@mappedin/mappedin-js 6.16.0 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_LICENSES.txt +24 -30
- package/lib/esm/{GLTFExporter-T4HNKLW3.js → GLTFExporter-WJIVKLX5.js} +1 -1
- package/lib/esm/{GLTFLoader-X5U6TBQB.js → GLTFLoader-UVI44S2F.js} +1 -1
- package/lib/esm/chunk-DWA5ATYZ.js +1 -0
- package/lib/esm/chunk-I6I3EXJN.js +1 -0
- package/lib/esm/chunk-IGHVNMJ3.js +1 -0
- package/lib/esm/chunk-QV35JDEX.js +1 -0
- package/lib/esm/{chunk-7LMDPH6B.js → chunk-QYWRASNF.js} +1 -1
- package/lib/esm/{chunk-W3AKKIQV.js → chunk-VBXAQAZN.js} +1 -1
- package/lib/esm/index.css +1 -1
- package/lib/esm/index.d.ts +19699 -20093
- package/lib/esm/index.js +1 -1
- package/lib/esm/inspector-47NR3USD.js +1 -0
- package/lib/esm/inspector-YWC6NP6D.css +1 -0
- package/lib/esm/internal-HBF7XZ6U.js +1 -0
- package/lib/esm/internal-QC6SWNN2.css +1 -0
- package/lib/esm/{roboto-regular-ERMR6E6W.js → roboto-regular-MRBWMLOE.js} +1 -1
- package/lib/esm/src-GA2Z4OON.css +1 -0
- package/lib/esm/src-QBZJI5BR.js +1 -0
- package/lib/esm/{text3d-EFUP5FMA.js → text3d-I6QPYM5K.js} +1 -1
- package/lib/esm/workers/collision-worker.csp.js +1 -1
- package/lib/index.css +1 -1
- package/package.json +1 -1
- package/lib/esm/chunk-2ZRUONOD.js +0 -1
- package/lib/esm/chunk-5W2UDR4H.js +0 -1
- package/lib/esm/chunk-RUZQ2KUL.js +0 -1
- package/lib/esm/inspector-A7WF4M5K.js +0 -1
- package/lib/esm/inspector-SKFFAA23.css +0 -1
- package/lib/esm/internal-BQXLERG7.css +0 -1
- package/lib/esm/internal-UAV7IGIX.js +0 -1
- package/lib/esm/text3d-M57DIX3E.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as qs}from"./chunk-VBXAQAZN.js";import{$ as Kt,C as Gh,D as ny,Ka as ly,Ma as uy,Na as hy,O as ao,Oa as cy,Ta as py,V as Xh,W as We,X as Pn,Z as Ir,_ as qh,a as O,aa as Ri,b as Q,ca as Sn,d as jh,e as ty,f as Uh,ga as Yr,ha as ay,i as no,nb as Xs,r as iy,sa as oy,u as ry,ya as sy}from"./chunk-QYWRASNF.js";import{a as zt,b as bi,c as ey,e as F2,g as B2,h as k,i as Xt,j as zi,k as wi}from"./chunk-IGHVNMJ3.js";var c2=F2((OW,Cs)=>{"use strict";O();var cN=!1,$n=!1,n2=!0,a2=!1,m={},o2=!1;typeof Cs<"u"&&Cs.exports?(Cs.exports=m,o2=!0):typeof document<"u"?window.ClipperLib=m:self.ClipperLib=m;var vh;o2?(Et="chrome",vh="Netscape"):(Et=navigator.userAgent.toString().toLowerCase(),vh=navigator.appName);var Et,Ee={};Et.indexOf("chrome")!=-1&&Et.indexOf("chromium")==-1?Ee.chrome=1:Ee.chrome=0;Et.indexOf("chromium")!=-1?Ee.chromium=1:Ee.chromium=0;Et.indexOf("safari")!=-1&&Et.indexOf("chrome")==-1&&Et.indexOf("chromium")==-1?Ee.safari=1:Ee.safari=0;Et.indexOf("firefox")!=-1?Ee.firefox=1:Ee.firefox=0;Et.indexOf("firefox/17")!=-1?Ee.firefox17=1:Ee.firefox17=0;Et.indexOf("firefox/15")!=-1?Ee.firefox15=1:Ee.firefox15=0;Et.indexOf("firefox/3")!=-1?Ee.firefox3=1:Ee.firefox3=0;Et.indexOf("opera")!=-1?Ee.opera=1:Ee.opera=0;Et.indexOf("msie 10")!=-1?Ee.msie10=1:Ee.msie10=0;Et.indexOf("msie 9")!=-1?Ee.msie9=1:Ee.msie9=0;Et.indexOf("msie 8")!=-1?Ee.msie8=1:Ee.msie8=0;Et.indexOf("msie 7")!=-1?Ee.msie7=1:Ee.msie7=0;Et.indexOf("msie ")!=-1?Ee.msie=1:Ee.msie=0;m.biginteger_used=null;var gn,pN=0xdeadbeefcafe,i2=(pN&16777215)==15715070;function Y(e,t,i){m.biginteger_used=1,e!=null&&(typeof e=="number"&&typeof t>"u"?this.fromInt(e):typeof e=="number"?this.fromNumber(e,t,i):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function ze(){return new Y(null)}function dN(e,t,i,r,n,a){for(;--a>=0;){var o=t*this[e++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=o&67108863}return n}function fN(e,t,i,r,n,a){for(var o=t&32767,s=t>>15;--a>=0;){var l=this[e]&32767,u=this[e++]>>15,h=s*l+u*o;l=o*l+((h&32767)<<15)+i[r]+(n&1073741823),n=(l>>>30)+(h>>>15)+s*u+(n>>>30),i[r++]=l&1073741823}return n}function mN(e,t,i,r,n,a){for(var o=t&16383,s=t>>14;--a>=0;){var l=this[e]&16383,u=this[e++]>>14,h=s*l+u*o;l=o*l+((h&16383)<<14)+i[r]+n,n=(l>>28)+(h>>14)+s*u,i[r++]=l&268435455}return n}i2&&vh=="Microsoft Internet Explorer"?(Y.prototype.am=fN,gn=30):i2&&vh!="Netscape"?(Y.prototype.am=dN,gn=26):(Y.prototype.am=mN,gn=28);Y.prototype.DB=gn;Y.prototype.DM=(1<<gn)-1;Y.prototype.DV=1<<gn;var Uf=52;Y.prototype.FV=Math.pow(2,Uf);Y.prototype.F1=Uf-gn;Y.prototype.F2=2*gn-Uf;var yN="0123456789abcdefghijklmnopqrstuvwxyz",wh=new Array,Za,Di;Za=48;for(Di=0;Di<=9;++Di)wh[Za++]=Di;Za=97;for(Di=10;Di<36;++Di)wh[Za++]=Di;Za=65;for(Di=10;Di<36;++Di)wh[Za++]=Di;function r2(e){return yN.charAt(e)}function s2(e,t){var i=wh[e.charCodeAt(t)];return i==null?-1:i}function gN(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function _N(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function yn(e){var t=ze();return t.fromInt(e),t}function xN(e,t){var i;if(t==16)i=4;else if(t==8)i=3;else if(t==256)i=8;else if(t==2)i=1;else if(t==32)i=5;else if(t==4)i=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,n=!1,a=0;--r>=0;){var o=i==8?e[r]&255:s2(e,r);if(o<0){e.charAt(r)=="-"&&(n=!0);continue}n=!1,a==0?this[this.t++]=o:a+i>this.DB?(this[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this[this.t++]=o>>this.DB-a):this[this.t-1]|=o<<a,a+=i,a>=this.DB&&(a-=this.DB)}i==8&&(e[0]&128)!=0&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),n&&Y.ZERO.subTo(this,this)}function vN(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function bN(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var i=(1<<t)-1,r,n=!1,a="",o=this.t,s=this.DB-o*this.DB%t;if(o-- >0)for(s<this.DB&&(r=this[o]>>s)>0&&(n=!0,a=r2(r));o>=0;)s<t?(r=(this[o]&(1<<s)-1)<<t-s,r|=this[--o]>>(s+=this.DB-t)):(r=this[o]>>(s-=t)&i,s<=0&&(s+=this.DB,--o)),r>0&&(n=!0),n&&(a+=r2(r));return n?a:"0"}function wN(){var e=ze();return Y.ZERO.subTo(this,e),e}function PN(){return this.s<0?this.negate():this}function SN(e){var t=this.s-e.s;if(t!=0)return t;var i=this.t;if(t=i-e.t,t!=0)return this.s<0?-t:t;for(;--i>=0;)if((t=this[i]-e[i])!=0)return t;return 0}function Ph(e){var t=1,i;return(i=e>>>16)!=0&&(e=i,t+=16),(i=e>>8)!=0&&(e=i,t+=8),(i=e>>4)!=0&&(e=i,t+=4),(i=e>>2)!=0&&(e=i,t+=2),(i=e>>1)!=0&&(e=i,t+=1),t}function TN(){return this.t<=0?0:this.DB*(this.t-1)+Ph(this[this.t-1]^this.s&this.DM)}function MN(e,t){var i;for(i=this.t-1;i>=0;--i)t[i+e]=this[i];for(i=e-1;i>=0;--i)t[i]=0;t.t=this.t+e,t.s=this.s}function CN(e,t){for(var i=e;i<this.t;++i)t[i-e]=this[i];t.t=Math.max(this.t-e,0),t.s=this.s}function IN(e,t){var i=e%this.DB,r=this.DB-i,n=(1<<r)-1,a=Math.floor(e/this.DB),o=this.s<<i&this.DM,s;for(s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>r|o,o=(this[s]&n)<<i;for(s=a-1;s>=0;--s)t[s]=0;t[a]=o,t.t=this.t+a+1,t.s=this.s,t.clamp()}function AN(e,t){t.s=this.s;var i=Math.floor(e/this.DB);if(i>=this.t){t.t=0;return}var r=e%this.DB,n=this.DB-r,a=(1<<r)-1;t[0]=this[i]>>r;for(var o=i+1;o<this.t;++o)t[o-i-1]|=(this[o]&a)<<n,t[o-i]=this[o]>>r;r>0&&(t[this.t-i-1]|=(this.s&a)<<n),t.t=this.t-i,t.clamp()}function EN(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]-e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r-=e[i],t[i++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[i++]=this.DV+r:r>0&&(t[i++]=r),t.t=i,t.clamp()}function kN(e,t){var i=this.abs(),r=e.abs(),n=i.t;for(t.t=n+r.t;--n>=0;)t[n]=0;for(n=0;n<r.t;++n)t[n+i.t]=i.am(0,r[n],t,n,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&Y.ZERO.subTo(t,t)}function DN(e){for(var t=this.abs(),i=e.t=2*t.t;--i>=0;)e[i]=0;for(i=0;i<t.t-1;++i){var r=t.am(i,t[i],e,2*i,0,1);(e[i+t.t]+=t.am(i+1,2*t[i],e,2*i+1,r,t.t-i-1))>=t.DV&&(e[i+t.t]-=t.DV,e[i+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(i,t[i],e,2*i,0,1)),e.s=0,e.clamp()}function LN(e,t,i){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t!=null&&t.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=ze());var a=ze(),o=this.s,s=e.s,l=this.DB-Ph(r[r.t-1]);l>0?(r.lShiftTo(l,a),n.lShiftTo(l,i)):(r.copyTo(a),n.copyTo(i));var u=a.t,h=a[u-1];if(h!=0){var c=h*(1<<this.F1)+(u>1?a[u-2]>>this.F2:0),p=this.FV/c,d=(1<<this.F1)/c,f=1<<this.F2,y=i.t,g=y-u,_=t==null?ze():t;for(a.dlShiftTo(g,_),i.compareTo(_)>=0&&(i[i.t++]=1,i.subTo(_,i)),Y.ONE.dlShiftTo(u,_),_.subTo(a,a);a.t<u;)a[a.t++]=0;for(;--g>=0;){var b=i[--y]==h?this.DM:Math.floor(i[y]*p+(i[y-1]+f)*d);if((i[y]+=a.am(0,b,i,g,0,u))<b)for(a.dlShiftTo(g,_),i.subTo(_,i);i[y]<--b;)i.subTo(_,i)}t!=null&&(i.drShiftTo(u,t),o!=s&&Y.ZERO.subTo(t,t)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),o<0&&Y.ZERO.subTo(i,i)}}}function zN(e){var t=ze();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(Y.ZERO)>0&&e.subTo(t,t),t}function Zn(e){this.m=e}function RN(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function FN(e){return e}function BN(e){e.divRemTo(this.m,null,e)}function ON(e,t,i){e.multiplyTo(t,i),this.reduce(i)}function NN(e,t){e.squareTo(t),this.reduce(t)}Zn.prototype.convert=RN;Zn.prototype.revert=FN;Zn.prototype.reduce=BN;Zn.prototype.mulTo=ON;Zn.prototype.sqrTo=NN;function VN(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Yn(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function jN(e){var t=ze();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Y.ZERO)>0&&this.m.subTo(t,t),t}function UN(e){var t=ze();return e.copyTo(t),this.reduce(t),t}function GN(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var i=e[t]&32767,r=i*this.mpl+((i*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(i=t+this.m.t,e[i]+=this.m.am(0,r,e,t,0,this.m.t);e[i]>=e.DV;)e[i]-=e.DV,e[++i]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function XN(e,t){e.squareTo(t),this.reduce(t)}function qN(e,t,i){e.multiplyTo(t,i),this.reduce(i)}Yn.prototype.convert=jN;Yn.prototype.revert=UN;Yn.prototype.reduce=GN;Yn.prototype.mulTo=qN;Yn.prototype.sqrTo=XN;function $N(){return(this.t>0?this[0]&1:this.s)==0}function ZN(e,t){if(e>4294967295||e<1)return Y.ONE;var i=ze(),r=ze(),n=t.convert(this),a=Ph(e)-1;for(n.copyTo(i);--a>=0;)if(t.sqrTo(i,r),(e&1<<a)>0)t.mulTo(r,n,i);else{var o=i;i=r,r=o}return t.revert(i)}function YN(e,t){var i;return e<256||t.isEven()?i=new Zn(t):i=new Yn(t),this.exp(e,i)}Y.prototype.copyTo=gN;Y.prototype.fromInt=_N;Y.prototype.fromString=xN;Y.prototype.clamp=vN;Y.prototype.dlShiftTo=MN;Y.prototype.drShiftTo=CN;Y.prototype.lShiftTo=IN;Y.prototype.rShiftTo=AN;Y.prototype.subTo=EN;Y.prototype.multiplyTo=kN;Y.prototype.squareTo=DN;Y.prototype.divRemTo=LN;Y.prototype.invDigit=VN;Y.prototype.isEven=$N;Y.prototype.exp=ZN;Y.prototype.toString=bN;Y.prototype.negate=wN;Y.prototype.abs=PN;Y.prototype.compareTo=SN;Y.prototype.bitLength=TN;Y.prototype.mod=zN;Y.prototype.modPowInt=YN;Y.ZERO=yn(0);Y.ONE=yn(1);function WN(){var e=ze();return this.copyTo(e),e}function HN(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function KN(){return this.t==0?this.s:this[0]<<24>>24}function JN(){return this.t==0?this.s:this[0]<<16>>16}function QN(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function e8(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function t8(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),i=Math.pow(e,t),r=yn(i),n=ze(),a=ze(),o="";for(this.divRemTo(r,n,a);n.signum()>0;)o=(i+a.intValue()).toString(e).substr(1)+o,n.divRemTo(r,n,a);return a.intValue().toString(e)+o}function i8(e,t){this.fromInt(0),t==null&&(t=10);for(var i=this.chunkSize(t),r=Math.pow(t,i),n=!1,a=0,o=0,s=0;s<e.length;++s){var l=s2(e,s);if(l<0){e.charAt(s)=="-"&&this.signum()==0&&(n=!0);continue}o=t*o+l,++a>=i&&(this.dMultiply(r),this.dAddOffset(o,0),a=0,o=0)}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(o,0)),n&&Y.ZERO.subTo(this,this)}function r8(e,t,i){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,i),this.testBit(e-1)||this.bitwiseTo(Y.ONE.shiftLeft(e-1),Gf,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(Y.ONE.shiftLeft(e-1),this);else{var r=new Array,n=e&7;r.length=(e>>3)+1,t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}}function n8(){var e=this.t,t=new Array;t[0]=this.s;var i=this.DB-e*this.DB%8,r,n=0;if(e-- >0)for(i<this.DB&&(r=this[e]>>i)!=(this.s&this.DM)>>i&&(t[n++]=r|this.s<<this.DB-i);e>=0;)i<8?(r=(this[e]&(1<<i)-1)<<8-i,r|=this[--e]>>(i+=this.DB-8)):(r=this[e]>>(i-=8)&255,i<=0&&(i+=this.DB,--e)),(r&128)!=0&&(r|=-256),n==0&&(this.s&128)!=(r&128)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t}function a8(e){return this.compareTo(e)==0}function o8(e){return this.compareTo(e)<0?this:e}function s8(e){return this.compareTo(e)>0?this:e}function l8(e,t,i){var r,n,a=Math.min(e.t,this.t);for(r=0;r<a;++r)i[r]=t(this[r],e[r]);if(e.t<this.t){for(n=e.s&this.DM,r=a;r<this.t;++r)i[r]=t(this[r],n);i.t=this.t}else{for(n=this.s&this.DM,r=a;r<e.t;++r)i[r]=t(n,e[r]);i.t=e.t}i.s=t(this.s,e.s),i.clamp()}function u8(e,t){return e&t}function h8(e){var t=ze();return this.bitwiseTo(e,u8,t),t}function Gf(e,t){return e|t}function c8(e){var t=ze();return this.bitwiseTo(e,Gf,t),t}function l2(e,t){return e^t}function p8(e){var t=ze();return this.bitwiseTo(e,l2,t),t}function u2(e,t){return e&~t}function d8(e){var t=ze();return this.bitwiseTo(e,u2,t),t}function f8(){for(var e=ze(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function m8(e){var t=ze();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function y8(e){var t=ze();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function g8(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function _8(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+g8(this[e]);return this.s<0?this.t*this.DB:-1}function x8(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function v8(){for(var e=0,t=this.s&this.DM,i=0;i<this.t;++i)e+=x8(this[i]^t);return e}function b8(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function w8(e,t){var i=Y.ONE.shiftLeft(e);return this.bitwiseTo(i,t,i),i}function P8(e){return this.changeBit(e,Gf)}function S8(e){return this.changeBit(e,u2)}function T8(e){return this.changeBit(e,l2)}function M8(e,t){for(var i=0,r=0,n=Math.min(e.t,this.t);i<n;)r+=this[i]+e[i],t[i++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;i<this.t;)r+=this[i],t[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<e.t;)r+=e[i],t[i++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[i++]=r:r<-1&&(t[i++]=this.DV+r),t.t=i,t.clamp()}function C8(e){var t=ze();return this.addTo(e,t),t}function I8(e){var t=ze();return this.subTo(e,t),t}function A8(e){var t=ze();return this.multiplyTo(e,t),t}function E8(){var e=ze();return this.squareTo(e),e}function k8(e){var t=ze();return this.divRemTo(e,t,null),t}function D8(e){var t=ze();return this.divRemTo(e,null,t),t}function L8(e){var t=ze(),i=ze();return this.divRemTo(e,t,i),new Array(t,i)}function z8(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function R8(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function Is(){}function h2(e){return e}function F8(e,t,i){e.multiplyTo(t,i)}function B8(e,t){e.squareTo(t)}Is.prototype.convert=h2;Is.prototype.revert=h2;Is.prototype.mulTo=F8;Is.prototype.sqrTo=B8;function O8(e){return this.exp(e,new Is)}function N8(e,t,i){var r=Math.min(this.t+e.t,t);for(i.s=0,i.t=r;r>0;)i[--r]=0;var n;for(n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,e[r],i,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e[r],i,r,0,t-r);i.clamp()}function V8(e,t,i){--t;var r=i.t=this.t+e.t-t;for(i.s=0;--r>=0;)i[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)i[this.t+r-t]=this.am(t-r,e[r],i,0,0,this.t+r-t);i.clamp(),i.drShiftTo(1,i)}function Ya(e){this.r2=ze(),this.q3=ze(),Y.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function j8(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=ze();return e.copyTo(t),this.reduce(t),t}function U8(e){return e}function G8(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function X8(e,t){e.squareTo(t),this.reduce(t)}function q8(e,t,i){e.multiplyTo(t,i),this.reduce(i)}Ya.prototype.convert=j8;Ya.prototype.revert=U8;Ya.prototype.reduce=G8;Ya.prototype.mulTo=q8;Ya.prototype.sqrTo=X8;function $8(e,t){var i=e.bitLength(),r,n=yn(1),a;if(i<=0)return n;i<18?r=1:i<48?r=3:i<144?r=4:i<768?r=5:r=6,i<8?a=new Zn(t):t.isEven()?a=new Ya(t):a=new Yn(t);var o=new Array,s=3,l=r-1,u=(1<<r)-1;if(o[1]=a.convert(this),r>1){var h=ze();for(a.sqrTo(o[1],h);s<=u;)o[s]=ze(),a.mulTo(h,o[s-2],o[s]),s+=2}var c=e.t-1,p,d=!0,f=ze(),y;for(i=Ph(e[c])-1;c>=0;){for(i>=l?p=e[c]>>i-l&u:(p=(e[c]&(1<<i+1)-1)<<l-i,c>0&&(p|=e[c-1]>>this.DB+i-l)),s=r;(p&1)==0;)p>>=1,--s;if((i-=s)<0&&(i+=this.DB,--c),d)o[p].copyTo(n),d=!1;else{for(;s>1;)a.sqrTo(n,f),a.sqrTo(f,n),s-=2;s>0?a.sqrTo(n,f):(y=n,n=f,f=y),a.mulTo(f,o[p],n)}for(;c>=0&&(e[c]&1<<i)==0;)a.sqrTo(n,f),y=n,n=f,f=y,--i<0&&(i=this.DB-1,--c)}return a.revert(n)}function Z8(e){var t=this.s<0?this.negate():this.clone(),i=e.s<0?e.negate():e.clone();if(t.compareTo(i)<0){var r=t;t=i,i=r}var n=t.getLowestSetBit(),a=i.getLowestSetBit();if(a<0)return t;for(n<a&&(a=n),a>0&&(t.rShiftTo(a,t),i.rShiftTo(a,i));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),t.compareTo(i)>=0?(t.subTo(i,t),t.rShiftTo(1,t)):(i.subTo(t,i),i.rShiftTo(1,i));return a>0&&i.lShiftTo(a,i),i}function Y8(e){if(e<=0)return 0;var t=this.DV%e,i=this.s<0?e-1:0;if(this.t>0)if(t==0)i=this[0]%e;else for(var r=this.t-1;r>=0;--r)i=(t*i+this[r])%e;return i}function W8(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return Y.ZERO;for(var i=e.clone(),r=this.clone(),n=yn(1),a=yn(0),o=yn(0),s=yn(1);i.signum()!=0;){for(;i.isEven();)i.rShiftTo(1,i),t?((!n.isEven()||!a.isEven())&&(n.addTo(this,n),a.subTo(e,a)),n.rShiftTo(1,n)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;r.isEven();)r.rShiftTo(1,r),t?((!o.isEven()||!s.isEven())&&(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);i.compareTo(r)>=0?(i.subTo(r,i),t&&n.subTo(o,n),a.subTo(s,a)):(r.subTo(i,r),t&&o.subTo(n,o),s.subTo(a,s))}if(r.compareTo(Y.ONE)!=0)return Y.ZERO;if(s.compareTo(e)>=0)return s.subtract(e);if(s.signum()<0)s.addTo(e,s);else return s;return s.signum()<0?s.add(e):s}var Yt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],H8=(1<<26)/Yt[Yt.length-1];function K8(e){var t,i=this.abs();if(i.t==1&&i[0]<=Yt[Yt.length-1]){for(t=0;t<Yt.length;++t)if(i[0]==Yt[t])return!0;return!1}if(i.isEven())return!1;for(t=1;t<Yt.length;){for(var r=Yt[t],n=t+1;n<Yt.length&&r<H8;)r*=Yt[n++];for(r=i.modInt(r);t<n;)if(r%Yt[t++]==0)return!1}return i.millerRabin(e)}function J8(e){var t=this.subtract(Y.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var r=t.shiftRight(i);e=e+1>>1,e>Yt.length&&(e=Yt.length);for(var n=ze(),a=0;a<e;++a){n.fromInt(Yt[Math.floor(Math.random()*Yt.length)]);var o=n.modPow(r,this);if(o.compareTo(Y.ONE)!=0&&o.compareTo(t)!=0){for(var s=1;s++<i&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(Y.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}Y.prototype.chunkSize=QN;Y.prototype.toRadix=t8;Y.prototype.fromRadix=i8;Y.prototype.fromNumber=r8;Y.prototype.bitwiseTo=l8;Y.prototype.changeBit=w8;Y.prototype.addTo=M8;Y.prototype.dMultiply=z8;Y.prototype.dAddOffset=R8;Y.prototype.multiplyLowerTo=N8;Y.prototype.multiplyUpperTo=V8;Y.prototype.modInt=Y8;Y.prototype.millerRabin=J8;Y.prototype.clone=WN;Y.prototype.intValue=HN;Y.prototype.byteValue=KN;Y.prototype.shortValue=JN;Y.prototype.signum=e8;Y.prototype.toByteArray=n8;Y.prototype.equals=a8;Y.prototype.min=o8;Y.prototype.max=s8;Y.prototype.and=h8;Y.prototype.or=c8;Y.prototype.xor=p8;Y.prototype.andNot=d8;Y.prototype.not=f8;Y.prototype.shiftLeft=m8;Y.prototype.shiftRight=y8;Y.prototype.getLowestSetBit=_8;Y.prototype.bitCount=v8;Y.prototype.testBit=b8;Y.prototype.setBit=P8;Y.prototype.clearBit=S8;Y.prototype.flipBit=T8;Y.prototype.add=C8;Y.prototype.subtract=I8;Y.prototype.multiply=A8;Y.prototype.divide=k8;Y.prototype.remainder=D8;Y.prototype.divideAndRemainder=L8;Y.prototype.modPow=$8;Y.prototype.modInverse=W8;Y.prototype.pow=O8;Y.prototype.gcd=Z8;Y.prototype.isProbablePrime=K8;Y.prototype.square=E8;var Ae=Y;Ae.prototype.IsNegative=function(){return this.compareTo(Ae.ZERO)==-1};Ae.op_Equality=function(e,t){return e.compareTo(t)==0};Ae.op_Inequality=function(e,t){return e.compareTo(t)!=0};Ae.op_GreaterThan=function(e,t){return e.compareTo(t)>0};Ae.op_LessThan=function(e,t){return e.compareTo(t)<0};Ae.op_Addition=function(e,t){return new Ae(e).add(new Ae(t))};Ae.op_Subtraction=function(e,t){return new Ae(e).subtract(new Ae(t))};Ae.Int128Mul=function(e,t){return new Ae(e).multiply(new Ae(t))};Ae.op_Division=function(e,t){return e.divide(t)};Ae.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof bh>"u"&&(bh=function(e,t){var i;if(typeof Object.getOwnPropertyNames>"u"){for(i in t.prototype)(typeof e.prototype[i]>"u"||e.prototype[i]==Object.prototype[i])&&(e.prototype[i]=t.prototype[i]);for(i in t)typeof e[i]>"u"&&(e[i]=t[i]);e.$baseCtor=t}else{for(var r=Object.getOwnPropertyNames(t.prototype),n=0;n<r.length;n++)typeof Object.getOwnPropertyDescriptor(e.prototype,r[n])>"u"&&Object.defineProperty(e.prototype,r[n],Object.getOwnPropertyDescriptor(t.prototype,r[n]));for(i in t)typeof e[i]>"u"&&(e[i]=t[i]);e.$baseCtor=t}});var bh;m.Path=function(){return[]};m.Paths=function(){return[]};m.DoublePoint=function(){var e=arguments;this.X=0,this.Y=0,e.length==1?(this.X=e[0].X,this.Y=e[0].Y):e.length==2&&(this.X=e[0],this.Y=e[1])};m.DoublePoint0=function(){this.X=0,this.Y=0};m.DoublePoint1=function(e){this.X=e.X,this.Y=e.Y};m.DoublePoint2=function(e,t){this.X=e,this.Y=t};m.PolyNode=function(){this.m_Parent=null,this.m_polygon=new m.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};m.PolyNode.prototype.IsHoleNode=function(){for(var e=!0,t=this.m_Parent;t!==null;)e=!e,t=t.m_Parent;return e};m.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};m.PolyNode.prototype.Contour=function(){return this.m_polygon};m.PolyNode.prototype.AddChild=function(e){var t=this.m_Childs.length;this.m_Childs.push(e),e.m_Parent=this,e.m_Index=t};m.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};m.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};m.PolyNode.prototype.Childs=function(){return this.m_Childs};m.PolyNode.prototype.Parent=function(){return this.m_Parent};m.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};m.PolyTree=function(){this.m_AllPolys=[],m.PolyNode.call(this)};m.PolyTree.prototype.Clear=function(){for(var e=0,t=this.m_AllPolys.length;e<t;e++)this.m_AllPolys[e]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};m.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};m.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};bh(m.PolyTree,m.PolyNode);m.Math_Abs_Int64=m.Math_Abs_Int32=m.Math_Abs_Double=function(e){return Math.abs(e)};m.Math_Max_Int32_Int32=function(e,t){return Math.max(e,t)};Ee.msie||Ee.opera||Ee.safari?m.Cast_Int32=function(e){return e|0}:m.Cast_Int32=function(e){return~~e};Ee.chrome?m.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):~~e}:Ee.firefox&&typeof Number.toInteger=="function"?m.Cast_Int64=function(e){return Number.toInteger(e)}:Ee.msie7||Ee.msie8?m.Cast_Int64=function(e){return parseInt(e,10)}:Ee.msie?m.Cast_Int64=function(e){return e<-2147483648||e>2147483647?e<0?Math.ceil(e):Math.floor(e):e|0}:m.Cast_Int64=function(e){return e<0?Math.ceil(e):Math.floor(e)};m.Clear=function(e){e.length=0};m.PI=3.141592653589793;m.PI2=2*3.141592653589793;m.IntPoint=function(){var e=arguments,t=e.length;if(this.X=0,this.Y=0,$n)if(this.Z=0,t==3)this.X=e[0],this.Y=e[1],this.Z=e[2];else if(t==2)this.X=e[0],this.Y=e[1],this.Z=0;else if(t==1)if(e[0]instanceof m.DoublePoint){var i=e[0];this.X=m.Clipper.Round(i.X),this.Y=m.Clipper.Round(i.Y),this.Z=0}else{var r=e[0];typeof r.Z>"u"&&(r.Z=0),this.X=r.X,this.Y=r.Y,this.Z=r.Z}else this.X=0,this.Y=0,this.Z=0;else if(t==2)this.X=e[0],this.Y=e[1];else if(t==1)if(e[0]instanceof m.DoublePoint){var i=e[0];this.X=m.Clipper.Round(i.X),this.Y=m.Clipper.Round(i.Y)}else{var r=e[0];this.X=r.X,this.Y=r.Y}else this.X=0,this.Y=0};m.IntPoint.op_Equality=function(e,t){return e.X==t.X&&e.Y==t.Y};m.IntPoint.op_Inequality=function(e,t){return e.X!=t.X||e.Y!=t.Y};$n?(m.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},m.IntPoint1=function(e){this.X=e.X,this.Y=e.Y,this.Z=e.Z},m.IntPoint1dp=function(e){this.X=m.Clipper.Round(e.X),this.Y=m.Clipper.Round(e.Y),this.Z=0},m.IntPoint2=function(e,t){this.X=e,this.Y=t,this.Z=0},m.IntPoint3=function(e,t,i){this.X=e,this.Y=t,this.Z=i}):(m.IntPoint0=function(){this.X=0,this.Y=0},m.IntPoint1=function(e){this.X=e.X,this.Y=e.Y},m.IntPoint1dp=function(e){this.X=m.Clipper.Round(e.X),this.Y=m.Clipper.Round(e.Y)},m.IntPoint2=function(e,t){this.X=e,this.Y=t});m.IntRect=function(){var e=arguments,t=e.length;t==4?(this.left=e[0],this.top=e[1],this.right=e[2],this.bottom=e[3]):t==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};m.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};m.IntRect1=function(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom};m.IntRect4=function(e,t,i,r){this.left=e,this.top=t,this.right=i,this.bottom=r};m.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};m.PolyType={ptSubject:0,ptClip:1};m.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};m.JoinType={jtSquare:0,jtRound:1,jtMiter:2};m.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};a2&&(m.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});m.EdgeSide={esLeft:0,esRight:1};m.Direction={dRightToLeft:0,dLeftToRight:1};m.TEdge=function(){this.Bot=new m.IntPoint,this.Curr=new m.IntPoint,this.Top=new m.IntPoint,this.Delta=new m.IntPoint,this.Dx=0,this.PolyTyp=m.PolyType.ptSubject,this.Side=m.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};m.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new m.IntPoint};m.MyIntersectNodeSort=function(){};m.MyIntersectNodeSort.Compare=function(e,t){return t.Pt.Y-e.Pt.Y};m.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};m.Scanbeam=function(){this.Y=0,this.Next=null};m.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};m.OutPt=function(){this.Idx=0,this.Pt=new m.IntPoint,this.Next=null,this.Prev=null};m.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new m.IntPoint};m.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};m.ClipperBase.horizontal=-9007199254740992;m.ClipperBase.Skip=-2;m.ClipperBase.Unassigned=-1;m.ClipperBase.tolerance=1e-20;cN?(m.ClipperBase.loRange=46340,m.ClipperBase.hiRange=46340):(m.ClipperBase.loRange=47453132,m.ClipperBase.hiRange=0xfffffffffffff);m.ClipperBase.near_zero=function(e){return e>-m.ClipperBase.tolerance&&e<m.ClipperBase.tolerance};m.ClipperBase.IsHorizontal=function(e){return e.Delta.Y===0};m.ClipperBase.prototype.PointIsVertex=function(e,t){var i=t;do{if(m.IntPoint.op_Equality(i.Pt,e))return!0;i=i.Next}while(i!=t);return!1};m.ClipperBase.prototype.PointOnLineSegment=function(e,t,i,r){return r?e.X==t.X&&e.Y==t.Y||e.X==i.X&&e.Y==i.Y||e.X>t.X==e.X<i.X&&e.Y>t.Y==e.Y<i.Y&&Ae.op_Equality(Ae.Int128Mul(e.X-t.X,i.Y-t.Y),Ae.Int128Mul(i.X-t.X,e.Y-t.Y)):e.X==t.X&&e.Y==t.Y||e.X==i.X&&e.Y==i.Y||e.X>t.X==e.X<i.X&&e.Y>t.Y==e.Y<i.Y&&(e.X-t.X)*(i.Y-t.Y)==(i.X-t.X)*(e.Y-t.Y)};m.ClipperBase.prototype.PointOnPolygon=function(e,t,i){for(var r=t;;){if(this.PointOnLineSegment(e,r.Pt,r.Next.Pt,i))return!0;if(r=r.Next,r==t)break}return!1};m.ClipperBase.prototype.SlopesEqual=m.ClipperBase.SlopesEqual=function(){var e=arguments,t=e.length,i,r,n,a,o,s,l;return t==3?(i=e[0],r=e[1],l=e[2],l?Ae.op_Equality(Ae.Int128Mul(i.Delta.Y,r.Delta.X),Ae.Int128Mul(i.Delta.X,r.Delta.Y)):m.Cast_Int64(i.Delta.Y*r.Delta.X)==m.Cast_Int64(i.Delta.X*r.Delta.Y)):t==4?(n=e[0],a=e[1],o=e[2],l=e[3],l?Ae.op_Equality(Ae.Int128Mul(n.Y-a.Y,a.X-o.X),Ae.Int128Mul(n.X-a.X,a.Y-o.Y)):m.Cast_Int64((n.Y-a.Y)*(a.X-o.X))-m.Cast_Int64((n.X-a.X)*(a.Y-o.Y))===0):(n=e[0],a=e[1],o=e[2],s=e[3],l=e[4],l?Ae.op_Equality(Ae.Int128Mul(n.Y-a.Y,o.X-s.X),Ae.Int128Mul(n.X-a.X,o.Y-s.Y)):m.Cast_Int64((n.Y-a.Y)*(o.X-s.X))-m.Cast_Int64((n.X-a.X)*(o.Y-s.Y))===0)};m.ClipperBase.SlopesEqual3=function(e,t,i){return i?Ae.op_Equality(Ae.Int128Mul(e.Delta.Y,t.Delta.X),Ae.Int128Mul(e.Delta.X,t.Delta.Y)):m.Cast_Int64(e.Delta.Y*t.Delta.X)==m.Cast_Int64(e.Delta.X*t.Delta.Y)};m.ClipperBase.SlopesEqual4=function(e,t,i,r){return r?Ae.op_Equality(Ae.Int128Mul(e.Y-t.Y,t.X-i.X),Ae.Int128Mul(e.X-t.X,t.Y-i.Y)):m.Cast_Int64((e.Y-t.Y)*(t.X-i.X))-m.Cast_Int64((e.X-t.X)*(t.Y-i.Y))===0};m.ClipperBase.SlopesEqual5=function(e,t,i,r,n){return n?Ae.op_Equality(Ae.Int128Mul(e.Y-t.Y,i.X-r.X),Ae.Int128Mul(e.X-t.X,i.Y-r.Y)):m.Cast_Int64((e.Y-t.Y)*(i.X-r.X))-m.Cast_Int64((e.X-t.X)*(i.Y-r.Y))===0};m.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var e=0,t=this.m_edges.length;e<t;++e){for(var i=0,r=this.m_edges[e].length;i<r;++i)this.m_edges[e][i]=null;m.Clear(this.m_edges[e])}m.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};m.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var e=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=e}this.m_CurrentLM=null};m.ClipperBase.prototype.RangeTest=function(e,t){t.Value?(e.X>m.ClipperBase.hiRange||e.Y>m.ClipperBase.hiRange||-e.X>m.ClipperBase.hiRange||-e.Y>m.ClipperBase.hiRange)&&m.Error("Coordinate outside allowed range in RangeTest()."):(e.X>m.ClipperBase.loRange||e.Y>m.ClipperBase.loRange||-e.X>m.ClipperBase.loRange||-e.Y>m.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(e,t))};m.ClipperBase.prototype.InitEdge=function(e,t,i,r){e.Next=t,e.Prev=i,e.Curr.X=r.X,e.Curr.Y=r.Y,e.OutIdx=-1};m.ClipperBase.prototype.InitEdge2=function(e,t){e.Curr.Y>=e.Next.Curr.Y?(e.Bot.X=e.Curr.X,e.Bot.Y=e.Curr.Y,e.Top.X=e.Next.Curr.X,e.Top.Y=e.Next.Curr.Y):(e.Top.X=e.Curr.X,e.Top.Y=e.Curr.Y,e.Bot.X=e.Next.Curr.X,e.Bot.Y=e.Next.Curr.Y),this.SetDx(e),e.PolyTyp=t};m.ClipperBase.prototype.FindNextLocMin=function(e){for(var t;;){for(;m.IntPoint.op_Inequality(e.Bot,e.Prev.Bot)||m.IntPoint.op_Equality(e.Curr,e.Top);)e=e.Next;if(e.Dx!=m.ClipperBase.horizontal&&e.Prev.Dx!=m.ClipperBase.horizontal)break;for(;e.Prev.Dx==m.ClipperBase.horizontal;)e=e.Prev;for(t=e;e.Dx==m.ClipperBase.horizontal;)e=e.Next;if(e.Top.Y!=e.Prev.Bot.Y){t.Prev.Bot.X<e.Bot.X&&(e=t);break}}return e};m.ClipperBase.prototype.ProcessBound=function(e,t){var i=e,r=e,n,a;if(e.Dx==m.ClipperBase.horizontal&&(t?a=e.Prev.Bot.X:a=e.Next.Bot.X,e.Bot.X!=a&&this.ReverseHorizontal(e)),r.OutIdx!=m.ClipperBase.Skip)if(t){for(;r.Top.Y==r.Next.Bot.Y&&r.Next.OutIdx!=m.ClipperBase.Skip;)r=r.Next;if(r.Dx==m.ClipperBase.horizontal&&r.Next.OutIdx!=m.ClipperBase.Skip){for(n=r;n.Prev.Dx==m.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==r.Next.Top.X?t||(r=n.Prev):n.Prev.Top.X>r.Next.Top.X&&(r=n.Prev)}for(;e!=r;)e.NextInLML=e.Next,e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),e=e.Next;e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Prev.Top.X&&this.ReverseHorizontal(e),r=r.Next}else{for(;r.Top.Y==r.Prev.Bot.Y&&r.Prev.OutIdx!=m.ClipperBase.Skip;)r=r.Prev;if(r.Dx==m.ClipperBase.horizontal&&r.Prev.OutIdx!=m.ClipperBase.Skip){for(n=r;n.Next.Dx==m.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==r.Prev.Top.X?t||(r=n.Next):n.Next.Top.X>r.Prev.Top.X&&(r=n.Next)}for(;e!=r;)e.NextInLML=e.Prev,e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),e=e.Prev;e.Dx==m.ClipperBase.horizontal&&e!=i&&e.Bot.X!=e.Next.Top.X&&this.ReverseHorizontal(e),r=r.Prev}if(r.OutIdx==m.ClipperBase.Skip){if(e=r,t){for(;e.Top.Y==e.Next.Bot.Y;)e=e.Next;for(;e!=r&&e.Dx==m.ClipperBase.horizontal;)e=e.Prev}else{for(;e.Top.Y==e.Prev.Bot.Y;)e=e.Prev;for(;e!=r&&e.Dx==m.ClipperBase.horizontal;)e=e.Next}if(e==r)t?r=e.Next:r=e.Prev;else{t?e=r.Next:e=r.Prev;var o=new m.LocalMinima;o.Next=null,o.Y=e.Bot.Y,o.LeftBound=null,o.RightBound=e,o.RightBound.WindDelta=0,r=this.ProcessBound(o.RightBound,t),this.InsertLocalMinima(o)}}return r};m.ClipperBase.prototype.AddPath=function(e,t,i){n2?!i&&t==m.PolyType.ptClip&&m.Error("AddPath: Open paths must be subject."):i||m.Error("AddPath: Open paths have been disabled.");var r=e.length-1;if(i)for(;r>0&&m.IntPoint.op_Equality(e[r],e[0]);)--r;for(;r>0&&m.IntPoint.op_Equality(e[r],e[r-1]);)--r;if(i&&r<2||!i&&r<1)return!1;for(var n=new Array,a=0;a<=r;a++)n.push(new m.TEdge);var o=!0;n[1].Curr.X=e[1].X,n[1].Curr.Y=e[1].Y;var s={Value:this.m_UseFullRange};this.RangeTest(e[0],s),this.m_UseFullRange=s.Value,s.Value=this.m_UseFullRange,this.RangeTest(e[r],s),this.m_UseFullRange=s.Value,this.InitEdge(n[0],n[1],n[r],e[0]),this.InitEdge(n[r],n[0],n[r-1],e[r]);for(var a=r-1;a>=1;--a)s.Value=this.m_UseFullRange,this.RangeTest(e[a],s),this.m_UseFullRange=s.Value,this.InitEdge(n[a],n[a+1],n[a-1],e[a]);for(var l=n[0],u=l,h=l;;){if(m.IntPoint.op_Equality(u.Curr,u.Next.Curr)){if(u==u.Next)break;u==l&&(l=u.Next),u=this.RemoveEdge(u),h=u;continue}if(u.Prev==u.Next)break;if(i&&m.ClipperBase.SlopesEqual(u.Prev.Curr,u.Curr,u.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(u.Prev.Curr,u.Curr,u.Next.Curr))){u==l&&(l=u.Next),u=this.RemoveEdge(u),u=u.Prev,h=u;continue}if(u=u.Next,u==h)break}if(!i&&u==u.Next||i&&u.Prev==u.Next)return!1;i||(this.m_HasOpenPaths=!0,l.Prev.OutIdx=m.ClipperBase.Skip);var c=l;u=l;do this.InitEdge2(u,t),u=u.Next,o&&u.Curr.Y!=l.Curr.Y&&(o=!1);while(u!=l);if(o){if(i)return!1;u.Prev.OutIdx=m.ClipperBase.Skip,u.Prev.Bot.X<u.Prev.Top.X&&this.ReverseHorizontal(u.Prev);var p=new m.LocalMinima;for(p.Next=null,p.Y=u.Bot.Y,p.LeftBound=null,p.RightBound=u,p.RightBound.Side=m.EdgeSide.esRight,p.RightBound.WindDelta=0;u.Next.OutIdx!=m.ClipperBase.Skip;)u.NextInLML=u.Next,u.Bot.X!=u.Prev.Top.X&&this.ReverseHorizontal(u),u=u.Next;return this.InsertLocalMinima(p),this.m_edges.push(n),!0}this.m_edges.push(n);for(var d,f=null;u=this.FindNextLocMin(u),u!=f;){f==null&&(f=u);var p=new m.LocalMinima;p.Next=null,p.Y=u.Bot.Y,u.Dx<u.Prev.Dx?(p.LeftBound=u.Prev,p.RightBound=u,d=!1):(p.LeftBound=u,p.RightBound=u.Prev,d=!0),p.LeftBound.Side=m.EdgeSide.esLeft,p.RightBound.Side=m.EdgeSide.esRight,i?p.LeftBound.Next==p.RightBound?p.LeftBound.WindDelta=-1:p.LeftBound.WindDelta=1:p.LeftBound.WindDelta=0,p.RightBound.WindDelta=-p.LeftBound.WindDelta,u=this.ProcessBound(p.LeftBound,d);var y=this.ProcessBound(p.RightBound,!d);p.LeftBound.OutIdx==m.ClipperBase.Skip?p.LeftBound=null:p.RightBound.OutIdx==m.ClipperBase.Skip&&(p.RightBound=null),this.InsertLocalMinima(p),d||(u=y)}return!0};m.ClipperBase.prototype.AddPaths=function(e,t,i){for(var r=!1,n=0,a=e.length;n<a;++n)this.AddPath(e[n],t,i)&&(r=!0);return r};m.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(e,t,i){return m.IntPoint.op_Equality(e,i)||m.IntPoint.op_Equality(e,t)||m.IntPoint.op_Equality(i,t)?!1:e.X!=i.X?t.X>e.X==t.X<i.X:t.Y>e.Y==t.Y<i.Y};m.ClipperBase.prototype.RemoveEdge=function(e){e.Prev.Next=e.Next,e.Next.Prev=e.Prev;var t=e.Next;return e.Prev=null,t};m.ClipperBase.prototype.SetDx=function(e){e.Delta.X=e.Top.X-e.Bot.X,e.Delta.Y=e.Top.Y-e.Bot.Y,e.Delta.Y===0?e.Dx=m.ClipperBase.horizontal:e.Dx=e.Delta.X/e.Delta.Y};m.ClipperBase.prototype.InsertLocalMinima=function(e){if(this.m_MinimaList===null)this.m_MinimaList=e;else if(e.Y>=this.m_MinimaList.Y)e.Next=this.m_MinimaList,this.m_MinimaList=e;else{for(var t=this.m_MinimaList;t.Next!==null&&e.Y<t.Next.Y;)t=t.Next;e.Next=t.Next,t.Next=e}};m.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};m.ClipperBase.prototype.ReverseHorizontal=function(e){var t=e.Top.X;e.Top.X=e.Bot.X,e.Bot.X=t,$n&&(t=e.Top.Z,e.Top.Z=e.Bot.Z,e.Bot.Z=t)};m.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var e=this.m_MinimaList;e!=null;){var t=e.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=m.EdgeSide.esLeft,t.OutIdx=m.ClipperBase.Unassigned),t=e.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=m.EdgeSide.esRight,t.OutIdx=m.ClipperBase.Unassigned),e=e.Next}};m.Clipper=function(e){typeof e>"u"&&(e=0),this.m_PolyOuts=null,this.m_ClipType=m.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=m.PolyFillType.pftEvenOdd,this.m_SubjFillType=m.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,m.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=m.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&e)!==0,this.StrictlySimple=(2&e)!==0,this.PreserveCollinear=(4&e)!==0,$n&&(this.ZFillFunction=null)};m.Clipper.ioReverseSolution=1;m.Clipper.ioStrictlySimple=2;m.Clipper.ioPreserveCollinear=4;m.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),m.ClipperBase.prototype.Clear.call(this))};m.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var e=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=e}};m.Clipper.prototype.Reset=function(){m.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var e=this.m_MinimaList;e!==null;)this.InsertScanbeam(e.Y),e=e.Next};m.Clipper.prototype.InsertScanbeam=function(e){if(this.m_Scanbeam===null)this.m_Scanbeam=new m.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=e;else if(e>this.m_Scanbeam.Y){var t=new m.Scanbeam;t.Y=e,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var i=this.m_Scanbeam;i.Next!==null&&e<=i.Next.Y;)i=i.Next;if(e==i.Y)return;var t=new m.Scanbeam;t.Y=e,t.Next=i.Next,i.Next=t}};m.Clipper.prototype.Execute=function(){var e=arguments,t=e.length,i=e[1]instanceof m.PolyTree;if(t==4&&!i){var r=e[0],n=e[1],a=e[2],o=e[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&m.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,m.Clear(n),this.m_SubjFillType=a,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!1;try{var s=this.ExecuteInternal();s&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return s}else if(t==4&&i){var r=e[0],l=e[1],a=e[2],o=e[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=a,this.m_ClipFillType=o,this.m_ClipType=r,this.m_UsingPolyTree=!0;try{var s=this.ExecuteInternal();s&&this.BuildResult2(l)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return s}else if(t==2&&!i){var r=e[0],n=e[1];return this.Execute(r,n,m.PolyFillType.pftEvenOdd,m.PolyFillType.pftEvenOdd)}else if(t==2&&i){var r=e[0],l=e[1];return this.Execute(r,l,m.PolyFillType.pftEvenOdd,m.PolyFillType.pftEvenOdd)}};m.Clipper.prototype.FixHoleLinkage=function(e){if(!(e.FirstLeft===null||e.IsHole!=e.FirstLeft.IsHole&&e.FirstLeft.Pts!==null)){for(var t=e.FirstLeft;t!==null&&(t.IsHole==e.IsHole||t.Pts===null);)t=t.FirstLeft;e.FirstLeft=t}};m.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var e=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(e),m.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(e,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),e=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{m.Clear(this.m_Joins),m.Clear(this.m_GhostJoins)}};m.Clipper.prototype.PopScanbeam=function(){var e=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,e};m.Clipper.prototype.DisposeAllPolyPts=function(){for(var e=0,t=this.m_PolyOuts.length;e<t;++e)this.DisposeOutRec(e);m.Clear(this.m_PolyOuts)};m.Clipper.prototype.DisposeOutRec=function(e){var t=this.m_PolyOuts[e];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[e]=null};m.Clipper.prototype.DisposeOutPts=function(e){if(e!==null){var t=null;for(e.Prev.Next=null;e!==null;)t=e,e=e.Next,t=null}};m.Clipper.prototype.AddJoin=function(e,t,i){var r=new m.Join;r.OutPt1=e,r.OutPt2=t,r.OffPt.X=i.X,r.OffPt.Y=i.Y,this.m_Joins.push(r)};m.Clipper.prototype.AddGhostJoin=function(e,t){var i=new m.Join;i.OutPt1=e,i.OffPt.X=t.X,i.OffPt.Y=t.Y,this.m_GhostJoins.push(i)};$n&&(m.Clipper.prototype.SetZ=function(e,t){e.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,e):this.ZFillFunction(t.Top,t.Bot,e))});m.Clipper.prototype.InsertLocalMinimaIntoAEL=function(e){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==e;){var t=this.m_CurrentLM.LeftBound,i=this.m_CurrentLM.RightBound;this.PopLocalMinima();var r=null;if(t===null?(this.InsertEdgeIntoAEL(i,null),this.SetWindingCount(i),this.IsContributing(i)&&(r=this.AddOutPt(i,i.Bot))):i==null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(r=this.AddOutPt(t,t.Bot)),this.InsertScanbeam(t.Top.Y)):(this.InsertEdgeIntoAEL(t,null),this.InsertEdgeIntoAEL(i,t),this.SetWindingCount(t),i.WindCnt=t.WindCnt,i.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(r=this.AddLocalMinPoly(t,i,t.Bot)),this.InsertScanbeam(t.Top.Y)),i!=null&&(m.ClipperBase.IsHorizontal(i)?this.AddEdgeToSEL(i):this.InsertScanbeam(i.Top.Y)),!(t==null||i==null)){if(r!==null&&m.ClipperBase.IsHorizontal(i)&&this.m_GhostJoins.length>0&&i.WindDelta!==0)for(var n=0,a=this.m_GhostJoins.length;n<a;n++){var o=this.m_GhostJoins[n];this.HorzSegmentsOverlap(o.OutPt1.Pt,o.OffPt,i.Bot,i.Top)&&this.AddJoin(o.OutPt1,r,o.OffPt)}if(t.OutIdx>=0&&t.PrevInAEL!==null&&t.PrevInAEL.Curr.X==t.Bot.X&&t.PrevInAEL.OutIdx>=0&&m.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var s=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(r,s,t.Top)}if(t.NextInAEL!=i){if(i.OutIdx>=0&&i.PrevInAEL.OutIdx>=0&&m.ClipperBase.SlopesEqual(i.PrevInAEL,i,this.m_UseFullRange)&&i.WindDelta!==0&&i.PrevInAEL.WindDelta!==0){var s=this.AddOutPt(i.PrevInAEL,i.Bot);this.AddJoin(r,s,i.Top)}var l=t.NextInAEL;if(l!==null)for(;l!=i;)this.IntersectEdges(i,l,t.Curr,!1),l=l.NextInAEL}}}};m.Clipper.prototype.InsertEdgeIntoAEL=function(e,t){if(this.m_ActiveEdges===null)e.PrevInAEL=null,e.NextInAEL=null,this.m_ActiveEdges=e;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,e))e.PrevInAEL=null,e.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=e,this.m_ActiveEdges=e;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,e);)t=t.NextInAEL;e.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=e),e.PrevInAEL=t,t.NextInAEL=e}};m.Clipper.prototype.E2InsertsBeforeE1=function(e,t){return t.Curr.X==e.Curr.X?t.Top.Y>e.Top.Y?t.Top.X<m.Clipper.TopX(e,t.Top.Y):e.Top.X>m.Clipper.TopX(t,e.Top.Y):t.Curr.X<e.Curr.X};m.Clipper.prototype.IsEvenOddFillType=function(e){return e.PolyTyp==m.PolyType.ptSubject?this.m_SubjFillType==m.PolyFillType.pftEvenOdd:this.m_ClipFillType==m.PolyFillType.pftEvenOdd};m.Clipper.prototype.IsEvenOddAltFillType=function(e){return e.PolyTyp==m.PolyType.ptSubject?this.m_ClipFillType==m.PolyFillType.pftEvenOdd:this.m_SubjFillType==m.PolyFillType.pftEvenOdd};m.Clipper.prototype.IsContributing=function(e){var t,i;switch(e.PolyTyp==m.PolyType.ptSubject?(t=this.m_SubjFillType,i=this.m_ClipFillType):(t=this.m_ClipFillType,i=this.m_SubjFillType),t){case m.PolyFillType.pftEvenOdd:if(e.WindDelta===0&&e.WindCnt!=1)return!1;break;case m.PolyFillType.pftNonZero:if(Math.abs(e.WindCnt)!=1)return!1;break;case m.PolyFillType.pftPositive:if(e.WindCnt!=1)return!1;break;default:if(e.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case m.ClipType.ctIntersection:switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2!==0;case m.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case m.ClipType.ctUnion:switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}case m.ClipType.ctDifference:if(e.PolyTyp==m.PolyType.ptSubject)switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2!==0;case m.PolyFillType.pftPositive:return e.WindCnt2>0;default:return e.WindCnt2<0}case m.ClipType.ctXor:if(e.WindDelta===0)switch(i){case m.PolyFillType.pftEvenOdd:case m.PolyFillType.pftNonZero:return e.WindCnt2===0;case m.PolyFillType.pftPositive:return e.WindCnt2<=0;default:return e.WindCnt2>=0}else return!0}return!0};m.Clipper.prototype.SetWindingCount=function(e){for(var t=e.PrevInAEL;t!==null&&(t.PolyTyp!=e.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)e.WindCnt=e.WindDelta===0?1:e.WindDelta,e.WindCnt2=0,t=this.m_ActiveEdges;else if(e.WindDelta===0&&this.m_ClipType!=m.ClipType.ctUnion)e.WindCnt=1,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(e)){if(e.WindDelta===0){for(var i=!0,r=t.PrevInAEL;r!==null;)r.PolyTyp==t.PolyTyp&&r.WindDelta!==0&&(i=!i),r=r.PrevInAEL;e.WindCnt=i?0:1}else e.WindCnt=e.WindDelta;e.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta:e.WindCnt=e.WindDelta===0?1:e.WindDelta:e.WindDelta===0?e.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*e.WindDelta<0?e.WindCnt=t.WindCnt:e.WindCnt=t.WindCnt+e.WindDelta,e.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(e))for(;t!=e;)t.WindDelta!==0&&(e.WindCnt2=e.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=e;)e.WindCnt2+=t.WindDelta,t=t.NextInAEL};m.Clipper.prototype.AddEdgeToSEL=function(e){this.m_SortedEdges===null?(this.m_SortedEdges=e,e.PrevInSEL=null,e.NextInSEL=null):(e.NextInSEL=this.m_SortedEdges,e.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=e,this.m_SortedEdges=e)};m.Clipper.prototype.CopyAELToSEL=function(){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e=e.NextInAEL};m.Clipper.prototype.SwapPositionsInAEL=function(e,t){if(!(e.NextInAEL==e.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(e.NextInAEL==t){var i=t.NextInAEL;i!==null&&(i.PrevInAEL=e);var r=e.PrevInAEL;r!==null&&(r.NextInAEL=t),t.PrevInAEL=r,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=i}else if(t.NextInAEL==e){var i=e.NextInAEL;i!==null&&(i.PrevInAEL=t);var r=t.PrevInAEL;r!==null&&(r.NextInAEL=e),e.PrevInAEL=r,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=i}else{var i=e.NextInAEL,r=e.PrevInAEL;e.NextInAEL=t.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=t.PrevInAEL,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e),t.NextInAEL=i,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=r,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}e.PrevInAEL===null?this.m_ActiveEdges=e:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};m.Clipper.prototype.SwapPositionsInSEL=function(e,t){if(!(e.NextInSEL===null&&e.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(e.NextInSEL==t){var i=t.NextInSEL;i!==null&&(i.PrevInSEL=e);var r=e.PrevInSEL;r!==null&&(r.NextInSEL=t),t.PrevInSEL=r,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=i}else if(t.NextInSEL==e){var i=e.NextInSEL;i!==null&&(i.PrevInSEL=t);var r=t.PrevInSEL;r!==null&&(r.NextInSEL=e),e.PrevInSEL=r,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=i}else{var i=e.NextInSEL,r=e.PrevInSEL;e.NextInSEL=t.NextInSEL,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=t.PrevInSEL,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e),t.NextInSEL=i,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=r,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}e.PrevInSEL===null?this.m_SortedEdges=e:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};m.Clipper.prototype.AddLocalMaxPoly=function(e,t,i){this.AddOutPt(e,i),t.WindDelta==0&&this.AddOutPt(t,i),e.OutIdx==t.OutIdx?(e.OutIdx=-1,t.OutIdx=-1):e.OutIdx<t.OutIdx?this.AppendPolygon(e,t):this.AppendPolygon(t,e)};m.Clipper.prototype.AddLocalMinPoly=function(e,t,i){var r,n,a;if(m.ClipperBase.IsHorizontal(t)||e.Dx>t.Dx?(r=this.AddOutPt(e,i),t.OutIdx=e.OutIdx,e.Side=m.EdgeSide.esLeft,t.Side=m.EdgeSide.esRight,n=e,n.PrevInAEL==t?a=t.PrevInAEL:a=n.PrevInAEL):(r=this.AddOutPt(t,i),e.OutIdx=t.OutIdx,e.Side=m.EdgeSide.esRight,t.Side=m.EdgeSide.esLeft,n=t,n.PrevInAEL==e?a=e.PrevInAEL:a=n.PrevInAEL),a!==null&&a.OutIdx>=0&&m.Clipper.TopX(a,i.Y)==m.Clipper.TopX(n,i.Y)&&m.ClipperBase.SlopesEqual(n,a,this.m_UseFullRange)&&n.WindDelta!==0&&a.WindDelta!==0){var o=this.AddOutPt(a,i);this.AddJoin(r,o,n.Top)}return r};m.Clipper.prototype.CreateOutRec=function(){var e=new m.OutRec;return e.Idx=-1,e.IsHole=!1,e.IsOpen=!1,e.FirstLeft=null,e.Pts=null,e.BottomPt=null,e.PolyNode=null,this.m_PolyOuts.push(e),e.Idx=this.m_PolyOuts.length-1,e};m.Clipper.prototype.AddOutPt=function(e,t){var i=e.Side==m.EdgeSide.esLeft;if(e.OutIdx<0){var r=this.CreateOutRec();r.IsOpen=e.WindDelta===0;var n=new m.OutPt;return r.Pts=n,n.Idx=r.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=n,n.Prev=n,r.IsOpen||this.SetHoleState(e,r),$n&&(m.IntPoint.op_Equality(t,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):m.IntPoint.op_Equality(t,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),e.OutIdx=r.Idx,n}else{var r=this.m_PolyOuts[e.OutIdx],a=r.Pts;if(i&&m.IntPoint.op_Equality(t,a.Pt))return a;if(!i&&m.IntPoint.op_Equality(t,a.Prev.Pt))return a.Prev;var n=new m.OutPt;return n.Idx=r.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=a,n.Prev=a.Prev,n.Prev.Next=n,a.Prev=n,i&&(r.Pts=n),$n&&(m.IntPoint.op_Equality(t,e.Bot)?(n.Pt.X=e.Bot.X,n.Pt.Y=e.Bot.Y,n.Pt.Z=e.Bot.Z):m.IntPoint.op_Equality(t,e.Top)?(n.Pt.X=e.Top.X,n.Pt.Y=e.Top.Y,n.Pt.Z=e.Top.Z):this.SetZ(n.Pt,e)),n}};m.Clipper.prototype.SwapPoints=function(e,t){var i=new m.IntPoint(e.Value);e.Value.X=t.Value.X,e.Value.Y=t.Value.Y,t.Value.X=i.X,t.Value.Y=i.Y};m.Clipper.prototype.HorzSegmentsOverlap=function(e,t,i,r){return e.X>i.X==e.X<r.X||t.X>i.X==t.X<r.X||i.X>e.X==i.X<t.X||r.X>e.X==r.X<t.X||e.X==i.X&&t.X==r.X?!0:e.X==r.X&&t.X==i.X};m.Clipper.prototype.InsertPolyPtBetween=function(e,t,i){var r=new m.OutPt;return r.Pt.X=i.X,r.Pt.Y=i.Y,t==e.Next?(e.Next=r,t.Prev=r,r.Next=t,r.Prev=e):(t.Next=r,e.Prev=r,r.Next=e,r.Prev=t),r};m.Clipper.prototype.SetHoleState=function(e,t){for(var i=!1,r=e.PrevInAEL;r!==null;)r.OutIdx>=0&&r.WindDelta!=0&&(i=!i,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[r.OutIdx])),r=r.PrevInAEL;i&&(t.IsHole=!0)};m.Clipper.prototype.GetDx=function(e,t){return e.Y==t.Y?m.ClipperBase.horizontal:(t.X-e.X)/(t.Y-e.Y)};m.Clipper.prototype.FirstIsBottomPt=function(e,t){for(var i=e.Prev;m.IntPoint.op_Equality(i.Pt,e.Pt)&&i!=e;)i=i.Prev;var r=Math.abs(this.GetDx(e.Pt,i.Pt));for(i=e.Next;m.IntPoint.op_Equality(i.Pt,e.Pt)&&i!=e;)i=i.Next;var n=Math.abs(this.GetDx(e.Pt,i.Pt));for(i=t.Prev;m.IntPoint.op_Equality(i.Pt,t.Pt)&&i!=t;)i=i.Prev;var a=Math.abs(this.GetDx(t.Pt,i.Pt));for(i=t.Next;m.IntPoint.op_Equality(i.Pt,t.Pt)&&i!=t;)i=i.Next;var o=Math.abs(this.GetDx(t.Pt,i.Pt));return r>=a&&r>=o||n>=a&&n>=o};m.Clipper.prototype.GetBottomPt=function(e){for(var t=null,i=e.Next;i!=e;)i.Pt.Y>e.Pt.Y?(e=i,t=null):i.Pt.Y==e.Pt.Y&&i.Pt.X<=e.Pt.X&&(i.Pt.X<e.Pt.X?(t=null,e=i):i.Next!=e&&i.Prev!=e&&(t=i)),i=i.Next;if(t!==null)for(;t!=i;)for(this.FirstIsBottomPt(i,t)||(e=t),t=t.Next;m.IntPoint.op_Inequality(t.Pt,e.Pt);)t=t.Next;return e};m.Clipper.prototype.GetLowermostRec=function(e,t){e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var i=e.BottomPt,r=t.BottomPt;return i.Pt.Y>r.Pt.Y?e:i.Pt.Y<r.Pt.Y?t:i.Pt.X<r.Pt.X?e:i.Pt.X>r.Pt.X||i.Next==i?t:r.Next==r||this.FirstIsBottomPt(i,r)?e:t};m.Clipper.prototype.Param1RightOfParam2=function(e,t){do if(e=e.FirstLeft,e==t)return!0;while(e!==null);return!1};m.Clipper.prototype.GetOutRec=function(e){for(var t=this.m_PolyOuts[e];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};m.Clipper.prototype.AppendPolygon=function(e,t){var i=this.m_PolyOuts[e.OutIdx],r=this.m_PolyOuts[t.OutIdx],n;this.Param1RightOfParam2(i,r)?n=r:this.Param1RightOfParam2(r,i)?n=i:n=this.GetLowermostRec(i,r);var a=i.Pts,o=a.Prev,s=r.Pts,l=s.Prev,u;e.Side==m.EdgeSide.esLeft?(t.Side==m.EdgeSide.esLeft?(this.ReversePolyPtLinks(s),s.Next=a,a.Prev=s,o.Next=l,l.Prev=o,i.Pts=l):(l.Next=a,a.Prev=l,s.Prev=o,o.Next=s,i.Pts=s),u=m.EdgeSide.esLeft):(t.Side==m.EdgeSide.esRight?(this.ReversePolyPtLinks(s),o.Next=l,l.Prev=o,s.Next=a,a.Prev=s):(o.Next=s,s.Prev=o,a.Prev=l,l.Next=a),u=m.EdgeSide.esRight),i.BottomPt=null,n==r&&(r.FirstLeft!=i&&(i.FirstLeft=r.FirstLeft),i.IsHole=r.IsHole),r.Pts=null,r.BottomPt=null,r.FirstLeft=i;var h=e.OutIdx,c=t.OutIdx;e.OutIdx=-1,t.OutIdx=-1;for(var p=this.m_ActiveEdges;p!==null;){if(p.OutIdx==c){p.OutIdx=h,p.Side=u;break}p=p.NextInAEL}r.Idx=i.Idx};m.Clipper.prototype.ReversePolyPtLinks=function(e){if(e!==null){var t,i;t=e;do i=t.Next,t.Next=t.Prev,t.Prev=i,t=i;while(t!=e)}};m.Clipper.SwapSides=function(e,t){var i=e.Side;e.Side=t.Side,t.Side=i};m.Clipper.SwapPolyIndexes=function(e,t){var i=e.OutIdx;e.OutIdx=t.OutIdx,t.OutIdx=i};m.Clipper.prototype.IntersectEdges=function(e,t,i,r){var n=!r&&e.NextInLML===null&&e.Top.X==i.X&&e.Top.Y==i.Y,a=!r&&t.NextInLML===null&&t.Top.X==i.X&&t.Top.Y==i.Y,o=e.OutIdx>=0,s=t.OutIdx>=0;if(n2&&(e.WindDelta===0||t.WindDelta===0)){e.WindDelta===0&&t.WindDelta===0?(n||a)&&o&&s&&this.AddLocalMaxPoly(e,t,i):e.PolyTyp==t.PolyTyp&&e.WindDelta!=t.WindDelta&&this.m_ClipType==m.ClipType.ctUnion?e.WindDelta===0?s&&(this.AddOutPt(e,i),o&&(e.OutIdx=-1)):o&&(this.AddOutPt(t,i),s&&(t.OutIdx=-1)):e.PolyTyp!=t.PolyTyp&&(e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=m.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(e,i),o&&(e.OutIdx=-1)):t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=m.ClipType.ctUnion||e.WindCnt2===0)&&(this.AddOutPt(t,i),s&&(t.OutIdx=-1))),n&&(e.OutIdx<0?this.DeleteFromAEL(e):m.Error("Error intersecting polylines")),a&&(t.OutIdx<0?this.DeleteFromAEL(t):m.Error("Error intersecting polylines"));return}if(e.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(e)){var l=e.WindCnt;e.WindCnt=t.WindCnt,t.WindCnt=l}else e.WindCnt+t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt+=t.WindDelta,t.WindCnt-e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=e.WindDelta;else this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=e.WindDelta;var u,h,c,p;e.PolyTyp==m.PolyType.ptSubject?(u=this.m_SubjFillType,c=this.m_ClipFillType):(u=this.m_ClipFillType,c=this.m_SubjFillType),t.PolyTyp==m.PolyType.ptSubject?(h=this.m_SubjFillType,p=this.m_ClipFillType):(h=this.m_ClipFillType,p=this.m_SubjFillType);var d,f;switch(u){case m.PolyFillType.pftPositive:d=e.WindCnt;break;case m.PolyFillType.pftNegative:d=-e.WindCnt;break;default:d=Math.abs(e.WindCnt);break}switch(h){case m.PolyFillType.pftPositive:f=t.WindCnt;break;case m.PolyFillType.pftNegative:f=-t.WindCnt;break;default:f=Math.abs(t.WindCnt);break}if(o&&s)n||a||d!==0&&d!=1||f!==0&&f!=1||e.PolyTyp!=t.PolyTyp&&this.m_ClipType!=m.ClipType.ctXor?this.AddLocalMaxPoly(e,t,i):(this.AddOutPt(e,i),this.AddOutPt(t,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if(o)(f===0||f==1)&&(this.AddOutPt(e,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if(s)(d===0||d==1)&&(this.AddOutPt(t,i),m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t));else if((d===0||d==1)&&(f===0||f==1)&&!n&&!a){var y,g;switch(c){case m.PolyFillType.pftPositive:y=e.WindCnt2;break;case m.PolyFillType.pftNegative:y=-e.WindCnt2;break;default:y=Math.abs(e.WindCnt2);break}switch(p){case m.PolyFillType.pftPositive:g=t.WindCnt2;break;case m.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}if(e.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(e,t,i);else if(d==1&&f==1)switch(this.m_ClipType){case m.ClipType.ctIntersection:y>0&&g>0&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctUnion:y<=0&&g<=0&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctDifference:(e.PolyTyp==m.PolyType.ptClip&&y>0&&g>0||e.PolyTyp==m.PolyType.ptSubject&&y<=0&&g<=0)&&this.AddLocalMinPoly(e,t,i);break;case m.ClipType.ctXor:this.AddLocalMinPoly(e,t,i);break}else m.Clipper.SwapSides(e,t)}n!=a&&(n&&e.OutIdx>=0||a&&t.OutIdx>=0)&&(m.Clipper.SwapSides(e,t),m.Clipper.SwapPolyIndexes(e,t)),n&&this.DeleteFromAEL(e),a&&this.DeleteFromAEL(t)};m.Clipper.prototype.DeleteFromAEL=function(e){var t=e.PrevInAEL,i=e.NextInAEL;t===null&&i===null&&e!=this.m_ActiveEdges||(t!==null?t.NextInAEL=i:this.m_ActiveEdges=i,i!==null&&(i.PrevInAEL=t),e.NextInAEL=null,e.PrevInAEL=null)};m.Clipper.prototype.DeleteFromSEL=function(e){var t=e.PrevInSEL,i=e.NextInSEL;t===null&&i===null&&e!=this.m_SortedEdges||(t!==null?t.NextInSEL=i:this.m_SortedEdges=i,i!==null&&(i.PrevInSEL=t),e.NextInSEL=null,e.PrevInSEL=null)};m.Clipper.prototype.UpdateEdgeIntoAEL=function(e){e.NextInLML===null&&m.Error("UpdateEdgeIntoAEL: invalid call");var t=e.PrevInAEL,i=e.NextInAEL;return e.NextInLML.OutIdx=e.OutIdx,t!==null?t.NextInAEL=e.NextInLML:this.m_ActiveEdges=e.NextInLML,i!==null&&(i.PrevInAEL=e.NextInLML),e.NextInLML.Side=e.Side,e.NextInLML.WindDelta=e.WindDelta,e.NextInLML.WindCnt=e.WindCnt,e.NextInLML.WindCnt2=e.WindCnt2,e=e.NextInLML,e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.PrevInAEL=t,e.NextInAEL=i,m.ClipperBase.IsHorizontal(e)||this.InsertScanbeam(e.Top.Y),e};m.Clipper.prototype.ProcessHorizontals=function(e){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,e),t=this.m_SortedEdges};m.Clipper.prototype.GetHorzDirection=function(e,t){e.Bot.X<e.Top.X?(t.Left=e.Bot.X,t.Right=e.Top.X,t.Dir=m.Direction.dLeftToRight):(t.Left=e.Top.X,t.Right=e.Bot.X,t.Dir=m.Direction.dRightToLeft)};m.Clipper.prototype.PrepareHorzJoins=function(e,t){var i=this.m_PolyOuts[e.OutIdx].Pts;e.Side!=m.EdgeSide.esLeft&&(i=i.Prev),t&&(m.IntPoint.op_Equality(i.Pt,e.Top)?this.AddGhostJoin(i,e.Bot):this.AddGhostJoin(i,e.Top))};m.Clipper.prototype.ProcessHorizontal=function(e,t){var i={Dir:null,Left:null,Right:null};this.GetHorzDirection(e,i);for(var r=i.Dir,n=i.Left,a=i.Right,o=e,s=null;o.NextInLML!==null&&m.ClipperBase.IsHorizontal(o.NextInLML);)o=o.NextInLML;for(o.NextInLML===null&&(s=this.GetMaximaPair(o));;){for(var l=e==o,u=this.GetNextInAEL(e,r);u!==null&&!(u.Curr.X==e.Top.X&&e.NextInLML!==null&&u.Dx<e.NextInLML.Dx);){var h=this.GetNextInAEL(u,r);if(r==m.Direction.dLeftToRight&&u.Curr.X<=a||r==m.Direction.dRightToLeft&&u.Curr.X>=n){if(e.OutIdx>=0&&e.WindDelta!=0&&this.PrepareHorzJoins(e,t),u==s&&l){r==m.Direction.dLeftToRight?this.IntersectEdges(e,u,u.Top,!1):this.IntersectEdges(u,e,u.Top,!1),s.OutIdx>=0&&m.Error("ProcessHorizontal error");return}else if(r==m.Direction.dLeftToRight){var c=new m.IntPoint(u.Curr.X,e.Curr.Y);this.IntersectEdges(e,u,c,!0)}else{var c=new m.IntPoint(u.Curr.X,e.Curr.Y);this.IntersectEdges(u,e,c,!0)}this.SwapPositionsInAEL(e,u)}else if(r==m.Direction.dLeftToRight&&u.Curr.X>=a||r==m.Direction.dRightToLeft&&u.Curr.X<=n)break;u=h}if(e.OutIdx>=0&&e.WindDelta!==0&&this.PrepareHorzJoins(e,t),e.NextInLML!==null&&m.ClipperBase.IsHorizontal(e.NextInLML)){e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot);var i={Dir:r,Left:n,Right:a};this.GetHorzDirection(e,i),r=i.Dir,n=i.Left,a=i.Right}else break}if(e.NextInLML!==null)if(e.OutIdx>=0){var p=this.AddOutPt(e,e.Top);if(e=this.UpdateEdgeIntoAEL(e),e.WindDelta===0)return;var d=e.PrevInAEL,h=e.NextInAEL;if(d!==null&&d.Curr.X==e.Bot.X&&d.Curr.Y==e.Bot.Y&&d.WindDelta!==0&&d.OutIdx>=0&&d.Curr.Y>d.Top.Y&&m.ClipperBase.SlopesEqual(e,d,this.m_UseFullRange)){var f=this.AddOutPt(d,e.Bot);this.AddJoin(p,f,e.Top)}else if(h!==null&&h.Curr.X==e.Bot.X&&h.Curr.Y==e.Bot.Y&&h.WindDelta!==0&&h.OutIdx>=0&&h.Curr.Y>h.Top.Y&&m.ClipperBase.SlopesEqual(e,h,this.m_UseFullRange)){var f=this.AddOutPt(h,e.Bot);this.AddJoin(p,f,e.Top)}}else e=this.UpdateEdgeIntoAEL(e);else s!==null?s.OutIdx>=0?(r==m.Direction.dLeftToRight?this.IntersectEdges(e,s,e.Top,!1):this.IntersectEdges(s,e,e.Top,!1),s.OutIdx>=0&&m.Error("ProcessHorizontal error")):(this.DeleteFromAEL(e),this.DeleteFromAEL(s)):(e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e))};m.Clipper.prototype.GetNextInAEL=function(e,t){return t==m.Direction.dLeftToRight?e.NextInAEL:e.PrevInAEL};m.Clipper.prototype.IsMinima=function(e){return e!==null&&e.Prev.NextInLML!=e&&e.Next.NextInLML!=e};m.Clipper.prototype.IsMaxima=function(e,t){return e!==null&&e.Top.Y==t&&e.NextInLML===null};m.Clipper.prototype.IsIntermediate=function(e,t){return e.Top.Y==t&&e.NextInLML!==null};m.Clipper.prototype.GetMaximaPair=function(e){var t=null;return m.IntPoint.op_Equality(e.Next.Top,e.Top)&&e.Next.NextInLML===null?t=e.Next:m.IntPoint.op_Equality(e.Prev.Top,e.Top)&&e.Prev.NextInLML===null&&(t=e.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!m.ClipperBase.IsHorizontal(t))?null:t};m.Clipper.prototype.ProcessIntersections=function(e,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(e,t),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch(i){this.m_SortedEdges=null,this.m_IntersectList.length=0,m.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};m.Clipper.prototype.BuildIntersectList=function(e,t){if(this.m_ActiveEdges!==null){var i=this.m_ActiveEdges;for(this.m_SortedEdges=i;i!==null;)i.PrevInSEL=i.PrevInAEL,i.NextInSEL=i.NextInAEL,i.Curr.X=m.Clipper.TopX(i,t),i=i.NextInAEL;for(var r=!0;r&&this.m_SortedEdges!==null;){for(r=!1,i=this.m_SortedEdges;i.NextInSEL!==null;){var n=i.NextInSEL,a=new m.IntPoint;if(i.Curr.X>n.Curr.X){!this.IntersectPoint(i,n,a)&&i.Curr.X>n.Curr.X+1&&m.Error("Intersection error"),a.Y>e&&(a.Y=e,Math.abs(i.Dx)>Math.abs(n.Dx)?a.X=m.Clipper.TopX(n,e):a.X=m.Clipper.TopX(i,e));var o=new m.IntersectNode;o.Edge1=i,o.Edge2=n,o.Pt.X=a.X,o.Pt.Y=a.Y,this.m_IntersectList.push(o),this.SwapPositionsInSEL(i,n),r=!0}else i=n}if(i.PrevInSEL!==null)i.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};m.Clipper.prototype.EdgesAdjacent=function(e){return e.Edge1.NextInSEL==e.Edge2||e.Edge1.PrevInSEL==e.Edge2};m.Clipper.IntersectNodeSort=function(e,t){return t.Pt.Y-e.Pt.Y};m.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var e=this.m_IntersectList.length,t=0;t<e;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var i=t+1;i<e&&!this.EdgesAdjacent(this.m_IntersectList[i]);)i++;if(i==e)return!1;var r=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[i],this.m_IntersectList[i]=r}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};m.Clipper.prototype.ProcessIntersectList=function(){for(var e=0,t=this.m_IntersectList.length;e<t;e++){var i=this.m_IntersectList[e];this.IntersectEdges(i.Edge1,i.Edge2,i.Pt,!0),this.SwapPositionsInAEL(i.Edge1,i.Edge2)}this.m_IntersectList.length=0};var Q8=function(e){return e<0?Math.ceil(e-.5):Math.round(e)},eV=function(e){return e<0?Math.ceil(e-.5):Math.floor(e+.5)},tV=function(e){return e<0?-Math.round(Math.abs(e)):Math.round(e)},iV=function(e){return e<0?(e-=.5,e<-2147483648?Math.ceil(e):e|0):(e+=.5,e>2147483647?Math.floor(e):e|0)};Ee.msie?m.Clipper.Round=Q8:Ee.chromium?m.Clipper.Round=tV:Ee.safari?m.Clipper.Round=iV:m.Clipper.Round=eV;m.Clipper.TopX=function(e,t){return t==e.Top.Y?e.Top.X:e.Bot.X+m.Clipper.Round(e.Dx*(t-e.Bot.Y))};m.Clipper.prototype.IntersectPoint=function(e,t,i){i.X=0,i.Y=0;var r,n;if(m.ClipperBase.SlopesEqual(e,t,this.m_UseFullRange)||e.Dx==t.Dx)return t.Bot.Y>e.Bot.Y?(i.X=t.Bot.X,i.Y=t.Bot.Y):(i.X=e.Bot.X,i.Y=e.Bot.Y),!1;if(e.Delta.X===0)i.X=e.Bot.X,m.ClipperBase.IsHorizontal(t)?i.Y=t.Bot.Y:(n=t.Bot.Y-t.Bot.X/t.Dx,i.Y=m.Clipper.Round(i.X/t.Dx+n));else if(t.Delta.X===0)i.X=t.Bot.X,m.ClipperBase.IsHorizontal(e)?i.Y=e.Bot.Y:(r=e.Bot.Y-e.Bot.X/e.Dx,i.Y=m.Clipper.Round(i.X/e.Dx+r));else{r=e.Bot.X-e.Bot.Y*e.Dx,n=t.Bot.X-t.Bot.Y*t.Dx;var a=(n-r)/(e.Dx-t.Dx);i.Y=m.Clipper.Round(a),Math.abs(e.Dx)<Math.abs(t.Dx)?i.X=m.Clipper.Round(e.Dx*a+r):i.X=m.Clipper.Round(t.Dx*a+n)}if(i.Y<e.Top.Y||i.Y<t.Top.Y){if(e.Top.Y>t.Top.Y)return i.Y=e.Top.Y,i.X=m.Clipper.TopX(t,e.Top.Y),i.X<e.Top.X;i.Y=t.Top.Y,Math.abs(e.Dx)<Math.abs(t.Dx)?i.X=m.Clipper.TopX(e,i.Y):i.X=m.Clipper.TopX(t,i.Y)}return!0};m.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(e){for(var t=this.m_ActiveEdges;t!==null;){var i=this.IsMaxima(t,e);if(i){var r=this.GetMaximaPair(t);i=r===null||!m.ClipperBase.IsHorizontal(r)}if(i){var n=t.PrevInAEL;this.DoMaxima(t),n===null?t=this.m_ActiveEdges:t=n.NextInAEL}else{if(this.IsIntermediate(t,e)&&m.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=m.Clipper.TopX(t,e),t.Curr.Y=e),this.StrictlySimple){var n=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&n!==null&&n.OutIdx>=0&&n.Curr.X==t.Curr.X&&n.WindDelta!==0){var a=this.AddOutPt(n,t.Curr),o=this.AddOutPt(t,t.Curr);this.AddJoin(a,o,t.Curr)}}t=t.NextInAEL}}for(this.ProcessHorizontals(!0),t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,e)){var a=null;t.OutIdx>=0&&(a=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var n=t.PrevInAEL,s=t.NextInAEL;if(n!==null&&n.Curr.X==t.Bot.X&&n.Curr.Y==t.Bot.Y&&a!==null&&n.OutIdx>=0&&n.Curr.Y>n.Top.Y&&m.ClipperBase.SlopesEqual(t,n,this.m_UseFullRange)&&t.WindDelta!==0&&n.WindDelta!==0){var o=this.AddOutPt(n,t.Bot);this.AddJoin(a,o,t.Top)}else if(s!==null&&s.Curr.X==t.Bot.X&&s.Curr.Y==t.Bot.Y&&a!==null&&s.OutIdx>=0&&s.Curr.Y>s.Top.Y&&m.ClipperBase.SlopesEqual(t,s,this.m_UseFullRange)&&t.WindDelta!==0&&s.WindDelta!==0){var o=this.AddOutPt(s,t.Bot);this.AddJoin(a,o,t.Top)}}t=t.NextInAEL}};m.Clipper.prototype.DoMaxima=function(e){var t=this.GetMaximaPair(e);if(t===null){e.OutIdx>=0&&this.AddOutPt(e,e.Top),this.DeleteFromAEL(e);return}for(var i=e.NextInAEL,r=!0;i!==null&&i!=t;)this.IntersectEdges(e,i,e.Top,!0),this.SwapPositionsInAEL(e,i),i=e.NextInAEL;e.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(e),this.DeleteFromAEL(t)):e.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(e,t,e.Top,!1):r&&e.WindDelta===0?(e.OutIdx>=0&&(this.AddOutPt(e,e.Top),e.OutIdx=-1),this.DeleteFromAEL(e),t.OutIdx>=0&&(this.AddOutPt(t,e.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):m.Error("DoMaxima error")};m.Clipper.ReversePaths=function(e){for(var t=0,i=e.length;t<i;t++)e[t].reverse()};m.Clipper.Orientation=function(e){return m.Clipper.Area(e)>=0};m.Clipper.prototype.PointCount=function(e){if(e===null)return 0;var t=0,i=e;do t++,i=i.Next;while(i!=e);return t};m.Clipper.prototype.BuildResult=function(e){m.Clear(e);for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t];if(r.Pts!==null){var n=r.Pts.Prev,a=this.PointCount(n);if(!(a<2)){for(var o=new Array(a),s=0;s<a;s++)o[s]=n.Pt,n=n.Prev;e.push(o)}}}};m.Clipper.prototype.BuildResult2=function(e){e.Clear();for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t],n=this.PointCount(r.Pts);if(!(r.IsOpen&&n<2||!r.IsOpen&&n<3)){this.FixHoleLinkage(r);var a=new m.PolyNode;e.m_AllPolys.push(a),r.PolyNode=a,a.m_polygon.length=n;for(var o=r.Pts.Prev,s=0;s<n;s++)a.m_polygon[s]=o.Pt,o=o.Prev}}for(var t=0,i=this.m_PolyOuts.length;t<i;t++){var r=this.m_PolyOuts[t];r.PolyNode!==null&&(r.IsOpen?(r.PolyNode.IsOpen=!0,e.AddChild(r.PolyNode)):r.FirstLeft!==null&&r.FirstLeft.PolyNode!=null?r.FirstLeft.PolyNode.AddChild(r.PolyNode):e.AddChild(r.PolyNode))}};m.Clipper.prototype.FixupOutPolygon=function(e){var t=null;e.BottomPt=null;for(var i=e.Pts;;){if(i.Prev==i||i.Prev==i.Next){this.DisposeOutPts(i),e.Pts=null;return}if(m.IntPoint.op_Equality(i.Pt,i.Next.Pt)||m.IntPoint.op_Equality(i.Pt,i.Prev.Pt)||m.ClipperBase.SlopesEqual(i.Prev.Pt,i.Pt,i.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(i.Prev.Pt,i.Pt,i.Next.Pt))){t=null;var r=i;i.Prev.Next=i.Next,i.Next.Prev=i.Prev,i=i.Prev,r=null}else{if(i==t)break;t===null&&(t=i),i=i.Next}}e.Pts=i};m.Clipper.prototype.DupOutPt=function(e,t){var i=new m.OutPt;return i.Pt.X=e.Pt.X,i.Pt.Y=e.Pt.Y,i.Idx=e.Idx,t?(i.Next=e.Next,i.Prev=e,e.Next.Prev=i,e.Next=i):(i.Prev=e.Prev,i.Next=e,e.Prev.Next=i,e.Prev=i),i};m.Clipper.prototype.GetOverlap=function(e,t,i,r,n){return e<t?i<r?(n.Left=Math.max(e,i),n.Right=Math.min(t,r)):(n.Left=Math.max(e,r),n.Right=Math.min(t,i)):i<r?(n.Left=Math.max(t,i),n.Right=Math.min(e,r)):(n.Left=Math.max(t,r),n.Right=Math.min(e,i)),n.Left<n.Right};m.Clipper.prototype.JoinHorz=function(e,t,i,r,n,a){var o=e.Pt.X>t.Pt.X?m.Direction.dRightToLeft:m.Direction.dLeftToRight,s=i.Pt.X>r.Pt.X?m.Direction.dRightToLeft:m.Direction.dLeftToRight;if(o==s)return!1;if(o==m.Direction.dLeftToRight){for(;e.Next.Pt.X<=n.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;a&&e.Pt.X!=n.X&&(e=e.Next),t=this.DupOutPt(e,!a),m.IntPoint.op_Inequality(t.Pt,n)&&(e=t,e.Pt.X=n.X,e.Pt.Y=n.Y,t=this.DupOutPt(e,!a))}else{for(;e.Next.Pt.X>=n.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;!a&&e.Pt.X!=n.X&&(e=e.Next),t=this.DupOutPt(e,a),m.IntPoint.op_Inequality(t.Pt,n)&&(e=t,e.Pt.X=n.X,e.Pt.Y=n.Y,t=this.DupOutPt(e,a))}if(s==m.Direction.dLeftToRight){for(;i.Next.Pt.X<=n.X&&i.Next.Pt.X>=i.Pt.X&&i.Next.Pt.Y==n.Y;)i=i.Next;a&&i.Pt.X!=n.X&&(i=i.Next),r=this.DupOutPt(i,!a),m.IntPoint.op_Inequality(r.Pt,n)&&(i=r,i.Pt.X=n.X,i.Pt.Y=n.Y,r=this.DupOutPt(i,!a))}else{for(;i.Next.Pt.X>=n.X&&i.Next.Pt.X<=i.Pt.X&&i.Next.Pt.Y==n.Y;)i=i.Next;!a&&i.Pt.X!=n.X&&(i=i.Next),r=this.DupOutPt(i,a),m.IntPoint.op_Inequality(r.Pt,n)&&(i=r,i.Pt.X=n.X,i.Pt.Y=n.Y,r=this.DupOutPt(i,a))}return o==m.Direction.dLeftToRight==a?(e.Prev=i,i.Next=e,t.Next=r,r.Prev=t):(e.Next=i,i.Prev=e,t.Prev=r,r.Next=t),!0};m.Clipper.prototype.JoinPoints=function(e,t,i){var r=e.OutPt1,n=new m.OutPt,a=e.OutPt2,o=new m.OutPt,s=e.OutPt1.Pt.Y==e.OffPt.Y;if(s&&m.IntPoint.op_Equality(e.OffPt,e.OutPt1.Pt)&&m.IntPoint.op_Equality(e.OffPt,e.OutPt2.Pt)){for(n=e.OutPt1.Next;n!=r&&m.IntPoint.op_Equality(n.Pt,e.OffPt);)n=n.Next;var l=n.Pt.Y>e.OffPt.Y;for(o=e.OutPt2.Next;o!=a&&m.IntPoint.op_Equality(o.Pt,e.OffPt);)o=o.Next;var u=o.Pt.Y>e.OffPt.Y;return l==u?!1:l?(n=this.DupOutPt(r,!1),o=this.DupOutPt(a,!0),r.Prev=a,a.Next=r,n.Next=o,o.Prev=n,e.OutPt1=r,e.OutPt2=n,!0):(n=this.DupOutPt(r,!0),o=this.DupOutPt(a,!1),r.Next=a,a.Prev=r,n.Prev=o,o.Next=n,e.OutPt1=r,e.OutPt2=n,!0)}else if(s){for(n=r;r.Prev.Pt.Y==r.Pt.Y&&r.Prev!=n&&r.Prev!=a;)r=r.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=r&&n.Next!=a;)n=n.Next;if(n.Next==r||n.Next==a)return!1;for(o=a;a.Prev.Pt.Y==a.Pt.Y&&a.Prev!=o&&a.Prev!=n;)a=a.Prev;for(;o.Next.Pt.Y==o.Pt.Y&&o.Next!=a&&o.Next!=r;)o=o.Next;if(o.Next==a||o.Next==r)return!1;var h={Left:null,Right:null};if(!this.GetOverlap(r.Pt.X,n.Pt.X,a.Pt.X,o.Pt.X,h))return!1;var c=h.Left,p=h.Right,d=new m.IntPoint,f;return r.Pt.X>=c&&r.Pt.X<=p?(d.X=r.Pt.X,d.Y=r.Pt.Y,f=r.Pt.X>n.Pt.X):a.Pt.X>=c&&a.Pt.X<=p?(d.X=a.Pt.X,d.Y=a.Pt.Y,f=a.Pt.X>o.Pt.X):n.Pt.X>=c&&n.Pt.X<=p?(d.X=n.Pt.X,d.Y=n.Pt.Y,f=n.Pt.X>r.Pt.X):(d.X=o.Pt.X,d.Y=o.Pt.Y,f=o.Pt.X>a.Pt.X),e.OutPt1=r,e.OutPt2=a,this.JoinHorz(r,n,a,o,d,f)}else{for(n=r.Next;m.IntPoint.op_Equality(n.Pt,r.Pt)&&n!=r;)n=n.Next;var y=n.Pt.Y>r.Pt.Y||!m.ClipperBase.SlopesEqual(r.Pt,n.Pt,e.OffPt,this.m_UseFullRange);if(y){for(n=r.Prev;m.IntPoint.op_Equality(n.Pt,r.Pt)&&n!=r;)n=n.Prev;if(n.Pt.Y>r.Pt.Y||!m.ClipperBase.SlopesEqual(r.Pt,n.Pt,e.OffPt,this.m_UseFullRange))return!1}for(o=a.Next;m.IntPoint.op_Equality(o.Pt,a.Pt)&&o!=a;)o=o.Next;var g=o.Pt.Y>a.Pt.Y||!m.ClipperBase.SlopesEqual(a.Pt,o.Pt,e.OffPt,this.m_UseFullRange);if(g){for(o=a.Prev;m.IntPoint.op_Equality(o.Pt,a.Pt)&&o!=a;)o=o.Prev;if(o.Pt.Y>a.Pt.Y||!m.ClipperBase.SlopesEqual(a.Pt,o.Pt,e.OffPt,this.m_UseFullRange))return!1}return n==r||o==a||n==o||t==i&&y==g?!1:y?(n=this.DupOutPt(r,!1),o=this.DupOutPt(a,!0),r.Prev=a,a.Next=r,n.Next=o,o.Prev=n,e.OutPt1=r,e.OutPt2=n,!0):(n=this.DupOutPt(r,!0),o=this.DupOutPt(a,!1),r.Next=a,a.Prev=r,n.Prev=o,o.Next=n,e.OutPt1=r,e.OutPt2=n,!0)}};m.Clipper.GetBounds=function(e){for(var t=0,i=e.length;t<i&&e[t].length==0;)t++;if(t==i)return new m.IntRect(0,0,0,0);var r=new m.IntRect;for(r.left=e[t][0].X,r.right=r.left,r.top=e[t][0].Y,r.bottom=r.top;t<i;t++)for(var n=0,a=e[t].length;n<a;n++)e[t][n].X<r.left?r.left=e[t][n].X:e[t][n].X>r.right&&(r.right=e[t][n].X),e[t][n].Y<r.top?r.top=e[t][n].Y:e[t][n].Y>r.bottom&&(r.bottom=e[t][n].Y);return r};m.Clipper.prototype.GetBounds2=function(e){var t=e,i=new m.IntRect;for(i.left=e.Pt.X,i.right=e.Pt.X,i.top=e.Pt.Y,i.bottom=e.Pt.Y,e=e.Next;e!=t;)e.Pt.X<i.left&&(i.left=e.Pt.X),e.Pt.X>i.right&&(i.right=e.Pt.X),e.Pt.Y<i.top&&(i.top=e.Pt.Y),e.Pt.Y>i.bottom&&(i.bottom=e.Pt.Y),e=e.Next;return i};m.Clipper.PointInPolygon=function(e,t){var i=0,r=t.length;if(r<3)return 0;for(var n=t[0],a=1;a<=r;++a){var o=a==r?t[0]:t[a];if(o.Y==e.Y&&(o.X==e.X||n.Y==e.Y&&o.X>e.X==n.X<e.X))return-1;if(n.Y<e.Y!=o.Y<e.Y){if(n.X>=e.X)if(o.X>e.X)i=1-i;else{var s=(n.X-e.X)*(o.Y-e.Y)-(o.X-e.X)*(n.Y-e.Y);if(s==0)return-1;s>0==o.Y>n.Y&&(i=1-i)}else if(o.X>e.X){var s=(n.X-e.X)*(o.Y-e.Y)-(o.X-e.X)*(n.Y-e.Y);if(s==0)return-1;s>0==o.Y>n.Y&&(i=1-i)}}n=o}return i};m.Clipper.prototype.PointInPolygon=function(e,t){for(var i=0,r=t;;){var n=t.Pt.X,a=t.Pt.Y,o=t.Next.Pt.X,s=t.Next.Pt.Y;if(s==e.Y&&(o==e.X||a==e.Y&&o>e.X==n<e.X))return-1;if(a<e.Y!=s<e.Y){if(n>=e.X)if(o>e.X)i=1-i;else{var l=(n-e.X)*(s-e.Y)-(o-e.X)*(a-e.Y);if(l==0)return-1;l>0==s>a&&(i=1-i)}else if(o>e.X){var l=(n-e.X)*(s-e.Y)-(o-e.X)*(a-e.Y);if(l==0)return-1;l>0==s>a&&(i=1-i)}}if(t=t.Next,r==t)break}return i};m.Clipper.prototype.Poly2ContainsPoly1=function(e,t){var i=e;do{var r=this.PointInPolygon(i.Pt,t);if(r>=0)return r!=0;i=i.Next}while(i!=e);return!0};m.Clipper.prototype.FixupFirstLefts1=function(e,t){for(var i=0,r=this.m_PolyOuts.length;i<r;i++){var n=this.m_PolyOuts[i];n.Pts!==null&&n.FirstLeft==e&&this.Poly2ContainsPoly1(n.Pts,t.Pts)&&(n.FirstLeft=t)}};m.Clipper.prototype.FixupFirstLefts2=function(e,t){for(var i=0,r=this.m_PolyOuts,n=r.length,a=r[i];i<n;i++,a=r[i])a.FirstLeft==e&&(a.FirstLeft=t)};m.Clipper.ParseFirstLeft=function(e){for(;e!=null&&e.Pts==null;)e=e.FirstLeft;return e};m.Clipper.prototype.JoinCommonEdges=function(){for(var e=0,t=this.m_Joins.length;e<t;e++){var i=this.m_Joins[e],r=this.GetOutRec(i.OutPt1.Idx),n=this.GetOutRec(i.OutPt2.Idx);if(!(r.Pts==null||n.Pts==null)){var a;if(r==n?a=r:this.Param1RightOfParam2(r,n)?a=n:this.Param1RightOfParam2(n,r)?a=r:a=this.GetLowermostRec(r,n),!!this.JoinPoints(i,r,n))if(r==n){if(r.Pts=i.OutPt1,r.BottomPt=null,n=this.CreateOutRec(),n.Pts=i.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var o=0,s=this.m_PolyOuts.length;o<s-1;o++){var l=this.m_PolyOuts[o];l.Pts==null||m.Clipper.ParseFirstLeft(l.FirstLeft)!=r||l.IsHole==r.IsHole||this.Poly2ContainsPoly1(l.Pts,i.OutPt2)&&(l.FirstLeft=n)}this.Poly2ContainsPoly1(n.Pts,r.Pts)?(n.IsHole=!r.IsHole,n.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,r),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):this.Poly2ContainsPoly1(r.Pts,n.Pts)?(n.IsHole=r.IsHole,r.IsHole=!n.IsHole,n.FirstLeft=r.FirstLeft,r.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(r,n),(r.IsHole^this.ReverseSolution)==this.Area(r)>0&&this.ReversePolyPtLinks(r.Pts)):(n.IsHole=r.IsHole,n.FirstLeft=r.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(r,n))}else n.Pts=null,n.BottomPt=null,n.Idx=r.Idx,r.IsHole=a.IsHole,a==n&&(r.FirstLeft=n.FirstLeft),n.FirstLeft=r,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,r)}}};m.Clipper.prototype.UpdateOutPtIdxs=function(e){var t=e.Pts;do t.Idx=e.Idx,t=t.Prev;while(t!=e.Pts)};m.Clipper.prototype.DoSimplePolygons=function(){for(var e=0;e<this.m_PolyOuts.length;){var t=this.m_PolyOuts[e++],i=t.Pts;if(i!==null)do{for(var r=i.Next;r!=t.Pts;){if(m.IntPoint.op_Equality(i.Pt,r.Pt)&&r.Next!=i&&r.Prev!=i){var n=i.Prev,a=r.Prev;i.Prev=a,a.Next=i,r.Prev=n,n.Next=r,t.Pts=i;var o=this.CreateOutRec();o.Pts=r,this.UpdateOutPtIdxs(o),this.Poly2ContainsPoly1(o.Pts,t.Pts)?(o.IsHole=!t.IsHole,o.FirstLeft=t):this.Poly2ContainsPoly1(t.Pts,o.Pts)?(o.IsHole=t.IsHole,t.IsHole=!o.IsHole,o.FirstLeft=t.FirstLeft,t.FirstLeft=o):(o.IsHole=t.IsHole,o.FirstLeft=t.FirstLeft),r=i}r=r.Next}i=i.Next}while(i!=t.Pts)}};m.Clipper.Area=function(e){var t=e.length;if(t<3)return 0;for(var i=0,r=0,n=t-1;r<t;++r)i+=(e[n].X+e[r].X)*(e[n].Y-e[r].Y),n=r;return-i*.5};m.Clipper.prototype.Area=function(e){var t=e.Pts;if(t==null)return 0;var i=0;do i=i+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=e.Pts);return i*.5};a2&&(m.Clipper.OffsetPaths=function(e,t,i,r,n){var a=new m.Paths,o=new m.ClipperOffset(n,n);return o.AddPaths(e,i,r),o.Execute(a,t),a});m.Clipper.SimplifyPolygon=function(e,t){var i=new Array,r=new m.Clipper(0);return r.StrictlySimple=!0,r.AddPath(e,m.PolyType.ptSubject,!0),r.Execute(m.ClipType.ctUnion,i,t,t),i};m.Clipper.SimplifyPolygons=function(e,t){typeof t>"u"&&(t=m.PolyFillType.pftEvenOdd);var i=new Array,r=new m.Clipper(0);return r.StrictlySimple=!0,r.AddPaths(e,m.PolyType.ptSubject,!0),r.Execute(m.ClipType.ctUnion,i,t,t),i};m.Clipper.DistanceSqrd=function(e,t){var i=e.X-t.X,r=e.Y-t.Y;return i*i+r*r};m.Clipper.DistanceFromLineSqrd=function(e,t,i){var r=t.Y-i.Y,n=i.X-t.X,a=r*t.X+n*t.Y;return a=r*e.X+n*e.Y-a,a*a/(r*r+n*n)};m.Clipper.SlopesNearCollinear=function(e,t,i,r){return m.Clipper.DistanceFromLineSqrd(t,e,i)<r};m.Clipper.PointsAreClose=function(e,t,i){var r=e.X-t.X,n=e.Y-t.Y;return r*r+n*n<=i};m.Clipper.ExcludeOp=function(e){var t=e.Prev;return t.Next=e.Next,e.Next.Prev=t,t.Idx=0,t};m.Clipper.CleanPolygon=function(e,t){typeof t>"u"&&(t=1.415);var i=e.length;if(i==0)return new Array;for(var r=new Array(i),n=0;n<i;++n)r[n]=new m.OutPt;for(var n=0;n<i;++n)r[n].Pt=e[n],r[n].Next=r[(n+1)%i],r[n].Next.Prev=r[n],r[n].Idx=0;for(var a=t*t,o=r[0];o.Idx==0&&o.Next!=o.Prev;)m.Clipper.PointsAreClose(o.Pt,o.Prev.Pt,a)?(o=m.Clipper.ExcludeOp(o),i--):m.Clipper.PointsAreClose(o.Prev.Pt,o.Next.Pt,a)?(m.Clipper.ExcludeOp(o.Next),o=m.Clipper.ExcludeOp(o),i-=2):m.Clipper.SlopesNearCollinear(o.Prev.Pt,o.Pt,o.Next.Pt,a)?(o=m.Clipper.ExcludeOp(o),i--):(o.Idx=1,o=o.Next);i<3&&(i=0);for(var s=new Array(i),n=0;n<i;++n)s[n]=new m.IntPoint(o.Pt),o=o.Next;return r=null,s};m.Clipper.CleanPolygons=function(e,t){for(var i=new Array(e.length),r=0,n=e.length;r<n;r++)i[r]=m.Clipper.CleanPolygon(e[r],t);return i};m.Clipper.Minkowski=function(e,t,i,r){var n=r?1:0,a=e.length,o=t.length,s=new Array;if(i)for(var l=0;l<o;l++){for(var u=new Array(a),h=0,c=e.length,p=e[h];h<c;h++,p=e[h])u[h]=new m.IntPoint(t[l].X+p.X,t[l].Y+p.Y);s.push(u)}else for(var l=0;l<o;l++){for(var u=new Array(a),h=0,c=e.length,p=e[h];h<c;h++,p=e[h])u[h]=new m.IntPoint(t[l].X-p.X,t[l].Y-p.Y);s.push(u)}for(var d=new Array,l=0;l<o-1+n;l++)for(var h=0;h<a;h++){var f=new Array;f.push(s[l%o][h%a]),f.push(s[(l+1)%o][h%a]),f.push(s[(l+1)%o][(h+1)%a]),f.push(s[l%o][(h+1)%a]),m.Clipper.Orientation(f)||f.reverse(),d.push(f)}var y=new m.Clipper(0);return y.AddPaths(d,m.PolyType.ptSubject,!0),y.Execute(m.ClipType.ctUnion,s,m.PolyFillType.pftNonZero,m.PolyFillType.pftNonZero),s};m.Clipper.MinkowskiSum=function(){var e=arguments,t=e.length;if(t==3){var i=e[0],r=e[1],n=e[2];return m.Clipper.Minkowski(i,r,!0,n)}else if(t==4){for(var i=e[0],a=e[1],o=e[2],n=e[3],s=new m.Clipper,l,u=0,h=a.length;u<h;++u){var l=m.Clipper.Minkowski(i,a[u],!0,n);s.AddPaths(l,m.PolyType.ptSubject,!0)}n&&s.AddPaths(a,m.PolyType.ptClip,!0);var c=new m.Paths;return s.Execute(m.ClipType.ctUnion,c,o,o),c}};m.Clipper.MinkowskiDiff=function(e,t,i){return m.Clipper.Minkowski(e,t,!1,i)};m.Clipper.PolyTreeToPaths=function(e){var t=new Array;return m.Clipper.AddPolyNodeToPaths(e,m.Clipper.NodeType.ntAny,t),t};m.Clipper.AddPolyNodeToPaths=function(e,t,i){var r=!0;switch(t){case m.Clipper.NodeType.ntOpen:return;case m.Clipper.NodeType.ntClosed:r=!e.IsOpen;break;default:break}e.m_polygon.length>0&&r&&i.push(e.m_polygon);for(var n=0,a=e.Childs(),o=a.length,s=a[n];n<o;n++,s=a[n])m.Clipper.AddPolyNodeToPaths(s,t,i)};m.Clipper.OpenPathsFromPolyTree=function(e){for(var t=new m.Paths,i=0,r=e.ChildCount();i<r;i++)e.Childs()[i].IsOpen&&t.push(e.Childs()[i].m_polygon);return t};m.Clipper.ClosedPathsFromPolyTree=function(e){var t=new m.Paths;return m.Clipper.AddPolyNodeToPaths(e,m.Clipper.NodeType.ntClosed,t),t};bh(m.Clipper,m.ClipperBase);m.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};m.ClipperOffset=function(e,t){typeof e>"u"&&(e=2),typeof t>"u"&&(t=m.ClipperOffset.def_arc_tolerance),this.m_destPolys=new m.Paths,this.m_srcPoly=new m.Path,this.m_destPoly=new m.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new m.IntPoint,this.m_polyNodes=new m.PolyNode,this.MiterLimit=e,this.ArcTolerance=t,this.m_lowest.X=-1};m.ClipperOffset.two_pi=6.28318530717959;m.ClipperOffset.def_arc_tolerance=.25;m.ClipperOffset.prototype.Clear=function(){m.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};m.ClipperOffset.Round=m.Clipper.Round;m.ClipperOffset.prototype.AddPath=function(e,t,i){var r=e.length-1;if(!(r<0)){var n=new m.PolyNode;if(n.m_jointype=t,n.m_endtype=i,i==m.EndType.etClosedLine||i==m.EndType.etClosedPolygon)for(;r>0&&m.IntPoint.op_Equality(e[0],e[r]);)r--;n.m_polygon.push(e[0]);for(var a=0,o=0,s=1;s<=r;s++)m.IntPoint.op_Inequality(n.m_polygon[a],e[s])&&(a++,n.m_polygon.push(e[s]),(e[s].Y>n.m_polygon[o].Y||e[s].Y==n.m_polygon[o].Y&&e[s].X<n.m_polygon[o].X)&&(o=a));if(!(i==m.EndType.etClosedPolygon&&a<2||i!=m.EndType.etClosedPolygon&&a<0)&&(this.m_polyNodes.AddChild(n),i==m.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new m.IntPoint(0,o);else{var l=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[o].Y>l.Y||n.m_polygon[o].Y==l.Y&&n.m_polygon[o].X<l.X)&&(this.m_lowest=new m.IntPoint(this.m_polyNodes.ChildCount()-1,o))}}};m.ClipperOffset.prototype.AddPaths=function(e,t,i){for(var r=0,n=e.length;r<n;r++)this.AddPath(e[r],t,i)};m.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!m.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];(t.m_endtype==m.EndType.etClosedPolygon||t.m_endtype==m.EndType.etClosedLine&&m.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var e=0;e<this.m_polyNodes.ChildCount();e++){var t=this.m_polyNodes.Childs()[e];t.m_endtype==m.EndType.etClosedLine&&!m.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};m.ClipperOffset.GetUnitNormal=function(e,t){var i=t.X-e.X,r=t.Y-e.Y;if(i==0&&r==0)return new m.DoublePoint(0,0);var n=1/Math.sqrt(i*i+r*r);return i*=n,r*=n,new m.DoublePoint(r,-i)};m.ClipperOffset.prototype.DoOffset=function(e){if(this.m_destPolys=new Array,this.m_delta=e,m.ClipperBase.near_zero(e)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];i.m_endtype==m.EndType.etClosedPolygon&&this.m_destPolys.push(i.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var r;this.ArcTolerance<=0?r=m.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(e)*m.ClipperOffset.def_arc_tolerance?r=Math.abs(e)*m.ClipperOffset.def_arc_tolerance:r=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-r/Math.abs(e));this.m_sin=Math.sin(m.ClipperOffset.two_pi/n),this.m_cos=Math.cos(m.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/m.ClipperOffset.two_pi,e<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var i=this.m_polyNodes.Childs()[t];this.m_srcPoly=i.m_polygon;var a=this.m_srcPoly.length;if(!(a==0||e<=0&&(a<3||i.m_endtype!=m.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,a==1){if(i.m_jointype==m.JoinType.jtRound)for(var o=1,s=0,l=1;l<=n;l++){this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+o*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+s*e)));var u=o;o=o*this.m_cos-this.m_sin*s,s=u*this.m_sin+s*this.m_cos}else for(var o=-1,s=-1,l=0;l<4;++l)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+o*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+s*e))),o<0?o=1:s<0?s=1:o=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var l=0;l<a-1;l++)this.m_normals.push(m.ClipperOffset.GetUnitNormal(this.m_srcPoly[l],this.m_srcPoly[l+1]));if(i.m_endtype==m.EndType.etClosedLine||i.m_endtype==m.EndType.etClosedPolygon?this.m_normals.push(m.ClipperOffset.GetUnitNormal(this.m_srcPoly[a-1],this.m_srcPoly[0])):this.m_normals.push(new m.DoublePoint(this.m_normals[a-2])),i.m_endtype==m.EndType.etClosedPolygon){for(var h=a-1,l=0;l<a;l++)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(i.m_endtype==m.EndType.etClosedLine){for(var h=a-1,l=0;l<a;l++)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var c=this.m_normals[a-1],l=a-1;l>0;l--)this.m_normals[l]=new m.DoublePoint(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new m.DoublePoint(-c.X,-c.Y),h=0;for(var l=a-1;l>=0;l--)h=this.OffsetPoint(l,h,i.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var h=0,l=1;l<a-1;++l)h=this.OffsetPoint(l,h,i.m_jointype);var p;if(i.m_endtype==m.EndType.etOpenButt){var l=a-1;p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_normals[l].X*e),m.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_normals[l].Y*e)),this.m_destPoly.push(p),p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[l].X-this.m_normals[l].X*e),m.ClipperOffset.Round(this.m_srcPoly[l].Y-this.m_normals[l].Y*e)),this.m_destPoly.push(p)}else{var l=a-1;h=a-2,this.m_sinA=0,this.m_normals[l]=new m.DoublePoint(-this.m_normals[l].X,-this.m_normals[l].Y),i.m_endtype==m.EndType.etOpenSquare?this.DoSquare(l,h):this.DoRound(l,h)}for(var l=a-1;l>0;l--)this.m_normals[l]=new m.DoublePoint(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new m.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),h=a-1;for(var l=h-1;l>0;--l)h=this.OffsetPoint(l,h,i.m_jointype);i.m_endtype==m.EndType.etOpenButt?(p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*e)),this.m_destPoly.push(p),p=new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*e),m.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*e)),this.m_destPoly.push(p)):(h=1,this.m_sinA=0,i.m_endtype==m.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};m.ClipperOffset.prototype.Execute=function(){var e=arguments,t=e[0]instanceof m.PolyTree;if(t){var i=e[0],r=e[1];i.Clear(),this.FixOrientations(),this.DoOffset(r);var n=new m.Clipper(0);if(n.AddPaths(this.m_destPolys,m.PolyType.ptSubject,!0),r>0)n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftPositive,m.PolyFillType.pftPositive);else{var a=m.Clipper.GetBounds(this.m_destPolys),o=new m.Path;if(o.push(new m.IntPoint(a.left-10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.top-10)),o.push(new m.IntPoint(a.left-10,a.top-10)),n.AddPath(o,m.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftNegative,m.PolyFillType.pftNegative),i.ChildCount()==1&&i.Childs()[0].ChildCount()>0){var s=i.Childs()[0];i.Childs()[0]=s.Childs()[0];for(var l=1;l<s.ChildCount();l++)i.AddChild(s.Childs()[l])}else i.Clear()}}else{var i=e[0],r=e[1];m.Clear(i),this.FixOrientations(),this.DoOffset(r);var n=new m.Clipper(0);if(n.AddPaths(this.m_destPolys,m.PolyType.ptSubject,!0),r>0)n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftPositive,m.PolyFillType.pftPositive);else{var a=m.Clipper.GetBounds(this.m_destPolys),o=new m.Path;o.push(new m.IntPoint(a.left-10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.bottom+10)),o.push(new m.IntPoint(a.right+10,a.top-10)),o.push(new m.IntPoint(a.left-10,a.top-10)),n.AddPath(o,m.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(m.ClipType.ctUnion,i,m.PolyFillType.pftNegative,m.PolyFillType.pftNegative),i.length>0&&i.splice(0,1)}}};m.ClipperOffset.prototype.OffsetPoint=function(e,t,i){if(this.m_sinA=this.m_normals[t].X*this.m_normals[e].Y-this.m_normals[e].X*this.m_normals[t].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[t].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new m.IntPoint(this.m_srcPoly[e])),this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)));else switch(i){case m.JoinType.jtMiter:{var r=1+(this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y);r>=this.m_miterLim?this.DoMiter(e,t,r):this.DoSquare(e,t);break}case m.JoinType.jtSquare:this.DoSquare(e,t);break;case m.JoinType.jtRound:this.DoRound(e,t);break}return t=e,t};m.ClipperOffset.prototype.DoSquare=function(e,t){var i=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y)/4);this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*i)),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*i)))),this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_delta*(this.m_normals[e].X+this.m_normals[e].Y*i)),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_delta*(this.m_normals[e].Y-this.m_normals[e].X*i))))};m.ClipperOffset.prototype.DoMiter=function(e,t,i){var r=this.m_delta/i;this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+(this.m_normals[t].X+this.m_normals[e].X)*r),m.ClipperOffset.Round(this.m_srcPoly[e].Y+(this.m_normals[t].Y+this.m_normals[e].Y)*r)))};m.ClipperOffset.prototype.DoRound=function(e,t){for(var i=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y),r=m.Cast_Int32(m.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(i))),n=this.m_normals[t].X,a=this.m_normals[t].Y,o,s=0;s<r;++s)this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+n*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+a*this.m_delta))),o=n,n=n*this.m_cos-this.m_sin*a,a=o*this.m_sin+a*this.m_cos;this.m_destPoly.push(new m.IntPoint(m.ClipperOffset.Round(this.m_srcPoly[e].X+this.m_normals[e].X*this.m_delta),m.ClipperOffset.Round(this.m_srcPoly[e].Y+this.m_normals[e].Y*this.m_delta)))};m.Error=function(e){try{throw new Error(e)}catch(t){alert(t.message)}};m.JS={};m.JS.AreaOfPolygon=function(e,t){return t||(t=1),m.Clipper.Area(e)/(t*t)};m.JS.AreaOfPolygons=function(e,t){t||(t=1);for(var i=0,r=0;r<e.length;r++)i+=m.Clipper.Area(e[r]);return i/(t*t)};m.JS.BoundsOfPath=function(e,t){return m.JS.BoundsOfPaths([e],t)};m.JS.BoundsOfPaths=function(e,t){t||(t=1);var i=m.Clipper.GetBounds(e);return i.left/=t,i.bottom/=t,i.right/=t,i.top/=t,i};m.JS.Clean=function(r,t){if(!(r instanceof Array))return[];var i=r[0]instanceof Array,r=m.JS.Clone(r);if(typeof t!="number"||t===null)return m.Error("Delta is not a number in Clean()."),r;if(r.length===0||r.length==1&&r[0].length===0||t<0)return r;i||(r=[r]);for(var n=r.length,a,o,s,l,u,h,c,p=[],d=0;d<n;d++)if(o=r[d],a=o.length,a!==0){if(a<3){s=o,p.push(s);continue}for(s=o,l=t*t,u=o[0],h=1,c=1;c<a;c++)(o[c].X-u.X)*(o[c].X-u.X)+(o[c].Y-u.Y)*(o[c].Y-u.Y)<=l||(s[h]=o[c],u=o[c],h++);u=o[h-1],(o[0].X-u.X)*(o[0].X-u.X)+(o[0].Y-u.Y)*(o[0].Y-u.Y)<=l&&h--,h<a&&s.splice(h,a-h),s.length&&p.push(s)}return!i&&p.length?p=p[0]:!i&&p.length===0?p=[]:i&&p.length===0&&(p=[[]]),p};m.JS.Clone=function(e){if(!(e instanceof Array))return[];if(e.length===0)return[];if(e.length==1&&e[0].length===0)return[[]];var t=e[0]instanceof Array;t||(e=[e]);var i=e.length,r,n,a,o,s=new Array(i);for(n=0;n<i;n++){for(r=e[n].length,o=new Array(r),a=0;a<r;a++)o[a]={X:e[n][a].X,Y:e[n][a].Y};s[n]=o}return t||(s=s[0]),s};m.JS.Lighten=function(e,t){if(!(e instanceof Array))return[];if(typeof t!="number"||t===null)return m.Error("Tolerance is not a number in Lighten()."),m.JS.Clone(e);if(e.length===0||e.length==1&&e[0].length===0||t<0)return m.JS.Clone(e);e[0]instanceof Array||(e=[e]);var i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v=e.length,w=t*t,P=[];for(i=0;i<v;i++)if(n=e[i],s=n.length,s!=0){for(a=0;a<1e6;a++){for(o=[],s=n.length,n[s-1].X!=n[0].X||n[s-1].Y!=n[0].Y?(d=1,n.push({X:n[0].X,Y:n[0].Y}),s=n.length):d=0,p=[],r=0;r<s-2;r++)l=n[r],h=n[r+1],u=n[r+2],_=l.X,b=l.Y,f=u.X-_,y=u.Y-b,(f!==0||y!==0)&&(g=((h.X-_)*f+(h.Y-b)*y)/(f*f+y*y),g>1?(_=u.X,b=u.Y):g>0&&(_+=f*g,b+=y*g)),f=h.X-_,y=h.Y-b,c=f*f+y*y,c<=w&&(p[r+1]=1,r++);for(o.push({X:n[0].X,Y:n[0].Y}),r=1;r<s-1;r++)p[r]||o.push({X:n[r].X,Y:n[r].Y});if(o.push({X:n[s-1].X,Y:n[s-1].Y}),d&&n.pop(),p.length)n=o;else break}s=o.length,o[s-1].X==o[0].X&&o[s-1].Y==o[0].Y&&o.pop(),o.length>2&&P.push(o)}return!e[0]instanceof Array&&(P=P[0]),typeof P>"u"&&(P=[[]]),P};m.JS.PerimeterOfPath=function(e,t,i){if(typeof e>"u")return 0;var r=Math.sqrt,n=0,a,o,s=0,l=0,u=0,h=0,c=e.length;if(c<2)return 0;for(t&&(e[c]=e[0],c++);--c;)a=e[c],s=a.X,l=a.Y,o=e[c-1],u=o.X,h=o.Y,n+=r((s-u)*(s-u)+(l-h)*(l-h));return t&&e.pop(),n/i};m.JS.PerimeterOfPaths=function(e,t,i){i||(i=1);for(var r=0,n=0;n<e.length;n++)r+=m.JS.PerimeterOfPath(e[n],t,i);return r};m.JS.ScaleDownPath=function(e,t){var i,r;for(t||(t=1),i=e.length;i--;)r=e[i],r.X=r.X/t,r.Y=r.Y/t};m.JS.ScaleDownPaths=function(e,t){var i,r,n,a=Math.round;for(t||(t=1),i=e.length;i--;)for(r=e[i].length;r--;)n=e[i][r],n.X=n.X/t,n.Y=n.Y/t};m.JS.ScaleUpPath=function(e,t){var i,r,n=Math.round;for(t||(t=1),i=e.length;i--;)r=e[i],r.X=n(r.X*t),r.Y=n(r.Y*t)};m.JS.ScaleUpPaths=function(e,t){var i,r,n,a=Math.round;for(t||(t=1),i=e.length;i--;)for(r=e[i].length;r--;)n=e[i][r],n.X=a(n.X*t),n.Y=a(n.Y*t)};m.ExPolygons=function(){return[]};m.ExPolygon=function(){this.outer=null,this.holes=null};m.JS.AddOuterPolyNodeToExPolygons=function(e,t){var i=new m.ExPolygon;i.outer=e.Contour();var r=e.Childs(),n=r.length;i.holes=new Array(n);var a,o,s,l,u,h;for(s=0;s<n;s++)for(a=r[s],i.holes[s]=a.Contour(),l=0,u=a.Childs(),h=u.length;l<h;l++)o=u[l],m.JS.AddOuterPolyNodeToExPolygons(o,t);t.push(i)};m.JS.ExPolygonsToPaths=function(e){var t,i,r,n,a=new m.Paths;for(t=0,r=e.length;t<r;t++)for(a.push(e[t].outer),i=0,n=e[t].holes.length;i<n;i++)a.push(e[t].holes[i]);return a};m.JS.PolyTreeToExPolygons=function(e){var t=new m.ExPolygons,i,r,n,a;for(r=0,n=e.Childs(),a=n.length;r<a;r++)i=n[r],m.JS.AddOuterPolyNodeToExPolygons(i,t);return t};Cs.exports=m});O();var $s="[MappedinJS]",O2=(n=>(n[n.LOG=0]="LOG",n[n.WARN=1]="WARN",n[n.ERROR=2]="ERROR",n[n.SILENT=3]="SILENT",n))(O2||{});function N2(e="",{prefix:t=$s}={}){let i="".concat(t).concat(e?"-".concat(e):""),r=(n,a)=>{if(typeof window<"u"&&window.rnDebug){let o=a.map(s=>s instanceof Error&&s.stack?"".concat(s.message,"\n").concat(s.stack):s);window.rnDebug("".concat(e," ").concat(n,": ").concat(o.join(" ")))}};return{logState:Q.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&(console.log(i,...n),r("log",n))},warn(...n){this.logState<=1&&(console.warn(i,...n),r("warn",n))},error(...n){this.logState<=2&&(console.error(i,...n),r("error",n))},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)},setLevel(n){0<=n&&n<=3&&(this.logState=n)}}}var dy=N2();function TV(e){0<=e&&e<=3&&(dy.logState=e)}var Ft=dy;O();function fy(e,t,i=!1){let r=null,n=0,a=function(...o){n++,n===1&&i===!0&&e(...o);let s=()=>{(!i||n>1)&&e(...o),r=null,n=0};clearTimeout(r),r=setTimeout(s,t)};return a.cancel=function(){r&&(clearTimeout(r),r=null),n=0},a}function IV(e,t,i){let r=null,n=null,a,o=null,s=0;i||(i={});let l=function(){s=i.leading===!1?0:Date.now(),o=null,n&&(a=e.apply(r,n)),o||(r=n=null)};return function(...u){let h=Date.now();!s&&i.leading===!1&&(s=h);let c=t-(h-s);return c<=0||c>t?(o&&(clearTimeout(o),o=null),s=h,a=e.apply(this,u),o||(r=n=null)):!o&&i.trailing!==!1&&(r=this,n=u,o=setTimeout(l,c)),a}}O();O();function V2(e,t){return"".concat(t," ").concat(e)}var Zs=class extends Error{constructor(t,i=$s){super(V2(t,i)),this.name="MappedinError"}},my=class extends Zs{constructor(t,i=$s){super(t,i),this.name="MappedinRenderError"}};var yy=["ease-in","ease-out","ease-in-out","linear","ease-out-cubic"];var gy=e=>e,j2=e=>e*e,U2=e=>1-Math.cos(e*Math.PI/2),G2=e=>1-(1-e)*(1-e),X2=e=>1-Math.pow(1-e,3),q2={linear:gy,"ease-in":j2,"ease-out":G2,"ease-in-out":U2,"ease-out-cubic":X2};function $2(e,t,i,r,n,a=gy){if(t===i)return n;e=Math.max(t,Math.min(e,i));let o=(e-Math.min(t,i))/Math.abs(i-t),s=typeof a=="function"?a(o):q2[a](o);return r+s*(n-r)}function RV(e,t){let i=0;if(t.length<2)return i;let n=t[0]<t[1]?(a,o)=>a>o:(a,o)=>a<o;for(;i<t.length-1&&n(e,t[i+1]);)i++;return i>t.length-2?Math.max(0,t.length-2):i}O();O();var er=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-er.Bounce.Out(1-e)},Out:function(e){return e<.36363636363636365?7.5625*e*e:e<.7272727272727273?7.5625*(e-=.5454545454545454)*e+.75:e<.9090909090909091?7.5625*(e-=.8181818181818182)*e+.9375:7.5625*(e-=.9545454545454546)*e+.984375},InOut:function(e){return e<.5?er.Bounce.In(e*2)*.5:er.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),oo=function(){return performance.now()},Z2=(function(){function e(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(i){return t._tweens[i]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];for(var n=0,a=i;n<a.length;n++){var o=a[n];(t=o._group)===null||t===void 0||t.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},e.prototype.remove=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];for(var r=0,n=t;r<n.length;r++){var a=n[r];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,i){t===void 0&&(t=oo()),i===void 0&&(i=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<r.length;n++){var a=this._tweens[r[n]],o=!i;a&&a.update(t,o)===!1&&!i&&this.remove(a)}r=Object.keys(this._tweensAddedDuringUpdate)}},e})(),ta={Linear:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),a=ta.Utils.Linear;return t<0?a(e[0],e[1],r):t>1?a(e[i],e[i-1],i-r):a(e[n],e[n+1>i?i:n+1],r-n)},Bezier:function(e,t){for(var i=0,r=e.length-1,n=Math.pow,a=ta.Utils.Bernstein,o=0;o<=r;o++)i+=n(1-t,r-o)*n(t,o)*e[o]*a(r,o);return i},CatmullRom:function(e,t){var i=e.length-1,r=i*t,n=Math.floor(r),a=ta.Utils.CatmullRom;return e[0]===e[i]?(t<0&&(n=Math.floor(r=i*(1+t))),a(e[(n-1+i)%i],e[n],e[(n+1)%i],e[(n+2)%i],r-n)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[i]-(a(e[i],e[i],e[i-1],e[i-1],r-i)-e[i]):a(e[n?n-1:0],e[n],e[i<n+1?i:n+1],e[i<n+2?i:n+2],r-n)},Utils:{Linear:function(e,t,i){return(t-e)*i+e},Bernstein:function(e,t){var i=ta.Utils.Factorial;return i(e)/i(t)/i(e-t)},Factorial:(function(){var e=[1];return function(t){var i=1;if(e[t])return e[t];for(var r=t;r>1;r--)i*=r;return e[t]=i,i}})(),CatmullRom:function(e,t,i,r,n){var a=(i-e)*.5,o=(r-t)*.5,s=n*n,l=n*s;return(2*t-2*i+a+o)*l+(-3*t+3*i-2*a-o)*s+a*n+t}}},_y=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),$h=new Z2,OV=(function(){function e(t,i){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=er.Linear.None,this._interpolationFunction=ta.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=_y.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof i=="object"?(this._group=i,i.add(this)):i===!0&&(this._group=$h,$h.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,i){if(i===void 0&&(i=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=i<0?0:i,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,i){if(t===void 0&&(t=oo()),i===void 0&&(i=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||i){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var a in this._valuesEnd)n[a]=this._valuesEnd[a];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,i)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,i,r,n,a){for(var o in r){var s=t[o],l=Array.isArray(s),u=l?"array":typeof s,h=!l&&Array.isArray(r[o]);if(!(u==="undefined"||u==="function")){if(h){var c=r[o];if(c.length===0)continue;for(var p=[s],d=0,f=c.length;d<f;d+=1){var y=this._handleRelativeValue(s,c[d]);if(isNaN(y)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(y)}h&&(r[o]=p)}if((u==="object"||l)&&s&&!h){i[o]=l?[]:{};var g=s;for(var _ in g)i[o][_]=g[_];n[o]=l?[]:{};var c=r[o];if(!this._isDynamic){var b={};for(var _ in c)b[_]=c[_];r[o]=c=b}this._setupProperties(g,i[o],c,n[o],a)}else(typeof i[o]>"u"||a)&&(i[o]=s),l||(i[o]*=1),h?n[o]=r[o].slice().reverse():n[o]=i[o]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=oo()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=oo()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,i=this._chainedTweens.length;t<i;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=er.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=ta.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,i){var r=this,n;if(t===void 0&&(t=oo()),i===void 0&&(i=e.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(i)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=t-this._startTime,s=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),l=this._duration+this._repeat*s,u=function(){if(r._duration===0||o>l)return 1;var y=Math.trunc(o/s),g=o-y*s,_=Math.min(g/r._duration,1);return _===0&&o===r._duration?1:_},h=u(),c=this._easingFunction(h);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),this._duration===0||o>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((o-this._duration)/s)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=s*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var d=0,f=this._chainedTweens.length;d<f;d++)this._chainedTweens[d].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,i,r,n){for(var a in r)if(i[a]!==void 0){var o=i[a]||0,s=r[a],l=Array.isArray(t[a]),u=Array.isArray(s),h=!l&&u;h?t[a]=this._interpolationFunction(s,n):typeof s=="object"&&s?this._updateProperties(t[a],o,s,n):(s=this._handleRelativeValue(o,s),typeof s=="number"&&(t[a]=o+(s-o)*n))}},e.prototype._handleRelativeValue=function(t,i){return typeof i!="string"?i:i.charAt(0)==="+"||i.charAt(0)==="-"?t+parseFloat(i):parseFloat(i)},e.prototype._swapEndStartRepeatValues=function(t){var i=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=i},e.autoStartOnUpdate=!1,e})();var NV=_y.nextId,tr=$h,VV=tr.getAll.bind(tr),jV=tr.removeAll.bind(tr),UV=tr.add.bind(tr),GV=tr.remove.bind(tr),XV=tr.update.bind(tr);var Y2={linear:er.Linear.None,"ease-in":er.Quadratic.In,"ease-out":er.Quadratic.Out,"ease-in-out":er.Quadratic.InOut};var W2={tension:0,cornerRadius:.5},H2="mappedin",xy="collision-worker.csp.js",vy="maplibre-worker.csp.js",Zh="";function by(e){Zh=e}var wy="";function K2(e){wy=e}var J2=!1;function Q2(){J2=!0}var Py=!0;function eP(e){Py=e}function Yh(){return Py}O();O();O();import Ar from"zod";var Sy=Ar.enum(yy),tP=e=>{let t=e[0];for(let i=1;i<e.length;i++){let r=e[i];if(r<=t)return!1;t=r}return!0},iP=e=>{let t=e[0];for(let i=1;i<e.length;i++){let r=e[i];if(r>=t)return!1;t=r}return!0},rP=e=>tP(e)||iP(e),nP=Ar.object({on:Ar.literal("zoom-level"),input:Ar.tuple([Ar.number()]).rest(Ar.number()).refine(rP,{message:"input array must be strictly increasing or decreasing"}),output:Ar.tuple([Ar.number()]).rest(Ar.number()),easing:Sy.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"});O();O();O();O();O();O();import{z as oi}from"zod";var Ty=oi.object({rotation:oi.array(oi.number()).length(3).optional(),altitude:oi.number().optional(),scale:oi.array(oi.number()).length(3).optional(),interactive:oi.boolean().optional(),verticalOffset:oi.number().optional(),id:oi.union([oi.number(),oi.string()]).optional()}),My=oi.object({color:oi.string()});O();import{z as Pe}from"zod";var Wh=Pe.object({visible:Pe.boolean(),color:Pe.string(),flipToFaceCamera:Pe.boolean(),font:Pe.string().optional(),fontSize:Pe.number(),margin:Pe.union([Pe.number(),Pe.tuple([Pe.number(),Pe.number(),Pe.number(),Pe.number()])]),outlineColor:Pe.string(),outlineOpacity:Pe.number(),outlineBlur:Pe.union([Pe.number(),Pe.string()]),outlineWidth:Pe.number(),outlineOffsetX:Pe.number(),outlineOffsetY:Pe.number(),strokeWidth:Pe.number(),maxWidth:Pe.number().optional(),maxHeight:Pe.number().optional(),strokeOpacity:Pe.number(),strokeColor:Pe.string(),fillOpacity:Pe.number(),hoverColor:Pe.string().optional(),id:Pe.union([Pe.string(),Pe.number()]),type:Pe.literal("text3d"),position:Pe.tuple([Pe.number(),Pe.number(),Pe.number()]),content:Pe.string(),rotation:Pe.number()}),Hh=Pe.strictObject(Wh.partial().omit({id:!0,type:!0}).shape),Cy=Pe.strictObject(Hh.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape);O();var aP=Object.create,Lp=Object.defineProperty,oP=Object.getOwnPropertyDescriptor,sP=Object.getOwnPropertyNames,lP=Object.getPrototypeOf,uP=Object.prototype.hasOwnProperty,ji=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Nn=(e,t)=>{for(var i in t)Lp(e,i,{get:t[i],enumerable:!0})},hP=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of sP(t))!uP.call(e,n)&&n!==i&&Lp(e,n,{get:()=>t[n],enumerable:!(r=oP(t,n))||r.enumerable});return e},fe=(e,t,i)=>(i=e!=null?aP(lP(e)):{},hP(t||!e||!e.__esModule?Lp(i,"default",{value:e,enumerable:!0}):i,e)),ge=ji((e,t)=>{"use strict";t.exports=i;function i(r,n){this.x=r,this.y=n}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(r){return this.clone()._add(r)},sub:function(r){return this.clone()._sub(r)},multByPoint:function(r){return this.clone()._multByPoint(r)},divByPoint:function(r){return this.clone()._divByPoint(r)},mult:function(r){return this.clone()._mult(r)},div:function(r){return this.clone()._div(r)},rotate:function(r){return this.clone()._rotate(r)},rotateAround:function(r,n){return this.clone()._rotateAround(r,n)},matMult:function(r){return this.clone()._matMult(r)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(r){return this.x===r.x&&this.y===r.y},dist:function(r){return Math.sqrt(this.distSqr(r))},distSqr:function(r){var n=r.x-this.x,a=r.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith:function(r){return this.angleWithSep(r.x,r.y)},angleWithSep:function(r,n){return Math.atan2(this.x*n-this.y*r,this.x*r+this.y*n)},_matMult:function(r){var n=r[0]*this.x+r[1]*this.y,a=r[2]*this.x+r[3]*this.y;return this.x=n,this.y=a,this},_add:function(r){return this.x+=r.x,this.y+=r.y,this},_sub:function(r){return this.x-=r.x,this.y-=r.y,this},_mult:function(r){return this.x*=r,this.y*=r,this},_div:function(r){return this.x/=r,this.y/=r,this},_multByPoint:function(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint:function(r){return this.x/=r.x,this.y/=r.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var r=this.y;return this.y=this.x,this.x=-r,this},_rotate:function(r){var n=Math.cos(r),a=Math.sin(r),o=n*this.x-a*this.y,s=a*this.x+n*this.y;return this.x=o,this.y=s,this},_rotateAround:function(r,n){var a=Math.cos(r),o=Math.sin(r),s=n.x+a*(this.x-n.x)-o*(this.y-n.y),l=n.y+o*(this.x-n.x)+a*(this.y-n.y);return this.x=s,this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(r){return r instanceof i?r:Array.isArray(r)?new i(r[0],r[1]):r}}),cP=ji((e,t)=>{"use strict";t.exports=i;function i(r,n,a,o){this.cx=3*r,this.bx=3*(a-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(o-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=n,this.p2x=a,this.p2y=o}i.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,n){if(n===void 0&&(n=1e-6),r<0)return 0;if(r>1)return 1;for(var a=r,o=0;o<8;o++){var s=this.sampleCurveX(a)-r;if(Math.abs(s)<n)return a;var l=this.sampleCurveDerivativeX(a);if(Math.abs(l)<1e-6)break;a=a-s/l}var u=0,h=1;for(a=r,o=0;o<20&&(s=this.sampleCurveX(a),!(Math.abs(s-r)<n));o++)r>s?u=a:h=a,a=(h-u)*.5+u;return a},solve:function(r,n){return this.sampleCurveY(this.solveCurveX(r,n))}}}),pP=ji((e,t)=>{function i(r,n){var a,o,s,l,u,h,c,p,d,f;for(a=r.length&3,o=r.length-a,s=n,u=3432918353,c=461845907,f=0;f<o;)d=r.charCodeAt(f)&255|(r.charCodeAt(++f)&255)<<8|(r.charCodeAt(++f)&255)<<16|(r.charCodeAt(++f)&255)<<24,++f,d=(d&65535)*u+(((d>>>16)*u&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,s^=d,s=s<<13|s>>>19,l=(s&65535)*5+(((s>>>16)*5&65535)<<16)&4294967295,s=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(d=0,a){case 3:d^=(r.charCodeAt(f+2)&255)<<16;case 2:d^=(r.charCodeAt(f+1)&255)<<8;case 1:d^=r.charCodeAt(f)&255,d=(d&65535)*u+(((d>>>16)*u&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,s^=d}return s^=r.length,s^=s>>>16,s=(s&65535)*2246822507+(((s>>>16)*2246822507&65535)<<16)&4294967295,s^=s>>>13,s=(s&65535)*3266489909+(((s>>>16)*3266489909&65535)<<16)&4294967295,s^=s>>>16,s>>>0}typeof t<"u"&&(t.exports=i)}),dP=ji((e,t)=>{function i(r,n){for(var a=r.length,o=n^a,s=0,l;a>=4;)l=r.charCodeAt(s)&255|(r.charCodeAt(++s)&255)<<8|(r.charCodeAt(++s)&255)<<16|(r.charCodeAt(++s)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)^l,a-=4,++s;switch(a){case 3:o^=(r.charCodeAt(s+2)&255)<<16;case 2:o^=(r.charCodeAt(s+1)&255)<<8;case 1:o^=r.charCodeAt(s)&255,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)}return o^=o>>>13,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>15,o>>>0}typeof t!==void 0&&(t.exports=i)}),k_=ji((e,t)=>{var i=pP(),r=dP();t.exports=i,t.exports.murmur3=i,t.exports.murmur2=r}),D_=ji((e,t)=>{"use strict";var i=ge();t.exports=r;function r(l,u,h,c,p){this.properties={},this.extent=h,this.type=0,this._pbf=l,this._geometry=-1,this._keys=c,this._values=p,l.readFields(n,this,u)}function n(l,u,h){l==1?u.id=h.readVarint():l==2?a(h,u):l==3?u.type=h.readVarint():l==4&&(u._geometry=h.pos)}function a(l,u){for(var h=l.readVarint()+l.pos;l.pos<h;){var c=u._keys[l.readVarint()],p=u._values[l.readVarint()];u.properties[c]=p}}r.types=["Unknown","Point","LineString","Polygon"],r.prototype.loadGeometry=function(){var l=this._pbf;l.pos=this._geometry;for(var u=l.readVarint()+l.pos,h=1,c=0,p=0,d=0,f=[],y;l.pos<u;){if(c<=0){var g=l.readVarint();h=g&7,c=g>>3}if(c--,h===1||h===2)p+=l.readSVarint(),d+=l.readSVarint(),h===1&&(y&&f.push(y),y=[]),y.push(new i(p,d));else if(h===7)y&&y.push(y[0].clone());else throw new Error("unknown command "+h)}return y&&f.push(y),f},r.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var u=l.readVarint()+l.pos,h=1,c=0,p=0,d=0,f=1/0,y=-1/0,g=1/0,_=-1/0;l.pos<u;){if(c<=0){var b=l.readVarint();h=b&7,c=b>>3}if(c--,h===1||h===2)p+=l.readSVarint(),d+=l.readSVarint(),p<f&&(f=p),p>y&&(y=p),d<g&&(g=d),d>_&&(_=d);else if(h!==7)throw new Error("unknown command "+h)}return[f,g,y,_]},r.prototype.toGeoJSON=function(l,u,h){var c=this.extent*Math.pow(2,h),p=this.extent*l,d=this.extent*u,f=this.loadGeometry(),y=r.types[this.type],g,_;function b(P){for(var S=0;S<P.length;S++){var C=P[S],E=180-(C.y+d)*360/c;P[S]=[(C.x+p)*360/c-180,360/Math.PI*Math.atan(Math.exp(E*Math.PI/180))-90]}}switch(this.type){case 1:var v=[];for(g=0;g<f.length;g++)v[g]=f[g][0];f=v,b(f);break;case 2:for(g=0;g<f.length;g++)b(f[g]);break;case 3:for(f=o(f),g=0;g<f.length;g++)for(_=0;_<f[g].length;_++)b(f[g][_]);break}f.length===1?f=f[0]:y="Multi"+y;var w={type:"Feature",geometry:{type:y,coordinates:f},properties:this.properties};return"id"in this&&(w.id=this.id),w};function o(l){var u=l.length;if(u<=1)return[l];for(var h=[],c,p,d=0;d<u;d++){var f=s(l[d]);f!==0&&(p===void 0&&(p=f<0),p===f<0?(c&&h.push(c),c=[l[d]]):c.push(l[d]))}return c&&h.push(c),h}function s(l){for(var u=0,h=0,c=l.length,p=c-1,d,f;h<c;p=h++)d=l[h],f=l[p],u+=(f.x-d.x)*(d.y+f.y);return u}}),L_=ji((e,t)=>{"use strict";var i=D_();t.exports=r;function r(o,s){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=o,this._keys=[],this._values=[],this._features=[],o.readFields(n,this,s),this.length=this._features.length}function n(o,s,l){o===15?s.version=l.readVarint():o===1?s.name=l.readString():o===5?s.extent=l.readVarint():o===2?s._features.push(l.pos):o===3?s._keys.push(l.readString()):o===4&&s._values.push(a(l))}function a(o){for(var s=null,l=o.readVarint()+o.pos;o.pos<l;){var u=o.readVarint()>>3;s=u===1?o.readString():u===2?o.readFloat():u===3?o.readDouble():u===4?o.readVarint64():u===5?o.readVarint():u===6?o.readSVarint():u===7?o.readBoolean():null}return s}r.prototype.feature=function(o){if(o<0||o>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[o];var s=this._pbf.readVarint()+this._pbf.pos;return new i(this._pbf,s,this.extent,this._keys,this._values)}}),fP=ji((e,t)=>{"use strict";var i=L_();t.exports=r;function r(a,o){this.layers=a.readFields(n,{},o)}function n(a,o,s){if(a===3){var l=new i(s,s.readVarint()+s.pos);l.length&&(o[l.name]=l)}}}),au=ji((e,t)=>{t.exports.VectorTile=fP(),t.exports.VectorTileFeature=D_(),t.exports.VectorTileLayer=L_()}),mP=ji(e=>{e.read=function(t,i,r,n,a){var o,s,l=a*8-n-1,u=(1<<l)-1,h=u>>1,c=-7,p=r?a-1:0,d=r?-1:1,f=t[i+p];for(p+=d,o=f&(1<<-c)-1,f>>=-c,c+=l;c>0;o=o*256+t[i+p],p+=d,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=s*256+t[i+p],p+=d,c-=8);if(o===0)o=1-h;else{if(o===u)return s?NaN:(f?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-h}return(f?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,i,r,n,a,o){var s,l,u,h=o*8-a-1,c=(1<<h)-1,p=c>>1,d=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,y=n?1:-1,g=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(l=isNaN(i)?1:0,s=c):(s=Math.floor(Math.log(i)/Math.LN2),i*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+p>=1?i+=d/u:i+=d*Math.pow(2,1-p),i*u>=2&&(s++,u/=2),s+p>=c?(l=0,s=c):s+p>=1?(l=(i*u-1)*Math.pow(2,a),s=s+p):(l=i*Math.pow(2,p-1)*Math.pow(2,a),s=0));a>=8;t[r+f]=l&255,f+=y,l/=256,a-=8);for(s=s<<a|l,h+=a;h>0;t[r+f]=s&255,f+=y,s/=256,h-=8);t[r+f-y]|=g*128}}),z_=ji((e,t)=>{"use strict";t.exports=r;var i=mP();function r(x){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(x)?x:new Uint8Array(x||0),this.pos=0,this.type=0,this.length=this.buf.length}r.Varint=0,r.Fixed64=1,r.Bytes=2,r.Fixed32=5;var n=65536*65536,a=1/n,o=12,s=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");r.prototype={destroy:function(){this.buf=null},readFields:function(x,T,I){for(I=I||this.length;this.pos<I;){var U=this.readVarint(),X=U>>3,Z=this.pos;this.type=U&7,x(X,T,this),this.pos===Z&&this.skip(U)}return T},readMessage:function(x,T){return this.readFields(x,T,this.readVarint()+this.pos)},readFixed32:function(){var x=E(this.buf,this.pos);return this.pos+=4,x},readSFixed32:function(){var x=B(this.buf,this.pos);return this.pos+=4,x},readFixed64:function(){var x=E(this.buf,this.pos)+E(this.buf,this.pos+4)*n;return this.pos+=8,x},readSFixed64:function(){var x=E(this.buf,this.pos)+B(this.buf,this.pos+4)*n;return this.pos+=8,x},readFloat:function(){var x=i.read(this.buf,this.pos,!0,23,4);return this.pos+=4,x},readDouble:function(){var x=i.read(this.buf,this.pos,!0,52,8);return this.pos+=8,x},readVarint:function(x){var T=this.buf,I,U;return U=T[this.pos++],I=U&127,U<128||(U=T[this.pos++],I|=(U&127)<<7,U<128)||(U=T[this.pos++],I|=(U&127)<<14,U<128)||(U=T[this.pos++],I|=(U&127)<<21,U<128)?I:(U=T[this.pos],I|=(U&15)<<28,l(I,x,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var x=this.readVarint();return x%2===1?(x+1)/-2:x/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var x=this.readVarint()+this.pos,T=this.pos;return this.pos=x,x-T>=o&&s?D(this.buf,T,x):R(this.buf,T,x)},readBytes:function(){var x=this.readVarint()+this.pos,T=this.buf.subarray(this.pos,x);return this.pos=x,T},readPackedVarint:function(x,T){if(this.type!==r.Bytes)return x.push(this.readVarint(T));var I=u(this);for(x=x||[];this.pos<I;)x.push(this.readVarint(T));return x},readPackedSVarint:function(x){if(this.type!==r.Bytes)return x.push(this.readSVarint());var T=u(this);for(x=x||[];this.pos<T;)x.push(this.readSVarint());return x},readPackedBoolean:function(x){if(this.type!==r.Bytes)return x.push(this.readBoolean());var T=u(this);for(x=x||[];this.pos<T;)x.push(this.readBoolean());return x},readPackedFloat:function(x){if(this.type!==r.Bytes)return x.push(this.readFloat());var T=u(this);for(x=x||[];this.pos<T;)x.push(this.readFloat());return x},readPackedDouble:function(x){if(this.type!==r.Bytes)return x.push(this.readDouble());var T=u(this);for(x=x||[];this.pos<T;)x.push(this.readDouble());return x},readPackedFixed32:function(x){if(this.type!==r.Bytes)return x.push(this.readFixed32());var T=u(this);for(x=x||[];this.pos<T;)x.push(this.readFixed32());return x},readPackedSFixed32:function(x){if(this.type!==r.Bytes)return x.push(this.readSFixed32());var T=u(this);for(x=x||[];this.pos<T;)x.push(this.readSFixed32());return x},readPackedFixed64:function(x){if(this.type!==r.Bytes)return x.push(this.readFixed64());var T=u(this);for(x=x||[];this.pos<T;)x.push(this.readFixed64());return x},readPackedSFixed64:function(x){if(this.type!==r.Bytes)return x.push(this.readSFixed64());var T=u(this);for(x=x||[];this.pos<T;)x.push(this.readSFixed64());return x},skip:function(x){var T=x&7;if(T===r.Varint)for(;this.buf[this.pos++]>127;);else if(T===r.Bytes)this.pos=this.readVarint()+this.pos;else if(T===r.Fixed32)this.pos+=4;else if(T===r.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+T)},writeTag:function(x,T){this.writeVarint(x<<3|T)},realloc:function(x){for(var T=this.length||16;T<this.pos+x;)T*=2;if(T!==this.length){var I=new Uint8Array(T);I.set(this.buf),this.buf=I,this.length=T}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(x){this.realloc(4),F(this.buf,x,this.pos),this.pos+=4},writeSFixed32:function(x){this.realloc(4),F(this.buf,x,this.pos),this.pos+=4},writeFixed64:function(x){this.realloc(8),F(this.buf,x&-1,this.pos),F(this.buf,Math.floor(x*a),this.pos+4),this.pos+=8},writeSFixed64:function(x){this.realloc(8),F(this.buf,x&-1,this.pos),F(this.buf,Math.floor(x*a),this.pos+4),this.pos+=8},writeVarint:function(x){if(x=+x||0,x>268435455||x<0){c(x,this);return}this.realloc(4),this.buf[this.pos++]=x&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=(x>>>=7)&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=(x>>>=7)&127|(x>127?128:0),!(x<=127)&&(this.buf[this.pos++]=x>>>7&127)))},writeSVarint:function(x){this.writeVarint(x<0?-x*2-1:x*2)},writeBoolean:function(x){this.writeVarint(!!x)},writeString:function(x){x=String(x),this.realloc(x.length*4),this.pos++;var T=this.pos;this.pos=z(this.buf,x,this.pos);var I=this.pos-T;I>=128&&f(T,I,this),this.pos=T-1,this.writeVarint(I),this.pos+=I},writeFloat:function(x){this.realloc(4),i.write(this.buf,x,this.pos,!0,23,4),this.pos+=4},writeDouble:function(x){this.realloc(8),i.write(this.buf,x,this.pos,!0,52,8),this.pos+=8},writeBytes:function(x){var T=x.length;this.writeVarint(T),this.realloc(T);for(var I=0;I<T;I++)this.buf[this.pos++]=x[I]},writeRawMessage:function(x,T){this.pos++;var I=this.pos;x(T,this);var U=this.pos-I;U>=128&&f(I,U,this),this.pos=I-1,this.writeVarint(U),this.pos+=U},writeMessage:function(x,T,I){this.writeTag(x,r.Bytes),this.writeRawMessage(T,I)},writePackedVarint:function(x,T){T.length&&this.writeMessage(x,y,T)},writePackedSVarint:function(x,T){T.length&&this.writeMessage(x,g,T)},writePackedBoolean:function(x,T){T.length&&this.writeMessage(x,v,T)},writePackedFloat:function(x,T){T.length&&this.writeMessage(x,_,T)},writePackedDouble:function(x,T){T.length&&this.writeMessage(x,b,T)},writePackedFixed32:function(x,T){T.length&&this.writeMessage(x,w,T)},writePackedSFixed32:function(x,T){T.length&&this.writeMessage(x,P,T)},writePackedFixed64:function(x,T){T.length&&this.writeMessage(x,S,T)},writePackedSFixed64:function(x,T){T.length&&this.writeMessage(x,C,T)},writeBytesField:function(x,T){this.writeTag(x,r.Bytes),this.writeBytes(T)},writeFixed32Field:function(x,T){this.writeTag(x,r.Fixed32),this.writeFixed32(T)},writeSFixed32Field:function(x,T){this.writeTag(x,r.Fixed32),this.writeSFixed32(T)},writeFixed64Field:function(x,T){this.writeTag(x,r.Fixed64),this.writeFixed64(T)},writeSFixed64Field:function(x,T){this.writeTag(x,r.Fixed64),this.writeSFixed64(T)},writeVarintField:function(x,T){this.writeTag(x,r.Varint),this.writeVarint(T)},writeSVarintField:function(x,T){this.writeTag(x,r.Varint),this.writeSVarint(T)},writeStringField:function(x,T){this.writeTag(x,r.Bytes),this.writeString(T)},writeFloatField:function(x,T){this.writeTag(x,r.Fixed32),this.writeFloat(T)},writeDoubleField:function(x,T){this.writeTag(x,r.Fixed64),this.writeDouble(T)},writeBooleanField:function(x,T){this.writeVarintField(x,!!T)}};function l(x,T,I){var U=I.buf,X,Z;if(Z=U[I.pos++],X=(Z&112)>>4,Z<128||(Z=U[I.pos++],X|=(Z&127)<<3,Z<128)||(Z=U[I.pos++],X|=(Z&127)<<10,Z<128)||(Z=U[I.pos++],X|=(Z&127)<<17,Z<128)||(Z=U[I.pos++],X|=(Z&127)<<24,Z<128)||(Z=U[I.pos++],X|=(Z&1)<<31,Z<128))return h(x,X,T);throw new Error("Expected varint not more than 10 bytes")}function u(x){return x.type===r.Bytes?x.readVarint()+x.pos:x.pos+1}function h(x,T,I){return I?T*4294967296+(x>>>0):(T>>>0)*4294967296+(x>>>0)}function c(x,T){var I,U;if(x>=0?(I=x%4294967296|0,U=x/4294967296|0):(I=~(-x%4294967296),U=~(-x/4294967296),I^4294967295?I=I+1|0:(I=0,U=U+1|0)),x>=18446744073709552e3||x<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");T.realloc(10),p(I,U,T),d(U,T)}function p(x,T,I){I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos++]=x&127|128,x>>>=7,I.buf[I.pos]=x&127}function d(x,T){var I=(x&7)<<4;T.buf[T.pos++]|=I|((x>>>=3)?128:0),x&&(T.buf[T.pos++]=x&127|((x>>>=7)?128:0),x&&(T.buf[T.pos++]=x&127|((x>>>=7)?128:0),x&&(T.buf[T.pos++]=x&127|((x>>>=7)?128:0),x&&(T.buf[T.pos++]=x&127|((x>>>=7)?128:0),x&&(T.buf[T.pos++]=x&127)))))}function f(x,T,I){var U=T<=16383?1:T<=2097151?2:T<=268435455?3:Math.floor(Math.log(T)/(Math.LN2*7));I.realloc(U);for(var X=I.pos-1;X>=x;X--)I.buf[X+U]=I.buf[X]}function y(x,T){for(var I=0;I<x.length;I++)T.writeVarint(x[I])}function g(x,T){for(var I=0;I<x.length;I++)T.writeSVarint(x[I])}function _(x,T){for(var I=0;I<x.length;I++)T.writeFloat(x[I])}function b(x,T){for(var I=0;I<x.length;I++)T.writeDouble(x[I])}function v(x,T){for(var I=0;I<x.length;I++)T.writeBoolean(x[I])}function w(x,T){for(var I=0;I<x.length;I++)T.writeFixed32(x[I])}function P(x,T){for(var I=0;I<x.length;I++)T.writeSFixed32(x[I])}function S(x,T){for(var I=0;I<x.length;I++)T.writeFixed64(x[I])}function C(x,T){for(var I=0;I<x.length;I++)T.writeSFixed64(x[I])}function E(x,T){return(x[T]|x[T+1]<<8|x[T+2]<<16)+x[T+3]*16777216}function F(x,T,I){x[I]=T,x[I+1]=T>>>8,x[I+2]=T>>>16,x[I+3]=T>>>24}function B(x,T){return(x[T]|x[T+1]<<8|x[T+2]<<16)+(x[T+3]<<24)}function R(x,T,I){for(var U="",X=T;X<I;){var Z=x[X],ie=null,pe=Z>239?4:Z>223?3:Z>191?2:1;if(X+pe>I)break;var je,le,Oe;pe===1?Z<128&&(ie=Z):pe===2?(je=x[X+1],(je&192)===128&&(ie=(Z&31)<<6|je&63,ie<=127&&(ie=null))):pe===3?(je=x[X+1],le=x[X+2],(je&192)===128&&(le&192)===128&&(ie=(Z&15)<<12|(je&63)<<6|le&63,(ie<=2047||ie>=55296&&ie<=57343)&&(ie=null))):pe===4&&(je=x[X+1],le=x[X+2],Oe=x[X+3],(je&192)===128&&(le&192)===128&&(Oe&192)===128&&(ie=(Z&15)<<18|(je&63)<<12|(le&63)<<6|Oe&63,(ie<=65535||ie>=1114112)&&(ie=null))),ie===null?(ie=65533,pe=1):ie>65535&&(ie-=65536,U+=String.fromCharCode(ie>>>10&1023|55296),ie=56320|ie&1023),U+=String.fromCharCode(ie),X+=pe}return U}function D(x,T,I){return s.decode(x.subarray(T,I))}function z(x,T,I){for(var U=0,X,Z;U<T.length;U++){if(X=T.charCodeAt(U),X>55295&&X<57344)if(Z)if(X<56320){x[I++]=239,x[I++]=191,x[I++]=189,Z=X;continue}else X=Z-55296<<10|X-56320|65536,Z=null;else{X>56319||U+1===T.length?(x[I++]=239,x[I++]=191,x[I++]=189):Z=X;continue}else Z&&(x[I++]=239,x[I++]=191,x[I++]=189,Z=null);X<128?x[I++]=X:(X<2048?x[I++]=X>>6|192:(X<65536?x[I++]=X>>12|224:(x[I++]=X>>18|240,x[I++]=X>>12&63|128),x[I++]=X>>6&63|128),x[I++]=X&63|128)}return I}}),R_={name:"@mappedin/outdoor-context",description:"Fork of maplibre-gl-js",version:"5.6.0",main:"dist/outdoor-context.js",style:"dist/outdoor-context.css",homepage:"https://www.mappedin.com",private:!1,repository:{type:"git",url:"git://github.com/mappedin/outdoor-context.git"},types:"dist/outdoor-context.d.ts",type:"module",dependencies:{"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^23.3.0","@types/geojson":"^7946.0.16","@types/geojson-vt":"3.2.5","@types/mapbox__point-geometry":"^0.1.4","@types/mapbox__vector-tile":"^1.3.4","@types/pbf":"^3.0.5","@types/supercluster":"^7.1.3",earcut:"^3.0.1","geojson-vt":"^4.0.2","gl-matrix":"^3.4.3","global-prefix":"^4.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.3.0",potpack:"^2.0.0",quickselect:"^3.0.0",supercluster:"^8.0.1",tinyqueue:"^3.0.0","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.3.0","@mapbox/mvt-fixtures":"^3.10.0","@types/benchmark":"^2.1.5","@types/d3":"^7.4.3","@types/diff":"^7.0.2","@types/earcut":"^3.0.0","@types/eslint":"^9.6.1","@types/gl":"^6.0.5","@types/glob":"^8.1.0","@types/jsdom":"^21.1.7","@types/minimist":"^1.2.5","@types/murmurhash-js":"^1.0.6","@types/nise":"^1.4.5","@types/node":"^22.15.29","@types/offscreencanvas":"^2019.7.3","@types/pixelmatch":"^5.2.6","@types/pngjs":"^6.0.5","@types/react":"^19.1.6","@types/react-dom":"^19.1.5","@types/request":"^2.48.12","@types/shuffle-seed":"^1.1.3","@types/window-or-global":"^1.0.6","@typescript-eslint/eslint-plugin":"^8.33.1","@typescript-eslint/parser":"^8.33.0","@vitest/coverage-v8":"3.1.3","@vitest/ui":"3.1.3",address:"^2.0.3",autoprefixer:"^10.4.21",benchmark:"^2.1.4",canvas:"^3.1.0",cspell:"^9.0.2",cssnano:"^7.0.7",d3:"^7.9.0","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1468520",diff:"^8.0.2","dts-bundle-generator":"^9.5.1",esbuild:"^0.27.2","esbuild-plugin-glsl":"^1.4.1",eslint:"^9.28.0","eslint-plugin-html":"^8.1.3","eslint-plugin-import":"^2.31.0","eslint-plugin-react":"^7.37.5","eslint-plugin-tsdoc":"0.4.0","eslint-plugin-vitest":"^0.5.4",expect:"^29.7.0",glob:"^11.0.2",globals:"^16.2.0",husky:"^8.0.0","is-builtin-module":"^5.0.0",jsdom:"^26.1.0","junit-report-builder":"^5.1.1","lint-staged":"^12.1.2",minimist:"^1.2.8","mock-geolocation":"^1.0.11","monocart-coverage-reports":"^2.12.6",nise:"^6.1.1","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5",nyc:"^15.1.0","pdf-merger-js":"^5.1.2",pixelmatch:"^7.1.0",pngjs:"^7.0.0",postcss:"^8.5.4","postcss-cli":"^11.0.1","postcss-inline-svg":"^6.0.0",prettier:"^3.7.4","pretty-bytes":"^7.0.0",puppeteer:"^24.9.0",react:"^19.0.0","react-dom":"^19.1.0",rw:"^1.3.3",semver:"^7.7.2",sharp:"^0.34.2","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.2",stylelint:"^16.20.0","stylelint-config-standard":"^38.0.0","ts-node":"^10.9.2",tslib:"^2.8.1",typedoc:"^0.28.5","typedoc-plugin-markdown":"^4.6.4","typedoc-plugin-missing-exports":"^4.0.0",typescript:"^5.8.3",vitest:"3.1.3","vitest-webgl-canvas-mock":"^1.1.0"},scripts:{"generate-dist-package":"node --no-warnings --loader ts-node/esm build/generate-dist-package.js","generate-shaders":"node --no-warnings --loader ts-node/esm build/generate-shaders.ts","generate-struct-arrays":"node --no-warnings --loader ts-node/esm build/generate-struct-arrays.ts","generate-style-code":"node --no-warnings --loader ts-node/esm build/generate-style-code.ts","generate-typings":"dts-bundle-generator --export-referenced-types --umd-module-name=maplibregl -o ./dist/outdoor-context.d.ts ./src/index.ts","generate-docs":"typedoc && node --no-warnings --loader ts-node/esm build/generate-docs.ts","generate-images":"node --no-warnings --loader ts-node/esm build/generate-doc-images.ts","build-dist":"npm run build-css && npm run generate-typings && npm run generate-shaders && npm run build-dev && npm run build-csp-dev && npm run build-prod && npm run build-csp","build-dev":"BUILD=dev node build/esbuild.mjs","watch-dev":"BUILD=dev node build/esbuild.mjs --watch","build-prod":"BUILD=production node build/esbuild.mjs","build-csp":"BUILD=production node build/esbuild.mjs --csp","build-csp-dev":"BUILD=dev node build/esbuild.mjs --csp","build-css":"postcss -o dist/outdoor-context.css src/css/outdoor-context.css && postcss --config postcss.config.min.js -o dist/outdoor-context-min.css src/css/outdoor-context-min.css","watch-css":"postcss --watch -o dist/outdoor-context.css src/css/outdoor-context.css",spellcheck:"cspell","start-server":"st --no-cache -H localhost --port 9966 .","start-docs":"docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint","lint-css":"stylelint **/*.css --fix -f verbose",test:"run-p lint lint-css test-render test-unit test-integration test-build","test-unit":"vitest run --config vitest.config.unit.ts","test-unit-ci":"vitest run --config vitest.config.unit.ts --coverage","test-integration":"vitest run --config vitest.config.integration.ts","test-integration-ci":"vitest run --config vitest.config.integration.ts --coverage","test-build":"vitest run --config vitest.config.build.ts","test-build-ci":"vitest run --config vitest.config.build.ts --coverage","test-watch-roots":"vitest --config vitest.config.unit.ts --watch","test-render":"node --no-warnings --loader ts-node/esm test/integration/render/run_render_tests.ts",codegen:"run-p --print-label generate-dist-package generate-style-code generate-struct-arrays generate-shaders && npm run generate-typings",benchmark:"node --no-warnings --loader ts-node/esm test/bench/run-benchmarks.ts","gl-stats":"node --no-warnings --loader ts-node/esm test/bench/gl-stats.ts",prepare:"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings","prettier:check":"prettier --check .","prettier:fix":"prettier --write .","publish:ci":'pnpm publish -r --no-git-checks --ignore-scripts --force --registry "https://npm.pkg.github.com/"',"version:ci":"pnpm version prerelease --no-git-tag-version","test:ci:cover":"mkdir .nyc_temp || true && pnpm cover && pnpm cover:merge && pnpm cover:report && pnpm cover:cleanup",cover:"nyc --silent pnpm test-unit-ci && cp ./coverage/vitest/unit/coverage-final.json ./.nyc_temp/coverage-maplibre.json","cover:merge":"nyc merge .nyc_temp ./.nyc_final/coverage.json","cover:report":"nyc report --reporter=json-summary --report-dir coverage/combined --temp-dir ./.nyc_final","cover:cleanup":"rm -r ./.nyc_final ./.nyc_temp ./.nyc_output"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0",pnpm:">=10.11.0"},volta:{node:"24.12.0"},"lint-staged":{"*.{ts,tsx,js,jsx,json,css,md}":["prettier --write"]}},yP=fe(ge(),1),gP=fe(cP(),1),Kh;function F_(){return Kh==null&&(Kh=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Kh}var Ys;function _P(){if(Ys==null&&(Ys=!1,F_())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<25;i++){let r=i*4;e.fillStyle="rgb(".concat(r,",").concat(r+1,",").concat(r+2,")"),e.fillRect(i%5,Math.floor(i/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!==3&&t[i]!==i){Ys=!0;break}}}return Ys||!1}var ye=1e-6,Ze=typeof Float32Array<"u"?Float32Array:Array,lr=Math.random,Lj=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Bo={};Nn(Bo,{LDU:()=>RP,add:()=>FP,adjoint:()=>CP,clone:()=>vP,copy:()=>bP,create:()=>xP,determinant:()=>IP,equals:()=>OP,exactEquals:()=>BP,frob:()=>zP,fromRotation:()=>kP,fromScaling:()=>DP,fromValues:()=>PP,identity:()=>wP,invert:()=>MP,mul:()=>jP,multiply:()=>B_,multiplyScalar:()=>NP,multiplyScalarAndAdd:()=>VP,rotate:()=>AP,scale:()=>EP,set:()=>SP,str:()=>LP,sub:()=>UP,subtract:()=>O_,transpose:()=>TP});function xP(){var e=new Ze(4);return Ze!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function vP(e){var t=new Ze(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function bP(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function wP(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function PP(e,t,i,r){var n=new Ze(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function SP(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e}function TP(e,t){if(e===t){var i=t[1];e[1]=t[2],e[2]=i}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function MP(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*a-n*r;return o?(o=1/o,e[0]=a*o,e[1]=-r*o,e[2]=-n*o,e[3]=i*o,e):null}function CP(e,t){var i=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=i,e}function IP(e){return e[0]*e[3]-e[2]*e[1]}function B_(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*s+a*l,e[1]=n*s+o*l,e[2]=r*u+a*h,e[3]=n*u+o*h,e}function AP(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+a*s,e[1]=n*l+o*s,e[2]=r*-s+a*l,e[3]=n*-s+o*l,e}function EP(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1];return e[0]=r*s,e[1]=n*s,e[2]=a*l,e[3]=o*l,e}function kP(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e}function DP(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function LP(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function zP(e){return Math.hypot(e[0],e[1],e[2],e[3])}function RP(e,t,i,r){return e[2]=r[2]/r[0],i[0]=r[0],i[1]=r[1],i[3]=r[3]-e[2]*i[1],[e,t,i]}function FP(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function O_(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function BP(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function OP(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(i-o)<=ye*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=ye*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=ye*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=ye*Math.max(1,Math.abs(a),Math.abs(u))}function NP(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function VP(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e}var jP=B_,UP=O_,Oo={};Nn(Oo,{add:()=>cS,adjoint:()=>KP,clone:()=>XP,copy:()=>qP,create:()=>N_,determinant:()=>JP,equals:()=>mS,exactEquals:()=>fS,frob:()=>hS,fromMat2d:()=>aS,fromMat4:()=>GP,fromQuat:()=>oS,fromRotation:()=>rS,fromScaling:()=>nS,fromTranslation:()=>iS,fromValues:()=>$P,identity:()=>YP,invert:()=>HP,mul:()=>yS,multiply:()=>V_,multiplyScalar:()=>pS,multiplyScalarAndAdd:()=>dS,normalFromMat4:()=>sS,projection:()=>lS,rotate:()=>eS,scale:()=>tS,set:()=>ZP,str:()=>uS,sub:()=>gS,subtract:()=>j_,translate:()=>QP,transpose:()=>WP});function N_(){var e=new Ze(9);return Ze!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function GP(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function XP(e){var t=new Ze(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function qP(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function $P(e,t,i,r,n,a,o,s,l){var u=new Ze(9);return u[0]=e,u[1]=t,u[2]=i,u[3]=r,u[4]=n,u[5]=a,u[6]=o,u[7]=s,u[8]=l,u}function ZP(e,t,i,r,n,a,o,s,l,u){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e}function YP(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function WP(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else 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];return e}function HP(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=h*o-s*u,p=-h*a+s*l,d=u*a-o*l,f=i*c+r*p+n*d;return f?(f=1/f,e[0]=c*f,e[1]=(-h*r+n*u)*f,e[2]=(s*r-n*o)*f,e[3]=p*f,e[4]=(h*i-n*l)*f,e[5]=(-s*i+n*a)*f,e[6]=d*f,e[7]=(-u*i+r*l)*f,e[8]=(o*i-r*a)*f,e):null}function KP(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8];return e[0]=o*h-s*u,e[1]=n*u-r*h,e[2]=r*s-n*o,e[3]=s*l-a*h,e[4]=i*h-n*l,e[5]=n*a-i*s,e[6]=a*u-o*l,e[7]=r*l-i*u,e[8]=i*o-r*a,e}function JP(e){var t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*(u*a-o*l)+i*(-u*n+o*s)+r*(l*n-a*s)}function V_(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=i[0],d=i[1],f=i[2],y=i[3],g=i[4],_=i[5],b=i[6],v=i[7],w=i[8];return e[0]=p*r+d*o+f*u,e[1]=p*n+d*s+f*h,e[2]=p*a+d*l+f*c,e[3]=y*r+g*o+_*u,e[4]=y*n+g*s+_*h,e[5]=y*a+g*l+_*c,e[6]=b*r+v*o+w*u,e[7]=b*n+v*s+w*h,e[8]=b*a+v*l+w*c,e}function QP(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=i[0],d=i[1];return e[0]=r,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=p*r+d*o+u,e[7]=p*n+d*s+h,e[8]=p*a+d*l+c,e}function eS(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=Math.sin(i),d=Math.cos(i);return e[0]=d*r+p*o,e[1]=d*n+p*s,e[2]=d*a+p*l,e[3]=d*o-p*r,e[4]=d*s-p*n,e[5]=d*l-p*a,e[6]=u,e[7]=h,e[8]=c,e}function tS(e,t,i){var r=i[0],n=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function iS(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function rS(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function nS(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function aS(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function oS(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i+i,s=r+r,l=n+n,u=i*o,h=r*o,c=r*s,p=n*o,d=n*s,f=n*l,y=a*o,g=a*s,_=a*l;return e[0]=1-c-f,e[3]=h-_,e[6]=p+g,e[1]=h+_,e[4]=1-u-f,e[7]=d-y,e[2]=p-g,e[5]=d+y,e[8]=1-u-c,e}function sS(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15],b=i*s-r*o,v=i*l-n*o,w=i*u-a*o,P=r*l-n*s,S=r*u-a*s,C=n*u-a*l,E=h*y-c*f,F=h*g-p*f,B=h*_-d*f,R=c*g-p*y,D=c*_-d*y,z=p*_-d*g,x=b*z-v*D+w*R+P*B-S*F+C*E;return x?(x=1/x,e[0]=(s*z-l*D+u*R)*x,e[1]=(l*B-o*z-u*F)*x,e[2]=(o*D-s*B+u*E)*x,e[3]=(n*D-r*z-a*R)*x,e[4]=(i*z-n*B+a*F)*x,e[5]=(r*B-i*D-a*E)*x,e[6]=(y*C-g*S+_*P)*x,e[7]=(g*w-f*C-_*v)*x,e[8]=(f*S-y*w+_*b)*x,e):null}function lS(e,t,i){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/i,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function uS(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function hS(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function cS(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e}function j_(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e}function pS(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e}function dS(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e}function fS(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]}function mS(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=t[0],p=t[1],d=t[2],f=t[3],y=t[4],g=t[5],_=t[6],b=t[7],v=t[8];return Math.abs(i-c)<=ye*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(r-p)<=ye*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(n-d)<=ye*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(a-f)<=ye*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(o-y)<=ye*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(s-g)<=ye*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-_)<=ye*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(u-b)<=ye*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(h-v)<=ye*Math.max(1,Math.abs(h),Math.abs(v))}var yS=V_,gS=j_,q={};Nn(q,{add:()=>tT,adjoint:()=>TS,clone:()=>xS,copy:()=>vS,create:()=>_S,determinant:()=>MS,equals:()=>aT,exactEquals:()=>nT,frob:()=>eT,fromQuat:()=>XS,fromQuat2:()=>NS,fromRotation:()=>RS,fromRotationTranslation:()=>X_,fromRotationTranslationScale:()=>US,fromRotationTranslationScaleOrigin:()=>GS,fromScaling:()=>zS,fromTranslation:()=>LS,fromValues:()=>bS,fromXRotation:()=>FS,fromYRotation:()=>BS,fromZRotation:()=>OS,frustum:()=>qS,getRotation:()=>jS,getScaling:()=>q_,getTranslation:()=>VS,identity:()=>U_,invert:()=>SS,lookAt:()=>KS,mul:()=>oT,multiply:()=>G_,multiplyScalar:()=>iT,multiplyScalarAndAdd:()=>rT,ortho:()=>WS,orthoNO:()=>Z_,orthoZO:()=>HS,perspective:()=>$S,perspectiveFromFieldOfView:()=>YS,perspectiveNO:()=>$_,perspectiveZO:()=>ZS,rotate:()=>AS,rotateX:()=>ES,rotateY:()=>kS,rotateZ:()=>DS,scale:()=>IS,set:()=>wS,str:()=>QS,sub:()=>sT,subtract:()=>Y_,targetTo:()=>JS,translate:()=>CS,transpose:()=>PS});function _S(){var e=new Ze(16);return Ze!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function xS(e){var t=new Ze(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function vS(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function bS(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y){var g=new Ze(16);return g[0]=e,g[1]=t,g[2]=i,g[3]=r,g[4]=n,g[5]=a,g[6]=o,g[7]=s,g[8]=l,g[9]=u,g[10]=h,g[11]=c,g[12]=p,g[13]=d,g[14]=f,g[15]=y,g}function wS(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=u,e[9]=h,e[10]=c,e[11]=p,e[12]=d,e[13]=f,e[14]=y,e[15]=g,e}function U_(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function PS(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function SS(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15],b=i*s-r*o,v=i*l-n*o,w=i*u-a*o,P=r*l-n*s,S=r*u-a*s,C=n*u-a*l,E=h*y-c*f,F=h*g-p*f,B=h*_-d*f,R=c*g-p*y,D=c*_-d*y,z=p*_-d*g,x=b*z-v*D+w*R+P*B-S*F+C*E;return x?(x=1/x,e[0]=(s*z-l*D+u*R)*x,e[1]=(n*D-r*z-a*R)*x,e[2]=(y*C-g*S+_*P)*x,e[3]=(p*S-c*C-d*P)*x,e[4]=(l*B-o*z-u*F)*x,e[5]=(i*z-n*B+a*F)*x,e[6]=(g*w-f*C-_*v)*x,e[7]=(h*C-p*w+d*v)*x,e[8]=(o*D-s*B+u*E)*x,e[9]=(r*B-i*D-a*E)*x,e[10]=(f*S-y*w+_*b)*x,e[11]=(c*w-h*S-d*b)*x,e[12]=(s*F-o*R-l*E)*x,e[13]=(i*R-r*F+n*E)*x,e[14]=(y*v-f*P-g*b)*x,e[15]=(h*P-c*v+p*b)*x,e):null}function TS(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],y=t[13],g=t[14],_=t[15];return e[0]=s*(p*_-d*g)-c*(l*_-u*g)+y*(l*d-u*p),e[1]=-(r*(p*_-d*g)-c*(n*_-a*g)+y*(n*d-a*p)),e[2]=r*(l*_-u*g)-s*(n*_-a*g)+y*(n*u-a*l),e[3]=-(r*(l*d-u*p)-s*(n*d-a*p)+c*(n*u-a*l)),e[4]=-(o*(p*_-d*g)-h*(l*_-u*g)+f*(l*d-u*p)),e[5]=i*(p*_-d*g)-h*(n*_-a*g)+f*(n*d-a*p),e[6]=-(i*(l*_-u*g)-o*(n*_-a*g)+f*(n*u-a*l)),e[7]=i*(l*d-u*p)-o*(n*d-a*p)+h*(n*u-a*l),e[8]=o*(c*_-d*y)-h*(s*_-u*y)+f*(s*d-u*c),e[9]=-(i*(c*_-d*y)-h*(r*_-a*y)+f*(r*d-a*c)),e[10]=i*(s*_-u*y)-o*(r*_-a*y)+f*(r*u-a*s),e[11]=-(i*(s*d-u*c)-o*(r*d-a*c)+h*(r*u-a*s)),e[12]=-(o*(c*g-p*y)-h*(s*g-l*y)+f*(s*p-l*c)),e[13]=i*(c*g-p*y)-h*(r*g-n*y)+f*(r*p-n*c),e[14]=-(i*(s*g-l*y)-o*(r*g-n*y)+f*(r*l-n*s)),e[15]=i*(s*p-l*c)-o*(r*p-n*c)+h*(r*l-n*s),e}function MS(e){var t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],h=e[9],c=e[10],p=e[11],d=e[12],f=e[13],y=e[14],g=e[15],_=t*o-i*a,b=t*s-r*a,v=t*l-n*a,w=i*s-r*o,P=i*l-n*o,S=r*l-n*s,C=u*f-h*d,E=u*y-c*d,F=u*g-p*d,B=h*y-c*f,R=h*g-p*f,D=c*g-p*y;return _*D-b*R+v*B+w*F-P*E+S*C}function G_(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],d=t[10],f=t[11],y=t[12],g=t[13],_=t[14],b=t[15],v=i[0],w=i[1],P=i[2],S=i[3];return e[0]=v*r+w*s+P*c+S*y,e[1]=v*n+w*l+P*p+S*g,e[2]=v*a+w*u+P*d+S*_,e[3]=v*o+w*h+P*f+S*b,v=i[4],w=i[5],P=i[6],S=i[7],e[4]=v*r+w*s+P*c+S*y,e[5]=v*n+w*l+P*p+S*g,e[6]=v*a+w*u+P*d+S*_,e[7]=v*o+w*h+P*f+S*b,v=i[8],w=i[9],P=i[10],S=i[11],e[8]=v*r+w*s+P*c+S*y,e[9]=v*n+w*l+P*p+S*g,e[10]=v*a+w*u+P*d+S*_,e[11]=v*o+w*h+P*f+S*b,v=i[12],w=i[13],P=i[14],S=i[15],e[12]=v*r+w*s+P*c+S*y,e[13]=v*n+w*l+P*p+S*g,e[14]=v*a+w*u+P*d+S*_,e[15]=v*o+w*h+P*f+S*b,e}function CS(e,t,i){var r=i[0],n=i[1],a=i[2],o,s,l,u,h,c,p,d,f,y,g,_;return t===e?(e[12]=t[0]*r+t[4]*n+t[8]*a+t[12],e[13]=t[1]*r+t[5]*n+t[9]*a+t[13],e[14]=t[2]*r+t[6]*n+t[10]*a+t[14],e[15]=t[3]*r+t[7]*n+t[11]*a+t[15]):(o=t[0],s=t[1],l=t[2],u=t[3],h=t[4],c=t[5],p=t[6],d=t[7],f=t[8],y=t[9],g=t[10],_=t[11],e[0]=o,e[1]=s,e[2]=l,e[3]=u,e[4]=h,e[5]=c,e[6]=p,e[7]=d,e[8]=f,e[9]=y,e[10]=g,e[11]=_,e[12]=o*r+h*n+f*a+t[12],e[13]=s*r+c*n+y*a+t[13],e[14]=l*r+p*n+g*a+t[14],e[15]=u*r+d*n+_*a+t[15]),e}function IS(e,t,i){var r=i[0],n=i[1],a=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function AS(e,t,i,r){var n=r[0],a=r[1],o=r[2],s=Math.hypot(n,a,o),l,u,h,c,p,d,f,y,g,_,b,v,w,P,S,C,E,F,B,R,D,z,x,T;return s<ye?null:(s=1/s,n*=s,a*=s,o*=s,l=Math.sin(i),u=Math.cos(i),h=1-u,c=t[0],p=t[1],d=t[2],f=t[3],y=t[4],g=t[5],_=t[6],b=t[7],v=t[8],w=t[9],P=t[10],S=t[11],C=n*n*h+u,E=a*n*h+o*l,F=o*n*h-a*l,B=n*a*h-o*l,R=a*a*h+u,D=o*a*h+n*l,z=n*o*h+a*l,x=a*o*h-n*l,T=o*o*h+u,e[0]=c*C+y*E+v*F,e[1]=p*C+g*E+w*F,e[2]=d*C+_*E+P*F,e[3]=f*C+b*E+S*F,e[4]=c*B+y*R+v*D,e[5]=p*B+g*R+w*D,e[6]=d*B+_*R+P*D,e[7]=f*B+b*R+S*D,e[8]=c*z+y*x+v*T,e[9]=p*z+g*x+w*T,e[10]=d*z+_*x+P*T,e[11]=f*z+b*x+S*T,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ES(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*r,e[5]=o*n+h*r,e[6]=s*n+c*r,e[7]=l*n+p*r,e[8]=u*n-a*r,e[9]=h*n-o*r,e[10]=c*n-s*r,e[11]=p*n-l*r,e}function kS(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*r,e[1]=o*n-h*r,e[2]=s*n-c*r,e[3]=l*n-p*r,e[8]=a*r+u*n,e[9]=o*r+h*n,e[10]=s*r+c*n,e[11]=l*r+p*n,e}function DS(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],h=t[5],c=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*r,e[1]=o*n+h*r,e[2]=s*n+c*r,e[3]=l*n+p*r,e[4]=u*n-a*r,e[5]=h*n-o*r,e[6]=c*n-s*r,e[7]=p*n-l*r,e}function LS(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function zS(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function RS(e,t,i){var r=i[0],n=i[1],a=i[2],o=Math.hypot(r,n,a),s,l,u;return o<ye?null:(o=1/o,r*=o,n*=o,a*=o,s=Math.sin(t),l=Math.cos(t),u=1-l,e[0]=r*r*u+l,e[1]=n*r*u+a*s,e[2]=a*r*u-n*s,e[3]=0,e[4]=r*n*u-a*s,e[5]=n*n*u+l,e[6]=a*n*u+r*s,e[7]=0,e[8]=r*a*u+n*s,e[9]=n*a*u-r*s,e[10]=a*a*u+l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function FS(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function BS(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function OS(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=0,e[4]=-i,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function X_(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=r+r,l=n+n,u=a+a,h=r*s,c=r*l,p=r*u,d=n*l,f=n*u,y=a*u,g=o*s,_=o*l,b=o*u;return e[0]=1-(d+y),e[1]=c+b,e[2]=p-_,e[3]=0,e[4]=c-b,e[5]=1-(h+y),e[6]=f+g,e[7]=0,e[8]=p+_,e[9]=f-g,e[10]=1-(h+d),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function NS(e,t){var i=new Ze(3),r=-t[0],n=-t[1],a=-t[2],o=t[3],s=t[4],l=t[5],u=t[6],h=t[7],c=r*r+n*n+a*a+o*o;return c>0?(i[0]=(s*o+h*r+l*a-u*n)*2/c,i[1]=(l*o+h*n+u*r-s*a)*2/c,i[2]=(u*o+h*a+s*n-l*r)*2/c):(i[0]=(s*o+h*r+l*a-u*n)*2,i[1]=(l*o+h*n+u*r-s*a)*2,i[2]=(u*o+h*a+s*n-l*r)*2),X_(e,t,i),e}function VS(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function q_(e,t){var i=t[0],r=t[1],n=t[2],a=t[4],o=t[5],s=t[6],l=t[8],u=t[9],h=t[10];return e[0]=Math.hypot(i,r,n),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(l,u,h),e}function jS(e,t){var i=new Ze(3);q_(i,t);var r=1/i[0],n=1/i[1],a=1/i[2],o=t[0]*r,s=t[1]*n,l=t[2]*a,u=t[4]*r,h=t[5]*n,c=t[6]*a,p=t[8]*r,d=t[9]*n,f=t[10]*a,y=o+h+f,g=0;return y>0?(g=Math.sqrt(y+1)*2,e[3]=.25*g,e[0]=(c-d)/g,e[1]=(p-l)/g,e[2]=(s-u)/g):o>h&&o>f?(g=Math.sqrt(1+o-h-f)*2,e[3]=(c-d)/g,e[0]=.25*g,e[1]=(s+u)/g,e[2]=(p+l)/g):h>f?(g=Math.sqrt(1+h-o-f)*2,e[3]=(p-l)/g,e[0]=(s+u)/g,e[1]=.25*g,e[2]=(c+d)/g):(g=Math.sqrt(1+f-o-h)*2,e[3]=(s-u)/g,e[0]=(p+l)/g,e[1]=(c+d)/g,e[2]=.25*g),e}function US(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3],l=n+n,u=a+a,h=o+o,c=n*l,p=n*u,d=n*h,f=a*u,y=a*h,g=o*h,_=s*l,b=s*u,v=s*h,w=r[0],P=r[1],S=r[2];return e[0]=(1-(f+g))*w,e[1]=(p+v)*w,e[2]=(d-b)*w,e[3]=0,e[4]=(p-v)*P,e[5]=(1-(c+g))*P,e[6]=(y+_)*P,e[7]=0,e[8]=(d+b)*S,e[9]=(y-_)*S,e[10]=(1-(c+f))*S,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function GS(e,t,i,r,n){var a=t[0],o=t[1],s=t[2],l=t[3],u=a+a,h=o+o,c=s+s,p=a*u,d=a*h,f=a*c,y=o*h,g=o*c,_=s*c,b=l*u,v=l*h,w=l*c,P=r[0],S=r[1],C=r[2],E=n[0],F=n[1],B=n[2],R=(1-(y+_))*P,D=(d+w)*P,z=(f-v)*P,x=(d-w)*S,T=(1-(p+_))*S,I=(g+b)*S,U=(f+v)*C,X=(g-b)*C,Z=(1-(p+y))*C;return e[0]=R,e[1]=D,e[2]=z,e[3]=0,e[4]=x,e[5]=T,e[6]=I,e[7]=0,e[8]=U,e[9]=X,e[10]=Z,e[11]=0,e[12]=i[0]+E-(R*E+x*F+U*B),e[13]=i[1]+F-(D*E+T*F+X*B),e[14]=i[2]+B-(z*E+I*F+Z*B),e[15]=1,e}function XS(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i+i,s=r+r,l=n+n,u=i*o,h=r*o,c=r*s,p=n*o,d=n*s,f=n*l,y=a*o,g=a*s,_=a*l;return e[0]=1-c-f,e[1]=h+_,e[2]=p-g,e[3]=0,e[4]=h-_,e[5]=1-u-f,e[6]=d+y,e[7]=0,e[8]=p+g,e[9]=d-y,e[10]=1-u-c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function qS(e,t,i,r,n,a,o){var s=1/(i-t),l=1/(n-r),u=1/(a-o);return e[0]=a*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a*2*l,e[6]=0,e[7]=0,e[8]=(i+t)*s,e[9]=(n+r)*l,e[10]=(o+a)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*u,e[15]=0,e}function $_(e,t,i,r,n){var a=1/Math.tan(t/2),o;return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(r-n),e[10]=(n+r)*o,e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r),e}var $S=$_;function ZS(e,t,i,r,n){var a=1/Math.tan(t/2),o;return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,n!=null&&n!==1/0?(o=1/(r-n),e[10]=n*o,e[14]=n*r*o):(e[10]=-1,e[14]=-r),e}function YS(e,t,i,r){var n=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(o+s),u=2/(n+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-((o-s)*l*.5),e[9]=(n-a)*u*.5,e[10]=r/(i-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*i/(i-r),e[15]=0,e}function Z_(e,t,i,r,n,a,o){var s=1/(t-i),l=1/(r-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=(o+a)*u,e[15]=1,e}var WS=Z_;function HS(e,t,i,r,n,a,o){var s=1/(t-i),l=1/(r-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=a*u,e[15]=1,e}function KS(e,t,i,r){var n,a,o,s,l,u,h,c,p,d,f=t[0],y=t[1],g=t[2],_=r[0],b=r[1],v=r[2],w=i[0],P=i[1],S=i[2];return Math.abs(f-w)<ye&&Math.abs(y-P)<ye&&Math.abs(g-S)<ye?U_(e):(h=f-w,c=y-P,p=g-S,d=1/Math.hypot(h,c,p),h*=d,c*=d,p*=d,n=b*p-v*c,a=v*h-_*p,o=_*c-b*h,d=Math.hypot(n,a,o),d?(d=1/d,n*=d,a*=d,o*=d):(n=0,a=0,o=0),s=c*o-p*a,l=p*n-h*o,u=h*a-c*n,d=Math.hypot(s,l,u),d?(d=1/d,s*=d,l*=d,u*=d):(s=0,l=0,u=0),e[0]=n,e[1]=s,e[2]=h,e[3]=0,e[4]=a,e[5]=l,e[6]=c,e[7]=0,e[8]=o,e[9]=u,e[10]=p,e[11]=0,e[12]=-(n*f+a*y+o*g),e[13]=-(s*f+l*y+u*g),e[14]=-(h*f+c*y+p*g),e[15]=1,e)}function JS(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=r[0],l=r[1],u=r[2],h=n-i[0],c=a-i[1],p=o-i[2],d=h*h+c*c+p*p;d>0&&(d=1/Math.sqrt(d),h*=d,c*=d,p*=d);var f=l*p-u*c,y=u*h-s*p,g=s*c-l*h;return d=f*f+y*y+g*g,d>0&&(d=1/Math.sqrt(d),f*=d,y*=d,g*=d),e[0]=f,e[1]=y,e[2]=g,e[3]=0,e[4]=c*g-p*y,e[5]=p*f-h*g,e[6]=h*y-c*f,e[7]=0,e[8]=h,e[9]=c,e[10]=p,e[11]=0,e[12]=n,e[13]=a,e[14]=o,e[15]=1,e}function QS(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function eT(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function tT(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e[9]=t[9]+i[9],e[10]=t[10]+i[10],e[11]=t[11]+i[11],e[12]=t[12]+i[12],e[13]=t[13]+i[13],e[14]=t[14]+i[14],e[15]=t[15]+i[15],e}function Y_(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e[9]=t[9]-i[9],e[10]=t[10]-i[10],e[11]=t[11]-i[11],e[12]=t[12]-i[12],e[13]=t[13]-i[13],e[14]=t[14]-i[14],e[15]=t[15]-i[15],e}function iT(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e}function rT(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e[9]=t[9]+i[9]*r,e[10]=t[10]+i[10]*r,e[11]=t[11]+i[11]*r,e[12]=t[12]+i[12]*r,e[13]=t[13]+i[13]*r,e[14]=t[14]+i[14]*r,e[15]=t[15]+i[15]*r,e}function nT(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function aT(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],p=e[10],d=e[11],f=e[12],y=e[13],g=e[14],_=e[15],b=t[0],v=t[1],w=t[2],P=t[3],S=t[4],C=t[5],E=t[6],F=t[7],B=t[8],R=t[9],D=t[10],z=t[11],x=t[12],T=t[13],I=t[14],U=t[15];return Math.abs(i-b)<=ye*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(r-v)<=ye*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-w)<=ye*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(a-P)<=ye*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(o-S)<=ye*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(s-C)<=ye*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(l-E)<=ye*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(u-F)<=ye*Math.max(1,Math.abs(u),Math.abs(F))&&Math.abs(h-B)<=ye*Math.max(1,Math.abs(h),Math.abs(B))&&Math.abs(c-R)<=ye*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(p-D)<=ye*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(d-z)<=ye*Math.max(1,Math.abs(d),Math.abs(z))&&Math.abs(f-x)<=ye*Math.max(1,Math.abs(f),Math.abs(x))&&Math.abs(y-T)<=ye*Math.max(1,Math.abs(y),Math.abs(T))&&Math.abs(g-I)<=ye*Math.max(1,Math.abs(g),Math.abs(I))&&Math.abs(_-U)<=ye*Math.max(1,Math.abs(_),Math.abs(U))}var oT=G_,sT=Y_,ou={};Nn(ou,{add:()=>IM,calculateW:()=>gM,clone:()=>SM,conjugate:()=>bM,copy:()=>MM,create:()=>Fc,dot:()=>C0,equals:()=>zM,exactEquals:()=>LM,exp:()=>P0,fromEuler:()=>wM,fromMat3:()=>T0,fromValues:()=>TM,getAngle:()=>dM,getAxisAngle:()=>pM,identity:()=>cM,invert:()=>vM,len:()=>kM,length:()=>I0,lerp:()=>EM,ln:()=>S0,mul:()=>AM,multiply:()=>w0,normalize:()=>Op,pow:()=>_M,random:()=>xM,rotateX:()=>fM,rotateY:()=>mM,rotateZ:()=>yM,rotationTo:()=>RM,scale:()=>M0,set:()=>CM,setAxes:()=>BM,setAxisAngle:()=>b0,slerp:()=>El,sqlerp:()=>FM,sqrLen:()=>DM,squaredLength:()=>A0,str:()=>PM});var $={};Nn($,{add:()=>cT,angle:()=>kT,bezier:()=>PT,ceil:()=>pT,clone:()=>lT,copy:()=>uT,create:()=>zp,cross:()=>Al,dist:()=>NT,distance:()=>Q_,div:()=>OT,divide:()=>J_,dot:()=>Rp,equals:()=>RT,exactEquals:()=>zT,floor:()=>dT,forEach:()=>UT,fromValues:()=>Rc,hermite:()=>wT,inverse:()=>vT,len:()=>r0,length:()=>W_,lerp:()=>bT,max:()=>mT,min:()=>fT,mul:()=>BT,multiply:()=>K_,negate:()=>xT,normalize:()=>i0,random:()=>ST,rotateX:()=>IT,rotateY:()=>AT,rotateZ:()=>ET,round:()=>yT,scale:()=>gT,scaleAndAdd:()=>_T,set:()=>hT,sqrDist:()=>VT,sqrLen:()=>jT,squaredDistance:()=>e0,squaredLength:()=>t0,str:()=>LT,sub:()=>FT,subtract:()=>H_,transformMat3:()=>MT,transformMat4:()=>TT,transformQuat:()=>CT,zero:()=>DT});function zp(){var e=new Ze(3);return Ze!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function lT(e){var t=new Ze(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function W_(e){var t=e[0],i=e[1],r=e[2];return Math.hypot(t,i,r)}function Rc(e,t,i){var r=new Ze(3);return r[0]=e,r[1]=t,r[2]=i,r}function uT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function hT(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e}function cT(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function H_(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function K_(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function J_(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function pT(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function dT(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function fT(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function mT(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function yT(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function gT(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function _T(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function Q_(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return Math.hypot(i,r,n)}function e0(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function t0(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function xT(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function vT(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function i0(e,t){var i=t[0],r=t[1],n=t[2],a=i*i+r*r+n*n;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function Rp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Al(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[0],s=i[1],l=i[2];return e[0]=n*l-a*s,e[1]=a*o-r*l,e[2]=r*s-n*o,e}function bT(e,t,i,r){var n=t[0],a=t[1],o=t[2];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e[2]=o+r*(i[2]-o),e}function wT(e,t,i,r,n,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,u=o*(a-1),h=o*(3-2*a);return e[0]=t[0]*s+i[0]*l+r[0]*u+n[0]*h,e[1]=t[1]*s+i[1]*l+r[1]*u+n[1]*h,e[2]=t[2]*s+i[2]*l+r[2]*u+n[2]*h,e}function PT(e,t,i,r,n,a){var o=1-a,s=o*o,l=a*a,u=s*o,h=3*a*s,c=3*l*o,p=l*a;return e[0]=t[0]*u+i[0]*h+r[0]*c+n[0]*p,e[1]=t[1]*u+i[1]*h+r[1]*c+n[1]*p,e[2]=t[2]*u+i[2]*h+r[2]*c+n[2]*p,e}function ST(e,t){t=t||1;var i=lr()*2*Math.PI,r=lr()*2-1,n=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(i)*n,e[1]=Math.sin(i)*n,e[2]=r*t,e}function TT(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[3]*r+i[7]*n+i[11]*a+i[15];return o=o||1,e[0]=(i[0]*r+i[4]*n+i[8]*a+i[12])/o,e[1]=(i[1]*r+i[5]*n+i[9]*a+i[13])/o,e[2]=(i[2]*r+i[6]*n+i[10]*a+i[14])/o,e}function MT(e,t,i){var r=t[0],n=t[1],a=t[2];return e[0]=r*i[0]+n*i[3]+a*i[6],e[1]=r*i[1]+n*i[4]+a*i[7],e[2]=r*i[2]+n*i[5]+a*i[8],e}function CT(e,t,i){var r=i[0],n=i[1],a=i[2],o=i[3],s=t[0],l=t[1],u=t[2],h=n*u-a*l,c=a*s-r*u,p=r*l-n*s,d=n*p-a*c,f=a*h-r*p,y=r*c-n*h,g=o*2;return h*=g,c*=g,p*=g,d*=2,f*=2,y*=2,e[0]=s+h+d,e[1]=l+c+f,e[2]=u+p+y,e}function IT(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[0],a[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),a[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function AT(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),a[1]=n[1],a[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function ET(e,t,i,r){var n=[],a=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],a[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),a[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),a[2]=n[2],e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function kT(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],o=t[1],s=t[2],l=Math.sqrt(i*i+r*r+n*n),u=Math.sqrt(a*a+o*o+s*s),h=l*u,c=h&&Rp(e,t)/h;return Math.acos(Math.min(Math.max(c,-1),1))}function DT(e){return e[0]=0,e[1]=0,e[2]=0,e}function LT(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function zT(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function RT(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(i-a)<=ye*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=ye*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=ye*Math.max(1,Math.abs(n),Math.abs(s))}var FT=H_,BT=K_,OT=J_,NT=Q_,VT=e0,r0=W_,jT=t0,UT=(function(){var e=zp();return function(t,i,r,n,a,o){var s,l;for(i||(i=3),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}})(),_t={};Nn(_t,{add:()=>u0,ceil:()=>GT,clone:()=>a0,copy:()=>s0,create:()=>n0,cross:()=>KT,dist:()=>oM,distance:()=>f0,div:()=>aM,divide:()=>p0,dot:()=>g0,equals:()=>v0,exactEquals:()=>x0,floor:()=>XT,forEach:()=>hM,fromValues:()=>o0,inverse:()=>HT,len:()=>lM,length:()=>Fp,lerp:()=>_0,max:()=>$T,min:()=>qT,mul:()=>nM,multiply:()=>c0,negate:()=>WT,normalize:()=>y0,random:()=>JT,round:()=>ZT,scale:()=>d0,scaleAndAdd:()=>YT,set:()=>l0,sqrDist:()=>sM,sqrLen:()=>uM,squaredDistance:()=>m0,squaredLength:()=>Bp,str:()=>iM,sub:()=>rM,subtract:()=>h0,transformMat4:()=>QT,transformQuat:()=>eM,zero:()=>tM});function n0(){var e=new Ze(4);return Ze!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function a0(e){var t=new Ze(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function o0(e,t,i,r){var n=new Ze(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function s0(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l0(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e}function u0(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function h0(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function c0(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function p0(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function GT(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function XT(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function qT(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e[3]=Math.min(t[3],i[3]),e}function $T(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e}function ZT(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function d0(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function YT(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e}function f0(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return Math.hypot(i,r,n,a)}function m0(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return i*i+r*r+n*n+a*a}function Fp(e){var t=e[0],i=e[1],r=e[2],n=e[3];return Math.hypot(t,i,r,n)}function Bp(e){var t=e[0],i=e[1],r=e[2],n=e[3];return t*t+i*i+r*r+n*n}function WT(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function HT(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function y0(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*i+r*r+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=i*o,e[1]=r*o,e[2]=n*o,e[3]=a*o,e}function g0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function KT(e,t,i,r){var n=i[0]*r[1]-i[1]*r[0],a=i[0]*r[2]-i[2]*r[0],o=i[0]*r[3]-i[3]*r[0],s=i[1]*r[2]-i[2]*r[1],l=i[1]*r[3]-i[3]*r[1],u=i[2]*r[3]-i[3]*r[2],h=t[0],c=t[1],p=t[2],d=t[3];return e[0]=c*u-p*l+d*s,e[1]=-(h*u)+p*o-d*a,e[2]=h*l-c*o+d*n,e[3]=-(h*s)+c*a-p*n,e}function _0(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e[2]=o+r*(i[2]-o),e[3]=s+r*(i[3]-s),e}function JT(e,t){t=t||1;var i,r,n,a,o,s;do i=lr()*2-1,r=lr()*2-1,o=i*i+r*r;while(o>=1);do n=lr()*2-1,a=lr()*2-1,s=n*n+a*a;while(s>=1);var l=Math.sqrt((1-o)/s);return e[0]=t*i,e[1]=t*r,e[2]=t*n*l,e[3]=t*a*l,e}function QT(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*a+i[12]*o,e[1]=i[1]*r+i[5]*n+i[9]*a+i[13]*o,e[2]=i[2]*r+i[6]*n+i[10]*a+i[14]*o,e[3]=i[3]*r+i[7]*n+i[11]*a+i[15]*o,e}function eM(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[0],s=i[1],l=i[2],u=i[3],h=u*r+s*a-l*n,c=u*n+l*r-o*a,p=u*a+o*n-s*r,d=-o*r-s*n-l*a;return e[0]=h*u+d*-o+c*-l-p*-s,e[1]=c*u+d*-s+p*-o-h*-l,e[2]=p*u+d*-l+h*-s-c*-o,e[3]=t[3],e}function tM(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function iM(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function x0(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function v0(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],o=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(i-o)<=ye*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=ye*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-l)<=ye*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(a-u)<=ye*Math.max(1,Math.abs(a),Math.abs(u))}var rM=h0,nM=c0,aM=p0,oM=f0,sM=m0,lM=Fp,uM=Bp,hM=(function(){var e=n0();return function(t,i,r,n,a,o){var s,l;for(i||(i=4),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}})();function Fc(){var e=new Ze(4);return Ze!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function cM(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function b0(e,t,i){i=i*.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function pM(e,t){var i=Math.acos(t[3])*2,r=Math.sin(i/2);return r>ye?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),i}function dM(e,t){var i=C0(e,t);return Math.acos(2*i*i-1)}function w0(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*h+o*s+n*u-a*l,e[1]=n*h+o*l+a*s-r*u,e[2]=a*h+o*u+r*l-n*s,e[3]=o*h-r*s-n*l-a*u,e}function fM(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-r*s,e}function mM(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l-a*s,e[1]=n*l+o*s,e[2]=a*l+r*s,e[3]=o*l-n*s,e}function yM(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*s,e[1]=n*l-r*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e}function gM(e,t){var i=t[0],r=t[1],n=t[2];return e[0]=i,e[1]=r,e[2]=n,e[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n)),e}function P0(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=Math.sqrt(i*i+r*r+n*n),s=Math.exp(a),l=o>0?s*Math.sin(o)/o:0;return e[0]=i*l,e[1]=r*l,e[2]=n*l,e[3]=s*Math.cos(o),e}function S0(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=Math.sqrt(i*i+r*r+n*n),s=o>0?Math.atan2(o,a)/o:0;return e[0]=i*s,e[1]=r*s,e[2]=n*s,e[3]=.5*Math.log(i*i+r*r+n*n+a*a),e}function _M(e,t,i){return S0(e,t),M0(e,e,i),P0(e,e),e}function El(e,t,i,r){var n=t[0],a=t[1],o=t[2],s=t[3],l=i[0],u=i[1],h=i[2],c=i[3],p,d,f,y,g;return d=n*l+a*u+o*h+s*c,d<0&&(d=-d,l=-l,u=-u,h=-h,c=-c),1-d>ye?(p=Math.acos(d),f=Math.sin(p),y=Math.sin((1-r)*p)/f,g=Math.sin(r*p)/f):(y=1-r,g=r),e[0]=y*n+g*l,e[1]=y*a+g*u,e[2]=y*o+g*h,e[3]=y*s+g*c,e}function xM(e){var t=lr(),i=lr(),r=lr(),n=Math.sqrt(1-t),a=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*i),e[1]=n*Math.cos(2*Math.PI*i),e[2]=a*Math.sin(2*Math.PI*r),e[3]=a*Math.cos(2*Math.PI*r),e}function vM(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*i+r*r+n*n+a*a,s=o?1/o:0;return e[0]=-i*s,e[1]=-r*s,e[2]=-n*s,e[3]=a*s,e}function bM(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function T0(e,t){var i=t[0]+t[4]+t[8],r;if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[n*3+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;r=Math.sqrt(t[n*3+n]-t[a*3+a]-t[o*3+o]+1),e[n]=.5*r,r=.5/r,e[3]=(t[a*3+o]-t[o*3+a])*r,e[a]=(t[a*3+n]+t[n*3+a])*r,e[o]=(t[o*3+n]+t[n*3+o])*r}return e}function wM(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(i),l=Math.cos(i),u=Math.sin(r),h=Math.cos(r);return e[0]=a*l*h-o*s*u,e[1]=o*s*h+a*l*u,e[2]=o*l*u-a*s*h,e[3]=o*l*h+a*s*u,e}function PM(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var SM=a0,TM=o0,MM=s0,CM=l0,IM=u0,AM=w0,M0=d0,C0=g0,EM=_0,I0=Fp,kM=I0,A0=Bp,DM=A0,Op=y0,LM=x0,zM=v0,RM=(function(){var e=zp(),t=Rc(1,0,0),i=Rc(0,1,0);return function(r,n,a){var o=Rp(n,a);return o<-.999999?(Al(e,t,n),r0(e)<1e-6&&Al(e,i,n),i0(e,e),b0(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Al(e,n,a),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,Op(r,r))}})(),FM=(function(){var e=Fc(),t=Fc();return function(i,r,n,a,o,s){return El(e,r,o,s),El(t,n,a,s),El(i,e,t,2*s*(1-s)),i}})(),BM=(function(){var e=N_();return function(t,i,r,n){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=n[0],e[4]=n[1],e[7]=n[2],e[2]=-i[0],e[5]=-i[1],e[8]=-i[2],Op(t,T0(t,e))}})(),Jt={};Nn(Jt,{add:()=>UM,angle:()=>lC,ceil:()=>GM,clone:()=>OM,copy:()=>VM,create:()=>E0,cross:()=>eC,dist:()=>gC,distance:()=>z0,div:()=>yC,divide:()=>L0,dot:()=>QM,equals:()=>pC,exactEquals:()=>cC,floor:()=>XM,forEach:()=>vC,fromValues:()=>NM,inverse:()=>KM,len:()=>dC,length:()=>F0,lerp:()=>tC,max:()=>$M,min:()=>qM,mul:()=>mC,multiply:()=>D0,negate:()=>HM,normalize:()=>JM,random:()=>iC,rotate:()=>sC,round:()=>ZM,scale:()=>YM,scaleAndAdd:()=>WM,set:()=>jM,sqrDist:()=>_C,sqrLen:()=>xC,squaredDistance:()=>R0,squaredLength:()=>B0,str:()=>hC,sub:()=>fC,subtract:()=>k0,transformMat2:()=>rC,transformMat2d:()=>nC,transformMat3:()=>aC,transformMat4:()=>oC,zero:()=>uC});function E0(){var e=new Ze(2);return Ze!=Float32Array&&(e[0]=0,e[1]=0),e}function OM(e){var t=new Ze(2);return t[0]=e[0],t[1]=e[1],t}function NM(e,t){var i=new Ze(2);return i[0]=e,i[1]=t,i}function VM(e,t){return e[0]=t[0],e[1]=t[1],e}function jM(e,t,i){return e[0]=t,e[1]=i,e}function UM(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e}function k0(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function D0(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function L0(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}function GM(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function XM(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function qM(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e}function $M(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e}function ZM(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function YM(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function WM(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e}function z0(e,t){var i=t[0]-e[0],r=t[1]-e[1];return Math.hypot(i,r)}function R0(e,t){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function F0(e){var t=e[0],i=e[1];return Math.hypot(t,i)}function B0(e){var t=e[0],i=e[1];return t*t+i*i}function HM(e,t){return e[0]=-t[0],e[1]=-t[1],e}function KM(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function JM(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e}function QM(e,t){return e[0]*t[0]+e[1]*t[1]}function eC(e,t,i){var r=t[0]*i[1]-t[1]*i[0];return e[0]=e[1]=0,e[2]=r,e}function tC(e,t,i,r){var n=t[0],a=t[1];return e[0]=n+r*(i[0]-n),e[1]=a+r*(i[1]-a),e}function iC(e,t){t=t||1;var i=lr()*2*Math.PI;return e[0]=Math.cos(i)*t,e[1]=Math.sin(i)*t,e}function rC(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n,e[1]=i[1]*r+i[3]*n,e}function nC(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n+i[4],e[1]=i[1]*r+i[3]*n+i[5],e}function aC(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[3]*n+i[6],e[1]=i[1]*r+i[4]*n+i[7],e}function oC(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e}function sC(e,t,i,r){var n=t[0]-i[0],a=t[1]-i[1],o=Math.sin(r),s=Math.cos(r);return e[0]=n*s-a*o+i[0],e[1]=n*o+a*s+i[1],e}function lC(e,t){var i=e[0],r=e[1],n=t[0],a=t[1],o=Math.sqrt(i*i+r*r)*Math.sqrt(n*n+a*a),s=o&&(i*n+r*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function uC(e){return e[0]=0,e[1]=0,e}function hC(e){return"vec2("+e[0]+", "+e[1]+")"}function cC(e,t){return e[0]===t[0]&&e[1]===t[1]}function pC(e,t){var i=e[0],r=e[1],n=t[0],a=t[1];return Math.abs(i-n)<=ye*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(r-a)<=ye*Math.max(1,Math.abs(r),Math.abs(a))}var dC=F0,fC=k0,mC=D0,yC=L0,gC=z0,_C=R0,xC=B0,vC=(function(){var e=E0();return function(t,i,r,n,a,o){var s,l;for(i||(i=2),r||(r=0),n?l=Math.min(n*i+r,t.length):l=t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}})();function ci(e,t,i){return t*(8192/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function so(){return new Float64Array(4)}function Pt(){return new Float64Array(3)}function nn(){return new Float64Array(16)}function na(){let e=new Float64Array(16);return q.identity(e),e}function O0(){let e=new Float32Array(16);return q.identity(e),e}function ln(e,t,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];let a=n?r==="map"?-e.bearingInRadians:0:r==="viewport"?e.bearingInRadians:0;if(a){let o=Math.sin(a),s=Math.cos(a);i=[i[0]*s-i[1]*o,i[0]*o+i[1]*s]}return[n?i[0]:ci(t,i[0],e.zoom),n?i[1]:ci(t,i[1],e.zoom)]}function Bc(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function Pi(e,t,i){let r=Oo.determinant([e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]]);if(r===0)return null;let n=$.cross([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),a=$.cross([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),o=$.cross([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),s=$.scale([],n,-e[3]);return $.add(s,s,$.scale([],a,-t[3])),$.add(s,s,$.scale([],o,-i[3])),$.scale(s,s,1/r),s}function bC(e,t,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],n=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return n===0?null:(-r-i[3])/n}function Ws(e,t,i,r){let n=Math.sqrt(e*e+t*t),a=Math.sqrt(i*i+r*r);e/=n,t/=n,i/=a,r/=a;let o=e*i+t*r,s=Math.acos(o);return-t*i+e*r>0?s:-s}function li(e,t){let i=ba(e,360),r=ba(t,360),n=r-i,a=r>i?n-360:n+360;return Math.abs(n)<Math.abs(a)?n:a}function Hs(e,t){let i=ba(e,Math.PI*2),r=ba(t,Math.PI*2);return Math.min(Math.abs(i-r),Math.abs(i-r+Math.PI*2),Math.abs(i-r-Math.PI*2))}function ba(e,t){return(e%t+t)%t}function kl(e,t,i,r,n){let a=Ne((e-t)/(i-t),0,1);return ma(r,n,a)}function ma(e,t,i){return e*(1-i)+t*i}function wC(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(let a of e)t=Math.min(t,a.x),i=Math.min(i,a.y),r=Math.max(r,a.x),n=Math.max(n,a.y);return[t,i,r,n]}function N0(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function Np(e,t,i,r){let n=new gP.default(e,t,i,r);return a=>n.solve(a)}var Oc=Np(.25,.1,.25,1);function Ne(e,t,i){return Math.min(i,Math.max(t,e))}function An(e,t,i){let r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function PC(e,t){let i=[];for(let r in e)r in t||i.push(r);return i}function re(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}function rs(e,t){let i={};for(let r=0;r<t.length;r++){let n=t[r];n in e&&(i[n]=e[n])}return i}var SC=1;function V0(){return SC++}function TC(e){return Math.log(e)/Math.LN2%1===0}function MC(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function qt(e){return Math.pow(2,e)}function $t(e){return Math.log(e)/Math.LN2}function Vp(e,t,i){let r={};for(let n in e)r[n]=t.call(i||this,e[n],n,e);return r}function j0(e,t,i){let r={};for(let n in e)t.call(i||this,e[n],n,e)&&(r[n]=e[n]);return r}function ar(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ar(e[i],t[i]))return!1;return!0}if(typeof e=="object"&&e!==null&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!ar(e[i],t[i]))return!1;return!0}return e===t}function Qt(e){return Array.isArray(e)?e.map(Qt):typeof e=="object"&&e?Vp(e,Qt):e}var Iy={};function Tt(e){Iy[e]||(typeof console<"u"&&console.warn(e),Iy[e]=!0)}function an(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function CC(e,t,i,r){let n=t.y-e.y,a=t.x-e.x,o=r.y-i.y,s=r.x-i.x,l=o*a-s*n;if(l===0)return null;let u=e.y-i.y,h=e.x-i.x,c=(s*u-o*h)/l;return new yP.default(e.x+c*a,e.y+c*n)}function IC([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(i),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}}function wa(e){return typeof WorkerGlobalScope<"u"&&typeof e<"u"&&e instanceof WorkerGlobalScope}function AC(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,i={};if(e.replace(t,(r,n,a,o)=>{let s=a||o;return i[n]=s?s.toLowerCase():!0,""}),i["max-age"]){let r=parseInt(i["max-age"],10);isNaN(r)?delete i["max-age"]:i["max-age"]=r}return i}var Jh=null;function EC(e){if(Jh==null){let t=e.navigator?e.navigator.userAgent:null;Jh=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Jh}function Fr(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}var kC=async e=>{if(e.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(i){throw new Error("Could not load image because of ".concat(i.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}},Ay="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",DC=e=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=Ay})},r.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let n=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(n):Ay});function LC(e,t,i,r,n){let a=Math.max(-t,0)*4,o=(Math.max(0,i)-i)*r*4+a,s=r*4,l=Math.max(0,t),u=Math.max(0,i),h=Math.min(e.width,t+r),c=Math.min(e.height,i+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:o,stride:s}]}}async function zC(e,t,i,r,n){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let a=new VideoFrame(e,{timestamp:0});try{let o=a==null?void 0:a.format;if(!o||!(o.startsWith("BGR")||o.startsWith("RGB")))throw new Error("Unrecognized format ".concat(o));let s=o.startsWith("BGR"),l=new Uint8ClampedArray(r*n*4);if(await a.copyTo(l,LC(e,t,i,r,n)),s)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{a.close()}}function Nc(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function Je(e){return e*Math.PI/180}function pa(e){return e/Math.PI*180}function U0(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function RC(e){let t=new Float64Array(9);Oo.fromQuat(t,e);let i=pa(-Math.asin(Ne(t[2],-1,1))),r,n;return Math.hypot(t[5],t[8])<.001?(r=0,n=-pa(Math.atan2(t[3],t[4]))):(r=pa(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),n=pa(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:r,pitch:i+90,bearing:n}}function FC(e,t,i){let r=Jt.fromValues(t.x-i.x,t.y-i.y),n=Jt.fromValues(e.x-i.x,e.y-i.y),a=r[0]*n[1]-r[1]*n[0],o=Math.atan2(a,Jt.dot(r,n));return pa(o)}function Ey(e,t,i){let r=new Float64Array(4);return ou.fromEuler(r,e,t-90,i),r}var su=25,jp=0,fr=85.051129,G0={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},X0={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function BC(e,t){return G0[t]&&"touches"in e}function OC(e,t){return X0[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)}function NC(e){return G0[e]||X0[e]}var q0="AbortError";function VC(e){return e.message===q0}function lu(){return new Error(q0)}var jC=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Ks,Qh,Me={now:jC,frame(e,t,i){let r=requestAnimationFrame(a=>{n(),t(a)}),{unsubscribe:n}=Nc(e.signal,"abort",()=>{n(),cancelAnimationFrame(r),i(lu())},!1)},frameAsync(e){return new Promise((t,i)=>{this.frame(e,t,i)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL(e){return Ks||(Ks=document.createElement("a")),Ks.href=e,Ks.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Qh==null&&(Qh=matchMedia("(prefers-reduced-motion: reduce)")),Qh.matches):!1}},UC=fe(ge(),1),aa=class He{static testProp(t){if(!He.docStyle)return t[0];for(let i=0;i<t.length;i++)if(t[i]in He.docStyle)return t[i];return t[0]}static create(t,i,r){let n=window.document.createElement(t);return i!==void 0&&(n.className=i),r&&r.appendChild(n),n}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){He.docStyle&&He.selectProp&&(He.userSelect=He.docStyle[He.selectProp],He.docStyle[He.selectProp]="none")}static enableDrag(){He.docStyle&&He.selectProp&&(He.docStyle[He.selectProp]=He.userSelect)}static setTransform(t,i){t.style[He.transformProp]=i}static addEventListener(t,i,r,n={}){"passive"in n?t.addEventListener(i,r,n):t.addEventListener(i,r,n.capture)}static removeEventListener(t,i,r,n={}){"passive"in n?t.removeEventListener(i,r,n):t.removeEventListener(i,r,n.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",He.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",He.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",He.suppressClickInternal,!0)},0)}static getScale(t){let i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}static getPoint(t,i,r){let n=i.boundingClientRect;return new UC.default((r.clientX-n.left)/i.x-t.clientLeft,(r.clientY-n.top)/i.y-t.clientTop)}static mousePos(t,i){let r=He.getScale(t);return He.getPoint(t,r,i)}static touchPos(t,i){let r=[],n=He.getScale(t);for(let a=0;a<i.length;a++)r.push(He.getPoint(t,n,i[a]));return r}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){let i=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),r=i.querySelectorAll("script");for(let n of r)n.remove();return He.clean(i),i.innerHTML}static isPossiblyDangerous(t,i){let r=i.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(t)&&(r.includes("javascript:")||r.includes("data:"))||t.startsWith("on"))return!0}static clean(t){let i=t.children;for(let r of i)He.removeAttributes(r),He.clean(r)}static removeAttributes(t){for(let{name:i,value:r}of t.attributes)He.isPossiblyDangerous(i,r)&&t.removeAttribute(i)}};aa.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,aa.selectProp=aa.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),aa.transformProp=aa.testProp(["transform","WebkitTransform"]);var Ie=aa,un={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function $0(e){return un.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}var Vc="global-dispatcher",Ul=class extends Error{constructor(e,t,i,r){super("AJAXError: ".concat(t," (").concat(e,"): ").concat(i)),this.status=e,this.statusText=t,this.url=i,this.body=r}},Up=()=>wa(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,GC=e=>/^file:/.test(e)||/^file:/.test(Up())&&!/^\w+:/.test(e);async function XC(e,t){let i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Up(),signal:t.signal});e.type==="json"&&!i.headers.has("Accept")&&i.headers.set("Accept","application/json");let r;try{r=await fetch(i)}catch(o){throw new Ul(0,o.message,e.url,new Blob)}if(!r.ok){let o=await r.blob();throw new Ul(r.status,r.statusText,e.url,o)}let n;e.type==="arrayBuffer"||e.type==="image"?n=r.arrayBuffer():e.type==="json"?n=r.json():n=r.text();let a=await n;if(t.signal.aborted)throw lu();return{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}function qC(e,t){return new Promise((i,r)=>{var a;let n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(n.responseType="arraybuffer");for(let o in e.headers)n.setRequestHeader(o,e.headers[o]);e.type==="json"&&(n.responseType="text",(a=e.headers)!=null&&a.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=e.credentials==="include",n.onerror=()=>{r(new Error(n.statusText))},n.onload=()=>{if(!t.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let o=n.response;if(e.type==="json")try{o=JSON.parse(n.response)}catch(s){r(s);return}i({data:o,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let o=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});r(new Ul(n.status,n.statusText,e.url,o))}},t.signal.addEventListener("abort",()=>{n.abort(),r(lu())}),n.send(e.body)})}var uu=function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){let i=$0(e.url);if(i)return i(e,t);if(wa(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Vc},t)}if(!GC(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return XC(e,t);if(wa(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:Vc},t)}return qC(e,t)},hu=(e,t)=>uu(re(e,{type:"json"}),t),$C=(e,t)=>uu(re(e,{type:"arrayBuffer"}),t);function Z0(e){if(!e||e.indexOf("://")<=0||e.indexOf("data:image/")===0||e.indexOf("blob:")===0)return!0;let t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}var ZC=e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(let r of e){let n=window.document.createElement("source");Z0(r)||(t.crossOrigin="Anonymous"),n.src=r,t.appendChild(n)}})},Gp={supported:!1,testSupport:YC},wo,Xp=!1,da,Y0=!1;typeof document<"u"&&(da=document.createElement("img"),da.onload=()=>{wo&&W0(wo),wo=null,Y0=!0},da.onerror=()=>{Xp=!0,wo=null},da.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function YC(e){Xp||!da||(Y0?W0(e):wo=e)}function W0(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,da),e.isContextLost())return;Gp.supported=!0}catch(i){}e.deleteTexture(t),Xp=!0}var cr;(e=>{let t,i,r,n;e.resetRequestQueue=()=>{t=[],i=0,r=0,n={}},e.addThrottleControl=h=>{let c=r++;return n[c]=h,c},e.removeThrottleControl=h=>{delete n[h],l()};let a=()=>{for(let h of Object.keys(n))if(n[h]())return!0;return!1};e.getImage=(h,c,p=!0)=>new Promise((d,f)=>{Gp.supported&&(h.headers||(h.headers={}),h.headers.accept="image/webp,*/*"),re(h,{type:"image"});let y={abortController:c,requestParameters:h,supportImageRefresh:p,state:"queued",onError:g=>{f(g)},onSuccess:g=>{d(g)}};t.push(y),l()});let o=h=>typeof createImageBitmap=="function"?kC(h):DC(h),s=async h=>{h.state="running";let{requestParameters:c,supportImageRefresh:p,onError:d,onSuccess:f,abortController:y}=h,g=p===!1&&!wa(self)&&!$0(c.url)&&(!c.headers||Object.keys(c.headers).reduce((b,v)=>b&&v==="accept",!0));i++;let _=g?u(c,y):uu(c,y);try{let b=await _;if(delete h.abortController,h.state="completed",b.data instanceof HTMLImageElement||Fr(b.data))f(b);else if(b.data){let v=await o(b.data);f({data:v,cacheControl:b.cacheControl,expires:b.expires})}}catch(b){delete h.abortController,d(b)}finally{i--,l()}},l=()=>{let h=a()?un.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:un.MAX_PARALLEL_IMAGE_REQUESTS;for(let c=i;c<h&&t.length>0;c++){let p=t.shift();if(p.abortController.signal.aborted){c--;continue}s(p)}},u=(h,c)=>new Promise((p,d)=>{let f=new Image,y=h.url,g=h.credentials;g&&g==="include"?f.crossOrigin="use-credentials":(g&&g==="same-origin"||!Z0(y))&&(f.crossOrigin="anonymous"),c.signal.addEventListener("abort",()=>{f.src="",d(lu())}),f.fetchPriority="high",f.onload=()=>{f.onerror=f.onload=null,p({data:f})},f.onerror=()=>{f.onerror=f.onload=null,!c.signal.aborted&&d(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},f.src=y})})(cr||(cr={}));cr.resetRequestQueue();var WC=class{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn?this._transformRequestFn(e,t)||{url:e}:{url:e}}setTransformRequest(e){this._transformRequestFn=e}};function ky(e,t,i){i[e]&&i[e].indexOf(t)!==-1||(i[e]=i[e]||[],i[e].push(t))}function ec(e,t,i){if(i&&i[e]){let r=i[e].indexOf(t);r!==-1&&i[e].splice(r,1)}}var H=class{constructor(e,t={}){re(this,t),this.type=e}},he=class extends H{constructor(e,t={}){super("error",re({error:e},t))}},ei=class{on(e,t){return this._listeners=this._listeners||{},ky(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return ec(e,t,this._listeners),ec(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},ky(e,t,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t){typeof e=="string"&&(e=new H(e,t||{}));let i=e.type;if(this.listens(i)){e.target=this;let r=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(let o of r)o.call(this,e);let n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(let o of n)ec(i,o,this._oneTimeListeners),o.call(this,e);let a=this._eventedParent;a&&(re(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof he&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},HC=8,KC={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},JC={"*":{type:"source"}},QC=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],eI={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},tI={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},iI={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},rI={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},nI={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},aI={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},oI={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},sI=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],lI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},uI={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},hI={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},cI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},pI={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},dI={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},fI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},mI={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},yI={type:"array",value:"*"},gI={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},_I={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},xI={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},vI={type:"array",value:"*",minimum:1},bI={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},wI={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},PI={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},SI={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},TI=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],MI={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},CI={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},II={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},AI={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},EI={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},kI={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},DI={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},LI={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},zI={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},RI={"*":{type:"string"}},V={$version:HC,$root:KC,sources:JC,source:QC,source_vector:eI,source_raster:tI,source_raster_dem:iI,source_geojson:rI,source_video:nI,source_image:aI,layer:oI,layout:sI,layout_background:lI,layout_fill:uI,layout_circle:hI,layout_heatmap:cI,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:pI,layout_symbol:dI,layout_raster:fI,layout_hillshade:mI,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:yI,filter_operator:gI,geometry_type:_I,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:xI,expression:vI,light:bI,sky:wI,terrain:PI,projection:SI,paint:TI,paint_fill:MI,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:CI,paint_circle:II,paint_heatmap:AI,paint_symbol:EI,paint_raster:kI,paint_hillshade:DI,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:LI,transition:zI,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:RI},FI=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function BI(e,t){let i={};for(let r in e)r!=="ref"&&(i[r]=e[r]);return FI.forEach(r=>{r in t&&(i[r]=t[r])}),i}function Dy(e){e=e.slice();let t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=BI(e[i],t[e[i].ref]));return e}function Ue(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Ue(e[i],t[i]))return!1;return!0}if(typeof e=="object"&&e!==null&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!Ue(e[i],t[i]))return!1;return!0}return e===t}function Si(e,t){e.push(t)}function H0(e,t,i){Si(i,{command:"addSource",args:[e,t[e]]})}function K0(e,t,i){Si(t,{command:"removeSource",args:[e]}),i[e]=!0}function OI(e,t,i,r){K0(e,i,r),H0(e,t,i)}function NI(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!Ue(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!Ue(e[i][r],t[i][r]))return!1;return!0}function VI(e,t,i,r){e=e||{},t=t||{};let n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||K0(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?Ue(e[n],t[n])||(e[n].type==="geojson"&&t[n].type==="geojson"&&NI(e,t,n)?Si(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):OI(n,t,i,r)):H0(n,t,i))}function Js(e,t,i,r,n,a){e=e||{},t=t||{};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Ue(e[o],t[o])||i.push({command:a,args:[r,o,t[o],n]}));for(let o in t)!Object.prototype.hasOwnProperty.call(t,o)||Object.prototype.hasOwnProperty.call(e,o)||Ue(e[o],t[o])||i.push({command:a,args:[r,o,t[o],n]})}function Ly(e){return e.id}function zy(e,t){return e[t.id]=t,e}function jI(e,t,i){e=e||[],t=t||[];let r=e.map(Ly),n=t.map(Ly),a=e.reduce(zy,{}),o=t.reduce(zy,{}),s=r.slice(),l=Object.create(null),u,h,c,p,d;for(let f=0,y=0;f<r.length;f++)u=r[f],Object.prototype.hasOwnProperty.call(o,u)?y++:(Si(i,{command:"removeLayer",args:[u]}),s.splice(s.indexOf(u,y),1));for(let f=0,y=0;f<n.length;f++)u=n[n.length-1-f],s[s.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(a,u)?(Si(i,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-y),1)):y++,p=s[s.length-f],Si(i,{command:"addLayer",args:[o[u],p]}),s.splice(s.length-f,0,u),l[u]=!0);for(let f=0;f<n.length;f++)if(u=n[f],h=a[u],c=o[u],!(l[u]||Ue(h,c))){if(!Ue(h.source,c.source)||!Ue(h["source-layer"],c["source-layer"])||!Ue(h.type,c.type)){Si(i,{command:"removeLayer",args:[u]}),p=s[s.lastIndexOf(u)+1],Si(i,{command:"addLayer",args:[c,p]});continue}Js(h.layout,c.layout,i,u,null,"setLayoutProperty"),Js(h.paint,c.paint,i,u,null,"setPaintProperty"),Ue(h.filter,c.filter)||Si(i,{command:"setFilter",args:[u,c.filter]}),(!Ue(h.minzoom,c.minzoom)||!Ue(h.maxzoom,c.maxzoom))&&Si(i,{command:"setLayerZoomRange",args:[u,c.minzoom,c.maxzoom]});for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&(d==="layout"||d==="paint"||d==="filter"||d==="metadata"||d==="minzoom"||d==="maxzoom"||(d.indexOf("paint.")===0?Js(h[d],c[d],i,u,d.slice(6),"setPaintProperty"):Ue(h[d],c[d])||Si(i,{command:"setLayerProperty",args:[u,d,c[d]]})));for(d in c)!Object.prototype.hasOwnProperty.call(c,d)||Object.prototype.hasOwnProperty.call(h,d)||d==="layout"||d==="paint"||d==="filter"||d==="metadata"||d==="minzoom"||d==="maxzoom"||(d.indexOf("paint.")===0?Js(h[d],c[d],i,u,d.slice(6),"setPaintProperty"):Ue(h[d],c[d])||Si(i,{command:"setLayerProperty",args:[u,d,c[d]]}))}}function UI(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!Ue(e.version,t.version))return[{command:"setStyle",args:[t]}];Ue(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),Ue(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),Ue(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Ue(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),Ue(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),Ue(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),Ue(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),Ue(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),Ue(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),Ue(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),Ue(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),Ue(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),Ue(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),Ue(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let r={},n=[];VI(e.sources,t.sources,n,r);let a=[];e.layers&&e.layers.forEach(o=>{"source"in o&&r[o.source]?i.push({command:"removeLayer",args:[o.id]}):a.push(o)}),i=i.concat(n),jI(a,t.layers,i)}catch(r){console.warn("Unable to compute style diff:",r),i=[{command:"setStyle",args:[t]}]}return i}var W=class{constructor(e,t,i,r){this.message=(e?"".concat(e,": "):"")+i,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}};function Pa(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}var or=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},GI=class J0{constructor(t,i=[]){this.parent=t,this.bindings={};for(let[r,n]of i)this.bindings[r]=n}concat(t){return new J0(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error("".concat(t," not found in scope."))}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},ns={kind:"null"},J={kind:"number"},Se={kind:"string"},be={kind:"boolean"},Ni={kind:"color"},cu={kind:"projectionDefinition"},En={kind:"object"},xe={kind:"value"},XI={kind:"error"},pu={kind:"collator"},as={kind:"formatted"},du={kind:"padding"},No={kind:"colorArray"},fu={kind:"numberArray"},os={kind:"resolvedImage"},mu={kind:"variableAnchorOffsetCollection"};function ui(e,t){return{kind:"array",itemType:e,N:t}}function ut(e){if(e.kind==="array"){let t=ut(e.itemType);return typeof e.N=="number"?"array<".concat(t,", ").concat(e.N,">"):e.itemType.kind==="value"?"array":"array<".concat(t,">")}else return e.kind}var qI=[ns,J,Se,be,Ni,cu,as,En,ui(xe),du,fu,No,os,mu];function Vo(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Vo(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let i of qI)if(!Vo(i,t))return null}}return"Expected ".concat(ut(e)," but found ").concat(ut(t)," instead.")}function qp(e,t){return t.some(i=>i.kind===e.kind)}function kn(e,t){return t.some(i=>i==="null"?e===null:i==="array"?Array.isArray(e):i==="object"?e&&!Array.isArray(e)&&typeof e=="object":i===typeof e)}function Wr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}var Q0=.96422,ex=1,tx=.82521,ix=4/29,ya=6/29,rx=3*ya*ya,$I=ya*ya*ya,ZI=Math.PI/180,YI=180/Math.PI;function nx(e){return e=e%360,e<0&&(e+=360),e}function ax([e,t,i,r]){e=tc(e),t=tc(t),i=tc(i);let n,a,o=ic((.2225045*e+.7168786*t+.0606169*i)/ex);e===t&&t===i?n=a=o:(n=ic((.4360747*e+.3850649*t+.1430804*i)/Q0),a=ic((.0139322*e+.0971045*t+.7141733*i)/tx));let s=116*o-16;return[s<0?0:s,500*(n-o),200*(o-a),r]}function tc(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ic(e){return e>$I?Math.pow(e,1/3):e/rx+ix}function ox([e,t,i,r]){let n=(e+16)/116,a=isNaN(t)?n:n+t/500,o=isNaN(i)?n:n-i/200;return n=ex*nc(n),a=Q0*nc(a),o=tx*nc(o),[rc(3.1338561*a-1.6168667*n-.4906146*o),rc(-.9787684*a+1.9161415*n+.033454*o),rc(.0719453*a-.2289914*n+1.4052427*o),r]}function rc(e){return e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055,e<0?0:e>1?1:e}function nc(e){return e>ya?e*e*e:rx*(e-ix)}function WI(e){let[t,i,r,n]=ax(e),a=Math.sqrt(i*i+r*r);return[Math.round(a*1e4)?nx(Math.atan2(r,i)*YI):NaN,a,t,n]}function HI([e,t,i,r]){return e=isNaN(e)?0:e*ZI,ox([i,Math.cos(e)*t,Math.sin(e)*t,r])}function KI([e,t,i,r]){e=nx(e),t/=100,i/=100;function n(a){let o=(a+e/30)%12,s=t*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(o-3,9-o,1))}return[n(0),n(8),n(4),r]}var JI=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function ko(e,t){return JI(e,t)?e[t]:void 0}function QI(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=ko(eA,e);if(t){let[n,a,o]=t;return[n/255,a/255,o/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let n=e.length<6?1:2,a=1;return[Qs(e.slice(a,a+=n)),Qs(e.slice(a,a+=n)),Qs(e.slice(a,a+=n)),Qs(e.slice(a,a+n)||"ff")]}if(e.startsWith("rgb")){let n=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,a=e.match(n);if(a){let[o,s,l,u,h,c,p,d,f,y,g,_]=a,b=[u||" ",p||" ",y].join("");if(b===" "||b===" /"||b===",,"||b===",,,"){let v=[l,c,f].join(""),w=v==="%%%"?100:v===""?255:0;if(w){let P=[oa(+s/w,0,1),oa(+h/w,0,1),oa(+d/w,0,1),g?Ry(+g,_):1];if(Fy(P))return P}}return}}let i=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=e.match(i);if(r){let[n,a,o,s,l,u,h,c,p]=r,d=[o||" ",l||" ",h].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){let f=[+a,oa(+s,0,100),oa(+u,0,100),c?Ry(+c,p):1];if(Fy(f))return KI(f)}}}function Qs(e){return parseInt(e.padEnd(2,e),16)/255}function Ry(e,t){return oa(t?e/100:e,0,1)}function oa(e,t,i){return Math.min(Math.max(t,e),i)}function Fy(e){return!e.some(Number.isNaN)}var eA={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function sn(e,t,i){return e+i*(t-e)}function Sa(e,t,i){return e.map((r,n)=>sn(r,t[n],i))}function tA(e){return e==="rgb"||e==="hcl"||e==="lab"}var oe=class sa{constructor(t,i,r,n=1,a=!0){this.r=t,this.g=i,this.b=r,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[t,i,r,n]))}static parse(t){if(t instanceof sa)return t;if(typeof t!="string")return;let i=QI(t);if(i)return new sa(...i,!1)}get rgb(){let{r:t,g:i,b:r,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[t/a,i/a,r/a,n])}get hcl(){return this.overwriteGetter("hcl",WI(this.rgb))}get lab(){return this.overwriteGetter("lab",ax(this.rgb))}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){let[t,i,r,n]=this.rgb;return"rgba(".concat([t,i,r].map(a=>Math.round(a*255)).join(","),",").concat(n,")")}static interpolate(t,i,r,n="rgb"){switch(n){case"rgb":{let[a,o,s,l]=Sa(t.rgb,i.rgb,r);return new sa(a,o,s,l,!1)}case"hcl":{let[a,o,s,l]=t.hcl,[u,h,c,p]=i.hcl,d,f;if(!isNaN(a)&&!isNaN(u)){let v=u-a;u>a&&v>180?v-=360:u<a&&a-u>180&&(v+=360),d=a+r*v}else isNaN(a)?isNaN(u)?d=NaN:(d=u,(s===1||s===0)&&(f=h)):(d=a,(c===1||c===0)&&(f=o));let[y,g,_,b]=HI([d,f!=null?f:sn(o,h,r),sn(s,c,r),sn(l,p,r)]);return new sa(y,g,_,b,!1)}case"lab":{let[a,o,s,l]=ox(Sa(t.lab,i.lab,r));return new sa(a,o,s,l,!1)}}}};oe.black=new oe(0,0,0,1);oe.white=new oe(1,1,1,1);oe.transparent=new oe(0,0,0,0);oe.red=new oe(1,0,0,1);var $p=class{constructor(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},iA=["bottom","center","top"],jc=class{constructor(e,t,i,r,n,a){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=a}},Or=class Dl{constructor(t){this.sections=t}static fromString(t){return new Dl([new jc(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Dl?t:Dl.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},gr=class Po{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Po)return t;if(typeof t=="number")return new Po([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let i of t)if(typeof i!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];break}return new Po(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new Po(Sa(t.values,i.values,r))}},_r=class So{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof So)return t;if(typeof t=="number")return new So([t]);if(Array.isArray(t)){for(let i of t)if(typeof i!="number")return;return new So(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new So(Sa(t.values,i.values,r))}},Ii=class To{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof To)return t;if(typeof t=="string"){let r=oe.parse(t);return r?new To([r]):void 0}if(!Array.isArray(t))return;let i=[];for(let r of t){if(typeof r!="string")return;let n=oe.parse(r);if(!n)return;i.push(n)}return new To(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,n="rgb"){let a=[];if(t.values.length!=i.values.length)throw new Error("colorArray: Arrays have mismatched length (".concat(t.values.length," vs. ").concat(i.values.length,"), cannot interpolate."));for(let o=0;o<t.values.length;o++)a.push(oe.interpolate(t.values[o],i.values[o],r,n));return new To(a)}},dt=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},rA=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),pn=class Ll{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ll)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!==0)){for(let i=0;i<t.length;i+=2){let r=t[i],n=t[i+1];if(typeof r!="string"||!rA.has(r)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new Ll(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){let n=t.values,a=i.values;if(n.length!==a.length)throw new dt("Cannot interpolate values of different length. from: ".concat(t.toString(),", to: ").concat(i.toString()));let o=[];for(let s=0;s<n.length;s+=2){if(n[s]!==a[s])throw new dt("Cannot interpolate values containing mismatched anchors. from[".concat(s,"]: ").concat(n[s],", to[").concat(s,"]: ").concat(a[s]));o.push(n[s]);let[l,u]=n[s+1],[h,c]=a[s+1];o.push([sn(l,h,r),sn(u,c,r)])}return new Ll(o)}},mr=class sx{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new sx({name:t,available:!1}):null}},Vn=class la{constructor(t,i,r){this.from=t,this.to=i,this.transition=r}static interpolate(t,i,r){return new la(t,i,r)}static parse(t){if(t instanceof la)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new la(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new la(t.from,t.to,t.transition);if(typeof t=="string")return new la(t,t,1)}};function lx(e,t,i,r){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof i=="number"&&i>=0&&i<=255?typeof r>"u"||typeof r=="number"&&r>=0&&r<=1?null:"Invalid rgba value [".concat([e,t,i,r].join(", "),"]: 'a' must be between 0 and 1."):"Invalid rgba value [".concat((typeof r=="number"?[e,t,i,r]:[e,t,i]).join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}function jo(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Vn||e instanceof oe||e instanceof $p||e instanceof Or||e instanceof gr||e instanceof _r||e instanceof Ii||e instanceof pn||e instanceof mr)return!0;if(Array.isArray(e)){for(let t of e)if(!jo(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!jo(e[t]))return!1;return!0}else return!1}function Mt(e){if(e===null)return ns;if(typeof e=="string")return Se;if(typeof e=="boolean")return be;if(typeof e=="number")return J;if(e instanceof oe)return Ni;if(e instanceof Vn)return cu;if(e instanceof $p)return pu;if(e instanceof Or)return as;if(e instanceof gr)return du;if(e instanceof _r)return fu;if(e instanceof Ii)return No;if(e instanceof pn)return mu;if(e instanceof mr)return os;if(Array.isArray(e)){let t=e.length,i;for(let r of e){let n=Mt(r);if(!i)i=n;else{if(i===n)continue;i=xe;break}}return ui(i||xe,t)}else return En}function Do(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof oe||e instanceof Vn||e instanceof Or||e instanceof gr||e instanceof _r||e instanceof Ii||e instanceof pn||e instanceof mr?e.toString():JSON.stringify(e)}var Uo=class ux{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(t.length!==2)return i.error("'literal' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!jo(t[1]))return i.error("invalid value");let r=t[1],n=Mt(r),a=i.expectedType;return n.kind==="array"&&n.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(n=a),new ux(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},el={string:Se,number:J,boolean:be,object:En},Dr=class hx{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=1,n,a=t[0];if(a==="array"){let s;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in el)||u==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);s=el[u],r++}else s=xe;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);l=t[2],r++}n=ui(s,l)}else{if(!el[a])throw new Error("Types doesn't contain name = ".concat(a));n=el[a]}let o=[];for(;r<t.length;r++){let s=i.parse(t[r],r,xe);if(!s)return null;o.push(s)}return new hx(n,o)}evaluate(t){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t);if(Vo(this.type,Mt(r))){if(i===this.args.length-1)throw new dt("Expected value to be of type ".concat(ut(this.type),", but found ").concat(ut(Mt(r))," instead."))}else return r}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},By={"to-boolean":be,"to-color":Ni,"to-number":J,"to-string":Se},fa=class cx{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[0];if(!By[r])throw new Error("Can't parse ".concat(r," as it is not part of the known types"));if((r==="to-boolean"||r==="to-string")&&t.length!==2)return i.error("Expected one argument.");let n=By[r],a=[];for(let o=1;o<t.length;o++){let s=i.parse(t[o],o,xe);if(!s)return null;a.push(s)}return new cx(n,a)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,r;for(let n of this.args){if(i=n.evaluate(t),r=null,i instanceof oe)return i;if(typeof i=="string"){let a=t.parseColor(i);if(a)return a}else if(Array.isArray(i)&&(i.length<3||i.length>4?r="Invalid rgba value ".concat(JSON.stringify(i),": expected an array containing either three or four numeric values."):r=lx(i[0],i[1],i[2],i[3]),!r))return new oe(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new dt(r||"Could not parse color from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"padding":{let i;for(let r of this.args){i=r.evaluate(t);let n=gr.parse(i);if(n)return n}throw new dt("Could not parse padding from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t);let n=_r.parse(i);if(n)return n}throw new dt("Could not parse numberArray from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t);let n=Ii.parse(i);if(n)return n}throw new dt("Could not parse colorArray from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t);let n=pn.parse(i);if(n)return n}throw new dt("Could not parse variableAnchorOffsetCollection from value '".concat(typeof i=="string"?i:JSON.stringify(i),"'"))}case"number":{let i=null;for(let r of this.args){if(i=r.evaluate(t),i===null)return 0;let n=Number(i);if(!isNaN(n))return n}throw new dt("Could not convert ".concat(JSON.stringify(i)," to number."))}case"formatted":return Or.fromString(Do(this.args[0].evaluate(t)));case"resolvedImage":return mr.fromString(Do(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Do(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},nA=["Unknown","Point","LineString","Polygon"],px=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?nA[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=oe.parse(e),this._parseColorCache.set(e,t)),t}},dx=class fx{constructor(t,i,r=[],n,a=new GI,o=[]){this.registry=t,this.path=r,this.key=r.map(s=>"[".concat(s,"]")).join(""),this.scope=a,this.errors=o,this.expectedType=n,this._isConstant=i}parse(t,i,r,n,a={}){return i?this.concat(i,r,n)._parse(t,a):this._parse(t,a)}_parse(t,i){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);function r(n,a,o){return o==="assert"?new Dr(a,[n]):o==="coerce"?new fa(a,[n]):n}if(Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n=t[0];if(typeof n!="string")return this.error("Expression name must be a string, but found ".concat(typeof n,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;let a=this.registry[n];if(a){let o=a.parse(t,this);if(!o)return null;if(this.expectedType){let s=this.expectedType,l=o.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")o=r(o,s,i.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=r(o,s,i.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(o instanceof Uo)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new px;try{o=new Uo(o.type,o.evaluate(s))}catch(l){return this.error(l.message),null}}return o}return this.error('Unknown expression "'.concat(n,'". If you wanted a literal array, use ["literal", [...]].'),0)}else return typeof t>"u"?this.error("'undefined' value invalid. Use null instead."):typeof t=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found ".concat(typeof t," instead."))}concat(t,i,r){let n=typeof t=="number"?this.path.concat(t):this.path,a=r?this.scope.concat(r):this.scope;return new fx(this.registry,this._isConstant,n,i||null,a,this.errors)}error(t,...i){let r="".concat(this.key).concat(i.map(n=>"[".concat(n,"]")).join(""));this.errors.push(new or(r,t))}checkSubtype(t,i){let r=Vo(t,i);return r&&this.error(r),r}},mx=class yx{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));let r=[];for(let a=1;a<t.length-1;a+=2){let o=t[a];if(typeof o!="string")return i.error("Expected string, but found ".concat(typeof o," instead."),a);if(/[^a-zA-Z0-9_]/.test(o))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=i.parse(t[a+1],a+1);if(!s)return null;r.push([o,s])}let n=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return n?new yx(r,n):null}outputDefined(){return this.result.outputDefined()}},gx=class _x{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(t.length!==2||typeof t[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");let r=t[1];return i.scope.has(r)?new _x(r,i.scope.get(r)):i.error('Unknown variable "'.concat(r,'". Make sure "').concat(r,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},aA=class xx{constructor(t,i,r){this.type=t,this.index=i,this.input=r}static parse(t,i){if(t.length!==3)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,J),n=i.parse(t[2],2,ui(i.expectedType||xe));if(!r||!n)return null;let a=n.type;return new xx(a.itemType,r,n)}evaluate(t){let i=this.index.evaluate(t),r=this.input.evaluate(t);if(i<0)throw new dt("Array index out of bounds: ".concat(i," < 0."));if(i>=r.length)throw new dt("Array index out of bounds: ".concat(i," > ").concat(r.length-1,"."));if(i!==Math.floor(i))throw new dt("Array index must be an integer, but found ".concat(i," instead."));return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},oA=class vx{constructor(t,i){this.type=be,this.needle=t,this.haystack=i}static parse(t,i){if(t.length!==3)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,xe),n=i.parse(t[2],2,xe);return!r||!n?null:qp(r.type,[be,Se,J,ns,xe])?new vx(r,n):i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ut(r.type)," instead"))}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!kn(i,["boolean","string","number","null"]))throw new dt("Expected first argument to be of type boolean, string, number or null, but found ".concat(ut(Mt(i))," instead."));if(!kn(r,["string","array"]))throw new dt("Expected second argument to be of type array or string, but found ".concat(ut(Mt(r))," instead."));return r.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},sA=class Uc{constructor(t,i,r){this.type=J,this.needle=t,this.haystack=i,this.fromIndex=r}static parse(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,xe),n=i.parse(t[2],2,xe);if(!r||!n)return null;if(!qp(r.type,[be,Se,J,ns,xe]))return i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ut(r.type)," instead"));if(t.length===4){let a=i.parse(t[3],3,J);return a?new Uc(r,n,a):null}else return new Uc(r,n)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!kn(i,["boolean","string","number","null"]))throw new dt("Expected first argument to be of type boolean, string, number or null, but found ".concat(ut(Mt(i))," instead."));let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),kn(r,["string"])){let a=r.indexOf(i,n);return a===-1?-1:[...r.slice(0,a)].length}else{if(kn(r,["array"]))return r.indexOf(i,n);throw new dt("Expected second argument to be of type array or string, but found ".concat(ut(Mt(r))," instead."))}}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},lA=class bx{constructor(t,i,r,n,a,o){this.inputType=t,this.type=i,this.input=r,this.cases=n,this.outputs=a,this.otherwise=o}static parse(t,i){if(t.length<5)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==1)return i.error("Expected an even number of arguments.");let r,n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);let a={},o=[];for(let u=2;u<t.length-1;u+=2){let h=t[u],c=t[u+1];Array.isArray(h)||(h=[h]);let p=i.concat(u);if(h.length===0)return p.error("Expected at least one branch label.");for(let f of h){if(typeof f!="number"&&typeof f!="string")return p.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>Number.MAX_SAFE_INTEGER)return p.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof f=="number"&&Math.floor(f)!==f)return p.error("Numeric branch labels must be integer values.");if(!r)r=Mt(f);else if(p.checkSubtype(r,Mt(f)))return null;if(typeof a[String(f)]<"u")return p.error("Branch labels must be unique.");a[String(f)]=o.length}let d=i.parse(c,u,n);if(!d)return null;n=n||d.type,o.push(d)}let s=i.parse(t[1],1,xe);if(!s)return null;let l=i.parse(t[t.length-1],t.length-1,n);return!l||s.type.kind!=="value"&&i.concat(1).checkSubtype(r,s.type)?null:new bx(r,n,s,a,o,l)}evaluate(t){let i=this.input.evaluate(t);return(Mt(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},uA=class wx{constructor(t,i,r){this.type=t,this.branches=i,this.otherwise=r}static parse(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&&i.expectedType.kind!=="value"&&(r=i.expectedType);let n=[];for(let o=1;o<t.length-1;o+=2){let s=i.parse(t[o],o,be);if(!s)return null;let l=i.parse(t[o+1],o+1,r);if(!l)return null;n.push([s,l]),r=r||l.type}let a=i.parse(t[t.length-1],t.length-1,r);if(!a)return null;if(!r)throw new Error("Can't infer output type");return new wx(r,n,a)}evaluate(t){for(let[i,r]of this.branches)if(i.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[i,r]of this.branches)t(i),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=>i.outputDefined())&&this.otherwise.outputDefined()}},hA=class Gc{constructor(t,i,r,n){this.type=t,this.input=i,this.beginIndex=r,this.endIndex=n}static parse(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1,xe),n=i.parse(t[2],2,J);if(!r||!n)return null;if(!qp(r.type,[ui(xe),Se,xe]))return i.error("Expected first argument to be of type array or string, but found ".concat(ut(r.type)," instead"));if(t.length===4){let a=i.parse(t[3],3,J);return a?new Gc(r.type,r,n,a):null}else return new Gc(r.type,r,n)}evaluate(t){let i=this.input.evaluate(t),r=this.beginIndex.evaluate(t),n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),kn(i,["string"]))return[...i].slice(r,n).join("");if(kn(i,["array"]))return i.slice(r,n);throw new dt("Expected first argument to be of type array or string, but found ".concat(ut(Mt(i))," instead."))}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}};function yu(e,t){let i=e.length-1,r=0,n=i,a=0,o,s;for(;r<=n;)if(a=Math.floor((r+n)/2),o=e[a],s=e[a+1],o<=t){if(a===i||t<s)return a;r=a+1}else if(o>t)n=a-1;else throw new dt("Input is not a number.");return 0}var Zp=class Px{constructor(t,i,r){this.type=t,this.input=i,this.labels=[],this.outputs=[];for(let[n,a]of r)this.labels.push(n),this.outputs.push(a)}static parse(t,i){if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return i.error("Expected an even number of arguments.");let r=i.parse(t[1],1,J);if(!r)return null;let n=[],a=null;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);for(let o=1;o<t.length;o+=2){let s=o===1?-1/0:t[o],l=t[o+1],u=o,h=o+1;if(typeof s!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let c=i.parse(l,h,a);if(!c)return null;a=a||c.type,n.push([s,c])}return new Px(a,r,n)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let n=this.input.evaluate(t);if(n<=i[0])return r[0].evaluate(t);let a=i.length;if(n>=i[a-1])return r[a-1].evaluate(t);let o=yu(i,n);return r[o].evaluate(t)}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function cA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ac,Oy;function pA(){if(Oy)return ac;Oy=1,ac=e;function e(t,i,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=r,this.p2y=n}return e.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,i){if(i===void 0&&(i=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var a=this.sampleCurveX(r)-t;if(Math.abs(a)<i)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-a/o}var s=0,l=1;for(r=t,n=0;n<20&&(a=this.sampleCurveX(r),!(Math.abs(a-t)<i));n++)t>a?s=r:l=r,r=(l-s)*.5+s;return r},solve:function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}},ac}var dA=pA(),fA=cA(dA),Vi=class Xc{constructor(t,i,r,n,a){this.type=t,this.operator=i,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(let[o,s]of a)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(t,i,r,n){let a=0;if(t.name==="exponential")a=oc(i,t.base,r,n);else if(t.name==="linear")a=oc(i,1,r,n);else if(t.name==="cubic-bezier"){let o=t.controlPoints;a=new fA(o[0],o[1],o[2],o[3]).solve(oc(i,1,r,n))}return a}static parse(t,i){let[r,n,a,...o]=t;if(!Array.isArray(n)||n.length===0)return i.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return i.error("Unknown interpolation type ".concat(String(n[0])),1,0);if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return i.error("Expected an even number of arguments.");if(a=i.parse(a,2,J),!a)return null;let s=[],l=null;(r==="interpolate-hcl"||r==="interpolate-lab")&&i.expectedType!=No?l=Ni:i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=0;u<o.length;u+=2){let h=o[u],c=o[u+1],p=u+3,d=u+4;if(typeof h!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(s.length&&s[s.length-1][0]>=h)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);let f=i.parse(c,d,l);if(!f)return null;l=l||f.type,s.push([h,f])}return!Wr(l,J)&&!Wr(l,cu)&&!Wr(l,Ni)&&!Wr(l,du)&&!Wr(l,fu)&&!Wr(l,No)&&!Wr(l,mu)&&!Wr(l,ui(J))?i.error("Type ".concat(ut(l)," is not interpolatable.")):new Xc(l,r,n,a,s)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let n=this.input.evaluate(t);if(n<=i[0])return r[0].evaluate(t);let a=i.length;if(n>=i[a-1])return r[a-1].evaluate(t);let o=yu(i,n),s=i[o],l=i[o+1],u=Xc.interpolationFactor(this.interpolation,n,s,l),h=r[o].evaluate(t),c=r[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return sn(h,c,u);case"color":return oe.interpolate(h,c,u);case"padding":return gr.interpolate(h,c,u);case"colorArray":return Ii.interpolate(h,c,u);case"numberArray":return _r.interpolate(h,c,u);case"variableAnchorOffsetCollection":return pn.interpolate(h,c,u);case"array":return Sa(h,c,u);case"projectionDefinition":return Vn.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return oe.interpolate(h,c,u,"hcl");case"colorArray":return Ii.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return oe.interpolate(h,c,u,"lab");case"colorArray":return Ii.interpolate(h,c,u,"lab")}}}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function oc(e,t,i,r){let n=r-i,a=e-i;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var ht={color:oe.interpolate,number:sn,padding:gr.interpolate,numberArray:_r.interpolate,colorArray:Ii.interpolate,variableAnchorOffsetCollection:pn.interpolate,array:Sa},Sx=class qc{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=null,n=i.expectedType;n&&n.kind!=="value"&&(r=n);let a=[];for(let o of t.slice(1)){let s=i.parse(o,1+a.length,r,void 0,{typeAnnotation:"omit"});if(!s)return null;r=r||s.type,a.push(s)}if(!r)throw new Error("No output type");return n&&a.some(o=>Vo(n,o.type))?new qc(xe,a):new qc(r,a)}evaluate(t){let i=null,r=0,n;for(let a of this.args)if(r++,i=a.evaluate(t),i&&i instanceof mr&&!i.available&&(n||(n=i.name),i=null,r===this.args.length&&(i=n)),i!==null)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function Ny(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function mA(e,t,i){return t===i}function yA(e,t,i){return t!==i}function gA(e,t,i){return t<i}function _A(e,t,i){return t>i}function xA(e,t,i){return t<=i}function vA(e,t,i){return t>=i}function Tx(e,t,i,r){return r.compare(t,i)===0}function bA(e,t,i,r){return!Tx(e,t,i,r)}function wA(e,t,i,r){return r.compare(t,i)<0}function PA(e,t,i,r){return r.compare(t,i)>0}function SA(e,t,i,r){return r.compare(t,i)<=0}function TA(e,t,i,r){return r.compare(t,i)>=0}function Da(e,t,i){let r=e!=="=="&&e!=="!=";return class Mx{constructor(a,o,s){this.type=be,this.lhs=a,this.rhs=o,this.collator=s,this.hasUntypedArgument=a.type.kind==="value"||o.type.kind==="value"}static parse(a,o){if(a.length!==3&&a.length!==4)return o.error("Expected two or three arguments.");let s=a[0],l=o.parse(a[1],1,xe);if(!l)return null;if(!Ny(s,l.type))return o.concat(1).error('"'.concat(s,"\" comparisons are not supported for type '").concat(ut(l.type),"'."));let u=o.parse(a[2],2,xe);if(!u)return null;if(!Ny(s,u.type))return o.concat(2).error('"'.concat(s,"\" comparisons are not supported for type '").concat(ut(u.type),"'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot compare types '".concat(ut(l.type),"' and '").concat(ut(u.type),"'."));r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Dr(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Dr(l.type,[u])));let h=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(h=o.parse(a[3],3,pu),!h)return null}return new Mx(l,u,h)}evaluate(a){let o=this.lhs.evaluate(a),s=this.rhs.evaluate(a);if(r&&this.hasUntypedArgument){let l=Mt(o),u=Mt(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new dt('Expected arguments for "'.concat(e,'" to be (string, string) or (number, number), but found (').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!r&&this.hasUntypedArgument){let l=Mt(o),u=Mt(s);if(l.kind!=="string"||u.kind!=="string")return t(a,o,s)}return this.collator?i(a,o,s,this.collator.evaluate(a)):t(a,o,s)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var MA=Da("==",mA,Tx),CA=Da("!=",yA,bA),IA=Da("<",gA,wA),AA=Da(">",_A,PA),EA=Da("<=",xA,SA),kA=Da(">=",vA,TA),Cx=class Ix{constructor(t,i,r){this.type=pu,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(t.length!==2)return i.error("Expected one argument.");let r=t[1];if(typeof r!="object"||Array.isArray(r))return i.error("Collator options argument must be an object.");let n=i.parse(r["case-sensitive"]===void 0?!1:r["case-sensitive"],1,be);if(!n)return null;let a=i.parse(r["diacritic-sensitive"]===void 0?!1:r["diacritic-sensitive"],1,be);if(!a)return null;let o=null;return r.locale&&(o=i.parse(r.locale,1,Se),!o)?null:new Ix(n,a,o)}evaluate(t){return new $p(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},DA=class Ax{constructor(t,i,r,n,a){this.type=Se,this.number=t,this.locale=i,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=a}static parse(t,i){if(t.length!==3)return i.error("Expected two arguments.");let r=i.parse(t[1],1,J);if(!r)return null;let n=t[2];if(typeof n!="object"||Array.isArray(n))return i.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=i.parse(n.locale,1,Se),!a))return null;let o=null;if(n.currency&&(o=i.parse(n.currency,1,Se),!o))return null;let s=null;if(n["min-fraction-digits"]&&(s=i.parse(n["min-fraction-digits"],1,J),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=i.parse(n["max-fraction-digits"],1,J),!l)?null:new Ax(r,a,o,s,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},Ex=class kx{constructor(t){this.type=as,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[1];if(!Array.isArray(r)&&typeof r=="object")return i.error("First argument must be an image or text section.");let n=[],a=!1;for(let o=1;o<=t.length-1;++o){let s=t[o];if(a&&typeof s=="object"&&!Array.isArray(s)){a=!1;let l=null;if(s["font-scale"]&&(l=i.parse(s["font-scale"],1,J),!l))return null;let u=null;if(s["text-font"]&&(u=i.parse(s["text-font"],1,ui(Se)),!u))return null;let h=null;if(s["text-color"]&&(h=i.parse(s["text-color"],1,Ni),!h))return null;let c=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!iA.includes(s["vertical-align"]))return i.error("'vertical-align' must be one of: 'bottom', 'center', 'top' but found '".concat(s["vertical-align"],"' instead."));if(c=i.parse(s["vertical-align"],1,Se),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=i.parse(t[o],1,xe);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new kx(n)}evaluate(t){let i=r=>{let n=r.content.evaluate(t);return Mt(n)===os?new jc("",n,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new jc(Do(n),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)};return new Or(this.sections.map(i))}eachChild(t){for(let i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}},LA=class Dx{constructor(t){this.type=os,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected two arguments.");let r=i.parse(t[1],1,Se);return r?new Dx(r):i.error("No image name provided.")}evaluate(t){let i=this.input.evaluate(t),r=mr.fromString(i);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(i)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}},zA=class Lx{constructor(t){this.type=J,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let r=i.parse(t[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?i.error("Expected argument of type string or array, but found ".concat(ut(r.type)," instead.")):new Lx(r):null}evaluate(t){let i=this.input.evaluate(t);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new dt("Expected value to be of type string or array, but found ".concat(ut(Mt(i))," instead."))}eachChild(t){t(this.input)}outputDefined(){return!1}},pr=8192;function RA(e,t){let i=FA(e[0]),r=OA(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*pr),Math.round(r*n*pr)]}function Yp(e,t){let i=Math.pow(2,t.z),r=(e[0]/pr+t.x)/i,n=(e[1]/pr+t.y)/i;return[BA(r),NA(n)]}function FA(e){return(180+e)/360}function BA(e){return e*360-180}function OA(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function NA(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function ss(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Go(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function VA(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function jA(e,t,i){let r=e[0]-t[0],n=e[1]-t[1],a=e[0]-i[0],o=e[1]-i[1];return r*o-a*n===0&&r*a<=0&&n*o<=0}function gu(e,t,i,r){let n=[t[0]-e[0],t[1]-e[1]],a=[r[0]-i[0],r[1]-i[1]];return qA(a,n)===0?!1:!!(Vy(e,t,i,r)&&Vy(i,r,e,t))}function UA(e,t,i){for(let r of i)for(let n=0;n<r.length-1;++n)if(gu(e,t,r[n],r[n+1]))return!0;return!1}function La(e,t,i=!1){let r=!1;for(let n of t)for(let a=0;a<n.length-1;a++){if(jA(e,n[a],n[a+1]))return i;VA(e,n[a],n[a+1])&&(r=!r)}return r}function GA(e,t){for(let i of t)if(La(e,i))return!0;return!1}function zx(e,t){for(let i of e)if(!La(i,t))return!1;for(let i=0;i<e.length-1;++i)if(UA(e[i],e[i+1],t))return!1;return!0}function XA(e,t){for(let i of t)if(zx(e,i))return!0;return!1}function qA(e,t){return e[0]*t[1]-e[1]*t[0]}function Vy(e,t,i,r){let n=e[0]-i[0],a=e[1]-i[1],o=t[0]-i[0],s=t[1]-i[1],l=r[0]-i[0],u=r[1]-i[1],h=n*u-l*a,c=o*u-l*s;return h>0&&c<0||h<0&&c>0}function Wp(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=[];for(let o=0;o<e[n].length;o++){let s=RA(e[n][o],i);ss(t,s),a.push(s)}r.push(a)}return r}function Rx(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=Wp(e[n],t,i);r.push(a)}return r}function Fx(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){let n=r*.5,a=e[0]-i[0]>n?-r:i[0]-e[0]>n?r:0;a===0&&(a=e[0]-i[2]>n?-r:i[2]-e[0]>n?r:0),e[0]+=a}ss(t,e)}function $A(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function jy(e,t,i,r){let n=Math.pow(2,r.z)*pr,a=[r.x*pr,r.y*pr],o=[];for(let s of e)for(let l of s){let u=[l.x+a[0],l.y+a[1]];Fx(u,t,i,n),o.push(u)}return o}function Uy(e,t,i,r){let n=Math.pow(2,r.z)*pr,a=[r.x*pr,r.y*pr],o=[];for(let s of e){let l=[];for(let u of s){let h=[u.x+a[0],u.y+a[1]];ss(t,h),l.push(h)}o.push(l)}if(t[2]-t[0]<=n/2){$A(t);for(let s of o)for(let l of s)Fx(l,t,i,n)}return o}function ZA(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=Wp(t.coordinates,r,n),o=jy(e.geometry(),i,r,n);if(!Go(i,r))return!1;for(let s of o)if(!La(s,a))return!1}if(t.type==="MultiPolygon"){let a=Rx(t.coordinates,r,n),o=jy(e.geometry(),i,r,n);if(!Go(i,r))return!1;for(let s of o)if(!GA(s,a))return!1}return!0}function YA(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(t.type==="Polygon"){let a=Wp(t.coordinates,r,n),o=Uy(e.geometry(),i,r,n);if(!Go(i,r))return!1;for(let s of o)if(!zx(s,a))return!1}if(t.type==="MultiPolygon"){let a=Rx(t.coordinates,r,n),o=Uy(e.geometry(),i,r,n);if(!Go(i,r))return!1;for(let s of o)if(!XA(s,a))return!1}return!0}var Hp=class zl{constructor(t,i){this.type=be,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error("'within' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(jo(t[1])){let r=t[1];if(r.type==="FeatureCollection"){let n=[];for(let a of r.features){let{type:o,coordinates:s}=a.geometry;o==="Polygon"&&n.push(s),o==="MultiPolygon"&&n.push(...s)}if(n.length){let a={type:"MultiPolygon",coordinates:n};return new zl(r,a)}}else if(r.type==="Feature"){let n=r.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new zl(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new zl(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return ZA(t,this.geometries);if(t.geometryType()==="LineString")return YA(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Bx=class{constructor(e=[],t=(i,r)=>i<r?-1:i>r?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let n=e-1>>1,a=t[n];if(i(r,a)>=0)break;t[e]=a,e=n}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let a=(e<<1)+1,o=a+1;if(o<this.length&&i(t[o],t[a])<0&&(a=o),i(t[a],n)>=0)break;t[e]=t[a],e=a}t[e]=n}};function Ox(e,t,i=0,r=e.length-1,n=WA){for(;r>i;){if(r-i>600){let l=r-i+1,u=t-i+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1),d=Math.max(i,Math.floor(t-u*c/l+p)),f=Math.min(r,Math.floor(t+(l-u)*c/l+p));Ox(e,t,d,f,n)}let a=e[t],o=i,s=r;for(lo(e,i,t),n(e[r],a)>0&&lo(e,i,r);o<s;){for(lo(e,o,s),o++,s--;n(e[o],a)<0;)o++;for(;n(e[s],a)>0;)s--}n(e[i],a)===0?lo(e,i,s):(s++,lo(e,s,r)),s<=t&&(i=s+1),t<=s&&(r=s-1)}}function lo(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function WA(e,t){return e<t?-1:e>t?1:0}function Kp(e,t){if(e.length<=1)return[e];let i=[],r,n;for(let a of e){let o=KA(a);o!==0&&(a.area=Math.abs(o),n===void 0&&(n=o<0),n===o<0?(r&&i.push(r),r=[a]):r.push(a))}if(r&&i.push(r),t>1)for(let a=0;a<i.length;a++)i[a].length<=t||(Ox(i[a],t,1,i[a].length-1,HA),i[a]=i[a].slice(0,t));return i}function HA(e,t){return t.area-e.area}function KA(e){let t=0;for(let i=0,r=e.length,n=r-1,a,o;i<r;n=i++)a=e[i],o=e[n],t+=(o.x-a.x)*(a.y+o.y);return t}var JA=6378.137,Gy=1/298.257223563,Xy=Gy*(2-Gy),qy=Math.PI/180,Jp=class{constructor(e){let t=qy*JA*1e3,i=Math.cos(e*qy),r=1/(1-Xy*(1-i*i)),n=Math.sqrt(r);this.kx=t*n*i,this.ky=t*n*r*(1-Xy)}distance(e,t){let i=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(e,t){let i=1/0,r,n,a,o;for(let s=0;s<e.length-1;s++){let l=e[s][0],u=e[s][1],h=this.wrap(e[s+1][0]-l)*this.kx,c=(e[s+1][1]-u)*this.ky,p=0;(h!==0||c!==0)&&(p=(this.wrap(t[0]-l)*this.kx*h+(t[1]-u)*this.ky*c)/(h*h+c*c),p>1?(l=e[s+1][0],u=e[s+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(t[0]-l)*this.kx,c=(t[1]-u)*this.ky;let d=h*h+c*c;d<i&&(i=d,r=l,n=u,a=s,o=p)}return{point:[r,n],index:a,t:Math.max(0,Math.min(1,o))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},$c=100,Zc=50;function Nx(e,t){return t[0]-e[0]}function Gl(e){return e[1]-e[0]+1}function Nr(e,t){return e[1]>=e[0]&&e[1]<t}function Yc(e,t){if(e[0]>e[1])return[null,null];let i=Gl(e);if(t){if(i===2)return[e,null];let n=Math.floor(i/2);return[[e[0],e[0]+n],[e[0]+n,e[1]]]}if(i===1)return[e,null];let r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function Wc(e,t){if(!Nr(t,e.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)ss(i,e[r]);return i}function Hc(e){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let r of i)ss(t,r);return t}function $y(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Qp(e,t,i){if(!$y(e)||!$y(t))return NaN;let r=0,n=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),i.distance([0,0],[r,n])}function In(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function ed(e,t,i,r,n){let a=Math.min(In(e,[i,r],n),In(t,[i,r],n)),o=Math.min(In(i,[e,t],n),In(r,[e,t],n));return Math.min(a,o)}function QA(e,t,i,r,n){if(!(Nr(t,e.length)&&Nr(r,i.length)))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let s=e[o],l=e[o+1];for(let u=r[0];u<r[1];++u){let h=i[u],c=i[u+1];if(gu(s,l,h,c))return 0;a=Math.min(a,ed(s,l,h,c,n))}}return a}function eE(e,t,i,r,n){if(!(Nr(t,e.length)&&Nr(r,i.length)))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let s=r[0];s<=r[1];++s)if(a=Math.min(a,n.distance(e[o],i[s])),a===0)return a;return a}function tE(e,t,i){if(La(e,t,!0))return 0;let r=1/0;for(let n of t){let a=n[0],o=n[n.length-1];if(a!==o&&(r=Math.min(r,In(e,[o,a],i)),r===0))return r;let s=i.pointOnLine(n,e);if(r=Math.min(r,i.distance(e,s.point)),r===0)return r}return r}function iE(e,t,i,r){if(!Nr(t,e.length))return NaN;for(let a=t[0];a<=t[1];++a)if(La(e[a],i,!0))return 0;let n=1/0;for(let a=t[0];a<t[1];++a){let o=e[a],s=e[a+1];for(let l of i)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],d=l[u];if(gu(o,s,p,d))return 0;n=Math.min(n,ed(o,s,p,d,r))}}return n}function Zy(e,t){for(let i of e)for(let r of i)if(La(r,t,!0))return!0;return!1}function rE(e,t,i,r=1/0){let n=Hc(e),a=Hc(t);if(r!==1/0&&Qp(n,a,i)>=r)return r;if(Go(n,a)){if(Zy(e,t))return 0}else if(Zy(t,e))return 0;let o=1/0;for(let s of e)for(let l=0,u=s.length,h=u-1;l<u;h=l++){let c=s[h],p=s[l];for(let d of t)for(let f=0,y=d.length,g=y-1;f<y;g=f++){let _=d[g],b=d[f];if(gu(c,p,_,b))return 0;o=Math.min(o,ed(c,p,_,b,i))}}return o}function Yy(e,t,i,r,n,a){if(!a)return;let o=Qp(Wc(r,a),n,i);o<t&&e.push([o,a,[0,0]])}function tl(e,t,i,r,n,a,o){if(!a||!o)return;let s=Qp(Wc(r,a),Wc(n,o),i);s<t&&e.push([s,a,o])}function Xl(e,t,i,r,n=1/0){let a=Math.min(r.distance(e[0],i[0][0]),n);if(a===0)return a;let o=new Bx([[0,[0,e.length-1],[0,0]]],Nx),s=Hc(i);for(;o.length>0;){let l=o.pop();if(l[0]>=a)continue;let u=l[1],h=t?Zc:$c;if(Gl(u)<=h){if(!Nr(u,e.length))return NaN;if(t){let c=iE(e,u,i,r);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=tE(e[c],i,r);if(a=Math.min(a,p),a===0)return 0}}else{let c=Yc(u,t);Yy(o,a,r,e,s,c[0]),Yy(o,a,r,e,s,c[1])}}return a}function ql(e,t,i,r,n,a=1/0){let o=Math.min(a,n.distance(e[0],i[0]));if(o===0)return o;let s=new Bx([[0,[0,e.length-1],[0,i.length-1]]],Nx);for(;s.length>0;){let l=s.pop();if(l[0]>=o)continue;let u=l[1],h=l[2],c=t?Zc:$c,p=r?Zc:$c;if(Gl(u)<=c&&Gl(h)<=p){if(!Nr(u,e.length)&&Nr(h,i.length))return NaN;let d;if(t&&r)d=QA(e,u,i,h,n),o=Math.min(o,d);else if(t&&!r){let f=e.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(d=In(i[y],f,n),o=Math.min(o,d),o===0)return o}else if(!t&&r){let f=i.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(d=In(e[y],f,n),o=Math.min(o,d),o===0)return o}else d=eE(e,u,i,h,n),o=Math.min(o,d)}else{let d=Yc(u,t),f=Yc(h,r);tl(s,o,n,e,i,d[0],f[0]),tl(s,o,n,e,i,d[0],f[1]),tl(s,o,n,e,i,d[1],f[0]),tl(s,o,n,e,i,d[1],f[1])}}return o}function nE(e,t){let i=e.geometry(),r=i.flat().map(o=>Yp([o.x,o.y],e.canonical));if(i.length===0)return NaN;let n=new Jp(r[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,ql(r,!1,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,ql(r,!1,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Xl(r,!1,o.coordinates,n,a));break}if(a===0)return a}return a}function aE(e,t){let i=e.geometry(),r=i.flat().map(o=>Yp([o.x,o.y],e.canonical));if(i.length===0)return NaN;let n=new Jp(r[0][1]),a=1/0;for(let o of t){switch(o.type){case"Point":a=Math.min(a,ql(r,!0,[o.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,ql(r,!0,o.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Xl(r,!0,o.coordinates,n,a));break}if(a===0)return a}return a}function oE(e,t){let i=e.geometry();if(i.length===0||i[0].length===0)return NaN;let r=Kp(i,0).map(o=>o.map(s=>s.map(l=>Yp([l.x,l.y],e.canonical)))),n=new Jp(r[0][0][0][1]),a=1/0;for(let o of t)for(let s of r){switch(o.type){case"Point":a=Math.min(a,Xl([o.coordinates],!1,s,n,a));break;case"LineString":a=Math.min(a,Xl(o.coordinates,!0,s,n,a));break;case"Polygon":a=Math.min(a,rE(s,o.coordinates,n,a));break}if(a===0)return a}return a}function sc(e){return e.type==="MultiPolygon"?e.coordinates.map(t=>({type:"Polygon",coordinates:t})):e.type==="MultiLineString"?e.coordinates.map(t=>({type:"LineString",coordinates:t})):e.type==="MultiPoint"?e.coordinates.map(t=>({type:"Point",coordinates:t})):[e]}var td=class Rl{constructor(t,i){this.type=J,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error("'distance' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(jo(t[1])){let r=t[1];if(r.type==="FeatureCollection")return new Rl(r,r.features.map(n=>sc(n.geometry)).flat());if(r.type==="Feature")return new Rl(r,sc(r.geometry));if("type"in r&&"coordinates"in r)return new Rl(r,sc(r))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return nE(t,this.geometries);if(t.geometryType()==="LineString")return aE(t,this.geometries);if(t.geometryType()==="Polygon")return oE(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},id=class Vx{constructor(t){this.type=xe,this.key=t}static parse(t,i){if(t.length!==2)return i.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let r=t[1];return r==null?i.error("Global state property must be defined."):typeof r!="string"?i.error("Global state property must be string, but found ".concat(typeof t[1]," instead.")):new Vx(r)}evaluate(t){var i;let r=(i=t.globals)===null||i===void 0?void 0:i.globalState;return!r||Object.keys(r).length===0?null:ko(r,this.key)}eachChild(){}outputDefined(){return!1}},ga={"==":MA,"!=":CA,">":AA,"<":IA,">=":kA,"<=":EA,array:Dr,at:aA,boolean:Dr,case:uA,coalesce:Sx,collator:Cx,format:Ex,image:LA,in:oA,"index-of":sA,interpolate:Vi,"interpolate-hcl":Vi,"interpolate-lab":Vi,length:zA,let:mx,literal:Uo,match:lA,number:Dr,"number-format":DA,object:Dr,slice:hA,step:Zp,string:Dr,"to-boolean":fa,"to-color":fa,"to-number":fa,"to-string":fa,var:gx,within:Hp,distance:td,"global-state":id},jn=class Mo{constructor(t,i,r,n){this.name=t,this.type=i,this._evaluate=r,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){let r=t[0],n=Mo.definitions[r];if(!n)return i.error('Unknown expression "'.concat(r,'". If you wanted a literal array, use ["literal", [...]].'),0);let a=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=o.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,h]of s){l=new dx(i.registry,$l,i.path,null,i.scope);let c=[],p=!1;for(let d=1;d<t.length;d++){let f=t[d],y=Array.isArray(u)?u[d-1]:u.type,g=l.parse(f,1+c.length,y);if(!g){p=!0;break}c.push(g)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(c.length," instead."));continue}for(let d=0;d<c.length;d++){let f=Array.isArray(u)?u[d]:u.type,y=c[d];l.concat(d+1).checkSubtype(f,y.type)}if(l.errors.length===0)return new Mo(r,a,h,c)}}if(s.length===1)i.errors.push(...l.errors);else{let u=(s.length?s:o).map(([c])=>lE(c)).join(" | "),h=[];for(let c=1;c<t.length;c++){let p=i.parse(t[c],1+h.length);if(!p)return null;h.push(ut(p.type))}i.error("Expected arguments of type ".concat(u,", but found (").concat(h.join(", "),") instead."))}return null}static register(t,i){Mo.definitions=i;for(let r in i)t[r]=Mo}};function Wy(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);let a=n?n.evaluate(e):1,o=lx(t,i,r,a);if(o)throw new dt(o);return new oe(t/255,i/255,r/255,a,!1)}function Hy(e,t){return e in t}function lc(e,t){let i=t[e];return typeof i>"u"?null:i}function sE(e,t,i,r){for(;i<=r;){let n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}function Tn(e){return{type:e}}jn.register(ga,{error:[XI,[Se],(e,[t])=>{throw new dt(t.evaluate(e))}],typeof:[Se,[xe],(e,[t])=>ut(Mt(t.evaluate(e)))],"to-rgba":[ui(J,4),[Ni],(e,[t])=>{let[i,r,n,a]=t.evaluate(e).rgb;return[i*255,r*255,n*255,a]}],rgb:[Ni,[J,J,J],Wy],rgba:[Ni,[J,J,J,J],Wy],has:{type:be,overloads:[[[Se],(e,[t])=>Hy(t.evaluate(e),e.properties())],[[Se,En],(e,[t,i])=>Hy(t.evaluate(e),i.evaluate(e))]]},get:{type:xe,overloads:[[[Se],(e,[t])=>lc(t.evaluate(e),e.properties())],[[Se,En],(e,[t,i])=>lc(t.evaluate(e),i.evaluate(e))]]},"feature-state":[xe,[Se],(e,[t])=>lc(t.evaluate(e),e.featureState||{})],properties:[En,[],e=>e.properties()],"geometry-type":[Se,[],e=>e.geometryType()],id:[xe,[],e=>e.id()],zoom:[J,[],e=>e.globals.zoom],"heatmap-density":[J,[],e=>e.globals.heatmapDensity||0],elevation:[J,[],e=>e.globals.elevation||0],"line-progress":[J,[],e=>e.globals.lineProgress||0],accumulated:[xe,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[J,Tn(J),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[J,Tn(J),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:J,overloads:[[[J,J],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[J],(e,[t])=>-t.evaluate(e)]]},"/":[J,[J,J],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[J,[J,J],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[J,[],()=>Math.LN2],pi:[J,[],()=>Math.PI],e:[J,[],()=>Math.E],"^":[J,[J,J],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[J,[J],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[J,[J],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[J,[J],(e,[t])=>Math.log(t.evaluate(e))],log2:[J,[J],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[J,[J],(e,[t])=>Math.sin(t.evaluate(e))],cos:[J,[J],(e,[t])=>Math.cos(t.evaluate(e))],tan:[J,[J],(e,[t])=>Math.tan(t.evaluate(e))],asin:[J,[J],(e,[t])=>Math.asin(t.evaluate(e))],acos:[J,[J],(e,[t])=>Math.acos(t.evaluate(e))],atan:[J,[J],(e,[t])=>Math.atan(t.evaluate(e))],min:[J,Tn(J),(e,t)=>Math.min(...t.map(i=>i.evaluate(e)))],max:[J,Tn(J),(e,t)=>Math.max(...t.map(i=>i.evaluate(e)))],abs:[J,[J],(e,[t])=>Math.abs(t.evaluate(e))],round:[J,[J],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[J,[J],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[J,[J],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[be,[Se,xe],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[be,[xe],(e,[t])=>e.id()===t.value],"filter-type-==":[be,[Se],(e,[t])=>e.geometryType()===t.value],"filter-<":[be,[Se,xe],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[be,[xe],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[be,[Se,xe],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[be,[xe],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[be,[Se,xe],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[be,[xe],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[be,[Se,xe],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[be,[xe],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[be,[xe],(e,[t])=>t.value in e.properties()],"filter-has-id":[be,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[be,[ui(Se)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[be,[ui(xe)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[be,[Se,ui(xe)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[be,[Se,ui(xe)],(e,[t,i])=>sE(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:be,overloads:[[[be,be],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Tn(be),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:be,overloads:[[[be,be],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Tn(be),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[be,[be],(e,[t])=>!t.evaluate(e)],"is-supported-script":[be,[Se],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return i?i(t.evaluate(e)):!0}],upcase:[Se,[Se],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Se,[Se],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Se,Tn(xe),(e,t)=>t.map(i=>Do(i.evaluate(e))).join("")],"resolved-locale":[Se,[pu],(e,[t])=>t.evaluate(e).resolvedLocale()]});function lE(e){return Array.isArray(e)?"(".concat(e.map(ut).join(", "),")"):"(".concat(ut(e.type),"...)")}function $l(e){if(e instanceof gx)return $l(e.boundExpression);if(e instanceof jn&&e.name==="error"||e instanceof Cx||e instanceof Hp||e instanceof td||e instanceof id)return!1;let t=e instanceof fa||e instanceof Dr,i=!0;return e.eachChild(r=>{t?i=i&&$l(r):i=i&&r instanceof Uo}),i?_u(e)&&xu(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function _u(e){if(e instanceof jn&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof Hp||e instanceof td)return!1;let t=!0;return e.eachChild(i=>{t&&!_u(i)&&(t=!1)}),t}function Xo(e){if(e instanceof jn&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(i=>{t&&!Xo(i)&&(t=!1)}),t}function xu(e,t){if(e instanceof jn&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(r=>{i&&!xu(r,t)&&(i=!1)}),i}function Kc(e){return{result:"success",value:e}}function ua(e){return{result:"error",value:e}}function Ta(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function jx(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function rd(e){return!!e.expression&&e.expression.interpolated}function Te(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function vu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Mt(e)===En}function uE(e){return e}function hE(e){switch(e.type){case"color":return oe.parse;case"padding":return gr.parse;case"numberArray":return _r.parse;case"colorArray":return Ii.parse;default:return null}}function cE(e){switch(e){case"exponential":return Gx;case"interval":return dE;case"categorical":return pE;case"identity":return fE;default:throw new Error('Unknown function type "'.concat(e,'"'))}}function Ux(e,t){let i=e.stops&&typeof e.stops[0][0]=="object",r=i||e.property!==void 0,n=i||!r,a=e.type||(rd(t)?"exponential":"interval"),o=hE(t);if(o&&(e=Pa({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],o(h[1])])),e.default?e.default=o(e.default):e.default=o(t.default)),e.colorSpace&&!tA(e.colorSpace))throw new Error('Unknown color space: "'.concat(e.colorSpace,'"'));let s=cE(a),l,u;if(a==="categorical"){l=Object.create(null);for(let h of e.stops)l[h[0]]=h[1];u=typeof e.stops[0][0]}if(i){let h={},c=[];for(let f=0;f<e.stops.length;f++){let y=e.stops[f],g=y[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},c.push(g)),h[g].stops.push([y[0].value,y[1]])}let p=[];for(let f of c)p.push([h[f].zoom,Ux(h[f],t)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:Vi.interpolationFactor.bind(void 0,d),zoomStops:p.map(f=>f[0]),evaluate({zoom:f},y){return Gx({stops:p,base:e.base},t,f).evaluate(f,y)}}}else if(n){let h=a==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:h,interpolationFactor:Vi.interpolationFactor.bind(void 0,h),zoomStops:e.stops.map(c=>c[0]),evaluate:({zoom:c})=>s(e,t,c,l,u)}}else return{kind:"source",evaluate(h,c){let p=c&&c.properties?c.properties[e.property]:void 0;return p===void 0?ls(e.default,t.default):s(e,t,p,l,u)}}}function ls(e,t,i){if(e!==void 0)return e;if(t!==void 0)return t;if(i!==void 0)return i}function pE(e,t,i,r,n){let a=typeof i===n?r[i]:void 0;return ls(a,e.default,t.default)}function dE(e,t,i){if(Te(i)!=="number")return ls(e.default,t.default);let r=e.stops.length;if(r===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];let n=yu(e.stops.map(a=>a[0]),i);return e.stops[n][1]}function Gx(e,t,i){let r=e.base!==void 0?e.base:1;if(Te(i)!=="number")return ls(e.default,t.default);let n=e.stops.length;if(n===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];let a=yu(e.stops.map(h=>h[0]),i),o=mE(i,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=ht[t.type]||uE;return typeof s.evaluate=="function"?{evaluate(...h){let c=s.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(!(c===void 0||p===void 0))return u(c,p,o,e.colorSpace)}}:u(s,l,o,e.colorSpace)}function fE(e,t,i){switch(t.type){case"color":i=oe.parse(i);break;case"formatted":i=Or.fromString(i.toString());break;case"resolvedImage":i=mr.fromString(i.toString());break;case"padding":i=gr.parse(i);break;case"colorArray":i=Ii.parse(i);break;case"numberArray":i=_r.parse(i);break;default:Te(i)!==t.type&&(t.type!=="enum"||!t.values[i])&&(i=void 0)}return ls(i,e.default,t.default)}function mE(e,t,i,r){let n=r-i,a=e-i;return n===0?0:t===1?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var nd=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new px,this._defaultValue=t?xE(t):null,this._enumValues=t&&t.type==="enum"?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let o=this.expression.evaluate(this._evaluator);if(o==null||typeof o=="number"&&o!==o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new dt("Expected value to be one of ".concat(Object.keys(this._enumValues).map(s=>JSON.stringify(s)).join(", "),", but found ").concat(JSON.stringify(o)," instead."));return o}catch(o){return this._warningHistory[o.message]||(this._warningHistory[o.message]=!0,typeof console<"u"&&console.warn(o.message)),this._defaultValue}}};function bu(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in ga}function ad(e,t){let i=new dx(ga,$l,[],t?_E(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return r?Kc(new nd(r,t)):ua(i.errors)}var qo=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Xo(t.expression),this.globalStateRefs=wu(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}evaluate(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}},Zl=class{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Xo(t.expression),this.globalStateRefs=wu(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}evaluate(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}interpolationFactor(e,t,i){return this.interpolationType?Vi.interpolationFactor(this.interpolationType,e,t,i):0}};function yE(e){return e._styleExpression!==void 0}function Xx(e,t){let i=ad(e,t);if(i.result==="error")return i;let r=i.value.expression,n=_u(r);if(!n&&!Ta(t))return ua([new or("","data expressions not supported")]);let a=xu(r,["zoom"]);if(!a&&!jx(t))return ua([new or("","zoom expressions not supported")]);let o=Fl(r);if(!o&&!a)return ua([new or("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(o instanceof or)return ua([o]);if(o instanceof Vi&&!rd(t))return ua([new or("",'"interpolate" expressions cannot be used with this property')]);if(!o)return Kc(n?new qo("constant",i.value):new qo("source",i.value));let s=o instanceof Vi?o.interpolation:void 0;return Kc(n?new Zl("camera",i.value,o.labels,s):new Zl("composite",i.value,o.labels,s))}var qx=class $x{constructor(t,i){this._parameters=t,this._specification=i,Pa(this,Ux(this._parameters,this._specification))}static deserialize(t){return new $x(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}};function gE(e,t){if(vu(e))return new qx(e,t);if(bu(e)){let i=Xx(e,t);if(i.result==="error")throw new Error(i.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));return i.value}else{let i=e;return t.type==="color"&&typeof e=="string"?i=oe.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?i=gr.parse(e):t.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?i=_r.parse(e):t.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?i=Ii.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?i=pn.parse(e):t.type==="projectionDefinition"&&typeof e=="string"&&(i=Vn.parse(e)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>i}}}function Fl(e){let t=null;if(e instanceof mx)t=Fl(e.result);else if(e instanceof Sx){for(let i of e.args)if(t=Fl(i),t)break}else(e instanceof Zp||e instanceof Vi)&&e.input instanceof jn&&e.input.name==="zoom"&&(t=e);return t instanceof or||e.eachChild(i=>{let r=Fl(i);r instanceof or?t=r:!t&&r?t=new or("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new or("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function wu(e,t=new Set){return e instanceof id&&t.add(e.key),e.eachChild(i=>{wu(i,t)}),t}function _E(e){let t={color:Ni,string:Se,number:J,enum:Se,boolean:be,formatted:as,padding:du,numberArray:fu,colorArray:No,projectionDefinition:cu,resolvedImage:os,variableAnchorOffsetCollection:mu};return e.type==="array"?ui(t[e.value]||xe,e.length):t[e.type]}function xE(e){if(e.type==="color"&&vu(e.default))return new oe(0,0,0,0);switch(e.type){case"color":return oe.parse(e.default)||null;case"padding":return gr.parse(e.default)||null;case"numberArray":return _r.parse(e.default)||null;case"colorArray":return Ii.parse(e.default)||null;case"variableAnchorOffsetCollection":return pn.parse(e.default)||null;case"projectionDefinition":return Vn.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function od(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length>=2&&e[1]!=="$id"&&e[1]!=="$type";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!od(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}var vE={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function $o(e){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};od(e)||(e=Yl(e));let t=ad(e,vE);if(t.result==="error")throw new Error(t.value.map(i=>"".concat(i.key,": ").concat(i.message)).join(", "));{let i=Zx(e);return{filter:(r,n,a)=>t.value.evaluate(r,n,{},a),needGeometry:i,getGlobalStateRefs:()=>wu(t.value.expression)}}}function bE(e,t){return e<t?-1:e>t?1:0}function Zx(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t<e.length;t++)if(Zx(e[t]))return!0;return!1}function Yl(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?uc(e[1],e[2],"=="):t==="!="?il(uc(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?uc(e[1],e[2],t):t==="any"?wE(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Yl)):t==="none"?["all"].concat(e.slice(1).map(Yl).map(il)):t==="in"?Ky(e[1],e.slice(2)):t==="!in"?il(Ky(e[1],e.slice(2))):t==="has"?Jy(e[1]):t==="!has"?il(Jy(e[1])):!0}function uc(e,t,i){switch(e){case"$type":return["filter-type-".concat(i),t];case"$id":return["filter-id-".concat(i),t];default:return["filter-".concat(i),e,t]}}function wE(e){return["any"].concat(e.map(Yl))}function Ky(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(i=>typeof i!=typeof t[0])?["filter-in-large",e,["literal",t.sort(bE)]]:["filter-in-small",e,["literal",t]]}}function Jy(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function il(e){return["!",e]}function PE(){let e={},t=V.$version;for(let i in V.$root){let r=V.$root[i];if(r.required){let n=null;i==="version"?n=t:r.type==="array"?n=[]:n={},n!=null&&(e[i]=n)}}return e}function Yx(e){let t=e.key,i=e.value;return i?[new W(t,i,"constants have been deprecated as of v8")]:[]}function xt(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Ln(e){if(Array.isArray(e))return e.map(Ln);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=Ln(e[i]);return t}return xt(e)}function Ci(e){let t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,l=[],u=Te(i);if(u!=="object")return[new W(t,i,"object expected, ".concat(u," found"))];for(let h in i){let c=h.split(".")[0],p=ko(r,c)||r["*"],d;if(ko(n,c))d=n[c];else if(ko(r,c))d=s;else if(n["*"])d=n["*"];else if(r["*"])d=s;else{l.push(new W(t,i[h],'unknown property "'.concat(h,'"')));continue}l=l.concat(d({key:(t&&"".concat(t,"."))+h,value:i[h],valueSpec:p,style:a,styleSpec:o,object:i,objectKey:h,validateSpec:s},i))}for(let h in r)n[h]||r[h].required&&r[h].default===void 0&&i[h]===void 0&&l.push(new W(t,i,'missing required property "'.concat(h,'"')));return l}function sd(e){let t=e.value,i=e.valueSpec,r=e.validateSpec,n=e.style,a=e.styleSpec,o=e.key,s=e.arrayElementValidator||r;if(Te(t)!=="array")return[new W(o,t,"array expected, ".concat(Te(t)," found"))];if(i.length&&t.length!==i.length)return[new W(o,t,"array length ".concat(i.length," expected, length ").concat(t.length," found"))];if(i["min-length"]&&t.length<i["min-length"])return[new W(o,t,"array length at least ".concat(i["min-length"]," expected, length ").concat(t.length," found"))];let l={type:i.value,values:i.values};a.$version<7&&(l.function=i.function),Te(i.value)==="object"&&(l=i.value);let u=[];for(let h=0;h<t.length;h++)u=u.concat(s({array:t,arrayIndex:h,value:t[h],valueSpec:l,validateSpec:e.validateSpec,style:n,styleSpec:a,key:"".concat(o,"[").concat(h,"]")}));return u}function Pu(e){let t=e.key,i=e.value,r=e.valueSpec,n=Te(i);return n==="number"&&i!==i&&(n="NaN"),n!=="number"?[new W(t,i,"number expected, ".concat(n," found"))]:"minimum"in r&&i<r.minimum?[new W(t,i,"".concat(i," is less than the minimum value ").concat(r.minimum))]:"maximum"in r&&i>r.maximum?[new W(t,i,"".concat(i," is greater than the maximum value ").concat(r.maximum))]:[]}function Wx(e){let t=e.valueSpec,i=xt(e.value.type),r,n={},a,o,s=i!=="categorical"&&e.value.property===void 0,l=!s,u=Te(e.value.stops)==="array"&&Te(e.value.stops[0])==="array"&&Te(e.value.stops[0][0])==="object",h=Ci({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:f}});return i==="identity"&&s&&h.push(new W(e.key,e.value,'missing required property "property"')),i!=="identity"&&!e.value.stops&&h.push(new W(e.key,e.value,'missing required property "stops"')),i==="exponential"&&e.valueSpec.expression&&!rd(e.valueSpec)&&h.push(new W(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Ta(e.valueSpec)?h.push(new W(e.key,e.value,"property functions not supported")):s&&!jx(e.valueSpec)&&h.push(new W(e.key,e.value,"zoom functions not supported"))),(i==="categorical"||u)&&e.value.property===void 0&&h.push(new W(e.key,e.value,'"property" property is required')),h;function c(y){if(i==="identity")return[new W(y.key,y.value,'identity function may not have a "stops" property')];let g=[],_=y.value;return g=g.concat(sd({key:y.key,value:_,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),Te(_)==="array"&&_.length===0&&g.push(new W(y.key,_,"array must have at least one stop")),g}function p(y){let g=[],_=y.value,b=y.key;if(Te(_)!=="array")return[new W(b,_,"array expected, ".concat(Te(_)," found"))];if(_.length!==2)return[new W(b,_,"array length 2 expected, length ".concat(_.length," found"))];if(u){if(Te(_[0])!=="object")return[new W(b,_,"object expected, ".concat(Te(_[0])," found"))];if(_[0].zoom===void 0)return[new W(b,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new W(b,_,"object stop key must have value")];if(o&&o>xt(_[0].zoom))return[new W(b,_[0].zoom,"stop zoom values must appear in ascending order")];xt(_[0].zoom)!==o&&(o=xt(_[0].zoom),a=void 0,n={}),g=g.concat(Ci({key:"".concat(b,"[0]"),value:_[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Pu,value:d}}))}else g=g.concat(d({key:"".concat(b,"[0]"),value:_[0],validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},_));return bu(Ln(_[1]))?g.concat([new W("".concat(b,"[1]"),_[1],"expressions are not allowed in function stops.")]):g.concat(y.validateSpec({key:"".concat(b,"[1]"),value:_[1],valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function d(y,g){let _=Te(y.value),b=xt(y.value),v=y.value!==null?y.value:g;if(!r)r=_;else if(_!==r)return[new W(y.key,v,"".concat(_," stop domain type must match previous stop domain type ").concat(r))];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new W(y.key,v,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&i!=="categorical"){let w="number expected, ".concat(_," found");return Ta(t)&&i===void 0&&(w+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new W(y.key,v,w)]}return i==="categorical"&&_==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new W(y.key,v,"integer expected, found ".concat(b))]:i!=="categorical"&&_==="number"&&a!==void 0&&b<a?[new W(y.key,v,"stop domain values must appear in ascending order")]:(a=b,i==="categorical"&&b in n?[new W(y.key,v,"stop domain values must be unique")]:(n[b]=!0,[]))}function f(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:t,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function Ma(e){let t=(e.expressionContext==="property"?Xx:ad)(Ln(e.value),e.valueSpec);if(t.result==="error")return t.value.map(r=>new W("".concat(e.key).concat(r.key),e.value,r.message));let i=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!i.outputDefined())return[new W(e.key,e.value,'Invalid data expression for "'.concat(e.propertyKey,'". Output values must be contained as literals within the expression.'))];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!Xo(i))return[new W(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!Xo(i))return[new W(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!xu(i,["zoom","feature-state"]))return[new W(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!_u(i))return[new W(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function SE(e){let t=e.value,i=e.key,r=Te(t);return r!=="boolean"?[new W(i,t,"boolean expected, ".concat(r," found"))]:[]}function Jc(e){let t=e.key,i=e.value,r=Te(i);return r!=="string"?[new W(t,i,"color expected, ".concat(r," found"))]:oe.parse(String(i))?[]:[new W(t,i,'color expected, "'.concat(i,'" found'))]}function Zo(e){let t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?r.values.indexOf(xt(i))===-1&&n.push(new W(t,i,"expected one of [".concat(r.values.join(", "),"], ").concat(JSON.stringify(i)," found"))):Object.keys(r.values).indexOf(xt(i))===-1&&n.push(new W(t,i,"expected one of [".concat(Object.keys(r.values).join(", "),"], ").concat(JSON.stringify(i)," found"))),n}function ld(e){return od(Ln(e.value))?Ma(Pa({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Hx(e)}function Hx(e){let t=e.value,i=e.key;if(Te(t)!=="array")return[new W(i,t,"array expected, ".concat(Te(t)," found"))];let r=e.styleSpec,n,a=[];if(t.length<1)return[new W(i,t,"filter array must have at least 1 element")];switch(a=a.concat(Zo({key:"".concat(i,"[0]"),value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),xt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&xt(t[1])==="$type"&&a.push(new W(i,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":t.length!==3&&a.push(new W(i,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&(n=Te(t[1]),n!=="string"&&a.push(new W("".concat(i,"[1]"),t[1],"string expected, ".concat(n," found"))));for(let o=2;o<t.length;o++)n=Te(t[o]),xt(t[1])==="$type"?a=a.concat(Zo({key:"".concat(i,"[").concat(o,"]"),value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&a.push(new W("".concat(i,"[").concat(o,"]"),t[o],"string, number, or boolean expected, ".concat(n," found")));break;case"any":case"all":case"none":for(let o=1;o<t.length;o++)a=a.concat(Hx({key:"".concat(i,"[").concat(o,"]"),value:t[o],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=Te(t[1]),t.length!==2?a.push(new W(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):n!=="string"&&a.push(new W("".concat(i,"[1]"),t[1],"string expected, ".concat(n," found")));break}return a}function Kx(e,t){let i=e.key,r=e.validateSpec,n=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,l=a["".concat(t,"_").concat(e.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return r({key:i,value:o,valueSpec:a.transition,style:n,styleSpec:a});let h=e.valueSpec||l[s];if(!h)return[new W(i,o,'unknown property "'.concat(s,'"'))];let c;if(Te(o)==="string"&&Ta(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new W(i,o,'"'.concat(s,'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": ').concat(JSON.stringify(c[1])," }`."))];let p=[];return e.layerType==="symbol"&&(s==="text-field"&&n&&!n.glyphs&&p.push(new W(i,o,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&vu(Ln(o))&&xt(o.type)==="identity"&&p.push(new W(i,o,'"text-font" does not support identity functions'))),p.concat(r({key:e.key,value:o,valueSpec:h,style:n,styleSpec:a,expressionContext:"property",propertyType:t,propertyKey:s}))}function Jx(e){return Kx(e,"paint")}function Qx(e){return Kx(e,"layout")}function ev(e){let t=[],i=e.value,r=e.key,n=e.style,a=e.styleSpec;if(Te(i)!=="object")return[new W(r,i,"object expected, ".concat(Te(i)," found"))];!i.type&&!i.ref&&t.push(new W(r,i,'either "type" or "ref" is required'));let o=xt(i.type),s=xt(i.ref);if(i.id){let l=xt(i.id);for(let u=0;u<e.arrayIndex;u++){let h=n.layers[u];xt(h.id)===l&&t.push(new W(r,i.id,'duplicate layer id "'.concat(i.id,'", previously used at line ').concat(h.id.__line__)))}}if("ref"in i){["type","source","source-layer","filter","layout"].forEach(u=>{u in i&&t.push(new W(r,i[u],'"'.concat(u,'" is prohibited for ref layers')))});let l;n.layers.forEach(u=>{xt(u.id)===s&&(l=u)}),l?l.ref?t.push(new W(r,i.ref,"ref cannot reference another ref layer")):o=xt(l.type):t.push(new W(r,i.ref,'ref layer "'.concat(s,'" not found')))}else if(o!=="background")if(!i.source)t.push(new W(r,i,'missing required property "source"'));else{let l=n.sources&&n.sources[i.source],u=l&&xt(l.type);l?u==="vector"&&o==="raster"?t.push(new W(r,i.source,'layer "'.concat(i.id,'" requires a raster source'))):u!=="raster-dem"&&o==="hillshade"?t.push(new W(r,i.source,'layer "'.concat(i.id,'" requires a raster-dem source'))):u!=="raster-dem"&&o==="color-relief"?t.push(new W(r,i.source,'layer "'.concat(i.id,'" requires a raster-dem source'))):u==="raster"&&o!=="raster"?t.push(new W(r,i.source,'layer "'.concat(i.id,'" requires a vector source'))):u==="vector"&&!i["source-layer"]?t.push(new W(r,i,'layer "'.concat(i.id,'" must specify a "source-layer"'))):u==="raster-dem"&&o!=="hillshade"&&o!=="color-relief"?t.push(new W(r,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):o==="line"&&i.paint&&i.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&t.push(new W(r,i,'layer "'.concat(i.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):t.push(new W(r,i.source,'source "'.concat(i.source,'" not found')))}return t=t.concat(Ci({key:r,value:i,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:"".concat(r,".type"),value:i.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"})},filter:ld,layout(l){return Ci({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Qx(Pa({layerType:o},u))}}})},paint(l){return Ci({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Jx(Pa({layerType:o},u))}}})}}})),t}function zn(e){let t=e.value,i=e.key,r=Te(t);return r!=="string"?[new W(i,t,"string expected, ".concat(r," found"))]:[]}function TE(e){var t;let i=(t=e.sourceName)!==null&&t!==void 0?t:"",r=e.value,n=e.styleSpec,a=n.source_raster_dem,o=e.style,s=[],l=Te(r);if(r===void 0)return s;if(l!=="object")return s.push(new W("source_raster_dem",r,"object expected, ".concat(l," found"))),s;let u=xt(r.encoding)==="custom",h=["redFactor","greenFactor","blueFactor","baseShift"],c=e.value.encoding?'"'.concat(e.value.encoding,'"'):"Default";for(let p in r)!u&&h.includes(p)?s.push(new W(p,r[p],'In "'.concat(i,'": "').concat(p,'" is only valid when "encoding" is set to "custom". ').concat(c," encoding found"))):a[p]?s=s.concat(e.validateSpec({key:p,value:r[p],valueSpec:a[p],validateSpec:e.validateSpec,style:o,styleSpec:n})):s.push(new W(p,r[p],'unknown property "'.concat(p,'"')));return s}var Qy={promoteId:ME};function tv(e){let t=e.value,i=e.key,r=e.styleSpec,n=e.style,a=e.validateSpec;if(!t.type)return[new W(i,t,'"type" is required')];let o=xt(t.type),s;switch(o){case"vector":case"raster":return s=Ci({key:i,value:t,valueSpec:r["source_".concat(o.replace("-","_"))],style:e.style,styleSpec:r,objectElementValidators:Qy,validateSpec:a}),s;case"raster-dem":return s=TE({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case"geojson":if(s=Ci({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:a,objectElementValidators:Qy}),t.cluster)for(let l in t.clusterProperties){let[u,h]=t.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...Ma({key:"".concat(i,".").concat(l,".map"),value:h,expressionContext:"cluster-map"})),s.push(...Ma({key:"".concat(i,".").concat(l,".reduce"),value:c,expressionContext:"cluster-reduce"}))}return s;case"video":return Ci({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:a,styleSpec:r});case"image":return Ci({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:a,styleSpec:r});case"canvas":return[new W(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Zo({key:"".concat(i,".type"),value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function ME({key:e,value:t}){if(Te(t)==="string")return zn({key:e,value:t});{let i=[];for(let r in t)i.push(...zn({key:"".concat(e,".").concat(r),value:t[r]}));return i}}function iv(e){let t=e.value,i=e.styleSpec,r=i.light,n=e.style,a=[],o=Te(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new W("light",t,"object expected, ".concat(o," found"))]),a;for(let s in t){let l=s.match(/^(.*)-transition$/);l&&r[l[1]]&&r[l[1]].transition?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i})):r[s]?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):a=a.concat([new W(s,t[s],'unknown property "'.concat(s,'"'))])}return a}function rv(e){let t=e.value,i=e.styleSpec,r=i.sky,n=e.style,a=Te(t);if(t===void 0)return[];if(a!=="object")return[new W("sky",t,"object expected, ".concat(a," found"))];let o=[];for(let s in t)r[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i})):o=o.concat([new W(s,t[s],'unknown property "'.concat(s,'"'))]);return o}function nv(e){let t=e.value,i=e.styleSpec,r=i.terrain,n=e.style,a=[],o=Te(t);if(t===void 0)return a;if(o!=="object")return a=a.concat([new W("terrain",t,"object expected, ".concat(o," found"))]),a;for(let s in t)r[s]?a=a.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i})):a=a.concat([new W(s,t[s],'unknown property "'.concat(s,'"'))]);return a}function CE(e){return zn(e).length===0?[]:Ma(e)}function IE(e){return zn(e).length===0?[]:Ma(e)}function AE(e){let t=e.key,i=e.value;if(Te(i)==="array"){if(i.length<1||i.length>4)return[new W(t,i,"padding requires 1 to 4 values; ".concat(i.length," values found"))];let r={type:"number"},n=[];for(let a=0;a<i.length;a++)n=n.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:i[a],validateSpec:e.validateSpec,valueSpec:r}));return n}else return Pu({key:t,value:i,valueSpec:{}})}function EE(e){let t=e.key,i=e.value;if(Te(i)==="array"){let r={type:"number"};if(i.length<1)return[new W(t,i,"array length at least 1 expected, length 0 found")];let n=[];for(let a=0;a<i.length;a++)n=n.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:i[a],validateSpec:e.validateSpec,valueSpec:r}));return n}else return Pu({key:t,value:i,valueSpec:{}})}function kE(e){let t=e.key,i=e.value;if(Te(i)==="array"){if(i.length<1)return[new W(t,i,"array length at least 1 expected, length 0 found")];let r=[];for(let n=0;n<i.length;n++)r=r.concat(Jc({key:"".concat(t,"[").concat(n,"]"),value:i[n]}));return r}else return Jc({key:t,value:i})}function DE(e){let t=e.key,i=e.value,r=Te(i),n=e.styleSpec;if(r!=="array"||i.length<1||i.length%2!==0)return[new W(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let o=0;o<i.length;o+=2)a=a.concat(Zo({key:"".concat(t,"[").concat(o,"]"),value:i[o],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(sd({key:"".concat(t,"[").concat(o+1,"]"),value:i[o+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return a}function av(e){let t=[],i=e.value,r=e.key;if(Array.isArray(i)){let n=[],a=[];for(let o in i){i[o].id&&n.includes(i[o].id)&&t.push(new W(r,i,"all the sprites' ids must be unique, but ".concat(i[o].id," is duplicated"))),n.push(i[o].id),i[o].url&&a.includes(i[o].url)&&t.push(new W(r,i,"all the sprites' URLs must be unique, but ".concat(i[o].url," is duplicated"))),a.push(i[o].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(Ci({key:"".concat(r,"[").concat(o,"]"),value:i[o],valueSpec:s,validateSpec:e.validateSpec}))}return t}else return zn({key:r,value:i})}function LE(e){let t=e.value,i=e.styleSpec,r=i.projection,n=e.style,a=Te(t);if(t===void 0)return[];if(a!=="object")return[new W("projection",t,"object expected, ".concat(a," found"))];let o=[];for(let s in t)r[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i})):o=o.concat([new W(s,t[s],'unknown property "'.concat(s,'"'))]);return o}function zE(e){let t=e.key,i=e.value;i=i instanceof String?i.valueOf():i;let r=Te(i);return r==="array"&&!FE(i)&&!RE(i)?[new W(t,i,"projection expected, invalid array ".concat(JSON.stringify(i)," found"))]:["array","string"].includes(r)?[]:[new W(t,i,'projection expected, invalid type "'.concat(r,'" found'))]}function RE(e){return!!["interpolate","step","literal"].includes(e[0])}function FE(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function BE(e){return!!e&&e.constructor===Object}function ov(e){return BE(e.value)?[]:[new W(e.key,e.value,"object expected, ".concat(Te(e.value)," found"))]}var eg={"*"(){return[]},array:sd,boolean:SE,number:Pu,color:Jc,constants:Yx,enum:Zo,filter:ld,function:Wx,layer:ev,object:Ci,source:tv,light:iv,sky:rv,terrain:nv,projection:LE,projectionDefinition:zE,string:zn,formatted:CE,resolvedImage:IE,padding:AE,numberArray:EE,colorArray:kE,variableAnchorOffsetCollection:DE,sprite:av,state:ov};function Wl(e){let t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=Wl,i.expression&&vu(xt(t))?Wx(e):i.expression&&bu(Ln(t))?Ma(e):i.type&&eg[i.type]?eg[i.type](e):Ci(Pa({},e,{valueSpec:i.type?r[i.type]:i}))}function sv(e){let t=e.value,i=e.key,r=zn(e);return r.length||(t.indexOf("{fontstack}")===-1&&r.push(new W(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&r.push(new W(i,t,'"glyphs" url must include a "{range}" token'))),r}function Ai(e,t=V){let i=[];return i=i.concat(Wl({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Wl,objectElementValidators:{glyphs:sv,"*"(){return[]}}})),e.constants&&(i=i.concat(Yx({key:"constants",value:e.constants}))),lv(i)}Ai.source=Gi(Ui(tv));Ai.sprite=Gi(Ui(av));Ai.glyphs=Gi(Ui(sv));Ai.light=Gi(Ui(iv));Ai.sky=Gi(Ui(rv));Ai.terrain=Gi(Ui(nv));Ai.state=Gi(Ui(ov));Ai.layer=Gi(Ui(ev));Ai.filter=Gi(Ui(ld));Ai.paintProperty=Gi(Ui(Jx));Ai.layoutProperty=Gi(Ui(Qx));function Ui(e){return function(t){return e(bi(zt({},t),{validateSpec:Wl}))}}function lv(e){return[].concat(e).sort((t,i)=>t.line-i.line)}function Gi(e){return function(...t){return lv(e.apply(this,t))}}var St=Ai,zj=St.source,OE=St.light,NE=St.sky,Rj=St.terrain,Fj=St.filter,VE=St.paintProperty,jE=St.layoutProperty;function Su(e,t){let i=!1;if(t&&t.length)for(let r of t)e.fire(new he(new Error(r.message))),i=!0;return i}var Qc=class uv{constructor(t,i,r){let n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let o=new Int32Array(this.arrayBuffer);t=o[0],i=o[1],r=o[2],this.d=i+2*r;for(let u=0;u<this.d*this.d;u++){let h=o[3+u],c=o[3+u+1];n.push(h===c?null:o.subarray(h,c))}let s=o[3+n.length],l=o[3+n.length+1];this.keys=o.subarray(s,l),this.bboxes=o.subarray(l),this.insert=this._insertReadonly}else{this.d=i+2*r;for(let o=0;o<this.d*this.d;o++)n.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=r,this.scale=i/t,this.uid=0;let a=r/i*t;this.min=-a,this.max=t+a}insert(t,i,r,n,a){this._forEachCell(i,r,n,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(a)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,r,n,a,o){this.cells[a].push(o)}query(t,i,r,n,a){let o=this.min,s=this.max;if(t<=o&&i<=o&&s<=r&&s<=n&&!a)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(t,i,r,n,this._queryCell,l,u,a),l}}_queryCell(t,i,r,n,a,o,s,l){let u=this.cells[a];if(u!==null){let h=this.keys,c=this.bboxes;for(let p=0;p<u.length;p++){let d=u[p];if(s[d]===void 0){let f=d*4;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&i<=c[f+3]&&r>=c[f+0]&&n>=c[f+1])?(s[d]=!0,o.push(h[d])):s[d]=!1}}}}_forEachCell(t,i,r,n,a,o,s,l){let u=this._convertToCellCoord(t),h=this._convertToCellCoord(i),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n);for(let d=u;d<=c;d++)for(let f=h;f<=p;f++){let y=this.d*f+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(f),this._convertFromCellCoord(d+1),this._convertFromCellCoord(f+1)))&&a.call(this,t,i,r,n,y,o,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,i=3+this.cells.length+1+1,r=0;for(let o=0;o<this.cells.length;o++)r+=this.cells[o].length;let n=new Int32Array(i+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=i;for(let o=0;o<t.length;o++){let s=t[o];n[3+o]=a,n.set(s,a),a+=s.length}return n[3+t.length]=a,n.set(this.keys,a),a+=this.keys.length,n[3+t.length+1]=a,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer}static serialize(t,i){let r=t.toArrayBuffer();return i&&i.push(r),{buffer:r}}static deserialize(t){return new uv(t.buffer)}},Lr={};function te(e,t,i={}){if(Lr[e])throw new Error("".concat(e," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Lr[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}te("Object",Object);te("Set",Set);te("TransferableGridIndex",Qc);te("Color",oe);te("Error",Error);te("AJAXError",Ul);te("ResolvedImage",mr);te("StylePropertyFunction",qx);te("StyleExpression",nd,{omit:["_evaluator"]});te("ZoomDependentExpression",Zl);te("ZoomConstantExpression",qo);te("CompoundExpression",jn,{omit:["_evaluate"]});for(let e in ga)ga[e]._classRegistryKey||te("Expression_".concat(e),ga[e]);function hv(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}function ud(e){let t=e.constructor;return e.$name||t._classRegistryKey}function UE(e){if(e===null||typeof e!="object")return!1;let t=ud(e);return!!(t&&t!=="Object")}function cv(e){return!UE(e)&&(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||hv(e)||Fr(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Lo(e,t){if(cv(e)){if((hv(e)||Fr(e))&&t&&t.push(e),ArrayBuffer.isView(e)){let a=e;t&&t.push(a.buffer)}return e instanceof ImageData&&t&&t.push(e.data.buffer),e}if(Array.isArray(e)){let a=[];for(let o of e)a.push(Lo(o,t));return a}if(typeof e!="object")throw new Error("can't serialize object of type ".concat(typeof e));let i=ud(e);if(!i)throw new Error("can't serialize object of unregistered class ".concat(e.constructor.name));if(!Lr[i])throw new Error("".concat(i," is not registered."));let{klass:r}=Lr[i],n=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&n===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let a in e){if(!e.hasOwnProperty(a)||Lr[i].omit.indexOf(a)>=0)continue;let o=e[a];n[a]=Lr[i].shallow.indexOf(a)>=0?o:Lo(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(n.$name=i),n}function zo(e){if(cv(e))return e;if(Array.isArray(e))return e.map(zo);if(typeof e!="object")throw new Error("can't deserialize object of type ".concat(typeof e));let t=ud(e)||"Object";if(!Lr[t])throw new Error("can't deserialize unregistered class ".concat(t));let{klass:i}=Lr[t];if(!i)throw new Error("can't deserialize unregistered class ".concat(t));if(i.deserialize)return i.deserialize(e);let r=Object.create(i.prototype);for(let n of Object.keys(e)){if(n==="$name")continue;let a=e[n];r[n]=Lr[t].shallow.indexOf(n)>=0?a:zo(a)}return r}var ep=class{constructor(){this.first=!0}update(e,t){let i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=i,!0):!1)}},It={"Latin-1 Supplement":e=>e>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Hangul Syllables":e=>e>=44032&&e<=55215,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function GE(e){for(let t of e)if(ZE(t.charCodeAt(0)))return!0;return!1}function hd(e){let t=e.map(i=>{try{return new RegExp("\\p{sc=".concat(i,"}"),"u").source}catch(r){return null}}).filter(i=>i);return new RegExp(t.join("|"),"u")}var XE=["Arab","Dupl","Mong","Ougr","Syrc"],Bj=hd(XE),qE=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],$E=hd(qE);function ZE(e){return e===746||e===747?!0:e<4352?!1:!!(It["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||It["CJK Compatibility"](e)||It["CJK Strokes"](e)||It["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&e!==12336||It["Enclosed CJK Letters and Months"](e)||It["Ideographic Description Characters"](e)||It.Kanbun(e)||It.Katakana(e)&&e!==12540||It["Halfwidth and Fullwidth Forms"](e)&&e!==65288&&e!==65289&&e!==65293&&!(e>=65306&&e<=65310)&&e!==65339&&e!==65341&&e!==65343&&!(e>=65371&&e<=65503)&&e!==65507&&!(e>=65512&&e<=65519)||It["Small Form Variants"](e)&&!(e>=65112&&e<=65118)&&!(e>=65123&&e<=65126)||It["Vertical Forms"](e)||It["Yijing Hexagram Symbols"](e)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(e))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(e))||$E.test(String.fromCodePoint(e)))}var YE=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],WE=hd(YE);function pv(e){return WE.test(String.fromCodePoint(e))}function HE(e,t){return!(!t&&pv(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||It.Khmer(e))}function KE(e){for(let t of e)if(pv(t.charCodeAt(0)))return!0;return!1}function JE(e,t){for(let i of e)if(!HE(i.charCodeAt(0),t))return!1;return!0}var QE=class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Ca.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let i=e.pluginURL,r=new Promise(a=>{this.loadScriptResolve=a});t(i);let n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(await Promise.race([r,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:i};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error("RTL Text Plugin failed to import scripts from ".concat(i))}},Ca=new QE,bt=class{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new ep,this.transition=t.transition||{},this.globalState=t.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ep,this.transition={},this.globalState={})}isSupportedScript(e){return JE(e,Ca.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}},Tu=class{constructor(e,t){this.property=e,this.value=t,this.expression=gE(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}},tp=class{constructor(e){this.property=e,this.value=new Tu(e,void 0)}transitioned(e,t){return new tg(this.property,this.value,t,re({},e.transition,this.transition),e.now)}untransitioned(){return new tg(this.property,this.value,null,{},0)}},Mu=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Qt(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new tp(this._values[e].property)),this._values[e].value=new Tu(this._values[e].property,t===null?void 0:Qt(t))}getTransition(e){return Qt(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new tp(this._values[e].property)),this._values[e].transition=Qt(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i);let r=this.getTransition(t);r!==void 0&&(e["".concat(t,"-transition")]=r)}return e}transitioned(e,t){let i=new ig(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){let e=new ig(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},tg=class{constructor(e,t,i,r,n){this.property=e,this.value=t,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){let r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),a=this.prior;if(a){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return a.possiblyEvaluate(e,t,i);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),n,N0(o))}}else return n}},ig=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let r=new Cu(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},ek=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return Qt(this._values[e].value)}setValue(e,t){this._values[e]=new Tu(this._values[e].property,t===null?void 0:Qt(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){let r=new Cu(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}},Oi=class{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}},Cu=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},ee=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){let r=this.specification.type,n=ht[r];return n?n(e,t,i):e}},ue=class{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Oi(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)},t):new Oi(this,e.expression,t)}interpolate(e,t,i){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new Oi(this,{kind:"constant",value:void 0},e.parameters);let r=this.specification.type,n=ht[r];if(n){let a=n(e.value.value,t.value.value,i);return new Oi(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,t,i,r,n,a){return e.kind==="constant"?e.value:e.evaluate(t,i,r,n,a)}},Iu=class extends ue{possiblyEvaluate(e,t,i,r){if(e.value===void 0)return new Oi(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let n=e.expression.evaluate(t,null,{},i,r),a=e.property.specification.type==="resolvedImage"&&typeof n!="string"?n.name:n,o=this._calculate(a,a,a,t);return new Oi(this,{kind:"constant",value:o},t)}else if(e.expression.kind==="camera"){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Oi(this,{kind:"constant",value:n},t)}else return new Oi(this,e.expression,t)}evaluate(e,t,i,r,n,a){if(e.kind==="source"){let o=e.evaluate(t,i,r,n,a);return this._calculate(o,o,o,t)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,r),e.evaluate({zoom:Math.floor(t.zoom)},i,r),e.evaluate({zoom:Math.floor(t.zoom)+1},i,r),t):e.value}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},cd=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(e.value!==void 0)if(e.expression.kind==="constant"){let n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}else return this._calculate(e.expression.evaluate(new bt(Math.floor(t.zoom-1),t)),e.expression.evaluate(new bt(Math.floor(t.zoom),t)),e.expression.evaluate(new bt(Math.floor(t.zoom+1),t)),t)}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},Au=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}},Bt=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let i=e[t];i.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new Tu(i,void 0),n=this.defaultTransitionablePropertyValues[t]=new tp(i);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}};te("DataDrivenProperty",ue);te("DataConstantProperty",ee);te("CrossFadedDataDrivenProperty",Iu);te("CrossFadedProperty",cd);te("ColorRampProperty",Au);var rl="-transition",Xi=class extends ei{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=$o(e.filter)),t.layout&&(this._unevaluatedLayout=new ek(t.layout)),t.paint)){this._transitionablePaint=new Mu(t.paint);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Cu(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=$o(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[t];for(let r of i.getGlobalStateRefs())e.add(r)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}setLayoutProperty(e,t,i={}){if(t!=null){let r="layers.".concat(this.id,".layout.").concat(e);if(this._validate(jE,r,e,t,i))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(rl)?this._transitionablePaint.getTransition(e.slice(0,-rl.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(t!=null){let r="layers.".concat(this.id,".paint.").concat(e);if(this._validate(VE,r,e,t,i))return!1}if(e.endsWith(rl))return this._transitionablePaint.setTransition(e.slice(0,-rl.length),t||void 0),!1;{let r=this._transitionablePaint._values[e],n=r.property.specification["property-type"]==="cross-faded-data-driven",a=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||a||n||this._handleOverridablePaintPropertyUpdate(e,o,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),j0(e,(t,i)=>t!==void 0&&!(i==="layout"&&!Object.keys(t).length)&&!(i==="paint"&&!Object.keys(t).length))}_validate(e,t,i,r,n={}){return n&&n.validate===!1?!1:Su(this,e.call(St,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:V,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(!(!(t instanceof Oi)||!Ta(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}},tk={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},us=class{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},ik=128,rk=5,mt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*rk),ik),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function yt(e,t=1){let i=0,r=0,n=e.map(o=>{let s=nk(o.type),l=i=rg(i,Math.max(t,s)),u=o.components||1;return r=Math.max(r,s),i+=s*u,{name:o.name,type:o.type,components:u,offset:l}}),a=rg(i,Math.max(r,t));return{members:n,size:a,alignment:t}}function nk(e){return tk[e].BYTES_PER_ELEMENT}function rg(e,t){return Math.ceil(e/t)*t}var ak=fe(ge(),1),hs=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.int16[r+0]=t,this.int16[r+1]=i,e}};hs.prototype.bytesPerElement=4;te("StructArrayLayout2i4",hs);var Eu=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}};Eu.prototype.bytesPerElement=6;te("StructArrayLayout3i6",Eu);var pd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,e}};pd.prototype.bytesPerElement=8;te("StructArrayLayout4i8",pd);var dd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*6;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}};dd.prototype.bytesPerElement=12;te("StructArrayLayout2i4i12",dd);var fd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*4,l=e*8;return this.int16[s+0]=t,this.int16[s+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=o,e}};fd.prototype.bytesPerElement=8;te("StructArrayLayout2i4ub8",fd);var Yo=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.float32[r+0]=t,this.float32[r+1]=i,e}};Yo.prototype.bytesPerElement=8;te("StructArrayLayout2f8",Yo);var md=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,r,n,a,o,s,l,u)}emplace(e,t,i,r,n,a,o,s,l,u,h){let c=e*10;return this.uint16[c+0]=t,this.uint16[c+1]=i,this.uint16[c+2]=r,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=o,this.uint16[c+6]=s,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,e}};md.prototype.bytesPerElement=20;te("StructArrayLayout10ui20",md);var yd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,a,o,s,l,u,h,c)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=e*12;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,e}};yd.prototype.bytesPerElement=24;te("StructArrayLayout4i4ui4i24",yd);var gd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}};gd.prototype.bytesPerElement=12;te("StructArrayLayout3f12",gd);var _d=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.uint32[i+0]=t,e}};_d.prototype.bytesPerElement=4;te("StructArrayLayout1ul4",_d);var xd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,a,o,s,l)}emplace(e,t,i,r,n,a,o,s,l,u){let h=e*10,c=e*5;return this.int16[h+0]=t,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=o,this.uint32[c+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=u,e}};xd.prototype.bytesPerElement=20;te("StructArrayLayout6i1ul2ui20",xd);var vd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*6;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}};vd.prototype.bytesPerElement=12;te("StructArrayLayout2i2i2i12",vd);var bd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}emplace(e,t,i,r,n,a){let o=e*4,s=e*8;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[s+6]=n,this.int16[s+7]=a,e}};bd.prototype.bytesPerElement=16;te("StructArrayLayout2f1f2i16",bd);var wd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,o){let s=e*16,l=e*4,u=e*8;return this.uint8[s+0]=t,this.uint8[s+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=o,e}};wd.prototype.bytesPerElement=16;te("StructArrayLayout2ub2f2i16",wd);var ku=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*3;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}};ku.prototype.bytesPerElement=6;te("StructArrayLayout3ui6",ku);var Pd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_){let b=e*24,v=e*12,w=e*48;return this.int16[b+0]=t,this.int16[b+1]=i,this.uint16[b+2]=r,this.uint16[b+3]=n,this.uint32[v+2]=a,this.uint32[v+3]=o,this.uint32[v+4]=s,this.uint16[b+10]=l,this.uint16[b+11]=u,this.uint16[b+12]=h,this.float32[v+7]=c,this.float32[v+8]=p,this.uint8[w+36]=d,this.uint8[w+37]=f,this.uint8[w+38]=y,this.uint32[v+10]=g,this.int16[b+22]=_,e}};Pd.prototype.bytesPerElement=48;te("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Pd);var Sd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,P,S,C,E,F,B,R){let D=this.length;return this.resize(D+1),this.emplace(D,e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,P,S,C,E,F,B,R)}emplace(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v,w,P,S,C,E,F,B,R,D){let z=e*32,x=e*16;return this.int16[z+0]=t,this.int16[z+1]=i,this.int16[z+2]=r,this.int16[z+3]=n,this.int16[z+4]=a,this.int16[z+5]=o,this.int16[z+6]=s,this.int16[z+7]=l,this.uint16[z+8]=u,this.uint16[z+9]=h,this.uint16[z+10]=c,this.uint16[z+11]=p,this.uint16[z+12]=d,this.uint16[z+13]=f,this.uint16[z+14]=y,this.uint16[z+15]=g,this.uint16[z+16]=_,this.uint16[z+17]=b,this.uint16[z+18]=v,this.uint16[z+19]=w,this.uint16[z+20]=P,this.uint16[z+21]=S,this.uint16[z+22]=C,this.uint32[x+12]=E,this.float32[x+13]=F,this.float32[x+14]=B,this.uint16[z+30]=R,this.uint16[z+31]=D,e}};Sd.prototype.bytesPerElement=64;te("StructArrayLayout8i15ui1ul2f2ui64",Sd);var Du=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.float32[i+0]=t,e}};Du.prototype.bytesPerElement=4;te("StructArrayLayout1f4",Du);var Td=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*6,a=e*3;return this.uint16[n+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,e}};Td.prototype.bytesPerElement=12;te("StructArrayLayout1ui2f12",Td);var Md=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let n=e*2,a=e*4;return this.uint32[n+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=r,e}};Md.prototype.bytesPerElement=8;te("StructArrayLayout1ul2ui8",Md);var Cd=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let r=e*2;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}};Cd.prototype.bytesPerElement=4;te("StructArrayLayout2ui4",Cd);var Id=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let i=e*1;return this.uint16[i+0]=t,e}};Id.prototype.bytesPerElement=2;te("StructArrayLayout1ui2",Id);var Ad=class extends mt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,e}};Ad.prototype.bytesPerElement=16;te("StructArrayLayout4f16",Ad);var dv=class extends us{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new ak.default(this.anchorPointX,this.anchorPointY)}};dv.prototype.size=20;var fv=class extends xd{get(e){return new dv(this,e)}};te("CollisionBoxArray",fv);var mv=class extends us{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};mv.prototype.size=48;var yv=class extends Pd{get(e){return new mv(this,e)}};te("PlacedSymbolArray",yv);var gv=class extends us{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};gv.prototype.size=64;var _v=class extends Sd{get(e){return new gv(this,e)}};te("SymbolInstanceArray",_v);var xv=class extends Du{getoffsetX(e){return this.float32[e*1+0]}};te("GlyphOffsetArray",xv);var vv=class extends Eu{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};te("SymbolLineVertexArray",vv);var bv=class extends us{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};bv.prototype.size=12;var wv=class extends Td{get(e){return new bv(this,e)}};te("TextAnchorOffsetArray",wv);var Pv=class extends us{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Pv.prototype.size=8;var Sv=class extends Md{get(e){return new Pv(this,e)}};te("FeatureIndexArray",Sv);var zr=class extends hs{},ok=class extends Eu{},sk=class extends pd{},lk=class extends hs{},uk=class extends hs{},hk=class extends dd{},ck=class extends fd{},pk=class extends Yo{},ia=class extends md{},dk=class extends yd{},fk=class extends gd{},mk=class extends _d{},ng=class extends vd{},yk=class extends bd{},gk=class extends wd{},_k=class extends ku{},qi=class extends ku{},ip=class extends Cd{},xk=class extends Id{},vk=yt([{name:"a_pos",components:2,type:"Int16"}],4),{members:bk,size:Oj,alignment:Nj}=vk,Qe=class ha{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,r,n){let a=this.segments[this.segments.length-1];return t>ha.MAX_VERTEX_ARRAY_LENGTH&&Tt("Max vertices per segment is ".concat(ha.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t,". Consider using the `fillLargeMeshArrays` function if you require meshes with more than ").concat(ha.MAX_VERTEX_ARRAY_LENGTH," vertices.")),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+t>ha.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(i,r,n):a}createNewSegment(t,i,r){let n={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return r!==void 0&&(n.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(t,i,r){return this.prepareSegment(0,t,i,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,r,n){return new ha([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}};Qe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;te("SegmentVector",Qe);function ag(e,t){return e=Ne(Math.floor(e),0,255),t=Ne(Math.floor(t),0,255),256*e+t}var Hl=yt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),wk=fe(k_(),1),Tv=class Mv{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,r,n){this.ids.push(og(t)),this.positions.push(i,r,n)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let i=og(t),r=0,n=this.ids.length-1;for(;r<n;){let o=r+n>>1;this.ids[o]>=i?n=o:r=o+1}let a=[];for(;this.ids[r]===i;){let o=this.positions[3*r],s=this.positions[3*r+1],l=this.positions[3*r+2];a.push({index:o,start:s,end:l}),r++}return a}static serialize(t,i){let r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return rp(r,n,0,r.length-1),i&&i.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){let i=new Mv;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}};function og(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,wk.default)(String(e))}function rp(e,t,i,r){for(;i<r;){let n=e[i+r>>1],a=i-1,o=r+1;for(;;){do a++;while(e[a]<n);do o--;while(e[o]>n);if(a>=o)break;nl(e,a,o),nl(t,3*a,3*o),nl(t,3*a+1,3*o+1),nl(t,3*a+2,3*o+2)}o-i<r-o?(rp(e,t,i,o),i=o+1):(rp(e,t,o+1,r),r=o)}}function nl(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}te("FeaturePositionMap",Tv);var Vr=class{constructor(e,t){this.gl=e.gl,this.location=t}},me=class extends Vr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},K=class extends Vr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},ce=class extends Vr{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},hi=class extends Vr{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},hn=class extends Vr{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},cn=class extends Vr{constructor(e,t){super(e,t),this.current=oe.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}},sg=class extends Vr{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e.length*4);for(let i=0;i<e.length;i++)t[4*i]=e[i].r,t[4*i+1]=e[i].g,t[4*i+2]=e[i].b,t[4*i+3]=e[i].a;this.gl.uniform4fv(this.location,t)}}},lg=class extends Vr{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},Pk=new Float32Array(16),pi=class extends Vr{constructor(e,t){super(e,t),this.current=Pk}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);return}for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function np(e){return[ag(255*e.r,255*e.g),ag(255*e.b,255*e.a)]}var Co=class{constructor(e,t,i){this.value=e,this.uniformNames=t.map(r=>"u_".concat(r)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return this.type==="color"?new cn(e,t):new K(e,t)}},ca=class{constructor(e,t){this.uniformNames=t.map(i=>"u_".concat(i)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,i,r){let n=r==="u_pattern_to"?this.patternTo:r==="u_pattern_from"?this.patternFrom:r==="u_pixel_ratio_to"?this.pixelRatioTo:r==="u_pixel_ratio_from"?this.pixelRatioFrom:null;n&&e.set(n)}getBinding(e,t,i){return i.substr(0,9)==="u_pattern"?new hn(e,t):new K(e,t)}},Er=class{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(n=>({name:"a_".concat(n),type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n){let a=this.paintVertexArray.length,o=this.expression.evaluate(new bt(0),t,{},r,[],n);this.paintVertexArray.resize(e),this._setPaintValue(a,e,o)}updatePaintArray(e,t,i,r){let n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(e,t,n)}_setPaintValue(e,t,i){if(this.type==="color"){let r=np(i);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},Fi=class{constructor(e,t,i,r,n,a){this.expression=e,this.uniformNames=t.map(o=>"u_".concat(o,"_t")),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:"a_".concat(o),type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,i,r,n){let a=this.expression.evaluate(new bt(this.zoom),t,{},r,[],n),o=this.expression.evaluate(new bt(this.zoom+1),t,{},r,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,a,o)}updatePaintArray(e,t,i,r){let n=this.expression.evaluate({zoom:this.zoom},i,r),a=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(e,t,n,a)}_setPaintValue(e,t,i,r){if(this.type==="color"){let n=np(i),a=np(r);for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,n[0],n[1],a[0],a[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=Ne(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new K(e,t)}},Jr=class{constructor(e,t,i,r,n,a){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,i){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,n){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],n)}_setPaintValues(e,t,i,r){if(!r||!i)return;let{min:n,mid:a,max:o}=i,s=r[n],l=r[a],u=r[o];if(!(!s||!l||!u))for(let h=e;h<t;h++)this.zoomInPaintVertexArray.emplace(h,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(h,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Hl.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Hl.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Cv=class{constructor(e,t,i){this.binders={},this._buffers=[];let r=[];for(let n in e.paint._values){if(!i(n))continue;let a=e.paint.get(n);if(!(a instanceof Oi)||!Ta(a.property.specification))continue;let o=Sk(n,e.type),s=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,h=a.property.specification["property-type"],c=h==="cross-faded"||h==="cross-faded-data-driven";if(s.kind==="constant")this.binders[n]=c?new ca(s.value,o):new Co(s.value,o,l),r.push("/u_".concat(n));else if(s.kind==="source"||c){let p=ug(n,l,"source");this.binders[n]=c?new Jr(s,l,u,t,p,e.id):new Er(s,o,l,p),r.push("/a_".concat(n))}else{let p=ug(n,l,"composite");this.binders[n]=new Fi(s,o,l,u,t,p),r.push("/z_".concat(n))}}this.cacheKey=r.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Er||t instanceof Fi?t.maxValue:0}populatePaintArrays(e,t,i,r,n){for(let a in this.binders){let o=this.binders[a];(o instanceof Er||o instanceof Fi||o instanceof Jr)&&o.populatePaintArray(e,t,i,r,n)}}setConstantPatternPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof ca&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,r,n){let a=!1;for(let o in e){let s=t.getPositions(o);for(let l of s){let u=i.feature(l.index);for(let h in this.binders){let c=this.binders[h];if((c instanceof Er||c instanceof Fi||c instanceof Jr)&&c.expression.isStateDependent===!0){let p=r.paint.get(h);c.expression=p.value,c.updatePaintArray(l.start,l.end,u,e[o],n),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof Co||i instanceof ca)&&e.push(...i.uniformNames.map(r=>"#define HAS_UNIFORM_".concat(r)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Er||i instanceof Fi)for(let r=0;r<i.paintVertexAttributes.length;r++)e.push(i.paintVertexAttributes[r].name);else if(i instanceof Jr)for(let r=0;r<Hl.members.length;r++)e.push(Hl.members[r].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Co||i instanceof ca||i instanceof Fi)for(let r of i.uniformNames)e.push(r)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Co||n instanceof ca||n instanceof Fi){for(let a of n.uniformNames)if(t[a]){let o=n.getBinding(e,t[a],a);i.push({name:a,property:r,binding:o})}}}return i}setUniforms(e,t,i,r){for(let{name:n,property:a,binding:o}of t)this.binders[a].setUniform(o,r,i.get(a),n)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let i=this.binders[t];if(e&&i instanceof Jr){let r=e.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof Er||i instanceof Fi)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof Er||i instanceof Fi||i instanceof Jr)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Er||t instanceof Fi||t instanceof Jr)&&t.destroy()}}},Rn=class{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Cv(r,t,i);this.needsUpload=!1,this._featureMap=new Tv,this._bufferOffset=0}populatePaintArrays(e,t,i,r,n,a){for(let o in this.programConfigurations)this.programConfigurations[o].populatePaintArrays(e,t,r,n,a);t.id!==void 0&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(let n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function Sk(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}function Tk(e){return{"line-pattern":{source:ia,composite:ia},"fill-pattern":{source:ia,composite:ia},"fill-extrusion-pattern":{source:ia,composite:ia}}[e]}function ug(e,t,i){let r={color:{source:Yo,composite:Ad},number:{source:Du,composite:Yo}},n=Tk(e);return n&&n[i]||r[t][i]}te("ConstantBinder",Co);te("CrossFadedConstantBinder",ca);te("SourceExpressionBinder",Er);te("CrossFadedCompositeBinder",Jr);te("CompositeExpressionBinder",Fi);te("ProgramConfiguration",Cv,{omit:["_buffers"]});te("ProgramConfigurationSet",Rn);var Mk=15,ap=Math.pow(2,Mk-1)-1,hg=-ap-1;function Un(e){let t=8192/e.extent,i=e.loadGeometry();for(let r=0;r<i.length;r++){let n=i[r];for(let a=0;a<n.length;a++){let o=n[a],s=Math.round(o.x*t),l=Math.round(o.y*t);o.x=Ne(s,hg,ap),o.y=Ne(l,hg,ap),(s<o.x||s>o.x+1||l<o.y||l>o.y+1)&&Tt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Gn(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Un(e):[]}}var cg=-32768;function Ck(e,t,i,r,n){e.emplaceBack(cg+t*8+r,cg+i*8+n)}var Ed=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new lk,this.indexArray=new qi,this.segments=new Qe,this.programConfigurations=new Rn(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){let r=this.layers[0],n=[],a=null,o=!1,s=r.type==="heatmap";if(r.type==="circle"){let u=r;a=u.layout.get("circle-sort-key"),o=!a.isConstant(),s=s||u.paint.get("circle-pitch-alignment")==="map"}let l=s?t.subdivisionGranularity.circle:1;for(let{feature:u,id:h,index:c,sourceLayerIndex:p}of e){let d=this.layers[0]._featureFilter.needGeometry,f=Gn(u,d);if(!this.layers[0]._featureFilter.filter(new bt(this.zoom,{globalState:this.globalState}),f,i))continue;let y=o?a.evaluate(f,{},i):void 0,g={id:h,properties:u.properties,type:u.type,sourceLayerIndex:p,index:c,geometry:d?f.geometry:Un(u),patterns:{},sortKey:y};n.push(g)}o&&n.sort((u,h)=>u.sortKey-h.sortKey);for(let u of n){let{geometry:h,index:c,sourceLayerIndex:p}=u,d=e[c].feature;this.addFeature(u,h,c,i,l),t.featureIndex.insert(d,h,c,p,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bk),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error("Invalid circle bucket granularity: ".concat(n,"; valid values are 1, 3, 5, 7."))}let o=a.length;for(let s of t)for(let l of s){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,e.sortKey),p=c.vertexLength;for(let d=0;d<o;d++)for(let f=0;f<o;f++)Ck(this.layoutVertexArray,u,h,a[f],a[d]);for(let d=0;d<o-1;d++)for(let f=0;f<o-1;f++){let y=p+d*o+f,g=p+(d+1)*o+f;this.indexArray.emplaceBack(y,g+1,y+1),this.indexArray.emplaceBack(y,g,g+1)}c.vertexLength+=o*o,c.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r)}};te("CircleBucket",Ed,{omit:["layers"]});var al=fe(ge(),1);function Iv(e,t){for(let i=0;i<e.length;i++)if(Ia(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(Ia(e,t[i]))return!0;return!!kd(e,t)}function Ik(e,t,i){return!!(Ia(e,t)||op(t,e,i))}function Av(e,t){if(e.length===1)return pg(t,e[0]);for(let i=0;i<t.length;i++){let r=t[i];for(let n=0;n<r.length;n++)if(Ia(e,r[n]))return!0}for(let i=0;i<e.length;i++)if(pg(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(kd(e,t[i]))return!0;return!1}function Ak(e,t,i){for(let r=0;r<t.length;r++){let n=t[r];if(e.length>=3){for(let a=0;a<n.length;a++)if(Ia(e,n[a]))return!0}if(Ek(e,n,i))return!0}return!1}function Ek(e,t,i){if(e.length>1){if(kd(e,t))return!0;for(let r=0;r<t.length;r++)if(op(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(op(e[r],t,i))return!0;return!1}function kd(e,t){if(e.length===0||t.length===0)return!1;for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1];for(let a=0;a<t.length-1;a++){let o=t[a],s=t[a+1];if(kk(r,n,o,s))return!0}}return!1}function kk(e,t,i,r){return an(e,i,r)!==an(t,i,r)&&an(e,t,i)!==an(e,t,r)}function op(e,t,i){let r=i*i;if(t.length===1)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++){let a=t[n-1],o=t[n];if(Dk(e,a,o)<r)return!0}return!1}function Dk(e,t,i){let r=t.distSqr(i);if(r===0)return e.distSqr(t);let n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return n<0?e.distSqr(t):n>1?e.distSqr(i):e.distSqr(i.sub(t)._mult(n)._add(t))}function pg(e,t){let i=!1,r,n,a;for(let o=0;o<e.length;o++){r=e[o];for(let s=0,l=r.length-1;s<r.length;l=s++)n=r[s],a=r[l],n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(i=!i)}return i}function Ia(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){let a=e[r],o=e[n];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(i=!i)}return i}function Lk(e,t,i,r,n){for(let o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;let a=[new al.default(t,i),new al.default(t,n),new al.default(r,n),new al.default(r,i)];if(e.length>2){for(let o of a)if(Ia(e,o))return!0}for(let o=0;o<e.length-1;o++){let s=e[o],l=e[o+1];if(zk(s,l,a))return!0}return!1}function zk(e,t,i){let r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;let a=an(e,t,i[0]);return a!==an(e,t,i[1])||a!==an(e,t,i[2])||a!==an(e,t,i[3])}var sp=fe(ge(),1);function Ro(e,t,i){let r=t.paint.get(e).value;return r.kind==="constant"?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Lu(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function zu(e,t,i,r,n){if(!t[0]&&!t[1])return e;let a=sp.default.convert(t)._mult(n);i==="viewport"&&a._rotate(-r);let o=[];for(let s=0;s<e.length;s++){let l=e[s];o.push(l.sub(a))}return o}function Rk(e,t){let i=[];for(let r=0;r<e.length;r++){let n=e[r],a=[];for(let o=0;o<n.length;o++){let s=n[o-1],l=n[o],u=n[o+1],h=o===0?new sp.default(0,0):l.sub(s)._unit()._perp(),c=o===n.length-1?new sp.default(0,0):u.sub(l)._unit()._perp(),p=h._add(c)._unit(),d=p.x*c.x+p.y*c.y;d!==0&&p._mult(1/d),a.push(p._mult(t)._add(l))}i.push(a)}return i}var dg,Fk=()=>dg=dg||new Bt({"circle-sort-key":new ue(V.layout_circle["circle-sort-key"])}),fg,Bk=()=>fg=fg||new Bt({"circle-radius":new ue(V.paint_circle["circle-radius"]),"circle-color":new ue(V.paint_circle["circle-color"]),"circle-blur":new ue(V.paint_circle["circle-blur"]),"circle-opacity":new ue(V.paint_circle["circle-opacity"]),"circle-translate":new ee(V.paint_circle["circle-translate"]),"circle-translate-anchor":new ee(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ee(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ee(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ue(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ue(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ue(V.paint_circle["circle-stroke-opacity"])}),Ok={get paint(){return Bk()},get layout(){return Fk()}},Nk=fe(ge(),1),Vk=e=>e.type==="circle",jk=class extends Xi{constructor(e){super(e,Ok)}createBucket(e){return new Ed(e)}queryRadius(e){let t=e;return Ro("circle-radius",this,t)+Ro("circle-stroke-width",this,t)+Lu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){let l=zu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),u=this.paint.get("circle-radius").evaluate(t,i),h=this.paint.get("circle-stroke-width").evaluate(t,i),c=u+h,p=this.paint.get("circle-pitch-alignment")==="map",d=p?l:Uk(l,n,o,s),f=p?c*a:c;for(let y of r)for(let g of y){let _=p?g:Ev(g,n,o,s),b=f,v=n.projectTileCoordinates(g.x,g.y,o,s).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=v/n.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=n.cameraToCenterDistance/v),Ik(d,_,b))return!0}return!1}};function Ev(e,t,i,r){let n=t.projectTileCoordinates(e.x,e.y,i,r).point;return new Nk.default((n.x*.5+.5)*t.width,(-n.y*.5+.5)*t.height)}function Uk(e,t,i,r){return e.map(n=>Ev(n,t,i,r))}var kv=class extends Ed{};te("HeatmapBucket",kv,{omit:["layers"]});var mg,Gk=()=>mg=mg||new Bt({"heatmap-radius":new ue(V.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ue(V.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ee(V.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Au(V.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ee(V.paint_heatmap["heatmap-opacity"])}),Xk={get paint(){return Gk()}};function Dd(e,{width:t,height:i},r,n){if(!n)n=new Uint8Array(t*i*r);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError("mismatched image size. expected: ".concat(n.length," but got: ").concat(t*i*r));return e.width=t,e.height=i,e.data=n,e}function Dv(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let n=Dd({},{width:t,height:i},r);Ld(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=n.data}function Ld(e,t,i,r,n,a){if(n.width===0||n.height===0)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");let o=e.data,s=t.data;if(o===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let u=((i.y+l)*e.width+i.x)*a,h=((r.y+l)*t.width+r.x)*a;for(let c=0;c<n.width*a;c++)s[h+c]=o[u+c]}return t}var zd=class Lv{constructor(t,i){Dd(this,t,1,i)}resize(t){Dv(this,t,1)}clone(){return new Lv({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,a){Ld(t,i,r,n,a,1)}},tt=class zv{constructor(t,i){Dd(this,t,4,i)}resize(t){Dv(this,t,4)}replace(t,i){i?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new zv({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,n,a){Ld(t,i,r,n,a,4)}setPixel(t,i,r){let n=(t*this.width+i)*4;this.data[n+0]=Math.round(r.r*255/r.a),this.data[n+1]=Math.round(r.g*255/r.a),this.data[n+2]=Math.round(r.b*255/r.a),this.data[n+3]=Math.round(r.a*255)}};te("AlphaImage",zd);te("RGBAImage",tt);function Rv(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new tt({width:i,height:r});if(!TC(i))throw new Error("width is not a power of 2 - ".concat(i));let a=(o,s,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);n.setPixel(o/4/i,s/4,u)};if(e.clips)for(let o=0,s=0;o<r;++o,s+=i*4)for(let l=0,u=0;l<i;l++,u+=4){let h=l/(i-1),{start:c,end:p}=e.clips[o],d=c*(1-h)+p*h;a(s,u,d)}else for(let o=0,s=0;o<i;o++,s+=4){let l=o/(i-1);a(0,s,l)}return n}var Wo="big-fb",qk=e=>e.type==="heatmap",$k=class extends Xi{createBucket(e){return new kv(e)}constructor(e){super(e,Xk),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Rv({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Wo)&&this.heatmapFbos.delete(Wo)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},yg,Zk=()=>yg=yg||new Bt({"hillshade-illumination-direction":new ee(V.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new ee(V.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new ee(V.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ee(V.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ee(V.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ee(V.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ee(V.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new ee(V.paint_hillshade["hillshade-method"])}),Yk={get paint(){return Zk()}},Wk=e=>e.type==="hillshade",Hk=class extends Xi{constructor(e){super(e,Yk),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values,n=Math.max(e.length,t.length,i.length,r.length);e=e.concat(Array(n-e.length).fill(e.at(-1))),t=t.concat(Array(n-t.length).fill(t.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1)));let a=t.map(Je);return{directionRadians:e.map(Je),altitudeRadians:a,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},gg,Kk=()=>gg=gg||new Bt({"color-relief-opacity":new ee(V["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Au(V["paint_color-relief"]["color-relief-color"])}),Jk={get paint(){return Kk()}},vt=class{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,t,i){let{width:r,height:n}=e,a=(!this.size||this.size[0]!==r||this.size[1]!==n)&&!i,{context:o}=this,{gl:s}=o;if(this.useMipmap=!!(t&&t.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!t||t.premultiply!==!1)),a)this.size=[r,n],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Fr(e)?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,e):s.texImage2D(s.TEXTURE_2D,0,this.format,r,n,0,this.format,s.UNSIGNED_BYTE,e.data);else{let{x:l,y:u}=i||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Fr(e)?s.texSubImage2D(s.TEXTURE_2D,0,l,u,s.RGBA,s.UNSIGNED_BYTE,e):s.texSubImage2D(s.TEXTURE_2D,0,l,u,r,n,s.RGBA,s.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,i){let{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i===n.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(i=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},Qk=class{constructor(e,t,i,r=1,n=1,a=1,o=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){Tt('"'.concat(i,'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".'));return}this.stride=t.height;let s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let l=0;l<s;l++)this.data[this._idx(-1,l)]=this.data[this._idx(0,l)],this.data[this._idx(s,l)]=this.data[this._idx(s-1,l)],this.data[this._idx(l,-1)]=this.data[this._idx(l,0)],this.data[this._idx(l,s)]=this.data[this._idx(l,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let l=0;l<s;l++)for(let u=0;u<s;u++){let h=this.get(l,u);h>this.max&&(this.max=h),h<this.min&&(this.min=h)}}get(e,t){let i=new Uint8Array(this.data.buffer),r=this._idx(e,t)*4;return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return Fv(e,this.getUnpackVector())}getPixels(){return new tt({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,a=i*this.dim,o=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1;break}switch(i){case-1:a=o-1;break;case 1:o=a+1;break}let s=-t*this.dim,l=-i*this.dim;for(let u=a;u<o;u++)for(let h=r;h<n;h++)this.data[this._idx(h,u)]=e.data[this._idx(h+s,u+l)]}};function Fv(e,t){let i=t[0],r=t[1],n=t[2],a=t[3],o=Math.min(i,r,n),s=Math.round((e+a)/o);return{r:Math.floor(s*o/i)%256,g:Math.floor(s*o/r)%256,b:Math.floor(s*o/n)%256}}te("DEMData",Qk);var e3=e=>e.type==="color-relief",t3=class extends Xi{constructor(e){super(e,Jk)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof qo&&i._styleExpression.expression instanceof Vi){this.colorRampExpression=i;let a=i._styleExpression.expression;t.elevationStops=a.labels,t.colorStops=[];for(let o of t.elevationStops)t.colorStops.push(a.evaluate({globals:{elevation:o}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[oe.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let r={elevationStops:[],colorStops:[]},n=(t.elevationStops.length-1)/(e-1);for(let a=0;a<t.elevationStops.length-.5;a+=n)r.elevationStops.push(t.elevationStops[Math.round(a)]),r.colorStops.push(t.colorStops[Math.round(a)]);return Tt("Too many colors in specification of ".concat(this.id," color-relief layer, may not render properly.")),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(t),n=new tt({width:r.colorStops.length,height:1}),a=new tt({width:r.colorStops.length,height:1});for(let o=0;o<r.elevationStops.length;o++){let s=Fv(r.elevationStops[o],i);a.setPixel(0,o,new oe(s.r/255,s.g/255,s.b/255,1)),n.setPixel(0,o,r.colorStops[o])}return this.colorRampTextures={elevationTexture:new vt(e,a,e.gl.RGBA),colorTexture:new vt(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}},i3=yt([{name:"a_pos",components:2,type:"Int16"}],4),{members:r3,size:Vj,alignment:jj}=i3;function Rd(e,t,i){let r=i.patternDependencies,n=!1;for(let a of t){let o=a.paint.get("".concat(e,"-pattern"));o.isConstant()||(n=!0);let s=o.constantOr(null);s&&(n=!0,r[s.to]=!0,r[s.from]=!0)}return n}function Fd(e,t,i,r,n){let a=n.patternDependencies;for(let o of t){let s=o.paint.get("".concat(e,"-pattern")).value;if(s.kind!=="constant"){let l=s.evaluate({zoom:r-1},i,{},n.availableImages),u=s.evaluate({zoom:r},i,{},n.availableImages),h=s.evaluate({zoom:r+1},i,{},n.availableImages);l=l&&l.name?l.name:l,u=u&&u.name?u.name:u,h=h&&h.name?h.name:h,a[l]=!0,a[u]=!0,a[h]=!0,i.patterns[o.id]={min:l,mid:u,max:h}}}return i}var ol=fe(ge(),1);function n3(e,t,i=2){let r=t&&t.length,n=r?t[0]*i:e.length,a=Bv(e,0,n,i,!0),o=[];if(!a||a.next===a.prev)return o;let s,l,u;if(r&&(a=u3(e,t,a,i)),e.length>80*i){s=e[0],l=e[1];let h=s,c=l;for(let p=i;p<n;p+=i){let d=e[p],f=e[p+1];d<s&&(s=d),f<l&&(l=f),d>h&&(h=d),f>c&&(c=f)}u=Math.max(h-s,c-l),u=u!==0?32767/u:0}return Ho(a,o,i,s,l,u,0),o}function Bv(e,t,i,r,n){let a;if(n===v3(e,t,i,r)>0)for(let o=t;o<i;o+=r)a=_g(o/r|0,e[o],e[o+1],a);else for(let o=i-r;o>=t;o-=r)a=_g(o/r|0,e[o],e[o+1],a);return a&&Aa(a,a.next)&&(Jo(a),a=a.next),a}function Fn(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(Aa(i,i.next)||ft(i.prev,i,i.next)===0)){if(Jo(i),i=t=i.prev,i===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function Ho(e,t,i,r,n,a,o){if(!e)return;!o&&a&&f3(e,r,n,a);let s=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?o3(e,r,n,a):a3(e)){t.push(l.i,e.i,u.i),Jo(e),e=u.next,s=u.next;continue}if(e=u,e===s){o?o===1?(e=s3(Fn(e),t),Ho(e,t,i,r,n,a,2)):o===2&&l3(e,t,i,r,n,a):Ho(Fn(e),t,i,r,n,a,1);break}}}function a3(e){let t=e.prev,i=e,r=e.next;if(ft(t,i,r)>=0)return!1;let n=t.x,a=i.x,o=r.x,s=t.y,l=i.y,u=r.y,h=Math.min(n,a,o),c=Math.min(s,l,u),p=Math.max(n,a,o),d=Math.max(s,l,u),f=r.next;for(;f!==t;){if(f.x>=h&&f.x<=p&&f.y>=c&&f.y<=d&&Io(n,s,a,l,o,u,f.x,f.y)&&ft(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function o3(e,t,i,r){let n=e.prev,a=e,o=e.next;if(ft(n,a,o)>=0)return!1;let s=n.x,l=a.x,u=o.x,h=n.y,c=a.y,p=o.y,d=Math.min(s,l,u),f=Math.min(h,c,p),y=Math.max(s,l,u),g=Math.max(h,c,p),_=lp(d,f,t,i,r),b=lp(y,g,t,i,r),v=e.prevZ,w=e.nextZ;for(;v&&v.z>=_&&w&&w.z<=b;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=g&&v!==n&&v!==o&&Io(s,h,l,c,u,p,v.x,v.y)&&ft(v.prev,v,v.next)>=0||(v=v.prevZ,w.x>=d&&w.x<=y&&w.y>=f&&w.y<=g&&w!==n&&w!==o&&Io(s,h,l,c,u,p,w.x,w.y)&&ft(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;v&&v.z>=_;){if(v.x>=d&&v.x<=y&&v.y>=f&&v.y<=g&&v!==n&&v!==o&&Io(s,h,l,c,u,p,v.x,v.y)&&ft(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=b;){if(w.x>=d&&w.x<=y&&w.y>=f&&w.y<=g&&w!==n&&w!==o&&Io(s,h,l,c,u,p,w.x,w.y)&&ft(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function s3(e,t){let i=e;do{let r=i.prev,n=i.next.next;!Aa(r,n)&&Nv(r,i,i.next,n)&&Ko(r,n)&&Ko(n,r)&&(t.push(r.i,i.i,n.i),Jo(i),Jo(i.next),i=e=n),i=i.next}while(i!==e);return Fn(i)}function l3(e,t,i,r,n,a){let o=e;do{let s=o.next.next;for(;s!==o.prev;){if(o.i!==s.i&&g3(o,s)){let l=Vv(o,s);o=Fn(o,o.next),l=Fn(l,l.next),Ho(o,t,i,r,n,a,0),Ho(l,t,i,r,n,a,0);return}s=s.next}o=o.next}while(o!==e)}function u3(e,t,i,r){let n=[];for(let a=0,o=t.length;a<o;a++){let s=t[a]*r,l=a<o-1?t[a+1]*r:e.length,u=Bv(e,s,l,r,!1);u===u.next&&(u.steiner=!0),n.push(y3(u))}n.sort(h3);for(let a=0;a<n.length;a++)i=c3(n[a],i);return i}function h3(e,t){let i=e.x-t.x;if(i===0&&(i=e.y-t.y,i===0)){let r=(e.next.y-e.y)/(e.next.x-e.x),n=(t.next.y-t.y)/(t.next.x-t.x);i=r-n}return i}function c3(e,t){let i=p3(e,t);if(!i)return t;let r=Vv(i,e);return Fn(r,r.next),Fn(i,i.next)}function p3(e,t){let i=t,r=e.x,n=e.y,a=-1/0,o;if(Aa(e,i))return i;do{if(Aa(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){let c=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(c<=r&&c>a&&(a=c,o=i.x<i.next.x?i:i.next,c===r))return o}i=i.next}while(i!==t);if(!o)return null;let s=o,l=o.x,u=o.y,h=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&Ov(n<u?r:a,n,l,u,n<u?a:r,n,i.x,i.y)){let c=Math.abs(n-i.y)/(r-i.x);Ko(i,e)&&(c<h||c===h&&(i.x>o.x||i.x===o.x&&d3(o,i)))&&(o=i,h=c)}i=i.next}while(i!==s);return o}function d3(e,t){return ft(e.prev,e,t.prev)<0&&ft(t.next,e,e.next)<0}function f3(e,t,i,r){let n=e;do n.z===0&&(n.z=lp(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,m3(n)}function m3(e){let t,i=1;do{let r=e,n;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let u=0;u<i&&(s++,o=o.nextZ,!!o);u++);let l=i;for(;s>0||l>0&&o;)s!==0&&(l===0||!o||r.z<=o.z)?(n=r,r=r.nextZ,s--):(n=o,o=o.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=o}a.nextZ=null,i*=2}while(t>1);return e}function lp(e,t,i,r,n){return e=(e-i)*n|0,t=(t-r)*n|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function y3(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}function Ov(e,t,i,r,n,a,o,s){return(n-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(i-o)*(t-s)&&(i-o)*(a-s)>=(n-o)*(r-s)}function Io(e,t,i,r,n,a,o,s){return!(e===o&&t===s)&&Ov(e,t,i,r,n,a,o,s)}function g3(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!_3(e,t)&&(Ko(e,t)&&Ko(t,e)&&x3(e,t)&&(ft(e.prev,e,t.prev)||ft(e,t.prev,t))||Aa(e,t)&&ft(e.prev,e,e.next)>0&&ft(t.prev,t,t.next)>0)}function ft(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Aa(e,t){return e.x===t.x&&e.y===t.y}function Nv(e,t,i,r){let n=ll(ft(e,t,i)),a=ll(ft(e,t,r)),o=ll(ft(i,r,e)),s=ll(ft(i,r,t));return!!(n!==a&&o!==s||n===0&&sl(e,i,t)||a===0&&sl(e,r,t)||o===0&&sl(i,e,r)||s===0&&sl(i,t,r))}function sl(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function ll(e){return e>0?1:e<0?-1:0}function _3(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&Nv(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}function Ko(e,t){return ft(e.prev,e,e.next)<0?ft(e,t,e.next)>=0&&ft(e,e.prev,t)>=0:ft(e,t,e.prev)<0||ft(e,e.next,t)<0}function x3(e,t){let i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}function Vv(e,t){let i=up(e.i,e.x,e.y),r=up(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function _g(e,t,i,r){let n=up(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Jo(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function up(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function v3(e,t,i,r){let n=0;for(let a=t,o=i-r;a<i;a+=r)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}var Rr=class{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){let t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}},hp=class{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}};hp.noSubdivision=new hp({fill:new Rr(0,0),line:new Rr(0,0),tile:new Rr(0,0),stencil:new Rr(0,0),circle:1});var Bd=hp;te("SubdivisionGranularityExpression",Rr);te("SubdivisionGranularitySetting",Bd);var rn=-32768,Cn=32767,b3=class{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=8192/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let i=Math.round(e)|0,r=Math.round(t)|0,n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(i,r),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return P3(this._vertexBuffer,e);let t=[],i=e.length;for(let r=0;r<i;r+=3){let n=[e[r+0],e[r+1],e[r+2]],a=[this._vertexBuffer[e[r+0]*2+0],this._vertexBuffer[e[r+0]*2+1],this._vertexBuffer[e[r+1]*2+0],this._vertexBuffer[e[r+1]*2+1],this._vertexBuffer[e[r+2]*2+0],this._vertexBuffer[e[r+2]*2+1]],o=1/0,s=1/0,l=-1/0,u=-1/0;for(let f=0;f<3;f++){let y=a[f*2],g=a[f*2+1];o=Math.min(o,y),l=Math.max(l,y),s=Math.min(s,g),u=Math.max(u,g)}if(o===l||s===u)continue;let h=Math.floor(o/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),p=Math.floor(s/this._granularityCellSize),d=Math.ceil(u/this._granularityCellSize);if(h===c&&p===d){t.push(...n);continue}for(let f=p;f<d;f++){let y=this._scanlineGenerateVertexRingForCellRow(f,a,n);S3(this._vertexBuffer,y,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){let r=e*this._granularityCellSize,n=r+this._granularityCellSize,a=[];for(let o=0;o<3;o++){let s=t[o*2],l=t[o*2+1],u=t[(o+1)*2%6],h=t[((o+1)*2+1)%6],c=t[(o+2)*2%6],p=t[((o+2)*2+1)%6],d=u-s,f=h-l,y=d===0,g=f===0,_=(r-l)/f,b=(n-l)/f,v=Math.min(_,b),w=Math.max(_,b);if(!g&&(v>=1||w<=0)||g&&(l<r||l>n)){h>=r&&h<=n&&a.push(i[(o+1)%3]);continue}if(!g&&v>0){let C=s+d*v,E=l+f*v;a.push(this._vertexToIndex(C,E))}let P=s+d*Math.max(v,0),S=s+d*Math.min(w,1);if(y||this._generateIntraEdgeVertices(a,s,l,u,h,P,S),!g&&w<1){let C=s+d*w,E=l+f*w;a.push(this._vertexToIndex(C,E))}(g||h>=r&&h<=n)&&a.push(i[(o+1)%3]),!g&&(h<=r||h>=n)&&this._generateInterEdgeVertices(a,s,l,u,h,c,p,S,r,n)}return a}_generateIntraEdgeVertices(e,t,i,r,n,a,o){let s=r-t,l=n-i,u=l===0,h=u?Math.min(t,r):Math.min(a,o),c=u?Math.max(t,r):Math.max(a,o),p=Math.floor(h/this._granularityCellSize)+1,d=Math.ceil(c/this._granularityCellSize)-1;if(u?t<r:a<o)for(let f=p;f<=d;f++){let y=f*this._granularityCellSize,g=i+l*(y-t)/s;e.push(this._vertexToIndex(y,g))}else for(let f=d;f>=p;f--){let y=f*this._granularityCellSize,g=i+l*(y-t)/s;e.push(this._vertexToIndex(y,g))}}_generateInterEdgeVertices(e,t,i,r,n,a,o,s,l,u){let h=n-i,c=a-r,p=o-n,d=(l-n)/p,f=(u-n)/p,y=Math.min(d,f),g=Math.max(d,f),_=r+c*y,b=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,w=s<_,P=p===0;if(P&&(o===l||o===u))return;if(P||y>=1||g<=0){let C=t-a,E=i-o,F=(l-o)/E,B=(u-o)/E,R=Math.min(F,B),D=a+C*R;b=Math.floor(Math.min(D,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(D,s)/this._granularityCellSize)-1,w=s<D}let S=h>0?u:l;if(w)for(let C=b;C<=v;C++){let E=C*this._granularityCellSize;e.push(this._vertexToIndex(E,S))}else for(let C=v;C>=b;C--){let E=C*this._granularityCellSize;e.push(this._vertexToIndex(E,S))}}_generateOutline(e){let t=[];for(let i of e){let r=Od(i,this._granularity,!0),n=this._pointArrayToIndices(r),a=[];for(let o=1;o<n.length;o++)a.push(n[o-1]),a.push(n[o]);t.push(a)}return t}_handlePoles(e){let t=!1,i=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(t||i)&&this._fillPoles(e,t,i)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let i=e[t+1];i===rn&&(e[t+1]=rn+1),i===Cn&&(e[t+1]=Cn-1)}}_generatePoleQuad(e,t,i,r,n,a){r>n!=(a===rn)?(e.push(t),e.push(i),e.push(this._vertexToIndex(r,a)),e.push(i),e.push(this._vertexToIndex(n,a)),e.push(this._vertexToIndex(r,a))):(e.push(i),e.push(t),e.push(this._vertexToIndex(r,a)),e.push(this._vertexToIndex(n,a)),e.push(i),e.push(this._vertexToIndex(r,a)))}_fillPoles(e,t,i){let r=this._vertexBuffer,n=0,a=8192,o=e.length;for(let s=2;s<o;s+=3){let l=e[s-2],u=e[s-1],h=e[s],c=r[l*2],p=r[l*2+1],d=r[u*2],f=r[u*2+1],y=r[h*2],g=r[h*2+1];t&&(p===n&&f===n&&this._generatePoleQuad(e,l,u,c,d,rn),f===n&&g===n&&this._generatePoleQuad(e,u,h,d,y,rn),g===n&&p===n&&this._generatePoleQuad(e,h,l,y,c,rn)),i&&(p===a&&f===a&&this._generatePoleQuad(e,l,u,c,d,Cn),f===a&&g===a&&this._generatePoleQuad(e,u,h,d,y,Cn),g===a&&p===a&&this._generatePoleQuad(e,h,l,y,c,Cn))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:i,holeIndices:r}=w3(e);this._initializeVertices(i);let n;try{let o=n3(i,r),s=this._convertIndices(i,o);n=this._subdivideTrianglesScanline(s)}catch(o){console.error(o)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_convertIndices(e,t){let i=[];for(let r=0;r<t.length;r++){let n=e[t[r]*2],a=e[t[r]*2+1];i.push(this._vertexToIndex(n,a))}return i}_pointArrayToIndices(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];t.push(this._vertexToIndex(r.x,r.y))}return t}};function jv(e,t,i,r=!0){return new b3(i,t).subdividePolygonInternal(e,r)}function Od(e,t,i=!1){if(!e||e.length<1)return[];if(e.length<2)return[];let r=e[0],n=e[e.length-1],a=i&&(r.x!==n.x||r.y!==n.y);if(t<2)return a?[...e,e[0]]:[...e];let o=Math.floor(8192/t),s=[];s.push(new ol.default(e[0].x,e[0].y));let l=e.length,u=a?l:l-1;for(let h=0;h<u;h++){let c=e[h],p=h<l-1?e[h+1]:e[0],d=c.x,f=c.y,y=p.x,g=p.y,_=d!==y,b=f!==g;if(!_&&!b)continue;let v=y-d,w=g-f,P=Math.abs(v),S=Math.abs(w),C=d,E=f;for(;;){let B=v>0?(Math.floor(C/o)+1)*o:(Math.ceil(C/o)-1)*o,R=w>0?(Math.floor(E/o)+1)*o:(Math.ceil(E/o)-1)*o,D=Math.abs(C-B),z=Math.abs(E-R),x=Math.abs(C-y),T=Math.abs(E-g),I=_?D/P:Number.POSITIVE_INFINITY,U=b?z/S:Number.POSITIVE_INFINITY;if((x<=D||!_)&&(T<=z||!b))break;if(I<U&&_||!b){C=B,E=E+w*I;let X=new ol.default(C,Math.round(E));(s[s.length-1].x!==X.x||s[s.length-1].y!==X.y)&&s.push(X)}else{C=C+v*U,E=R;let X=new ol.default(Math.round(C),E);(s[s.length-1].x!==X.x||s[s.length-1].y!==X.y)&&s.push(X)}}let F=new ol.default(y,g);(s[s.length-1].x!==F.x||s[s.length-1].y!==F.y)&&s.push(F)}return s}function w3(e){let t=[],i=[];for(let r of e)if(r.length!==0){r!==e[0]&&t.push(i.length/2);for(let n=0;n<r.length;n++)i.push(r[n].x),i.push(r[n].y)}return{flattened:i,holeIndices:t}}function P3(e,t){let i=[];for(let r=0;r<t.length;r+=3){let n=t[r],a=t[r+1],o=t[r+2],s=e[n*2],l=e[n*2+1],u=e[a*2],h=e[a*2+1],c=e[o*2],p=e[o*2+1],d=u-s,f=h-l,y=c-s,g=p-l;d*g-f*y>0?(i.push(n),i.push(o),i.push(a)):(i.push(n),i.push(a),i.push(o))}return i}function S3(e,t,i){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let r=0,n=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<n&&(n=u,r=l)}let a=t.length,o=r,s=(o+1)%a;for(;;){let l=o-1>=0?o-1:a-1,u=(s+1)%a,h=e[t[l]*2],c=e[t[l]*2+1],p=e[t[u]*2],d=e[t[u]*2+1],f=e[t[o]*2],y=e[t[o]*2+1],g=e[t[s]*2],_=e[t[s]*2+1],b=!1;if(h<p)b=!0;else if(h>p)b=!1;else{let v=g-f,w=_-y,P=-v,S=y<_?1:-1,C=((h-f)*w+(c-y)*P)*S,E=((p-f)*w+(d-y)*P)*S;C>E&&(b=!0)}if(b){let v=t[l],w=t[o],P=t[s];v!==w&&v!==P&&w!==P&&i.push(P,w,v),o--,o<0&&(o=a-1)}else{let v=t[u],w=t[o],P=t[s];v!==w&&v!==P&&w!==P&&i.push(P,w,v),s++,s>=a&&(s=0)}if(l===u)break}}function Uv(e,t,i,r,n,a,o,s,l){let u=n.length/2,h=o&&s&&l;if(u<Qe.MAX_VERTEX_ARRAY_LENGTH){let c=t.prepareSegment(u,i,r),p=c.vertexLength;for(let y=0;y<a.length;y+=3)r.emplaceBack(p+a[y],p+a[y+1],p+a[y+2]);c.vertexLength+=u,c.primitiveLength+=a.length/3;let d,f;h&&(f=o.prepareSegment(u,i,s),d=f.vertexLength,f.vertexLength+=u);for(let y=0;y<n.length;y+=2)e(n[y],n[y+1]);if(h)for(let y=0;y<l.length;y++){let g=l[y];for(let _=1;_<g.length;_+=2)s.emplaceBack(d+g[_-1],d+g[_]);f.primitiveLength+=g.length/2}}else T3(t,i,r,n,a,e),h&&M3(o,i,s,n,l,e),t.forceNewSegmentOnNextPrepare(),o==null||o.forceNewSegmentOnNextPrepare()}function Fo(e,t,i,r,n,a,o){if(a){let s=r.count;return i(t[n*2],t[n*2+1]),e[n]=r.count,r.count++,o.vertexLength++,s}else return e[n]}function T3(e,t,i,r,n,a){let o=[];for(let c=0;c<r.length/2;c++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),h=u.vertexLength;for(let c=2;c<n.length;c+=3){let p=n[c-2],d=n[c-1],f=n[c],y=o[p]<l,g=o[d]<l,_=o[f]<l,b=(y?1:0)+(g?1:0)+(_?1:0);u.vertexLength+b>Qe.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,y=!0,g=!0,_=!0,h=0);let v=Fo(o,r,a,s,p,y,u),w=Fo(o,r,a,s,d,g,u),P=Fo(o,r,a,s,f,_,u);i.emplaceBack(h+v-l,h+w-l,h+P-l),u.primitiveLength++}}function M3(e,t,i,r,n,a){let o=[];for(let c=0;c<r.length/2;c++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),h=u.vertexLength;for(let c=0;c<n.length;c++){let p=n[c];for(let d=1;d<n[c].length;d+=2){let f=p[d-1],y=p[d],g=o[f]<l,_=o[y]<l,b=(g?1:0)+(_?1:0);u.vertexLength+b>Qe.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,g=!0,_=!0,h=0);let v=Fo(o,r,a,s,f,g,u),w=Fo(o,r,a,s,y,_,u);i.emplaceBack(h+v-l,h+w-l),u.primitiveLength++}}}var C3=500,Gv=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new uk,this.indexArray=new qi,this.indexArray2=new ip,this.programConfigurations=new Rn(e.layers,e.zoom),this.segments=new Qe,this.segments2=new Qe,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=Rd("fill",this.layers,t);let r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),a=[];for(let{feature:o,id:s,index:l,sourceLayerIndex:u}of e){let h=this.layers[0]._featureFilter.needGeometry,c=Gn(o,h);if(!this.layers[0]._featureFilter.filter(new bt(this.zoom,{globalState:this.globalState}),c,i))continue;let p=n?r.evaluate(c,{},i,t.availableImages):void 0,d={id:s,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:h?c.geometry:Un(o),patterns:{},sortKey:p};a.push(d)}n&&a.sort((o,s)=>o.sortKey-s.sortKey);for(let o of a){let{geometry:s,index:l,sourceLayerIndex:u}=o;if(this.hasPattern){let c=Fd("fill",this.layers,o,this.zoom,t);this.patternFeatures.push(c)}else this.addFeature(o,s,l,i,{},t.subdivisionGranularity);let h=e[l].feature;t.featureIndex.insert(h,s,l,u,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,r3),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,i,r,n,a){for(let o of Kp(t,C3)){let s=jv(o,r,a.fill.getGranularityForZoomLevel(r.z)),l=this.layoutVertexArray;Uv((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,s.verticesFlattened,s.indicesTriangles,this.segments2,this.indexArray2,s.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}};te("FillBucket",Gv,{omit:["layers","patternFeatures"]});var xg,I3=()=>xg=xg||new Bt({"fill-sort-key":new ue(V.layout_fill["fill-sort-key"])}),vg,A3=()=>vg=vg||new Bt({"fill-antialias":new ee(V.paint_fill["fill-antialias"]),"fill-opacity":new ue(V.paint_fill["fill-opacity"]),"fill-color":new ue(V.paint_fill["fill-color"]),"fill-outline-color":new ue(V.paint_fill["fill-outline-color"]),"fill-translate":new ee(V.paint_fill["fill-translate"]),"fill-translate-anchor":new ee(V.paint_fill["fill-translate-anchor"]),"fill-pattern":new Iu(V.paint_fill["fill-pattern"])}),E3={get paint(){return A3()},get layout(){return I3()}},k3=e=>e.type==="fill",D3=class extends Xi{constructor(e){super(e,E3)}recalculate(e,t){super.recalculate(e,t);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Gv(e)}queryRadius(){return Lu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){let n=zu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r);return Av(n,t)}isTileClipped(){return!0}},L3=yt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),z3=yt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:R3,size:Gj,alignment:Xj}=L3,F3=fe(au(),1),B3=F3.default.VectorTileFeature.types,O3=500,hc=Math.pow(2,13);function uo(e,t,i,r,n,a,o,s){e.emplaceBack(t,i,Math.floor(r*hc)*2+o,n*hc*2,a*hc*2,Math.round(s))}var Xv=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new hk,this.centroidVertexArray=new zr,this.indexArray=new qi,this.programConfigurations=new Rn(e.layers,e.zoom),this.segments=new Qe,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.features=[],this.hasPattern=Rd("fill-extrusion",this.layers,t);for(let{feature:r,id:n,index:a,sourceLayerIndex:o}of e){let s=this.layers[0]._featureFilter.needGeometry,l=Gn(r,s);if(!this.layers[0]._featureFilter.filter(new bt(this.zoom,{globalState:this.globalState}),l,i))continue;let u={id:n,sourceLayerIndex:o,index:a,geometry:s?l.geometry:Un(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Fd("fill-extrusion",this.layers,u,this.zoom,t)):this.addFeature(u,u.geometry,a,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,u.geometry,a,o,this.index,!0)}}addFeatures(e,t,i){for(let r of this.features){let{geometry:n}=r;this.addFeature(r,n,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,R3),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,z3.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,i,r,n,a){for(let o of Kp(t,O3)){let s={x:0,y:0,sampleCount:0},l=this.layoutVertexArray.length;this.processPolygon(s,r,e,o,a);let u=this.layoutVertexArray.length-l,h=Math.floor(s.x/s.sampleCount),c=Math.floor(s.y/s.sampleCount);for(let p=0;p<u;p++)this.centroidVertexArray.emplaceBack(h,c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}processPolygon(e,t,i,r,n){if(r.length<1||bg(r[0]))return;for(let h of r)h.length!==0&&N3(e,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(t.z),s=B3[i.type]==="Polygon";for(let h of r){if(h.length===0||bg(h))continue;let c=Od(h,o,s);this._generateSideFaces(c,a)}if(!s)return;let l=jv(r,t,o,!1),u=this.layoutVertexArray;Uv((h,c)=>{uo(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let r=1;r<e.length;r++){let n=e[r],a=e[r-1];if(V3(n,a))continue;t.segment.vertexLength+4>Qe.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=n.sub(a)._perp()._unit(),s=a.dist(n);i+s>32768&&(i=0),uo(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,i),uo(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,i),i+=s,uo(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,0,i),uo(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,1,i);let l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};function N3(e,t){for(let i=0;i<t.length;i++){let r=t[i];i===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}te("FillExtrusionBucket",Xv,{omit:["layers","features"]});function V3(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function bg(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var wg,j3=()=>wg=wg||new Bt({"fill-extrusion-opacity":new ee(V["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ue(V["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ee(V["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ee(V["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Iu(V["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ue(V["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ue(V["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ee(V["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),U3={get paint(){return j3()}},cp=fe(ge(),1),G3=e=>e.type==="fill-extrusion",X3=class extends Xi{constructor(e){super(e,U3)}createBucket(e){return new Xv(e)}queryRadius(){return Lu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,pixelPosMatrix:o}){let s=zu(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),h=Z3(s,o,0),c=$3(r,u,l,o),p=c[0],d=c[1];return q3(p,d,h)}};function ho(e,t){return e.x*t.x+e.y*t.y}function Pg(e,t){if(e.length===1){let i=0,r=t[i++],n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){let a=t[i],o=e[0],s=n.sub(r),l=a.sub(r),u=o.sub(r),h=ho(s,s),c=ho(s,l),p=ho(l,l),d=ho(u,s),f=ho(u,l),y=h*p-c*c,g=(p*d-c*f)/y,_=(h*f-c*d)/y,b=1-g-_,v=r.z*b+n.z*g+a.z*_;if(isFinite(v))return v}return 1/0}else{let i=1/0;for(let r of t)i=Math.min(i,r.z);return i}}function q3(e,t,i){let r=1/0;Av(i,t)&&(r=Pg(i,t[0]));for(let n=0;n<t.length;n++){let a=t[n],o=e[n];for(let s=0;s<a.length-1;s++){let l=a[s],u=a[s+1],h=o[s],c=o[s+1],p=[l,u,c,h,l];Iv(i,p)&&(r=Math.min(r,Pg(i,p)))}}return r===1/0?!1:r}function $3(e,t,i,r){let n=[],a=[],o=r[8]*t,s=r[9]*t,l=r[10]*t,u=r[11]*t,h=r[8]*i,c=r[9]*i,p=r[10]*i,d=r[11]*i;for(let f of e){let y=[],g=[];for(let _ of f){let b=_.x,v=_.y,w=r[0]*b+r[4]*v+r[12],P=r[1]*b+r[5]*v+r[13],S=r[2]*b+r[6]*v+r[14],C=r[3]*b+r[7]*v+r[15],E=w+o,F=P+s,B=S+l,R=C+u,D=w+h,z=P+c,x=S+p,T=C+d,I=new cp.default(E/R,F/R);I.z=B/R,y.push(I);let U=new cp.default(D/T,z/T);U.z=x/T,g.push(U)}n.push(y),a.push(g)}return[n,a]}function Z3(e,t,i){let r=[];for(let n of e){let a=[n.x,n.y,i,1];_t.transformMat4(a,a,t),r.push(new cp.default(a[0]/a[3],a[1]/a[3]))}return r}var Y3=yt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:W3,size:qj,alignment:$j}=Y3,H3=yt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:K3,size:Zj,alignment:Yj}=H3,J3=fe(au(),1),Q3=J3.default.VectorTileFeature.types,Sg=63,eD=Math.cos(75/2*(Math.PI/180)),tD=15,iD=20,rD=15,qv=1/2,Tg=Math.pow(2,rD-1)/qv,$v=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new ck,this.layoutVertexArray2=new pk,this.indexArray=new qi,this.programConfigurations=new Rn(e.layers,e.zoom),this.segments=new Qe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=Rd("line",this.layers,t);let r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),a=[];for(let{feature:o,id:s,index:l,sourceLayerIndex:u}of e){let h=this.layers[0]._featureFilter.needGeometry,c=Gn(o,h);if(!this.layers[0]._featureFilter.filter(new bt(this.zoom,{globalState:this.globalState}),c,i))continue;let p=n?r.evaluate(c,{},i):void 0,d={id:s,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:h?c.geometry:Un(o),patterns:{},sortKey:p};a.push(d)}n&&a.sort((o,s)=>o.sortKey-s.sortKey);for(let o of a){let{geometry:s,index:l,sourceLayerIndex:u}=o;if(this.hasPattern){let c=Fd("line",this.layers,o,this.zoom,t);this.patternFeatures.push(c)}else this.addFeature(o,s,l,i,{},t.subdivisionGranularity);let h=e[l].feature;t.featureIndex.insert(h,s,l,u,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,K3)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,W3),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let t=+e.properties.mapbox_clip_start,i=+e.properties.mapbox_clip_end;return{start:t,end:i}}}addFeature(e,t,i,r,n,a){let o=this.layers[0].layout,s=o.get("line-join").evaluate(e,{}),l=o.get("line-cap"),u=o.get("line-miter-limit"),h=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let c of t)this.addLine(c,e,s,l,u,h,r,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}addLine(e,t,i,r,n,a,o,s){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=o?s.line.getGranularityForZoomLevel(o.z):1;if(e=Od(e,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=Q3[t.type]==="Polygon",h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let c=0;for(;c<h-1&&e[c].equals(e[c+1]);)c++;if(h<(u?3:2))return;i==="bevel"&&(n=1.05);let p=this.overscaling<=16?tD*8192/(512*this.overscaling):0,d=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),f,y,g,_,b;this.e1=this.e2=-1,u&&(f=e[h-2],b=e[c].sub(f)._unit()._perp());for(let v=c;v<h;v++){if(g=v===h-1?u?e[c+1]:void 0:e[v+1],g&&e[v].equals(g))continue;b&&(_=b),f&&(y=f),f=e[v],b=g?g.sub(f)._unit()._perp():_,_=_||b;let w=_.add(b);(w.x!==0||w.y!==0)&&w._unit();let P=_.x*b.x+_.y*b.y,S=w.x*b.x+w.y*b.y,C=S!==0?1/S:1/0,E=2*Math.sqrt(2-2*S),F=S<eD&&y&&g,B=_.x*b.y-_.y*b.x>0;if(F&&v>c){let z=f.dist(y);if(z>2*p){let x=f.sub(f.sub(y)._mult(p/z)._round());this.updateDistance(y,x),this.addCurrentVertex(x,_,0,0,d),y=x}}let R=y&&g,D=R?i:u?"butt":r;if(R&&D==="round"&&(C<a?D="miter":C<=2&&(D="fakeround")),D==="miter"&&C>n&&(D="bevel"),D==="bevel"&&(C>2&&(D="flipbevel"),C<n&&(D="miter")),y&&this.updateDistance(y,f),D==="miter")w._mult(C),this.addCurrentVertex(f,w,0,0,d);else if(D==="flipbevel"){if(C>100)w=b.mult(-1);else{let z=C*_.add(b).mag()/_.sub(b).mag();w._perp()._mult(z*(B?-1:1))}this.addCurrentVertex(f,w,0,0,d),this.addCurrentVertex(f,w.mult(-1),0,0,d)}else if(D==="bevel"||D==="fakeround"){let z=-Math.sqrt(C*C-1),x=B?z:0,T=B?0:z;if(y&&this.addCurrentVertex(f,_,x,T,d),D==="fakeround"){let I=Math.round(E*180/Math.PI/iD);for(let U=1;U<I;U++){let X=U/I;if(X!==.5){let ie=X-.5,pe=1.0904+P*(-3.2452+P*(3.55645-P*1.43519)),je=.848013+P*(-1.06021+P*.215638);X=X+X*ie*(X-1)*(pe*ie*ie+je)}let Z=b.sub(_)._mult(X)._add(_)._unit()._mult(B?-1:1);this.addHalfVertex(f,Z.x,Z.y,!1,B,0,d)}}g&&this.addCurrentVertex(f,b,-x,-T,d)}else if(D==="butt")this.addCurrentVertex(f,w,0,0,d);else if(D==="square"){let z=y?1:-1;this.addCurrentVertex(f,w,z,z,d)}else D==="round"&&(y&&(this.addCurrentVertex(f,_,0,0,d),this.addCurrentVertex(f,_,1,1,d,!0)),g&&(this.addCurrentVertex(f,b,-1,-1,d,!0),this.addCurrentVertex(f,b,0,0,d)));if(F&&v<h-1){let z=f.dist(g);if(z>2*p){let x=f.add(g.sub(f)._mult(p/z)._round());this.updateDistance(f,x),this.addCurrentVertex(x,b,0,0,d),f=x}}}}addCurrentVertex(e,t,i,r,n,a=!1){let o=t.x+t.y*i,s=t.y-t.x*i,l=-t.x+t.y*r,u=-t.y-t.x*r;this.addHalfVertex(e,o,s,a,!1,i,n),this.addHalfVertex(e,l,u,a,!0,-r,n),this.distance>Tg/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,n,a))}addHalfVertex({x:e,y:t},i,r,n,a,o,s){let l=(this.lineClips?this.scaledDistance*(Tg-1):this.scaledDistance)*qv;if(this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(a?1:0),Math.round(Sg*i)+128,Math.round(Sg*r)+128,(o===0?0:o<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,c=this.lineClips.end-this.lineClips.start,p=h/c;this.layoutVertexArray2.emplaceBack(p,this.lineClipsArray.length)}let u=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),s.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}};te("LineBucket",$v,{omit:["layers","patternFeatures"]});var Mg,nD=()=>Mg=Mg||new Bt({"line-cap":new ee(V.layout_line["line-cap"]),"line-join":new ue(V.layout_line["line-join"]),"line-miter-limit":new ee(V.layout_line["line-miter-limit"]),"line-round-limit":new ee(V.layout_line["line-round-limit"]),"line-sort-key":new ue(V.layout_line["line-sort-key"])}),Cg,aD=()=>Cg=Cg||new Bt({"line-opacity":new ue(V.paint_line["line-opacity"]),"line-color":new ue(V.paint_line["line-color"]),"line-translate":new ee(V.paint_line["line-translate"]),"line-translate-anchor":new ee(V.paint_line["line-translate-anchor"]),"line-width":new ue(V.paint_line["line-width"]),"line-gap-width":new ue(V.paint_line["line-gap-width"]),"line-offset":new ue(V.paint_line["line-offset"]),"line-blur":new ue(V.paint_line["line-blur"]),"line-dasharray":new cd(V.paint_line["line-dasharray"]),"line-pattern":new Iu(V.paint_line["line-pattern"]),"line-gradient":new Au(V.paint_line["line-gradient"])}),Ig={get paint(){return aD()},get layout(){return nD()}},oD=class extends ue{possiblyEvaluate(e,t){return t=new bt(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=re({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}},ul,sD=e=>e.type==="line",lD=class extends Xi{constructor(e){super(e,Ig),this.gradientVersion=0,ul||(ul=new oD(Ig.paint.properties["line-width"].specification),ul.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();yE(t)?this.stepInterpolant=t._styleExpression.expression instanceof Zp:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=ul.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new $v(e)}queryRadius(e){let t=e,i=Ag(Ro("line-width",this,t),Ro("line-gap-width",this,t)),r=Ro("line-offset",this,t);return i/2+Math.abs(r)+Lu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a}){let o=zu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),s=a/2*Ag(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=Rk(r,l*a)),Ak(o,r,s)}isTileClipped(){return!0}};function Ag(e,t){return t>0?t+2*e:e}var uD=yt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),hD=yt([{name:"a_projected_pos",components:3,type:"Float32"}],4),Wj=yt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),cD=yt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),Hj=yt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Eg=yt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),pD=yt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Kj=yt([{name:"triangle",components:3,type:"Uint16"}]),Jj=yt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Qj=yt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),eU=yt([{type:"Float32",name:"offsetX"}]),tU=yt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),iU=yt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]),hl=fe(ge(),1);function dD(e,t,i){let r=t.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?e=e.toLocaleUpperCase():r==="lowercase"&&(e=e.toLocaleLowerCase()),Ca.applyArabicShaping&&(e=Ca.applyArabicShaping(e)),e}function fD(e,t,i){return e.sections.forEach(r=>{r.text=dD(r.text,t,i)}),e}function mD(e){let t={},i={},r=[],n=0;function a(u){r.push(e[u]),n++}function o(u,h,c){let p=i[u];return delete i[u],i[h]=p,r[p].geometry[0].pop(),r[p].geometry[0]=r[p].geometry[0].concat(c[0]),p}function s(u,h,c){let p=t[h];return delete t[h],t[u]=p,r[p].geometry[0].shift(),r[p].geometry[0]=c[0].concat(r[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return"".concat(u,":").concat(p.x,":").concat(p.y)}for(let u=0;u<e.length;u++){let h=e[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){a(u);continue}let d=l(p,c),f=l(p,c,!0);if(d in i&&f in t&&i[d]!==t[f]){let y=s(d,f,c),g=o(d,f,r[y].geometry);delete t[d],delete i[f],i[l(p,r[g].geometry,!0)]=g,r[y].geometry=null}else d in i?o(d,f,c):f in t?s(d,f,c):(a(u),t[d]=n-1,i[f]=n-1)}return r.filter(u=>u.geometry)}var yD={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"},Zv=24,gD=fe(z_(),1),kg=3;function _D(e,t,i){e===1&&i.readMessage(xD,t)}function xD(e,t,i){if(e===3){let{id:r,bitmap:n,width:a,height:o,left:s,top:l,advance:u}=i.readMessage(vD,{});t.push({id:r,bitmap:new zd({width:a+2*kg,height:o+2*kg},n),metrics:{width:a,height:o,left:s,top:l,advance:u}})}}function vD(e,t,i){e===1?t.id=i.readVarint():e===2?t.bitmap=i.readBytes():e===3?t.width=i.readVarint():e===4?t.height=i.readVarint():e===5?t.left=i.readSVarint():e===6?t.top=i.readSVarint():e===7&&(t.advance=i.readVarint())}function bD(e){return new gD.default(e).readFields(_D,[])}function wD(e){let{userImage:t}=e;return t&&t.render&&t.render()?(e.data.replace(new Uint8Array(t.data.buffer)),!0):!1}function Yv(e){let t=0,i=0;for(let o of e)t+=o.w*o.h,i=Math.max(i,o.w);e.sort((o,s)=>s.h-o.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}],n=0,a=0;for(let o of e)for(let s=r.length-1;s>=0;s--){let l=r[s];if(!(o.w>l.w||o.h>l.h)){if(o.x=l.x,o.y=l.y,a=Math.max(a,o.y+o.h),n=Math.max(n,o.x+o.w),o.w===l.w&&o.h===l.h){let u=r.pop();u&&s<r.length&&(r[s]=u)}else o.h===l.h?(l.x+=o.w,l.w-=o.w):o.w===l.w?(l.y+=o.h,l.h-=o.h):(r.push({x:l.x+o.w,y:l.y,w:l.w-o.w,h:o.h}),l.y+=o.h,l.h-=o.h);break}}return{w:n,h:a,fill:t/(n*a)||0}}var Ti=1,Nd=class{constructor(e,{pixelRatio:t,version:i,stretchX:r,stretchY:n,content:a,textFitWidth:o,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=n,this.content=a,this.version=i,this.textFitWidth=o,this.textFitHeight=s}get tl(){return[this.paddedRect.x+Ti,this.paddedRect.y+Ti]}get br(){return[this.paddedRect.x+this.paddedRect.w-Ti,this.paddedRect.y+this.paddedRect.h-Ti]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-Ti*2)/this.pixelRatio,(this.paddedRect.h-Ti*2)/this.pixelRatio]}},PD=class{constructor(e,t){let i={},r={};this.haveRenderCallbacks=[];let n=[];this.addImages(e,i,n),this.addImages(t,r,n);let{w:a,h:o}=Yv(n),s=new tt({width:a||1,height:o||1});for(let l in e){let u=e[l],h=i[l].paddedRect;tt.copy(u.data,s,{x:0,y:0},{x:h.x+Ti,y:h.y+Ti},u.data)}for(let l in t){let u=t[l],h=r[l].paddedRect,c=h.x+Ti,p=h.y+Ti,d=u.data.width,f=u.data.height;tt.copy(u.data,s,{x:0,y:0},{x:c,y:p},u.data),tt.copy(u.data,s,{x:0,y:f-1},{x:c,y:p-1},{width:d,height:1}),tt.copy(u.data,s,{x:0,y:0},{x:c,y:p+f},{width:d,height:1}),tt.copy(u.data,s,{x:d-1,y:0},{x:c-1,y:p},{width:1,height:f}),tt.copy(u.data,s,{x:0,y:0},{x:c+d,y:p},{width:1,height:f})}this.image=s,this.iconPositions=i,this.patternPositions=r}addImages(e,t,i){for(let r in e){let n=e[r],a={x:0,y:0,w:n.data.width+2*Ti,h:n.data.height+2*Ti};i.push(a),t[r]=new Nd(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,n]=e.tl;i.update(t.data,void 0,{x:r,y:n})}};te("ImagePosition",Nd);te("ImageAtlas",PD);var Wv=(e=>(e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e))(Wv||{});function Hv(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0;break}return{horizontalAlign:t,verticalAlign:i}}var SD=fe(au(),1),TD=255,Bl=128,Dg=TD*Bl;function Lg(e,t){let{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new bt(e+1))};if(i.kind==="source")return{kind:"source"};{let{zoomStops:r,interpolationType:n}=i,a=0;for(;a<r.length&&r[a]<=e;)a++;a=Math.max(0,a-1);let o=a;for(;o<r.length&&r[o]<e+1;)o++;o=Math.min(r.length-1,o);let s=r[a],l=r[o];if(i.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n};let u=i.evaluate(new bt(s)),h=i.evaluate(new bt(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:h,interpolationType:n}}}function Vd(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return e.kind==="source"?r/Bl:e.kind==="composite"?ht.number(r/Bl,n/Bl,i):t}function Ru(e,t){let i=0,r=0;if(e.kind==="constant")r=e.layoutSize;else if(e.kind!=="source"){let{interpolationType:n,minZoom:a,maxZoom:o}=e,s=n?Ne(Vi.interpolationFactor(n,t,a,o),0,1):0;e.kind==="camera"?r=ht.number(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:r}}function Kl(e,t,i){let r="never",n=e.get(t);return n?r=n:e.get(i)&&(r="always"),r}var MD=SD.default.VectorTileFeature.types,CD=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function cl(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=s?Math.min(Dg,Math.round(s[0])):0,f=s?Math.min(Dg,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(r*32),Math.round(n*32),a,o,(d<<1)+(l?1:0),f,u*16,h*16,c*256,p*256)}function Qo(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function ID(e){for(let t of e.sections)if(KE(t.text))return!0;return!1}var pp=class{constructor(e){this.layoutVertexArray=new dk,this.indexArray=new qi,this.programConfigurations=e,this.segments=new Qe,this.dynamicLayoutVertexArray=new fk,this.opacityVertexArray=new mk,this.hasVisibleVertices=!1,this.placedSymbolArray=new yv}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uD.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,hD.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,CD,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};te("SymbolBuffers",pp);var dp=class{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new Qe,this.collisionVertexArray=new gk}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,cD.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};te("CollisionBuffers",dp);var Ea=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(o=>o.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Lg(this.zoom,t["text-size"]),this.iconSizeData=Lg(this.zoom,t["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=Kl(i,"text-overlap","text-allow-overlap")!=="never"||Kl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!r.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(o=>Wv[o])),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.sourceID=e.sourceID}createArrays(){this.text=new pp(new Rn(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new pp(new Rn(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new xv,this.lineVertexArray=new vv,this.symbolInstances=new _v,this.textAnchorOffsets=new wv}calculateGlyphDependencies(e,t,i,r,n){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(i||r)&&n){let o=yD[e.charAt(a)];o&&(t[o.charCodeAt(0)]=!0)}}populate(e,t,i){let r=this.layers[0],n=r.layout,a=n.get("text-font"),o=n.get("text-field"),s=n.get("icon-image"),l=(o.value.kind!=="constant"||o.value.value instanceof Or&&!o.value.value.isEmpty()||o.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=s.value.kind!=="constant"||!!s.value.value||Object.keys(s.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,p=t.glyphDependencies,d=t.availableImages,f=new bt(this.zoom,{globalState:this.globalState});for(let{feature:y,id:g,index:_,sourceLayerIndex:b}of e){let v=r._featureFilter.needGeometry,w=Gn(y,v);if(!r._featureFilter.filter(f,w,i))continue;v||(w.geometry=Un(y));let P;if(l){let F=r.getValueAndResolveTokens("text-field",w,i,d),B=Or.factory(F),R=this.hasRTLText=this.hasRTLText||ID(B);(!R||Ca.getRTLTextPluginStatus()==="unavailable"||R&&Ca.isParsed())&&(P=fD(B,r,w))}let S;if(u){let F=r.getValueAndResolveTokens("icon-image",w,i,d);F instanceof mr?S=F:S=mr.fromString(F)}if(!P&&!S)continue;let C=this.sortFeaturesByKey?h.evaluate(w,{},i):void 0,E={id:g,text:P,icon:S,index:_,sourceLayerIndex:b,geometry:w.geometry,properties:y.properties,type:MD[y.type],sortKey:C};if(this.features.push(E),S&&(c[S.name]=!0),P){let F=a.evaluate(w,{},i).join(","),B=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let R of P.sections)if(R.image)c[R.image.name]=!0;else{let D=GE(P.toString()),z=R.fontStack||F,x=p[z]=p[z]||{};this.calculateGlyphDependencies(R.text,x,B,this.allowVerticalPlacement,D)}}}n.get("symbol-placement")==="line"&&(this.features=mD(this.features)),this.sortFeaturesByKey&&this.features.sort((y,g)=>y.sortKey-g.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let i=this.lineVertexArray.length;if(e.segment!==void 0){let r=e.dist(t[e.segment+1]),n=e.dist(t[e.segment]),a={};for(let o=e.segment+1;o<t.length;o++)a[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:r},o<t.length-1&&(r+=t[o+1].dist(t[o]));for(let o=e.segment||0;o>=0;o--)a[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:n},o>0&&(n+=t[o-1].dist(t[o]));for(let o=0;o<t.length;o++){let s=a[o];this.lineVertexArray.emplaceBack(s.x,s.y,s.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.indexArray,d=e.layoutVertexArray,f=e.segments.prepareSegment(4*t.length,d,p,this.canOverlap?a.sortKey:void 0),y=this.glyphOffsetArray.length,g=f.vertexLength,_=this.allowVerticalPlacement&&o===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<t.length;v++){let{tl:w,tr:P,bl:S,br:C,tex:E,pixelOffsetTL:F,pixelOffsetBR:B,minFontScaleX:R,minFontScaleY:D,glyphOffset:z,isSDF:x,sectionIndex:T}=t[v],I=f.vertexLength,U=z[1];cl(d,s.x,s.y,w.x,U+w.y,E.x,E.y,i,x,F.x,F.y,R,D),cl(d,s.x,s.y,P.x,U+P.y,E.x+E.w,E.y,i,x,B.x,F.y,R,D),cl(d,s.x,s.y,S.x,U+S.y,E.x,E.y+E.h,i,x,F.x,B.y,R,D),cl(d,s.x,s.y,C.x,U+C.y,E.x+E.w,E.y+E.h,i,x,B.x,B.y,R,D),Qo(e.dynamicLayoutVertexArray,s,_),p.emplaceBack(I,I+2,I+1),p.emplaceBack(I+1,I+2,I+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(z[0]),(v===t.length-1||T!==t[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{},c,b&&b[T])}e.placedSymbolArray.emplaceBack(s.x,s.y,y,this.glyphOffsetArray.length-y,g,l,u,s.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],o,0,!1,0,h)}_addCollisionDebugVertex(e,t,i,r,n,a){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,i,r,n,a,o){let s=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=s.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,c=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(u,h,a,c,p,new hl.default(e,t)),this._addCollisionDebugVertex(u,h,a,c,p,new hl.default(i,t)),this._addCollisionDebugVertex(u,h,a,c,p,new hl.default(i,r)),this._addCollisionDebugVertex(u,h,a,c,p,new hl.default(e,r)),s.vertexLength+=4;let d=n.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let n=e;n<t;n++){let a=this.collisionBoxArray.get(n),o=a.x1,s=a.y1,l=a.x2,u=a.y2;this.addCollisionDebugVertices(o,s,l,u,r?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new dp(ng,Eg.members,ip),this.iconCollisionBox=new dp(ng,Eg.members,ip);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,i,r,n,a,o,s,l){let u={};for(let h=t;h<i;h++){let c=e.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=r;h<n;h++){let c=e.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=a;h<o;h++){let c=e.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=s;h<l;h++){let c=e.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+i.numGlyphs*4;for(let n=i.vertexStartIndex;n<r;n+=4)e.indexArray.emplaceBack(n,n+2,n+1),e.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),r=[],n=[],a=[];for(let o=0;o<this.symbolInstances.length;++o){a.push(o);let s=this.symbolInstances.get(o);r.push(Math.round(t*s.anchorX+i*s.anchorY)|0),n.push(s.featureIndex)}return a.sort((o,s)=>r[o]-r[s]||n[s]-n[o]),a}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let i=this.symbolInstances.get(t);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((r,n,a)=>{r>=0&&a.indexOf(r)===n&&this.addIndicesForPlacedSymbol(this.text,r)}),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};te("SymbolBucket",Ea,{omit:["layers","collisionBoxArray","features","compareText"]});Ea.MAX_GLYPHS=65535;Ea.addDynamicAttributes=Qo;function AD(e,t){return t.replace(/{([^{}]+)}/g,(i,r)=>e&&r in e?String(e[r]):"")}var zg,ED=()=>zg=zg||new Bt({"symbol-placement":new ee(V.layout_symbol["symbol-placement"]),"symbol-spacing":new ee(V.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ee(V.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ue(V.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ee(V.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ee(V.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ee(V.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ee(V.layout_symbol["icon-ignore-placement"]),"icon-optional":new ee(V.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ee(V.layout_symbol["icon-rotation-alignment"]),"icon-size":new ue(V.layout_symbol["icon-size"]),"icon-text-fit":new ee(V.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ee(V.layout_symbol["icon-text-fit-padding"]),"icon-image":new ue(V.layout_symbol["icon-image"]),"icon-rotate":new ue(V.layout_symbol["icon-rotate"]),"icon-padding":new ue(V.layout_symbol["icon-padding"]),"icon-keep-upright":new ee(V.layout_symbol["icon-keep-upright"]),"icon-offset":new ue(V.layout_symbol["icon-offset"]),"icon-anchor":new ue(V.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ee(V.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ee(V.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ee(V.layout_symbol["text-rotation-alignment"]),"text-field":new ue(V.layout_symbol["text-field"]),"text-font":new ue(V.layout_symbol["text-font"]),"text-size":new ue(V.layout_symbol["text-size"]),"text-max-width":new ue(V.layout_symbol["text-max-width"]),"text-line-height":new ee(V.layout_symbol["text-line-height"]),"text-letter-spacing":new ue(V.layout_symbol["text-letter-spacing"]),"text-justify":new ue(V.layout_symbol["text-justify"]),"text-radial-offset":new ue(V.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ee(V.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ue(V.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ue(V.layout_symbol["text-anchor"]),"text-max-angle":new ee(V.layout_symbol["text-max-angle"]),"text-writing-mode":new ee(V.layout_symbol["text-writing-mode"]),"text-rotate":new ue(V.layout_symbol["text-rotate"]),"text-padding":new ee(V.layout_symbol["text-padding"]),"text-keep-upright":new ee(V.layout_symbol["text-keep-upright"]),"text-transform":new ue(V.layout_symbol["text-transform"]),"text-offset":new ue(V.layout_symbol["text-offset"]),"text-allow-overlap":new ee(V.layout_symbol["text-allow-overlap"]),"text-overlap":new ee(V.layout_symbol["text-overlap"]),"text-ignore-placement":new ee(V.layout_symbol["text-ignore-placement"]),"text-optional":new ee(V.layout_symbol["text-optional"])}),Rg,kD=()=>Rg=Rg||new Bt({"icon-opacity":new ue(V.paint_symbol["icon-opacity"]),"icon-color":new ue(V.paint_symbol["icon-color"]),"icon-halo-color":new ue(V.paint_symbol["icon-halo-color"]),"icon-halo-width":new ue(V.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ue(V.paint_symbol["icon-halo-blur"]),"icon-translate":new ee(V.paint_symbol["icon-translate"]),"icon-translate-anchor":new ee(V.paint_symbol["icon-translate-anchor"]),"text-opacity":new ue(V.paint_symbol["text-opacity"]),"text-color":new ue(V.paint_symbol["text-color"],{runtimeType:Ni,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new ue(V.paint_symbol["text-halo-color"]),"text-halo-width":new ue(V.paint_symbol["text-halo-width"]),"text-halo-blur":new ue(V.paint_symbol["text-halo-blur"]),"text-translate":new ee(V.paint_symbol["text-translate"]),"text-translate-anchor":new ee(V.paint_symbol["text-translate-anchor"])}),cc={get paint(){return kD()},get layout(){return ED()}},Kv=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:ns,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};te("FormatSectionOverride",Kv,{omit:["defaultValue"]});var DD=e=>e.type==="symbol",LD=class fp extends Xi{constructor(t){super(t,cc)}recalculate(t,i){if(super.recalculate(t,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let r=this.layout.get("text-writing-mode");if(r){let n=[];for(let a of r)n.indexOf(a)<0&&n.push(a);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,r,n){let a=this.layout.get(t).evaluate(i,{},r,n),o=this._unevaluatedLayout._values[t];return!o.isDataDriven()&&!bu(o.value)&&a?AD(i.properties,a):a}createBucket(t){return new Ea(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of cc.paint.overridableProperties){if(!fp.hasPaintOverride(this.layout,t))continue;let i=this.paint.get(t),r=new Kv(i),n=new nd(r,i.property.specification),a=null;i.value.kind==="constant"||i.value.kind==="source"?a=new qo("source",n):a=new Zl("composite",n,i.value.zoomStops),this.paint._values[t]=new Oi(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!this.layout||i.isDataDriven()||r.isDataDriven()?!1:fp.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){let r=t.get("text-field"),n=cc.paint.properties[i],a=!1,o=s=>{for(let l of s)if(n.overrides&&n.overrides.hasOverride(l)){a=!0;return}};if(r.value.kind==="constant"&&r.value.value instanceof Or)o(r.value.value.sections);else if(r.value.kind==="source"){let s=u=>{if(!a)if(u instanceof Uo&&Mt(u.value)===as){let h=u.value;o(h.sections)}else u instanceof Ex?o(u.sections):u.eachChild(s)},l=r.value;l._styleExpression&&s(l._styleExpression.expression)}return a}},Fg,zD=()=>Fg=Fg||new Bt({"background-color":new ee(V.paint_background["background-color"]),"background-pattern":new cd(V.paint_background["background-pattern"]),"background-opacity":new ee(V.paint_background["background-opacity"])}),RD={get paint(){return zD()}},FD=e=>e.type==="background",BD=class extends Xi{constructor(e){super(e,RD)}},Bg,OD=()=>Bg=Bg||new Bt({"raster-opacity":new ee(V.paint_raster["raster-opacity"]),"raster-hue-rotate":new ee(V.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ee(V.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ee(V.paint_raster["raster-brightness-max"]),"raster-saturation":new ee(V.paint_raster["raster-saturation"]),"raster-contrast":new ee(V.paint_raster["raster-contrast"]),"raster-resampling":new ee(V.paint_raster["raster-resampling"]),"raster-fade-duration":new ee(V.paint_raster["raster-fade-duration"])}),ND={get paint(){return OD()}},VD=e=>e.type==="raster",jD=class extends Xi{constructor(e){super(e,ND)}};function UD(e){let t=[],i=e.id;return i===void 0&&t.push({message:"layers.".concat(i,': missing required property "id"')}),e.render===void 0&&t.push({message:"layers.".concat(i,': missing required method "render"')}),e.renderingMode&&e.renderingMode!=="2d"&&e.renderingMode!=="3d"&&t.push({message:"layers.".concat(i,': property "renderingMode" must be either "2d" or "3d"')}),t}var GD=e=>e.type==="custom",XD=class extends Xi{constructor(e){super(e,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function pc(e){if(e.type==="custom")return new XD(e);switch(e.type){case"background":return new BD(e);case"circle":return new jk(e);case"color-relief":return new t3(e);case"fill":return new D3(e);case"fill-extrusion":return new X3(e);case"heatmap":return new $k(e);case"hillshade":return new Hk(e);case"line":return new lD(e);case"raster":return new jD(e);case"symbol":return new LD(e)}}function Ol(e){let t=[];if(typeof e=="string")t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:r,url:n}of e){let a="".concat(r).concat(n);i.indexOf(a)===-1&&(i.push(a),t.push({id:r,url:n}))}}return t}function Og(e,t,i){try{let r=new URL(e);return r.pathname+="".concat(t).concat(i),r.toString()}catch(r){throw new Error('Invalid sprite URL "'.concat(e,'", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically'))}}async function qD(e,t,i,r){let n=Ol(e),a=i>1?"@2x":"",o={},s={};for(let{id:l,url:u}of n){let h=t.transformRequest(Og(u,a,".json"),"SpriteJSON");o[l]=hu(h,r);let c=t.transformRequest(Og(u,a,".png"),"SpriteImage");s[l]=cr.getImage(c,r)}return await Promise.all([...Object.values(o),...Object.values(s)]),$D(o,s)}async function $D(e,t){let i={};for(let r in e){i[r]={};let n=Me.getImageCanvasContext((await t[r]).data),a=(await e[r]).data;for(let o in a){let{width:s,height:l,x:u,y:h,sdf:c,pixelRatio:p,stretchX:d,stretchY:f,content:y,textFitWidth:g,textFitHeight:_}=a[o],b={width:s,height:l,x:u,y:h,context:n};i[r][o]={data:null,pixelRatio:p,sdf:c,stretchX:d,stretchY:f,content:y,textFitWidth:g,textFitHeight:_,spriteData:b}}}return i}var pl=1,ZD=class extends ei{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new tt({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let i=t.spriteData;t.data=new tt({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,t)&&(this.images[e]=t)}_validate(e,t){let i=!0,r=t.data||t.spriteData;return this._validateStretch(t.stretchX,r&&r.width)||(this.fire(new he(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),i=!1),this._validateStretch(t.stretchY,r&&r.height)||(this.fire(new he(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),i=!1),this._validateContent(t.content,t)||(this.fire(new he(new Error('Image "'.concat(e,'" has invalid "content" value')))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let i=t.spriteData,r=i&&i.width||t.data.width,n=i&&i.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||n<e[1]||e[2]<0||r<e[2]||e[3]<0||n<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){let r=this.getImage(e);if(i&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw new Error("size mismatch between old image (".concat(r.data.width,"x").concat(r.data.height,") and new image (").concat(t.data.width,"x").concat(t.data.height,")."));t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,i)=>{let r=!0;if(!this.isLoaded())for(let n of e)this.images[n]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let t={};for(let i of e){let r=this.getImage(i);r||(this.fire(new H("styleimagemissing",{id:i})),r=this.getImage(i)),r?t[i]={data:r.data.clone(),pixelRatio:r.pixelRatio,sdf:r.sdf,version:r.version,stretchX:r.stretchX,stretchY:r.stretchY,content:r.content,textFitWidth:r.textFitWidth,textFitHeight:r.textFitHeight,hasRenderCallback:!!(r.userImage&&r.userImage.render)}:Tt('Image "'.concat(i,'" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.'))}return t}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],i=this.getImage(e);if(!i)return null;if(t&&t.position.version===i.version)return t.position;if(t)t.position.version=i.version;else{let r=i.data.width+pl*2,n=i.data.height+pl*2,a={w:r,h:n,x:0,y:0},o=new Nd(a,i);this.patterns[e]={bin:a,position:o}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new vt(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let n in this.patterns)e.push(this.patterns[n].bin);let{w:t,h:i}=Yv(e),r=this.atlasImage;r.resize({width:t||1,height:i||1});for(let n in this.patterns){let{bin:a}=this.patterns[n],o=a.x+pl,s=a.y+pl,l=this.getImage(n).data,u=l.width,h=l.height;tt.copy(l,r,{x:0,y:0},{x:o,y:s},{width:u,height:h}),tt.copy(l,r,{x:0,y:h-1},{x:o,y:s-1},{width:u,height:1}),tt.copy(l,r,{x:0,y:0},{x:o,y:s+h},{width:u,height:1}),tt.copy(l,r,{x:u-1,y:0},{x:o-1,y:s},{width:1,height:h}),tt.copy(l,r,{x:0,y:0},{x:o+u,y:s},{width:1,height:h})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let i=this.getImage(t);i||Tt('Image with ID: "'.concat(t,'" was not found')),wD(i)&&this.updateImage(t,i)}}};async function YD(e,t,i,r){let n=t*256,a=n+255,o=r.transformRequest(i.replace("{fontstack}",e).replace("{range}","".concat(n,"-").concat(a)),"Glyphs"),s=await $C(o,new AbortController);if(!s||!s.data)throw new Error("Could not load glyph range. range: ".concat(t,", ").concat(n,"-").concat(a));let l={};for(let u of bD(s.data))l[u.id]=u;return l}var WD=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:a="normal",fontStyle:o="normal",lang:s=null}={}){this.buffer=t,this.cutoff=r,this.radius=i,this.lang=s;let l=this.size=e+t*4,u=this._createCanvas(l),h=this.ctx=u.getContext("2d",{willReadFrequently:!0});h.font="".concat(o," ").concat(a," ").concat(e,"px ").concat(n),h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(i),s=0,l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-n))),u=Math.min(this.size-this.buffer,o+Math.ceil(r)),h=l+2*this.buffer,c=u+2*this.buffer,p=Math.max(h*c,0),d=new Uint8ClampedArray(p),f={data:d,width:h,height:c,glyphWidth:l,glyphHeight:u,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(l===0||u===0)return f;let{ctx:y,buffer:g,gridInner:_,gridOuter:b}=this;this.lang&&(y.lang=this.lang),y.clearRect(g,g,l,u),y.fillText(e,g,g+o);let v=y.getImageData(g,g,l,u);b.fill(1e20,0,p),_.fill(0,0,p);for(let w=0;w<u;w++)for(let P=0;P<l;P++){let S=v.data[4*(w*l+P)+3]/255;if(S===0)continue;let C=(w+g)*h+P+g;if(S===1)b[C]=0,_[C]=1e20;else{let E=.5-S;b[C]=E>0?E*E:0,_[C]=E<0?E*E:0}}Ng(b,0,0,h,c,h,this.f,this.v,this.z),Ng(_,g,g,l,u,h,this.f,this.v,this.z);for(let w=0;w<p;w++){let P=Math.sqrt(b[w])-Math.sqrt(_[w]);d[w]=Math.round(255-255*(P/this.radius+this.cutoff))}return f}};function Ng(e,t,i,r,n,a,o,s,l){for(let u=t;u<t+r;u++)Vg(e,i*a+u,a,n,o,s,l);for(let u=i;u<i+n;u++)Vg(e,u*a+t,1,r,o,s,l)}function Vg(e,t,i,r,n,a,o){a[0]=0,o[0]=-1e20,o[1]=1e20,n[0]=e[t];for(let s=1,l=0,u=0;s<r;s++){n[s]=e[t+s*i];let h=s*s;do{let c=a[l];u=(n[s]-n[c]+h-c*c)/(s-c)/2}while(u<=o[l]&&--l>-1);l++,a[l]=s,o[l]=u,o[l+1]=1e20}for(let s=0,l=0;s<r;s++){for(;o[l+1]<s;)l++;let u=a[l],h=s-u;e[t+s*i]=n[u]+h*h}}var mp=class yp{constructor(t,i){this.requestManager=t,this.localIdeographFontFamily=i,this.entries={}}setURL(t){this.url=t}async getGlyphs(t){let i=[];for(let a in t)for(let o of t[a])i.push(this._getAndCacheGlyphsPromise(a,o));let r=await Promise.all(i),n={};for(let{stack:a,id:o,glyph:s}of r)n[a]||(n[a]={}),n[a][o]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return n}async _getAndCacheGlyphsPromise(t,i){let r=this.entries[t];r||(r=this.entries[t]={glyphs:{},requests:{},ranges:{}});let n=r.glyphs[i];if(n!==void 0)return{stack:t,id:i,glyph:n};if(n=this._tinySDF(r,t,i),n)return r.glyphs[i]=n,{stack:t,id:i,glyph:n};let a=Math.floor(i/256);if(a*256>65535)throw new Error("glyphs > 65535 not supported");if(r.ranges[a])return{stack:t,id:i,glyph:n};if(!this.url)throw new Error("glyphsUrl is not set");if(!r.requests[a]){let s=yp.loadGlyphRange(t,a,this.url,this.requestManager);r.requests[a]=s}let o=await r.requests[a];for(let s in o)this._doesCharSupportLocalGlyph(+s)||(r.glyphs[+s]=o[+s]);return r.ranges[a]=!0,{stack:t,id:i,glyph:o[i]||null}}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(t))||It["CJK Unified Ideographs"](t)||It["Hangul Syllables"](t)||It.Hiragana(t)||It.Katakana(t)||It["CJK Symbols and Punctuation"](t)||It["Halfwidth and Fullwidth Forms"](t))}_tinySDF(t,i,r){let n=this.localIdeographFontFamily;if(!n||!this._doesCharSupportLocalGlyph(r))return;let a=2,o=t.tinySDF;if(!o){let l="400";/bold/i.test(i)?l="900":/medium/i.test(i)?l="500":/light/i.test(i)&&(l="200"),o=t.tinySDF=new yp.TinySDF({fontSize:24*a,buffer:3*a,radius:8*a,cutoff:.25,fontFamily:n,fontWeight:l})}let s=o.draw(String.fromCharCode(r));return{id:r,bitmap:new zd({width:s.width||30*a,height:s.height||30*a},s.data),metrics:{width:s.glyphWidth/a||24,height:s.glyphHeight/a||24,left:s.glyphLeft/a+.5||0,top:s.glyphTop/a-27.5||-8,advance:s.glyphAdvance/a||24,isDoubleResolution:!0}}}};mp.loadGlyphRange=YD,mp.TinySDF=WD;var HD=mp,KD=class{constructor(){this.specification=V.light.position}possiblyEvaluate(e,t){return IC(e.expression.evaluate(t))}interpolate(e,t,i){return{x:ht.number(e.x,t.x,i),y:ht.number(e.y,t.y,i),z:ht.number(e.z,t.z,i)}}},jg="-transition",dc,JD=class extends ei{constructor(e){super(),dc=dc||new Bt({anchor:new ee(V.light.anchor),position:new KD,color:new ee(V.light.color),intensity:new ee(V.light.intensity)}),this._transitionable=new Mu(dc),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(OE,e,t))for(let i in e){let r=e[i];i.endsWith(jg)?this._transitionable.setTransition(i.slice(0,-jg.length),r):this._transitionable.setValue(i,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return i&&i.validate===!1?!1:Su(this,e.call(St,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:V}))}},QD=new Bt({"sky-color":new ee(V.sky["sky-color"]),"horizon-color":new ee(V.sky["horizon-color"]),"fog-color":new ee(V.sky["fog-color"]),"fog-ground-blend":new ee(V.sky["fog-ground-blend"]),"horizon-fog-blend":new ee(V.sky["horizon-fog-blend"]),"sky-horizon-blend":new ee(V.sky["sky-horizon-blend"]),"atmosphere-blend":new ee(V.sky["atmosphere-blend"])}),Ug="-transition",eL=class extends ei{constructor(e){super(),this._transitionable=new Mu(QD),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new bt(0))}setSky(e,t={}){if(!this._validate(NE,e,t)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let i in e){let r=e[i];i.endsWith(Ug)?this._transitionable.setTransition(i.slice(0,-Ug.length),r):this._transitionable.setValue(i,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i={}){return(i==null?void 0:i.validate)===!1?!1:Su(this,e.call(St,re({value:t,style:{glyphs:!0,sprite:!0},styleSpec:V})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},tL=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let i=e.join(",")+String(t);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){let r=e.length%2===1,n=[],a=r?-e[e.length-1]*i:0,o=e[0]*i,s=!0;n.push({left:a,right:o,isDash:s,zeroLength:e[0]===0});let l=e[0];for(let u=1;u<e.length;u++){s=!s;let h=e[u];a=l*i,l+=h,o=l*i,n.push({left:a,right:o,isDash:s,zeroLength:h===0})}return n}addRoundDash(e,t,i){let r=t/2;for(let n=-i;n<=i;n++){let a=this.nextRow+i+n,o=this.width*a,s=0,l=e[s];for(let u=0;u<this.width;u++){u/l.right>1&&(l=e[++s]);let h=Math.abs(u-l.left),c=Math.abs(u-l.right),p=Math.min(h,c),d,f=n/i*(r+1);if(l.isDash){let y=r-Math.abs(f);d=Math.sqrt(p*p+y*y)}else d=r-Math.sqrt(p*p+f*f);this.data[o+u]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let o=e.length-1;o>=0;--o){let s=e[o],l=e[o+1];s.zeroLength?e.splice(o,1):l&&l.isDash===s.isDash&&(l.left=s.left,e.splice(o,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let r=this.width*this.nextRow,n=0,a=e[n];for(let o=0;o<this.width;o++){o/a.right>1&&(a=e[++n]);let s=Math.abs(o-a.left),l=Math.abs(o-a.right),u=Math.min(s,l),h=a.isDash?u:-u;this.data[r+o]=Math.max(0,Math.min(255,h+128))}}addDash(e,t){let i=t?7:0,r=2*i+1;if(this.nextRow+r>this.height)return Tt("LineAtlas out of space"),null;let n=0;for(let o=0;o<e.length;o++)n+=e[o];if(n!==0){let o=this.width/n,s=this.getDashRanges(e,this.width,o);t?this.addRoundDash(s,o,i):this.addRegularDash(s)}let a={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:n};return this.nextRow+=r,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}},iL=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},rL={once:!0},nL=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new iL(()=>this.process()),this.subscription=Nc(this.target,"message",i=>this.receive(i),!1),this.globalScope=wa(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((i,r)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=t?Nc(t.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},rL):null;this.resolveRejects[n]={resolve:l=>{a==null||a.unsubscribe(),i(l)},reject:l=>{a==null||a.unsubscribe(),r(l)}};let o=[],s=bi(zt({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Lo(e.data,o)});this.target.postMessage(s,{transfer:o})})}receive(e){let t=e.data,i=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[i];let r=this.abortControllers[i];delete this.abortControllers[i],r&&r.abort();return}if(wa(self)||t.mustQueue){this.tasks[i]=t,this.taskQueue.push(i),this.invoker.trigger();return}this.processTask(i,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let n=this.resolveRejects[e];if(delete this.resolveRejects[e],!n)return;t.error?n.reject(zo(t.error)):n.resolve(zo(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,new Error("Could not find a registered handler for ".concat(t.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let i=zo(t.data),r=new AbortController;this.abortControllers[e]=r;try{let n=await this.messageHandlers[t.type](t.sourceMapId,i,r);this.completeTask(e,null,n)}catch(n){this.completeTask(e,n)}}completeTask(e,t,i){let r=[];delete this.abortControllers[e];let n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Lo(t):null,data:Lo(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},aL='(()=>{var Uy=Object.create;var ss=Object.defineProperty;var $y=Object.getOwnPropertyDescriptor;var jy=Object.getOwnPropertyNames;var qy=Object.getPrototypeOf,Wy=Object.prototype.hasOwnProperty;var ve=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xy=(t,e)=>{for(var r in e)ss(t,r,{get:e[r],enumerable:!0})},Hy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jy(e))!Wy.call(t,i)&&i!==r&&ss(t,i,{get:()=>e[i],enumerable:!(n=$y(e,i))||n.enumerable});return t};var Y=(t,e,r)=>(r=t!=null?Uy(qy(t)):{},Hy(e||!t||!t.__esModule?ss(r,"default",{value:t,enumerable:!0}):r,t));var ye=ve((p0,au)=>{"use strict";au.exports=hr;function hr(t,e){this.x=t,this.y=e}hr.prototype={clone:function(){return new hr(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};hr.convert=function(t){return t instanceof hr?t:Array.isArray(t)?new hr(t[0],t[1]):t}});var uu=ve((f0,lu)=>{"use strict";lu.exports=su;function su(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}su.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}}});var op=ve((Ov,el)=>{function Sg(t,e){var r,n,i,o,a,s,l,u,c,p;for(r=t.length&3,n=t.length-r,i=e,a=3432918353,l=461845907,p=0;p<n;)c=t.charCodeAt(p)&255|(t.charCodeAt(++p)&255)<<8|(t.charCodeAt(++p)&255)<<16|(t.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(t.charCodeAt(p+2)&255)<<16;case 2:c^=(t.charCodeAt(p+1)&255)<<8;case 1:c^=t.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof el<"u"&&(el.exports=Sg)});var ap=ve((Gv,tl)=>{function wg(t,e){for(var r=t.length,n=e^r,i=0,o;r>=4;)o=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(t.charCodeAt(i+2)&255)<<16;case 2:n^=(t.charCodeAt(i+1)&255)<<8;case 1:n^=t.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof tl!==void 0&&(tl.exports=wg)});var rl=ve((Nv,ta)=>{var sp=op(),Ag=ap();ta.exports=sp;ta.exports.murmur3=sp;ta.exports.murmur2=Ag});var dl=ve((LS,jp)=>{"use strict";var cb=ye();jp.exports=Rr;function Rr(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(pb,this,e)}function pb(t,e,r){t==1?e.id=r.readVarint():t==2?fb(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function fb(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}Rr.types=["Unknown","Point","LineString","Polygon"];Rr.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=[],s;t.pos<e;){if(n<=0){var l=t.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new cb(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};Rr.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};Rr.prototype.toGeoJSON=function(t,e,r){var n=this.extent*Math.pow(2,r),i=this.extent*t,o=this.extent*e,a=this.loadGeometry(),s=Rr.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],g=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(g*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=yb(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function yb(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=mb(t[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[o]]):n.push(t[o]))}return n&&r.push(n),r}function mb(t){for(var e=0,r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}});var gl=ve((FS,Wp)=>{"use strict";var hb=dl();Wp.exports=qp;function qp(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(db,this,e),this.length=this._features.length}function db(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(gb(r))}function gb(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}qp.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new hb(this._pbf,e,this.extent,this._keys,this._values)}});var Hp=ve((DS,Xp)=>{"use strict";var bb=gl();Xp.exports=xb;function xb(t,e){this.layers=t.readFields(vb,{},e)}function vb(t,e,r){if(t===3){var n=new bb(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Rt=ve((VS,xa)=>{xa.exports.VectorTile=Hp();xa.exports.VectorTileFeature=dl();xa.exports.VectorTileLayer=gl()});var df=ve(Sl=>{Sl.read=function(t,e,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=t[e+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+t[e+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+t[e+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};Sl.write=function(t,e,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=f/l:e+=f*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,i),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+y]=a&255,y+=m,a/=256,u-=8);t[r+y-m]|=h*128}});var mi=ve((fA,Pf)=>{"use strict";Pf.exports=J;var Aa=df();function J(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var wl=65536*65536,gf=1/wl,Ob=12,vf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");J.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_a(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xf(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_a(this.buf,this.pos)+_a(this.buf,this.pos+4)*wl;return this.pos+=8,t},readSFixed64:function(){var t=_a(this.buf,this.pos)+xf(this.buf,this.pos+4)*wl;return this.pos+=8,t},readFloat:function(){var t=Aa.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Aa.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Gb(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Ob&&vf?ex(this.buf,e,t):Qb(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==J.Bytes)return t.push(this.readVarint(e));var r=mt(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==J.Bytes)return t.push(this.readSVarint());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==J.Bytes)return t.push(this.readBoolean());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==J.Bytes)return t.push(this.readFloat());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==J.Bytes)return t.push(this.readDouble());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed32());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==J.Bytes)return t.push(this.readSFixed64());var e=mt(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===J.Varint)for(;this.buf[this.pos++]>127;);else if(e===J.Bytes)this.pos=this.readVarint()+this.pos;else if(e===J.Fixed32)this.pos+=4;else if(e===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Gr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Gr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Nb(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=tx(this.buf,t,this.pos);var r=this.pos-e;r>=128&&bf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Aa.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Aa.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&bf(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,J.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,jb,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,qb,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Hb,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Wb,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Xb,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Zb,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Jb,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Yb,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Kb,e)},writeBytesField:function(t,e){this.writeTag(t,J.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,J.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,J.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,J.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,J.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,J.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,J.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};function Gb(t,e,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Or(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function mt(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Or(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Nb(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),Ub(r,n,e),$b(n,e)}function Ub(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function $b(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function bf(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function jb(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function qb(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Wb(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Xb(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Hb(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Zb(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Jb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Yb(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Kb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function _a(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Gr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function xf(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Qb(t,e,r){for(var n="",i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=t[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=t[i+1],u=t[i+2],c=t[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function ex(t,e,r){return vf.decode(t.subarray(e,r))}function tx(t,e,r){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=i;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var gy=ve((iT,dy)=>{dy.exports=Ha;function Ha(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Ha(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Ha(t.geometries[n],e);else if(r==="Feature")Ha(t.geometry,e);else if(r==="Polygon")my(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)my(t.coordinates[n],e);return t}function my(t,e){if(t.length!==0){hy(t[0],e);for(var r=1;r<t.length;r++)hy(t[r],!e)}}function hy(t,e){for(var r=0,n=0,i=0,o=t.length,a=o-1;i<o;a=i++){var s=(t[i][0]-t[a][0])*(t[a][1]+t[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!e&&t.reverse()}});var Py=ve((sT,vy)=>{"use strict";var Ux=ye(),$x=Rt().VectorTileFeature;vy.exports=xy;function xy(t,e){this.options=e||{},this.features=t,this.length=t.length}xy.prototype.feature=function(t){return new Ja(this.features[t],this.options.extent)};function Ja(t,e){this.id=typeof t.id=="number"?t.id:void 0,this.type=t.type,this.rawGeometry=t.type===1?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}Ja.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new Ux(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Ja.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]};Ja.prototype.toGeoJSON=$x.prototype.toGeoJSON});var Ay=ve((lT,Fi)=>{var jx=mi(),wy=Py();Fi.exports=Ul;Fi.exports.fromVectorTileJs=Ul;Fi.exports.fromGeojsonVt=qx;Fi.exports.GeoJSONWrapper=wy;function Ul(t){var e=new jx;return Wx(t,e),e.finish()}function qx(t,e){e=e||{};var r={};for(var n in t)r[n]=new wy(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ul({layers:r})}function Wx(t,e){for(var r in t.layers)e.writeMessage(3,Xx,t.layers[r])}function Xx(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,Hx,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,Yx,o[r])}function Hx(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Zx,t),e.writeVarintField(3,r.type),e.writeMessage(4,Jx,r)}function Zx(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u>"u"&&(n.push(s),u=n.length-1,o[s]=u),e.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f>"u"&&(i.push(l),f=i.length-1,a[p]=f),e.writeVarint(f)}}}function Nl(t,e){return(e<<3)+(t&7)}function Sy(t){return t<<1^t>>31}function Jx(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),e.writeVarint(Nl(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(Nl(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(Sy(f)),e.writeVarint(Sy(y)),i+=f,o+=y}n===3&&e.writeVarint(Nl(7,1))}}function Yx(t,e){var r=typeof t;r==="string"?e.writeStringField(1,t):r==="boolean"?e.writeBooleanField(7,t):r==="number"&&(t%1!==0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}});var km=Y(ye(),1),Pu=Y(uu(),1);var ls;function cu(){return ls==null&&(ls=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ls}var qi;function pu(){if(qi==null&&(qi=!1,cu())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<25;i++){let o=i*4;r.fillStyle=`rgb(${o},${o+1},${o+2})`,r.fillRect(i%5,Math.floor(i/5),1,1)}let n=r.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!==3&&n[i]!==i){qi=!0;break}}}return qi||!1}var Jr=1e-6,Yr=typeof Float32Array<"u"?Float32Array:Array,Kr=Math.random;var d0=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Wi={};Xy(Wi,{add:()=>em,ceil:()=>tm,clone:()=>Jy,copy:()=>Ky,create:()=>fu,cross:()=>fm,dist:()=>Am,distance:()=>du,div:()=>wm,divide:()=>hu,dot:()=>pm,equals:()=>vm,exactEquals:()=>xm,floor:()=>rm,forEach:()=>Cm,fromValues:()=>Yy,inverse:()=>um,len:()=>Im,length:()=>bu,lerp:()=>ym,max:()=>im,min:()=>nm,mul:()=>Sm,multiply:()=>mu,negate:()=>lm,normalize:()=>cm,random:()=>mm,round:()=>om,scale:()=>am,scaleAndAdd:()=>sm,set:()=>Qy,sqrDist:()=>_m,sqrLen:()=>Tm,squaredDistance:()=>gu,squaredLength:()=>xu,str:()=>bm,sub:()=>Pm,subtract:()=>yu,transformMat4:()=>hm,transformQuat:()=>dm,zero:()=>gm});function fu(){var t=new Yr(4);return Yr!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Jy(t){var e=new Yr(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Yy(t,e,r,n){var i=new Yr(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Ky(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Qy(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function em(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function yu(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function mu(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function hu(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function tm(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function rm(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function nm(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function im(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function om(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function am(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function sm(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}function du(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return Math.hypot(r,n,i,o)}function gu(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function bu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function xu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function lm(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function um(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function cm(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a,t}function pm(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function fm(t,e,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=e[0],p=e[1],f=e[2],y=e[3];return t[0]=p*u-f*l+y*s,t[1]=-(c*u)+f*a-y*o,t[2]=c*l-p*a+y*i,t[3]=-(c*s)+p*o-f*i,t}function ym(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t[3]=s+n*(r[3]-s),t}function mm(t,e){e=e||1;var r,n,i,o,a,s;do r=Kr()*2-1,n=Kr()*2-1,a=r*r+n*n;while(a>=1);do i=Kr()*2-1,o=Kr()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*i*l,t[3]=e*o*l,t}function hm(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}function dm(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return t[0]=c*u+y*-a+p*-l-f*-s,t[1]=p*u+y*-s+f*-a-c*-l,t[2]=f*u+y*-l+c*-s-p*-a,t[3]=e[3],t}function gm(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function bm(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function xm(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function vm(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(r-a)<=Jr*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Jr*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Jr*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Jr*Math.max(1,Math.abs(o),Math.abs(u))}var Pm=yu,Sm=mu,wm=hu,Am=du,_m=gu,Im=bu,Tm=xu,Cm=(function(){var t=fu();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,e.length):l=e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}})();function Su(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Em(t,e,r,n){let i=new Pu.default(t,e,r,n);return o=>i.solve(o)}var A0=Em(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function wu(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function de(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function Au(t){return Math.log(t)/Math.LN2%1===0}function tn(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function _u(t,e,r){let n={};for(let i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function nt(t){return Array.isArray(t)?t.map(nt):typeof t=="object"&&t?tn(t,nt):t}var vu={};function ce(t){vu[t]||(typeof console<"u"&&console.warn(t),vu[t]=!0)}function ot(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function at(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function vt(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function Mm(t,e,r,n,i){let o=Math.max(-e,0)*4,l=(Math.max(0,r)-r)*n*4+o,u=n*4,c=Math.max(0,e),p=Math.max(0,r),f=Math.min(t.width,e+n),y=Math.min(t.height,r+i);return{rect:{x:c,y:p,width:f-c,height:y-p},layout:[{offset:l,stride:u}]}}async function Lm(t,e,r,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(t,{timestamp:0});try{let a=o?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Mm(t,e,r,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}var Qr,en;function Fm(t,e,r,n,i){let o=t.width,a=t.height;(!Qr||!en)&&(Qr=new OffscreenCanvas(o,a),en=Qr.getContext("2d",{willReadFrequently:!0})),Qr.width=o,Qr.height=a,en.drawImage(t,0,0,o,a);let s=en.getImageData(e,r,n,i);return en.clearRect(0,0,o,a),s.data}async function Iu(t,e,r,n,i){if(pu())try{return await Lm(t,e,r,n,i)}catch{}return Fm(t,e,r,n,i)}function us(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}function cs(t){return t*Math.PI/180}var Xi=25,Hi=0;var $t=class t{constructor(e,r,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;let o=n/r*e;this.min=-o,this.max=e+o}insert(e,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,n,i,o,a){this.cells[o].push(a)}query(e,r,n,i,o){let a=this.min,s=this.max;if(e<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,r,n,i,this._queryCell,l,u,o),l}}_queryCell(e,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):e<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,r,n,i,h,a,s,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<e.length;a++){let s=e[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,r){let n=e.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(e){return new t(e.buffer)}};var Dm=8,Vm={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Bm={"*":{type:"source"}},Rm=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],zm={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Om={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Gm={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Nm={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},Um={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},$m={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},jm={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},qm=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Wm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xm={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Hm={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Zm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Jm={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ym={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Km={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eh={type:"array",value:"*"},th={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},rh={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},nh={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},ih={type:"array",value:"*",minimum:1},oh={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},ah={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sh={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},lh={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},uh=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],ch={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},ph={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},fh={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},yh={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},mh={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},hh={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},dh={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},gh={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},bh={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},xh={"*":{type:"string"}},P={$version:Dm,$root:Vm,sources:Bm,source:Rm,source_vector:zm,source_raster:Om,source_raster_dem:Gm,source_geojson:Nm,source_video:Um,source_image:$m,layer:jm,layout:qm,layout_background:Wm,layout_fill:Xm,layout_circle:Hm,layout_heatmap:Zm,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Jm,layout_symbol:Ym,layout_raster:Km,layout_hillshade:Qm,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:eh,filter_operator:th,geometry_type:rh,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:nh,expression:ih,light:oh,sky:ah,terrain:sh,projection:lh,paint:uh,paint_fill:ch,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:ph,paint_circle:fh,paint_heatmap:yh,paint_symbol:mh,paint_raster:hh,paint_hillshade:dh,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:gh,transition:bh,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:xh},vh=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var C=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function xr(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var Be=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},vs=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},wr={kind:"null"},k={kind:"number"},$={kind:"string"},U={kind:"boolean"},ze={kind:"color"},yo={kind:"projectionDefinition"},Wt={kind:"object"},N={kind:"value"},Ph={kind:"error"},mo={kind:"collator"},Ar={kind:"formatted"},ho={kind:"padding"},an={kind:"colorArray"},go={kind:"numberArray"},vn={kind:"resolvedImage"},bo={kind:"variableAnchorOffsetCollection"};function Ce(t,e){return{kind:"array",itemType:t,N:e}}function ie(t){if(t.kind==="array"){let e=ie(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var Sh=[wr,k,$,U,ze,yo,Ar,Wt,Ce(N),ho,go,an,vn,bo];function sn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!sn(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of Sh)if(!sn(r,e))return null}}return`Expected ${ie(t)} but found ${ie(e)} instead.`}function zs(t,e){return e.some(r=>r.kind===t.kind)}function Xt(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Pt(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var Xu=.96422,Hu=1,Zu=.82521,Ju=4/29,br=6/29,Yu=3*br*br,wh=br*br*br,Ah=Math.PI/180,_h=180/Math.PI;function Ku(t){return t=t%360,t<0&&(t+=360),t}function Qu([t,e,r,n]){t=ps(t),e=ps(e),r=ps(r);let i,o,a=fs((.2225045*t+.7168786*e+.0606169*r)/Hu);t===e&&e===r?i=o=a:(i=fs((.4360747*t+.3850649*e+.1430804*r)/Xu),o=fs((.0139322*t+.0971045*e+.7141733*r)/Zu));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function ps(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fs(t){return t>wh?Math.pow(t,1/3):t/Yu+Ju}function ec([t,e,r,n]){let i=(t+16)/116,o=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=Hu*ms(i),o=Xu*ms(o),a=Zu*ms(a),[ys(3.1338561*o-1.6168667*i-.4906146*a),ys(-.9787684*o+1.9161415*i+.033454*a),ys(.0719453*o-.2289914*i+1.4052427*a),n]}function ys(t){return t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055,t<0?0:t>1?1:t}function ms(t){return t>br?t*t*t:Yu*(t-Ju)}function Ih(t){let[e,r,n,i]=Qu(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Ku(Math.atan2(n,r)*_h):NaN,o,e,i]}function Th([t,e,r,n]){return t=isNaN(t)?0:t*Ah,ec([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Ch([t,e,r,n]){t=Ku(t),e/=100,r/=100;function i(o){let a=(o+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}var kh=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function nn(t,e){return kh(t,e)?t[e]:void 0}function Eh(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=nn(Mh,t);if(e){let[i,o,a]=e;return[i/255,o/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let o=t.length<6?1:2,a=1;return[Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+o)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=t.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,g,d]=o,x=[u||" ",f||" ",h].join("");if(x===" "||x===" /"||x===",,"||x===",,,"){let b=[l,p,m].join(""),v=b==="%%%"?100:b===""?255:0;if(v){let S=[dr(+s/v,0,1),dr(+c/v,0,1),dr(+y/v,0,1),g?Tu(+g,d):1];if(Cu(S))return S}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=t.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,dr(+s,0,100),dr(+u,0,100),p?Tu(+p,f):1];if(Cu(m))return Ch(m)}}}function Zi(t){return parseInt(t.padEnd(2,t),16)/255}function Tu(t,e){return dr(e?t/100:t,0,1)}function dr(t,e,r){return Math.min(Math.max(e,t),r)}function Cu(t){return!t.some(Number.isNaN)}var Mh={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function wt(t,e,r){return t+r*(e-t)}function vr(t,e,r){return t.map((n,i)=>wt(n,e[i],r))}function Lh(t){return t==="rgb"||t==="hcl"||t==="lab"}var H=class t{constructor(e,r,n,i=1,o=!0){this.r=e,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,r,n,i]))}static parse(e){if(e instanceof t)return e;if(typeof e!="string")return;let r=Eh(e);if(r)return new t(...r,!1)}get rgb(){let{r:e,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[e/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",Ih(this.rgb))}get lab(){return this.overwriteGetter("lab",Qu(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(o=>Math.round(o*255)).join(",")},${i})`}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,l]=vr(e.rgb,r.rgb,n);return new t(o,a,s,l,!1)}case"hcl":{let[o,a,s,l]=e.hcl,[u,c,p,f]=r.hcl,y,m;if(!isNaN(o)&&!isNaN(u)){let b=u-o;u>o&&b>180?b-=360:u<o&&o-u>180&&(b+=360),y=o+n*b}else isNaN(o)?isNaN(u)?y=NaN:(y=u,(s===1||s===0)&&(m=c)):(y=o,(p===1||p===0)&&(m=a));let[h,g,d,x]=Th([y,m??wt(a,c,n),wt(s,p,n),wt(l,f,n)]);return new t(h,g,d,x,!1)}case"lab":{let[o,a,s,l]=ec(vr(e.lab,r.lab,n));return new t(o,a,s,l,!1)}}}};H.black=new H(0,0,0,1);H.white=new H(1,1,1,1);H.transparent=new H(0,0,0,0);H.red=new H(1,0,0,1);var ln=class{constructor(e,r,n){e?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Fh=["bottom","center","top"],un=class{constructor(e,r,n,i,o,a){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o,this.verticalAlign=a}},Ee=class t{constructor(e){this.sections=e}static fromString(e){return new t([new un(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof t?e:t.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Oe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(vr(e.values,r.values,n))}},Ge=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="number")return new t([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){return new t(vr(e.values,r.values,n))}},Pe=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="string"){let n=H.parse(e);return n?new t([n]):void 0}if(!Array.isArray(e))return;let r=[];for(let n of e){if(typeof n!="string")return;let i=H.parse(n);if(!i)return;r.push(i)}return new t(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n,i="rgb"){let o=[];if(e.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)o.push(H.interpolate(e.values[a],r.values[a],n,i));return new t(o)}},ne=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},Dh=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Me=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let r=0;r<e.length;r+=2){let n=e[r],i=e[r+1];if(typeof n!="string"||!Dh.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new t(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,n){let i=e.values,o=r.values;if(i.length!==o.length)throw new ne(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`);let a=[];for(let s=0;s<i.length;s+=2){if(i[s]!==o[s])throw new ne(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${i[s]}, to[${s}]: ${o[s]}`);a.push(i[s]);let[l,u]=i[s+1],[c,p]=o[s+1];a.push([wt(l,c,n),wt(u,p,n)])}return new t(a)}},Se=class t{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new t({name:e,available:!1}):null}},At=class t{constructor(e,r,n){this.from=e,this.to=r,this.transition=n}static interpolate(e,r,n){return new t(e,r,n)}static parse(e){if(e instanceof t)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new t(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new t(e.from,e.to,e.transition);if(typeof e=="string")return new t(e,e,1)}};function tc(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function cn(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof At||t instanceof H||t instanceof ln||t instanceof Ee||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Me||t instanceof Se)return!0;if(Array.isArray(t)){for(let e of t)if(!cn(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!cn(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return wr;if(typeof t=="string")return $;if(typeof t=="boolean")return U;if(typeof t=="number")return k;if(t instanceof H)return ze;if(t instanceof At)return yo;if(t instanceof ln)return mo;if(t instanceof Ee)return Ar;if(t instanceof Oe)return ho;if(t instanceof Ge)return go;if(t instanceof Pe)return an;if(t instanceof Me)return bo;if(t instanceof Se)return vn;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ue(n);if(!r)r=i;else{if(r===i)continue;r=N;break}}return Ce(r||N,e)}else return Wt}function on(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof H||t instanceof At||t instanceof Ee||t instanceof Oe||t instanceof Ge||t instanceof Pe||t instanceof Me||t instanceof Se?t.toString():JSON.stringify(t)}var _t=class t{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!cn(e[1]))return r.error("invalid value");let n=e[1],i=ue(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Ji={string:$,number:k,boolean:U,object:Wt},$e=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=1,i,o=e[0];if(o==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in Ji)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Ji[u],n++}else s=N;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],n++}i=Ce(s,l)}else{if(!Ji[o])throw new Error(`Types doesn\'t contain name = ${o}`);i=Ji[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[n],n,N);if(!s)return null;a.push(s)}return new t(i,a)}evaluate(e){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(e);if(sn(this.type,ue(n))){if(r===this.args.length-1)throw new ne(`Expected value to be of type ${ie(this.type)}, but found ${ie(ue(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},ku={"to-boolean":U,"to-color":ze,"to-number":k,"to-string":$},St=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[0];if(!ku[n])throw new Error(`Can\'t parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=ku[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,N);if(!s)return null;o.push(s)}return new t(i,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(e),n=null,r instanceof H)return r;if(typeof r=="string"){let o=e.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n=`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=tc(r[0],r[1],r[2],r[3]),!n))return new H(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ne(n||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=Oe.parse(r);if(i)return i}throw new ne(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"numberArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ge.parse(r);if(i)return i}throw new ne(`Could not parse numberArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"colorArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Pe.parse(r);if(i)return i}throw new ne(`Could not parse colorArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=Me.parse(r);if(i)return i}throw new ne(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new ne(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Ee.fromString(on(this.args[0].evaluate(e)));case"resolvedImage":return Se.fromString(on(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return on(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Vh=["Unknown","Point","LineString","Polygon"],eo=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Vh[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache.get(e);return r||(r=H.parse(e),this._parseColorCache.set(e,r)),r}},to=class t{constructor(e,r,n=[],i,o=new vs,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${s}]`).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,o={}){return r?this.concat(r,n,i)._parse(e,o):this._parse(e,o)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new $e(o,[i]):a==="coerce"?new St(o,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=e[0];if(typeof i!="string")return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(l.kind)||s.kind==="colorArray"&&["value","string","array"].includes(l.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof _t)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new eo;try{a=new _t(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new Be(n,e))}checkSubtype(e,r){let n=sn(e,r);return n&&this.error(n),n}},ro=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return r.error(`Expected string, but found ${typeof a} instead.`,o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},no=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Ps=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,k),i=r.parse(e[2],2,Ce(r.expectedType||N));if(!n||!i)return null;let o=i.type;return new t(o.itemType,n,i)}evaluate(e){let r=this.index.evaluate(e),n=this.input.evaluate(e);if(r<0)throw new ne(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new ne(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new ne(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ss=class t{constructor(e,r){this.type=U,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);return!n||!i?null:zs(n.type,[U,$,k,wr,N])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);if(!Xt(n,["string","array"]))throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},ws=class t{constructor(e,r,n){this.type=k,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);if(!n||!i)return null;if(!zs(n.type,[U,$,k,wr,N]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n,i,o):null}else return new t(n,i)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Xt(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Xt(n,["array"]))return n.indexOf(r,i);throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},As=class t{constructor(e,r,n,i,o,a){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=ue(m);else if(f.checkSubtype(n,ue(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(e[1],1,N);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new t(n,i,s,o,a,l)}evaluate(e){let r=this.input.evaluate(e);return(ue(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},_s=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=r.parse(e[a],a,U);if(!s)return null;let l=r.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new t(n,i,o)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},Is=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,k);if(!n||!i)return null;if(!zs(n.type,[Ce(N),$,N]))return r.error(`Expected first argument to be of type array or string, but found ${ie(n.type)} instead`);if(e.length===4){let o=r.parse(e[3],3,k);return o?new t(n.type,n,i,o):null}else return new t(n.type,n,i)}evaluate(e){let r=this.input.evaluate(e),n=this.beginIndex.evaluate(e),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),Xt(r,["string"]))return[...r].slice(n,i).join("");if(Xt(r,["array"]))return r.slice(n,i);throw new ne(`Expected first argument to be of type array or string, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function xo(t,e){let r=t.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=t[o],s=t[o+1],a<=e){if(o===r||e<s)return o;n=o+1}else if(a>e)i=o-1;else throw new ne("Input is not a number.");return 0}var Pr=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,k);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],l=e[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new t(o,n,i)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=xo(r,i);return n[a].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Bh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hs,Eu;function Rh(){if(Eu)return hs;Eu=1,hs=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<r)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,l=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<r));i++)e>o?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},hs}var zh=Rh(),Oh=Bh(zh),ke=class t{constructor(e,r,n,i,o){this.type=e,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,r,n,i){let o=0;if(e.name==="exponential")o=ds(r,e.base,n,i);else if(e.name==="linear")o=ds(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Oh(a[0],a[1],a[2],a[3]).solve(ds(r,1,n,i))}return o}static parse(e,r){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,k),!o)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&r.expectedType!=an?l=ze:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Pt(l,k)&&!Pt(l,yo)&&!Pt(l,ze)&&!Pt(l,ho)&&!Pt(l,go)&&!Pt(l,an)&&!Pt(l,bo)&&!Pt(l,Ce(k))?r.error(`Type ${ie(l)} is not interpolatable.`):new t(l,n,i,o,s)}evaluate(e){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(e);let i=this.input.evaluate(e);if(i<=r[0])return n[0].evaluate(e);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(e);let a=xo(r,i),s=r[a],l=r[a+1],u=t.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(e),p=n[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return wt(c,p,u);case"color":return H.interpolate(c,p,u);case"padding":return Oe.interpolate(c,p,u);case"colorArray":return Pe.interpolate(c,p,u);case"numberArray":return Ge.interpolate(c,p,u);case"variableAnchorOffsetCollection":return Me.interpolate(c,p,u);case"array":return vr(c,p,u);case"projectionDefinition":return At.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"hcl");case"colorArray":return Pe.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return H.interpolate(c,p,u,"lab");case"colorArray":return Pe.interpolate(c,p,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function ds(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var lt={color:H.interpolate,number:wt,padding:Oe.interpolate,numberArray:Ge.interpolate,colorArray:Pe.interpolate,variableAnchorOffsetCollection:Me.interpolate,array:vr},io=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>sn(i,s.type))?new t(N,o):new t(n,o)}evaluate(e){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(e),r&&r instanceof Se&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function Mu(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Gh(t,e,r){return e===r}function Nh(t,e,r){return e!==r}function Uh(t,e,r){return e<r}function $h(t,e,r){return e>r}function jh(t,e,r){return e<=r}function qh(t,e,r){return e>=r}function rc(t,e,r,n){return n.compare(e,r)===0}function Wh(t,e,r,n){return!rc(t,e,r,n)}function Xh(t,e,r,n){return n.compare(e,r)<0}function Hh(t,e,r,n){return n.compare(e,r)>0}function Zh(t,e,r,n){return n.compare(e,r)<=0}function Jh(t,e,r,n){return n.compare(e,r)>=0}function _r(t,e,r){let n=t!=="=="&&t!=="!=";return class nc{constructor(o,a,s){this.type=U,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,N);if(!l)return null;if(!Mu(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type \'${ie(l.type)}\'.`);let u=a.parse(o[2],2,N);if(!u)return null;if(!Mu(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type \'${ie(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types \'${ie(l.type)}\' and \'${ie(u.type)}\'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new $e(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new $e(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,mo),!c)return null}return new nc(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new ne(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):e(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var Yh=_r("==",Gh,rc),Kh=_r("!=",Nh,Wh),Qh=_r("<",Uh,Xh),ed=_r(">",$h,Hh),td=_r("<=",jh,Zh),rd=_r(">=",qh,Jh),oo=class t{constructor(e,r,n){this.type=mo,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let n=e[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,U);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,U);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,$),!a)?null:new t(i,o,a)}evaluate(e){return new ln(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},Ts=class t{constructor(e,r,n,i,o){this.type=$,this.number=e,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let n=r.parse(e[1],1,k);if(!n)return null;let i=e[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,$),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,$),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,k),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,k),!l)?null:new t(n,o,a,s,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},pn=class t{constructor(e){this.type=Ar,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=e[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=e.length-1;++a){let s=e[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,k),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ce($)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,ze),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!Fh.includes(s["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${s["vertical-align"]}\' instead.`);if(p=r.parse(s["vertical-align"],1,$),!p)return null}let f=i[i.length-1];f.scale=l,f.font=u,f.textColor=c,f.verticalAlign=p}else{let l=r.parse(e[a],1,N);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return ue(i)===vn?new un("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new un(on(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null,n.verticalAlign?n.verticalAlign.evaluate(e):null)};return new Ee(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}},Cs=class t{constructor(e){this.type=vn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,$);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Se.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},ks=class t{constructor(e){this.type=k,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ie(n.type)} instead.`):new t(n):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ne(`Expected value to be of type string or array, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},He=8192;function nd(t,e){let r=id(t[0]),n=ad(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*He),Math.round(n*i*He)]}function Os(t,e){let r=Math.pow(2,e.z),n=(t[0]/He+e.x)/r,i=(t[1]/He+e.y)/r;return[od(n),sd(i)]}function id(t){return(180+t)/360}function od(t){return t*360-180}function ad(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function sd(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Pn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function fn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ld(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function ud(t,e,r){let n=t[0]-e[0],i=t[1]-e[1],o=t[0]-r[0],a=t[1]-r[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function vo(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return yd(o,i)===0?!1:!!(Lu(t,e,r,n)&&Lu(r,n,t,e))}function cd(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(vo(t,e,n[i],n[i+1]))return!0;return!1}function Ir(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(ud(t,i[o],i[o+1]))return r;ld(t,i[o],i[o+1])&&(n=!n)}return n}function pd(t,e){for(let r of e)if(Ir(t,r))return!0;return!1}function ic(t,e){for(let r of t)if(!Ir(r,e))return!1;for(let r=0;r<t.length-1;++r)if(cd(t[r],t[r+1],e))return!1;return!0}function fd(t,e){for(let r of e)if(ic(t,r))return!0;return!1}function yd(t,e){return t[0]*e[1]-t[1]*e[0]}function Lu(t,e,r,n){let i=t[0]-r[0],o=t[1]-r[1],a=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function Gs(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=[];for(let a=0;a<t[i].length;a++){let s=nd(t[i][a],r);Pn(e,s),o.push(s)}n.push(o)}return n}function oc(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Gs(t[i],e,r);n.push(o)}return n}function ac(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){let i=n*.5,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;o===0&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}Pn(e,t)}function md(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function Fu(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];ac(u,e,r,i),a.push(u)}return a}function Du(t,e,r,n){let i=Math.pow(2,n.z)*He,o=[n.x*He,n.y*He],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Pn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){md(e);for(let s of a)for(let l of s)ac(l,e,r,i)}return a}function hd(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Gs(e.coordinates,n,i),a=Fu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!Ir(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Fu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!pd(s,o))return!1}return!0}function dd(t,e){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(e.type==="Polygon"){let o=Gs(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!ic(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!fd(s,o))return!1}return!0}var yn=class t{constructor(e,r){this.type=U,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new t(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return hd(e,this.geometries);if(e.geometryType()==="LineString")return dd(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},ao=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};function sc(t,e,r=0,n=t.length-1,i=gd){for(;n>r;){if(n-r>600){let l=n-r+1,u=e-r+1,c=Math.log(l),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),y=Math.max(r,Math.floor(e-u*p/l+f)),m=Math.min(n,Math.floor(e+(l-u)*p/l+f));sc(t,e,y,m,i)}let o=t[e],a=r,s=n;for(rn(t,r,e),i(t[n],o)>0&&rn(t,r,n);a<s;){for(rn(t,a,s),a++,s--;i(t[a],o)<0;)a++;for(;i(t[s],o)>0;)s--}i(t[r],o)===0?rn(t,r,s):(s++,rn(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function rn(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function gd(t,e){return t<e?-1:t>e?1:0}function Yt(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=xd(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(sc(n[a],e,1,n[a].length-1,bd),n[a]=n[a].slice(0,e));return n}function bd(t,e){return e.area-t.area}function xd(t){let e=0;for(let r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}var vd=6378.137,Vu=1/298.257223563,Bu=Vu*(2-Vu),Ru=Math.PI/180,mn=class{constructor(e){let r=Ru*vd*1e3,n=Math.cos(e*Ru),i=1/(1-Bu*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-Bu)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,f=(e[l+1][1]-c)*this.ky,y=0;(p!==0||f!==0)&&(y=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*f)/(p*p+f*f),y>1?(u=e[l+1][0],c=e[l+1][1]):y>0&&(u+=p/this.kx*y,c+=f/this.ky*y)),p=this.wrap(r[0]-u)*this.kx,f=(r[1]-c)*this.ky;let m=p*p+f*f;m<n&&(n=m,i=u,o=c,a=l,s=y)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Es=100,Ms=50;function lc(t,e){return e[0]-t[0]}function so(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function Ls(t,e){if(t[0]>t[1])return[null,null];let r=so(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function Fs(t,e){if(!st(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Pn(r,t[n]);return r}function Ds(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Pn(e,n);return e}function zu(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ns(t,e,r){if(!zu(t)||!zu(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function qt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Us(t,e,r,n,i){let o=Math.min(qt(t,[r,n],i),qt(e,[r,n],i)),a=Math.min(qt(r,[t,e],i),qt(n,[t,e],i));return Math.min(o,a)}function Pd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],f=r[c+1];if(vo(l,u,p,f))return 0;a=Math.min(a,Us(l,u,p,f,i))}}return a}function Sd(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(a=Math.min(a,i.distance(t[s],r[l])),a===0)return a;return a}function wd(t,e,r){if(Ir(t,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,qt(t,[a,o],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function Ad(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Ir(t[o],r,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=t[o],s=t[o+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let f=l[p],y=l[u];if(vo(a,s,f,y))return 0;i=Math.min(i,Us(a,s,f,y,n))}}return i}function Ou(t,e){for(let r of t)for(let n of r)if(Ir(n,e,!0))return!0;return!1}function _d(t,e,r,n=1/0){let i=Ds(t),o=Ds(e);if(n!==1/0&&Ns(i,o,r)>=n)return n;if(fn(i,o)){if(Ou(t,e))return 0}else if(Ou(e,t))return 0;let a=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],f=s[l];for(let y of e)for(let m=0,h=y.length,g=h-1;m<h;g=m++){let d=y[g],x=y[m];if(vo(p,f,d,x))return 0;a=Math.min(a,Us(p,f,d,x,r))}}return a}function Gu(t,e,r,n,i,o){if(!o)return;let a=Ns(Fs(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function Yi(t,e,r,n,i,o,a){if(!o||!a)return;let s=Ns(Fs(n,o),Fs(i,a),r);s<e&&t.push([s,o,a])}function lo(t,e,r,n,i=1/0){let o=Math.min(n.distance(t[0],r[0][0]),i);if(o===0)return o;let a=new ao([[0,[0,t.length-1],[0,0]]],lc),s=Ds(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Ms:Es;if(so(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Ad(t,u,r,n);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let f=wd(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=Ls(u,e);Gu(a,o,n,t,s,p[0]),Gu(a,o,n,t,s,p[1])}}return o}function uo(t,e,r,n,i,o=1/0){let a=Math.min(o,i.distance(t[0],r[0]));if(a===0)return a;let s=new ao([[0,[0,t.length-1],[0,r.length-1]]],lc);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Ms:Es,f=n?Ms:Es;if(so(u)<=p&&so(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Pd(t,u,r,c,i),a=Math.min(a,y);else if(e&&!n){let m=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(y=qt(r[h],m,i),a=Math.min(a,y),a===0)return a}else if(!e&&n){let m=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(y=qt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=Sd(t,u,r,c,i),a=Math.min(a,y)}else{let y=Ls(u,e),m=Ls(c,n);Yi(s,a,i,t,r,y[0],m[0]),Yi(s,a,i,t,r,y[0],m[1]),Yi(s,a,i,t,r,y[1],m[0]),Yi(s,a,i,t,r,y[1],m[1])}}return a}function Id(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Td(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Cd(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Yt(r,0).map(a=>a.map(s=>s.map(l=>Os([l.x,l.y],t.canonical)))),i=new mn(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,lo([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,lo(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,_d(s,a.coordinates,i,o));break}if(o===0)return o}return o}function gs(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var hn=class t{constructor(e,r){this.type=k,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>gs(i.geometry)).flat());if(n.type==="Feature")return new t(n,gs(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,gs(n))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Id(e,this.geometries);if(e.geometryType()==="LineString")return Td(e,this.geometries);if(e.geometryType()==="Polygon")return Cd(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},dn=class t{constructor(e){this.type=N,this.key=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?r.error("Global state property must be defined."):typeof n!="string"?r.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new t(n)}evaluate(e){var r;let n=(r=e.globals)===null||r===void 0?void 0:r.globalState;return!n||Object.keys(n).length===0?null:nn(n,this.key)}eachChild(){}outputDefined(){return!1}},Kt={"==":Yh,"!=":Kh,">":ed,"<":Qh,">=":rd,"<=":td,array:$e,at:Ps,boolean:$e,case:_s,coalesce:io,collator:oo,format:pn,image:Cs,in:Ss,"index-of":ws,interpolate:ke,"interpolate-hcl":ke,"interpolate-lab":ke,length:ks,let:ro,literal:_t,match:As,number:$e,"number-format":Ts,object:$e,slice:Is,step:Pr,string:$e,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:no,within:yn,distance:hn,"global-state":dn},Ze=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new to(r.registry,co,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],h=Array.isArray(u)?u[y-1]:u.type,g=l.parse(m,1+p.length,h);if(!g){f=!0;break}p.push(g)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new t(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Ed(f)).join(" | "),p=[];for(let f=1;f<e.length;f++){let y=r.parse(e[f],1+p.length);if(!y)return null;p.push(ie(y.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function Nu(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);let o=i?i.evaluate(t):1,a=tc(e,r,n,o);if(a)throw new ne(a);return new H(e/255,r/255,n/255,o,!1)}function Uu(t,e){return t in e}function bs(t,e){let r=e[t];return typeof r>"u"?null:r}function kd(t,e,r,n){for(;r<=n;){let i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}function jt(t){return{type:t}}Ze.register(Kt,{error:[Ph,[$],(t,[e])=>{throw new ne(e.evaluate(t))}],typeof:[$,[N],(t,[e])=>ie(ue(e.evaluate(t)))],"to-rgba":[Ce(k,4),[ze],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[ze,[k,k,k],Nu],rgba:[ze,[k,k,k,k],Nu],has:{type:U,overloads:[[[$],(t,[e])=>Uu(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>Uu(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[$],(t,[e])=>bs(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>bs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[$],(t,[e])=>bs(e.evaluate(t),t.featureState||{})],properties:[Wt,[],t=>t.properties()],"geometry-type":[$,[],t=>t.geometryType()],id:[N,[],t=>t.id()],zoom:[k,[],t=>t.globals.zoom],"heatmap-density":[k,[],t=>t.globals.heatmapDensity||0],elevation:[k,[],t=>t.globals.elevation||0],"line-progress":[k,[],t=>t.globals.lineProgress||0],accumulated:[N,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[k,jt(k),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[k,jt(k),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:k,overloads:[[[k,k],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[k],(t,[e])=>-e.evaluate(t)]]},"/":[k,[k,k],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[k,[k,k],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[k,[],()=>Math.LN2],pi:[k,[],()=>Math.PI],e:[k,[],()=>Math.E],"^":[k,[k,k],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[k,[k],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[k,[k],(t,[e])=>Math.log(e.evaluate(t))],log2:[k,[k],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[k,[k],(t,[e])=>Math.sin(e.evaluate(t))],cos:[k,[k],(t,[e])=>Math.cos(e.evaluate(t))],tan:[k,[k],(t,[e])=>Math.tan(e.evaluate(t))],asin:[k,[k],(t,[e])=>Math.asin(e.evaluate(t))],acos:[k,[k],(t,[e])=>Math.acos(e.evaluate(t))],atan:[k,[k],(t,[e])=>Math.atan(e.evaluate(t))],min:[k,jt(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,jt(k),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[k,[k],(t,[e])=>Math.abs(e.evaluate(t))],round:[k,[k],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[k,[k],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[k,[k],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[$,N],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[N],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[$],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[$,N],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[N],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[N],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Ce($)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ce(N)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[$,Ce(N)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[$,Ce(N)],(t,[e,r])=>kd(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[jt(U),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[jt(U),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[U,[U],(t,[e])=>!e.evaluate(t)],"is-supported-script":[U,[$],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[$,[$],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[$,[$],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[$,jt(N),(t,e)=>e.map(r=>on(r.evaluate(t))).join("")],"resolved-locale":[$,[mo],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Ed(t){return Array.isArray(t)?`(${t.map(ie).join(", ")})`:`(${ie(t.type)}...)`}function co(t){if(t instanceof no)return co(t.boundExpression);if(t instanceof Ze&&t.name==="error")return!1;if(t instanceof oo)return!1;if(t instanceof yn)return!1;if(t instanceof hn)return!1;if(t instanceof dn)return!1;let e=t instanceof St||t instanceof $e,r=!0;return t.eachChild(n=>{e?r=r&&co(n):r=r&&n instanceof _t}),r?Po(t)&&So(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Po(t){if(t instanceof Ze){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof yn||t instanceof hn)return!1;let e=!0;return t.eachChild(r=>{e&&!Po(r)&&(e=!1)}),e}function gn(t){if(t instanceof Ze&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!gn(r)&&(e=!1)}),e}function So(t,e){if(t instanceof Ze&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!So(n,e)&&(r=!1)}),r}function Vs(t){return{result:"success",value:t}}function gr(t){return{result:"error",value:t}}function It(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function uc(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function $s(t){return!!t.expression&&t.expression.interpolated}function j(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function wo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&ue(t)===Wt}function Md(t){return t}function Ld(t){switch(t.type){case"color":return H.parse;case"padding":return Oe.parse;case"numberArray":return Ge.parse;case"colorArray":return Pe.parse;default:return null}}function Fd(t){switch(t){case"exponential":return pc;case"interval":return Vd;case"categorical":return Dd;case"identity":return Bd;default:throw new Error(`Unknown function type "${t}"`)}}function cc(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,o=t.type||($s(e)?"exponential":"interval"),a=Ld(e);if(a&&(t=xr({},t),t.stops&&(t.stops=t.stops.map(c=>[c[0],a(c[1])])),t.default?t.default=a(t.default):t.default=a(e.default)),t.colorSpace&&!Lh(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s=Fd(o),l,u;if(o==="categorical"){l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}if(r){let c={},p=[];for(let m=0;m<t.stops.length;m++){let h=t.stops[m],g=h[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:t.type,property:t.property,default:t.default,stops:[]},p.push(g)),c[g].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,cc(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:ke.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return pc({stops:f,base:t.base},e,m).evaluate(m,h)}}}else if(i){let c=o==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:ke.interpolationFactor.bind(void 0,c),zoomStops:t.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(t,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[t.property]:void 0;return f===void 0?Sn(t.default,e.default):s(t,e,f,l,u)}}}function Sn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Dd(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return Sn(o,t.default,e.default)}function Vd(t,e,r){if(j(r)!=="number")return Sn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let i=xo(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function pc(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return Sn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let o=xo(t.stops.map(c=>c[0]),r),a=Rd(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=lt[e.type]||Md;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,t.colorSpace)}}:u(s,l,a,t.colorSpace)}function Bd(t,e,r){switch(e.type){case"color":r=H.parse(r);break;case"formatted":r=Ee.fromString(r.toString());break;case"resolvedImage":r=Se.fromString(r.toString());break;case"padding":r=Oe.parse(r);break;case"colorArray":r=Pe.parse(r);break;case"numberArray":r=Ge.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return Sn(r,t.default,e.default)}function Rd(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var Ht=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new eo,this._defaultValue=r?Od(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,r,n,i,o,a){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ne(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function wn(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Kt}function Qt(t,e){let r=new to(Kt,co,[],e?zd(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Vs(new Ht(n,e)):gr(r.errors)}var Je=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!gn(r.expression),this.globalStateRefs=Ao(r.expression)}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}},Tt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!gn(r.expression),this.globalStateRefs=Ao(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,r,n,i,o,a)}evaluate(e,r,n,i,o,a){return this._styleExpression.evaluate(e,r,n,i,o,a)}interpolationFactor(e,r,n){return this.interpolationType?ke.interpolationFactor(this.interpolationType,e,r,n):0}};function fc(t){return t._styleExpression!==void 0}function yc(t,e){let r=Qt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Po(n);if(!i&&!It(e))return gr([new Be("","data expressions not supported")]);let o=So(n,["zoom"]);if(!o&&!uc(e))return gr([new Be("","zoom expressions not supported")]);let a=Qi(n);if(!a&&!o)return gr([new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Be)return gr([a]);if(a instanceof ke&&!$s(e))return gr([new Be("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return Vs(i?new Je("constant",r.value):new Je("source",r.value));let s=a instanceof ke?a.interpolation:void 0;return Vs(i?new Tt("camera",r.value,a.labels,s):new Tt("composite",r.value,a.labels,s))}var bn=class t{constructor(e,r){this._parameters=e,this._specification=r,xr(this,cc(this._parameters,this._specification))}static deserialize(e){return new t(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function mc(t,e){if(wo(t))return new bn(t,e);if(wn(t)){let r=yc(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${n.message}`).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=H.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Oe.parse(t):e.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?r=Ge.parse(t):e.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?r=Pe.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=Me.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=At.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function Qi(t){let e=null;if(t instanceof ro)e=Qi(t.result);else if(t instanceof io){for(let r of t.args)if(e=Qi(r),e)break}else(t instanceof Pr||t instanceof ke)&&t.input instanceof Ze&&t.input.name==="zoom"&&(e=t);return e instanceof Be||t.eachChild(r=>{let n=Qi(r);n instanceof Be?e=n:!e&&n?e=new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&n&&e!==n&&(e=new Be("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function Ao(t,e=new Set){return t instanceof dn&&e.add(t.key),t.eachChild(r=>{Ao(r,e)}),e}function zd(t){let e={color:ze,string:$,number:k,enum:$,boolean:U,formatted:Ar,padding:ho,numberArray:go,colorArray:an,projectionDefinition:yo,resolvedImage:vn,variableAnchorOffsetCollection:bo};return t.type==="array"?Ce(e[t.value]||N,t.length):e[t.type]}function Od(t){if(t.type==="color"&&wo(t.default))return new H(0,0,0,0);switch(t.type){case"color":return H.parse(t.default)||null;case"padding":return Oe.parse(t.default)||null;case"numberArray":return Ge.parse(t.default)||null;case"colorArray":return Pe.parse(t.default)||null;case"variableAnchorOffsetCollection":return Me.parse(t.default)||null;case"projectionDefinition":return At.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function js(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!js(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var Gd={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ct(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};js(t)||(t=po(t));let e=Qt(t,Gd);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=hc(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r,getGlobalStateRefs:()=>Ao(e.value.expression)}}}function Nd(t,e){return t<e?-1:t>e?1:0}function hc(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(hc(t[e]))return!0;return!1}function po(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?xs(t[1],t[2],"=="):e==="!="?Ki(xs(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?xs(t[1],t[2],e):e==="any"?Ud(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(po)):e==="none"?["all"].concat(t.slice(1).map(po).map(Ki)):e==="in"?$u(t[1],t.slice(2)):e==="!in"?Ki($u(t[1],t.slice(2))):e==="has"?ju(t[1]):e==="!has"?Ki(ju(t[1])):!0}function xs(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Ud(t){return["any"].concat(t.map(po))}function $u(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Nd)]]:["filter-in-small",t,["literal",e]]}}function ju(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ki(t){return["!",t]}function Bs(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t===void 0||t===null)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(let o of t)i+=`${Bs(o)},`;return`${i}]`}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+=`${JSON.stringify(r[i])}:${Bs(t[r[i]])},`;return`${n}}`}function $d(t){let e="";for(let r of vh)e+=`/${Bs(t[r])}`;return e}function dc(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||$d(t[i]);e&&(e[t[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(t[i])}let n=[];for(let i in r)n.push(r[i]);return n}function gc(t){let e=t.key,r=t.value;return r?[new C(e,r,"constants have been deprecated as of v8")]:[]}function le(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Zt(t){if(Array.isArray(t))return t.map(Zt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Zt(t[r]);return e}return le(t)}function Re(t){let e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=t.validateSpec,l=[],u=j(r);if(u!=="object")return[new C(e,r,`object expected, ${u} found`)];for(let c in r){let p=c.split(".")[0],f=nn(n,p)||n["*"],y;if(nn(i,p))y=i[p];else if(nn(n,p))y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new C(e,r[c],`unknown property "${c}"`));continue}l=l.concat(y({key:(e&&`${e}.`)+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new C(e,r,`missing required property "${c}"`));return l}function qs(t){let e=t.value,r=t.valueSpec,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.key,s=t.arrayElementValidator||n;if(j(e)!=="array")return[new C(a,e,`array expected, ${j(e)} found`)];if(r.length&&e.length!==r.length)return[new C(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new C(a,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:o,key:`${a}[${c}]`}));return u}function _o(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new C(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new C(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new C(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function bc(t){let e=t.valueSpec,r=le(t.value.type),n,i={},o,a,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=j(t.value.stops)==="array"&&j(t.value.stops[0])==="array"&&j(t.value.stops[0][0])==="object",c=Re({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new C(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new C(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!$s(t.valueSpec)&&c.push(new C(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!It(t.valueSpec)?c.push(new C(t.key,t.value,"property functions not supported")):s&&!uc(t.valueSpec)&&c.push(new C(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new C(t.key,t.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new C(h.key,h.value,\'identity function may not have a "stops" property\')];let g=[],d=h.value;return g=g.concat(qs({key:h.key,value:d,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(d)==="array"&&d.length===0&&g.push(new C(h.key,d,"array must have at least one stop")),g}function f(h){let g=[],d=h.value,x=h.key;if(j(d)!=="array")return[new C(x,d,`array expected, ${j(d)} found`)];if(d.length!==2)return[new C(x,d,`array length 2 expected, length ${d.length} found`)];if(u){if(j(d[0])!=="object")return[new C(x,d,`object expected, ${j(d[0])} found`)];if(d[0].zoom===void 0)return[new C(x,d,"object stop key must have zoom")];if(d[0].value===void 0)return[new C(x,d,"object stop key must have value")];if(a&&a>le(d[0].zoom))return[new C(x,d[0].zoom,"stop zoom values must appear in ascending order")];le(d[0].zoom)!==a&&(a=le(d[0].zoom),o=void 0,i={}),g=g.concat(Re({key:`${x}[0]`,value:d[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:_o,value:y}}))}else g=g.concat(y({key:`${x}[0]`,value:d[0],validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},d));return wn(Zt(d[1]))?g.concat([new C(`${x}[1]`,d[1],"expressions are not allowed in function stops.")]):g.concat(h.validateSpec({key:`${x}[1]`,value:d[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,g){let d=j(h.value),x=le(h.value),b=h.value!==null?h.value:g;if(!n)n=d;else if(d!==n)return[new C(h.key,b,`${d} stop domain type must match previous stop domain type ${n}`)];if(d!=="number"&&d!=="string"&&d!=="boolean")return[new C(h.key,b,"stop domain value must be a number, string, or boolean")];if(d!=="number"&&r!=="categorical"){let v=`number expected, ${d} found`;return It(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new C(h.key,b,v)]}return r==="categorical"&&d==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new C(h.key,b,`integer expected, found ${x}`)]:r!=="categorical"&&d==="number"&&o!==void 0&&x<o?[new C(h.key,b,"stop domain values must appear in ascending order")]:(o=x,r==="categorical"&&x in i?[new C(h.key,b,"stop domain values must be unique")]:(i[x]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function Sr(t){let e=(t.expressionContext==="property"?yc:Qt)(Zt(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new C(`${t.key}${n.key}`,t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new C(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!So(r,["zoom","feature-state"]))return[new C(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Po(r))return[new C(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function jd(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new C(r,e,`boolean expected, ${n} found`)]:[]}function Rs(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new C(e,r,`color expected, ${n} found`)]:H.parse(String(r))?[]:[new C(e,r,`color expected, "${r}" found`)]}function xn(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Ws(t){return js(Zt(t.value))?Sr(xr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xc(t)}function xc(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new C(r,e,`array expected, ${j(e)} found`)];let n=t.styleSpec,i,o=[];if(e.length<1)return[new C(r,e,"filter array must have at least 1 element")];switch(o=o.concat(xn({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),le(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&le(e[1])==="$type"&&o.push(new C(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new C(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=j(e[a]),le(e[1])==="$type"?o=o.concat(xn({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new C(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(xc({key:`${r}[${a}]`,value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=j(e[1]),e.length!==2?o.push(new C(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`));break}return o}function vc(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=t.valueSpec||l[s];if(!c)return[new C(r,a,`unknown property "${s}"`)];let p;if(j(a)==="string"&&It(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new C(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \\`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\\`.`)];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new C(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&wo(Zt(a))&&le(a.type)==="identity"&&f.push(new C(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function Pc(t){return vc(t,"paint")}function Sc(t){return vc(t,"layout")}function wc(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;if(j(r)!=="object")return[new C(n,r,`object expected, ${j(r)} found`)];!r.type&&!r.ref&&e.push(new C(n,r,\'either "type" or "ref" is required\'));let a=le(r.type),s=le(r.ref);if(r.id){let l=le(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];le(c.id)===l&&e.push(new C(n,r.id,`duplicate layer id "${r.id}", previously used at line ${c.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new C(n,r[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{le(u.id)===s&&(l=u)}),l?l.ref?e.push(new C(n,r.ref,"ref cannot reference another ref layer")):a=le(l.type):e.push(new C(n,r.ref,`ref layer "${s}" not found`))}else if(a!=="background")if(!r.source)e.push(new C(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&le(l.type);l?u==="vector"&&a==="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&a==="color-relief"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new C(n,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&a!=="hillshade"&&a!=="color-relief"?e.push(new C(n,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new C(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new C(n,r.source,`source "${r.source}" not found`))}return e=e.concat(Re({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Ws,layout(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Sc(xr({layerType:a},u))}}})},paint(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Pc(xr({layerType:a},u))}}})}}})),e}function Jt(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new C(r,e,`string expected, ${n} found`)]:[]}function qd(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,o=i.source_raster_dem,a=t.style,s=[],l=j(n);if(n===void 0)return s;if(l!=="object")return s.push(new C("source_raster_dem",n,`object expected, ${l} found`)),s;let c=le(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let y in n)!c&&p.includes(y)?s.push(new C(y,n[y],`In "${r}": "${y}" is only valid when "encoding" is set to "custom". ${f} encoding found`)):o[y]?s=s.concat(t.validateSpec({key:y,value:n[y],valueSpec:o[y],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new C(y,n[y],`unknown property "${y}"`));return s}var qu={promoteId:Wd};function Ac(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new C(r,e,\'"type" is required\')];let a=le(e.type),s;switch(a){case"vector":case"raster":return s=Re({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:qu,validateSpec:o}),s;case"raster-dem":return s=qd({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=Re({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:qu}),e.cluster)for(let l in e.clusterProperties){let[u,c]=e.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...Sr({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...Sr({key:`${r}.${l}.reduce`,value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return Re({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Re({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new C(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return xn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Wd({key:t,value:e}){if(j(e)==="string")return Jt({key:t,value:e});{let r=[];for(let n in e)r.push(...Jt({key:`${t}.${n}`,value:e[n]}));return r}}function _c(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("light",e,`object expected, ${a} found`)]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new C(s,e[s],`unknown property "${s}"`)])}return o}function Ic(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("sky",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],`unknown property "${s}"`)]);return a}function Tc(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,o=[],a=j(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new C("terrain",e,`object expected, ${a} found`)]),o;for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new C(s,e[s],`unknown property "${s}"`)]);return o}function Xd(t){return Jt(t).length===0?[]:Sr(t)}function Hd(t){return Jt(t).length===0?[]:Sr(t)}function Zd(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new C(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return _o({key:e,value:r,valueSpec:{}})}function Jd(t){let e=t.key,r=t.value;if(j(r)==="array"){let i={type:"number"};if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return _o({key:e,value:r,valueSpec:{}})}function Yd(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1)return[new C(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<r.length;o++)i=i.concat(Rs({key:`${e}[${o}]`,value:r[o]}));return i}else return Rs({key:e,value:r})}function Kd(t){let e=t.key,r=t.value,n=j(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new C(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(xn({key:`${e}[${a}]`,value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(qs({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function Cc(t){let e=[],r=t.value,n=t.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&e.push(new C(n,r,`all the sprites\' ids must be unique, but ${r[a].id} is duplicated`)),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new C(n,r,`all the sprites\' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Re({key:`${n}[${a}]`,value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Jt({key:n,value:r})}function Qd(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new C("projection",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new C(s,e[s],`unknown property "${s}"`)]);return a}function eg(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=j(r);return n==="array"&&!rg(r)&&!tg(r)?[new C(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(n)?[]:[new C(e,r,`projection expected, invalid type "${n}" found`)]}function tg(t){return!!["interpolate","step","literal"].includes(t[0])}function rg(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function ng(t){return!!t&&t.constructor===Object}function kc(t){return ng(t.value)?[]:[new C(t.key,t.value,`object expected, ${j(t.value)} found`)]}var Wu={"*"(){return[]},array:qs,boolean:jd,number:_o,color:Rs,constants:gc,enum:xn,filter:Ws,function:bc,layer:wc,object:Re,source:Ac,light:_c,sky:Ic,terrain:Tc,projection:Qd,projectionDefinition:eg,string:Jt,formatted:Xd,resolvedImage:Hd,padding:Zd,numberArray:Jd,colorArray:Yd,variableAnchorOffsetCollection:Kd,sprite:Cc,state:kc};function fo(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=fo,r.expression&&wo(le(e))?bc(t):r.expression&&wn(Zt(e))?Sr(t):r.type&&Wu[r.type]?Wu[r.type](t):Re(xr({},t,{valueSpec:r.type?n[r.type]:r}))}function Ec(t){let e=t.value,r=t.key,n=Jt(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new C(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Le(t,e=P){let r=[];return r=r.concat(fo({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:fo,objectElementValidators:{glyphs:Ec,"*"(){return[]}}})),t.constants&&(r=r.concat(gc({key:"constants",value:t.constants}))),Mc(r)}Le.source=qe(je(Ac));Le.sprite=qe(je(Cc));Le.glyphs=qe(je(Ec));Le.light=qe(je(_c));Le.sky=qe(je(Ic));Le.terrain=qe(je(Tc));Le.state=qe(je(kc));Le.layer=qe(je(wc));Le.filter=qe(je(Ws));Le.paintProperty=qe(je(Pc));Le.layoutProperty=qe(je(Sc));function je(t){return function(e){return t({...e,validateSpec:fo})}}function Mc(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function qe(t){return function(...e){return Mc(t.apply(this,e))}}var Lc="AbortError";function Fc(t){return t.message===Lc}function Xs(){return new Error(Lc)}var Io={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dc(t){return Io.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function Vc(t,e){Io.REGISTERED_PROTOCOLS[t]=e}function Bc(t){delete Io.REGISTERED_PROTOCOLS[t]}var Rc="global-dispatcher",er=class extends Error{constructor(e,r,n,i){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=i}},Oc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ig=t=>/^file:/.test(t)||/^file:/.test(Oc())&&!/^\\w+:/.test(t);async function og(t,e){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:Oc(),signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let n;try{n=await fetch(r)}catch(a){throw new er(0,a.message,t.url,new Blob)}if(!n.ok){let a=await n.blob();throw new er(n.status,n.statusText,t.url,a)}let i;t.type==="arrayBuffer"||t.type==="image"?i=n.arrayBuffer():t.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw Xs();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function ag(t,e){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let o in t.headers)i.setRequestHeader(o,t.headers[o]);t.type==="json"&&(i.responseType="text",t.headers?.Accept||i.setRequestHeader("Accept","application/json")),i.withCredentials=t.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let o=i.response;if(t.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new er(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Xs())}),i.send(t.body)})}var Gc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=Dc(t.url);if(r)return r(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:Rc},e)}if(!ig(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return og(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Rc},e)}return ag(t,e)},Nc=(t,e)=>Gc(de(t,{type:"json"}),e),Uc=(t,e)=>Gc(de(t,{type:"arrayBuffer"}),e);var ut={};function I(t,e,r={}){if(ut[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ut[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}I("Object",Object);I("Set",Set);I("TransferableGridIndex",$t);I("Color",H);I("Error",Error);I("AJAXError",er);I("ResolvedImage",Se);I("StylePropertyFunction",bn);I("StyleExpression",Ht,{omit:["_evaluator"]});I("ZoomDependentExpression",Tt);I("ZoomConstantExpression",Je);I("CompoundExpression",Ze,{omit:["_evaluate"]});for(let t in Kt)Kt[t]._classRegistryKey||I(`Expression_${t}`,Kt[t]);function $c(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function Hs(t){let e=t.constructor;return t.$name||e._classRegistryKey}function sg(t){if(t===null||typeof t!="object")return!1;let e=Hs(t);return!!(e&&e!=="Object")}function jc(t){return!sg(t)&&(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||$c(t)||vt(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Tr(t,e){if(jc(t)){if(($c(t)||vt(t))&&e&&e.push(t),ArrayBuffer.isView(t)){let o=t;e&&e.push(o.buffer)}return t instanceof ImageData&&e&&e.push(t.data.buffer),t}if(Array.isArray(t)){let o=[];for(let a of t)o.push(Tr(a,e));return o}if(typeof t!="object")throw new Error(`can\'t serialize object of type ${typeof t}`);let r=Hs(t);if(!r)throw new Error(`can\'t serialize object of unregistered class ${t.constructor.name}`);if(!ut[r])throw new Error(`${r} is not registered.`);let{klass:n}=ut[r],i=n.serialize?n.serialize(t,e):{};if(n.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in t){if(!t.hasOwnProperty(o)||ut[r].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=ut[r].shallow.indexOf(o)>=0?a:Tr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(i.$name=r),i}function Cr(t){if(jc(t))return t;if(Array.isArray(t))return t.map(Cr);if(typeof t!="object")throw new Error(`can\'t deserialize object of type ${typeof t}`);let e=Hs(t)||"Object";if(!ut[e])throw new Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=ut[e];if(!r)throw new Error(`can\'t deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);let n=Object.create(r.prototype);for(let i of Object.keys(t)){if(i==="$name")continue;let o=t[i];n[i]=ut[e].shallow.indexOf(i)>=0?o:Cr(o)}return n}var To=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var lg={once:!0},Co=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new To(()=>this.process()),this.subscription=us(this.target,"message",n=>this.receive(n),!1),this.globalScope=at(self)?e:window}registerMessageHandler(e,r){this.messageHandlers[e]=r}sendAsync(e,r){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=r?us(r.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[o];let u={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(u)},lg):null;this.resolveRejects[o]={resolve:u=>{a?.unsubscribe(),n(u)},reject:u=>{a?.unsubscribe(),i(u)}};let s=[],l={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:Tr(e.data,s)};this.target.postMessage(l,{transfer:s})})}receive(e){let r=e.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!=="resource://android"&&location.origin!=="resource://android"&&r.origin!==location.origin)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(at(self)||r.mustQueue){this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,r)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(e,r)}async processTask(e,r){if(r.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;r.error?o.reject(Cr(r.error)):o.resolve(Cr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let n=Cr(r.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[r.type](r.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,r,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?Tr(r):null,data:Tr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function qc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function Zs(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var ko=class{constructor(e,r={}){de(this,r),this.type=e}},An=class extends ko{constructor(e,r={}){super("error",de({error:e},r))}},Eo=class{on(e,r){return this._listeners=this._listeners||{},qc(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return Zs(e,r,this._listeners),Zs(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},qc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new ko(e,r||{}));let n=e.type;if(this.listens(n)){e.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)Zs(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(de(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof An&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}};var ct=Le,K0=ct.source,Q0=ct.light,ev=ct.sky,tv=ct.terrain,rv=ct.filter,Wc=ct.paintProperty,Xc=ct.layoutProperty;function Hc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new An(new Error(n.message))),r=!0;return r}var _n=class{constructor(){this.first=!0}update(e,r){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=n,!0):!1)}};var q={"Latin-1 Supplement":t=>t>=128&&t<=255,"Hangul Jamo":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,"CJK Strokes":t=>t>=12736&&t<=12783,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Hangul Syllables":t=>t>=44032&&t<=55215,"Private Use Area":t=>t>=57344&&t<=63743,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function In(t){for(let e of t)if(Mo(e.charCodeAt(0)))return!0;return!1}function Zc(t){for(let e of t)if(!pg(e.charCodeAt(0)))return!1;return!0}function Js(t){let e=t.map(r=>{try{return new RegExp(`\\\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var ug=["Arab","Dupl","Mong","Ougr","Syrc"],cg=Js(ug);function pg(t){return!cg.test(String.fromCodePoint(t))}var fg=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],Jc=Js(fg);function Yc(t){return t<11904?!1:q["CJK Compatibility Forms"](t)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)||q["Enclosed CJK Letters and Months"](t)||q["Halfwidth and Fullwidth Forms"](t)||q["Ideographic Description Characters"](t)||q["Vertical Forms"](t)?!0:Jc.test(String.fromCodePoint(t))}function Mo(t){return t===746||t===747?!0:t<4352?!1:!!(q["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||q["CJK Compatibility"](t)||q["CJK Strokes"](t)||q["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||q["Enclosed CJK Letters and Months"](t)||q["Ideographic Description Characters"](t)||q.Kanbun(t)||q.Katakana(t)&&t!==12540||q["Halfwidth and Fullwidth Forms"](t)&&t!==65288&&t!==65289&&t!==65293&&!(t>=65306&&t<=65310)&&t!==65339&&t!==65341&&t!==65343&&!(t>=65371&&t<=65503)&&t!==65507&&!(t>=65512&&t<=65519)||q["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||q["Vertical Forms"](t)||q["Yijing Hexagram Symbols"](t)||/\\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\\p{sc=Hang}/u.test(String.fromCodePoint(t))||Jc.test(String.fromCodePoint(t)))}function yg(t){return!!(q["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||q["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||q["Letterlike Symbols"](t)||q["Number Forms"](t)||q["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||q["Control Pictures"](t)&&t!==9251||q["Optical Character Recognition"](t)||q["Enclosed Alphanumerics"](t)||q["Geometric Shapes"](t)||q["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||q["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||q["CJK Symbols and Punctuation"](t)||q.Katakana(t)||q["Private Use Area"](t)||q["CJK Compatibility Forms"](t)||q["Small Form Variants"](t)||q["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function Ys(t){return!(Mo(t)||yg(t))}function Kc(t){return/\\p{sc=Arab}/u.test(String.fromCodePoint(t))}var mg=["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"],hg=Js(mg);function Qc(t){return hg.test(String.fromCodePoint(t))}function dg(t,e){return!(!e&&Qc(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||q.Khmer(t))}function ep(t){for(let e of t)if(Qc(e.charCodeAt(0)))return!0;return!1}function tp(t,e){for(let r of t)if(!dg(r.charCodeAt(0),e))return!1;return!0}var Ks=class{constructor(){this.TIMEOUT=5e3;this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null;this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(we.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,r){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let n=e.pluginURL,i=new Promise(s=>{this.loadScriptResolve=s});r(n);let o=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await Promise.race([i,o]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:n};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)}},we=new Ks;var W=class{constructor(e,r){this.zoom=e,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new _n,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new _n,this.transition={},this.globalState={})}isSupportedScript(e){return tp(e,we.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var kr=class{constructor(e,r){this.property=e,this.value=r,this.expression=mc(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},Tn=class{constructor(e){this.property=e,this.value=new kr(e,void 0)}transitioned(e,r){return new Fo(this.property,this.value,r,de({},e.transition,this.transition),e.now)}untransitioned(){return new Fo(this.property,this.value,null,{},0)}},Lo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return nt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Tn(this._values[e].property)),this._values[e].value=new kr(this._values[e].property,r===null?void 0:nt(r))}getTransition(e){return nt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Tn(this._values[e].property)),this._values[e].transition=nt(r)||void 0}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n);let i=this.getTransition(r);i!==void 0&&(e[`${r}-transition`]=i)}return e}transitioned(e,r){let n=new Do(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(e,r._values[i]);return n}untransitioned(){let e=new Do(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},Fo=class{constructor(e,r,n,i,o){this.property=e,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(e,r,n){let i=e.now||0,o=this.value.possiblyEvaluate(e,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(e,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,r,n),o,Su(s))}}else return o}},Do=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},Vo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return nt(this._values[e].value)}setValue(e,r){this._values[e]=new kr(this._values[e].property,r===null?void 0:nt(r))}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){let i=new kt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},ge=class{constructor(e,r,n){this.property=e,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,n,i){return this.property.evaluate(this.value,this.parameters,e,r,n,i)}},kt=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},E=class{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,n){let i=this.specification.type,o=lt[i];return o?o(e,r,n):e}},F=class{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,n,i){return e.expression.kind==="constant"||e.expression.kind==="camera"?new ge(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new ge(this,e.expression,r)}interpolate(e,r,n){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ge(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=lt[i];if(o){let a=o(e.value.value,r.value.value,n);return new ge(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,r,n,i,o,a){return e.kind==="constant"?e.value:e.evaluate(r,n,i,o,a)}},pt=class extends F{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new ge(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new ge(this,{kind:"constant",value:l},r)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ge(this,{kind:"constant",value:o},r)}else return new ge(this,e.expression,r)}evaluate(e,r,n,i,o,a){if(e.kind==="source"){let s=e.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},n,i),e.evaluate({zoom:Math.floor(r.zoom)},n,i),e.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):e.value}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},tr=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(e.expression.evaluate(new W(Math.floor(r.zoom-1),r)),e.expression.evaluate(new W(Math.floor(r.zoom),r)),e.expression.evaluate(new W(Math.floor(r.zoom+1),r)),r)}_calculate(e,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:n,to:r}}interpolate(e){return e}},ft=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},ee=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in e){let n=e[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new kr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Tn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};I("DataDrivenProperty",F);I("DataConstantProperty",E);I("CrossFadedDataDrivenProperty",pt);I("CrossFadedProperty",tr);I("ColorRampProperty",ft);var Bo="-transition",oe=class extends Eo{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Ct(e.filter)),r.layout&&(this._unevaluatedLayout=new Vo(r.layout)),r.paint)){this._transitionablePaint=new Lo(r.paint);for(let n in e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(let n in e.layout)this.setLayoutProperty(n,e.layout[n],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new kt(r.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ct(e)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;if(this._unevaluatedLayout)for(let r in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[r];for(let i of n.getGlobalStateRefs())e.add(i)}for(let r of this._featureFilter.getGlobalStateRefs())e.add(r);return e}setLayoutProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.layout.${e}`;if(this._validate(Xc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Bo)?this._transitionablePaint.getTransition(e.slice(0,-Bo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(Wc,i,e,r,n))return!1}if(e.endsWith(Bo))return this._transitionablePaint.setTransition(e.slice(0,-Bo.length),r||void 0),!1;{let i=this._transitionablePaint._values[e],o=i.property.specification["property-type"]==="cross-faded-data-driven",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,n){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),_u(e,(r,n)=>r!==void 0&&!(n==="layout"&&!Object.keys(r).length)&&!(n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,i,o={}){return o&&o.validate===!1?!1:Hc(this,e.call(ct,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:P,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof ge)||!It(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var gg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Et=class{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},bg=128,xg=5,te=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*xg),bg),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function Q(t,e=1){let r=0,n=0,i=t.map(a=>{let s=vg(a.type),l=r=rp(r,Math.max(e,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=rp(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function vg(t){return gg[t].BYTES_PER_ELEMENT}function rp(t,e){return Math.ceil(t/e)*e}var np=Y(ye(),1),rr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.int16[i+0]=r,this.int16[i+1]=n,e}};rr.prototype.bytesPerElement=4;I("StructArrayLayout2i4",rr);var Cn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.int16[o+0]=r,this.int16[o+1]=n,this.int16[o+2]=i,e}};Cn.prototype.bytesPerElement=6;I("StructArrayLayout3i6",Cn);var Ro=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=i,this.int16[a+3]=o,e}};Ro.prototype.bytesPerElement=8;I("StructArrayLayout4i8",Ro);var kn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};kn.prototype.bytesPerElement=12;I("StructArrayLayout2i4i12",kn);var En=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=r,this.int16[l+1]=n,this.uint8[u+4]=i,this.uint8[u+5]=o,this.uint8[u+6]=a,this.uint8[u+7]=s,e}};En.prototype.bytesPerElement=8;I("StructArrayLayout2i4ub8",En);var Mt=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.float32[i+0]=r,this.float32[i+1]=n,e}};Mt.prototype.bytesPerElement=8;I("StructArrayLayout2f8",Mt);var Mn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,r,n,i,o,a,s,l,u,c)}emplace(e,r,n,i,o,a,s,l,u,c,p){let f=e*10;return this.uint16[f+0]=r,this.uint16[f+1]=n,this.uint16[f+2]=i,this.uint16[f+3]=o,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=l,this.uint16[f+7]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,e}};Mn.prototype.bytesPerElement=20;I("StructArrayLayout10ui20",Mn);var Ln=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f){let y=this.length;return this.resize(y+1),this.emplace(y,e,r,n,i,o,a,s,l,u,c,p,f)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y){let m=e*12;return this.int16[m+0]=r,this.int16[m+1]=n,this.int16[m+2]=i,this.int16[m+3]=o,this.uint16[m+4]=a,this.uint16[m+5]=s,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=p,this.int16[m+10]=f,this.int16[m+11]=y,e}};Ln.prototype.bytesPerElement=24;I("StructArrayLayout4i4ui4i24",Ln);var Fn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.float32[o+0]=r,this.float32[o+1]=n,this.float32[o+2]=i,e}};Fn.prototype.bytesPerElement=12;I("StructArrayLayout3f12",Fn);var Dn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint32[n+0]=r,e}};Dn.prototype.bytesPerElement=4;I("StructArrayLayout1ul4",Dn);var Vn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,r,n,i,o,a,s,l,u)}emplace(e,r,n,i,o,a,s,l,u,c){let p=e*10,f=e*5;return this.int16[p+0]=r,this.int16[p+1]=n,this.int16[p+2]=i,this.int16[p+3]=o,this.int16[p+4]=a,this.int16[p+5]=s,this.uint32[f+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};Vn.prototype.bytesPerElement=20;I("StructArrayLayout6i1ul2ui20",Vn);var Bn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*6;return this.int16[l+0]=r,this.int16[l+1]=n,this.int16[l+2]=i,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};Bn.prototype.bytesPerElement=12;I("StructArrayLayout2i2i2i12",Bn);var zo=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,n,i,o)}emplace(e,r,n,i,o,a){let s=e*4,l=e*8;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=i,this.int16[l+6]=o,this.int16[l+7]=a,e}};zo.prototype.bytesPerElement=16;I("StructArrayLayout2f1f2i16",zo);var Rn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,n,i,o,a)}emplace(e,r,n,i,o,a,s){let l=e*16,u=e*4,c=e*8;return this.uint8[l+0]=r,this.uint8[l+1]=n,this.float32[u+1]=i,this.float32[u+2]=o,this.int16[c+6]=a,this.int16[c+7]=s,e}};Rn.prototype.bytesPerElement=16;I("StructArrayLayout2ub2f2i16",Rn);var zn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*3;return this.uint16[o+0]=r,this.uint16[o+1]=n,this.uint16[o+2]=i,e}};zn.prototype.bytesPerElement=6;I("StructArrayLayout3ui6",zn);var On=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d){let x=this.length;return this.resize(x+1),this.emplace(x,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x){let b=e*24,v=e*12,S=e*48;return this.int16[b+0]=r,this.int16[b+1]=n,this.uint16[b+2]=i,this.uint16[b+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[v+7]=f,this.float32[v+8]=y,this.uint8[S+36]=m,this.uint8[S+37]=h,this.uint8[S+38]=g,this.uint32[v+10]=d,this.int16[b+22]=x,e}};On.prototype.bytesPerElement=48;I("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",On);var Gn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z){let L=this.length;return this.resize(L+1),this.emplace(L,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T,M,D,V,z,L){let _=e*32,B=e*16;return this.int16[_+0]=r,this.int16[_+1]=n,this.int16[_+2]=i,this.int16[_+3]=o,this.int16[_+4]=a,this.int16[_+5]=s,this.int16[_+6]=l,this.int16[_+7]=u,this.uint16[_+8]=c,this.uint16[_+9]=p,this.uint16[_+10]=f,this.uint16[_+11]=y,this.uint16[_+12]=m,this.uint16[_+13]=h,this.uint16[_+14]=g,this.uint16[_+15]=d,this.uint16[_+16]=x,this.uint16[_+17]=b,this.uint16[_+18]=v,this.uint16[_+19]=S,this.uint16[_+20]=A,this.uint16[_+21]=w,this.uint16[_+22]=T,this.uint32[B+12]=M,this.float32[B+13]=D,this.float32[B+14]=V,this.uint16[_+30]=z,this.uint16[_+31]=L,e}};Gn.prototype.bytesPerElement=64;I("StructArrayLayout8i15ui1ul2f2ui64",Gn);var nr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.float32[n+0]=r,e}};nr.prototype.bytesPerElement=4;I("StructArrayLayout1f4",nr);var Nn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*6,a=e*3;return this.uint16[o+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,e}};Nn.prototype.bytesPerElement=12;I("StructArrayLayout1ui2f12",Nn);var Un=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*2,a=e*4;return this.uint32[o+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,e}};Un.prototype.bytesPerElement=8;I("StructArrayLayout1ul2ui8",Un);var $n=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,r)}emplace(e,r,n){let i=e*2;return this.uint16[i+0]=r,this.uint16[i+1]=n,e}};$n.prototype.bytesPerElement=4;I("StructArrayLayout2ui4",$n);var Oo=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let n=e*1;return this.uint16[n+0]=r,e}};Oo.prototype.bytesPerElement=2;I("StructArrayLayout1ui2",Oo);var Er=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,n,i)}emplace(e,r,n,i,o){let a=e*4;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,this.float32[a+3]=o,e}};Er.prototype.bytesPerElement=16;I("StructArrayLayout4f16",Er);var Go=class extends Et{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new np.default(this.anchorPointX,this.anchorPointY)}};Go.prototype.size=20;var jn=class extends Vn{get(e){return new Go(this,e)}};I("CollisionBoxArray",jn);var No=class extends Et{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};No.prototype.size=48;var qn=class extends On{get(e){return new No(this,e)}};I("PlacedSymbolArray",qn);var Uo=class extends Et{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};Uo.prototype.size=64;var Wn=class extends Gn{get(e){return new Uo(this,e)}};I("SymbolInstanceArray",Wn);var Xn=class extends nr{getoffsetX(e){return this.float32[e*1+0]}};I("GlyphOffsetArray",Xn);var Hn=class extends Cn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};I("SymbolLineVertexArray",Hn);var $o=class extends Et{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};$o.prototype.size=12;var Zn=class extends Nn{get(e){return new $o(this,e)}};I("TextAnchorOffsetArray",Zn);var jo=class extends Et{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};jo.prototype.size=8;var Jn=class extends Un{get(e){return new jo(this,e)}};I("FeatureIndexArray",Jn);var qo=class extends rr{};var Wo=class extends rr{},Xo=class extends rr{},Ho=class extends kn{};var Zo=class extends En{},Jo=class extends Mt{},yt=class extends Mn{},Yo=class extends Ln{},Ko=class extends Fn{},Qo=class extends Dn{},Yn=class extends Bn{};var ea=class extends Rn{};var Fe=class extends zn{},Lt=class extends $n{};var Pg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:ip,size:kv,alignment:Ev}=Pg;var pe=class t{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1;this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&ce(`Max vertices per segment is ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${t.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i?this.createNewSegment(r,n,i):o}createNewSegment(e,r,n){let i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(i.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,r,n){return this.prepareSegment(0,e,r,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,n,i){return new t([{vertexOffset:e,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};pe.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;I("SegmentVector",pe);function Qs(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Kn=Q([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var up=Y(rl(),1);var Qn=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(lp(e)),this.positions.push(r,n,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=lp(e),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(e,r){let n=new Float64Array(e.ids),i=new Uint32Array(e.positions);return nl(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(e){let r=new t;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function lp(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,up.default)(String(t))}function nl(t,e,r,n){for(;r<n;){let i=t[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(t[o]<i);do a--;while(t[a]>i);if(o>=a)break;ra(t,o,a),ra(e,3*o,3*a),ra(e,3*o+1,3*a+1),ra(e,3*o+2,3*a+2)}a-r<n-a?(nl(t,e,r,a),r=a+1):(nl(t,e,a+1,n),n=a)}}function ra(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}I("FeaturePositionMap",Qn);var ei=class{constructor(e,r){this.gl=e.gl,this.location=r}};var Mr=class extends ei{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var na=class extends ei{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},ia=class extends ei{constructor(e,r){super(e,r),this.current=H.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}};var qv=new Float32Array(16);function il(t){return[Qs(255*t.r,255*t.g),Qs(255*t.b,255*t.a)]}var ir=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new ia(e,r):new Mr(e,r)}},Ft=class{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new na(e,r):new Mr(e,r)}},We=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:`a_${o}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new W(0),r,{},i,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(e,r,o)}_setPaintValue(e,r,n){if(this.type==="color"){let i=il(n);for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>`u_${s}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:`a_${s}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,r,n,i,o){let a=this.expression.evaluate(new W(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new W(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(e,r,o,a)}_setPaintValue(e,r,n,i){if(this.type==="color"){let o=il(n),a=il(i);for(let s=e;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=it(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new Mr(e,r)}},Ye=class{constructor(e,r,n,i,o,a){this.expression=e,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(e,r,n,i,o){this._setPaintValues(e,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(e,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=e;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Kn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Kn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},oa=class{constructor(e,r,n){this.binders={},this._buffers=[];let i=[];for(let o in e.paint._values){if(!n(o))continue;let a=e.paint.get(o);if(!(a instanceof ge)||!It(a.property.specification))continue;let s=_g(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new Ft(l.value,s):new ir(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||f){let y=cp(o,u,"source");this.binders[o]=f?new Ye(l,u,c,r,y,e.id):new We(l,s,u,y),i.push(`/a_${o}`)}else{let y=cp(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push(`/z_${o}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof We||r instanceof De?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof We||s instanceof De||s instanceof Ye)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof Ft&&i.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,i,o){let a=!1;for(let s in e){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof We||f instanceof De||f instanceof Ye)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let r in this.binders){let n=this.binders[r];(n instanceof ir||n instanceof Ft)&&e.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof We||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof Ye)for(let i=0;i<Kn.members.length;i++)e.push(Kn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof ir||n instanceof Ft||n instanceof De)for(let i of n.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof ir||o instanceof Ft||o instanceof De){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(e,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(e,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(e&&n instanceof Ye){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof We||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof We||n instanceof De||n instanceof Ye)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof We||r instanceof De||r instanceof Ye)&&r.destroy()}}},Ae=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new oa(i,r,n);this.needsUpload=!1,this._featureMap=new Qn,this._bufferOffset=0}populatePaintArrays(e,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,r,o,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function _g(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function Ig(t){return{"line-pattern":{source:yt,composite:yt},"fill-pattern":{source:yt,composite:yt},"fill-extrusion-pattern":{source:yt,composite:yt}}[t]}function cp(t,e,r){let n={color:{source:Mt,composite:Er},number:{source:nr,composite:Mt}},i=Ig(t);return i&&i[r]||n[e][r]}I("ConstantBinder",ir);I("CrossFadedConstantBinder",Ft);I("SourceExpressionBinder",We);I("CrossFadedCompositeBinder",Ye);I("CompositeExpressionBinder",De);I("ProgramConfiguration",oa,{omit:["_buffers"]});I("ProgramConfigurationSet",Ae);var Tg=15,ol=Math.pow(2,Tg-1)-1,pp=-ol-1;function _e(t){let e=8192/t.extent,r=t.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=it(s,pp,ol),a.y=it(l,pp,ol),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ne(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?_e(t):[]}}var fp=-32768;function Cg(t,e,r,n,i){t.emplaceBack(fp+e*8+n,fp+r*8+i)}var or=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Wo,this.indexArray=new Fe,this.segments=new pe,this.programConfigurations=new Ae(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){let i=this.layers[0],o=[],a=null,s=!1,l=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),l=l||c.paint.get("circle-pitch-alignment")==="map"}let u=l?r.subdivisionGranularity.circle:1;for(let{feature:c,id:p,index:f,sourceLayerIndex:y}of e){let m=this.layers[0]._featureFilter.needGeometry,h=Ne(c,m);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),h,n))continue;let g=s?a.evaluate(h,{},n):void 0,d={id:p,properties:c.properties,type:c.type,sourceLayerIndex:y,index:f,geometry:m?h.geometry:_e(c),patterns:{},sortKey:g};o.push(d)}s&&o.sort((c,p)=>c.sortKey-p.sortKey);for(let c of o){let{geometry:p,index:f,sourceLayerIndex:y}=c,m=e[f].feature;this.addFeature(c,p,f,n,u),r.featureIndex.insert(m,p,f,y,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ip),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,n,i,o=1){let a;switch(o){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${o}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let l of r)for(let u of l){let c=u.x,p=u.y;if(c<0||c>=8192||p<0||p>=8192)continue;let f=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),y=f.vertexLength;for(let m=0;m<s;m++)for(let h=0;h<s;h++)Cg(this.layoutVertexArray,c,p,a[h],a[m]);for(let m=0;m<s-1;m++)for(let h=0;h<s-1;h++){let g=y+m*s+h,d=y+(m+1)*s+h;this.indexArray.emplaceBack(g,d+1,g+1),this.indexArray.emplaceBack(g,d,d+1)}f.vertexLength+=s*s,f.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};I("CircleBucket",or,{omit:["layers"]});var ti=Y(ye(),1);function mp(t,e){for(let r=0;r<t.length;r++)if(Lr(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Lr(t,e[r]))return!0;return!!sl(t,e)}function hp(t,e,r){return!!(Lr(t,e)||al(e,t,r))}function aa(t,e){if(t.length===1)return yp(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(Lr(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(yp(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(sl(t,e[r]))return!0;return!1}function dp(t,e,r){for(let n=0;n<e.length;n++){let i=e[n];if(t.length>=3){for(let o=0;o<i.length;o++)if(Lr(t,i[o]))return!0}if(kg(t,i,r))return!0}return!1}function kg(t,e,r){if(t.length>1){if(sl(t,e))return!0;for(let n=0;n<e.length;n++)if(al(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(al(t[n],e,r))return!0;return!1}function sl(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let n=t[r],i=t[r+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(Eg(n,i,a,s))return!0}}return!1}function Eg(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function al(t,e,r){let n=r*r;if(e.length===1)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++){let o=e[i-1],a=e[i];if(ll(t,o,a)<n)return!0}return!1}function ll(t,e,r){let n=e.distSqr(r);if(n===0)return t.distSqr(e);let i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i<0?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function yp(t,e){let r=!1,n,i,o;for(let a=0;a<t.length;a++){n=t[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>e.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function Lr(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){let o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function gp(t,e,r,n,i){for(let a of t)if(e<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new ti.default(e,r),new ti.default(e,i),new ti.default(n,i),new ti.default(n,r)];if(t.length>2){for(let a of o)if(Lr(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(Mg(s,l,o))return!0}return!1}function Mg(t,e,r){let n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;let o=ot(t,e,r[0]);return o!==ot(t,e,r[1])||o!==ot(t,e,r[2])||o!==ot(t,e,r[3])}var sa=Y(ye(),1);function ar(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Dt(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Vt(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=sa.default.convert(e)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<t.length;s++){let l=t[s];a.push(l.sub(o))}return a}function bp(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new sa.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new sa.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(e)._add(l))}r.push(o)}return r}var xp,Lg=()=>xp=xp||new ee({"circle-sort-key":new F(P.layout_circle["circle-sort-key"])}),vp,Fg=()=>vp=vp||new ee({"circle-radius":new F(P.paint_circle["circle-radius"]),"circle-color":new F(P.paint_circle["circle-color"]),"circle-blur":new F(P.paint_circle["circle-blur"]),"circle-opacity":new F(P.paint_circle["circle-opacity"]),"circle-translate":new E(P.paint_circle["circle-translate"]),"circle-translate-anchor":new E(P.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new E(P.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new E(P.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new F(P.paint_circle["circle-stroke-width"]),"circle-stroke-color":new F(P.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new F(P.paint_circle["circle-stroke-opacity"])}),Pp={get paint(){return Fg()},get layout(){return Lg()}};var Sp=Y(ye(),1);var la=class extends oe{constructor(e){super(e,Pp)}createBucket(e){return new or(e)}queryRadius(e){let r=e;return ar("circle-radius",this,r)+ar("circle-stroke-width",this,r)+Dt(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:l}){let u=Vt(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("circle-radius").evaluate(r,n),p=this.paint.get("circle-stroke-width").evaluate(r,n),f=c+p,y=this.paint.get("circle-pitch-alignment")==="map",m=y?u:Dg(u,o,s,l),h=y?f*a:f;for(let g of i)for(let d of g){let x=y?d:wp(d,o,s,l),b=h,v=o.projectTileCoordinates(d.x,d.y,s,l).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=v/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=o.cameraToCenterDistance/v),hp(m,x,b))return!0}return!1}};function wp(t,e,r,n){let i=e.projectTileCoordinates(t.x,t.y,r,n).point;return new Sp.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function Dg(t,e,r,n){return t.map(i=>wp(i,e,r,n))}var ri=class extends or{};I("HeatmapBucket",ri,{omit:["layers"]});var Ap,Vg=()=>Ap=Ap||new ee({"heatmap-radius":new F(P.paint_heatmap["heatmap-radius"]),"heatmap-weight":new F(P.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new E(P.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ft(P.paint_heatmap["heatmap-color"]),"heatmap-opacity":new E(P.paint_heatmap["heatmap-opacity"])}),_p={get paint(){return Vg()}};function ul(t,{width:e,height:r},n,i){if(!i)i=new Uint8Array(e*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`);return t.width=e,t.height=r,t.data=i,t}function Ip(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=ul({},{width:e,height:r},n);cl(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data}function cl(t,e,r,n,i,o){if(i.width===0||i.height===0)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=t.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*t.width+r.x)*o,c=((n.y+l)*e.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return e}var sr=class t{constructor(e,r){ul(this,e,1,r)}resize(e){Ip(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,1)}},fe=class t{constructor(e,r){ul(this,e,4,r)}resize(e){Ip(this,e,4)}replace(e,r){r?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,4)}setPixel(e,r,n){let i=(e*this.width+r)*4;this.data[i+0]=Math.round(n.r*255/n.a),this.data[i+1]=Math.round(n.g*255/n.a),this.data[i+2]=Math.round(n.b*255/n.a),this.data[i+3]=Math.round(n.a*255)}};I("AlphaImage",sr);I("RGBAImage",fe);function Tp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new fe({width:r,height:n});if(!Au(r))throw new Error(`width is not a power of 2 - ${r}`);let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.setPixel(a/4/r,s/4,u)};if(t.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=t.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var Cp="big-fb";var ua=class extends oe{createBucket(e){return new ri(e)}constructor(e){super(e,_p),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Tp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Cp)&&this.heatmapFbos.delete(Cp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var kp,Bg=()=>kp=kp||new ee({"hillshade-illumination-direction":new E(P.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new E(P.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new E(P.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new E(P.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new E(P.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new E(P.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new E(P.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new E(P.paint_hillshade["hillshade-method"])}),Ep={get paint(){return Bg()}};var ca=class extends oe{constructor(e){super(e,Ep),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,n=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,o=Math.max(e.length,r.length,n.length,i.length);e=e.concat(Array(o-e.length).fill(e.at(-1))),r=r.concat(Array(o-r.length).fill(r.at(-1))),n=n.concat(Array(o-n.length).fill(n.at(-1))),i=i.concat(Array(o-i.length).fill(i.at(-1)));let a=r.map(cs);return{directionRadians:e.map(cs),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Mp,Rg=()=>Mp=Mp||new ee({"color-relief-opacity":new E(P["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new ft(P["paint_color-relief"]["color-relief-color"])}),Lp={get paint(){return Rg()}};var ni=class{constructor(e,r,n,i){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(r,i)}update(e,r,n){let{width:i,height:o}=e,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!n,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(r&&r.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!r||r.premultiply!==!1)),a)this.size=[i,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{let{x:u,y:c}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||vt(e)?l.texSubImage2D(l.TEXTURE_2D,0,u,c,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,u,c,i,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,r,n){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),n===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(n=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,n||e),this.filter=e),r!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};var ii=class{constructor(e,r,n,i=1,o=1,a=1,s=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){ce(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return pl(e,this.getUnpackVector())}getPixels(){return new fe({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=e.data[this._idx(p+l,c+u)]}};function pl(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],a=Math.min(r,n,i),s=Math.round((t+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/n)%256,b:Math.floor(s*a/i)%256}}I("DEMData",ii);var pa=class extends oe{constructor(e){super(e,Lp)}_createColorRamp(e){let r={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof Je&&n._styleExpression.expression instanceof ke){this.colorRampExpression=n;let a=n._styleExpression.expression;r.elevationStops=a.labels,r.colorStops=[];for(let s of r.elevationStops)r.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[H.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=e)return r;let i={elevationStops:[],colorStops:[]},o=(r.elevationStops.length-1)/(e-1);for(let a=0;a<r.elevationStops.length-.5;a+=o)i.elevationStops.push(r.elevationStops[Math.round(a)]),i.colorStops.push(r.colorStops[Math.round(a)]);return ce(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,r,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(r),o=new fe({width:i.colorStops.length,height:1}),a=new fe({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let l=pl(i.elevationStops[s],n);a.setPixel(0,s,new H(l.r/255,l.g/255,l.b/255,1)),o.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new ni(e,a,e.gl.RGBA),colorTexture:new ni(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};var zg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Fp,size:U1,alignment:$1}=zg;function Fr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get(`${t}-pattern`);a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Dr(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get(`${t}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var ci=Y(ye(),1);function ml(t,e,r=2){let n=e&&e.length,i=n?e[0]*r:t.length,o=Vp(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=$g(t,e,o,r)),t.length>80*r){s=t[0],l=t[1];let c=s,p=l;for(let f=r;f<i;f+=r){let y=t[f],m=t[f+1];y<s&&(s=y),m<l&&(l=m),y>c&&(c=y),m>p&&(p=m)}u=Math.max(c-s,p-l),u=u!==0?32767/u:0}return ai(o,a,r,s,l,u,0),a}function Vp(t,e,r,n,i){let o;if(i===eb(t,e,r,n)>0)for(let a=e;a<r;a+=n)o=Dp(a/n|0,t[a],t[a+1],o);else for(let a=r-n;a>=e;a-=n)o=Dp(a/n|0,t[a],t[a+1],o);return o&&Vr(o,o.next)&&(li(o),o=o.next),o}function lr(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Vr(r,r.next)||se(r.prev,r,r.next)===0)){if(li(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function ai(t,e,r,n,i,o,a){if(!t)return;!a&&o&&Hg(t,n,i,o);let s=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(o?Gg(t,n,i,o):Og(t)){e.push(l.i,t.i,u.i),li(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Ng(lr(t),e),ai(t,e,r,n,i,o,2)):a===2&&Ug(t,e,r,n,i,o):ai(lr(t),e,r,n,i,o,1);break}}}function Og(t){let e=t.prev,r=t,n=t.next;if(se(e,r,n)>=0)return!1;let i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=Math.min(i,o,a),p=Math.min(s,l,u),f=Math.max(i,o,a),y=Math.max(s,l,u),m=n.next;for(;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&oi(i,s,o,l,a,u,m.x,m.y)&&se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Gg(t,e,r,n){let i=t.prev,o=t,a=t.next;if(se(i,o,a)>=0)return!1;let s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=Math.min(s,l,u),m=Math.min(c,p,f),h=Math.max(s,l,u),g=Math.max(c,p,f),d=fl(y,m,e,r,n),x=fl(h,g,e,r,n),b=t.prevZ,v=t.nextZ;for(;b&&b.z>=d&&v&&v.z<=x;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=d;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ng(t,e){let r=t;do{let n=r.prev,i=r.next.next;!Vr(n,i)&&Rp(n,r,r.next,i)&&si(n,i)&&si(i,n)&&(e.push(n.i,r.i,i.i),li(r),li(r.next),r=t=i),r=r.next}while(r!==t);return lr(r)}function Ug(t,e,r,n,i,o){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&Yg(a,s)){let l=zp(a,s);a=lr(a,a.next),l=lr(l,l.next),ai(a,e,r,n,i,o,0),ai(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function $g(t,e,r,n){let i=[];for(let o=0,a=e.length;o<a;o++){let s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=Vp(t,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(Jg(u))}i.sort(jg);for(let o=0;o<i.length;o++)r=qg(i[o],r);return r}function jg(t,e){let r=t.x-e.x;if(r===0&&(r=t.y-e.y,r===0)){let n=(t.next.y-t.y)/(t.next.x-t.x),i=(e.next.y-e.y)/(e.next.x-e.x);r=n-i}return r}function qg(t,e){let r=Wg(t,e);if(!r)return e;let n=zp(r,t);return lr(n,n.next),lr(r,r.next)}function Wg(t,e){let r=e,n=t.x,i=t.y,o=-1/0,a;if(Vr(t,r))return r;do{if(Vr(t,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let p=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(p<=n&&p>o&&(o=p,a=r.x<r.next.x?r:r.next,p===n))return a}r=r.next}while(r!==e);if(!a)return null;let s=a,l=a.x,u=a.y,c=1/0;r=a;do{if(n>=r.x&&r.x>=l&&n!==r.x&&Bp(i<u?n:o,i,l,u,i<u?o:n,i,r.x,r.y)){let p=Math.abs(i-r.y)/(n-r.x);si(r,t)&&(p<c||p===c&&(r.x>a.x||r.x===a.x&&Xg(a,r)))&&(a=r,c=p)}r=r.next}while(r!==s);return a}function Xg(t,e){return se(t.prev,t,e.prev)<0&&se(e.next,t,t.next)<0}function Hg(t,e,r,n){let i=t;do i.z===0&&(i.z=fl(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Zg(i)}function Zg(t){let e,r=1;do{let n=t,i;t=null;let o=null;for(e=0;n;){e++;let a=n,s=0;for(let u=0;u<r&&(s++,a=a.nextZ,!!a);u++);let l=r;for(;s>0||l>0&&a;)s!==0&&(l===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(e>1);return t}function fl(t,e,r,n,i){return t=(t-r)*i|0,e=(e-n)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Jg(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Bp(t,e,r,n,i,o,a,s){return(i-a)*(e-s)>=(t-a)*(o-s)&&(t-a)*(n-s)>=(r-a)*(e-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function oi(t,e,r,n,i,o,a,s){return!(t===a&&e===s)&&Bp(t,e,r,n,i,o,a,s)}function Yg(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Kg(t,e)&&(si(t,e)&&si(e,t)&&Qg(t,e)&&(se(t.prev,t,e.prev)||se(t,e.prev,e))||Vr(t,e)&&se(t.prev,t,t.next)>0&&se(e.prev,e,e.next)>0)}function se(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Vr(t,e){return t.x===e.x&&t.y===e.y}function Rp(t,e,r,n){let i=ya(se(t,e,r)),o=ya(se(t,e,n)),a=ya(se(r,n,t)),s=ya(se(r,n,e));return!!(i!==o&&a!==s||i===0&&fa(t,r,e)||o===0&&fa(t,n,e)||a===0&&fa(r,t,n)||s===0&&fa(r,e,n))}function fa(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ya(t){return t>0?1:t<0?-1:0}function Kg(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Rp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function si(t,e){return se(t.prev,t,t.next)<0?se(t,e,t.next)>=0&&se(t,t.prev,e)>=0:se(t,e,t.prev)<0||se(t,t.next,e)<0}function Qg(t,e){let r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function zp(t,e){let r=yl(t.i,t.x,t.y),n=yl(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Dp(t,e,r,n){let i=yl(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function li(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function yl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function eb(t,e,r,n){let i=0;for(let o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}var Bt=class{constructor(e,r){if(r>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=r}getGranularityForZoomLevel(e){let r=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/r),this._minGranularity,1)}},ha=class ha{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};ha.noSubdivision=new ha({fill:new Bt(0,0),line:new Bt(0,0),tile:new Bt(0,0),stencil:new Bt(0,0),circle:1});var ma=ha;I("SubdivisionGranularityExpression",Bt);I("SubdivisionGranularitySetting",ma);var Br=-32768,ui=32767,hl=class{constructor(e,r){this._vertexBuffer=[];this._vertexDictionary=new Map;this._used=!1;this._granularity=e,this._granularityCellSize=8192/e,this._canonical=r}_getKey(e,r){return e=e+32768,r=r+32768,e<<16|r<<0}_vertexToIndex(e,r){if(e<-32768||r<-32768||e>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");let n=Math.round(e)|0,i=Math.round(r)|0,o=this._getKey(n,i);if(this._vertexDictionary.has(o))return this._vertexDictionary.get(o);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(o,a),this._vertexBuffer.push(n,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return rb(this._vertexBuffer,e);let r=[],n=e.length;for(let i=0;i<n;i+=3){let o=[e[i+0],e[i+1],e[i+2]],a=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]],s=1/0,l=1/0,u=-1/0,c=-1/0;for(let h=0;h<3;h++){let g=a[h*2],d=a[h*2+1];s=Math.min(s,g),u=Math.max(u,g),l=Math.min(l,d),c=Math.max(c,d)}if(s===u||l===c)continue;let p=Math.floor(s/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize),y=Math.floor(l/this._granularityCellSize),m=Math.ceil(c/this._granularityCellSize);if(p===f&&y===m){r.push(...o);continue}for(let h=y;h<m;h++){let g=this._scanlineGenerateVertexRingForCellRow(h,a,o);nb(this._vertexBuffer,g,r)}}return r}_scanlineGenerateVertexRingForCellRow(e,r,n){let i=e*this._granularityCellSize,o=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let l=r[s*2],u=r[s*2+1],c=r[(s+1)*2%6],p=r[((s+1)*2+1)%6],f=r[(s+2)*2%6],y=r[((s+2)*2+1)%6],m=c-l,h=p-u,g=m===0,d=h===0,x=(i-u)/h,b=(o-u)/h,v=Math.min(x,b),S=Math.max(x,b);if(!d&&(v>=1||S<=0)||d&&(u<i||u>o)){p>=i&&p<=o&&a.push(n[(s+1)%3]);continue}if(!d&&v>0){let T=l+m*v,M=u+h*v;a.push(this._vertexToIndex(T,M))}let A=l+m*Math.max(v,0),w=l+m*Math.min(S,1);if(g||this._generateIntraEdgeVertices(a,l,u,c,p,A,w),!d&&S<1){let T=l+m*S,M=u+h*S;a.push(this._vertexToIndex(T,M))}(d||p>=i&&p<=o)&&a.push(n[(s+1)%3]),!d&&(p<=i||p>=o)&&this._generateInterEdgeVertices(a,l,u,c,p,f,y,w,i,o)}return a}_generateIntraEdgeVertices(e,r,n,i,o,a,s){let l=i-r,u=o-n,c=u===0,p=c?Math.min(r,i):Math.min(a,s),f=c?Math.max(r,i):Math.max(a,s),y=Math.floor(p/this._granularityCellSize)+1,m=Math.ceil(f/this._granularityCellSize)-1;if(c?r<i:a<s)for(let g=y;g<=m;g++){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}else for(let g=m;g>=y;g--){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}}_generateInterEdgeVertices(e,r,n,i,o,a,s,l,u,c){let p=o-n,f=a-i,y=s-o,m=(u-o)/y,h=(c-o)/y,g=Math.min(m,h),d=Math.max(m,h),x=i+f*g,b=Math.floor(Math.min(x,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(x,l)/this._granularityCellSize)-1,S=l<x,A=y===0;if(A&&(s===u||s===c))return;if(A||g>=1||d<=0){let T=r-a,M=n-s,D=(u-s)/M,V=(c-s)/M,z=Math.min(D,V),L=a+T*z;b=Math.floor(Math.min(L,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(L,l)/this._granularityCellSize)-1,S=l<L}let w=p>0?c:u;if(S)for(let T=b;T<=v;T++){let M=T*this._granularityCellSize;e.push(this._vertexToIndex(M,w))}else for(let T=v;T>=b;T--){let M=T*this._granularityCellSize;e.push(this._vertexToIndex(M,w))}}_generateOutline(e){let r=[];for(let n of e){let i=Ke(n,this._granularity,!0),o=this._pointArrayToIndices(i),a=[];for(let s=1;s<o.length;s++)a.push(o[s-1]),a.push(o[s]);r.push(a)}return r}_handlePoles(e){let r=!1,n=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(r||n)&&this._fillPoles(e,r,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let r=0;r<e.length;r+=2){let n=e[r+1];n===Br&&(e[r+1]=Br+1),n===ui&&(e[r+1]=ui-1)}}_generatePoleQuad(e,r,n,i,o,a){i>o!=(a===Br)?(e.push(r),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(o,a)),e.push(this._vertexToIndex(i,a))):(e.push(n),e.push(r),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(o,a)),e.push(n),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,r,n){let i=this._vertexBuffer,o=0,a=8192,s=e.length;for(let l=2;l<s;l+=3){let u=e[l-2],c=e[l-1],p=e[l],f=i[u*2],y=i[u*2+1],m=i[c*2],h=i[c*2+1],g=i[p*2],d=i[p*2+1];r&&(y===o&&h===o&&this._generatePoleQuad(e,u,c,f,m,Br),h===o&&d===o&&this._generatePoleQuad(e,c,p,m,g,Br),d===o&&y===o&&this._generatePoleQuad(e,p,u,g,f,Br)),n&&(y===a&&h===a&&this._generatePoleQuad(e,u,c,f,m,ui),h===a&&d===a&&this._generatePoleQuad(e,c,p,m,g,ui),d===a&&y===a&&this._generatePoleQuad(e,p,u,g,f,ui))}}_initializeVertices(e){for(let r=0;r<e.length;r+=2)this._vertexToIndex(e[r],e[r+1])}subdividePolygonInternal(e,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:n,holeIndices:i}=tb(e);this._initializeVertices(n);let o;try{let s=ml(n,i),l=this._convertIndices(n,s);o=this._subdivideTrianglesScanline(l)}catch(s){console.error(s)}let a=[];return r&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(o),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:a}}_convertIndices(e,r){let n=[];for(let i=0;i<r.length;i++){let o=e[r[i]*2],a=e[r[i]*2+1];n.push(this._vertexToIndex(o,a))}return n}_pointArrayToIndices(e){let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(this._vertexToIndex(i.x,i.y))}return r}};function da(t,e,r,n=!0){return new hl(r,e).subdividePolygonInternal(t,n)}function Ke(t,e,r=!1){if(!t||t.length<1)return[];if(t.length<2)return[];let n=t[0],i=t[t.length-1],o=r&&(n.x!==i.x||n.y!==i.y);if(e<2)return o?[...t,t[0]]:[...t];let a=Math.floor(8192/e),s=[];s.push(new ci.default(t[0].x,t[0].y));let l=t.length,u=o?l:l-1;for(let c=0;c<u;c++){let p=t[c],f=c<l-1?t[c+1]:t[0],y=p.x,m=p.y,h=f.x,g=f.y,d=y!==h,x=m!==g;if(!d&&!x)continue;let b=h-y,v=g-m,S=Math.abs(b),A=Math.abs(v),w=y,T=m;for(;;){let D=b>0?(Math.floor(w/a)+1)*a:(Math.ceil(w/a)-1)*a,V=v>0?(Math.floor(T/a)+1)*a:(Math.ceil(T/a)-1)*a,z=Math.abs(w-D),L=Math.abs(T-V),_=Math.abs(w-h),B=Math.abs(T-g),G=d?z/S:Number.POSITIVE_INFINITY,O=x?L/A:Number.POSITIVE_INFINITY;if((_<=z||!d)&&(B<=L||!x))break;if(G<O&&d||!x){w=D,T=T+v*G;let R=new ci.default(w,Math.round(T));(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}else{w=w+b*O,T=V;let R=new ci.default(Math.round(w),T);(s[s.length-1].x!==R.x||s[s.length-1].y!==R.y)&&s.push(R)}}let M=new ci.default(h,g);(s[s.length-1].x!==M.x||s[s.length-1].y!==M.y)&&s.push(M)}return s}function tb(t){let e=[],r=[];for(let n of t)if(n.length!==0){n!==t[0]&&e.push(r.length/2);for(let i=0;i<n.length;i++)r.push(n[i].x),r.push(n[i].y)}return{flattened:r,holeIndices:e}}function rb(t,e){let r=[];for(let n=0;n<e.length;n+=3){let i=e[n],o=e[n+1],a=e[n+2],s=t[i*2],l=t[i*2+1],u=t[o*2],c=t[o*2+1],p=t[a*2],f=t[a*2+1],y=u-s,m=c-l,h=p-s,g=f-l;y*g-m*h>0?(r.push(i),r.push(a),r.push(o)):(r.push(i),r.push(o),r.push(a))}return r}function nb(t,e,r){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let n=0,i=t[e[0]*2];for(let l=1;l<e.length;l++){let u=t[e[l]*2];u<i&&(i=u,n=l)}let o=e.length,a=n,s=(a+1)%o;for(;;){let l=a-1>=0?a-1:o-1,u=(s+1)%o,c=t[e[l]*2],p=t[e[l]*2+1],f=t[e[u]*2],y=t[e[u]*2+1],m=t[e[a]*2],h=t[e[a]*2+1],g=t[e[s]*2],d=t[e[s]*2+1],x=!1;if(c<f)x=!0;else if(c>f)x=!1;else{let b=g-m,S=d-h,A=-b,w=h<d?1:-1,T=((c-m)*S+(p-h)*A)*w,M=((f-m)*S+(y-h)*A)*w;T>M&&(x=!0)}if(x){let b=e[l],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),a--,a<0&&(a=o-1)}else{let b=e[u],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),s++,s>=o&&(s=0)}if(l===u)break}}function ga(t,e,r,n,i,o,a,s,l){let u=i.length/2,c=a&&s&&l;if(u<pe.MAX_VERTEX_ARRAY_LENGTH){let p=e.prepareSegment(u,r,n),f=p.vertexLength;for(let h=0;h<o.length;h+=3)n.emplaceBack(f+o[h],f+o[h+1],f+o[h+2]);p.vertexLength+=u,p.primitiveLength+=o.length/3;let y,m;c&&(m=a.prepareSegment(u,r,s),y=m.vertexLength,m.vertexLength+=u);for(let h=0;h<i.length;h+=2)t(i[h],i[h+1]);if(c)for(let h=0;h<l.length;h++){let g=l[h];for(let d=1;d<g.length;d+=2)s.emplaceBack(y+g[d-1],y+g[d]);m.primitiveLength+=g.length/2}}else ib(e,r,n,i,o,t),c&&ob(a,r,s,i,l,t),e.forceNewSegmentOnNextPrepare(),a?.forceNewSegmentOnNextPrepare()}function pi(t,e,r,n,i,o,a){if(o){let s=n.count;return r(e[i*2],e[i*2+1]),t[i]=n.count,n.count++,a.vertexLength++,s}else return t[i]}function ib(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=2;p<i.length;p+=3){let f=i[p-2],y=i[p-1],m=i[p],h=a[f]<l,g=a[y]<l,d=a[m]<l,x=(h?1:0)+(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,h=!0,g=!0,d=!0,c=0);let b=pi(a,n,o,s,f,h,u),v=pi(a,n,o,s,y,g,u),S=pi(a,n,o,s,m,d,u);r.emplaceBack(c+b-l,c+v-l,c+S-l),u.primitiveLength++}}function ob(t,e,r,n,i,o){let a=[];for(let p=0;p<n.length/2;p++)a.push(-1);let s={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),c=u.vertexLength;for(let p=0;p<i.length;p++){let f=i[p];for(let y=1;y<i[p].length;y+=2){let m=f[y-1],h=f[y],g=a[m]<l,d=a[h]<l,x=(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,g=!0,d=!0,c=0);let b=pi(a,n,o,s,m,g,u),v=pi(a,n,o,s,h,d,u);r.emplaceBack(c+b-l,c+v-l),u.primitiveLength++}}}var ab=500,ur=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Xo,this.indexArray=new Fe,this.indexArray2=new Lt,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.segments2=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Fr("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:_e(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Dr("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,n,i,o,a){for(let s of Yt(r,ab)){let l=da(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;ga((c,p)=>{u.emplaceBack(c,p)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};I("FillBucket",ur,{omit:["layers","patternFeatures"]});var Op,sb=()=>Op=Op||new ee({"fill-sort-key":new F(P.layout_fill["fill-sort-key"])}),Gp,lb=()=>Gp=Gp||new ee({"fill-antialias":new E(P.paint_fill["fill-antialias"]),"fill-opacity":new F(P.paint_fill["fill-opacity"]),"fill-color":new F(P.paint_fill["fill-color"]),"fill-outline-color":new F(P.paint_fill["fill-outline-color"]),"fill-translate":new E(P.paint_fill["fill-translate"]),"fill-translate-anchor":new E(P.paint_fill["fill-translate-anchor"]),"fill-pattern":new pt(P.paint_fill["fill-pattern"])}),Np={get paint(){return lb()},get layout(){return sb()}};var ba=class extends oe{constructor(e){super(e,Np)}recalculate(e,r){super.recalculate(e,r);let n=this.paint._values["fill-outline-color"];n.value.kind==="constant"&&n.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new ur(e)}queryRadius(){return Dt(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:r,transform:n,pixelsToTileUnits:i}){let o=Vt(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return aa(o,r)}isTileClipped(){return!0}};var ub=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Up=Q([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:$p,size:kS,alignment:ES}=ub;var Jp=Y(Rt(),1);var Pb=Jp.default.VectorTileFeature.types,Sb=500,bl=Math.pow(2,13);function fi(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*bl)*2+a,i*bl*2,o*bl*2,Math.round(s))}var cr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ho,this.centroidVertexArray=new qo,this.indexArray=new Fe,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Fr("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=Ne(i,l);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:_e(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Dr("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{},r.subdivisionGranularity),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(e,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n,e.subdivisionGranularity)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$p),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Up.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,n,i,o,a){for(let s of Yt(r,Sb)){let l={x:0,y:0,sampleCount:0},u=this.layoutVertexArray.length;this.processPolygon(l,i,e,s,a);let c=this.layoutVertexArray.length-u,p=Math.floor(l.x/l.sampleCount),f=Math.floor(l.y/l.sampleCount);for(let y=0;y<c;y++)this.centroidVertexArray.emplaceBack(p,f)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}processPolygon(e,r,n,i,o){if(i.length<1||Zp(i[0]))return;for(let p of i)p.length!==0&&wb(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(r.z),l=Pb[n.type]==="Polygon";for(let p of i){if(p.length===0||Zp(p))continue;let f=Ke(p,s,l);this._generateSideFaces(f,a)}if(!l)return;let u=da(i,r,s,!1),c=this.layoutVertexArray;ga((p,f)=>{fi(c,p,f,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(e,r){let n=0;for(let i=1;i<e.length;i++){let o=e[i],a=e[i-1];if(Ab(o,a))continue;r.segment.vertexLength+4>pe.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=o.sub(a)._perp()._unit(),l=a.dist(o);n+l>32768&&(n=0),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,n);let u=r.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}};function wb(t,e){for(let r=0;r<e.length;r++){let n=e[r];r===e.length-1&&e[0].x===n.x&&e[0].y===n.y||(t.x+=n.x,t.y+=n.y,t.sampleCount++)}}I("FillExtrusionBucket",cr,{omit:["layers","features"]});function Ab(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Zp(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Yp,_b=()=>Yp=Yp||new ee({"fill-extrusion-opacity":new E(P["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new F(P["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new E(P["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new E(P["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new pt(P["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new F(P["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new F(P["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new E(P["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Kp={get paint(){return _b()}};var va=Y(ye(),1);var Pa=class extends oe{constructor(e){super(e,Kp)}createBucket(e){return new cr(e)}queryRadius(){return Dt(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){let l=Vt(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),u=this.paint.get("fill-extrusion-height").evaluate(r,n),c=this.paint.get("fill-extrusion-base").evaluate(r,n),p=Cb(l,s,0),f=Tb(i,c,u,s),y=f[0],m=f[1];return Ib(y,m,p)}};function yi(t,e){return t.x*e.x+t.y*e.y}function Qp(t,e){if(t.length===1){let r=0,n=e[r++],i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){let o=e[r],a=t[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=yi(s,s),p=yi(s,l),f=yi(l,l),y=yi(u,s),m=yi(u,l),h=c*f-p*p,g=(f*y-p*m)/h,d=(c*m-p*y)/h,x=1-g-d,b=n.z*x+i.z*g+o.z*d;if(isFinite(b))return b}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function Ib(t,e,r){let n=1/0;aa(r,e)&&(n=Qp(r,e[0]));for(let i=0;i<e.length;i++){let o=e[i],a=t[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];mp(r,f)&&(n=Math.min(n,Qp(r,f)))}}return n===1/0?!1:n}function Tb(t,e,r,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of t){let h=[],g=[];for(let d of m){let x=d.x,b=d.y,v=n[0]*x+n[4]*b+n[12],S=n[1]*x+n[5]*b+n[13],A=n[2]*x+n[6]*b+n[14],w=n[3]*x+n[7]*b+n[15],T=v+a,M=S+s,D=A+l,V=w+u,z=v+c,L=S+p,_=A+f,B=w+y,G=new va.default(T/V,M/V);G.z=D/V,h.push(G);let O=new va.default(z/B,L/B);O.z=_/B,g.push(O)}i.push(h),o.push(g)}return[i,o]}function Cb(t,e,r){let n=[];for(let i of t){let o=[i.x,i.y,r,1];Wi.transformMat4(o,o,e),n.push(new va.default(o[0]/o[3],o[1]/o[3]))}return n}var kb=Q([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ef,size:fw,alignment:yw}=kb;var Eb=Q([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:tf,size:dw,alignment:gw}=Eb;var of=Y(Rt(),1);var Mb=of.default.VectorTileFeature.types,rf=63,Lb=Math.cos(75/2*(Math.PI/180)),Fb=15,Db=20,Vb=15,af=1/2,nf=Math.pow(2,Vb-1)/af,pr=class{constructor(e){this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Zo,this.layoutVertexArray2=new Jo,this.indexArray=new Fe,this.programConfigurations=new Ae(e.layers,e.zoom),this.segments=new pe,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Fr("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,f=Ne(s,p);if(!this.layers[0]._featureFilter.filter(new W(this.zoom,{globalState:this.globalState}),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:_e(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Dr("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{},r.subdivisionGranularity);let p=e[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(e,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,n)}addFeatures(e,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,tf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ef),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let r=+e.properties.mapbox_clip_start,n=+e.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(e,r,n,i,o,a){let s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),u=s.get("line-cap"),c=s.get("line-miter-limit"),p=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let f of r)this.addLine(f,e,l,u,c,p,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a,s,l){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let u=s?l.line.getGranularityForZoomLevel(s.z):1;if(e=Ke(e,u),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=Mb[r.type]==="Polygon",p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let f=0;for(;f<p-1&&e[f].equals(e[f+1]);)f++;if(p<(c?3:2))return;n==="bevel"&&(o=1.05);let y=this.overscaling<=16?Fb*8192/(512*this.overscaling):0,m=this.segments.prepareSegment(p*10,this.layoutVertexArray,this.indexArray),h,g,d,x,b;this.e1=this.e2=-1,c&&(h=e[p-2],b=e[f].sub(h)._unit()._perp());for(let v=f;v<p;v++){if(d=v===p-1?c?e[f+1]:void 0:e[v+1],d&&e[v].equals(d))continue;b&&(x=b),h&&(g=h),h=e[v],b=d?d.sub(h)._unit()._perp():x,x=x||b;let S=x.add(b);(S.x!==0||S.y!==0)&&S._unit();let A=x.x*b.x+x.y*b.y,w=S.x*b.x+S.y*b.y,T=w!==0?1/w:1/0,M=2*Math.sqrt(2-2*w),D=w<Lb&&g&&d,V=x.x*b.y-x.y*b.x>0;if(D&&v>f){let _=h.dist(g);if(_>2*y){let B=h.sub(h.sub(g)._mult(y/_)._round());this.updateDistance(g,B),this.addCurrentVertex(B,x,0,0,m),g=B}}let z=g&&d,L=z?n:c?"butt":i;if(z&&L==="round"&&(T<a?L="miter":T<=2&&(L="fakeround")),L==="miter"&&T>o&&(L="bevel"),L==="bevel"&&(T>2&&(L="flipbevel"),T<o&&(L="miter")),g&&this.updateDistance(g,h),L==="miter")S._mult(T),this.addCurrentVertex(h,S,0,0,m);else if(L==="flipbevel"){if(T>100)S=b.mult(-1);else{let _=T*x.add(b).mag()/x.sub(b).mag();S._perp()._mult(_*(V?-1:1))}this.addCurrentVertex(h,S,0,0,m),this.addCurrentVertex(h,S.mult(-1),0,0,m)}else if(L==="bevel"||L==="fakeround"){let _=-Math.sqrt(T*T-1),B=V?_:0,G=V?0:_;if(g&&this.addCurrentVertex(h,x,B,G,m),L==="fakeround"){let O=Math.round(M*180/Math.PI/Db);for(let R=1;R<O;R++){let K=R/O;if(K!==.5){let re=K-.5,me=1.0904+A*(-3.2452+A*(3.55645-A*1.43519)),Ut=.848013+A*(-1.06021+A*.215638);K=K+K*re*(K-1)*(me*re*re+Ut)}let X=b.sub(x)._mult(K)._add(x)._unit()._mult(V?-1:1);this.addHalfVertex(h,X.x,X.y,!1,V,0,m)}}d&&this.addCurrentVertex(h,b,-B,-G,m)}else if(L==="butt")this.addCurrentVertex(h,S,0,0,m);else if(L==="square"){let _=g?1:-1;this.addCurrentVertex(h,S,_,_,m)}else L==="round"&&(g&&(this.addCurrentVertex(h,x,0,0,m),this.addCurrentVertex(h,x,1,1,m,!0)),d&&(this.addCurrentVertex(h,b,-1,-1,m,!0),this.addCurrentVertex(h,b,0,0,m)));if(D&&v<p-1){let _=h.dist(d);if(_>2*y){let B=h.add(d.sub(h)._mult(y/_)._round());this.updateDistance(h,B),this.addCurrentVertex(B,b,0,0,m),h=B}}}}addCurrentVertex(e,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(e,s,l,a,!1,n,o),this.addHalfVertex(e,u,c,a,!0,-i,o),this.distance>nf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,n,i,o,a))}addHalfVertex({x:e,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(nf-1):this.scaledDistance)*af;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(rf*n)+128,Math.round(rf*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,p,this.e2),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}};I("LineBucket",pr,{omit:["layers","patternFeatures"]});var sf,Bb=()=>sf=sf||new ee({"line-cap":new E(P.layout_line["line-cap"]),"line-join":new F(P.layout_line["line-join"]),"line-miter-limit":new E(P.layout_line["line-miter-limit"]),"line-round-limit":new E(P.layout_line["line-round-limit"]),"line-sort-key":new F(P.layout_line["line-sort-key"])}),lf,Rb=()=>lf=lf||new ee({"line-opacity":new F(P.paint_line["line-opacity"]),"line-color":new F(P.paint_line["line-color"]),"line-translate":new E(P.paint_line["line-translate"]),"line-translate-anchor":new E(P.paint_line["line-translate-anchor"]),"line-width":new F(P.paint_line["line-width"]),"line-gap-width":new F(P.paint_line["line-gap-width"]),"line-offset":new F(P.paint_line["line-offset"]),"line-blur":new F(P.paint_line["line-blur"]),"line-dasharray":new tr(P.paint_line["line-dasharray"]),"line-pattern":new pt(P.paint_line["line-pattern"]),"line-gradient":new ft(P.paint_line["line-gradient"])}),xl={get paint(){return Rb()},get layout(){return Bb()}};var vl=class extends F{possiblyEvaluate(e,r){return r=new W(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,n,i){return r=de({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Sa;var wa=class extends oe{constructor(e){super(e,xl),this.gradientVersion=0,Sa||(Sa=new vl(xl.paint.properties["line-width"].specification),Sa.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();fc(r)?this.stepInterpolant=r._styleExpression.expression instanceof Pr:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Sa.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new pr(e)}queryRadius(e){let r=e,n=uf(ar("line-width",this,r),ar("line-gap-width",this,r)),i=ar("line-offset",this,r);return n/2+Math.abs(i)+Dt(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=Vt(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*uf(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),u=this.paint.get("line-offset").evaluate(r,n);return u&&(i=bp(i,u*a)),dp(s,i,l)}isTileClipped(){return!0}};function uf(t,e){return e>0?e+2*t:t}var cf=Q([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pf=Q([{name:"a_projected_pos",components:3,type:"Float32"}],4),Zw=Q([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ff=Q([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),Jw=Q([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Pl=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Yw=Q([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Kw=Q([{name:"triangle",components:3,type:"Uint16"}]),Qw=Q([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),eA=Q([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),tA=Q([{type:"Float32",name:"offsetX"}]),rA=Q([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),nA=Q([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var vi=Y(ye(),1);function zb(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),we.applyArabicShaping&&(t=we.applyArabicShaping(t)),t}function yf(t,e,r){return t.sections.forEach(n=>{n.text=zb(n.text,e,r)}),t}function mf(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=e[c];return delete e[c],e[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return`${u}:${f.x}:${f.y}`}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in e&&r[y]!==e[m]){let h=s(y,m,p),g=a(y,m,n[h].geometry);delete e[y],delete r[m],r[l(f,n[g].geometry,!0)]=g,n[h].geometry=null}else y in r?a(y,m,p):m in e?s(y,m,p):(o(u),e[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var zr={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function hf(t){let e="";for(let r=0;r<t.length;r++){let n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;(!n||!Ys(n)||zr[t[r+1]])&&(!i||!Ys(i)||zr[t[r-1]])&&zr[t[r]]?e+=zr[t[r]]:e+=t[r]}return e}var ae=24;var rx=Y(mi(),1),nx=3;var Ia=nx;function hi(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],o=0,a=0;for(let s of t)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();c&&l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}var he=1;var Ta=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a,textFitWidth:s,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n,this.textFitWidth=s,this.textFitHeight=l}get tl(){return[this.paddedRect.x+he,this.paddedRect.y+he]}get br(){return[this.paddedRect.x+this.paddedRect.w-he,this.paddedRect.y+this.paddedRect.h-he]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-he*2)/this.pixelRatio,(this.paddedRect.h-he*2)/this.pixelRatio]}},di=class{constructor(e,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,n,o),this.addImages(r,i,o);let{w:a,h:s}=hi(o),l=new fe({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;fe.copy(c.data,l,{x:0,y:0},{x:p.x+he,y:p.y+he},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+he,y=p.y+he,m=c.data.width,h=c.data.height;fe.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),fe.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),fe.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),fe.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),fe.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(e,r,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*he,h:o.data.height+2*he};n.push(a),r[i]=new Ta(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),r)}patchUpdatedImage(e,r,n){if(!e||!r||e.version===r.version)return;e.version=r.version;let[i,o]=e.tl;n.update(r.data,void 0,{x:i,y:o})}};I("ImagePosition",Ta);I("ImageAtlas",di);var Ea=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(Ea||{}),bi=-17;function ix(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var Sf=57344,wf=63743,Ca=class t{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(e,r,n){let i=new t;return i.scale=e||1,i.fontStack=r,i.verticalAlign=n||"bottom",i}static forImage(e,r){let n=new t;return n.imageName=e,n.verticalAlign=r||"bottom",n}},gi=class t{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){let n=new t;for(let i=0;i<e.sections.length;i++){let o=e.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=hf(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&ka[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ka[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){let n=new t;return n.text=this.text.substring(e,r),n.sectionIndex=this.sectionIndex.slice(e,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,n=0;for(let i=0;i<this.length();i++){let o=this.getSection(i);if(o.imageName){let a=e[o.imageName];if(!a)continue;let s=a.displaySize;r=Math.max(r,s[0]),n=Math.max(n,s[1])}}return{maxImageWidth:r,maxImageHeight:n}}addTextSection(e,r){this.text+=e.text,this.sections.push(Ca.forText(e.scale,e.fontStack||r,e.verticalAlign));let n=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(n)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){ce("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){ce(`Reached maximum number of images ${wf-Sf+2}`);return}this.text+=String.fromCharCode(n),this.sections.push(Ca.forImage(r,e.verticalAlign)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=wf?null:++this.imageSectionID:(this.imageSectionID=Sf,this.imageSectionID)}};function ox(t,e){let r=[],n=t.text,i=0;for(let o of e)r.push(t.substring(i,o)),i=o;return i<n.length&&r.push(t.substring(i,n.length)),r}function xi(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=gi.fromFeature(t,i);p===2&&h.verticalizePunctuation();let g,{processBidirectionalText:d,processStyledBidirectionalText:x}=we;if(d&&h.sections.length===1){g=[];let S=d(h.toString(),Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A,w.sections=h.sections;for(let T=0;T<A.length;T++)w.sectionIndex.push(0);g.push(w)}}else if(x){g=[];let S=x(h.text,h.sectionIndex,Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A[0],w.sectionIndex=A[1],w.sections=h.sections,g.push(w)}}else g=ox(h,Al(h,u,o,e,n,y));let b=[],v={positionedLines:b,text:h.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return yx(v,e,r,n,g,a,s,l,p,u,f,m),ix(b)?!1:v}var ka={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ax={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},sx={40:!0};function If(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ae/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function lx(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=If(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function Af(t,e,r,n){let i=Math.pow(t-e,2);return n?t<e?i/2:i*2:i+Math.abs(r)*r}function ux(t,e,r){let n=0;return t===10&&(n-=1e4),r&&(n+=150),(t===40||t===65288)&&(n+=50),(e===41||e===65289)&&(n+=50),n}function _f(t,e,r,n,i,o){let a=null,s=Af(e,r,i,o);for(let l of n){let u=e-l.x,c=Af(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function Tf(t){return t?Tf(t.priorBreak).concat(t.index):[]}function Al(t,e,r,n,i,o){if(!t)return[];let a=[],s=lx(t,e,r,n,i,o),l=t.text.indexOf("\\u200B")>=0,u=0;for(let c=0;c<t.length();c++){let p=t.getSection(c),f=t.getCharCode(c);if(ka[f]||(u+=If(f,p,n,i,e,o)),c<t.length()-1){let y=Yc(f);(ax[f]||y||p.imageName||c!==t.length()-2&&sx[t.getCharCode(c+1)])&&a.push(_f(c+1,u,s,a,ux(f,t.getCharCode(c+1),y&&l),!1))}}return Tf(_f(t.length(),u,s,a,0,!0))}function Cf(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:e,verticalAlign:r}}function cx(t,e,r){let n=e.getMaxScale()*ae,{maxImageWidth:i,maxImageHeight:o}=e.getMaxImageSize(t),a=Math.max(n,o*r);return{verticalLineContentWidth:Math.max(n,i*r),horizontalLineContentHeight:a}}function kf(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function px(t,e,r,n){if(t&&t.rect)return t;let i=e[r.fontStack],o=i&&i[n];return o?{rect:null,metrics:o.metrics}:null}function fx(t,e,r){return!(t===1||!e&&!Mo(r)||e&&(ka[r]||Kc(r)))}function yx(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=0,m=0,h=0,g=s==="right"?1:s==="left"?0:.5,d=ae/p,x=0;for(let S of i){S.trim();let A=S.getMaxScale(),w={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=w;let T=w.positionedGlyphs,M=0;if(!S.length()){y+=o,++x;continue}let D=cx(n,S,d);for(let L=0;L<S.length();L++){let _=S.getSection(L),B=S.getSectionIndex(L),G=S.getCharCode(L),O=fx(l,c,G),R;if(_.imageName){if(t.iconsInText=!0,_.scale=_.scale*d,R=hx(_,O,A,D,n),!R)continue;M=Math.max(M,R.imageOffset)}else if(R=mx(_,G,O,D,e,r),!R)continue;let{rect:K,metrics:X,baselineOffset:re}=R;if(T.push({glyph:G,imageName:_.imageName,x:f,y:y+re+bi,vertical:O,scale:_.scale,fontStack:_.fontStack,sectionIndex:B,metrics:X,rect:K}),!O)f+=X.advance*_.scale+u;else{t.verticalizable=!0;let me=_.imageName?X.advance:ae;f+=me*_.scale+u}}if(T.length!==0){let L=f-u;m=Math.max(L,m),dx(T,0,T.length-1,g)}f=0;let V=(A-1)*ae;w.lineOffset=Math.max(M,V);let z=o*A+M;y+=z,h=Math.max(z,h),++x}let{horizontalAlign:b,verticalAlign:v}=Cf(a);gx(t.positionedLines,g,b,v,m,h,o,y,i.length),t.top+=-v*y,t.bottom=t.top+y,t.left+=-b*m,t.right=t.left+m}function mx(t,e,r,n,i,o){let a=o[t.fontStack],s=a&&a[e],l=px(s,i,t,e);if(l===null)return null;let u;if(r)u=n.verticalLineContentWidth-t.scale*ae;else{let c=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-t.scale*ae)*c}return{rect:l.rect,metrics:l.metrics,baselineOffset:u}}function hx(t,e,r,n,i){let o=i[t.imageName];if(!o)return null;let a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:he,top:-Ia,advance:e?s[1]:s[0]},u;if(e)u=n.verticalLineContentWidth-s[1]*t.scale;else{let p=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-s[1]*t.scale)*p}let c=(e?s[0]:s[1])*t.scale-ae*r;return{rect:a,metrics:l,baselineOffset:u,imageOffset:c}}function dx(t,e,r,n){if(n===0)return;let i=t[r],o=i.metrics.advance*i.scale,a=(t[r].x+o)*n;for(let s=e;s<=r;s++)t[s].x-=a}function gx(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-bi:c=-n*l*a+.5*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function Ef(t,e,r){let{horizontalAlign:n,verticalAlign:i}=Cf(r),o=e[0],a=e[1],s=o-t.displaySize[0]*n,l=s+t.displaySize[0],u=a-t.displaySize[1]*i,c=u+t.displaySize[1];return{image:t,top:u,bottom:c,left:s,right:l}}function Ma(t){let e=t.left,r=t.top,n=t.right-e,i=t.bottom-r,o=t.image.content[2]-t.image.content[0],a=t.image.content[3]-t.image.content[1],s=t.image.textFitWidth??"stretchOrShrink",l=t.image.textFitHeight??"stretchOrShrink",u=o/a;if(l==="proportional"){if(s==="stretchOnly"&&n/i<u||s==="proportional"){let c=Math.ceil(i*u);e*=c/n,n=c}}else if(s==="proportional"&&l==="stretchOnly"&&u!==0&&n/i>u){let c=Math.ceil(n/u);r*=c/i,i=c}return{x1:e,y1:r,x2:e+n,y2:r+i}}function _l(t,e,r,n,i,o){let a=t.image,s;if(a.content){let g=a.content,d=a.pixelRatio||1;s=[g[0]/d,g[1]/d,a.displaySize[0]-g[2]/d,a.displaySize[1]-g[3]/d]}let l=e.left*o,u=e.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=e.top*o,h=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var Mf=Y(Rt(),1);var Nr=255,zt=128,Qe=Nr*zt;function Il(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new W(t+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=t;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new W(s)),c=r.evaluate(new W(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function Tl(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var bx=Mf.default.VectorTileFeature.types,xx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function La(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(Qe,Math.round(s[0])):0,m=s?Math.min(Qe,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function Lf(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function vx(t){for(let e of t.sections)if(ep(e.text))return!0;return!1}var Pi=class{constructor(e){this.layoutVertexArray=new Yo,this.indexArray=new Fe,this.programConfigurations=e,this.segments=new pe,this.dynamicLayoutVertexArray=new Ko,this.opacityVertexArray=new Qo,this.hasVisibleVertices=!1,this.placedSymbolArray=new qn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,cf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,pf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,xx,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};I("SymbolBuffers",Pi);var Si=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new pe,this.collisionVertexArray=new ea}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,ff.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I("CollisionBuffers",Si);var Xe=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.globalState=e.globalState,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(l=>l.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=Tl(i,"text-overlap","text-allow-overlap")!=="never"||Tl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>Ea[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Pi(new Ae(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Pi(new Ae(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Xn,this.lineVertexArray=new Hn,this.symbolInstances=new Wn,this.textAnchorOffsets=new Zn}calculateGlyphDependencies(e,r,n,i,o){for(let a=0;a<e.length;a++)if(r[e.charCodeAt(a)]=!0,(n||i)&&o){let s=zr[e.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(e,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Ee&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new W(this.zoom,{globalState:this.globalState});for(let{feature:g,id:d,index:x,sourceLayerIndex:b}of e){let v=i._featureFilter.needGeometry,S=Ne(g,v);if(!i._featureFilter.filter(h,S,n))continue;v||(S.geometry=_e(g));let A;if(u){let D=i.getValueAndResolveTokens("text-field",S,n,m),V=Ee.factory(D),z=this.hasRTLText=this.hasRTLText||vx(V);(!z||we.getRTLTextPluginStatus()==="unavailable"||z&&we.isParsed())&&(A=yf(V,i,S))}let w;if(c){let D=i.getValueAndResolveTokens("icon-image",S,n,m);D instanceof Se?w=D:w=Se.fromString(D)}if(!A&&!w)continue;let T=this.sortFeaturesByKey?p.evaluate(S,{},n):void 0,M={id:d,text:A,icon:w,index:x,sourceLayerIndex:b,geometry:S.geometry,properties:g.properties,type:bx[g.type],sortKey:T};if(this.features.push(M),w&&(f[w.name]=!0),A){let D=a.evaluate(S,{},n).join(","),V=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let z of A.sections)if(z.image)f[z.image.name]=!0;else{let L=In(A.toString()),_=z.fontStack||D,B=y[_]=y[_]||{};this.calculateGlyphDependencies(z.text,B,V,this.allowVerticalPlacement,L)}}}o.get("symbol-placement")==="line"&&(this.features=mf(this.features)),this.sortFeaturesByKey&&this.features.sort((g,d)=>g.sortKey-d.sortKey)}update(e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){let n=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(r[e.segment+1]),o=e.dist(r[e.segment]),a={};for(let s=e.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,r,n,i,o,a,s,l,u,c,p,f){let y=e.indexArray,m=e.layoutVertexArray,h=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,d=h.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<r.length;v++){let{tl:S,tr:A,bl:w,br:T,tex:M,pixelOffsetTL:D,pixelOffsetBR:V,minFontScaleX:z,minFontScaleY:L,glyphOffset:_,isSDF:B,sectionIndex:G}=r[v],O=h.vertexLength,R=_[1];La(m,l.x,l.y,S.x,R+S.y,M.x,M.y,n,B,D.x,D.y,z,L),La(m,l.x,l.y,A.x,R+A.y,M.x+M.w,M.y,n,B,V.x,D.y,z,L),La(m,l.x,l.y,w.x,R+w.y,M.x,M.y+M.h,n,B,D.x,V.y,z,L),La(m,l.x,l.y,T.x,R+T.y,M.x+M.w,M.y+M.h,n,B,V.x,V.y,z,L),Lf(e.dynamicLayoutVertexArray,l,x),y.emplaceBack(O,O+2,O+1),y.emplaceBack(O+1,O+2,O+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(_[0]),(v===r.length-1||G!==r[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,b&&b[G])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,d,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,r,n,i,o,a){return r.emplaceBack(0,0),e.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(e,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,r,n,i){for(let o=e;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Si(Yn,Pl.members,Lt),this.iconCollisionBox=new Si(Yn,Pl.members,Lt);for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=e.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=e.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=e.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=e.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){let n=e.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)e.indexArray.emplaceBack(o,o+2,o+1),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(e),n=Math.cos(e),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(e,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};I("SymbolBucket",Xe,{omit:["layers","collisionBoxArray","features","compareText"]});Xe.MAX_GLYPHS=65535;Xe.addDynamicAttributes=Lf;function Ff(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var Df,Px=()=>Df=Df||new ee({"symbol-placement":new E(P.layout_symbol["symbol-placement"]),"symbol-spacing":new E(P.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new E(P.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new F(P.layout_symbol["symbol-sort-key"]),"symbol-z-order":new E(P.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new E(P.layout_symbol["icon-allow-overlap"]),"icon-overlap":new E(P.layout_symbol["icon-overlap"]),"icon-ignore-placement":new E(P.layout_symbol["icon-ignore-placement"]),"icon-optional":new E(P.layout_symbol["icon-optional"]),"icon-rotation-alignment":new E(P.layout_symbol["icon-rotation-alignment"]),"icon-size":new F(P.layout_symbol["icon-size"]),"icon-text-fit":new E(P.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new E(P.layout_symbol["icon-text-fit-padding"]),"icon-image":new F(P.layout_symbol["icon-image"]),"icon-rotate":new F(P.layout_symbol["icon-rotate"]),"icon-padding":new F(P.layout_symbol["icon-padding"]),"icon-keep-upright":new E(P.layout_symbol["icon-keep-upright"]),"icon-offset":new F(P.layout_symbol["icon-offset"]),"icon-anchor":new F(P.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new E(P.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new E(P.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new E(P.layout_symbol["text-rotation-alignment"]),"text-field":new F(P.layout_symbol["text-field"]),"text-font":new F(P.layout_symbol["text-font"]),"text-size":new F(P.layout_symbol["text-size"]),"text-max-width":new F(P.layout_symbol["text-max-width"]),"text-line-height":new E(P.layout_symbol["text-line-height"]),"text-letter-spacing":new F(P.layout_symbol["text-letter-spacing"]),"text-justify":new F(P.layout_symbol["text-justify"]),"text-radial-offset":new F(P.layout_symbol["text-radial-offset"]),"text-variable-anchor":new E(P.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new F(P.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new F(P.layout_symbol["text-anchor"]),"text-max-angle":new E(P.layout_symbol["text-max-angle"]),"text-writing-mode":new E(P.layout_symbol["text-writing-mode"]),"text-rotate":new F(P.layout_symbol["text-rotate"]),"text-padding":new E(P.layout_symbol["text-padding"]),"text-keep-upright":new E(P.layout_symbol["text-keep-upright"]),"text-transform":new F(P.layout_symbol["text-transform"]),"text-offset":new F(P.layout_symbol["text-offset"]),"text-allow-overlap":new E(P.layout_symbol["text-allow-overlap"]),"text-overlap":new E(P.layout_symbol["text-overlap"]),"text-ignore-placement":new E(P.layout_symbol["text-ignore-placement"]),"text-optional":new E(P.layout_symbol["text-optional"])}),Vf,Sx=()=>Vf=Vf||new ee({"icon-opacity":new F(P.paint_symbol["icon-opacity"]),"icon-color":new F(P.paint_symbol["icon-color"]),"icon-halo-color":new F(P.paint_symbol["icon-halo-color"]),"icon-halo-width":new F(P.paint_symbol["icon-halo-width"]),"icon-halo-blur":new F(P.paint_symbol["icon-halo-blur"]),"icon-translate":new E(P.paint_symbol["icon-translate"]),"icon-translate-anchor":new E(P.paint_symbol["icon-translate-anchor"]),"text-opacity":new F(P.paint_symbol["text-opacity"]),"text-color":new F(P.paint_symbol["text-color"],{runtimeType:ze,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new F(P.paint_symbol["text-halo-color"]),"text-halo-width":new F(P.paint_symbol["text-halo-width"]),"text-halo-blur":new F(P.paint_symbol["text-halo-blur"]),"text-translate":new E(P.paint_symbol["text-translate"]),"text-translate-anchor":new E(P.paint_symbol["text-translate-anchor"])}),Fa={get paint(){return Sx()},get layout(){return Px()}};var wi=class{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:wr,this.defaultValue=e}evaluate(e){if(e.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;e(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};I("FormatSectionOverride",wi,{omit:["defaultValue"]});var Da=class t extends oe{constructor(e){super(e,Fa)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let i=[];for(let o of n)i.indexOf(o)<0&&i.push(o);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,n,i){let o=this.layout.get(e).evaluate(r,{},n,i),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!wn(a.value)&&o?Ff(r.properties,o):o}createBucket(e){return new Xe(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Fa.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new wi(r),i=new Ht(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new Je("source",i):o=new Tt("composite",i,r.value.zoomStops),this.paint._values[e]=new ge(r.property,o,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,n){return!this.layout||r.isDataDriven()||n.isDataDriven()?!1:t.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let n=e.get("text-field"),i=Fa.paint.properties[r],o=!1,a=s=>{for(let l of s)if(i.overrides&&i.overrides.hasOverride(l)){o=!0;return}};if(n.value.kind==="constant"&&n.value.value instanceof Ee)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof _t&&ue(u.value)===Ar){let c=u.value;a(c.sections)}else u instanceof pn?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function Bf(t,e,r,n=1){let i=t.get("icon-padding").evaluate(e,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var Rf,wx=()=>Rf=Rf||new ee({"background-color":new E(P.paint_background["background-color"]),"background-pattern":new tr(P.paint_background["background-pattern"]),"background-opacity":new E(P.paint_background["background-opacity"])}),zf={get paint(){return wx()}};var Va=class extends oe{constructor(e){super(e,zf)}};var Of,Ax=()=>Of=Of||new ee({"raster-opacity":new E(P.paint_raster["raster-opacity"]),"raster-hue-rotate":new E(P.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new E(P.paint_raster["raster-brightness-min"]),"raster-brightness-max":new E(P.paint_raster["raster-brightness-max"]),"raster-saturation":new E(P.paint_raster["raster-saturation"]),"raster-contrast":new E(P.paint_raster["raster-contrast"]),"raster-resampling":new E(P.paint_raster["raster-resampling"]),"raster-fade-duration":new E(P.paint_raster["raster-fade-duration"])}),Gf={get paint(){return Ax()}};var Ba=class extends oe{constructor(e){super(e,Gf)}};var Ra=class extends oe{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Nf(t){if(t.type==="custom")return new Ra(t);switch(t.type){case"background":return new Va(t);case"circle":return new la(t);case"color-relief":return new pa(t);case"fill":return new ba(t);case"fill-extrusion":return new Pa(t);case"heatmap":return new ua(t);case"hillshade":return new ca(t);case"line":return new wa(t);case"raster":return new Ba(t);case"symbol":return new Da(t)}}var za=class{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(e,r){for(let i of e){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Nf(i);o._featureFilter=Ct(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=dc(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var fy=Y(Rt(),1),yy=Y(mi(),1);var Ur=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){let n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};var $f=Y(Rt(),1),jf=Y(mi(),1);var Oa=class{constructor(e,r,n,i,o){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=n,e._y=i,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(e[r]=this[r]);return e}};var Ai=Y(ye(),1),fr=class t{constructor(){this.minX=1/0;this.maxX=-1/0;this.minY=1/0;this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new t;return r.extend(e(new Ai.default(this.minX,this.minY))),r.extend(e(new Ai.default(this.maxX,this.minY))),r.extend(e(new Ai.default(this.minX,this.maxY))),r.extend(e(new Ai.default(this.maxX,this.maxY))),r}static fromPoints(e){let r=new t;for(let n of e)r.extend(n);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};var _i=class{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new $t(8192,16,0),this.grid3D=new $t(8192,16,0),this.featureIndexArray=new Jn,this.promoteId=r}insert(e,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new $f.default.VectorTile(new jf.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ur(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,n,i){this.loadVTLayers();let o=e.params,a=8192/e.tileSize/e.scale,s=Ct(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=fr.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=fr.fromPoints(e.cameraQueryGeometry).expandBy(u),y=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,(g,d,x,b)=>gp(e.cameraQueryGeometry,g-u,d-u,x+u,b+u));for(let g of y)p.push(g);p.sort(_x);let m={},h;for(let g=0;g<p.length;g++){let d=p[g];if(d===h)continue;h=d;let x=this.featureIndexArray.get(d),b=null;this.loadMatchingFeature(m,x.bucketIndex,x.sourceLayerIndex,x.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,S,A)=>(b||(b=_e(v)),S.queryIntersectsFeature({queryGeometry:l,feature:v,featureState:A,geometry:b,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!f.some(d=>a.has(d)))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let d=Ne(h,!0);if(!o.filter(new W(this.tileID.overscaledZ),d,this.tileID.canonical))return}else if(!o.filter(new W(this.tileID.overscaledZ),h))return;let g=this.getId(h,y);for(let d=0;d<f.length;d++){let x=f[d];if(a&&!a.has(x))continue;let b=l[x];if(!b)continue;let v={};g&&c&&(v=c.getState(b.sourceLayer||"_geojsonTileLayer",g));let S=de({},u[x]);S.paint=Uf(S.paint,b.paint,h,v,s),S.layout=Uf(S.layout,b.layout,h,v,s);let A=!p||p(h,b,v);if(!A)continue;let w=new Oa(h,this.z,this.x,this.y,g);w.layer=S;let T=e[x];T===void 0&&(T=e[x]=[]),T.push({featureIndex:i,feature:w,intersectionZ:A})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=Ct(o);for(let p of e)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(e){for(let r of this.bucketLayerIDs)for(let n of r)if(e===n)return!0;return!1}getId(e,r){let n=e.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=e.properties[i],typeof n=="boolean"&&(n=Number(n)),n===void 0&&e.properties?.cluster&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};I("FeatureIndex",_i,{omit:["rawTileData","sourceLayerCoder"]});function Uf(t,e,r,n,i){return tn(t,(o,a)=>{let s=e instanceof kt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function _x(t,e){return e-t}var qf=Y(ye(),1);var et=class t extends qf.default{constructor(e,r,n,i){super(e,r),this.angle=n,i!==void 0&&(this.segment=i)}clone(){return new t(this.x,this.y,this.angle,this.segment)}};I("Anchor",et);function Cl(t,e,r,n,i){if(e.segment===void 0||r===0)return!0;let o=e,a=e.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=t[a-1],p=t[a],f=t[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Wf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Xf(t,e,r){return t?3/5*e*r:0}function Hf(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Zf(t,e,r,n,i,o){let a=Xf(r,i,o),s=Hf(r,n)*o,l=0,u=Wf(t)/2;for(let c=0;c<t.length-1;c++){let p=t[c],f=t[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=lt.number(p.x,f.x,m),g=lt.number(p.y,f.y,m),d=new et(h,g,f.angleTo(p),c);return d._round(),!a||Cl(t,d,s,a,e)?d:void 0}l+=y}}function Jf(t,e,r,n,i,o,a,s,l){let u=Xf(n,o,a),c=Hf(n,i),p=c*a,f=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-p<e/4&&(e=p+e/4);let y=o*2,m=f?e/2*s%e:(c/2+y)*a*s%e;return Yf(t,m,e,u,r,p,f,!1,l)}function Yf(t,e,r,n,i,o,a,s,l){let u=o/2,c=Wf(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let h=t[m],g=t[m+1],d=h.dist(g),x=g.angleTo(h);for(;f+r<p+d;){f+=r;let b=(f-p)/d,v=lt.number(h.x,g.x,b),S=lt.number(h.y,g.y,b);if(v>=0&&v<l&&S>=0&&S<l&&f-u>=0&&f+u<=c){let A=new et(v,S,x,m);A._round(),(!n||Cl(t,A,o,n,i))&&y.push(A)}}p+=d}return!s&&!y.length&&!a&&(y=Yf(t,p/2,r,n,i,o,a,!0,l)),y}var ht=Y(ye(),1);function Kf(t,e,r,n,i){let o=[];for(let a=0;a<t.length;a++){let s=t[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<e&&p.x<e||(c.x<e?c=new ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new ht.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ht.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ht.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ht.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var be=Y(ye(),1);var $r=he;function kl(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*$r,l=o.paddedRect.h-2*$r,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},c=o.stretchX||[[0,s]],p=o.stretchY||[[0,l]],f=(_,B)=>_+B[1]-B[0],y=c.reduce(f,0),m=p.reduce(f,0),h=s-y,g=l-m,d=0,x=y,b=0,v=m,S=0,A=h,w=0,T=g;if(o.content&&n){let _=o.content,B=_[2]-_[0],G=_[3]-_[1];(o.textFitWidth||o.textFitHeight)&&(u=Ma(t)),d=Ga(c,0,_[0]),b=Ga(p,0,_[1]),x=Ga(c,_[0],_[2]),v=Ga(p,_[1],_[3]),S=_[0]-d,w=_[1]-b,A=B-x,T=G-v}let M=u.x1,D=u.y1,V=u.x2-M,z=u.y2-D,L=(_,B,G,O)=>{let R=Na(_.stretch-d,x,V,M),K=Ua(_.fixed-S,A,_.stretch,y),X=Na(B.stretch-b,v,z,D),re=Ua(B.fixed-w,T,B.stretch,m),me=Na(G.stretch-d,x,V,M),Ut=Ua(G.fixed-S,A,G.stretch,y),tt=Na(O.stretch-b,v,z,D),gt=Ua(O.fixed-w,T,O.stretch,m),Gi=new be.default(R,X),Ni=new be.default(me,X),Ui=new be.default(me,tt),$i=new be.default(R,tt),is=new be.default(K/a,re/a),Ie=new be.default(Ut/a,gt/a),bt=e*Math.PI/180;if(bt){let xt=Math.sin(bt),Zr=Math.cos(bt),Ve=[Zr,-xt,xt,Zr];Gi._matMult(Ve),Ni._matMult(Ve),$i._matMult(Ve),Ui._matMult(Ve)}let Hr=_.stretch+_.fixed,os=G.stretch+G.fixed,ji=B.stretch+B.fixed,as=O.stretch+O.fixed,Te={x:o.paddedRect.x+$r+Hr,y:o.paddedRect.y+$r+ji,w:os-Hr,h:as-ji},xe=A/a/V,rt=T/a/z;return{tl:Gi,tr:Ni,bl:$i,br:Ui,tex:Te,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:is,pixelOffsetBR:Ie,minFontScaleX:xe,minFontScaleY:rt,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(L({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=Qf(c,h,y),B=Qf(p,g,m);for(let G=0;G<_.length-1;G++){let O=_[G],R=_[G+1];for(let K=0;K<B.length-1;K++){let X=B[K],re=B[K+1];i.push(L(O,X,R,re))}}}return i}function Ga(t,e,r){let n=0;for(let i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Qf(t,e,r){let n=[{fixed:-$r,stretch:0}];for(let[i,o]of t){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:e+$r,stretch:r}),n}function Na(t,e,r,n){return t/e*r+n}function Ua(t,e,r,n){return t-e*r/n}function ey(t,e,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of e.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=Ia+1,h=!0,g=1,d=0,x=(i||s)&&p.vertical,b=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let X=(p.scale-1)*ae,re=(ae-p.metrics.width*p.scale)/2;d=c.lineOffset/2-(p.imageName?-re:X)}if(p.imageName){let X=a[p.imageName];h=X.sdf,g=X.pixelRatio,m=he/g}let v=i?[p.x+b,p.y]:[0,0],S=i?[0,0]:[p.x+b+r[0],p.y+r[1]-d],A=[0,0];x&&(A=S,S=[0,0]);let w=p.metrics.isDoubleResolution?2:1,T=(p.metrics.left-m)*p.scale-b+S[0],M=(-p.metrics.top-m)*p.scale+S[1],D=T+f.w/w*p.scale/g,V=M+f.h/w*p.scale/g,z=new be.default(T,M),L=new be.default(D,M),_=new be.default(T,V),B=new be.default(D,V);if(x){let X=new be.default(-b,b-bi),re=-Math.PI/2,me=ae/2-b,Ut=p.imageName?me:0,tt=new be.default(5-bi-me,-Ut),gt=new be.default(...A);z._rotateAround(re,X)._add(tt)._add(gt),L._rotateAround(re,X)._add(tt)._add(gt),_._rotateAround(re,X)._add(tt)._add(gt),B._rotateAround(re,X)._add(tt)._add(gt)}if(l){let X=Math.sin(l),re=Math.cos(l),me=[re,-X,X,re];z._matMult(me),L._matMult(me),_._matMult(me),B._matMult(me)}let G=new be.default(0,0),O=new be.default(0,0);u.push({tl:z,tr:L,bl:_,br:B,tex:f,writingMode:e.writingMode,glyphOffset:v,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:G,pixelOffsetBR:O,minFontScaleX:0,minFontScaleY:0})}return u}var Ii=Y(ye(),1);var yr=class{constructor(e,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=e.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?Ma(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};p.y1=p.y1*s-l[0],p.y2=p.y2*s+l[2],p.x1=p.x1*s-l[3],p.x2=p.x2*s+l[1];let f=a.collisionPadding;if(f&&(p.x1-=f[0]*s,p.y1-=f[1]*s,p.x2+=f[2]*s,p.y2+=f[3]*s),c){let y=new Ii.default(p.x1,p.y1),m=new Ii.default(p.x2,p.y1),h=new Ii.default(p.x1,p.y2),g=new Ii.default(p.x2,p.y2),d=c*Math.PI/180;y._rotate(d),m._rotate(d),h._rotate(d),g._rotate(d),p.x1=Math.min(y.x,m.x,h.x,g.x),p.x2=Math.max(y.x,m.x,h.x,g.x),p.y1=Math.min(y.y,m.y,h.y,g.y),p.y2=Math.max(y.y,m.y,h.y,g.y)}e.emplaceBack(r.x,r.y,p.x1,p.y1,p.x2,p.y2,n,i,o)}this.boxEndIndex=e.length}};var Ti=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};var El=Y(ye(),1);function ty(t,e=1,r=!1){let n=fr.fromPoints(t[0]),i=Math.min(n.width(),n.height()),o=i/2,a=new Ti([],Ix),{minX:s,minY:l,maxX:u,maxY:c}=n;if(i===0)return new El.default(s,l);for(let y=s;y<u;y+=i)for(let m=l;m<c;m+=i)a.push(new jr(y+o,m+o,o,t));let p=Cx(t),f=a.length;for(;a.length;){let y=a.pop();(y.d>p.d||!p.d)&&(p=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,f)),!(y.max-p.d<=e)&&(o=y.h/2,a.push(new jr(y.p.x-o,y.p.y-o,o,t)),a.push(new jr(y.p.x+o,y.p.y-o,o,t)),a.push(new jr(y.p.x-o,y.p.y+o,o,t)),a.push(new jr(y.p.x+o,y.p.y+o,o,t)),f+=4)}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Ix(t,e){return e.max-t.max}function jr(t,e,r,n){this.p=new El.default(t,e),this.h=r,this.d=Tx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Tx(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){let o=e[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>t.y!=c.y>t.y&&t.x<(c.x-u.x)*(t.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,ll(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Cx(t){let e=0,r=0,n=0,i=t[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,e+=c*3}return new jr(r/e,n/e,0,t)}var Dl=Y(rl(),1);var Ml=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(Ml||{}),Ot=7,$a=Number.POSITIVE_INFINITY;function Ll(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(i){case"top-right":case"top-left":s=l-Ot;break;case"bottom-right":case"bottom-left":s=-l+Ot;break;case"bottom":s=-o+Ot;break;case"top":s=o-Ot;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-Ot;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Ot;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return e[1]!==$a?n(t,e[0],e[1]):r(t,e[0])}function Fl(t,e,r){let n=t.layout,i=n.get("text-variable-anchor-offset")?.evaluate(e,{},r);if(i){let a=i.values,s=[];for(let l=0;l<a.length;l+=2){let u=s[l]=a[l],c=a[l+1].map(p=>p*ae);u.startsWith("top")?c[1]-=Ot:u.startsWith("bottom")&&(c[1]+=Ot),s[l+1]=c}return new Me(s)}let o=n.get("text-variable-anchor");if(o){let a;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?a=[n.get("text-radial-offset").evaluate(e,{},r)*ae,$a]:a=n.get("text-offset").evaluate(e,{},r).map(u=>u*ae);let l=[];for(let u of o)l.push(u,Ll(u,a));return new Me(l)}return null}function iy(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=8192/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new W(t.bucket.zoom+1),t.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new W(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new W(c),t.canonical),i["text-size"].possiblyEvaluate(new W(p),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new W(c),t.canonical),i["icon-size"].possiblyEvaluate(new W(p),t.canonical)]}let a=n.get("text-line-height")*ae,s=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",l=n.get("text-keep-upright"),u=n.get("text-size");for(let c of t.bucket.features){let p=n.get("text-font").evaluate(c,{},t.canonical).join(","),f=u.evaluate(c,{},t.canonical),y=o.layoutTextSize.evaluate(c,{},t.canonical),m=o.layoutIconSize.evaluate(c,{},t.canonical),h={horizontal:{},vertical:void 0},g=c.text,d=[0,0];if(g){let S=g.toString(),A=n.get("text-letter-spacing").evaluate(c,{},t.canonical)*ae,w=Zc(S)?A:0,T=n.get("text-anchor").evaluate(c,{},t.canonical),M=Fl(r,c,t.canonical);if(!M){let _=n.get("text-radial-offset").evaluate(c,{},t.canonical);_?d=Ll(T,[_*ae,$a]):d=n.get("text-offset").evaluate(c,{},t.canonical).map(B=>B*ae)}let D=s?"center":n.get("text-justify").evaluate(c,{},t.canonical),z=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(c,{},t.canonical)*ae:1/0,L=()=>{t.bucket.allowVerticalPlacement&&In(S)&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,"left",w,d,2,!0,y,f))};if(!s&&M){let _=new Set;if(D==="auto")for(let G=0;G<M.values.length;G+=2)_.add(ry(M.values[G]));else _.add(D);let B=!1;for(let G of _)if(!h.horizontal[G])if(B)h.horizontal[G]=h.horizontal[0];else{let O=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,"center",G,w,d,1,!1,y,f);O&&(h.horizontal[G]=O,B=O.positionedLines.length===1)}L()}else{D==="auto"&&(D=ry(T));let _=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,1,!1,y,f);_&&(h.horizontal[D]=_),L(),In(S)&&s&&l&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,2,!1,y,f))}}let x,b=!1;if(c.icon&&c.icon.name){let S=t.imageMap[c.icon.name];S&&(x=Ef(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),b=!!S.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(S.pixelRatio!==t.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let v=oy(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||x)&&kx(t.bucket,c,h,x,t.imageMap,o,y,m,d,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function ry(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function kx(t,e,r,n,i,o,a,s,l,u,c,p){let f=o.textMaxSize.evaluate(e,{});f===void 0&&(f=a);let y=t.layers[0].layout,m=y.get("icon-offset").evaluate(e,{},c),h=oy(r.horizontal),g=24,d=a/g,x=t.tilePixelRatio*d,b=t.tilePixelRatio*f/g,v=t.tilePixelRatio*s,S=t.tilePixelRatio*y.get("symbol-spacing"),A=y.get("text-padding")*t.tilePixelRatio,w=Bf(y,e,c,t.tilePixelRatio),T=y.get("text-max-angle")/180*Math.PI,M=y.get("text-rotation-alignment")!=="viewport"&&y.get("symbol-placement")!=="point",D=y.get("icon-rotation-alignment")==="map"&&y.get("symbol-placement")!=="point",V=y.get("symbol-placement"),z=S/2,L=y.get("icon-text-fit"),_;n&&L!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(_=_l(n,r.vertical,L,y.get("icon-text-fit-padding"),m,d)),h&&(n=_l(n,h,L,y.get("icon-text-fit-padding"),m,d)));let B=c?p.line.getGranularityForZoomLevel(c.z):1,G=(O,R)=>{R.x<0||R.x>=8192||R.y<0||R.y>=8192||Mx(t,R,O,r,n,i,_,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,x,[A,A,A,A],M,l,v,w,D,m,e,o,u,c,a)};if(V==="line")for(let O of Kf(e.geometry,0,0,8192,8192)){let R=Ke(O,B),K=Jf(R,S,T,r.vertical||h,n,g,b,t.overscaling,8192);for(let X of K){let re=h;(!re||!Lx(t,re.text,z,X))&&G(R,X)}}else if(V==="line-center"){for(let O of e.geometry)if(O.length>1){let R=Ke(O,B),K=Zf(R,T,r.vertical||h,n,g,b);K&&G(R,K)}}else if(e.type==="Polygon")for(let O of Yt(e.geometry,0)){let R=ty(O,16),K=Ke(O[0],B,!0);G(K,new et(R.x,R.y,0))}else if(e.type==="LineString")for(let O of e.geometry){let R=Ke(O,B);G(R,new et(R[0].x,R[0].y,0))}else if(e.type==="Point")for(let O of e.geometry)for(let R of O)G([R],new et(R.x,R.y,0))}function Ex(t,e){let r=t.length,n=e?.values;if(n?.length>0)for(let i=0;i<n.length;i+=2){let o=Ml[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function ny(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=ey(e,r,s,i,o,a,n,t.allowVerticalPlacement),g=t.textSizeData,d=null;g.kind==="source"?(d=[zt*i.layout.get("text-size").evaluate(a,{})],d[0]>Qe&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)):g.kind==="composite"&&(d=[zt*y.compositeTextSizes[0].evaluate(a,{},m),zt*y.compositeTextSizes[1].evaluate(a,{},m)],(d[0]>Qe||d[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)),t.addSymbols(t.text,h,d,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let x of c)p[x]=t.text.placedSymbolArray.length-1;return h.length*4}function oy(t){for(let e in t)return t[e];return null}function Mx(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,v,S,A,w,T){let M=t.addToLineVertexArray(e,r),D,V,z,L,_=0,B=0,G=0,O=0,R=-1,K=-1,X={},re=(0,Dl.default)("");if(t.allowVerticalPlacement&&n.vertical){let xe=s.layout.get("text-rotate").evaluate(v,{},w)+90,rt=n.vertical;z=new yr(l,e,u,c,p,rt,f,y,m,xe),a&&(L=new yr(l,e,u,c,p,a,g,d,m,xe))}if(i){let Te=s.layout.get("icon-rotate").evaluate(v,{}),xe=s.layout.get("icon-text-fit")!=="none",rt=kl(i,Te,A,xe),xt=a?kl(a,Te,A,xe):void 0;V=new yr(l,e,u,c,p,i,g,d,!1,Te),_=rt.length*4;let Zr=t.iconSizeData,Ve=null;Zr.kind==="source"?(Ve=[zt*s.layout.get("icon-size").evaluate(v,{})],Ve[0]>Qe&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)):Zr.kind==="composite"&&(Ve=[zt*S.compositeIconSizes[0].evaluate(v,{},w),zt*S.compositeIconSizes[1].evaluate(v,{},w)],(Ve[0]>Qe||Ve[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)),t.addSymbols(t.icon,rt,Ve,b,x,v,0,e,M.lineStartIndex,M.lineLength,-1,w),R=t.icon.placedSymbolArray.length-1,xt&&(B=xt.length*4,t.addSymbols(t.icon,xt,Ve,b,x,v,2,e,M.lineStartIndex,M.lineLength,-1,w),K=t.icon.placedSymbolArray.length-1)}let me=Object.keys(n.horizontal);for(let Te of me){let xe=n.horizontal[Te];if(!D){re=(0,Dl.default)(xe.text);let xt=s.layout.get("text-rotate").evaluate(v,{},w);D=new yr(l,e,u,c,p,xe,f,y,m,xt)}let rt=xe.positionedLines.length===1;if(G+=ny(t,e,xe,o,s,m,v,h,M,n.vertical?1:3,rt?me:[Te],X,R,S,w),rt)break}n.vertical&&(O+=ny(t,e,n.vertical,o,s,m,v,h,M,2,["vertical"],X,K,S,w));let Ut=D?D.boxStartIndex:t.collisionBoxArray.length,tt=D?D.boxEndIndex:t.collisionBoxArray.length,gt=z?z.boxStartIndex:t.collisionBoxArray.length,Gi=z?z.boxEndIndex:t.collisionBoxArray.length,Ni=V?V.boxStartIndex:t.collisionBoxArray.length,Ui=V?V.boxEndIndex:t.collisionBoxArray.length,$i=L?L.boxStartIndex:t.collisionBoxArray.length,is=L?L.boxEndIndex:t.collisionBoxArray.length,Ie=-1,bt=(Te,xe)=>Te&&Te.circleDiameter?Math.max(Te.circleDiameter,xe):xe;Ie=bt(D,Ie),Ie=bt(z,Ie),Ie=bt(V,Ie),Ie=bt(L,Ie);let Hr=Ie>-1?1:0;Hr&&(Ie*=T/ae),t.glyphOffsetArray.length>=Xe.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let os=Fl(s,v,w),[ji,as]=Ex(t.textAnchorOffsets,os);t.symbolInstances.emplaceBack(e.x,e.y,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical||-1,R,K,re,Ut,tt,gt,Gi,Ni,Ui,$i,is,u,G,O,_,B,Hr,0,f,Ie,ji,as)}function Lx(t,e,r,n){let i=t.compareText;if(!(e in i))i[e]=[];else{let o=i[e];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[e].push(n),!1}var ja=1,Ci=class{constructor(e){let r={},n=[];for(let s in e){let l=e[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*ja,h:p.bitmap.height+2*ja};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=hi(n),a=new sr({width:i||1,height:o||1});for(let s in e){let l=e[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;sr.copy(c.bitmap,a,{x:0,y:0},{x:p.x+ja,y:p.y+ja},c.bitmap)}}this.image=a,this.positions=r}};I("GlyphAtlas",Ci);function sy(t,e,r){e=Math.pow(2,r)-e-1;var n=ay(t*256,e*256,r),i=ay((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function ay(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=t*n-2*Math.PI*6378137/2,o=e*n-2*Math.PI*6378137/2;return[i,o]}var py=Y(ye(),1);var Vl=63710088e-1,ki=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(wu(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,n=this.lat*r,i=e.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*r);return Vl*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof t)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new t(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new t(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var ly=2*Math.PI*Vl;function uy(t){return ly*Math.cos(t*Math.PI/180)}function Fx(t){return(180+t)/360}function Dx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Vx(t,e){return t/uy(e)}function Bx(t){return t*360-180}function Bl(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Rx(t,e){return t*uy(Bl(e))}function zx(t){return 1/Math.cos(t*Math.PI/180)}var Ei=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=ki.convert(e);return new t(Fx(n.lng),Dx(n.lat),Vx(r,n.lat))}toLngLat(){return new ki(Bx(this.x),Bl(this.y))}toAltitude(){return Rx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ly*zx(Bl(this.y))}};function cy(t,e,r){return!(t<Hi||t>Xi||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}var qa=class{constructor(e,r,n){if(!cy(e,r,n))throw new Error(`x=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} ${Hi}<=z<=${Xi} `);this.z=e,this.x=r,this.y=n,this.key=Mi(0,e,e,r,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,n){let i=sy(this.x,this.y,this.z),o=Ox(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){let r=Math.pow(2,this.z);return new py.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},Rl=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Mi(e,r.z,r.z,r.x,r.y)}},Li=class t{constructor(e,r,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new qa(n,+i,+o),this.key=Mi(r,e,n,i,o)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?Mi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Mi(this.wrap*+r,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new t(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new t(r,this.wrap,r,n,i),new t(r,this.wrap,r,n+1,i),new t(r,this.wrap,r,n,i+1),new t(r,this.wrap,r,n+1,i+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new t(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new t(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Rl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Ei(e.x-this.wrap,e.y))}};function Mi(t,e,r,n,i){t*=2,t<0&&(t=t*-1-1);let o=1<<r;return(o*o*t+o*i+n).toString(36)+r.toString(36)+e.toString(36)}function Ox(t,e,r){let n="",i;for(let o=t;o>0;o--)i=1<<o-1,n+=(e&i?1:0)+(r&i?2:0);return n}I("CanonicalTileID",qa);I("OverscaledTileID",Li,{omit:["terrainRttPosMatrix32f"]});var Wa=class{constructor(e){this.tileID=new Li(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[],this.globalState=e.globalState}async parse(e,r,n,i,o){this.status="parsing",this.data=e,this.collisionBoxArray=new jn;let a=new Ur(Object.keys(e.layers).sort()),s=new _i(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n,subdivisionGranularity:o},c=r.familiesBySource[this.source];for(let A in c){let w=e.layers[A];if(!w)continue;w.version===1&&ce(`Vector tile source "${this.source}" layer "${A}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let T=a.encode(A),M=[];for(let D=0;D<w.length;D++){let V=w.feature(D),z=s.getId(V,A);M.push({feature:V,id:z,index:D,sourceLayerIndex:T})}for(let D of c[A]){let V=D[0];if(V.source!==this.source&&ce(`layer.source = ${V.source} does not equal this.source = ${this.source}`),V.minzoom&&this.zoom<Math.floor(V.minzoom)||V.maxzoom&&this.zoom>=V.maxzoom||V.visibility==="none")continue;zl(D,this.zoom,n),(l[V.id]=V.createBucket({index:s.bucketLayerIDs.length,layers:D,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source,globalState:this.globalState})).populate(M,u,this.tileID.canonical),s.bucketLayerIDs.push(D.map(L=>L.id))}}let p=tn(u.glyphDependencies,A=>Object.keys(A).map(Number));this.inFlightDependencies.forEach(A=>A?.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){let A=new AbortController;this.inFlightDependencies.push(A),f=i.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},A)}let y=Object.keys(u.iconDependencies),m=Promise.resolve({});if(y.length){let A=new AbortController;this.inFlightDependencies.push(A),m=i.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"icons"}},A)}let h=Object.keys(u.patternDependencies),g=Promise.resolve({});if(h.length){let A=new AbortController;this.inFlightDependencies.push(A),g=i.sendAsync({type:"GI",data:{icons:h,source:this.source,tileID:this.tileID,type:"patterns"}},A)}let[d,x,b]=await Promise.all([f,m,g]),v=new Ci(d),S=new di(x,b);for(let A in l){let w=l[A];w instanceof Xe?(zl(w.layers,this.zoom,n),iy({bucket:w,glyphMap:d,glyphPositions:v.positions,imageMap:x,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):w.hasPattern&&(w instanceof pr||w instanceof ur||w instanceof cr)&&(zl(w.layers,this.zoom,n),w.addFeatures(u,this.tileID.canonical,S.patternPositions))}return this.status="done",{buckets:Object.values(l).filter(A=>!A.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:v.image,imageAtlas:S,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?x:null,glyphPositions:this.returnDependencies?v.positions:null}}};function zl(t,e,r){let n=new W(e);for(let i of t)i.recalculate(n,r)}var Gx=60,XI=1e3/Gx;var qr=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}};var Wr=class{constructor(e,r,n){this.actor=e,this.layerIndex=r,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}async loadVectorTile(e,r){let n=await Uc(e.request,r);try{return{vectorTile:new fy.default.VectorTile(new yy.default(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(i){let o=new Uint8Array(n.data),a=o[0]===31&&o[1]===139,s=`Unable to parse the tile at ${e.request.url}, `;throw a?s+="please make sure the data is not gzipped and that you have configured the relevant header in the server":s+=`got error: ${i.message}`,new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new qr(e.request):!1,i=new Wa(e);this.loading[r]=i;let o=new AbortController;i.abort=o;try{let a=await this.loadVectorTile(e,o);if(delete this.loading[r],!a)return null;let s=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);let u={};if(n){let p=n.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}i.vectorTile=a.vectorTile;let c=i.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return de({rawTileData:s.slice(0)},p,l,u)}finally{delete this.fetching[r]}}catch(a){throw delete this.loading[r],i.status="done",this.loaded[r]=i,a}}async reloadTile(e){let r=e.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let n=this.loaded[r];if(n.showCollisionBoxes=e.showCollisionBoxes,n.globalState=e.globalState,n.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=de({rawTileData:a.slice(0)},i,s,l)}else o=i;return o}if(n.status==="done"&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity)}async abortTile(e){let r=this.loading,n=e.uid;r&&r[n]&&r[n].abort&&(r[n].abort.abort(),delete r[n])}async removeTile(e){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}};var Xa=class{constructor(){this.loaded={}}async loadTile(e){let{uid:r,encoding:n,rawImageData:i,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,u=i.width+2,c=i.height+2,p=vt(i)?new fe({width:u,height:c},await Iu(i,-1,-1,u,c)):i,f=new ii(r,p,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=f,f}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var Gy=Y(gy(),1);var Ol=Y(ye(),1),by=Y(Rt(),1);var Nx=by.default.VectorTileFeature.prototype.toGeoJSON,Gl=class{constructor(e){this._feature=e,this.extent=8192,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(this._feature.type===1){let e=[];for(let r of this._feature.geometry)e.push([new Ol.default(r[0],r[1])]);return e}else{let e=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new Ol.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Nx.call(this,e,r,n)}},Za=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new Gl(this._features[e])}};var Ny=Y(Ay(),1);var _y=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$l=1,Di=8,Bi=class t{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==$l)throw new Error(`Got v${i} data when expected v${$l}.`);let o=_y[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new t(s,a,o,e)}constructor(e,r=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=_y.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Di+a+s+l),this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,($l<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return ql(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let g=f;g<=p;g++){let d=a[2*g],x=a[2*g+1];d>=e&&d<=n&&x>=r&&x<=i&&u.push(o[g])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=e&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?e<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let g=f;g<=p;g++)Iy(o[2*g],o[2*g+1],e,r)<=u&&l.push(i[g]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];Iy(m,h,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function ql(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;Ty(t,e,a,n,i,o),ql(t,e,r,n,a-1,1-o),ql(t,e,r,a+1,i,1-o)}function Ty(t,e,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));Ty(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(Vi(t,e,n,r),e[2*i+o]>a&&Vi(t,e,n,i);s<l;){for(Vi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?Vi(t,e,n,l):(l++,Vi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Vi(t,e,r,n){jl(t,r,n),jl(e,2*r,2*n),jl(e,2*r+1,2*n+1)}function jl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function Iy(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Kx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Cy=Math.fround||(t=>(e=>(t[0]=+e,t[0])))(new Float32Array(1)),mr=2,Nt=3,Wl=4,Gt=5,Ey=6,Ri=class{constructor(e){this.options=Object.assign(Object.create(Kx),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o=`prepare ${e.length} points`;r&&console.time(o),this.points=e;let a=[];for(let l=0;l<e.length;l++){let u=e[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=Cy(Ya(c)),y=Cy(Ka(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(e,r){let n=((e[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,e[1])),o=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(Ya(n),Ka(a),Ya(o),Ka(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Gt]>1?ky(u,f,this.clusterProps):this.points[u[f+Nt]])}return c}getChildren(e){let r=this._getOriginId(e),n=this._getOriginZoom(e),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+Wl]===e&&p.push(a[y+Gt]>1?ky(a,y,this.clusterProps):this.points[a[y+Nt]])}if(p.length===0)throw new Error(i);return p}getLeaves(e,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,e,r,n,0),i}getTile(e,r,n){let i=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(e){let r=this._getOriginZoom(e)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(e);if(r++,n.length!==1)break;e=n[0].properties.cluster_id}return r}_appendLeaves(e,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(e,l.cluster_id,n,i,o):o<i?o++:e.push(s),e.length===n)break}return o}_createTree(e){let r=new Bi(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)r.add(e[n],e[n+1]);return r.finish(),r.data=e,r}_addTileFeatures(e,r,n,i,o,a){for(let s of e){let l=s*this.stride,u=r[l+Gt]>1,c,p,f;if(u)c=My(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Nt]];c=h.properties;let[g,d]=h.geometry.coordinates;p=Ya(g),f=Ka(d)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Nt]:m=this.points[r[l+Nt]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=e.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+mr]<=r)continue;l[p+mr]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),h=l[p+Gt],g=h;for(let d of m){let x=d*c;l[x+mr]>r&&(g+=l[x+Gt])}if(g>h&&g>=a){let d=f*h,x=y*h,b,v=-1,S=((p/c|0)<<5)+(r+1)+this.points.length;for(let A of m){let w=A*c;if(l[w+mr]<=r)continue;l[w+mr]=r;let T=l[w+Gt];d+=l[w]*T,x+=l[w+1]*T,l[w+Wl]=S,o&&(b||(b=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,w)))}l[p+Wl]=S,u.push(d/g,x/g,1/0,S,-1,g),o&&u.push(v)}else{for(let d=0;d<c;d++)u.push(l[p+d]);if(g>1)for(let d of m){let x=d*c;if(!(l[x+mr]<=r)){l[x+mr]=r;for(let b=0;b<c;b++)u.push(l[x+b])}}}}return u}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,r,n){if(e[r+Gt]>1){let a=this.clusterProps[e[r+Ey]];return n?Object.assign({},a):a}let i=this.points[e[r+Nt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function ky(t,e,r){return{type:"Feature",id:t[e+Nt],properties:My(t,e,r),geometry:{type:"Point",coordinates:[Qx(t[e]),e0(t[e+1])]}}}function My(t,e,r){let n=t[e+Gt],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,o=t[e+Ey],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Nt],point_count:n,point_count_abbreviated:i})}function Ya(t){return t/360+.5}function Ka(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Qx(t){return(t-.5)*360}function e0(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function zi(t,e,r,n){let i=n,o=e+(r-e>>1),a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1];for(let f=e+3;f<r;f+=3){let y=t0(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){let m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&zi(t,e,s,n),t[s+2]=i,r-s>3&&zi(t,s,r,n))}function t0(t,e,r,n,i,o){let a=i-r,s=o-n;if(a!==0||s!==0){let l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=t-r,s=e-n,a*a+s*s}function dt(t,e,r,n){let i={id:t??null,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")Qa(i,r);else if(e==="Polygon")Qa(i,r[0]);else if(e==="MultiLineString")for(let o of r)Qa(i,o);else if(e==="MultiPolygon")for(let o of r)Qa(i,o[0]);return i}function Qa(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Zl(t,e){let r=[];if(t.type==="FeatureCollection")for(let n=0;n<t.features.length;n++)es(r,t.features[n],e,n);else t.type==="Feature"?es(r,t,e):es(r,{geometry:t},e);return r}function es(t,e,r,n){if(!e.geometry)return;let i=e.geometry.coordinates;if(i&&i.length===0)return;let o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=e.id;if(r.promoteId?l=e.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")Ly(i,s);else if(o==="MultiPoint")for(let u of i)Ly(u,s);else if(o==="LineString")Hl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(let u of i)s=[],Hl(u,s,a,!1),t.push(dt(l,"LineString",s,e.properties));return}else Xl(i,s,a,!1);else if(o==="Polygon")Xl(i,s,a,!0);else if(o==="MultiPolygon")for(let u of i){let c=[];Xl(u,c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(let u of e.geometry.geometries)es(t,{id:l,geometry:u,properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(dt(l,o,s,e.properties))}function Ly(t,e){e.push(Fy(t[0]),Dy(t[1]),0)}function Hl(t,e,r,n){let i,o,a=0;for(let l=0;l<t.length;l++){let u=Fy(t[l][0]),c=Dy(t[l][1]);e.push(u,c,0),l>0&&(n?a+=(i*c-u*o)/2:a+=Math.sqrt(Math.pow(u-i,2)+Math.pow(c-o,2))),i=u,o=c}let s=e.length-3;e[2]=1,zi(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Xl(t,e,r,n){for(let i=0;i<t.length;i++){let o=[];Hl(t[i],o,r,n),e.push(o)}}function Fy(t){return t/360+.5}function Dy(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function Ue(t,e,r,n,i,o,a,s){if(r/=e,n/=e,o>=r&&a<n)return t;if(a<r||o>=n)return null;let l=[];for(let u of t){let c=u.geometry,p=u.type,f=i===0?u.minX:u.minY,y=i===0?u.maxX:u.maxY;if(f>=r&&y<n){l.push(u);continue}else if(y<r||f>=n)continue;let m=[];if(p==="Point"||p==="MultiPoint")r0(c,m,r,n,i);else if(p==="LineString")By(c,m,r,n,i,!1,s.lineMetrics);else if(p==="MultiLineString")Jl(c,m,r,n,i,!1);else if(p==="Polygon")Jl(c,m,r,n,i,!0);else if(p==="MultiPolygon")for(let h of c){let g=[];Jl(h,g,r,n,i,!0),g.length&&m.push(g)}if(m.length){if(s.lineMetrics&&p==="LineString"){for(let h of m)l.push(dt(u.id,p,h,u.tags));continue}(p==="LineString"||p==="MultiLineString")&&(m.length===1?(p="LineString",m=m[0]):p="MultiLineString"),(p==="Point"||p==="MultiPoint")&&(p=m.length===3?"Point":"MultiPoint"),l.push(dt(u.id,p,m,u.tags))}}return l.length?l:null}function r0(t,e,r,n,i){for(let o=0;o<t.length;o+=3){let a=t[o+i];a>=r&&a<=n&&Xr(e,t[o],t[o+1],t[o+2])}}function By(t,e,r,n,i,o,a){let s=Vy(t),l=i===0?n0:i0,u=t.start,c,p;for(let d=0;d<t.length-3;d+=3){let x=t[d],b=t[d+1],v=t[d+2],S=t[d+3],A=t[d+4],w=i===0?x:b,T=i===0?S:A,M=!1;a&&(c=Math.sqrt(Math.pow(x-S,2)+Math.pow(b-A,2))),w<r?T>r&&(p=l(s,x,b,S,A,r),a&&(s.start=u+c*p)):w>n?T<n&&(p=l(s,x,b,S,A,n),a&&(s.start=u+c*p)):Xr(s,x,b,v),T<r&&w>=r&&(p=l(s,x,b,S,A,r),M=!0),T>n&&w<=n&&(p=l(s,x,b,S,A,n),M=!0),!o&&M&&(a&&(s.end=u+c*p),e.push(s),s=Vy(t)),a&&(u+=c)}let f=t.length-3,y=t[f],m=t[f+1],h=t[f+2],g=i===0?y:m;g>=r&&g<=n&&Xr(s,y,m,h),f=s.length-3,o&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&Xr(s,s[0],s[1],s[2]),s.length&&e.push(s)}function Vy(t){let e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Jl(t,e,r,n,i,o){for(let a of t)By(a,e,r,n,i,o,!1)}function Xr(t,e,r,n){t.push(e,r,n)}function n0(t,e,r,n,i,o){let a=(o-e)/(n-e);return Xr(t,o,r+(i-r)*a,1),a}function i0(t,e,r,n,i,o){let a=(o-r)/(i-r);return Xr(t,e+(n-e)*a,o,1),a}function Kl(t,e){let r=e.buffer/e.extent,n=t,i=Ue(t,1,-1-r,r,0,-1,2,e),o=Ue(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=Ue(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=Ry(i,1).concat(n)),o&&(n=n.concat(Ry(o,-1)))),n}function Ry(t,e){let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Yl(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(let s of i.geometry)a.push(Yl(s,e))}else if(o==="MultiPolygon"){a=[];for(let s of i.geometry){let l=[];for(let u of s)l.push(Yl(u,e));a.push(l)}}r.push(dt(i.id,o,a,i.tags))}return r}function Yl(t,e){let r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function ts(t,e){if(t.transformed)return t;let r=1<<t.z,n=t.x,i=t.y;for(let o of t.features){let a=o.geometry,s=o.type;if(o.geometry=[],s===1)for(let l=0;l<a.length;l+=2)o.geometry.push(zy(a[l],a[l+1],e,r,n,i));else for(let l=0;l<a.length;l++){let u=[];for(let c=0;c<a[l].length;c+=2)u.push(zy(a[l][c],a[l][c+1],e,r,n,i));o.geometry.push(u)}}return t.transformed=!0,t}function zy(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function eu(t,e,r,n,i){let o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let s of t)o0(a,s,o,i);return a}function o0(t,e,r,n){let i=e.geometry,o=e.type,a=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),o==="Point"||o==="MultiPoint")for(let s=0;s<i.length;s+=3)a.push(i[s],i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")Ql(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let s=0;s<i.length;s++)Ql(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(let s=0;s<i.length;s++){let l=i[s];for(let u=0;u<l.length;u++)Ql(a,l[u],t,r,!0,u===0)}if(a.length){let s=e.tags||null;if(o==="LineString"&&n.lineMetrics){s={};for(let u in e.tags)s[u]=e.tags[u];s.mapbox_clip_start=i.start/i.size,s.mapbox_clip_end=i.end/i.size}let l={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:s};e.id!==null&&(l.id=e.id),t.features.push(l)}}function Ql(t,e,r,n,i,o){let a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}let s=[];for(let l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l],e[l+1])),r.numPoints++;i&&a0(s,o),t.push(s)}function a0(t,e){let r=0;for(let n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(let n=0,i=t.length;n<i/2;n+=2){let o=t[n],a=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=o,t[i-1-n]=a}}var s0={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ru=class{constructor(e,r){r=this.options=l0(Object.create(s0),r);let n=r.debug;if(n&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=Zl(e,r);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=Kl(i,r),i.length&&this.splitTile(i,0,0,0),n&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,r,n,i,o,a,s){let l=[e,r,n,i],u=this.options,c=u.debug;for(;l.length;){i=l.pop(),n=l.pop(),r=l.pop(),e=l.pop();let p=1<<r,f=tu(r,n,i),y=this.tiles[f];if(!y&&(c>1&&console.time("creation"),y=this.tiles[f]=eu(e,r,n,i,u),this.tileCoords.push({z:r,x:n,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,i,y.numFeatures,y.numPoints,y.numSimplified),console.timeEnd("creation"));let T=`z${r}`;this.stats[T]=(this.stats[T]||0)+1,this.total++}if(y.source=e,o==null){if(r===u.indexMaxZoom||y.numPoints<=u.indexMaxPoints)continue}else{if(r===u.maxZoom||r===o)continue;if(o!=null){let T=o-r;if(n!==a>>T||i!==s>>T)continue}}if(y.source=null,e.length===0)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,h=.5-m,g=.5+m,d=1+m,x=null,b=null,v=null,S=null,A=Ue(e,p,n-m,n+g,0,y.minX,y.maxX,u),w=Ue(e,p,n+h,n+d,0,y.minX,y.maxX,u);e=null,A&&(x=Ue(A,p,i-m,i+g,1,y.minY,y.maxY,u),b=Ue(A,p,i+h,i+d,1,y.minY,y.maxY,u),A=null),w&&(v=Ue(w,p,i-m,i+g,1,y.minY,y.maxY,u),S=Ue(w,p,i+h,i+d,1,y.minY,y.maxY,u),w=null),c>1&&console.timeEnd("clipping"),l.push(x||[],r+1,n*2,i*2),l.push(b||[],r+1,n*2,i*2+1),l.push(v||[],r+1,n*2+1,i*2),l.push(S||[],r+1,n*2+1,i*2+1)}}getTile(e,r,n){e=+e,r=+r,n=+n;let i=this.options,{extent:o,debug:a}=i;if(e<0||e>24)return null;let s=1<<e;r=r+s&s-1;let l=tu(e,r,n);if(this.tiles[l])return ts(this.tiles[l],o);a>1&&console.log("drilling down to z%d-%d-%d",e,r,n);let u=e,c=r,p=n,f;for(;!f&&u>0;)u--,c=c>>1,p=p>>1,f=this.tiles[tu(u,c,p)];return!f||!f.source?null:(a>1&&(console.log("found parent tile z%d-%d-%d",u,c,p),console.time("drilling down")),this.splitTile(f.source,u,c,p,e,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[l]?ts(this.tiles[l],o):null)}};function tu(t,e,r){return((1<<t)*r+e)*32+t}function l0(t,e){for(let r in e)t[r]=e[r];return t}function nu(t,e){return new ru(t,e)}function Oi(t,e){return e?t.properties[e]:t.id}function iu(t,e){if(t==null)return!0;if(t.type==="Feature")return Oi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=Oi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function ou(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(Oi(t,e),t);else for(let n of t.features)r.set(Oi(n,e),n);return r}function Oy(t,e,r){if(e.removeAll&&t.clear(),e.remove)for(let n of e.remove)t.delete(n);if(e.add)for(let n of e.add){let i=Oi(n,r);i!=null&&t.set(i,n)}if(e.update)for(let n of e.update){let i=t.get(n.id);if(i==null)continue;let o=n.newGeometry||n.removeAllProperties,a=!n.removeAllProperties&&(n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0);if((o||a)&&(i={...i},t.set(n.id,i),a&&(i.properties={...i.properties})),n.newGeometry&&(i.geometry=n.newGeometry),n.removeAllProperties)i.properties={};else if(n.removeProperties?.length>0)for(let s of n.removeProperties)Object.prototype.hasOwnProperty.call(i.properties,s)&&delete i.properties[s];if(n.addOrUpdateProperties?.length>0)for(let{key:s,value:l}of n.addOrUpdateProperties)i.properties[s]=l}}var rs=class extends Wr{constructor(){super(...arguments);this._dataUpdateable=new Map}async loadVectorTile(r,n){let i=r.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let o=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!o)return null;let a=new Za(o.features),s=(0,Ny.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){this._pendingRequest?.abort();let n=r&&r.request&&r.request.collectResourceTiming?new qr(r.request):!1;this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(r,this._pendingRequest),this._geoJSONIndex=r.cluster?new Ri(u0(r)).load((await this._pendingData).features):nu(await this._pendingData,r.geojsonVtOptions),this.loaded={};let i={};if(n){let o=n.finish();o&&(i.resourceTiming={},i.resourceTiming[r.source]=JSON.parse(JSON.stringify(o)))}return i}catch(i){if(delete this._pendingRequest,Fc(i))return{abandoned:!0};throw i}}async getData(){return this._pendingData}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadAndProcessGeoJSON(r,n){let i=await this.loadGeoJSON(r,n);if(delete this._pendingRequest,typeof i!="object")throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if((0,Gy.default)(i,!0),r.filter){let o=Qt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(o.result==="error")throw new Error(o.value.map(s=>`${s.key}: ${s.message}`).join(", "));i={type:"FeatureCollection",features:i.features.filter(s=>o.value.evaluate({zoom:0},s))}}return i}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await Nc(r.request,n);return this._dataUpdateable=iu(o.data,i)?ou(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=iu(o,i)?ou(o,i):void 0,o}catch{throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`)}if(!r.dataDiff)throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${r.source}`);return Oy(this._dataUpdateable,r.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}async removeSource(r){this._pendingRequest&&this._pendingRequest.abort()}getClusterExpansionZoom(r){return this._geoJSONIndex.getClusterExpansionZoom(r.clusterId)}getClusterChildren(r){return this._geoJSONIndex.getChildren(r.clusterId)}getClusterLeaves(r){return this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset)}};function u0({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(e);for(let s of a){let[l,u]=e[s],c=Qt(u),p=Qt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return t.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},t.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},t}var ns=class{constructor(e){this.self=e,this.actor=new Co(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(r,n)=>{if(this.externalWorkerSourceTypes[r])throw new Error(`Worker source with name "${r}" already registered.`);this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=Vc,this.self.removeProtocol=Bc,this.self.registerRTLTextPlugin=r=>{we.setMethods(r)},this.actor.registerMessageHandler("LDT",(r,n)=>this._getDEMWorkerSource(r,n.source).loadTile(n)),this.actor.registerMessageHandler("RDT",async(r,n)=>{this._getDEMWorkerSource(r,n.source).removeTile(n)}),this.actor.registerMessageHandler("GCEZ",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterExpansionZoom(n)),this.actor.registerMessageHandler("GCC",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterChildren(n)),this.actor.registerMessageHandler("GCL",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterLeaves(n)),this.actor.registerMessageHandler("LD",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadData(n)),this.actor.registerMessageHandler("GD",(r,n)=>this._getWorkerSource(r,n.type,n.source).getData()),this.actor.registerMessageHandler("LT",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadTile(n)),this.actor.registerMessageHandler("RT",(r,n)=>this._getWorkerSource(r,n.type,n.source).reloadTile(n)),this.actor.registerMessageHandler("AT",(r,n)=>this._getWorkerSource(r,n.type,n.source).abortTile(n)),this.actor.registerMessageHandler("RMT",(r,n)=>this._getWorkerSource(r,n.type,n.source).removeTile(n)),this.actor.registerMessageHandler("RS",async(r,n)=>{if(!this.workerSources[r]||!this.workerSources[r][n.type]||!this.workerSources[r][n.type][n.source])return;let i=this.workerSources[r][n.type][n.source];delete this.workerSources[r][n.type][n.source],i.removeSource!==void 0&&i.removeSource(n)}),this.actor.registerMessageHandler("RM",async r=>{delete this.layerIndexes[r],delete this.availableImages[r],delete this.workerSources[r],delete this.demWorkerSources[r]}),this.actor.registerMessageHandler("SR",async(r,n)=>{this.referrer=n}),this.actor.registerMessageHandler("SRPS",(r,n)=>this._syncRTLPluginState(r,n)),this.actor.registerMessageHandler("IS",async(r,n)=>{this.self.importScripts(n)}),this.actor.registerMessageHandler("SI",(r,n)=>this._setImages(r,n)),this.actor.registerMessageHandler("UL",async(r,n)=>{this._getLayerIndex(r).update(n.layers,n.removedIds)}),this.actor.registerMessageHandler("SL",async(r,n)=>{this._getLayerIndex(r).replace(n)})}async _setImages(e,r){this.availableImages[e]=r;for(let n in this.workerSources[e]){let i=this.workerSources[e][n];for(let o in i)i[o].availableImages=r}}async _syncRTLPluginState(e,r){return await we.syncState(r,this.self.importScripts)}_getAvailableImages(e){let r=this.availableImages[e];return r||(r=[]),r}_getLayerIndex(e){let r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new za),r}_getWorkerSource(e,r,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][r]||(this.workerSources[e][r]={}),!this.workerSources[e][r][n]){let i={sendAsync:(o,a)=>(o.targetMapId=e,this.actor.sendAsync(o,a))};switch(r){case"vector":this.workerSources[e][r][n]=new Wr(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new rs(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][r][n]=new this.externalWorkerSourceTypes[r](i,this._getLayerIndex(e),this._getAvailableImages(e));break}}return this.workerSources[e][r][n]}_getDEMWorkerSource(e,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]=new Xa),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new ns(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n',oL=()=>un.WORKER_URL?un.WORKER_URL:URL.createObjectURL(new Blob([aL],{type:"text/javascript"}));function sL(){return new Worker(oL())}var lL="maplibre_preloaded_worker_pool",Jv=class Qv{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Qv.workerCount;)this.workers.push(sL());return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[lL]}numActive(){return Object.keys(this.active).length}},uL=Math.floor(Me.hardwareConcurrency/2);Jv.workerCount=EC(globalThis)?Math.max(Math.min(uL,3),1):1;var fc;function eb(){return fc||(fc=new Jv),fc}var tb=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t;let i=this.workerPool.acquire(t);for(let r=0;r<i.length;r++){let n=i[r],a=new nL(n,t);a.name="Worker ".concat(r),this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){let i=[];for(let r of this.actors)i.push(r.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let i of this.actors)i.registerMessageHandler(e,t)}},dl;function hL(){return dl||(dl=new tb(eb(),Vc),dl.registerMessageHandler("GR",(e,t,i)=>uu(t,i))),dl}function cL(e,t){let i=q.create();return q.translate(i,i,[1,1,0]),q.scale(i,i,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?q.multiply(i,i,e.calculatePosMatrix(t.toUnwrapped())):i}function pL(e,t,i){if(e)for(let r of e){let n=t[r];if(n&&n.source===i&&n.type==="fill-extrusion")return!0}else for(let r in t){let n=t[r];if(n.source===i&&n.type==="fill-extrusion")return!0}return!1}function dL(e,t,i,r,n,a,o){var p;let s=pL((p=n==null?void 0:n.layers)!=null?p:null,t,e.id),l=a.maxPitchScaleFactor(),u=e.tilesIn(r,l,s);u.sort(ib);let h=[];for(let d of u)h.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,i,e._state,d.queryGeometry,d.cameraQueryGeometry,d.scale,n,a,l,cL(e.transform,d.tileID),o?(f,y)=>o(d.tileID,f,y):void 0)});let c=yL(h);return gL(c,e)}function fL(e,t,i,r,n,a,o){let s={},l=a.queryRenderedSymbols(r),u=[];for(let h of Object.keys(l).map(Number))u.push(o[h]);u.sort(ib);for(let h of u){let c=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],t,h.bucketIndex,h.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(let p in c){let d=s[p]=s[p]||[],f=c[p];f.sort((y,g)=>{let _=h.featureSortOrder;if(_){let b=_.indexOf(y.featureIndex);return _.indexOf(g.featureIndex)-b}else return g.featureIndex-y.featureIndex});for(let y of f)d.push(y)}}return _L(s,e,i)}function mL(e,t){let i=e.getRenderableIds().map(a=>e.getTileByID(a)),r=[],n={};for(let a=0;a<i.length;a++){let o=i[a],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(r,t))}return r}function ib(e,t){let i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function yL(e){let t={},i={};for(let r of e){let n=r.queryResults,a=r.wrappedTileID,o=i[a]=i[a]||{};for(let s in n){let l=n[s],u=o[s]=o[s]||{},h=t[s]=t[s]||[];for(let c of l)u[c.featureIndex]||(u[c.featureIndex]=!0,h.push(c))}}return t}function gL(e,t){for(let i in e)for(let r of e[i])rb(r,t);return e}function _L(e,t,i){for(let r in e)for(let n of e[r]){let a=t[r],o=i[a.source];rb(n,o)}return e}function rb(e,t){let i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}async function nb(e,t,i){let r=e;if(e.url?r=(await hu(t.transformRequest(e.url,"Source"),i)).data:await Me.frameAsync(i),!r)return null;let n=rs(re(r,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in r&&r.vector_layers&&(n.vectorLayerIds=r.vector_layers.map(a=>a.id)),n}var sr=63710088e-1,de=class Ao{constructor(t,i){if(isNaN(t)||isNaN(i))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(i,")"));if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ao(An(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let i=Math.PI/180,r=this.lat*i,n=t.lat*i,a=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*i);return sr*Math.acos(Math.min(a,1))}static convert(t){if(t instanceof Ao)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Ao(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Ao(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}},yr=class Qr{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof de?new de(t.lng,t.lat):de.convert(t),this}setSouthWest(t){return this._sw=t instanceof de?new de(t.lng,t.lat):de.convert(t),this}extend(t){let i=this._sw,r=this._ne,n,a;if(t instanceof de)n=t,a=t;else if(t instanceof Qr){if(n=t._sw,a=t._ne,!n||!a)return this}else{if(Array.isArray(t))if(t.length===4||t.every(Array.isArray)){let o=t;return this.extend(Qr.convert(o))}else{let o=t;return this.extend(de.convert(o))}else if(t&&("lng"in t||"lon"in t)&&"lat"in t)return this.extend(de.convert(t));return this}return!i&&!r?(this._sw=new de(n.lng,n.lat),this._ne=new de(a.lng,a.lat)):(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)),this}getCenter(){return new de((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new de(this.getWest(),this.getNorth())}getSouthEast(){return new de(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return"LngLatBounds(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:i,lat:r}=de.convert(t),n=this._sw.lat<=r&&r<=this._ne.lat,a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),n&&a}static convert(t){return t instanceof Qr||!t?t:new Qr(t)}static fromLngLat(t,i=0){let r=360*i/40075017,n=r/Math.cos(Math.PI/180*t.lat);return new Qr(new de(t.lng-n,t.lat-r),new de(t.lng+n,t.lat+r))}adjustAntiMeridian(){let t=new de(this._sw.lng,this._sw.lat),i=new de(this._ne.lng,this._ne.lat);return t.lng>i.lng?new Qr(t,new de(i.lng+360,i.lat)):new Qr(t,i)}},ab=2*Math.PI*sr;function ob(e){return ab*Math.cos(e*Math.PI/180)}function ka(e){return(180+e)/360}function Bn(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Dn(e,t){return e/ob(t)}function xL(e){return e*360-180}function gp(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function _p(e,t){return e*ob(gp(t))}function vL(e){return 1/Math.cos(e*Math.PI/180)}var Ke=class sb{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){let r=de.convert(t);return new sb(ka(r.lng),Bn(r.lat),Dn(i,r.lat))}toLngLat(){return new de(xL(this.x),gp(this.y))}toAltitude(){return _p(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ab*vL(gp(this.y))}},lb=class{constructor(e,t,i){this.bounds=yr.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=Math.pow(2,e.z),i={minX:Math.floor(ka(this.bounds.getWest())*t),minY:Math.floor(Bn(this.bounds.getNorth())*t),maxX:Math.ceil(ka(this.bounds.getEast())*t),maxY:Math.ceil(Bn(this.bounds.getSouth())*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}},bL=class extends ei{constructor(e,t,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,re(this,rs(t,["url","scheme","tileSize","promoteId"])),this._options=re({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}async load(){this._loaded=!1,this.fire(new H("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await nb(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(re(this,e),e.bounds&&(this.tileBounds=new lb(e.bounds,this.minzoom,this.maxzoom)),this.fire(new H("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new H("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new he(e))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return re({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),r="LT";else if(e.state==="loading")return new Promise((n,a)=>{e.reloadPromise={resolve:n,reject:a}});e.abortController=new AbortController;try{let n=await e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,n)}catch(n){if(delete e.abortController,e.aborted)return;if(n&&n.status!==404)throw n;this._afterTileLoadWorkerResponse(e,null)}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let i=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(i.resolve).catch(i.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},ub=class extends ei{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=re({type:"raster"},t),re(this,rs(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new H("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let t=await nb(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(re(this,t),t.bounds&&(this.tileBounds=new lb(t.bounds,this.minzoom,this.maxzoom)),this.fire(new H("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new H("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this.fire(new he(t))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return re({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let i=await cr.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i&&i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let r=this.map.painter.context,n=r.gl,a=i.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new vt(r,a,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}};function wL(e,t,i){t=Math.pow(2,i)-t-1;var r=Gg(e*256,t*256,i),n=Gg((e+1)*256,(t+1)*256,i);return r[0]+","+r[1]+","+n[0]+","+n[1]}function Gg(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i),n=e*r-2*Math.PI*6378137/2,a=t*r-2*Math.PI*6378137/2;return[n,a]}var PL=fe(ge(),1);function SL(e,t,i){return!(e<jp||e>su||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}function TL(e,t){let{x:i,y:r}=Ke.fromLngLat(t);return!(e<jp||e>su||r<0||r>=1||i<0||i>=1)}var Fu=class{constructor(e,t,i){if(!SL(e,t,i))throw new Error("x=".concat(t,", y=").concat(i,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," ").concat(jp,"<=z<=").concat(su," "));this.z=e,this.x=t,this.y=i,this.key=_a(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){let r=wL(this.x,this.y,this.z),n=ML(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=Math.pow(2,this.z);return new PL.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},Jl=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=_a(e,t.z,t.z,t.x,t.y)}},Vt=class Bi{constructor(t,i,r,n,a){if(this.terrainRttPosMatrix32f=null,t<r)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(r));this.overscaledZ=t,this.wrap=i,this.canonical=new Fu(r,+n,+a),this.key=_a(i,t,r,n,a)}clone(){return new Bi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let i=this.canonical.z-t;return t>this.canonical.z?new Bi(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Bi(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(t,i){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?_a(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y):_a(this.wrap*+i,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let i=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new Bi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=this.canonical.x*2,n=this.canonical.y*2;return[new Bi(i,this.wrap,i,r,n),new Bi(i,this.wrap,i,r+1,n),new Bi(i,this.wrap,i,r,n+1),new Bi(i,this.wrap,i,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new Bi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Bi(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Jl(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new Ke(t.x-this.wrap,t.y))}};function _a(e,t,i,r,n){e*=2,e<0&&(e=e*-1-1);let a=1<<i;return(a*a*e+a*n+r).toString(36)+i.toString(36)+t.toString(36)}function ML(e,t,i){let r="",n;for(let a=e;a>0;a--)n=1<<a-1,r+=(t&n?1:0)+(i&n?2:0);return r}te("CanonicalTileID",Fu);te("OverscaledTileID",Vt,{omit:["terrainRttPosMatrix32f"]});var CL=class extends ub{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options=re({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(t,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let r=await cr.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(r&&r.data){let n=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let a=Fr(n)&&F_()?n:await this.readImageNow(n),o={type:this.type,uid:e.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let s=await e.actor.sendAsync({type:"LDT",data:o});e.dem=s,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(r){if(delete e.abortController,e.aborted)e.state="unloaded";else if(r)throw e.state="errored",r}}async readImageNow(e){if(typeof VideoFrame<"u"&&_P()){let t=e.width+2,i=e.height+2;try{return new tt({width:t,height:i},await zC(e,-1,-1,t,i))}catch(r){}}return Me.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,i=Math.pow(2,t.z),r=(t.x-1+i)%i,n=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+i)%i,o=t.x+1===i?e.wrap+1:e.wrap,s={};return s[new Vt(e.overscaledZ,n,t.z,r,t.y).key]={backfilled:!1},s[new Vt(e.overscaledZ,o,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(s[new Vt(e.overscaledZ,n,t.z,r,t.y-1).key]={backfilled:!1},s[new Vt(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new Vt(e.overscaledZ,o,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<i&&(s[new Vt(e.overscaledZ,n,t.z,r,t.y+1).key]={backfilled:!1},s[new Vt(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new Vt(e.overscaledZ,o,t.z,a,t.y+1).key]={backfilled:!1}),s}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}},IL=class extends ei{constructor(e,t,i,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(r),this._data=t.data,this._options=re({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&Tt('The maxzoom value "'.concat(this.maxzoom,'" is expected to be greater than the clusterMaxZoom value "').concat(t.clusterMaxZoom,'".')),this.workerOptions=re({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer!==void 0?t.buffer:128),tolerance:this._pixelsToTileUnits(t.tolerance!==void 0?t.tolerance:.375),extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(8192/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||Tt("Integer expected for option 'clusterMaxZoom': provided value \"".concat(e,'" rounded to "').concat(t,'"')),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}async getData(){let e=re({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(t=>t.coordinates).flat(1/0):e.coordinates.flat(1/0)}async getBounds(){let e=new yr,t=await this.getData(),i;switch(t.type){case"FeatureCollection":i=t.features.map(r=>this.getCoordinatesFromGeometry(r.geometry)).flat(1/0);break;case"Feature":i=this.getCoordinatesFromGeometry(t.geometry);break;default:i=this.getCoordinatesFromGeometry(t);break}if(i.length==0)return e;for(let r=0;r<i.length-1;r+=2)e.extend([i[r],i[r+1]]);return e}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom))),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _updateWorkerData(e){let t=re({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(Me.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new H("dataloading",{dataType:"source"}));try{let i=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||i.abandoned){this.fire(new H("dataabort",{dataType:"source"}));return}let r=null;i.resourceTiming&&i.resourceTiming[this.id]&&(r=i.resourceTiming[this.id].slice(0));let n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&re(n,{resourceTiming:r}),this.fire(new H("data",bi(zt({},n),{sourceDataType:"metadata"}))),this.fire(new H("data",bi(zt({},n),{sourceDataType:"content"})))}catch(i){if(this._pendingLoads--,this._removed){this.fire(new H("dataabort",{dataType:"source"}));return}this.fire(new he(i))}}loaded(){return this._pendingLoads===0}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=this.actor;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,globalState:this.map.getGlobalState()};e.abortController=new AbortController;let r=await this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t==="RT")}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return re({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},fl=fe(ge(),1),dr=class xp{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let i=new xp;return i.extend(t(new fl.default(this.minX,this.minY))),i.extend(t(new fl.default(this.maxX,this.minY))),i.extend(t(new fl.default(this.minX,this.maxY))),i.extend(t(new fl.default(this.maxX,this.maxY))),i}static fromPoints(t){let i=new xp;for(let r of t)i.extend(r);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}},cs=class extends ei{constructor(e,t,i,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}async load(e){this._loaded=!1,this.fire(new H("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=await cr.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new he(t))}}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new H("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let t=e.map(Ke.fromLngLat);return this.tileID=AL(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(i=>this.tileID.getTilePoint(i)._round()),this.flippedWindingOrder=EL(this.tileCoords),this.fire(new H("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture||(this.texture=new vt(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new H("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:i,maxX:r,maxY:n}=dr.fromPoints(e),a={};for(let o=0;o<=su;o++){let s=Math.pow(2,o),l=Math.floor(t*s),u=Math.floor(i*s),h=Math.floor(r*s),c=Math.floor(n*s);a[o]={minTileX:l,minTileY:u,maxTileX:h,maxTileY:c}}return a}};function AL(e){let t=dr.fromPoints(e),i=t.width(),r=t.height(),n=Math.max(i,r),a=Math.max(0,Math.floor(-Math.log(n)/Math.LN2)),o=Math.pow(2,a);return new Fu(a,Math.floor((t.minX+t.maxX)/2*o),Math.floor((t.minY+t.maxY)/2*o))}function EL(e){let t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[0].x,n=e[2].y-e[0].y;return t*n-i*r<0}var kL=class extends cs{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{let t=await ZC(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new he(t))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new he(new W("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(t.start(0)," and ").concat(t.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new vt(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new H("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},DL=class extends cs{constructor(e,t,i,r){super(e,t,i,r),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(n=>!Array.isArray(n)||n.length!==2||n.some(a=>typeof a!="number")))&&this.fire(new he(new W("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new he(new W("sources.".concat(e),null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new he(new W("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new he(new W("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new he(new W("sources.".concat(e),null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate!==void 0?t.animate:!0}async load(){if(this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new he(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,i=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new vt(t,this.canvas,i.RGBA,{premultiply:!0});let r=!1;for(let n in this.tiles){let a=this.tiles[n];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,r=!0)}r&&this.fire(new H("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},LL={},zL=(e,t,i,r)=>{let n=RL(t.type),a=new n(e,t,i,r);if(a.id!==e)throw new Error("Expected Source id to be ".concat(e," instead of ").concat(a.id));return a},RL=e=>{switch(e){case"geojson":return IL;case"image":return cs;case"raster":return ub;case"raster-dem":return CL;case"vector":return bL;case"video":return kL;case"canvas":return DL}return LL[e]};function FL(e,t){let i={};if(!t)return i;for(let r of e){let n=r.layerIds.map(a=>t.getLayer(a)).filter(Boolean);if(n.length!==0){r.layers=n,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(a=>n.filter(o=>o.id===a)[0]));for(let a of n)i[a.id]=r}}return i}var BL=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}},OL=fe(au(),1),NL=fe(z_(),1),hb=class{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=r,this.properties=e.properties,this.id=n}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t==="_geometry"||t==="_vectorTileFeature"||(e[t]=this[t]);return e}},VL=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Qc(8192,16,0),this.grid3D=new Qc(8192,16,0),this.featureIndexArray=new Sv,this.promoteId=t}insert(e,t,i,r,n,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);let s=a?this.grid3D:this.grid;for(let l=0;l<t.length;l++){let u=t[l],h=[1/0,1/0,-1/0,-1/0];for(let c=0;c<u.length;c++){let p=u[c];h[0]=Math.min(h[0],p.x),h[1]=Math.min(h[1],p.y),h[2]=Math.max(h[2],p.x),h[3]=Math.max(h[3],p.y)}h[0]<8192&&h[1]<8192&&h[2]>=0&&h[3]>=0&&s.insert(o,h[0],h[1],h[2],h[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new OL.default.VectorTile(new NL.default(this.rawTileData)).layers,this.sourceLayerCoder=new BL(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,r){this.loadVTLayers();let n=e.params,a=8192/e.tileSize/e.scale,o=$o(n.filter),s=e.queryGeometry,l=e.queryPadding*a,u=dr.fromPoints(s),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=dr.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,g,_,b)=>Lk(e.cameraQueryGeometry,y-l,g-l,_+l,b+l));for(let y of p)h.push(y);h.sort(jL);let d={},f;for(let y=0;y<h.length;y++){let g=h[y];if(g===f)continue;f=g;let _=this.featureIndexArray.get(g),b=null;this.loadMatchingFeature(d,_.bucketIndex,_.sourceLayerIndex,_.featureIndex,o,n.layers,n.availableImages,t,i,r,(v,w,P)=>(b||(b=Un(v)),w.queryIntersectsFeature({queryGeometry:s,feature:v,featureState:P,geometry:b,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return d}loadMatchingFeature(e,t,i,r,n,a,o,s,l,u,h){let c=this.bucketLayerIDs[t];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(n.needGeometry){let y=Gn(d,!0);if(!n.filter(new bt(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new bt(this.tileID.overscaledZ),d))return;let f=this.getId(d,p);for(let y=0;y<c.length;y++){let g=c[y];if(a&&!a.has(g))continue;let _=s[g];if(!_)continue;let b={};f&&u&&(b=u.getState(_.sourceLayer||"_geojsonTileLayer",f));let v=re({},l[g]);v.paint=Xg(v.paint,_.paint,d,b,o),v.layout=Xg(v.layout,_.layout,d,b,o);let w=!h||h(d,_,b);if(!w)continue;let P=new hb(d,this.z,this.x,this.y,f);P.layer=v;let S=e[g];S===void 0&&(S=e[g]=[]),S.push({featureIndex:r,feature:P,intersectionZ:w})}}lookupSymbolFeatures(e,t,i,r,n,a,o,s){let l={};this.loadVTLayers();let u=$o(n);for(let h of e)this.loadMatchingFeature(l,i,r,h,u,a,o,s,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){var r;let i=e.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];i=e.properties[n],typeof i=="boolean"&&(i=Number(i)),i===void 0&&((r=e.properties)!=null&&r.cluster)&&this.promoteId&&(i=Number(e.properties.cluster_id))}return i}};te("FeatureIndex",VL,{omit:["rawTileData","sourceLayerCoder"]});function Xg(e,t,i,r,n){return Vp(e,(a,o)=>{let s=t instanceof Cu?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s})}function jL(e,t){return t-e}var vp="RTLPluginLoaded",UL=class extends ei{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=hL()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Me.resolveURL(e),!this.url)throw new Error("requested url ".concat(e," is invalid"));if(this.status==="unavailable")if(t)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new H(vp))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},mc=null;function bp(){return mc||(mc=new UL),mc}var GL=3e4,cb=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=V0(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new fv;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=FL(e.buckets,t==null?void 0:t.style),this.hasSymbolBuckets=!1;for(let r in this.buckets){let n=this.buckets[r];if(n instanceof Ea)if(this.hasSymbolBuckets=!0,i)n.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let r in this.buckets){let n=this.buckets[r];if(n instanceof Ea&&n.hasRTLText){this.hasRTLText=!0,bp().lazyLoad();break}}this.queryPadding=0;for(let r in this.buckets){let n=this.buckets[r];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(r).queryRadius(n))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new vt(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new vt(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,n,a,o,s,l,u,h){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:a,tileSize:this.tileSize,pixelPosMatrix:u,transform:s,params:o,queryPadding:this.queryPadding*l,getElevation:h},e,t,i)}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;let r=i.loadVTLayers(),n=t&&t.sourceLayer?t.sourceLayer:"",a=r._geojsonTileLayer||r[n];if(!a)return;let o=$o(t&&t.filter),{z:s,x:l,y:u}=this.tileID.canonical,h={z:s,x:l,y:u};for(let c=0;c<a.length;c++){let p=a.feature(c);if(o.needGeometry){let y=Gn(p,!0);if(!o.filter(new bt(this.tileID.overscaledZ),y,this.tileID.canonical))continue}else if(!o.filter(new bt(this.tileID.overscaledZ),p))continue;let d=i.getId(p,n),f=new hb(p,s,l,u,d);f.tile=h,e.push(f)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let i=AC(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+i["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(!t)r=!0;else if(this.expirationTime<t)r=!0;else{let n=this.expirationTime-t;n?this.expirationTime=i+Math.max(n,GL):r=!0}r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let i=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!t.style.hasLayer(r))continue;let n=this.buckets[r],a=n.layers[0].sourceLayer||"_geojsonTileLayer",o=i[a],s=e[a];if(!o||!s||Object.keys(s).length===0)continue;n.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});let l=t&&t.style&&t.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Me.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Me.now()+e}setDependencies(e,t){let i={};for(let r of t)i[r]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let r=this.dependencies[i];if(r){for(let n of t)if(r[n])return!0}}return!1}},XL=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let n={value:t,timeout:void 0};if(i!==void 0&&(n.timeout=setTimeout(()=>{this.remove(e,n)},i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let i=e.wrapped().key,r=t===void 0?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let i in this.data)for(let r of this.data[i])e(r.value)||t.push(r);for(let i of t)this.remove(i.value.tileID,i)}},qg=fe(ge(),1),qL=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,i){let r=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},re(this.stateChanges[e][r],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let n in this.state[e])n!==r&&(this.deletedStates[e][n]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][r]===null){this.deletedStates[e][r]={};for(let n in this.state[e][r])i[n]||(this.deletedStates[e][r][n]=null)}else for(let n in i)this.deletedStates[e]&&this.deletedStates[e][r]&&this.deletedStates[e][r][n]===null&&delete this.deletedStates[e][r][n]}removeFeatureState(e,t,i){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][r]){this.deletedStates[e][r]={};for(i in this.stateChanges[e][r])this.deletedStates[e][r][i]=null}else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),r=this.state[e]||{},n=this.stateChanges[e]||{},a=re({},r[i],n[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let o=this.deletedStates[e][t];if(o===null)return{};for(let s in o)delete a[s]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let i={};for(let r in this.stateChanges){this.state[r]=this.state[r]||{};let n={};for(let a in this.stateChanges[r])this.state[r][a]||(this.state[r][a]={}),re(this.state[r][a],this.stateChanges[r][a]),n[a]=this.state[r][a];i[r]=n}for(let r in this.deletedStates){this.state[r]=this.state[r]||{};let n={};if(this.deletedStates[r]===null)for(let a in this.state[r])n[a]={},this.state[r][a]={};else for(let a in this.deletedStates[r]){if(this.deletedStates[r][a]===null)this.state[r][a]={};else for(let o of Object.keys(this.deletedStates[r][a]))delete this.state[r][a][o];n[a]=this.state[r][a]}i[r]=i[r]||{},re(i[r],n)}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length!==0)for(let r in e)e[r].setFeatureState(i,t)}},$L=fe(ge(),1),xa=89.25;function ZL(e,t,i){let r=1/(1<<i.z);return new Ke(e/8192*r+i.x*r,t/8192*r+i.y*r)}function ur(e,t){let i=Ne(t.lat,-fr,fr);return new $L.default(ka(t.lng)*e,Bn(i)*e)}function es(e,t){return new Ke(t.x/e,t.y/e).toLngLat()}function Nl(e){return e.cameraToCenterDistance*Math.min(Math.tan(Je(90-e.pitch))*.85,Math.tan(Je(xa-e.pitch)))}function yc(e,t){let i=e.canonical,r=t/qt(i.z),n=i.x+Math.pow(2,i.z)*e.wrap,a=q.identity(new Float64Array(16));return q.translate(a,a,[n*r,i.y*r,0]),q.scale(a,a,[r/8192,r/8192,1]),a}function wp(e,t,i,r,n){let a=Ke.fromLngLat(e,t),o=Dn(1,e.lat),s=n*o,l=s*Math.cos(Je(i)),u=Math.sqrt(s*s-l*l),h=u*Math.sin(Je(-r)),c=u*Math.cos(Je(-r));return new Ke(a.x+h,a.y+c,a.z+l)}function YL(e,t,i){let r=t.intersectsFrustum(e);if(!i||r===0)return r;let n=t.intersectsPlane(i);return n===0?0:r===2&&n===2?2:1}function $g(e,t,i){let r=0,n=(i-t)/10;for(let a=0;a<10;a++){let o=t+(a+.5)/10*(i-t);r+=n*Math.pow(Math.cos(o),e)}return r}function Pp(e,t){return function(i,r,n,a,o){let s=2*((e-1)/$t(Math.cos(Je(xa-o))/Math.cos(Je(xa)))-1),l=Math.acos(n/a),u=2*$g(s-1,0,Je(o/2)),h=Math.min(Je(xa),l+Je(o/2)),c=Math.min(h,l-Je(o/2)),p=$g(s-1,c,h),d=Math.atan(r/n),f=Math.hypot(r,n),y=i;return y=y+$t(a/f/Math.max(.5,Math.cos(Je(o/2)))),y+=s*$t(Math.cos(d))/2,y-=$t(Math.max(1,p/u/t))/2,y}}var WL=9.314,HL=3,KL=Pp(WL,HL);function Bu(e,t){let i=(t.roundZoom?Math.round:Math.floor)(e.zoom+$t(e.tileSize/t.tileSize));return Math.max(0,i)}function Ou(e,t){let i=e.getCameraFrustum(),r=e.getClippingPlane(),n=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=Ke.fromLngLat(e.center,e.elevation);n.z=a.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let o=e.getCoveringTilesDetailsProvider(),s=o.allowVariableZoom(e,t),l=Bu(e,t),u=t.minzoom||0,h=t.maxzoom!==void 0?t.maxzoom:e.maxZoom,c=Math.min(Math.max(0,l),h),p=Math.pow(2,c),d=[p*n.x,p*n.y,0],f=[p*a.x,p*a.y,0],y=Math.hypot(a.x-n.x,a.y-n.y),g=Math.abs(a.z-n.z),_=Math.hypot(y,g),b=P=>({zoom:0,x:0,y:0,wrap:P,fullyVisible:!1}),v=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let P=1;P<=3;P++)v.push(b(-P)),v.push(b(P));for(v.push(b(0));v.length>0;){let P=v.pop(),S=P.x,C=P.y,E=P.fullyVisible,F={x:S,y:C,z:P.zoom},B=o.getTileBoundingVolume(F,P.wrap,e.elevation,t);if(!E){let x=YL(i,B,r);if(x===0)continue;E=x===2}let R=o.distanceToTile2d(n.x,n.y,F,B),D=l;s&&(D=(t.calculateTileZoom||KL)(e.zoom+$t(e.tileSize/t.tileSize),R,g,_,e.fov)),D=(t.roundZoom?Math.round:Math.floor)(D),D=Math.max(0,D);let z=Math.min(D,h);if(P.wrap=o.getWrap(a,F,P.wrap),P.zoom>=z){if(P.zoom<u)continue;let x=c-P.zoom,T=d[0]-.5-(S<<x),I=d[1]-.5-(C<<x),U=t.reparseOverscaled?Math.max(P.zoom,D):P.zoom;w.push({tileID:new Vt(P.zoom===h?U:P.zoom,P.wrap,P.zoom,S,C),distanceSq:Jt.sqrLen([f[0]-.5-S,f[1]-.5-C]),tileDistanceToCamera:Math.sqrt(T*T+I*I)});continue}for(let x=0;x<4;x++){let T=(S<<1)+x%2,I=(C<<1)+(x>>1),U=P.zoom+1;v.push({zoom:U,x:T,y:I,wrap:P.wrap,fullyVisible:E})}}return w.sort((P,S)=>P.distanceSq-S.distanceSq).map(P=>P.tileID)}var Zg=fe(ge(),1),JL=dr.fromPoints([new Zg.default(0,0),new Zg.default(8192,8192)]),ts=class Eo extends ei{constructor(t,i,r){super(),this.id=t,this.dispatcher=r,this.on("data",n=>this._dataHandler(n)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=zL(t,i,r,this),this._tiles={},this._cache=new XL(0,n=>this._unloadTile(n)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new qL,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let t in this._tiles){let i=this._tiles[t];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,i,r){try{await this._source.loadTile(t),this._tileLoaded(t,i,r)}catch(n){t.state="errored",n.status!==404?this._source.fire(new he(n,{tile:t})):this.update(this.transform,this.terrain)}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new H("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let i in this._tiles){let r=this._tiles[i];r.upload(t),r.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Yg).map(t=>t.key)}getRenderableIds(t){let i=[];for(let r in this._tiles)this._isIdRenderable(r,t)&&i.push(this._tiles[r]);return t?i.sort((r,n)=>{let a=r.tileID,o=n.tileID,s=new qg.default(a.canonical.x,a.canonical.y)._rotate(-this.transform.bearingInRadians),l=new qg.default(o.canonical.x,o.canonical.y)._rotate(-this.transform.bearingInRadians);return a.overscaledZ-o.overscaledZ||l.y-s.y||l.x-s.x}).map(r=>r.tileID.key):i.map(r=>r.tileID).sort(Yg).map(r=>r.key)}hasRenderableParent(t){let i=this.findLoadedParent(t,0);return i?this._isIdRenderable(i.tileID.key):!1}_isIdRenderable(t,i){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(i||!this._tiles[t].holdingForFade())}reload(t){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let i in this._tiles)t?this._reloadTile(i,"expired"):this._tiles[i].state!=="errored"&&this._reloadTile(i,"reloading")}async _reloadTile(t,i){let r=this._tiles[t];r&&(r.state!=="loading"&&(r.state=i),await this._loadTile(r,t,i))}_tileLoaded(t,i,r){t.timeAdded=Me.now(),r==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new H("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){let i=this.getRenderableIds();for(let n=0;n<i.length;n++){let a=i[n];if(t.neighboringTiles&&t.neighboringTiles[a]){let o=this.getTileByID(a);r(t,o),r(o,t)}}function r(n,a){n.needsHillshadePrepare=!0,n.needsTerrainPrepare=!0;let o=a.tileID.canonical.x-n.tileID.canonical.x,s=a.tileID.canonical.y-n.tileID.canonical.y,l=Math.pow(2,n.tileID.canonical.z),u=a.tileID.key;o===0&&s===0||Math.abs(s)>1||(Math.abs(o)>1&&(Math.abs(o+l)===1?o+=l:Math.abs(o-l)===1&&(o-=l)),!(!a.dem||!n.dem)&&(n.dem.backfillBorder(a.dem,o,s),n.neighboringTiles&&n.neighboringTiles[u]&&(n.neighboringTiles[u].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,i,r,n){for(let a in this._tiles){let o=this._tiles[a];if(n[a]||!o.hasData()||o.tileID.overscaledZ<=i||o.tileID.overscaledZ>r)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>i+1;){let u=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[u.key],o&&o.hasData()&&(s=u)}let l=s;for(;l.overscaledZ>i;)if(l=l.scaledTo(l.overscaledZ-1),t[l.key]||t[l.canonical.key]){n[s.key]=s;break}}}findLoadedParent(t,i){if(t.key in this._loadedParentTiles){let r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=i?r:null}for(let r=t.overscaledZ-1;r>=i;r--){let n=t.scaledTo(r),a=this._getLoadedTile(n);if(a)return a}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){let i=this._tiles[t.key];return i&&i.hasData()?i:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){let i=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=i*r,a=this._maxTileCacheZoomLevels===null?un.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,o=Math.floor(n*a),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(t){let i=this._prevLng===void 0?t:this._prevLng,r=(t-i)/360,n=Math.round(r);if(this._prevLng=t,n){let a={};for(let o in this._tiles){let s=this._tiles[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+n),a[s.tileID.key]=s}this._tiles=a;for(let o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(let o in this._tiles){let s=this._tiles[o];this._setTileReloadTimer(o,s)}}}_updateCoveredAndRetainedTiles(t,i,r,n,a,o){let s={},l={},u=Object.keys(t),h=Me.now();for(let c of u){let p=t[c],d=this._tiles[c];if(!d||d.fadeEndTime!==0&&d.fadeEndTime<=h)continue;let f=this.findLoadedParent(p,i),y=this.findLoadedSibling(p),g=f||y||null;g&&(this._addTile(g.tileID),s[g.tileID.key]=g.tileID),l[c]=p}this._retainLoadedChildren(l,n,r,t);for(let c in s)t[c]||(this._coveredTiles[c]=!0,t[c]=s[c]);if(o){let c={},p={};for(let d of a)this._tiles[d.key].hasData()?c[d.key]=d:p[d.key]=d;for(let d in p){let f=p[d].children(this._source.maxzoom);this._tiles[f[0].key]&&this._tiles[f[1].key]&&this._tiles[f[2].key]&&this._tiles[f[3].key]&&(c[f[0].key]=t[f[0].key]=f[0],c[f[1].key]=t[f[1].key]=f[1],c[f[2].key]=t[f[2].key]=f[2],c[f[3].key]=t[f[3].key]=f[3],delete p[d])}for(let d in p){let f=p[d],y=this.findLoadedParent(f,this._source.minzoom),g=this.findLoadedSibling(f),_=y||g||null;if(_){c[_.tileID.key]=t[_.tileID.key]=_.tileID;for(let b in c)c[b].isChildOf(_.tileID)&&delete c[b]}}for(let d in this._tiles)c[d]||(this._coveredTiles[d]=!0)}}update(t,i){if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let r;!this.used&&!this.usedForTerrain?r=[]:this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(h=>new Vt(h.canonical.z,h.wrap,h.canonical.z,h.canonical.x,h.canonical.y)):(r=Ou(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter(h=>this._source.hasTile(h))));let n=Bu(t,this._source),a=Math.max(n-Eo.maxOverzooming,this._source.minzoom),o=Math.max(n+Eo.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let h={};for(let c of r)if(c.canonical.z>this._source.minzoom){let p=c.scaledTo(c.canonical.z-1);h[p.key]=p;let d=c.scaledTo(Math.max(this._source.minzoom,Math.min(c.canonical.z,5)));h[d.key]=d}r=r.concat(Object.values(h))}let s=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new H("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(r,n);Wg(this._source.type)&&this._updateCoveredAndRetainedTiles(l,a,o,n,r,i);for(let h in l)this._tiles[h].clearFadeHold();let u=PC(this._tiles,l);for(let h of u){let c=this._tiles[h];c.hasSymbolBuckets&&!c.holdingForFade()?c.setHoldDuration(this.map._fadeDuration):(!c.hasSymbolBuckets||c.symbolFadeFinished())&&this._removeTile(h)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,i){var l;let r={},n={},a=Math.max(i-Eo.maxOverzooming,this._source.minzoom),o=Math.max(i+Eo.maxUnderzooming,this._source.minzoom),s={};for(let u of t){let h=this._addTile(u);r[u.key]=u,!h.hasData()&&i<this._source.maxzoom&&(s[u.key]=u)}this._retainLoadedChildren(s,i,o,r);for(let u of t){let h=this._tiles[u.key];if(h.hasData())continue;if(i+1>this._source.maxzoom){let p=u.children(this._source.maxzoom)[0],d=this.getTile(p);if(d&&d.hasData()){r[p.key]=p;continue}}else{let p=u.children(this._source.maxzoom);if(r[p[0].key]&&r[p[1].key]&&r[p[2].key]&&r[p[3].key])continue}let c=h.wasRequested();for(let p=u.overscaledZ-1;p>=a;--p){let d=u.scaledTo(p);if(n[d.key])break;if(n[d.key]=!0,h=this.getTile(d),!h&&c&&(h=this._addTile(d)),h){let f=h.hasData();if((f||!((l=this.map)!=null&&l.cancelPendingTileRequestsWhileZooming)||c)&&(r[d.key]=d),c=h.wasRequested(),f)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let t in this._tiles){let i=[],r,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}i.push(n.key);let a=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(a),r)break;n=a}for(let a of i)this._loadedParentTiles[a]=r}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let t in this._tiles){let i=this._tiles[t].tileID,r=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=r}}_addTile(t){let i=this._tiles[t.key];if(i)return i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));let r=i;return i||(i=new cb(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._tiles[t.key]=i,r||this._source.fire(new H("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,i){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);let r=i.getExpiryTimeout();r&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},r))}refreshTiles(t){for(let i in this._tiles)!this._isIdRenderable(i)&&this._tiles[i].state!="errored"||t.some(r=>r.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_removeTile(t){let i=this._tiles[t];i&&(i.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),!(i.uses>0)&&(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){let i=t.sourceDataType;t.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&t.dataType==="source"&&i==="content"&&(this.reload(t.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,i,r){let n=[],a=this.transform;if(!a)return n;let o=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=r?a.getCameraQueryGeometry(t):t,l=d=>a.screenPointToMercatorCoordinate(d,this.terrain),u=this.transformBbox(t,l,!o),h=this.transformBbox(s,l,!o),c=this.getIds(),p=dr.fromPoints(h);for(let d=0;d<c.length;d++){let f=this._tiles[c[d]];if(f.holdingForFade())continue;let y=o?[f.tileID]:[f.tileID.unwrapTo(-1),f.tileID.unwrapTo(0)],g=Math.pow(2,a.zoom-f.tileID.overscaledZ),_=i*f.queryPadding*8192/f.tileSize/g;for(let b of y){let v=p.map(w=>b.getTilePoint(new Ke(w.x,w.y)));if(v.expandBy(_),v.intersects(JL)){let w=u.map(S=>b.getTilePoint(S)),P=h.map(S=>b.getTilePoint(S));n.push({tile:f,tileID:o?b:b.unwrapTo(0),queryGeometry:w,cameraQueryGeometry:P,scale:g})}}}return n}transformBbox(t,i,r){let n=t.map(i);if(r){let a=dr.fromPoints(t);a.shrinkBy(Math.min(a.width(),a.height())*.001);let o=a.map(i);dr.fromPoints(n).covers(o)||(n=n.map(s=>s.x>.5?new Ke(s.x-1,s.y,s.z):s))}return n}getVisibleCoordinates(t){let i=this.getRenderableIds(t).map(r=>this._tiles[r].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(Wg(this._source.type)){let t=Me.now();for(let i in this._tiles)if(this._tiles[i].fadeEndTime>=t)return!0}return!1}setFeatureState(t,i,r){t=t||"_geojsonTileLayer",this._state.updateState(t,i,r)}removeFeatureState(t,i,r){t=t||"_geojsonTileLayer",this._state.removeFeatureState(t,i,r)}getFeatureState(t,i){return t=t||"_geojsonTileLayer",this._state.getState(t,i)}setDependencies(t,i,r){let n=this._tiles[t];n&&n.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(let r in this._tiles)this._tiles[r].hasDependency(t,i)&&this._reloadTile(r,"reloading");this._cache.filter(r=>!r.hasDependency(t,i))}};ts.maxOverzooming=10;ts.maxUnderzooming=3;function Yg(e,t){let i=Math.abs(e.wrap*2)-+(e.wrap<0),r=Math.abs(t.wrap*2)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Wg(e){return e==="raster"||e==="image"||e==="video"}var rr=fe(ge(),1),Hr=fe(ge(),1);function QL(e,t,i,r,n){let a=[];for(let o=0;o<e.length;o++){let s=e[o],l;for(let u=0;u<s.length-1;u++){let h=s[u],c=s[u+1];h.x<t&&c.x<t||(h.x<t?h=new Hr.default(t,h.y+(c.y-h.y)*((t-h.x)/(c.x-h.x)))._round():c.x<t&&(c=new Hr.default(t,h.y+(c.y-h.y)*((t-h.x)/(c.x-h.x)))._round()),!(h.y<i&&c.y<i)&&(h.y<i?h=new Hr.default(h.x+(c.x-h.x)*((i-h.y)/(c.y-h.y)),i)._round():c.y<i&&(c=new Hr.default(h.x+(c.x-h.x)*((i-h.y)/(c.y-h.y)),i)._round()),!(h.x>=r&&c.x>=r)&&(h.x>=r?h=new Hr.default(r,h.y+(c.y-h.y)*((r-h.x)/(c.x-h.x)))._round():c.x>=r&&(c=new Hr.default(r,h.y+(c.y-h.y)*((r-h.x)/(c.x-h.x)))._round()),!(h.y>=n&&c.y>=n)&&(h.y>=n?h=new Hr.default(h.x+(c.x-h.x)*((n-h.y)/(c.y-h.y)),n)._round():c.y>=n&&(c=new Hr.default(h.x+(c.x-h.x)*((n-h.y)/(c.y-h.y)),n)._round()),(!l||!h.equals(l[l.length-1]))&&(l=[h],a.push(l)),l.push(c)))))}}return a}var ez=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=Ne(e,0,1);let t=1,i=this._distances[t],r=e*this.paddedLength+this.padding;for(;i<r&&t<this._distances.length;)i=this._distances[++t];let n=t-1,a=this._distances[n],o=i-a,s=o>0?(r-a)/o:0;return this.points[n].mult(1-s).add(this.points[t].mult(s))}};function ml(e,t){let i=!0;return e==="always"||(e==="never"||t==="never")&&(i=!1),i}var Hg=class{constructor(e,t,i){let r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let a=0;a<this.xCellCount*this.yCellCount;a++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,n,a){this.boxCells[n].push(a)}_insertCircleCell(e,t,i,r,n,a){this.circleCells[n].push(a)}_query(e,t,i,r,n,a,o){if(i<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let l=0;l<this.boxKeys.length;l++)s.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});for(let l=0;l<this.circleKeys.length;l++){let u=this.circles[l*3],h=this.circles[l*3+1],c=this.circles[l*3+2];s.push({key:this.circleKeys[l],x1:u-c,y1:h-c,x2:u+c,y2:h+c})}}else{let l={hitTest:n,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,r,this._queryCell,s,l,o)}return s}query(e,t,i,r){return this._query(e,t,i,r,!1,null)}hitTest(e,t,i,r,n,a){return this._query(e,t,i,r,!0,n,a).length>0}hitTestCircle(e,t,i,r,n){let a=e-i,o=e+i,s=t-i,l=t+i;if(o<0||a>this.width||l<0||s>this.height)return!1;let u=[],h={hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(a,s,o,l,this._queryCellCircle,u,h,n),u.length>0}_queryCell(e,t,i,r,n,a,o,s){let{seenUids:l,hitTest:u,overlapMode:h}=o,c=this.boxCells[n];if(c!==null){let d=this.bboxes;for(let f of c)if(!l.box[f]){l.box[f]=!0;let y=f*4,g=this.boxKeys[f];if(e<=d[y+2]&&t<=d[y+3]&&i>=d[y+0]&&r>=d[y+1]&&(!s||s(g))&&(!u||!ml(h,g.overlapMode))&&(a.push({key:g,x1:d[y],y1:d[y+1],x2:d[y+2],y2:d[y+3]}),u))return!0}}let p=this.circleCells[n];if(p!==null){let d=this.circles;for(let f of p)if(!l.circle[f]){l.circle[f]=!0;let y=f*3,g=this.circleKeys[f];if(this._circleAndRectCollide(d[y],d[y+1],d[y+2],e,t,i,r)&&(!s||s(g))&&(!u||!ml(h,g.overlapMode))){let _=d[y],b=d[y+1],v=d[y+2];if(a.push({key:g,x1:_-v,y1:b-v,x2:_+v,y2:b+v}),u)return!0}}}return!1}_queryCellCircle(e,t,i,r,n,a,o,s){let{circle:l,seenUids:u,overlapMode:h}=o,c=this.boxCells[n];if(c!==null){let d=this.bboxes;for(let f of c)if(!u.box[f]){u.box[f]=!0;let y=f*4,g=this.boxKeys[f];if(this._circleAndRectCollide(l.x,l.y,l.radius,d[y+0],d[y+1],d[y+2],d[y+3])&&(!s||s(g))&&!ml(h,g.overlapMode))return a.push(!0),!0}}let p=this.circleCells[n];if(p!==null){let d=this.circles;for(let f of p)if(!u.circle[f]){u.circle[f]=!0;let y=f*3,g=this.circleKeys[f];if(this._circlesCollide(d[y],d[y+1],d[y+2],l.x,l.y,l.radius)&&(!s||s(g))&&!ml(h,g.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,i,r,n,a,o,s){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),h=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r);for(let p=l;p<=h;p++)for(let d=u;d<=c;d++){let f=this.xCellCount*d+p;if(n.call(this,e,t,i,r,f,a,o,s))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,a){let o=r-e,s=n-t,l=i+a;return l*l>o*o+s*s}_circleAndRectCollide(e,t,i,r,n,a,o){let s=(a-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;let u=(o-n)/2,h=Math.abs(t-(n+u));if(h>u+i)return!1;if(l<=s||h<=u)return!0;let c=l-s,p=h-u;return c*c+p*p<=i*i}},is=fe(ge(),1);function jd(e,t,i){let r=q.create();if(!e){let{vecSouth:n,vecEast:a}=Ud(t),o=Bo.create();o[0]=a[0],o[1]=a[1],o[2]=n[0],o[3]=n[1],Bo.invert(o,o),r[0]=o[0],r[1]=o[1],r[4]=o[2],r[5]=o[3]}return q.scale(r,r,[1/i,1/i,1]),r}function tz(e,t,i,r){if(e){let n=q.create();if(!t){let{vecSouth:a,vecEast:o}=Ud(i);n[0]=o[0],n[1]=o[1],n[4]=a[0],n[5]=a[1]}return q.scale(n,n,[r,r,1]),n}else return i.pixelsToClipSpaceMatrix}function Ud(e){let t=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),n=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),o=Jt.create();o[0]=-n*r*i-a*t,o[1]=-a*r*i+n*t;let s=Jt.length(o);s<1e-9?Jt.zero(o):Jt.scale(o,o,1/s);let l=Jt.create();l[0]=n*r*t-a*i,l[1]=a*r*t+n*i;let u=Jt.length(l);return u<1e-9?Jt.zero(l):Jt.scale(l,l,1/u),{vecEast:l,vecSouth:o}}function Gd(e,t,i,r){let n;r?(n=[e,t,r(e,t),1],_t.transformMat4(n,n,i)):(n=[e,t,0,1],Xd(n,n,i));let a=n[3];return{point:new is.default(n[0]/a,n[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function pb(e,t){return .5+.5*(e/t)}function iz(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function rz(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=i?e.textSizeData:e.iconSizeData,f=Ru(d,t.transform.zoom),y=[256/t.width*2+1,256/t.height*2+1],g=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let _=e.lineVertexArray,b=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=t.transform.width/t.transform.height,w=!1;for(let P=0;P<b.length;P++){let S=b.get(P);if(S.hidden||S.writingMode===2&&!w){va(S.numGlyphs,g);continue}w=!1;let C=new is.default(S.anchorX,S.anchorY),E={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:_,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:C,unwrappedTileID:l,width:u,height:h,translation:c},F=mb(S.anchorX,S.anchorY,E);if(!iz(F.point,y)){va(S.numGlyphs,g);continue}let B=F.signedDistanceFromCamera,R=pb(t.transform.cameraToCenterDistance,B),D=Vd(d,f,S),z=a?D*t.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/R:D*R,x=Jg({projectionContext:E,pitchedLabelPlaneMatrixInverse:n,symbol:S,fontSize:z,flip:!1,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s});w=x.useVertical,(x.notEnoughRoom||w||x.needsFlipping&&Jg({projectionContext:E,pitchedLabelPlaneMatrixInverse:n,symbol:S,fontSize:z,flip:!0,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s}).notEnoughRoom)&&va(S.numGlyphs,g)}i?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}function db(e,t,i,r,n,a,o,s){let l=a.glyphStartIndex+a.numGlyphs,u=a.lineStartIndex,h=a.lineStartIndex+a.lineLength,c=t.getoffsetX(a.glyphStartIndex),p=t.getoffsetX(l-1),d=Ql(e*c,i,r,n,a.segment,u,h,s,o);if(!d)return null;let f=Ql(e*p,i,r,n,a.segment,u,h,s,o);return!f||s.projectionCache.anyProjectionOccluded?null:{first:d,last:f}}function Kg(e,t,i,r){if(e===1){let n=Math.abs(i.y-t.y),a=Math.abs(i.x-t.x)*r;if(n>a)return{useVertical:!0}}return(e===2?t.y<i.y:t.x>i.x)?{needsFlipping:!0}:null}function Jg(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:i,symbol:r,fontSize:n,flip:a,keepUpright:o,glyphOffsetArray:s,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:h}=e,c=n/24,p=r.lineOffsetX*c,d=r.lineOffsetY*c,f;if(r.numGlyphs>1){let y=r.glyphStartIndex+r.numGlyphs,g=r.lineStartIndex,_=r.lineStartIndex+r.lineLength,b=db(c,s,p,d,a,r,h,t);if(!b)return{notEnoughRoom:!0};let v=yl(b.first.point.x,b.first.point.y,t,i),w=yl(b.last.point.x,b.last.point.y,t,i);if(o&&!a){let P=Kg(r.writingMode,v,w,u);if(P)return P}f=[b.first];for(let P=r.glyphStartIndex+1;P<y-1;P++){let S=Ql(c*s.getoffsetX(P),p,d,a,r.segment,g,_,t,h);if(!S)return{notEnoughRoom:!0};f.push(S)}f.push(b.last)}else{if(o&&!a){let g=On(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,_=r.lineStartIndex+r.segment+1,b=new is.default(t.lineVertexArray.getx(_),t.lineVertexArray.gety(_)),v=On(b.x,b.y,t),w=v.signedDistanceFromCamera>0?v.point:fb(t.tileAnchorPoint,b,g,1,t),P=yl(g.x,g.y,t,i),S=yl(w.x,w.y,t,i),C=Kg(r.writingMode,P,S,u);if(C)return C}let y=Ql(c*s.getoffsetX(r.glyphStartIndex),p,d,a,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,t,h);if(!y||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[y]}for(let y of f)Qo(l,y.point,y.angle);return{}}function fb(e,t,i,r,n){let a=e.add(e.sub(t)._unit()),o=On(a.x,a.y,n).point,s=i.sub(o);return i.add(s._mult(r/s.mag()))}function Sp(e,t,i){let r=t.projectionCache;if(r.projections[e])return r.projections[e];let n=new is.default(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),a=On(n.x,n.y,t);if(a.signedDistanceFromCamera>0)return r.projections[e]=a.point,r.anyProjectionOccluded=r.anyProjectionOccluded||a.isOccluded,a.point;let o=e-i.direction,s=i.distanceFromAnchor===0?t.tileAnchorPoint:new is.default(t.lineVertexArray.getx(o),t.lineVertexArray.gety(o)),l=i.absOffsetX-i.distanceFromAnchor+1;return fb(s,n,i.previousVertex,l,t)}function On(e,t,i){let r=e+i.translation[0],n=t+i.translation[1],a;return i.pitchWithMap?(a=Gd(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),a.isOccluded=!1):(a=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),a.point.x=(a.point.x*.5+.5)*i.width,a.point.y=(-a.point.y*.5+.5)*i.height),a}function yl(e,t,i,r){if(i.pitchWithMap){let n=[e,t,0,1];return _t.transformMat4(n,n,r),i.transform.projectTileCoordinates(n[0]/n[3],n[1]/n[3],i.unwrappedTileID,i.getElevation).point}else return{x:e/i.width*2-1,y:t/i.height*2-1}}function mb(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function Tp(e,t,i){return e._unit()._perp()._mult(t*i)}function nz(e,t,i,r,n,a,o,s,l){if(s.projectionCache.offsets[e])return s.projectionCache.offsets[e];let u=i.add(t);if(e+l.direction<r||e+l.direction>=n)return s.projectionCache.offsets[e]=u,u;let h=Sp(e+l.direction,s,l),c=Tp(h.sub(i),o,l.direction),p=i.add(c),d=h.add(c);return s.projectionCache.offsets[e]=CC(a,u,p,d)||u,s.projectionCache.offsets[e]}function Ql(e,t,i,r,n,a,o,s,l){let u=r?e-t:e+t,h=u>0?1:-1,c=0;r&&(h*=-1,c=Math.PI),h<0&&(c+=Math.PI);let p=h>0?a+n:a+n+1,d;s.projectionCache.cachedAnchorPoint?d=s.projectionCache.cachedAnchorPoint:(d=On(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=d);let f=d,y=d,g,_,b=0,v=0,w=Math.abs(u),P=[],S;do{if(p+=h,p<a||p>=o)return null;b+=v,y=f,_=g;let B={absOffsetX:w,direction:h,distanceFromAnchor:b,previousVertex:y};if(f=Sp(p,s,B),i===0)P.push(y),S=f.sub(y);else{let R,D=f.sub(y);if(D.mag()===0){let z=Sp(p+h,s,B);R=Tp(z.sub(f),i,h)}else R=Tp(D,i,h);_||(_=y.add(R)),g=nz(p,R,f,a,o,_,i,s,B),P.push(_),S=g.sub(_)}v=S.mag()}while(b+v<=w);let C=(w-b)/v,E=S._mult(C)._add(_||y),F=c+Math.atan2(f.y-y.y,f.x-y.x);return P.push(E),{point:E,angle:l?F:0,path:P}}var az=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function va(e,t){for(let i=0;i<e;i++){let r=t.length;t.resize(r+4),t.float32.set(az,r*3)}}function Xd(e,t,i){let r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}function oz(e,t){let i=q.create();return q.invert(i,t.pitchedLabelPlaneMatrix),e.map(r=>{let n=Gd(r.x,r.y,i,t.getElevation),a=t.transform.projectTileCoordinates(n.point.x,n.point.y,t.unwrappedTileID,t.getElevation);return a.point.x=(a.point.x*.5+.5)*t.width,a.point.y=(-a.point.y*.5+.5)*t.height,a})}function sz(e){let t=0,i=0,r=0,n=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(r=a+1,n=0):(n++,n>i&&(i=n,t=r));return e.slice(t,t+i)}var $e=100,lz=class{constructor(e,t=new Hg(e.width+2*$e,e.height+2*$e,25),i=new Hg(e.width+2*$e,e.height+2*$e,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+$e,this.screenBottomBoundary=e.height+$e,this.gridRightBoundary=e.width+2*$e,this.gridBottomBoundary=e.height+2*$e,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.anchorPointX+s[0],d=e.anchorPointY+s[1],f=this.projectAndGetPerspectiveRatio(p,d,n,u,c),y=i*f.perspectiveRatio,g;if(!a&&!o){let C=f.x+(h?h.x*y:0),E=f.y+(h?h.y*y:0);g={allPointsOccluded:!1,box:[C+e.x1*y,E+e.y1*y,C+e.x2*y,E+e.y2*y]}}else g=this._projectCollisionBox(e,y,r,n,a,o,s,f,u,h,c);let[_,b,v,w]=g.box,P=a?g.allPointsOccluded:f.isOccluded,S=P;return S||(S=f.perspectiveRatio<this.perspectiveRatioCutoff),S||(S=!this.isInsideGrid(_,b,v,w)),S||t!=="always"&&this.grid.hitTest(_,b,v,w,t,l)?{box:[_,b,v,w],placeable:!1,offscreen:!1,occluded:P}:{box:[_,b,v,w],placeable:!0,offscreen:this.isOffscreen(_,b,v,w),occluded:P}}placeCollisionCircles(e,t,i,r,n,a,o,s,l,u,h,c,p,d){let f=[],y=new rr.default(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(y.x,y.y,a,d),_=(l?n*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,a)/g:n*g)/Zv,b={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},v=t.lineOffsetX*_,w=t.lineOffsetY*_,P={getElevation:d,pitchedLabelPlaneMatrix:o,lineVertexArray:i,pitchWithMap:l,projectionCache:b,transform:this.transform,tileAnchorPoint:y,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:p},S=db(_,r,v,w,!1,t,!1,P),C=!1,E=!1,F=!0;if(S){let B=h*.5*g+c,R=new rr.default(-$e,-$e),D=new rr.default(this.screenRightBoundary,this.screenBottomBoundary),z=new ez,x=S.first,T=S.last,I=[];for(let Z=x.path.length-1;Z>=1;Z--)I.push(x.path[Z]);for(let Z=1;Z<T.path.length;Z++)I.push(T.path[Z]);let U=B*2.5;if(l){let Z=this.projectPathToScreenSpace(I,P);Z.some(ie=>ie.signedDistanceFromCamera<=0)?I=[]:I=Z.map(ie=>ie.point)}let X=[];if(I.length>0){let Z=I[0].clone(),ie=I[0].clone();for(let pe=1;pe<I.length;pe++)Z.x=Math.min(Z.x,I[pe].x),Z.y=Math.min(Z.y,I[pe].y),ie.x=Math.max(ie.x,I[pe].x),ie.y=Math.max(ie.y,I[pe].y);Z.x>=R.x&&ie.x<=D.x&&Z.y>=R.y&&ie.y<=D.y?X=[I]:ie.x<R.x||Z.x>D.x||ie.y<R.y||Z.y>D.y?X=[]:X=QL([I],R.x,R.y,D.x,D.y)}for(let Z of X){z.reset(Z,B*.25);let ie=0;z.length<=.5*B?ie=1:ie=Math.ceil(z.paddedLength/U)+1;for(let pe=0;pe<ie;pe++){let je=pe/Math.max(ie-1,1),le=z.lerp(je),Oe=le.x+$e,qe=le.y+$e;f.push(Oe,qe,B,0);let gt=Oe-B,kt=qe-B,Dt=Oe+B,jt=qe+B;if(F=F&&this.isOffscreen(gt,kt,Dt,jt),E=E||this.isInsideGrid(gt,kt,Dt,jt),e!=="always"&&this.grid.hitTestCircle(Oe,qe,B,e,u)&&(C=!0,!s))return{circles:[],offscreen:!1,collisionDetected:C}}}}return{circles:!s&&C||!E||g<this.perspectiveRatioCutoff?[]:f,offscreen:F,collisionDetected:C}}projectPathToScreenSpace(e,t){let i=oz(e,t);return sz(i)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=new dr;for(let h of e){let c=new rr.default(h.x+$e,h.y+$e);i.extend(c),t.push(c)}let{minX:r,minY:n,maxX:a,maxY:o}=i,s=this.grid.query(r,n,a,o).concat(this.ignoredGrid.query(r,n,a,o)),l={},u={};for(let h of s){let c=h.key;if(l[c.bucketInstanceId]===void 0&&(l[c.bucketInstanceId]={}),l[c.bucketInstanceId][c.featureIndex])continue;let p=[new rr.default(h.x1,h.y1),new rr.default(h.x2,h.y1),new rr.default(h.x2,h.y2),new rr.default(h.x1,h.y2)];Iv(t,p)&&(l[c.bucketInstanceId][c.featureIndex]=!0,u[c.bucketInstanceId]===void 0&&(u[c.bucketInstanceId]=[]),u[c.bucketInstanceId].push(c.featureIndex))}return u}insertCollisionBox(e,t,i,r,n,a){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:t};o.insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n,a){let o=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:t};for(let l=0;l<e.length;l+=4)o.insertCircle(s,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,t,i,r,n){if(n){let a;r?(a=[e,t,r(e,t),1],_t.transformMat4(a,a,n)):(a=[e,t,0,1],Xd(a,a,n));let o=a[3];return{x:(a[0]/o+1)/2*this.transform.width+$e,y:(-a[1]/o+1)/2*this.transform.height+$e,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o),isOccluded:!1,signedDistanceFromCamera:o}}else{let a=this.transform.projectTileCoordinates(e,t,i,r);return{x:(a.point.x+1)/2*this.transform.width+$e,y:(-a.point.y+1)/2*this.transform.height+$e,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera),isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){let n=this.transform.projectTileCoordinates(e,t,i,r);return .5+.5*(this.transform.cameraToCenterDistance/n.signedDistanceFromCamera)}isOffscreen(e,t,i,r){return i<$e||e>=this.screenRightBoundary||r<$e||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=q.identity([]);return q.translate(e,e,[-$e,-$e,0]),e}_projectCollisionBox(e,t,i,r,n,a,o,s,l,u,h){let c=1,p=0,d=0,f=1,y=e.anchorPointX+o[0],g=e.anchorPointY+o[1];if(a&&!n){let z=this.projectAndGetPerspectiveRatio(y+1,g,r,l,h),x=z.x-s.x,T=z.y-s.y,I=Math.atan(T/x)+(x<0?Math.PI:0),U=Math.sin(I),X=Math.cos(I);c=X,p=U,d=-U,f=X}else if(!a&&n){let z=Ud(this.transform);c=z.vecEast[0],p=z.vecEast[1],d=z.vecSouth[0],f=z.vecSouth[1]}let _=s.x,b=s.y,v=t;if(n){_=y,b=g;let z=this.transform.zoom-i.overscaledZ;if(v=Math.pow(2,-z),v*=this.transform.getPitchedTextCorrection(y,g,r),!u){let x=s.signedDistanceFromCamera/this.transform.cameraToCenterDistance,T=Ne(.5+.5*x,0,4);v*=T}}u&&(_+=c*u.x*v+d*u.y*v,b+=p*u.x*v+f*u.y*v);let w=e.x1*v,P=e.x2*v,S=(w+P)/2,C=e.y1*v,E=e.y2*v,F=(C+E)/2,B=[{offsetX:w,offsetY:C},{offsetX:S,offsetY:C},{offsetX:P,offsetY:C},{offsetX:P,offsetY:F},{offsetX:P,offsetY:E},{offsetX:S,offsetY:E},{offsetX:w,offsetY:E},{offsetX:w,offsetY:F}],R=[];for(let{offsetX:z,offsetY:x}of B)R.push(new rr.default(_+c*z+d*x,b+p*z+f*x));let D=!1;if(n){let z=R.map(x=>this.projectAndGetPerspectiveRatio(x.x,x.y,r,l,h));D=z.some(x=>!x.isOccluded),R=z.map(x=>new rr.default(x.x,x.y))}else D=!0;return{box:wC(R),allPointsOccluded:!D}}},uz=fe(ge(),1),hz=class yb extends uz.default{constructor(t,i,r,n){super(t,i),this.angle=r,n!==void 0&&(this.segment=n)}clone(){return new yb(this.x,this.y,this.angle,this.segment)}};te("Anchor",hz);var rU=fe(ge(),1),nU=fe(ge(),1),aU=fe(ge(),1),oU=fe(k_(),1),Mp=(e=>(e[e.center=1]="center",e[e.left=2]="left",e[e.right=3]="right",e[e.top=4]="top",e[e.bottom=5]="bottom",e[e["top-left"]=6]="top-left",e[e["top-right"]=7]="top-right",e[e["bottom-left"]=8]="bottom-left",e[e["bottom-right"]=9]="bottom-right",e))(Mp||{}),sU=Number.POSITIVE_INFINITY;function cz(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}var gb=fe(ge(),1),Qg=class{constructor(e,t,i,r){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):this.opacity=r&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}},co=class{constructor(e,t,i,r,n){this.text=new Qg(e?e.text:null,t,i,n),this.icon=new Qg(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},e_=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},pz=class{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}},dz=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:i=>i.collisionGroupID===t}}return this.collisionGroups[e]}};function t_(e,t,i,r,n){let{horizontalAlign:a,verticalAlign:o}=Hv(e),s=-(a-.5)*t,l=-(o-.5)*i;return new gb.default(s+r[0]*n,l+r[1]*n)}var fz=class{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new lz(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new dz(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(i,r)=>t.getElevation(e,i,r):null}getBucketParts(e,t,i,r){let n=i.getBucket(t),a=i.latestFeatureIndex;if(!n||!a||t.id!==n.layerIds[0])return;let o=i.collisionBoxArray,s=n.layers[0].layout,l=n.layers[0].paint,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/8192,c=i.tileID.toUnwrapped(),p=s.get("text-rotation-alignment")==="map",d=ci(i,1,this.transform.zoom),f=ln(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),y=ln(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),g=jd(p,this.transform,d);this.retainedQueryData[n.bucketInstanceId]=new pz(n.bucketInstanceId,a,n.sourceLayerIndex,n.index,i.tileID);let _={bucket:n,layout:s,translationText:f,translationIcon:y,unwrappedTileID:c,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:i.holdingForFade(),collisionBoxArray:o,partiallyEvaluatedTextSize:Ru(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(r)for(let b of n.sortKeyRanges){let{sortKey:v,symbolInstanceStart:w,symbolInstanceEnd:P}=b;e.push({sortKey:v,symbolInstanceStart:w,symbolInstanceEnd:P,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b,v){let w=Mp[e.textAnchor],P=[e.textOffset0,e.textOffset1],S=t_(w,i,r,P,n),C=this.collisionIndex.placeCollisionBox(t,c,s,l,u,o,a,y,h.predicate,b,S,v);if(!(_&&!this.collisionIndex.placeCollisionBox(_,c,s,l,u,o,a,g,h.predicate,b,S,v).placeable)&&C.placeable){let E;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(E=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:P,width:i,height:r,anchor:w,textBoxScale:n,prevAnchor:E},this.markUsedJustification(d,w,p,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,p),this.placedOrientations[p.crossTileID]=f),{shift:S,placedGlyphBoxes:C}}}placeLayerBucketPart(e,t,i){let{bucket:r,layout:n,translationText:a,translationIcon:o,unwrappedTileID:s,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:h,collisionBoxArray:c,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=n.get("text-optional"),y=n.get("icon-optional"),g=Kl(n,"text-overlap","text-allow-overlap"),_=g==="always",b=Kl(n,"icon-overlap","icon-allow-overlap"),v=b==="always",w=n.get("text-rotation-alignment")==="map",P=n.get("text-pitch-alignment")==="map",S=n.get("icon-text-fit")!=="none",C=n.get("symbol-z-order")==="viewport-y",E=_&&(v||!r.hasIconData()||y),F=v&&(_||!r.hasTextData()||f);!r.collisionArrays&&c&&r.deserializeCollisionBoxes(c);let B=this.retainedQueryData[r.bucketInstanceId].tileID,R=this._getTerrainElevationFunc(B),D=this.transform.getFastPathSimpleProjectionMatrix(B),z=(x,T,I)=>{var Ki,_i;if(t[x.crossTileID])return;if(h){this.placements[x.crossTileID]=new e_(!1,!1,!1);return}let U=!1,X=!1,Z=!0,ie=null,pe={box:null,placeable:!1,offscreen:null,occluded:!1},je={box:null,placeable:!1,offscreen:null},le=null,Oe=null,qe=null,gt=0,kt=0,Dt=0;T.textFeatureIndex?gt=T.textFeatureIndex:x.useRuntimeCollisionCircles&&(gt=x.featureIndex),T.verticalTextFeatureIndex&&(kt=T.verticalTextFeatureIndex);let jt=T.textBox;if(jt){let Ht=pt=>{let et=1;if(r.allowVerticalPlacement&&!pt&&this.prevPlacement){let Gt=this.prevPlacement.placedOrientations[x.crossTileID];Gt&&(this.placedOrientations[x.crossTileID]=Gt,et=Gt,this.markUsedOrientation(r,et,x))}return et},Ut=(pt,et)=>{if(r.allowVerticalPlacement&&x.numVerticalGlyphVertices>0&&T.verticalTextBox){for(let Gt of r.writingModes)if(Gt===2?(pe=et(),je=pe):pe=pt(),pe&&pe.placeable)break}else pe=pt()},xi=x.textAnchorOffsetStartIndex,Ot=x.textAnchorOffsetEndIndex;if(Ot===xi){let pt=(et,Gt)=>{let Ct=this.collisionIndex.placeCollisionBox(et,g,u,B,s,P,w,a,d.predicate,R,void 0,D);return Ct&&Ct.placeable&&(this.markUsedOrientation(r,Gt,x),this.placedOrientations[x.crossTileID]=Gt),Ct};Ut(()=>pt(jt,1),()=>{let et=T.verticalTextBox;return r.allowVerticalPlacement&&x.numVerticalGlyphVertices>0&&et?pt(et,2):{box:null,offscreen:null}}),Ht(pe&&pe.placeable)}else{let pt=Mp[(_i=(Ki=this.prevPlacement)==null?void 0:Ki.variableOffsets[x.crossTileID])==null?void 0:_i.anchor],et=(Ct,Wa,Ah)=>{let Qn=Ct.x2-Ct.x1,Ls=Ct.y2-Ct.y1,zs=x.textBoxScale,Rs=S&&b==="never"?Wa:null,Ji=null,Ha=g==="never"?1:2,Fs="never";pt&&Ha++;for(let Bs=0;Bs<Ha;Bs++){for(let Li=xi;Li<Ot;Li++){let vn=r.textAnchorOffsets.get(Li);if(pt&&vn.textAnchor!==pt)continue;let Ka=this.attemptAnchorPlacement(vn,Ct,Qn,Ls,zs,w,P,u,B,s,d,Fs,x,r,Ah,a,o,Rs,R);if(Ka&&(Ji=Ka.placedGlyphBoxes,Ji&&Ji.placeable))return U=!0,ie=Ka.shift,Ji}pt?pt=null:Fs=g}return i&&!Ji&&(Ji={box:this.collisionIndex.placeCollisionBox(jt,"always",u,B,s,P,w,a,d.predicate,R,void 0,D).box,offscreen:!1,placeable:!1,occluded:!1}),Ji};Ut(()=>et(jt,T.iconBox,1),()=>{let Ct=T.verticalTextBox,Wa=pe&&pe.placeable;return r.allowVerticalPlacement&&!Wa&&x.numVerticalGlyphVertices>0&&Ct?et(Ct,T.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),pe&&(U=pe.placeable,Z=pe.offscreen);let Gt=Ht(pe&&pe.placeable);if(!U&&this.prevPlacement){let Ct=this.prevPlacement.variableOffsets[x.crossTileID];Ct&&(this.variableOffsets[x.crossTileID]=Ct,this.markUsedJustification(r,Ct.anchor,x,Gt))}}}if(le=pe,U=le&&le.placeable,Z=le&&le.offscreen,x.useRuntimeCollisionCircles){let Ht=r.text.placedSymbolArray.get(x.centerJustifiedTextSymbolIndex),Ut=Vd(r.textSizeData,p,Ht),xi=n.get("text-padding"),Ot=x.collisionCircleDiameter;Oe=this.collisionIndex.placeCollisionCircles(g,Ht,r.lineVertexArray,r.glyphOffsetArray,Ut,s,l,i,P,d.predicate,Ot,xi,a,R),Oe.circles.length&&Oe.collisionDetected&&!i&&Tt("Collisions detected, but collision boxes are not shown"),U=_||Oe.circles.length>0&&!Oe.collisionDetected,Z=Z&&Oe.offscreen}if(T.iconFeatureIndex&&(Dt=T.iconFeatureIndex),T.iconBox){let Ht=Ut=>this.collisionIndex.placeCollisionBox(Ut,b,u,B,s,P,w,o,d.predicate,R,S&&ie?ie:void 0,D);je&&je.placeable&&T.verticalIconBox?(qe=Ht(T.verticalIconBox),X=qe.placeable):(qe=Ht(T.iconBox),X=qe.placeable),Z=Z&&qe.offscreen}let yi=f||x.numHorizontalGlyphVertices===0&&x.numVerticalGlyphVertices===0,Lt=y||x.numIconVertices===0;!yi&&!Lt?X=U=X&&U:Lt?yi||(X=X&&U):U=X&&U;let xn=U&&le.placeable,Cr=X&&qe.placeable;if(xn&&(je&&je.placeable&&kt?this.collisionIndex.insertCollisionBox(le.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,kt,d.ID):this.collisionIndex.insertCollisionBox(le.box,g,n.get("text-ignore-placement"),r.bucketInstanceId,gt,d.ID)),Cr&&this.collisionIndex.insertCollisionBox(qe.box,b,n.get("icon-ignore-placement"),r.bucketInstanceId,Dt,d.ID),Oe&&U&&this.collisionIndex.insertCollisionCircles(Oe.circles,g,n.get("text-ignore-placement"),r.bucketInstanceId,gt,d.ID),i&&this.storeCollisionData(r.bucketInstanceId,I,T,le,qe,Oe),x.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(r.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");let Hi=(U||E)&&!(le!=null&&le.occluded),gi=(X||F)&&!(qe!=null&&qe.occluded);this.placements[x.crossTileID]=new e_(Hi,gi,Z||r.justReloaded),t[x.crossTileID]=!0};if(C){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let x=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let T=x.length-1;T>=0;--T){let I=x[T];z(r.symbolInstances.get(I),r.collisionArrays[I],I)}}else for(let x=e.symbolInstanceStart;x<e.symbolInstanceEnd;x++)z(r.symbolInstances.get(x),r.collisionArrays[x],x);r.justReloaded=!1}storeCollisionData(e,t,i,r,n,a){if(i.textBox||i.iconBox){let o;this.collisionBoxArrays.has(e)?o=this.collisionBoxArrays.get(e):(o=new Map,this.collisionBoxArrays.set(e,o));let s;o.has(t)?s=o.get(t):(s={text:null,icon:null},o.set(t,s)),i.textBox&&(s.text=r.box),i.iconBox&&(s.icon=n.box)}if(a){let o=this.collisionCircleArrays[e];o===void 0&&(o=this.collisionCircleArrays[e]=[]);for(let s=0;s<a.circles.length;s+=4)o.push(a.circles[s+0]-$e),o.push(a.circles[s+1]-$e),o.push(a.circles[s+2]),o.push(a.collisionDetected?1:0)}}markUsedJustification(e,t,i,r){let n={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},a;r===2?a=i.verticalPlacedTextSymbolIndex:a=n[cz(t)];let o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let s of o)s>=0&&(a>=0&&s!==a?e.text.placedSymbolArray.get(s).crossTileID=0:e.text.placedSymbolArray.get(s).crossTileID=i.crossTileID)}markUsedOrientation(e,t,i){let r=t===1||t===3?t:0,n=t===2?t:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let o of a)e.text.placedSymbolArray.get(o).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let s in this.placements){let l=this.placements[s],u=n[s];u?(this.opacities[s]=new co(u,r,l.text,l.icon),i=i||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new co(null,r,l.text,l.icon,l.skipFade),i=i||l.text||l.icon)}for(let s in n){let l=n[s];if(!this.opacities[s]){let u=new co(l,r,!1,!1);u.isHidden()||(this.opacities[s]=u,i=i||l.text.placed||l.icon.placed)}}for(let s in a)!this.variableOffsets[s]&&this.opacities[s]&&!this.opacities[s].isHidden()&&(this.variableOffsets[s]=a[s]);for(let s in o)!this.placedOrientations[s]&&this.opacities[s]&&!this.opacities[s].isHidden()&&(this.placedOrientations[s]=o[s]);if(t&&t.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let r of t){let n=r.getBucket(e);n&&r.latestFeatureIndex&&e.id===n.layerIds[0]&&this.updateBucketOpacities(n,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,t,i,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let n=e.layers[0],a=n.layout,o=new co(null,0,!1,!1,!0),s=a.get("text-allow-overlap"),l=a.get("icon-allow-overlap"),u=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h=a.get("text-rotation-alignment")==="map",c=a.get("text-pitch-alignment")==="map",p=a.get("icon-text-fit")!=="none",d=new co(null,0,s&&(l||!e.hasIconData()||a.get("icon-optional")),l&&(s||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let f=(g,_,b)=>{for(let v=0;v<_/4;v++)g.opacityVertexArray.emplaceBack(b);g.hasVisibleVertices=g.hasVisibleVertices||b!==po},y=this.collisionBoxArrays.get(e.bucketInstanceId);for(let g=0;g<e.symbolInstances.length;g++){let _=e.symbolInstances.get(g),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:v,crossTileID:w}=_,P=i[w],S=this.opacities[w];P?S=o:S||(S=d,this.opacities[w]=S),i[w]=!0;let C=b>0||v>0,E=_.numIconVertices>0,F=this.placedOrientations[_.crossTileID],B=F===2,R=F===1||F===3;if(C){let z=r_(S.text),x=B?po:z;f(e.text,b,x);let T=R?po:z;f(e.text,v,T);let I=S.text.isHidden();[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex].forEach(Z=>{Z>=0&&(e.text.placedSymbolArray.get(Z).hidden=I||B?1:0)}),_.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=I||R?1:0);let U=this.variableOffsets[_.crossTileID];U&&this.markUsedJustification(e,U.anchor,_,F);let X=this.placedOrientations[_.crossTileID];X&&(this.markUsedJustification(e,"left",_,X),this.markUsedOrientation(e,X,_))}if(E){let z=r_(S.icon),x=!(p&&_.verticalPlacedIconSymbolIndex&&B);if(_.placedIconSymbolIndex>=0){let T=x?z:po;f(e.icon,_.numIconVertices,T),e.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=S.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let T=x?po:z;f(e.icon,_.numVerticalIconVertices,T),e.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=S.icon.isHidden()}}let D=y&&y.has(g)?y.get(g):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let z=e.collisionArrays[g];if(z){let x=new gb.default(0,0);if(z.textBox||z.verticalTextBox){let T=!0;if(u){let I=this.variableOffsets[w];I?(x=t_(I.anchor,I.width,I.height,I.textOffset,I.textBoxScale),h&&x._rotate(c?-this.transform.bearingInRadians:this.transform.bearingInRadians)):T=!1}if(z.textBox||z.verticalTextBox){let I;z.textBox&&(I=B),z.verticalTextBox&&(I=R),i_(e.textCollisionBox.collisionVertexArray,S.text.placed,!T||I,D.text,x.x,x.y)}}if(z.iconBox||z.verticalIconBox){let T=!!(!R&&z.verticalIconBox),I;z.iconBox&&(I=T),z.verticalIconBox&&(I=!T),i_(e.iconCollisionBox.collisionVertexArray,S.icon.placed,I,D.icon,p?x.x:0,p?x.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(e.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(e.text.layoutVertexArray.length,") / 4"));if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(e.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(e.icon.layoutVertexArray.length,") / 4"));e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}};function i_(e,t,i,r,n,a){(!r||r.length===0)&&(r=[0,0,0,0]);let o=r[0]-$e,s=r[1]-$e,l=r[2]-$e,u=r[3]-$e;e.emplaceBack(t?1:0,i?1:0,n||0,a||0,o,s),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,l,s),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,l,u),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,o,u)}var mz=Math.pow(2,25),yz=Math.pow(2,24),gz=Math.pow(2,17),_z=Math.pow(2,16),xz=Math.pow(2,9),vz=Math.pow(2,8),bz=Math.pow(2,1);function r_(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=e.placed?1:0,i=Math.floor(e.opacity*127);return i*mz+t*yz+i*gz+t*_z+i*xz+t*vz+i*bz+t}var po=0,wz=class{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,r,n){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let o=e[this._currentTileIndex];if(t.getBucketParts(a,r,o,this._sortAcrossTiles),this._currentTileIndex++,n())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((o,s)=>o.sortKey-s.sortKey));this._currentPartIndex<a.length;){let o=a[this._currentPartIndex];if(t.placeLayerBucketPart(o,this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0}return!1}},Pz=class{constructor(e,t,i,r,n,a,o,s){this.placement=new fz(e,t,a,o,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let r=Me.now(),n=()=>this._forceFullPlacement?!1:Me.now()-r>2;for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],o=t[a],s=this.placement.collisionIndex.transform.zoom;if(o.type==="symbol"&&(!o.minzoom||o.minzoom<=s)&&(!o.maxzoom||o.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new wz(o)),this._inProgressLayer.continuePlacement(i[o.source],this.placement,this._showCollisionBoxes,o,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}},n_=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],gc=1,fo=8,Sz=class _b{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(t,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");let n=r>>4;if(n!==gc)throw new Error("Got v".concat(n," data when expected v").concat(gc,"."));let a=n_[r&15];if(!a)throw new Error("Unrecognized array type.");let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new _b(s,o,a,t)}constructor(t,i=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error("Unpexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let a=n_.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(r,"."));n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,fo,t),this.coords=new this.ArrayType(this.data,fo+s+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(fo+o+s+l),this.ids=new this.IndexArrayType(this.data,fo,t),this.coords=new this.ArrayType(this.data,fo+s+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(gc<<4)+a]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=t)}add(t,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error("Added ".concat(t," items when expected ").concat(this.numItems,"."));return Cp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:a,coords:o,nodeSize:s}=this,l=[0,a.length-1,0],u=[];for(;l.length;){let h=l.pop()||0,c=l.pop()||0,p=l.pop()||0;if(c-p<=s){for(let g=p;g<=c;g++){let _=o[2*g],b=o[2*g+1];_>=t&&_<=r&&b>=i&&b<=n&&u.push(a[g])}continue}let d=p+c>>1,f=o[2*d],y=o[2*d+1];f>=t&&f<=r&&y>=i&&y<=n&&u.push(a[d]),(h===0?t<=f:i<=y)&&(l.push(p),l.push(d-1),l.push(1-h)),(h===0?r>=f:n>=y)&&(l.push(d+1),l.push(c),l.push(1-h))}return u}within(t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:n,coords:a,nodeSize:o}=this,s=[0,n.length-1,0],l=[],u=r*r;for(;s.length;){let h=s.pop()||0,c=s.pop()||0,p=s.pop()||0;if(c-p<=o){for(let g=p;g<=c;g++)a_(a[2*g],a[2*g+1],t,i)<=u&&l.push(n[g]);continue}let d=p+c>>1,f=a[2*d],y=a[2*d+1];a_(f,y,t,i)<=u&&l.push(n[d]),(h===0?t-r<=f:i-r<=y)&&(s.push(p),s.push(d-1),s.push(1-h)),(h===0?t+r>=f:i+r>=y)&&(s.push(d+1),s.push(c),s.push(1-h))}return l}};function Cp(e,t,i,r,n,a){if(n-r<=i)return;let o=r+n>>1;xb(e,t,o,r,n,a),Cp(e,t,i,r,o-1,1-a),Cp(e,t,i,o+1,n,1-a)}function xb(e,t,i,r,n,a){for(;n>r;){if(n-r>600){let u=n-r+1,h=i-r+1,c=Math.log(u),p=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1),f=Math.max(r,Math.floor(i-h*p/u+d)),y=Math.min(n,Math.floor(i+(u-h)*p/u+d));xb(e,t,i,f,y,a)}let o=t[2*i+a],s=r,l=n;for(mo(e,t,r,i),t[2*n+a]>o&&mo(e,t,r,n);s<l;){for(mo(e,t,s,l),s++,l--;t[2*s+a]<o;)s++;for(;t[2*l+a]>o;)l--}t[2*r+a]===o?mo(e,t,r,l):(l++,mo(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function mo(e,t,i,r){_c(e,i,r),_c(t,2*i,2*r),_c(t,2*i+1,2*r+1)}function _c(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function a_(e,t,i,r){let n=e-i,a=t-r;return n*n+a*a}var yo=512/8192/2,Tz=128,Mz=class{constructor(e,t,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let n=0;n<t.length;n++){let a=t.get(n),o=a.key,s=r.get(o);s?s.push(a):r.set(o,[a])}for(let[n,a]of r){let o=a.map(u=>({x:Math.floor(u.anchorX*yo),y:Math.floor(u.anchorY*yo)})),s=a.map(u=>u.crossTileID),l={positions:o,crossTileIDs:s};if(l.positions.length>Tz){let u=new Sz(l.positions.length,16,Uint16Array);for(let{x:h,y:c}of l.positions)u.add(h,c);u.finish(),delete l.positions,l.index=u}this._symbolsByKey[n]=l}}getScaledCoordinates(e,t){let{x:i,y:r,z:n}=this.tileID.canonical,{x:a,y:o,z:s}=t.canonical,l=s-n,u=yo/Math.pow(2,l),h=(a*8192+e.anchorX)*u,c=(o*8192+e.anchorY)*u,p=i*8192*yo,d=r*8192*yo;return{x:Math.floor(h-p),y:Math.floor(c-d)}}findMatches(e,t,i){let r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let n=0;n<e.length;n++){let a=e.get(n);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);if(o.index){let l=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(let u of l){let h=o.crossTileIDs[u];if(!i[h]){i[h]=!0,a.crossTileID=h;break}}}else if(o.positions)for(let l=0;l<o.positions.length;l++){let u=o.positions[l],h=o.crossTileIDs[l];if(Math.abs(u.x-s.x)<=r&&Math.abs(u.y-s.y)<=r&&!i[h]){i[h]=!0,a.crossTileID=h;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},Cz=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},Iz=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let i in this.indexes){let r=this.indexes[i],n={};for(let a in r){let o=r[a];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+t),n[o.tileID.key]=o}this.indexes[i]=n}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let n=0;n<t.symbolInstances.length;n++){let a=t.symbolInstances.get(n);a.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let r=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let a=this.indexes[n];if(Number(n)>e.overscaledZ)for(let o in a){let s=a[o];s.tileID.isChildOf(e)&&s.findMatches(t.symbolInstances,e,r)}else{let o=e.scaledTo(Number(n)),s=a[o.key];s&&s.findMatches(t.symbolInstances,e,r)}}for(let n=0;n<t.symbolInstances.length;n++){let a=t.symbolInstances.get(n);a.crossTileID||(a.crossTileID=i.generate(),r[a.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Mz(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[e][r]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let r=this.indexes[i];for(let n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}},vb=class{constructor(){this.layerIndexes={},this.crossTileIDs=new Cz,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new Iz);let n=!1,a={};r.handleWrapJump(i);for(let o of t){let s=o.getBucket(e);!s||e.id!==s.layerIds[0]||(s.bucketInstanceId||(s.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(o.tileID,s,this.crossTileIDs)&&(n=!0),a[s.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(n=!0),n}pruneUnusedLayers(e){let t={};e.forEach(i=>{t[i]=!0});for(let i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}},Az="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;",Ez="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;",kz="uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Dz="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",Lz="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",zz="uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",Rz="in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Fz="uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}",o_="void main() {fragColor=vec4(1.0);}",Bz="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",Oz="uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Nz="uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}",Vz="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}",jz="uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}",Uz="in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}",Gz="in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}",Xz="in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}",qz="in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}",$z="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(textureSize(u_elevation_stops,0)[0]);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int num_elevation_stops=textureSize(u_elevation_stops,0)[0];int r=(num_elevation_stops-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(textureSize(u_color_stops,0)[0]);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Zz="uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}",Yz="uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}",Wz="in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}",Hz="in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}",Kz="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",Jz="uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}",Qz="in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",eR="uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}",tR="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",iR="uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}",rR="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",nR="uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}",aR="in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",oR="uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}",sR="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",lR="uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}",uR="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",hR="uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}",cR="uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;switch(u_method){case BASIC:\nbasic_hillshade(deriv);break;case COMBINED:\ncombined_hillshade(deriv);break;case IGOR:\nigor_hillshade(deriv);break;case MULTIDIRECTIONAL:\nmultidirectional_hillshade(deriv);break;case STANDARD:\ndefault:\nstandard_hillshade(deriv);break;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",pR="uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}",dR="uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",fR="\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}",mR="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",yR="\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}",gR="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",_R="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}",xR="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",vR="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}",bR="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",wR="uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}",PR="uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",SR="in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}",TR="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",MR="in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}",CR="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}",IR="in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}",AR="in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}",ER="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",kR="uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}",DR="in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}",LR="in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}",zR="in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}",RR="in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}",FR="in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}",BR="float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}",OR="#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}",NR="in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}",VR="in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}",jR="uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}",UR="in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}",hr={prelude:ke(Az,Ez),projectionMercator:ke("",BR),projectionGlobe:ke("",OR),background:ke(kz,Dz),backgroundPattern:ke(Lz,zz),circle:ke(Rz,Fz),clippingMask:ke(o_,Bz),heatmap:ke(Oz,Nz),heatmapTexture:ke(Vz,jz),collisionBox:ke(Uz,Gz),collisionCircle:ke(Xz,qz),colorRelief:ke($z,Zz),debug:ke(Yz,Wz),depth:ke(o_,Hz),fill:ke(Kz,Jz),fillOutline:ke(Qz,eR),fillOutlinePattern:ke(tR,iR),fillPattern:ke(rR,nR),fillExtrusion:ke(aR,oR),fillExtrusionPattern:ke(sR,lR),hillshadePrepare:ke(uR,hR),hillshade:ke(cR,pR),line:ke(dR,fR),lineGradient:ke(mR,yR),linePattern:ke(gR,_R),lineSDF:ke(xR,vR),raster:ke(bR,wR),symbolIcon:ke(PR,SR),symbolSDF:ke(TR,MR),symbolTextAndIcon:ke(CR,IR),terrain:ke(kR,DR),terrainDepth:ke(AR,LR),terrainCoords:ke(ER,zR),projectionErrorMeasurement:ke(FR,RR),atmosphere:ke(NR,VR),sky:ke(jR,UR)};function ke(e,t){let i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=a?a.concat(n):n,s={};return e=e.replace(i,(l,u,h,c,p)=>(s[p]=!0,u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nin ").concat(h," ").concat(c," ").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"))),t=t.replace(i,(l,u,h,c,p)=>{let d=c==="float"?"vec2":"vec4",f=p.match(/color/)?"color":d;return s[p]?u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nuniform lowp float u_").concat(p,"_t;\nin ").concat(h," ").concat(d," a_").concat(p,";\nout ").concat(h," ").concat(c," ").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):f==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(p," = a_").concat(p,";\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(p," = unpack_mix_").concat(f,"(a_").concat(p,", u_").concat(p,"_t);\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\nuniform lowp float u_").concat(p,"_t;\nin ").concat(h," ").concat(d," a_").concat(p,";\n#else\nuniform ").concat(h," ").concat(c," u_").concat(p,";\n#endif\n"):f==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = a_").concat(p,";\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(p,"\n ").concat(h," ").concat(c," ").concat(p," = unpack_mix_").concat(f,"(a_").concat(p,", u_").concat(p,"_t);\n#else\n ").concat(h," ").concat(c," ").concat(p," = u_").concat(p,";\n#endif\n")}),{fragmentSource:e,vertexSource:t,staticAttributes:r,staticUniforms:o}}function GR(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}function XR(e){return e.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}var za=class{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}},on=yt([{name:"a_pos",type:"Int16",components:2}]),bb="#define PROJECTION_MERCATOR",wb="mercator",Ip=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return wb}get shaderDefine(){return bb}get shaderPreludeCode(){return hr.projectionMercator}get vertexShaderPreludeCode(){return hr.projectionMercator.vertexSource}get subdivisionGranularity(){return Bd.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,t,i,r,n){if(this._cachedMesh)return this._cachedMesh;let a=new zr;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let o=e.createVertexBuffer(a,on.members),s=Qe.simpleSegment(0,0,4,2),l=new qi;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new za(o,u,s),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}},si=fe(ge(),1),Mn=fe(ge(),1),qR=fe(ge(),1),s_=class Pb{constructor(t=0,i=0,r=0,n=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=n}interpolate(t,i,r){return i.top!=null&&t.top!=null&&(this.top=ht.number(t.top,i.top,r)),i.bottom!=null&&t.bottom!=null&&(this.bottom=ht.number(t.bottom,i.bottom,r)),i.left!=null&&t.left!=null&&(this.left=ht.number(t.left,i.left,r)),i.right!=null&&t.right!=null&&(this.right=ht.number(t.right,i.right,r)),this}getCenter(t,i){let r=Ne((this.left+t-this.right)/2,0,t),n=Ne((this.top+i-this.bottom)/2,0,i);return new qR.default(r,n)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Pb(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function eu(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function l_(e){return Math.max(0,Math.floor(e))}var qd=class{constructor(e,t,i,r,n,a){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=a===void 0?!0:!!a,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=r!=null?r:0,this._maxPitch=n!=null?n:60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new de(0,0),this._elevation=0,this._zoom=0,this._tileZoom=l_(this._zoom),this._scale=qt(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new s_,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,i){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=l_(this._zoom),this._scale=qt(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new s_(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!i&&e.autoCalculateNearFarZ,t&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Mn.default(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=An(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=Bo.create(),Bo.rotate(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=Ne(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return pa(this._fovInRadians)}setFov(e){e=Ne(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Je(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.getConstrained(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=qt(t),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return!this._latRange||this._latRange.length!==2||!this._lngRange||this._lngRange.length!==2?null:new yr([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-fr,fr])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:i,minY:r,maxX:n,maxY:a}=dr.fromPoints(t).extend(e);return[new Mn.default(i,r),new Mn.default(n,r),new Mn.default(n,a),new Mn.default(i,a),new Mn.default(i,r)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=q.identity(new Float64Array(16));q.scale(e,e,[this._width/2,-this._height/2,1]),q.translate(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=q.identity(new Float64Array(16)),q.scale(e,e,[1,-1,1]),q.translate(e,e,[-1,-1,0]),q.scale(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,i,r){let n=i!==void 0?i:this.bearing,a=r=r!==void 0?r:this.pitch,o=Ke.fromLngLat(e,t),s=-Math.cos(Je(a)),l=Math.sin(Je(a)),u=l*Math.sin(Je(n)),h=-l*Math.cos(Je(n)),c=this.elevation,p=t-c,d;s*p>=0||Math.abs(s)<.1?(d=1e4,c=t+d*s):d=-p/s;let f=_p(1,o.y),y,g,_=0,b=10;do{if(_+=1,_>b)break;g=d/f;let P=u*g,S=h*g;y=new Ke(o.x+P,o.y+S),f=1/y.meterInMercatorCoordinateUnits()}while(Math.abs(d-g*f)>1e-12);let v=y.toLngLat(),w=$t(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize);return{center:v,elevation:c,zoom:w}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=Dn(1,this.center.lat)*this.worldSize,i=this.cameraToCenterDistance/t,r=Ke.fromLngLat(this.center,this.elevation),n=wp(this.center,this.elevation,this.pitch,this.bearing,i);this._elevation=e;let a=this.calculateCenterFromCameraLngLatAlt(n.toLngLat(),_p(n.z,r.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Mn.default(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=Dn(1,this.center.lat)*this.worldSize,t=this.cameraToCenterDistance/e;return wp(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/t,e.canonical.y/t,1/t/8192,1/t/8192]}},Sb=class Tb{constructor(t,i){this.min=t,this.max=i,this.center=$.scale([],$.add([],this.min,this.max),.5)}quadrant(t){let i=[t%2===0,t<2],r=$.clone(this.min),n=$.clone(this.max);for(let a=0;a<i.length;a++)r[a]=i[a]?this.min[a]:this.center[a],n[a]=i[a]?this.center[a]:this.max[a];return n[2]=this.max[2],new Tb(r,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let i=!0;for(let r=0;r<t.planes.length;r++){let n=this.intersectsPlane(t.planes[r]);if(n===0)return 0;n===1&&(i=!1)}return i?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let i=t[3],r=t[3];for(let n=0;n<3;n++)t[n]>0?(i+=t[n]*this.min[n],r+=t[n]*this.max[n]):(r+=t[n]*this.min[n],i+=t[n]*this.max[n]);return i>=0?2:r<0?0:1}},$R=class{distanceToTile2d(e,t,i,r){let n=r.distanceX([e,t]),a=r.distanceY([e,t]);return Math.hypot(n,a)}getWrap(e,t,i){return i}getTileBoundingVolume(e,t,i,r){var s,l;let n=0,a=0;if(r!=null&&r.terrain){let u=new Vt(e.z,t,e.z,e.x,e.y),h=r.terrain.getMinMaxElevation(u);n=(s=h.minElevation)!=null?s:Math.min(0,i),a=(l=h.maxElevation)!=null?l:Math.max(0,i)}let o=1<<e.z;return new Sb([t+e.x/o,e.y/o,n],[t+(e.x+1)/o,(e.y+1)/o,a])}allowVariableZoom(e,t){let i=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,r=Ne(78.5-i/2,0,60);return!!t.terrain||e.pitch>r}allowWorldCopies(){return!0}prepareNextFrame(){}},Mb=class Cb{constructor(t,i,r){this.points=t,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(t,i=1,r=0,n,a){let o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],s=a?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=Math.pow(2,r),u=o.map(d=>ZR(d,t,i,l));n&&YR(u,s[0],n,a);let h=s.map(d=>{let f=$.sub([],u[d[0]],u[d[1]]),y=$.sub([],u[d[2]],u[d[1]]),g=$.normalize([],$.cross([],f,y)),_=-$.dot(g,u[d[1]]);return g.concat(_)}),c=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],p=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let d of u)for(let f=0;f<3;f++)c[f]=Math.min(c[f],d[f]),p[f]=Math.max(p[f],d[f]);return new Cb(u,h,new Sb(c,p))}};function ZR(e,t,i,r){let n=_t.transformMat4([],e,t),a=1/n[3]/i*r;return _t.mul(n,n,[a,a,1/n[3],a])}function YR(e,t,i,r){let n=r?4:0,a=r?0:4,o=0,s=[],l=[];for(let c=0;c<4;c++){let p=$.sub([],e[c+a],e[c+n]),d=$.length(p);$.scale(p,p,1/d),s.push(d),l.push(p)}for(let c=0;c<4;c++){let p=bC(e[c+n],l[c],i);p!==null&&p>=0?o=Math.max(o,p):o=Math.max(o,s[c])}let u=WR(e,t),h=HR(i,u);if(h!==null){let c=h/$.dot(l[0],u);o=Math.min(o,c)}for(let c=0;c<4;c++){let p=Math.min(o,s[c]),d=[e[c+n][0]+l[c][0]*p,e[c+n][1]+l[c][1]*p,e[c+n][2]+l[c][2]*p,1];e[c+a]=d}}function WR(e,t){let i=$.sub([],e[t[0]],e[t[1]]),r=$.sub([],e[t[2]],e[t[1]]),n=[0,0,0,0];return $.normalize(n,$.cross([],i,r)),n[3]=-$.dot(n,e[t[0]]),n}function HR(e,t){let i=$.len(e),r=_t.scale([],e,1/i),n=$.sub([],t,$.scale([],r,$.dot(t,r))),a=$.len(n);if(a>0){let o=Math.sqrt(1-r[3]*r[3]),s=$.scale([],r,-r[3]),l=$.add([],s,$.scale([],n,o/a));return Bc(t,l)}else return null}var tu=class Ib{constructor(t,i,r,n,a){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new qd({calcMatrices:()=>{this._calcMatrices()},getConstrained:(o,s)=>this.getConstrained(o,s)},t,i,r,n,a),this._coveringTilesDetailsProvider=new $R}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,i){}clone(){let t=new Ib;return t.apply(this),t}apply(t,i,r){this._helper.apply(t,i,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let i=[new Jl(0,t)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new si.default(0,0)),n=this.screenPointToMercatorCoordinate(new si.default(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new si.default(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new si.default(0,this._helper._height)),s=Math.floor(Math.min(r.x,n.x,a.x,o.x)),l=Math.floor(Math.max(r.x,n.x,a.x,o.x)),u=1;for(let h=s-u;h<=l+u;h++)h!==0&&i.push(new Jl(h,t))}return i}getCameraFrustum(){return Mb.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let i=this.screenPointToLocation(this.centerPoint,t),r=t?t.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t,i){let r=Dn(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),a=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),o=Ke.fromLngLat(t),s=new Ke(o.x-(n.x-a.x),o.y-(n.y-a.y));this.setCenter(s==null?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(Ke.fromLngLat(t),i.getElevationForLngLatZoom(t,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(Ke.fromLngLat(t))}screenPointToLocation(t,i){var r;return(r=this.screenPointToMercatorCoordinate(t,i))==null?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(r!=null)return r}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,i){let r=i||0,n=[t.x,t.y,0,1],a=[t.x,t.y,1,1];_t.transformMat4(n,n,this._pixelMatrixInverse),_t.transformMat4(a,a,this._pixelMatrixInverse);let o=n[3],s=a[3],l=n[0]/o,u=a[0]/s,h=n[1]/o,c=a[1]/s,p=n[2]/o,d=a[2]/s,f=p===d?0:(r-p)/(d-p);return new Ke(ht.number(l,u,f)/this.worldSize,ht.number(h,c,f)/this.worldSize,r)}coordinatePoint(t,i=0,r=this._pixelMatrix){let n=[t.x*this.worldSize,t.y*this.worldSize,i,1];return _t.transformMat4(n,n,r),new si.default(n[0]/n[3],n[1]/n[3])}getBounds(){let t=Math.max(0,this._helper._height/2-Nl(this));return new yr().extend(this.screenPointToLocation(new si.default(0,t))).extend(this.screenPointToLocation(new si.default(this._helper._width,t))).extend(this.screenPointToLocation(new si.default(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new si.default(0,this._helper._height)))}isPointOnMapSurface(t,i){return i?i.pointCoordinate(t)!=null:t.y>this.height/2-Nl(this)}calculatePosMatrix(t,i=!1,r){var l;let n=(l=t.key)!=null?l:_a(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),a=i?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(n)){let u=a.get(n);return r?u.f32:u.f64}let o=yc(t,this.worldSize);q.multiply(o,i?this._alignedProjMatrix:this._viewProjMatrix,o);let s={f64:o,f32:new Float32Array(o)};return a.set(n,s),r?s.f32:s.f64}calculateFogMatrix(t){let i=t.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let n=yc(t,this.worldSize);return q.multiply(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}getConstrained(t,i){i=Ne(+i,this.minZoom,this.maxZoom);let r={center:new de(t.lng,t.lat),zoom:i},n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&n===null){let v=179.9999999999;n=[-v,v]}let a=this.tileSize*qt(r.zoom),o=0,s=a,l=0,u=a,h=0,c=0,{x:p,y:d}=this.size;if(this._helper._latRange){let v=this._helper._latRange;o=Bn(v[1])*a,s=Bn(v[0])*a,s-o<d&&(h=d/(s-o))}n&&(l=An(ka(n[0])*a,0,a),u=An(ka(n[1])*a,0,a),u<l&&(u+=a),u-l<p&&(c=p/(u-l)));let{x:f,y}=ur(a,t),g,_,b=Math.max(c||0,h||0);if(b){let v=new si.default(c?(u+l)/2:f,h?(s+o)/2:y);return r.center=es(a,v).wrap(),r.zoom+=$t(b),r}if(this._helper._latRange){let v=d/2;y-v<o&&(_=o+v),y+v>s&&(_=s-v)}if(n){let v=(l+u)/2,w=f;this._helper._renderWorldCopies&&(w=An(f,v-a/2,v+a/2));let P=p/2;w-P<l&&(g=l+P),w+P>u&&(g=u-P)}if(g!==void 0||_!==void 0){let v=new si.default(g!=null?g:f,_!=null?_:y);r.center=es(a,v).wrap()}return r}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}_calculateNearFarZIfNeeded(t,i,r){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=t-n*this._helper._pixelPerMeter/Math.cos(i),o=n<0?a:t,s=Math.PI/2+this.pitchInRadians,l=Je(this.fov)*(Math.abs(Math.cos(Je(this.roll)))*this.height+Math.abs(Math.sin(Je(this.roll)))*this.width)/this.height*(.5+r.y/this.height),u=Math.sin(l)*o/Math.sin(Ne(Math.PI-s-l,.01,Math.PI-.01)),h=Nl(this),c=Math.atan(h/this._helper.cameraToCenterDistance),p=Je(90-xa),d=c>p?2*c*(.5+r.y/(h*2)):p,f=Math.sin(d)*o/Math.sin(Ne(Math.PI-s-d,.01,Math.PI-.01)),y=Math.min(u,f);this._helper._farZ=(Math.cos(Math.PI/2-i)*y+o)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,i=ur(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=Dn(1,this.center.lat)*this.worldSize;let a=Je(Math.min(this.pitch,xa)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(a));this._calculateNearFarZIfNeeded(o,a,t);let s;s=new Float64Array(16),q.perspective(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),q.invert(this._invProjMatrix,s),s[8]=-t.x*2/this._helper._width,s[9]=t.y*2/this._helper._height,this._projectionMatrix=q.clone(s),q.scale(s,s,[1,-1,1]),q.translate(s,s,[0,0,-this._helper.cameraToCenterDistance]),q.rotateZ(s,s,-this.rollInRadians),q.rotateX(s,s,this.pitchInRadians),q.rotateZ(s,s,-this.bearingInRadians),q.translate(s,s,[-r,-n,0]),this._mercatorMatrix=q.scale([],s,[this.worldSize,this.worldSize,this.worldSize]),q.scale(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=q.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),q.translate(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=q.invert([],s);let l=[0,0,-1,1];_t.transformMat4(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),q.perspective(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=-t.x*2/this.width,this._fogMatrix[9]=t.y*2/this.height,q.scale(this._fogMatrix,this._fogMatrix,[1,-1,1]),q.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),q.rotateZ(this._fogMatrix,this._fogMatrix,-this.rollInRadians),q.rotateX(this._fogMatrix,this._fogMatrix,this.pitchInRadians),q.rotateZ(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),q.translate(this._fogMatrix,this._fogMatrix,[-r,-n,0]),q.scale(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),q.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=q.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let u=this._helper._width%2/2,h=this._helper._height%2/2,c=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=r-Math.round(r)+c*u+p*h,f=n-Math.round(n)+c*h+p*u,y=new Float64Array(s);if(q.translate(y,y,[d>.5?d-1:d,f>.5?f-1:f,0]),this._alignedProjMatrix=y,s=q.invert(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new si.default(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return _t.transformMat4(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=Dn(1,this.center.lat)*this.worldSize,i=this._helper.cameraToCenterDistance/t;return wp(this.center,this.elevation,this.pitch,this.bearing,i).toLngLat()}lngLatToCameraDepth(t,i){let r=Ke.fromLngLat(t),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return _t.transformMat4(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){let{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=t,a=this._helper.getMercatorTileCoordinates(i),o=i?this.calculatePosMatrix(i,r,!0):null,s;return i&&i.terrainRttPosMatrix32f&&n?s=i.terrainRttPosMatrix32f:o?s=o:s=O0(),{mainMatrix:s,tileMercatorCoords:a,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,r){return 1}transformLightDirection(t){return $.clone(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,i,r,n){let a=this.calculatePosMatrix(r),o;n?(o=[t,i,n(t,i),1],_t.transformMat4(o,o,a)):(o=[t,i,0,1],Xd(o,o,a));let s=o[3];return{point:new si.default(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(let i of t)this.calculatePosMatrix(i)}getMatrixForModel(t,i){let r=Ke.fromLngLat(t,i),n=r.meterInMercatorCoordinateUnits(),a=na();return q.translate(a,a,[r.x,r.y,r.z]),q.rotateZ(a,a,Math.PI),q.rotateX(a,a,Math.PI/2),q.scale(a,a,[-n,n,n]),a}getProjectionDataForCustomLayer(t=!0){let i=new Vt(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),n=yc(i,this.worldSize);q.multiply(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];let a=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],o=nn();return q.scale(o,n,a),r.fallbackMatrix=o,r.mainMatrix=o,r}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}},gl=fe(ge(),1);function Ab(){Tt("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Eb(e){if(e.useSlerp)if(e.k<1){let t=Ey(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=Ey(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),r=new Float64Array(4);ou.slerp(r,t,i,e.k);let n=RC(r);e.tr.setRoll(n.roll),e.tr.setPitch(n.pitch),e.tr.setBearing(n.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(ht.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(ht.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(ht.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function kb(e,t,i,r,n){let a=n.padding,o=ur(n.worldSize,i.getNorthWest()),s=ur(n.worldSize,i.getNorthEast()),l=ur(n.worldSize,i.getSouthEast()),u=ur(n.worldSize,i.getSouthWest()),h=Je(-r),c=o.rotate(h),p=s.rotate(h),d=l.rotate(h),f=u.rotate(h),y=new gl.default(Math.max(c.x,p.x,f.x,d.x),Math.max(c.y,p.y,f.y,d.y)),g=new gl.default(Math.min(c.x,p.x,f.x,d.x),Math.min(c.y,p.y,f.y,d.y)),_=y.sub(g),b=n.width-(a.left+a.right+t.left+t.right),v=n.height-(a.top+a.bottom+t.top+t.bottom),w=b/_.x,P=v/_.y;if(P<0||w<0){Ab();return}let S=Math.min($t(n.scale*Math.min(w,P)),e.maxZoom),C=gl.default.convert(e.offset),E=(t.left-t.right)/2,F=(t.top-t.bottom)/2,B=new gl.default(E,F).rotate(Je(r)),R=C.add(B).mult(n.scale/qt(S));return{center:es(n.worldSize,o.add(l).div(2).sub(R)),zoom:S,bearing:r}}var iu=class{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,n){return kb(e,t,i,r,n)}handleJumpToCenterZoom(e,t){let i=typeof t.zoom<"u"?+t.zoom:e.zoom;e.zoom!==i&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(de.convert(t.center))}handleEaseTo(e,t){let i=e.zoom,r=e.padding,n={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a=t.roll===void 0?e.roll:t.roll,o=t.pitch===void 0?e.pitch:t.pitch,s=t.bearing===void 0?e.bearing:t.bearing,l={roll:a,pitch:o,bearing:s},u=typeof t.zoom<"u",h=!e.isPaddingEqual(t.padding),c=!1,p=u?+t.zoom:e.zoom,d=e.centerPoint.add(t.offsetAsPoint),f=e.screenPointToLocation(d),{center:y,zoom:g}=e.getConstrained(de.convert(t.center||f),p!=null?p:i);eu(e,y);let _=ur(e.worldSize,f),b=ur(e.worldSize,y).sub(_),v=qt(g-i);return c=g!==i,{easeFunc:w=>{if(c&&e.setZoom(ht.number(i,g,w)),U0(n,l)||Eb({startEulerAngles:n,endEulerAngles:l,tr:e,k:w,useSlerp:n.roll!=l.roll}),h&&(e.interpolatePadding(r,t.padding,w),d=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let P=qt(e.zoom-i),S=g>i?Math.min(2,v):Math.max(.5,v),C=Math.pow(S,1-w),E=es(e.worldSize,_.add(b.mult(w*C)).mult(P));e.setLocationAtPoint(e.renderWorldCopies?E.wrap():E,d)}},isZooming:c,elevationCenter:y}}handleFlyTo(e,t){let i=typeof t.zoom<"u",r=e.zoom,n=e.getConstrained(de.convert(t.center||t.locationAtOffset),i?+t.zoom:r),a=n.center,o=n.zoom;eu(e,a);let s=ur(e.worldSize,t.locationAtOffset),l=ur(e.worldSize,a).sub(s),u=l.mag(),h=qt(o-r),c=typeof t.minZoom<"u",p;if(c){let d=Math.min(+t.minZoom,r,o),f=e.getConstrained(a,d).zoom;p=qt(f-r)}return{easeFunc:(d,f,y,g)=>{e.setZoom(d===1?o:r+$t(f));let _=d===1?a:es(e.worldSize,s.add(l.mult(y)).mult(f));e.setLocationAtPoint(e.renderWorldCopies?_.wrap():_,g)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:p,pixelPathLength:u}}},KR=0,Db=1,JR=771,it=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};it.Replace=[Db,KR];it.disabled=new it(it.Replace,oe.transparent,[!1,!1,!1,!1]);it.unblended=new it(it.Replace,oe.transparent,[!0,!0,!0,!0]);it.alphaBlended=new it([Db,JR],oe.transparent,[!0,!0,!0,!0]);var Le=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};Le.disabled=new Le(!1,1029,2305);Le.backCCW=new Le(!0,1029,2305);Le.frontCCW=new Le(!0,1028,2305);var ve=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};ve.ReadOnly=!1;ve.ReadWrite=!0;ve.disabled=new ve(519,ve.ReadOnly,[0,1]);var Fe=class{constructor(e,t,i,r,n,a){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=a}};Fe.disabled=new Fe({func:519,mask:0},0,0,7680,7680,7680);var QR=(e,t)=>({u_input:new K(e,t.u_input),u_output_expected:new K(e,t.u_output_expected)}),e5=(e,t)=>({u_input:e,u_output_expected:t}),xc=new WeakMap;function Br(e){var t;if(xc.has(e))return xc.get(e);{let i=(t=e.getParameter(e.VERSION))==null?void 0:t.startsWith("WebGL 2.0");return xc.set(e,i),i}}var t5=class Lb{constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;let i=t.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;let n=new zr;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);let a=new qi;a.emplaceBack(0,1,2),this._fullscreenTriangle=new za(i.createVertexBuffer(n,on.members),i.createIndexBuffer(a),Qe.simpleSegment(0,0,n.length,a.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);let o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),Br(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}get awaitingQuery(){return!!this._readbackQueue}destroy(){let t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,i){let r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,i),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,i=t.gl;t.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,i){let r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:oe.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,ve.disabled,Fe.disabled,it.unblended,Le.disabled,e5(t,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Br(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);let a=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:a}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Br(t)){let i=t.clientWaitSync(this._readbackQueue.sync,0,0);if(i===t.WAIT_FAILED){Tt("WebGL2 clientWaitSync failed."),this._readbackQueue=null,this._lastReadbackFrame=this._updateCount;return}if(i===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Lb._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let i=0;return i+=t[0]/256,i+=t[1]/65536,i+=t[2]/16777216,t[3]<127&&(i=-i),i/128}},_l=8192/128;function i5(e,t){let i=r5(t,"16bit"),r=zr.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),n=qi.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new za(e.createVertexBuffer(r,on.members),e.createIndexBuffer(n),Qe.simpleSegment(0,0,r.length,n.length))}function r5(e,t){let i=e.granularity!==void 0?Math.max(e.granularity,1):1,r=i+(e.generateBorders?2:0),n=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),a=r+1,o=n+1,s=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=i+(e.generateBorders?1:0),h=i+(e.generateBorders||e.extendToSouthPole?1:0),c=a*o,p=r*n*6,d=a*o>65536;if(d&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=d||t==="32bit",y=new Int16Array(c*2),g=0;for(let v=l;v<=h;v++)for(let w=s;w<=u;w++){let P=w/i*8192;w===-1&&(P=-_l),w===i+1&&(P=8192+_l);let S=v/i*8192;v===-1&&(S=e.extendToNorthPole?rn:-_l),v===i+1&&(S=e.extendToSouthPole?Cn:8192+_l),y[g++]=P,y[g++]=S}let _=f?new Uint32Array(p):new Uint16Array(p),b=0;for(let v=0;v<n;v++)for(let w=0;w<r;w++){let P=w+v*a,S=w+1+v*a,C=w+(v+1)*a,E=w+1+(v+1)*a;_[b++]=P,_[b++]=C,_[b++]=S,_[b++]=S,_[b++]=C,_[b++]=E}return{vertices:y.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}var n5="#define GLOBE",a5="globe",u_={errorTransitionTimeSeconds:.5},vc=new Bd({fill:new Rr(128,2),line:new Rr(512,0),tile:new Rr(128,32),stencil:new Rr(128,1),circle:3}),zb=class{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return a5}get shaderDefine(){return n5}get shaderPreludeCode(){return hr.projectionGlobe}get vertexShaderPreludeCode(){return hr.projectionMercator.vertexSource}get subdivisionGranularity(){return vc}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new t5(e));let t=Bn(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5,r=this._errorMeasurement.updateErrorLoop(t,i),n=Me.now();r!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=r,this._errorMeasurementLastChangeTime=n);let a=(n-this._errorMeasurementLastChangeTime)/1e3,o=Math.min(Math.max(a/u_.errorTransitionTimeSeconds,0),1),s=-this._errorMeasurementLastValue;this._errorCorrectionUsable=ma(this._errorCorrectionPreviousValue,s,N0(o))}_getMeshKey(e){return"".concat(e.granularity.toString(36),"_").concat(e.generateBorders?"b":"").concat(e.extendToNorthPole?"n":"").concat(e.extendToSouthPole?"s":"")}getMeshFromTileID(e,t,i,r,n){let a=(n==="stencil"?vc.stencil:vc.tile).getGranularityForZoomLevel(t.z),o=t.y===0&&r,s=t.y===(1<<t.z)-1&&r;return this._getMesh(e,{granularity:a,generateBorders:i,extendToNorthPole:o,extendToSouthPole:s})}_getMesh(e,t){let i=this._getMeshKey(t);if(i in this._tileMeshCache)return this._tileMeshCache[i];let r=i5(e,t);return this._tileMeshCache[i]=r,r}recalculate(e){}hasTransition(){let e=Me.now(),t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<u_.errorTransitionTimeSeconds+.2,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}},o5=new Bt({type:new ee(V.projection.type)}),h_=class extends ei{constructor(e){super(),this._transitionable=new Mu(o5),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new bt(0)),this._mercatorProjection=new Ip,this._verticalPerspectiveProjection=new zb}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof Vn){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,r,n){return this.currentProjection.getMeshFromTileID(e,t,i,r,n)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}},nr=fe(ge(),1);function Rb(e){let t=Nu(e.worldSize,e.center.lat);return 2*Math.PI*t}function s5(e,t,i){let r=Nt(t),n=Nt(i),a=$.dot(r,n),o=Math.acos(a),s=Rb(e);return o/(2*Math.PI)*s}function l5(e,t){let i=ba(e*Math.PI*2+Math.PI,Math.PI*2),r=2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5;return[i,r]}function u5(e,t){let i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}function en(e,t,i,r,n){let a=1/(1<<n),o=e/8192*a+i*a,s=t/8192*a+r*a,l=ba(o*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-Math.PI*.5,h=Math.cos(u),c=new Float64Array(3);return c[0]=Math.sin(l)*h,c[1]=Math.sin(u),c[2]=Math.cos(l)*h,c}function Nt(e){return u5(e.lng*Math.PI/180,e.lat*Math.PI/180)}function Nu(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function c_(e){let t=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){let r=e[0]/i,n=e[2]/i,a=Math.acos(n),o=(r>0?a:-a)/Math.PI*180;return new de(An(o,-180,180),t)}else return new de(0,t)}function h5(e){let t=Pt();t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3];let i=Math.sqrt(1-e[3]*e[3]);return{center:t,radius:i}}function c5(e,t,i){let r=Pt();$.sub(r,i,e);let n=Pt();return $.scaleAndAdd(n,e,r,t/$.len(r)),n}function ru(e){return Math.cos(e*Math.PI/180)}function Rt(e,t){let i=ru(e),r=ru(t);return $t(r/i)}function p5(e,t){return 360/Rb({worldSize:e,center:{lat:t}})}function p_(e,t){let i=e.rotate(t.bearingInRadians),r=t.zoom+Rt(t.center.lat,0),n=ma(1/ru(t.center.lat),1/ru(Math.min(Math.abs(t.center.lat),60)),kl(r,7,3,0,1)),a=p5(t.worldSize,t.center.lat);return new de(t.center.lng-i.x*a*n,Ne(t.center.lat+i.y*a,-fr,fr))}function bc(e){let t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function d_(e,t,i,r){let n=e.lat+i*r;if(Math.abs(i)>1){let a=e.lat+i,o=(Math.sign(a)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+i)*Math.PI/180,l=bc(o+r*(s-o)),u=bc(o),h=bc(s),c=(l-u)/(h-u),p=e.lng+t*c;return new de(p,n)}else{let a=e.lng+t*r;return new de(a,n)}}var d5=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,r){let n="".concat(e.z,"_").concat(e.x,"_").concat(e.y,"_").concat(r!=null&&r.terrain?"t":""),a=this._cache.get(n);if(a)return a;let o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;let s=this._boundingVolumeFactory(e,t,i,r);return this._cache.set(n,s),this._hadAnyChanges=!0,s}},wc=class Ap{constructor(t,i,r,n){this.min=r,this.max=n,this.points=t,this.planes=i}static fromAabb(t,i){let r=[];for(let n=0;n<8;n++)r.push([(n>>0&1)===1?i[0]:t[0],(n>>1&1)===1?i[1]:t[1],(n>>2&1)===1?i[2]:t[2]]);return new Ap(r,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,i,r){let n=ou.fromEuler([],r[0],r[1],r[2]),a=$.transformQuat([],[i[0],0,0],n),o=$.transformQuat([],[0,i[1],0],n),s=$.transformQuat([],[0,0,i[2]],n),l=[...t],u=[...t];for(let c=0;c<8;c++)for(let p=0;p<3;p++){let d=t[p]+a[p]*((c>>0&1)===1?1:-1)+o[p]*((c>>1&1)===1?1:-1)+s[p]*((c>>2&1)===1?1:-1);l[p]=Math.min(l[p],d),u[p]=Math.max(u[p],d)}let h=[];for(let c=0;c<8;c++){let p=[...t];$.add(p,p,$.scale([],a,(c>>0&1)===1?1:-1)),$.add(p,p,$.scale([],o,(c>>1&1)===1?1:-1)),$.add(p,p,$.scale([],s,(c>>2&1)===1?1:-1)),h.push(p)}return new Ap(h,[[...a,-$.dot(a,h[0])],[...o,-$.dot(o,h[0])],[...s,-$.dot(s,h[0])],[-a[0],-a[1],-a[2],-$.dot(a,h[7])],[-o[0],-o[1],-o[2],-$.dot(o,h[7])],[-s[0],-s[1],-s[2],-$.dot(s,h[7])]],l,u)}intersectsFrustum(t){let i=!0,r=this.points.length,n=this.planes.length,a=t.planes.length,o=t.points.length;for(let s=0;s<a;s++){let l=t.planes[s],u=0;for(let h=0;h<r;h++){let c=this.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0;u<r&&(i=!1)}if(i)return 2;for(let s=0;s<n;s++){let l=this.planes[s],u=0;for(let h=0;h<o;h++){let c=t.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let n=0;n<i;n++){let a=this.points[n];t[0]*a[0]+t[1]*a[1]+t[2]*a[2]+t[3]>=0&&r++}return r===i?2:r===0?0:1}};function Vl(e,t,i){let r=e-t;return r<0?-r:Math.max(0,r-i)}function Pc(e,t,i,r,n){let a=e-i,o;return a<0?o=Math.min(-a,1+a-n):a>1?o=Math.min(Math.max(a-n,0),1-a):o=0,Math.max(o,Vl(t,r,n))}var f5=class{constructor(){this._boundingVolumeCache=new d5(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,r){let n=1<<i.z,a=1/n,o=i.x/n,s=i.y/n,l=1,u=.5*l,h=2*l;return h=Math.min(h,Pc(e,t,o,s,a)),h=Math.min(h,Pc(e,t,o+u,-s-a,a)),h=Math.min(h,Pc(e,t,o+u,l+l-s-a,a)),h}getWrap(e,t,i){let r=1<<t.z,n=1/r,a=t.x/r,o=Vl(e.x,a,n),s=Vl(e.x,a-1,n),l=Vl(e.x,a+1,n),u=Math.min(o,s,l);return u===l?1:u===s?-1:0}allowVariableZoom(e,t){return Bu(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,r)}_computeTileBoundingVolume(e,t,i,r){var o,s;let n=0,a=0;if(r!=null&&r.terrain){let l=new Vt(e.z,t,e.z,e.x,e.y),u=r.terrain.getMinMaxElevation(l);n=(o=u.minElevation)!=null?o:Math.min(0,i),a=(s=u.maxElevation)!=null?s:Math.max(0,i)}if(n/=sr,a/=sr,n+=1,a+=1,e.z<=0)return wc.fromAabb([-a,-a,-a],[a,a,a]);if(e.z===1)return wc.fromAabb([e.x===0?-a:0,e.y===0?0:-a,-a],[e.x===0?0:a,e.y===0?a:0,a]);{let l=[en(0,0,e.x,e.y,e.z),en(8192,0,e.x,e.y,e.z),en(8192,8192,e.x,e.y,e.z),en(0,8192,e.x,e.y,e.z)],u=[];for(let B of l)u.push($.scale([],B,a));if(a!==n)for(let B of l)u.push($.scale([],B,n));e.y===0&&u.push([0,1,0]),e.y===(1<<e.z)-1&&u.push([0,-1,0]);let h=[1,1,1],c=[-1,-1,-1];for(let B of u)for(let R=0;R<3;R++)h[R]=Math.min(h[R],B[R]),c[R]=Math.max(c[R],B[R]);let p=en(8192/2,8192/2,e.x,e.y,e.z),d=$.cross([],[0,1,0],p);$.normalize(d,d);let f=$.cross([],p,d);$.normalize(f,f);let y=$.cross([],l[2],l[1]);$.normalize(y,y);let g=$.cross([],l[0],l[3]);$.normalize(g,g),u.push($.scale([],p,a)),e.y>=(1<<e.z)/2&&u.push($.scale([],en(8192/2,0,e.x,e.y,e.z),a)),e.y<(1<<e.z)/2&&u.push($.scale([],en(8192/2,8192,e.x,e.y,e.z),a));let _=f_(p,u),b=f_(f,u),v=[-p[0],-p[1],-p[2],_.max],w=[p[0],p[1],p[2],-_.min],P=[-f[0],-f[1],-f[2],b.max],S=[f[0],f[1],f[2],-b.min],C=[...y,0],E=[...g,0],F=[];return e.y===0?F.push(Pi(E,C,v),Pi(E,C,w)):F.push(Pi(P,C,v),Pi(P,C,w),Pi(P,E,v),Pi(P,E,w)),e.y===(1<<e.z)-1?F.push(Pi(E,C,v),Pi(E,C,w)):F.push(Pi(S,C,v),Pi(S,C,w),Pi(S,E,v),Pi(S,E,w)),new wc(F,[v,w,P,S,C,E],h,c)}}};function f_(e,t){let i=1/0,r=-1/0;for(let n of t){let a=$.dot(e,n);i=Math.min(i,a),r=Math.max(r,a)}return{min:i,max:r}}var Fb=class Bb{constructor(){this._cachedClippingPlane=so(),this._projectionMatrix=na(),this._globeViewProjMatrix32f=O0(),this._globeViewProjMatrixNoCorrection=na(),this._globeViewProjMatrixNoCorrectionInverted=na(),this._globeProjMatrixInverted=na(),this._cameraPosition=Pt(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new qd({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,i)=>this.getConstrained(t,i)}),this._coveringTilesDetailsProvider=new f5}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i){this._helper.resize(t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}clone(){let t=new Bb;return t.apply(this),t}apply(t,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=Pt();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:i,applyGlobeMatrix:r}=t,n=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:r?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let i=this.pitchInRadians,r=this.cameraToCenterDistance/t,n=1,a=Math.sin(i)*r,o=Math.cos(i)*r+n,s=Math.sqrt(a*a+o*o),l=n/s*n,u=-a,h=o,c=Math.sqrt(u*u+h*h);u/=c,h/=c;let p=[0,u,h];$.rotateZ(p,p,[0,0,0],-this.bearingInRadians),$.rotateX(p,p,[0,0,0],-1*this.center.lat*Math.PI/180),$.rotateY(p,p,[0,0,0],this.center.lng*Math.PI/180);let d=1/$.length(p);return $.scale(p,p,d),[...p,-l*d]}isLocationOccluded(t){return!this.isSurfacePointVisible(Nt(t))}transformLightDirection(t){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),a=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],o=[a[2],0,-a[0]],s=[0,0,0];$.cross(s,o,a),$.normalize(o,o),$.normalize(s,s);let l=[o[0]*t[0]+s[0]*t[1]+a[0]*t[2],o[1]*t[0]+s[1]*t[1]+a[1]*t[2],o[2]*t[0]+s[2]*t[1]+a[2]*t[2]],u=[0,0,0];return $.normalize(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,i,r){let n=ZL(t,i,r.canonical),a=l5(n.x,n.y);return this.getCircleRadiusCorrection()/Math.cos(a[1])}projectTileCoordinates(t,i,r,n){let a=r.canonical,o=en(t,i,a.x,a.y,a.z),s=1+(n?n(t,i):0)/sr,l=[o[0]*s,o[1]*s,o[2]*s,1];_t.transformMat4(l,l,this._globeViewProjMatrixNoCorrection);let u=this._cachedClippingPlane,h=u[0]*o[0]+u[1]*o[1]+u[2]*o[2]+u[3]<0;return{point:new nr.default(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=Nu(this.worldSize,this.center.lat),i=nn(),r=nn();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+t*2),q.perspective(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;i[8]=-n.x*2/this._helper._width,i[9]=n.y*2/this._helper._height,this._projectionMatrix=q.clone(i),this._globeProjMatrixInverted=nn(),q.invert(this._globeProjMatrixInverted,i),q.translate(i,i,[0,0,-this.cameraToCenterDistance]),q.rotateZ(i,i,this.rollInRadians),q.rotateX(i,i,-this.pitchInRadians),q.rotateZ(i,i,this.bearingInRadians),q.translate(i,i,[0,0,-t]);let a=Pt();a[0]=t,a[1]=t,a[2]=t,q.rotateX(r,i,this.center.lat*Math.PI/180),q.rotateY(r,r,-this.center.lng*Math.PI/180),q.scale(r,r,a),this._globeViewProjMatrixNoCorrection=r,q.rotateX(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),q.rotateY(i,i,-this.center.lng*Math.PI/180),q.scale(i,i,a),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=nn(),q.invert(this._globeViewProjMatrixNoCorrectionInverted,r);let o=Pt();this._cameraPosition=Pt(),this._cameraPosition[2]=this.cameraToCenterDistance/t,$.rotateZ(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),$.rotateX(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),$.rotateZ(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),$.add(this._cameraPosition,this._cameraPosition,[0,0,1]),$.rotateX(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),$.rotateY(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let s=q.clone(this._globeViewProjMatrixNoCorrectionInverted);q.scale(s,s,[1,1,-1]),this._cachedFrustum=Mb.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){Tt("calculateFogMatrix is not supported on globe projection.");let i=nn();return q.identity(i),i}getVisibleUnwrappedCoordinates(t){return[new Jl(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&Tt("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){if(!this._globeViewProjMatrixNoCorrection)return 1;let r=Nt(t);$.scale(r,r,1+i/sr);let n=so();return _t.transformMat4(n,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(t){}getBounds(){let t=this.width*.5,i=this.height*.5,r=[new nr.default(0,0),new nr.default(t,0),new nr.default(this.width,0),new nr.default(this.width,i),new nr.default(this.width,this.height),new nr.default(t,this.height),new nr.default(0,this.height),new nr.default(0,i)],n=[];for(let c of r)n.push(this.unprojectScreenPoint(c));let a=0,o=0,s=0,l=0,u=this.center;for(let c of n){let p=li(u.lng,c.lng),d=li(u.lat,c.lat);p<o&&(o=p),p>a&&(a=p),d<l&&(l=d),d>s&&(s=d)}let h=[u.lng+o,u.lat+l,u.lng+a,u.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new yr(h)}getConstrained(t,i){let r=Ne(t.lat,-fr,fr),n=Ne(+i,this.minZoom+Rt(0,r),this.maxZoom);return{center:new de(t.lng,r),zoom:n}}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}setLocationAtPoint(t,i){let r=this.unprojectScreenPoint(i),n=Nt(r),a=Nt(t),o=Pt();$.zero(o);let s=Pt();$.rotateY(s,n,o,-this.center.lng*Math.PI/180),$.rotateX(s,s,o,this.center.lat*Math.PI/180);let l=a[0]*a[0]+a[2]*a[2],u=s[0]*s[0];if(l<u)return;let h=Math.sqrt(l-u),c=-h,p=Ws(a[0],a[2],s[0],h),d=Ws(a[0],a[2],s[0],c),f=Pt();$.rotateY(f,a,o,-p);let y=Ws(f[1],f[2],s[1],s[2]),g=Pt();$.rotateY(g,a,o,-d);let _=Ws(g[1],g[2],s[1],s[2]),b=Math.PI*.5,v=y>=-b&&y<=b,w=_>=-b&&_<=b,P,S;if(v&&w){let B=this.center.lng*Math.PI/180,R=this.center.lat*Math.PI/180,D=Hs(p,B),z=Hs(y,R),x=Hs(d,B),T=Hs(_,R);D+z<x+T?(P=p,S=y):(P=d,S=_)}else if(v)P=p,S=y;else if(w)P=d,S=_;else return;let C=P/Math.PI*180,E=S/Math.PI*180,F=this.center.lat;this.setCenter(new de(C,Ne(E,-90,90))),this.setZoom(this.zoom+Rt(F,this.center.lat))}locationToScreenPoint(t,i){let r=Nt(t);if(i){let n=i.getElevationForLngLatZoom(t,this._helper._tileZoom);$.scale(r,r,1+n/sr)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t){let i=so();return _t.transformMat4(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new nr.default((i[0]*.5+.5)*this.width,(-i[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){let r=i.pointCoordinate(t);if(r)return r}return Ke.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,i){var r;return(r=this.screenPointToMercatorCoordinate(t,i))==null?void 0:r.toLngLat()}isPointOnMapSurface(t,i){let r=this._cameraPosition,n=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(r,n)}getRayDirectionFromPixel(t){let i=so();i[0]=t.x/this.width*2-1,i[1]=(t.y/this.height*2-1)*-1,i[2]=1,i[3]=1,_t.transformMat4(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=Pt();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let n=Pt();return $.normalize(n,r),n}isSurfacePointVisible(t){let i=this._cachedClippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let i=so();return _t.transformMat4(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(t,i){let r=$.dot(t,i),n=1,a=Pt(),o=Pt();$.scale(o,i,r),$.sub(a,t,o);let s=n-$.dot(a,a);if(s<0)return null;let l=$.dot(t,t)-n,u=-r+(r<0?1:-1)*Math.sqrt(s),h=l/u,c=u,p=Math.min(h,c),d=Math.max(h,c);return{tMin:p,tMax:d}}unprojectScreenPoint(t){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(t),n=this.rayPlanetIntersection(i,r);if(n){let p=Pt();$.add(p,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);let d=Pt();return $.normalize(d,p),c_(d)}let a=this._cachedClippingPlane,o=a[0]*r[0]+a[1]*r[1]+a[2]*r[2],s=-Bc(a,i)/o,l=2,u=Pt();if(s>0)$.add(u,i,[r[0]*s,r[1]*s,r[2]*s]);else{let p=Pt();$.add(p,i,[r[0]*l,r[1]*l,r[2]*l]);let d=Bc(this._cachedClippingPlane,p);$.sub(u,p,[this._cachedClippingPlane[0]*d,this._cachedClippingPlane[1]*d,this._cachedClippingPlane[2]*d])}let h=h5(a),c=c5(h.center,h.radius,u);return c_(c)}getMatrixForModel(t,i){let r=de.convert(t),n=1/sr,a=na();return q.rotateY(a,a,r.lng/180*Math.PI),q.rotateX(a,a,-r.lat/180*Math.PI),q.translate(a,a,[0,0,1+i/sr]),q.rotateX(a,a,Math.PI*.5),q.scale(a,a,[n,n,n]),a}getProjectionDataForCustomLayer(t=!0){let i=this.getProjectionData({overscaledTileID:new Vt(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}},m_=class Ob{constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new qd({calcMatrices:()=>{this._calcMatrices()},getConstrained:(t,i)=>this.getConstrained(t,i)}),this._globeness=1,this._mercatorTransform=new tu,this._verticalPerspectiveTransform=new Fb}get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,r){return this._helper.interpolatePadding(t,i,r)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,r=!0){this._helper.resize(t,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,i){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}clone(){let t=new Ob;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this),t}apply(t){this._helper.apply(t),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let i=this._mercatorTransform.getProjectionData(t),r=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return ma(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return ma(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,r){let n=this._mercatorTransform.getPitchedTextCorrection(t,i,r),a=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,r);return ma(n,a,this._globeness)}projectTileCoordinates(t,i,r,n){return this.currentTransform.projectTileCoordinates(t,i,r,n)}_calcMatrices(){!this._helper._width||!this._helper._height||(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){return this.currentTransform.lngLatToCameraDepth(t,i)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}getConstrained(t,i){return this.currentTransform.getConstrained(t,i)}calculateCenterFromCameraLngLatAlt(t,i,r,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,r,n)}setLocationAtPoint(t,i){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(t,i),this.apply(this._mercatorTransform);return}this._verticalPerspectiveTransform.setLocationAtPoint(t,i),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}isPointOnMapSurface(t,i){return this.currentTransform.isPointOnMapSurface(t,i)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,i){return this.currentTransform.getMatrixForModel(t,i)}getProjectionDataForCustomLayer(t=!0){let i=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return i;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return r.fallbackMatrix=i.mainMatrix,r}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},Sc=fe(ge(),1),Nb=class kr{get useGlobeControls(){return!0}handlePanInertia(t,i){let r=p_(t,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new Sc.default(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){let r=t.around,n=i.screenPointToLocation(r);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);let a=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);let o=i.zoom-a;if(o===0)return;let s=.3,l=.5,u=45,h=85,c=.25,p=.75,d=.35,f=.9,y=.5,g=.25,_=li(i.center.lng,n.lng),b=_/(Math.abs(_/180)+1),v=li(i.center.lat,n.lat),w=i.getRayDirectionFromPixel(r),P=i.cameraPosition,S=$.dot(P,w)*-1,C=Pt();$.add(C,P,[w[0]*S,w[1]*S,w[2]*S]);let E=$.length(C)-1,F=Math.exp(-Math.max(E-s,0)*l),B=Nu(i.worldSize,i.center.lat)/Math.min(i.width,i.height),R=kl(B,f,y,1,g),D=(1-qt(-o))*Math.min(F,R),z=i.center.lat,x=i.zoom,T=new de(i.center.lng+b*D,Ne(i.center.lat+v*D,-fr,fr));i.setLocationAtPoint(n,r);let I=i.center,U=kl(Math.abs(_),u,h,0,1),X=kl(B,p,d,0,1),Z=Math.pow(Math.max(U,X),c),ie=li(I.lng,T.lng),pe=li(I.lat,T.lat);i.setCenter(new de(I.lng+ie*Z,I.lat+pe*Z).wrap()),i.setZoom(x+Rt(z,i.center.lat))}handleMapControlsPan(t,i,r){if(!t.panDelta)return;let n=i.center.lat,a=i.zoom;i.setCenter(p_(t.panDelta,i).wrap()),i.setZoom(a+Rt(n,i.center.lat))}cameraForBoxAndBearing(t,i,r,n,a){let o=kb(t,i,r,n,a),s=i.left/a.width*2-1,l=(a.width-i.right)/a.width*2-1,u=i.top/a.height*-2+1,h=(a.height-i.bottom)/a.height*-2+1,c=li(r.getWest(),r.getEast())<0,p=c?r.getEast():r.getWest(),d=c?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),y=Math.min(r.getNorth(),r.getSouth()),g=p+li(p,d)*.5,_=f+li(f,y)*.5,b=a.clone();b.setCenter(o.center),b.setBearing(o.bearing),b.setPitch(0),b.setRoll(0),b.setZoom(o.zoom);let v=b.modelViewProjectionMatrix,w=[Nt(r.getNorthWest()),Nt(r.getNorthEast()),Nt(r.getSouthWest()),Nt(r.getSouthEast()),Nt(new de(d,_)),Nt(new de(p,_)),Nt(new de(g,f)),Nt(new de(g,y))],P=Nt(o.center),S=Number.POSITIVE_INFINITY;for(let C of w)s<0&&(S=kr.getLesserNonNegativeNonNull(S,kr.solveVectorScale(C,P,v,"x",s))),l>0&&(S=kr.getLesserNonNegativeNonNull(S,kr.solveVectorScale(C,P,v,"x",l))),u>0&&(S=kr.getLesserNonNegativeNonNull(S,kr.solveVectorScale(C,P,v,"y",u))),h<0&&(S=kr.getLesserNonNegativeNonNull(S,kr.solveVectorScale(C,P,v,"y",h)));if(!Number.isFinite(S)||S===0){Ab();return}return o.zoom=b.zoom+$t(S),o}handleJumpToCenterZoom(t,i){let r=t.center.lat,n=t.getConstrained(i.center?de.convert(i.center):t.center,t.zoom).center;t.setCenter(n.wrap());let a=typeof i.zoom<"u"?+i.zoom:t.zoom+Rt(r,n.lat);t.zoom!==a&&t.setZoom(a)}handleEaseTo(t,i){let r=t.zoom,n=t.center,a=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s=i.roll===void 0?t.roll:i.roll,l=i.pitch===void 0?t.pitch:i.pitch,u=i.bearing===void 0?t.bearing:i.bearing,h={roll:s,pitch:l,bearing:u},c=typeof i.zoom<"u",p=!t.isPaddingEqual(i.padding),d=!1,f=i.center?de.convert(i.center):n,y=t.getConstrained(f,r).center;eu(t,y);let g=t.clone();g.setCenter(y),g.setZoom(c?+i.zoom:r+Rt(n.lat,f.lat)),g.setBearing(i.bearing);let _=new Sc.default(Ne(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),Ne(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));g.setLocationAtPoint(y,_);let b=(i.offset&&i.offsetAsPoint.mag())>0?g.center:y,v=c?+i.zoom:r+Rt(n.lat,b.lat),w=r+Rt(n.lat,0),P=v+Rt(b.lat,0),S=li(n.lng,b.lng),C=li(n.lat,b.lat),E=qt(P-w);return d=v!==r,{easeFunc:F=>{if(U0(o,h)||Eb({startEulerAngles:o,endEulerAngles:h,tr:t,k:F,useSlerp:o.roll!=h.roll}),p&&t.interpolatePadding(a,i.padding,F),i.around)Tt("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{let B=P>w?Math.min(2,E):Math.max(.5,E),R=Math.pow(B,1-F),D=F*R,z=d_(n,S,C,D);t.setCenter(z.wrap())}if(d){let B=ht.number(w,P,F)+Rt(0,t.center.lat);t.setZoom(B)}},isZooming:d,elevationCenter:b}}handleFlyTo(t,i){let r=typeof i.zoom<"u",n=t.center,a=t.zoom,o=t.padding,s=!t.isPaddingEqual(i.padding),l=t.getConstrained(de.convert(i.center||i.locationAtOffset),a).center,u=r?+i.zoom:t.zoom+Rt(t.center.lat,l.lat),h=t.clone();h.setCenter(l),h.setZoom(u),h.setBearing(i.bearing);let c=new Sc.default(Ne(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),Ne(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(l,c);let p=h.center;eu(t,p);let d=s5(t,n,p),f=a+Rt(n.lat,0),y=u+Rt(p.lat,0),g=qt(y-f),_=typeof i.minZoom=="number",b;if(_){let P=+i.minZoom+Rt(p.lat,0),S=Math.min(P,f,y)+Rt(0,p.lat),C=t.getConstrained(p,S).zoom+Rt(p.lat,0);b=qt(C-f)}let v=li(n.lng,p.lng),w=li(n.lat,p.lat);return{easeFunc:(P,S,C,E)=>{let F=d_(n,v,w,C);s&&t.interpolatePadding(o,i.padding,P);let B=P===1?p:F;t.setCenter(B.wrap());let R=f+$t(S);t.setZoom(P===1?u:R+Rt(0,B.lat))},scaleOfZoom:g,targetCenter:p,scaleOfMinZoom:b,pixelPathLength:d}}static solveVectorScale(t,i,r,n,a){let o=a,s=n==="x"?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],l=[r[3],r[7],r[11],r[15]],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],h=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],c=i[0]*s[0]+i[1]*s[1]+i[2]*s[2],p=i[0]*l[0]+i[1]*l[1]+i[2]*l[2],d=(c+s[3]-o*p-o*l[3])/(c-u-o*p+o*h);return c+o*h===u+o*p||l[3]*(u-c)+s[3]*(p-h)+u*p===c*h?null:d}static getLesserNonNegativeNonNull(t,i){return i!==null&&i>=0&&i<t?i:t}},y_=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new iu,this._verticalPerspectiveCameraHelper=new Nb}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,r,n){return this.currentHelper.cameraForBoxAndBearing(e,t,i,r,n)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};function m5(e){if(Array.isArray(e)){let t=new h_({type:e});return{projection:t,transform:new m_,cameraHelper:new y_(t)}}switch(e){case"mercator":return{projection:new Ip,transform:new tu,cameraHelper:new iu};case"globe":{let t=new h_({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:t,transform:new m_,cameraHelper:new y_(t)}}case"vertical-perspective":return{projection:new zb,transform:new Fb,cameraHelper:new Nb};default:return Tt("Unknown projection name: ".concat(e,". Falling back to mercator projection.")),{projection:new Ip,transform:new tu,cameraHelper:new iu}}}var xl=(e,t)=>Su(e,t&&t.filter(i=>i.identifier!=="source.canvas")),y5=PE(),g_=class extends ei{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let i in this.sourceCaches){let r=this.sourceCaches[i].getSource().type;(r==="vector"||r==="geojson")&&this.sourceCaches[i].reload()}},this.map=e,this.dispatcher=new tb(eb(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(i,r)=>this.getGlyphs(i,r)),this.dispatcher.registerMessageHandler("GI",(i,r)=>this.getImages(i,r)),this.imageManager=new ZD,this.imageManager.setEventedParent(this),this.glyphManager=new HD(e._requestManager,t.localIdeographFontFamily),this.lineAtlas=new tL(256,512),this.crossTileSymbolIndex=new vb,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new ep,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",Up()),bp().on(vp,this._rtlPluginLoaded),this.on("data",i=>{if(i.dataType!=="source"||i.sourceDataType!=="metadata")return;let r=this.sourceCaches[i.sourceId];if(!r)return;let n=r.getSource();if(!(!n||!n.vectorLayerIds))for(let a in this._layers){let o=this._layers[a];o.source===n.id&&this._validateLayer(o)}})}setGlobalStateProperty(e,t){var n,a,o;this._checkLoaded();let i=t===null?(o=(a=(n=this.stylesheet.state)==null?void 0:n[e])==null?void 0:a.default)!=null?o:null:t;if(ar(i,this._globalState[e]))return this;this._globalState[e]=i;let r=this._findGlobalStateAffectedSources([e]);for(let s in this.sourceCaches)r.has(s)&&(this._reloadSource(s),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let r in e)!ar(this._globalState[r],e[r].default)&&(t.push(r),this._globalState[r]=e[r].default);let i=this._findGlobalStateAffectedSources(t);for(let r in this.sourceCaches)i.has(r)&&(this._reloadSource(r),this._changed=!0)}_findGlobalStateAffectedSources(e){if(e.length===0)return new Set;let t=new Set;for(let i in this._layers){let r=this._layers[i],n=r.getLayoutAffectingGlobalStateRefs();for(let a of e)n.has(a)&&t.add(r.source)}return t}loadURL(e,t={},i){this.fire(new H("dataloading",{dataType:"style"})),t.validate=typeof t.validate=="boolean"?t.validate:!0;let r=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;hu(r,this._loadStyleRequest).then(a=>{this._loadStyleRequest=null,this._load(a.data,t,i)}).catch(a=>{this._loadStyleRequest=null,a&&!n.signal.aborted&&this.fire(new he(a))})}loadJSON(e,t={},i){this.fire(new H("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Me.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,i)}).catch(()=>{})}loadEmpty(){this.fire(new H("dataloading",{dataType:"style"})),this._load(y5,{validate:!1})}_load(e,t,i){var n,a,o;let r=t.transformStyle?t.transformStyle(i,e):e;if(!(t.validate&&xl(this,St(r)))){this._loaded=!0,this.stylesheet=r;for(let s in r.sources)this.addSource(s,r.sources[s],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this._createLayers(),this.light=new JD(this.stylesheet.light),this._setProjectionInternal(((n=this.stylesheet.projection)==null?void 0:n.type)||"mercator"),this.sky=new eL(this.stylesheet.sky),this.map.setTerrain((a=this.stylesheet.terrain)!=null?a:null),this.setGlobalState((o=this.stylesheet.state)!=null?o:null),this.fire(new H("data",{dataType:"style"})),this.fire(new H("style.load"))}}_createLayers(){let e=Dy(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(t=>t.id),this._layers={},this._serializedLayers=null;for(let t of e){let i=pc(t);i.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=i}}_loadSprite(e,t=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let r;qD(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(n=>{if(this._spriteRequest=null,n)for(let a in n){this._spritesImagesIds[a]=[];let o=this._spritesImagesIds[a]?this._spritesImagesIds[a].filter(s=>!(s in n)):[];for(let s of o)this.imageManager.removeImage(s),this._changedImages[s]=!0;for(let s in n[a]){let l=a==="default"?s:"".concat(a,":").concat(s);this._spritesImagesIds[a].push(l),l in this.imageManager.images?this.imageManager.updateImage(l,n[a][s],!1):this.imageManager.addImage(l,n[a][s]),t&&(this._changedImages[l]=!0)}}}).catch(n=>{this._spriteRequest=null,r=n,this.fire(new he(r))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new H("data",{dataType:"style"})),i&&i(r)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new H("data",{dataType:"style"}))}_validateLayer(e){let t=this.sourceCaches[e.source];if(!t)return;let i=e.sourceLayer;if(!i)return;let r=t.getSource();(r.type==="geojson"||r.vectorLayerIds&&r.vectorLayerIds.indexOf(i)===-1)&&this.fire(new he(new Error('Source layer "'.concat(i,'" does not exist on source "').concat(r.id,'" as specified by style layer "').concat(e.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let i=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?Qt(i):i);let r=[];for(let n of e)if(i[n]){let a=t?Qt(i[n]):i[n];r.push(a)}return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let i of t){let r=this._layers[i];r.type!=="custom"&&(e[i]=r.serialize())}return e}hasTransitions(){var e,t,i;if((e=this.light)!=null&&e.hasTransition()||(t=this.sky)!=null&&t.hasTransition()||(i=this.projection)!=null&&i.hasTransition())return!0;for(let r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(let r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){let r=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(r.length||n.length)&&this._updateWorkerLayers(r,n);for(let a in this._updatedSources){let o=this._updatedSources[a];if(o==="reload")this._reloadSource(a);else if(o==="clear")this._clearSource(a);else throw new Error("Invalid action ".concat(o))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let a in this._updatedPaintProps)this._layers[a].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let i={};for(let r in this.sourceCaches){let n=this.sourceCaches[r];i[r]=n.used,n.used=!1}for(let r of this._order){let n=this._layers[r];n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)&&n.source&&(this.sourceCaches[n.source].used=!0)}for(let r in i){let n=this.sourceCaches[r];!!i[r]!=!!n.used&&n.fire(new H("data",{sourceDataType:"visibility",dataType:"source",sourceId:r}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new H("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){var a;this._checkLoaded();let i=this.serialize();if(e=t.transformStyle?t.transformStyle(i,e):e,((a=t.validate)!=null?a:!0)&&xl(this,St(e)))return!1;e=Qt(e),e.layers=Dy(e.layers);let r=UI(i,e),n=this._getOperationsToPerform(r);if(n.unimplemented.length>0)throw new Error("Unimplemented: ".concat(n.unimplemented.join(", "),"."));if(n.operations.length===0)return!1;for(let o of n.operations)o();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){let t=[],i=[];for(let r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,r.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,r.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,r.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,r.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,r.args));break;case"addSource":t.push(()=>this.addSource.apply(this,r.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,r.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,r.args));break;case"setLight":t.push(()=>this.setLight.apply(this,r.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,r.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,r.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,r.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,r.args));break;case"setSky":t.push(()=>this.setSky.apply(this,r.args));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,r.args));break;case"setTransition":t.push(()=>{});break;default:i.push(r.command);break}return{operations:t,unimplemented:i}}addImage(e,t){if(this.getImage(e))return this.fire(new he(new Error('An image named "'.concat(e,'" already exists.'))));this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new he(new Error('An image named "'.concat(e,'" does not exist.'))));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new H("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,i={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error('Source "'.concat(e,'" already exists.'));if(!t.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(t).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(t.type)>=0&&this._validate(St.source,"sources.".concat(e),t,null,i))return;this.map&&this.map._collectResourceTiming&&(t.collectResourceTiming=!0);let r=this.sourceCaches[e]=new ts(e,t,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new he(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(i,'" is using it.'))));let t=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],t.fire(new H("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID=".concat(e));let i=this.sourceCaches[e].getSource();if(i.type!=="geojson")throw new Error("geojsonSource.type is ".concat(i.type,", which is !== 'geojson"));i.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,t,i={}){this._checkLoaded();let r=e.id;if(this.getLayer(r)){this.fire(new he(new Error('Layer "'.concat(r,'" already exists on this map.'))));return}let n;if(e.type==="custom"){if(xl(this,UD(e)))return;n=pc(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(r,e.source),e=Qt(e),e=re(e,{source:r})),this._validate(St.layer,"layers.".concat(r),e,{arrayIndex:-1},i))return;n=pc(e),this._validateLayer(n),n.setEventedParent(this,{layer:{id:r}})}let a=t?this._order.indexOf(t):this._order.length;if(t&&a===-1){this.fire(new he(new Error('Cannot add layer "'.concat(r,'" before non-existing layer "').concat(t,'".'))));return}if(this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=n,this._removedLayers[r]&&n.source&&n.type!=="custom"){let o=this._removedLayers[r];delete this._removedLayers[r],o.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.sourceCaches[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new he(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));return}if(e===t)return;let i=this._order.indexOf(e);this._order.splice(i,1);let r=t?this._order.indexOf(t):this._order.length;if(t&&r===-1){this.fire(new he(new Error('Cannot move layer "'.concat(e,'" before non-existing layer "').concat(t,'".'))));return}this._order.splice(r,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new he(new Error('Cannot remove non-existing layer "'.concat(e,'".'))));return}t.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,i){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new he(new Error('Cannot set the zoom range of non-existing layer "'.concat(e,'".'))));return}r.minzoom===t&&r.maxzoom===i||(t!=null&&(r.minzoom=t),i!=null&&(r.maxzoom=i),this._updateLayer(r))}setFilter(e,t,i={}){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new he(new Error('Cannot filter non-existing layer "'.concat(e,'".'))));return}if(!ar(r.filter,t)){if(t==null){r.setFilter(void 0),this._updateLayer(r);return}this._validate(St.filter,"layers.".concat(r.id,".filter"),t,null,i)||(r.setFilter(Qt(t)),this._updateLayer(r))}}getFilter(e){return Qt(this.getLayer(e).filter)}setLayoutProperty(e,t,i,r={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new he(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}ar(n.getLayoutProperty(t),i)||(n.setLayoutProperty(t,i,r),this._updateLayer(n))}getLayoutProperty(e,t){let i=this.getLayer(e);if(!i){this.fire(new he(new Error('Cannot get style of non-existing layer "'.concat(e,'".'))));return}return i.getLayoutProperty(t)}setPaintProperty(e,t,i,r={}){this._checkLoaded();let n=this.getLayer(e);if(!n){this.fire(new he(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}ar(n.getPaintProperty(t),i)||(n.setPaintProperty(t,i,r)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null)}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(n===void 0){this.fire(new he(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let a=n.getSource().type;if(a==="geojson"&&r){this.fire(new he(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(a==="vector"&&!r){this.fire(new he(new Error("The sourceLayer parameter must be provided for vector source types.")));return}e.id===void 0&&this.fire(new he(new Error("The feature id parameter must be provided."))),n.setFeatureState(r,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let i=e.source,r=this.sourceCaches[i];if(r===void 0){this.fire(new he(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let n=r.getSource().type,a=n==="vector"?e.sourceLayer:void 0;if(n==="vector"&&!a){this.fire(new he(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(t&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new he(new Error("A feature id is required to remove its specific state property.")));return}r.removeFeatureState(a,e.id,t)}getFeatureState(e){this._checkLoaded();let t=e.source,i=e.sourceLayer,r=this.sourceCaches[t];if(r===void 0){this.fire(new he(new Error("The source '".concat(t,"' does not exist in the map's style."))));return}if(r.getSource().type==="vector"&&!i){this.fire(new he(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new he(new Error("The feature id parameter must be provided."))),r.getFeatureState(i,e.id)}getTransition(){return re({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=Vp(this.sourceCaches,n=>n.serialize()),t=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,r=this.stylesheet;return j0({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,projection:r.projection,sources:e,layers:t,terrain:i},n=>n!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=a=>this._layers[a].type==="fill-extrusion",i={},r=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o)){i[o]=a;for(let s of e){let l=s[o];if(l)for(let u of l)r.push(u)}}}r.sort((a,o)=>o.intersectionZ-a.intersectionZ);let n=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let s=r.length-1;s>=0;s--){let l=r[s].feature;if(i[l.layer.id]<a)break;n.push(l),r.pop()}else for(let s of e){let l=s[o];if(l)for(let u of l)n.push(u.feature)}}return n}queryRenderedFeatures(e,t,i){t&&t.filter&&this._validate(St.filter,"queryRenderedFeatures.filter",t.filter,null,t);let r={};if(t&&t.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new he(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let l of t.layers){let u=this._layers[l];if(!u)return this.fire(new he(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];r[u.source]=!0}}let n=[];t.availableImages=this._availableImages;let a=this._serializedAllLayers(),o=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,s=bi(zt({},t),{layers:o});for(let l in this.sourceCaches)t.layers&&!r[l]||n.push(dL(this.sourceCaches[l],this._layers,a,e,s,i,this.map.terrain?(u,h,c)=>this.map.terrain.getElevation(u,h,c):void 0));return this.placement&&n.push(fL(this._layers,a,this.sourceCaches,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(e,t){t&&t.filter&&this._validate(St.filter,"querySourceFeatures.filter",t.filter,null,t);let i=this.sourceCaches[e];return i?mL(i,t):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let i=this.light.getLight(),r=!1;for(let a in e)if(!ar(e[a],i[a])){r=!0;break}if(!r)return;let n={now:Me.now(),transition:re({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(n)}getProjection(){var e;return(e=this.stylesheet)==null?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)==null?void 0:e.sky}setSky(e,t={}){this._checkLoaded();let i=this.getSky(),r=!1;if(!e&&!i)return;if(e&&!i)r=!0;else if(!e&&i)r=!0;else for(let a in e)if(!ar(e[a],i[a])){r=!0;break}if(!r)return;let n={now:Me.now(),transition:re({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(n)}_setProjectionInternal(e){let t=m5(e);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let i in this.sourceCaches)this.sourceCaches[i].reload()}_validate(e,t,i,r,n={}){return n&&n.validate===!1?!1:xl(this,e.call(St,re({key:t,style:this.serialize(),value:i,styleSpec:V},r)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),bp().off(vp,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.sourceCaches){let i=this.sourceCaches[t];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,i,r,n=!1){let a=!1,o=!1,s={};for(let l of this._order){let u=this._layers[l];if(u.type!=="symbol")continue;if(!s[u.source]){let c=this.sourceCaches[u.source];s[u.source]=c.getRenderableIds(!0).map(p=>c.getTileByID(p)).sort((p,d)=>d.tileID.overscaledZ-p.tileID.overscaledZ||(p.tileID.isLessThan(d.tileID)?-1:1))}let h=this.crossTileSymbolIndex.addLayer(u,s[u.source],e.center.lng);a=a||h}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n=n||this._layerOrderChanged||i===0,(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Me.now(),e.zoom))&&(this.pauseablePlacement=new Pz(e,this.map.terrain,this._order,n,t,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Me.now()),o=!0),a&&this.pauseablePlacement.placement.setStale()),o||a)for(let l of this._order){let u=this._layers[l];u.type==="symbol"&&this.placement.updateLayerOpacities(u,s[u.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Me.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}async getImages(e,t){let i=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let r=this.sourceCaches[t.source];return r&&r.setDependencies(t.tileID.key,t.type,t.icons),i}async getGlyphs(e,t){let i=await this.glyphManager.getGlyphs(t.stacks),r=this.sourceCaches[t.source];return r&&r.setDependencies(t.tileID.key,t.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),!(e&&this._validate(St.glyphs,"glyphs",e,null,t))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,t,i={},r){this._checkLoaded();let n=[{id:e,url:t}],a=[...Ol(this.stylesheet.sprite),...n];this._validate(St.sprite,"sprite",a,null,i)||(this.stylesheet.sprite=a,this._loadSprite(n,!0,r))}removeSprite(e){this._checkLoaded();let t=Ol(this.stylesheet.sprite);if(!t.find(i=>i.id===e)){this.fire(new he(new Error('Sprite "'.concat(e,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[e])for(let i of this._spritesImagesIds[e])this.imageManager.removeImage(i),this._changedImages[i]=!0;t.splice(t.findIndex(i=>i.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new H("data",{dataType:"style"}))}getSprite(){return Ol(this.stylesheet.sprite)}setSprite(e,t={},i){this._checkLoaded(),!(e&&this._validate(St.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}},g5=yt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),_5=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,n,a,o,s,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==r.length;for(let h=0;!u&&h<r.length;h++)this.boundPaintVertexBuffers[h]!==r[h]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,n,a,o,s,l):(e.bindVertexArray.set(this.vao),o&&o.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(e,t,i,r,n,a,o,s){let l=e.numAttributes,u=this.context,h=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s,t.enableAttributes(h,e);for(let c of i)c.enableAttributes(h,e);a&&a.enableAttributes(h,e),o&&o.enableAttributes(h,e),s&&s.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,n);for(let c of i)c.bind(),c.setVertexAttribPointers(h,e,n);a&&(a.bind(),a.setVertexAttribPointers(h,e,n)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(h,e,n)),s&&(s.bind(),s.setVertexAttribPointers(h,e,n)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}},x5=(e,t)=>({u_depth:new me(e,t.u_depth),u_terrain:new me(e,t.u_terrain),u_terrain_dim:new K(e,t.u_terrain_dim),u_terrain_matrix:new pi(e,t.u_terrain_matrix),u_terrain_unpack:new hn(e,t.u_terrain_unpack),u_terrain_exaggeration:new K(e,t.u_terrain_exaggeration)}),v5=(e,t)=>({u_texture:new me(e,t.u_texture),u_ele_delta:new K(e,t.u_ele_delta),u_fog_matrix:new pi(e,t.u_fog_matrix),u_fog_color:new cn(e,t.u_fog_color),u_fog_ground_blend:new K(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new K(e,t.u_fog_ground_blend_opacity),u_horizon_color:new cn(e,t.u_horizon_color),u_horizon_fog_blend:new K(e,t.u_horizon_fog_blend),u_is_globe_mode:new K(e,t.u_is_globe_mode)}),b5=(e,t)=>({u_ele_delta:new K(e,t.u_ele_delta)}),w5=(e,t)=>({u_texture:new me(e,t.u_texture),u_terrain_coords_id:new K(e,t.u_terrain_coords_id),u_ele_delta:new K(e,t.u_ele_delta)}),P5=(e,t,i,r,n)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:i?i.properties.get("fog-color"):oe.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:n?0:i?i.calculateFogBlendOpacity(r):0,u_horizon_color:i?i.properties.get("horizon-color"):oe.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:n?1:0}),S5=e=>({u_ele_delta:e}),T5=(e,t)=>({u_terrain_coords_id:e/255,u_texture:0,u_ele_delta:t}),M5=(e,t)=>({u_projection_matrix:new pi(e,t.u_projection_matrix),u_projection_tile_mercator_coords:new hn(e,t.u_projection_tile_mercator_coords),u_projection_clipping_plane:new hn(e,t.u_projection_clipping_plane),u_projection_transition:new K(e,t.u_projection_transition),u_projection_fallback_matrix:new pi(e,t.u_projection_fallback_matrix)}),C5={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function vl(e){let t=[];for(let i=0;i<e.length;i++){if(e[i]===null)continue;let r=e[i].split(" ");t.push(r.pop())}return t}var I5=class{constructor(e,t,i,r,n,a,o,s,l=[]){let u=e.gl;this.program=u.createProgram();let h=vl(t.staticAttributes),c=i?i.getBinderAttributes():[],p=h.concat(c),d=hr.prelude.staticUniforms?vl(hr.prelude.staticUniforms):[],f=o.staticUniforms?vl(o.staticUniforms):[],y=t.staticUniforms?vl(t.staticUniforms):[],g=i?i.getBinderUniforms():[],_=d.concat(f).concat(y).concat(g),b=[];for(let F of _)b.indexOf(F)<0&&b.push(F);let v=i?i.defines():[];Br(u)&&v.unshift("#version 300 es"),n&&v.push("#define OVERDRAW_INSPECTOR;"),a&&v.push("#define TERRAIN3D;"),s&&v.push(s),l&&v.push(...l);let w=v.concat(hr.prelude.fragmentSource,o.fragmentSource,t.fragmentSource).join("\n"),P=v.concat(hr.prelude.vertexSource,o.vertexSource,t.vertexSource).join("\n");Br(u)||(w=XR(w),P=GR(P));let S=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(S,w),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(u.getShaderInfoLog(S)));u.attachShader(this.program,S);let C=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(C,P),u.compileShader(C),!u.getShaderParameter(C,u.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(u.getShaderInfoLog(C)));u.attachShader(this.program,C),this.attributes={};let E={};this.numAttributes=p.length;for(let F=0;F<this.numAttributes;F++)p[F]&&(u.bindAttribLocation(this.program,F,p[F]),this.attributes[p[F]]=F);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error("Program failed to link: ".concat(u.getProgramInfoLog(this.program)));u.deleteShader(C),u.deleteShader(S);for(let F=0;F<b.length;F++){let B=b[F];if(B&&!E[B]){let R=u.getUniformLocation(this.program,B);R&&(E[B]=R)}}this.fixedUniforms=r(e,E),this.terrainUniforms=x5(e,E),this.projectionUniforms=M5(e,E),this.binderUniforms=i?i.getUniforms(e,E):[]}draw(e,t,i,r,n,a,o,s,l,u,h,c,p,d,f,y,g,_,b){let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(n),e.setCullFace(a),s){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(let P in this.terrainUniforms)this.terrainUniforms[P].set(s[P])}if(l)for(let P in l){let S=C5[P];this.projectionUniforms[S].set(l[P])}if(o)for(let P in this.fixedUniforms)this.fixedUniforms[P].set(o[P]);y&&y.setUniforms(e,this.binderUniforms,d,{zoom:f});let w=0;switch(t){case v.LINES:w=2;break;case v.TRIANGLES:w=3;break;case v.LINE_STRIP:w=1;break}for(let P of p.get()){let S=P.vaos||(P.vaos={});(S[u]||(S[u]=new _5)).bind(e,this,h,y?y.getPaintVertexBuffers():[],c,P.vertexOffset,g,_,b),v.drawElements(t,P.primitiveLength*w,v.UNSIGNED_SHORT,P.primitiveOffset*w*2)}}};function Vb(e,t,i){let r=1/ci(i,1,t.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,t.transform.tileZoom)/n,o=a*(i.tileID.canonical.x+i.tileID.wrap*n),s=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[o&65535,s&65535]}}function A5(e,t,i,r){let n=i.imageManager.getPattern(e.from.toString()),a=i.imageManager.getPattern(e.to.toString()),{width:o,height:s}=i.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=u*(r.tileID.canonical.x+r.tileID.wrap*l),c=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/ci(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[h&65535,c&65535]}}var E5=(e,t)=>({u_lightpos:new hi(e,t.u_lightpos),u_lightpos_globe:new hi(e,t.u_lightpos_globe),u_lightintensity:new K(e,t.u_lightintensity),u_lightcolor:new hi(e,t.u_lightcolor),u_vertical_gradient:new K(e,t.u_vertical_gradient),u_opacity:new K(e,t.u_opacity),u_fill_translate:new ce(e,t.u_fill_translate)}),k5=(e,t)=>({u_lightpos:new hi(e,t.u_lightpos),u_lightpos_globe:new hi(e,t.u_lightpos_globe),u_lightintensity:new K(e,t.u_lightintensity),u_lightcolor:new hi(e,t.u_lightcolor),u_vertical_gradient:new K(e,t.u_vertical_gradient),u_height_factor:new K(e,t.u_height_factor),u_opacity:new K(e,t.u_opacity),u_fill_translate:new ce(e,t.u_fill_translate),u_image:new me(e,t.u_image),u_texsize:new ce(e,t.u_texsize),u_pixel_coord_upper:new ce(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ce(e,t.u_pixel_coord_lower),u_scale:new hi(e,t.u_scale),u_fade:new K(e,t.u_fade)}),jb=(e,t,i,r)=>{let n=e.style.light,a=n.properties.get("position"),o=[a.x,a.y,a.z],s=Oo.create();n.properties.get("anchor")==="viewport"&&Oo.fromRotation(s,e.transform.bearingInRadians),$.transformMat3(o,o,s);let l=e.transform.transformLightDirection(o),u=n.properties.get("color");return{u_lightpos:o,u_lightpos_globe:l,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+t,u_opacity:i,u_fill_translate:r}},D5=(e,t,i,r,n,a,o)=>re(jb(e,t,i,r),Vb(a,e,o),{u_height_factor:-Math.pow(2,n.overscaledZ)/o.tileSize/8}),L5=(e,t)=>({u_fill_translate:new ce(e,t.u_fill_translate)}),z5=(e,t)=>({u_image:new me(e,t.u_image),u_texsize:new ce(e,t.u_texsize),u_pixel_coord_upper:new ce(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ce(e,t.u_pixel_coord_lower),u_scale:new hi(e,t.u_scale),u_fade:new K(e,t.u_fade),u_fill_translate:new ce(e,t.u_fill_translate)}),R5=(e,t)=>({u_world:new ce(e,t.u_world),u_fill_translate:new ce(e,t.u_fill_translate)}),F5=(e,t)=>({u_world:new ce(e,t.u_world),u_image:new me(e,t.u_image),u_texsize:new ce(e,t.u_texsize),u_pixel_coord_upper:new ce(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ce(e,t.u_pixel_coord_lower),u_scale:new hi(e,t.u_scale),u_fade:new K(e,t.u_fade),u_fill_translate:new ce(e,t.u_fill_translate)}),Ub=(e,t,i,r)=>re(Vb(t,e,i),{u_fill_translate:r}),B5=e=>({u_fill_translate:e}),O5=(e,t)=>({u_world:e,u_fill_translate:t}),N5=(e,t,i,r,n)=>re(Ub(e,t,i,n),{u_world:r}),V5=(e,t)=>({u_camera_to_center_distance:new K(e,t.u_camera_to_center_distance),u_scale_with_map:new me(e,t.u_scale_with_map),u_pitch_with_map:new me(e,t.u_pitch_with_map),u_extrude_scale:new ce(e,t.u_extrude_scale),u_device_pixel_ratio:new K(e,t.u_device_pixel_ratio),u_globe_extrude_scale:new K(e,t.u_globe_extrude_scale),u_translate:new ce(e,t.u_translate)}),j5=(e,t,i,r,n)=>{let a=e.transform,o,s,l=0;if(i.paint.get("circle-pitch-alignment")==="map"){let u=ci(t,1,a.zoom);o=!0,s=[u,u],l=u/(8192*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n}else o=!1,s=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+o,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:s,u_globe_extrude_scale:l,u_translate:r}},U5=(e,t)=>({u_pixel_extrude_scale:new ce(e,t.u_pixel_extrude_scale)}),G5=(e,t)=>({u_viewport_size:new ce(e,t.u_viewport_size)}),X5=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),q5=e=>({u_viewport_size:[e.width,e.height]}),$5=(e,t)=>({u_color:new cn(e,t.u_color),u_overlay:new me(e,t.u_overlay),u_overlay_scale:new K(e,t.u_overlay_scale)}),__=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Z5=(e,t)=>({u_extrude_scale:new K(e,t.u_extrude_scale),u_intensity:new K(e,t.u_intensity),u_globe_extrude_scale:new K(e,t.u_globe_extrude_scale)}),Y5=(e,t)=>({u_matrix:new pi(e,t.u_matrix),u_world:new ce(e,t.u_world),u_image:new me(e,t.u_image),u_color_ramp:new me(e,t.u_color_ramp),u_opacity:new K(e,t.u_opacity)}),Gb=(e,t,i,r)=>{let n=ci(e,1,t)/(8192*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*r;return{u_extrude_scale:ci(e,1,t),u_intensity:i,u_globe_extrude_scale:n}},Xb=(e,t,i,r)=>{let n=q.create();q.ortho(n,0,e.width,e.height,0,0,1);let a=e.context.gl;return{u_matrix:n,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:i,u_color_ramp:r,u_opacity:t.paint.get("heatmap-opacity")}},W5=(e,t)=>({u_image:new me(e,t.u_image),u_latrange:new ce(e,t.u_latrange),u_exaggeration:new K(e,t.u_exaggeration),u_altitudes:new lg(e,t.u_altitudes),u_azimuths:new lg(e,t.u_azimuths),u_accent:new cn(e,t.u_accent),u_method:new me(e,t.u_method),u_shadows:new sg(e,t.u_shadows),u_highlights:new sg(e,t.u_highlights)}),H5=(e,t)=>({u_matrix:new pi(e,t.u_matrix),u_image:new me(e,t.u_image),u_dimension:new ce(e,t.u_dimension),u_zoom:new K(e,t.u_zoom),u_unpack:new hn(e,t.u_unpack)}),K5=(e,t,i)=>{let r=i.paint.get("hillshade-accent-color"),n;switch(i.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0;break}let a=i.getIlluminationProperties();for(let o=0;o<a.directionRadians.length;o++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(a.directionRadians[o]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:Q5(e,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:r,u_method:n,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},J5=(e,t)=>{let i=t.stride,r=q.create();return q.ortho(r,0,8192,-8192,0,0,1),q.translate(r,r,[0,-8192,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function Q5(e,t){let i=Math.pow(2,t.canonical.z),r=t.canonical.y;return[new Ke(0,r/i).toLngLat().lat,new Ke(0,(r+1)/i).toLngLat().lat]}var eF=(e,t)=>({u_image:new me(e,t.u_image),u_unpack:new hn(e,t.u_unpack),u_dimension:new ce(e,t.u_dimension),u_elevation_stops:new me(e,t.u_elevation_stops),u_color_stops:new me(e,t.u_color_stops),u_opacity:new K(e,t.u_opacity)}),tF=(e,t)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:e.paint.get("color-relief-opacity")}),iF=(e,t)=>({u_translation:new ce(e,t.u_translation),u_ratio:new K(e,t.u_ratio),u_device_pixel_ratio:new K(e,t.u_device_pixel_ratio),u_units_to_pixels:new ce(e,t.u_units_to_pixels)}),rF=(e,t)=>({u_translation:new ce(e,t.u_translation),u_ratio:new K(e,t.u_ratio),u_device_pixel_ratio:new K(e,t.u_device_pixel_ratio),u_units_to_pixels:new ce(e,t.u_units_to_pixels),u_image:new me(e,t.u_image),u_image_height:new K(e,t.u_image_height)}),nF=(e,t)=>({u_translation:new ce(e,t.u_translation),u_texsize:new ce(e,t.u_texsize),u_ratio:new K(e,t.u_ratio),u_device_pixel_ratio:new K(e,t.u_device_pixel_ratio),u_image:new me(e,t.u_image),u_units_to_pixels:new ce(e,t.u_units_to_pixels),u_scale:new hi(e,t.u_scale),u_fade:new K(e,t.u_fade)}),aF=(e,t)=>({u_translation:new ce(e,t.u_translation),u_ratio:new K(e,t.u_ratio),u_device_pixel_ratio:new K(e,t.u_device_pixel_ratio),u_units_to_pixels:new ce(e,t.u_units_to_pixels),u_patternscale_a:new ce(e,t.u_patternscale_a),u_patternscale_b:new ce(e,t.u_patternscale_b),u_sdfgamma:new K(e,t.u_sdfgamma),u_image:new me(e,t.u_image),u_tex_y_a:new K(e,t.u_tex_y_a),u_tex_y_b:new K(e,t.u_tex_y_b),u_mix:new K(e,t.u_mix)}),$d=(e,t,i,r)=>{let n=e.transform;return{u_translation:$b(e,t,i),u_ratio:r/ci(t,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},oF=(e,t,i,r,n)=>re($d(e,t,i,r),{u_image:0,u_image_height:n}),sF=(e,t,i,r,n)=>{let a=e.transform,o=qb(t,a);return{u_translation:$b(e,t,i),u_texsize:t.imageAtlasTexture.size,u_ratio:r/ci(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},lF=(e,t,i,r,n,a)=>{let o=e.transform,s=e.lineAtlas,l=qb(t,o),u=i.layout.get("line-cap")==="round",h=s.getDash(n.from,u),c=s.getDash(n.to,u),p=h.width*a.fromScale,d=c.width*a.toScale;return re($d(e,t,i,r),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-c.height/2],u_sdfgamma:s.width/(Math.min(p,d)*256*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:c.y,u_mix:a.t})};function qb(e,t){return 1/ci(e,1,t.tileZoom)}function $b(e,t,i){return ln(e.transform,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}var uF=(e,t)=>({u_tl_parent:new ce(e,t.u_tl_parent),u_scale_parent:new K(e,t.u_scale_parent),u_buffer_scale:new K(e,t.u_buffer_scale),u_fade_t:new K(e,t.u_fade_t),u_opacity:new K(e,t.u_opacity),u_image0:new me(e,t.u_image0),u_image1:new me(e,t.u_image1),u_brightness_low:new K(e,t.u_brightness_low),u_brightness_high:new K(e,t.u_brightness_high),u_saturation_factor:new K(e,t.u_saturation_factor),u_contrast_factor:new K(e,t.u_contrast_factor),u_spin_weights:new hi(e,t.u_spin_weights),u_coords_top:new hn(e,t.u_coords_top),u_coords_bottom:new hn(e,t.u_coords_bottom)}),hF=(e,t,i,r,n)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:dF(r.paint.get("raster-saturation")),u_contrast_factor:pF(r.paint.get("raster-contrast")),u_spin_weights:cF(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]});function cF(e){e*=Math.PI/180;let t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}function pF(e){return e>0?1/(1-e):1+e}function dF(e){return e>0?1-1/(1.001-e):-e}var fF=(e,t)=>({u_is_size_zoom_constant:new me(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new me(e,t.u_is_size_feature_constant),u_size_t:new K(e,t.u_size_t),u_size:new K(e,t.u_size),u_camera_to_center_distance:new K(e,t.u_camera_to_center_distance),u_pitch:new K(e,t.u_pitch),u_rotate_symbol:new me(e,t.u_rotate_symbol),u_aspect_ratio:new K(e,t.u_aspect_ratio),u_fade_change:new K(e,t.u_fade_change),u_label_plane_matrix:new pi(e,t.u_label_plane_matrix),u_coord_matrix:new pi(e,t.u_coord_matrix),u_is_text:new me(e,t.u_is_text),u_pitch_with_map:new me(e,t.u_pitch_with_map),u_is_along_line:new me(e,t.u_is_along_line),u_is_variable_anchor:new me(e,t.u_is_variable_anchor),u_texsize:new ce(e,t.u_texsize),u_texture:new me(e,t.u_texture),u_translation:new ce(e,t.u_translation),u_pitched_scale:new K(e,t.u_pitched_scale)}),mF=(e,t)=>({u_is_size_zoom_constant:new me(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new me(e,t.u_is_size_feature_constant),u_size_t:new K(e,t.u_size_t),u_size:new K(e,t.u_size),u_camera_to_center_distance:new K(e,t.u_camera_to_center_distance),u_pitch:new K(e,t.u_pitch),u_rotate_symbol:new me(e,t.u_rotate_symbol),u_aspect_ratio:new K(e,t.u_aspect_ratio),u_fade_change:new K(e,t.u_fade_change),u_label_plane_matrix:new pi(e,t.u_label_plane_matrix),u_coord_matrix:new pi(e,t.u_coord_matrix),u_is_text:new me(e,t.u_is_text),u_pitch_with_map:new me(e,t.u_pitch_with_map),u_is_along_line:new me(e,t.u_is_along_line),u_is_variable_anchor:new me(e,t.u_is_variable_anchor),u_texsize:new ce(e,t.u_texsize),u_texture:new me(e,t.u_texture),u_gamma_scale:new K(e,t.u_gamma_scale),u_device_pixel_ratio:new K(e,t.u_device_pixel_ratio),u_is_halo:new me(e,t.u_is_halo),u_translation:new ce(e,t.u_translation),u_pitched_scale:new K(e,t.u_pitched_scale)}),yF=(e,t)=>({u_is_size_zoom_constant:new me(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new me(e,t.u_is_size_feature_constant),u_size_t:new K(e,t.u_size_t),u_size:new K(e,t.u_size),u_camera_to_center_distance:new K(e,t.u_camera_to_center_distance),u_pitch:new K(e,t.u_pitch),u_rotate_symbol:new me(e,t.u_rotate_symbol),u_aspect_ratio:new K(e,t.u_aspect_ratio),u_fade_change:new K(e,t.u_fade_change),u_label_plane_matrix:new pi(e,t.u_label_plane_matrix),u_coord_matrix:new pi(e,t.u_coord_matrix),u_is_text:new me(e,t.u_is_text),u_pitch_with_map:new me(e,t.u_pitch_with_map),u_is_along_line:new me(e,t.u_is_along_line),u_is_variable_anchor:new me(e,t.u_is_variable_anchor),u_texsize:new ce(e,t.u_texsize),u_texsize_icon:new ce(e,t.u_texsize_icon),u_texture:new me(e,t.u_texture),u_texture_icon:new me(e,t.u_texture_icon),u_gamma_scale:new K(e,t.u_gamma_scale),u_device_pixel_ratio:new K(e,t.u_device_pixel_ratio),u_is_halo:new me(e,t.u_is_halo),u_translation:new ce(e,t.u_translation),u_pitched_scale:new K(e,t.u_pitched_scale)}),Zb=(e,t,i,r,n,a,o,s,l,u,h,c,p)=>{let d=o.transform;return{u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:d.width/d.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:a,u_texsize:c,u_texture:0,u_translation:u,u_pitched_scale:p}},Yb=(e,t,i,r,n,a,o,s,l,u,h,c,p,d)=>{let f=o.transform;return re(Zb(e,t,i,r,n,a,o,s,l,u,h,c,d),{u_gamma_scale:r?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+p})},gF=(e,t,i,r,n,a,o,s,l,u,h,c,p)=>re(Yb(e,t,i,r,n,a,o,s,l,u,!0,h,!0,p),{u_texsize_icon:c,u_texture_icon:1}),_F=(e,t)=>({u_opacity:new K(e,t.u_opacity),u_color:new cn(e,t.u_color)}),xF=(e,t)=>({u_opacity:new K(e,t.u_opacity),u_image:new me(e,t.u_image),u_pattern_tl_a:new ce(e,t.u_pattern_tl_a),u_pattern_br_a:new ce(e,t.u_pattern_br_a),u_pattern_tl_b:new ce(e,t.u_pattern_tl_b),u_pattern_br_b:new ce(e,t.u_pattern_br_b),u_texsize:new ce(e,t.u_texsize),u_mix:new K(e,t.u_mix),u_pattern_size_a:new ce(e,t.u_pattern_size_a),u_pattern_size_b:new ce(e,t.u_pattern_size_b),u_scale_a:new K(e,t.u_scale_a),u_scale_b:new K(e,t.u_scale_b),u_pixel_coord_upper:new ce(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ce(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new K(e,t.u_tile_units_to_pixels)}),vF=(e,t)=>({u_opacity:e,u_color:t}),bF=(e,t,i,r,n)=>re(A5(i,n,t,r),{u_opacity:e}),wF=(e,t)=>({u_sun_pos:new hi(e,t.u_sun_pos),u_atmosphere_blend:new K(e,t.u_atmosphere_blend),u_globe_position:new hi(e,t.u_globe_position),u_globe_radius:new K(e,t.u_globe_radius),u_inv_proj_matrix:new pi(e,t.u_inv_proj_matrix)}),PF=(e,t,i,r,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}),SF=(e,t)=>({u_sky_color:new cn(e,t.u_sky_color),u_horizon_color:new cn(e,t.u_horizon_color),u_horizon:new ce(e,t.u_horizon),u_horizon_normal:new ce(e,t.u_horizon_normal),u_sky_horizon_blend:new K(e,t.u_sky_horizon_blend),u_sky_blend:new K(e,t.u_sky_blend)}),TF=(e,t,i)=>{let r=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),a=Nl(t),o=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-a*n)*i,(t.height/2+a*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:o}},x_=(e,t)=>{},MF={fillExtrusion:E5,fillExtrusionPattern:k5,fill:L5,fillPattern:z5,fillOutline:R5,fillOutlinePattern:F5,circle:V5,collisionBox:U5,collisionCircle:G5,debug:$5,depth:x_,clippingMask:x_,heatmap:Z5,heatmapTexture:Y5,hillshade:W5,hillshadePrepare:H5,colorRelief:eF,line:iF,lineGradient:rF,linePattern:nF,lineSDF:aF,raster:uF,symbolIcon:fF,symbolSDF:mF,symbolTextAndIcon:yF,background:_F,backgroundPattern:xF,terrain:v5,terrainDepth:b5,terrainCoords:w5,projectionErrorMeasurement:QR,atmosphere:wF,sky:SF},CF=class{constructor(e,t,i){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},IF={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},AF=class{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error("Length of new data is ".concat(e.length,", which doesn't match current length of ").concat(this.length));let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){let r=this.attributes[i],n=t.attributes[r.name];n!==void 0&&e.enableVertexAttribArray(n)}}setVertexAttribPointers(e,t,i){for(let r=0;r<this.attributes.length;r++){let n=this.attributes[r],a=t.attributes[n.name];a!==void 0&&e.vertexAttribPointer(a,n.components,e[IF[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},Ve=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},EF=class extends Ve{getDefault(){return oe.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},kF=class extends Ve{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},DF=class extends Ve{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},LF=class extends Ve{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},zF=class extends Ve{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},RF=class extends Ve{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},FF=class extends Ve{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},BF=class extends Ve{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},OF=class extends Ve{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},NF=class extends Ve{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},VF=class extends Ve{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},jF=class extends Ve{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},UF=class extends Ve{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},GF=class extends Ve{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},XF=class extends Ve{getDefault(){return oe.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},qF=class extends Ve{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},$F=class extends Ve{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},ZF=class extends Ve{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},YF=class extends Ve{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},WF=class extends Ve{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},HF=class extends Ve{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},KF=class extends Ve{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},JF=class extends Ve{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},QF=class extends Ve{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},eB=class extends Ve{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},tB=class extends Ve{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},iB=class extends Ve{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},rB=class extends Ve{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;let t=this.gl;Br(t)?t.bindVertexArray(e):(i=t.getExtension("OES_vertex_array_object"))==null||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},nB=class extends Ve{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},aB=class extends Ve{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},oB=class extends Ve{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},Zd=class extends Ve{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},sB=class extends Zd{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},lB=class extends Zd{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},uB=class extends Zd{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},Wb="Framebuffer is not complete";function hB(e){return e.message===Wb}function cB(){return new Error(Wb)}var pB=class{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;let a=e.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new sB(e,o),r)this.depthAttachment=n?new uB(e,o):new lB(e,o);else if(n)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw cB()}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}},dB=class{constructor(e){var t,i;if(this.gl=e,this.clearColor=new EF(this),this.clearDepth=new kF(this),this.clearStencil=new DF(this),this.colorMask=new LF(this),this.depthMask=new zF(this),this.stencilMask=new RF(this),this.stencilFunc=new FF(this),this.stencilOp=new BF(this),this.stencilTest=new OF(this),this.depthRange=new NF(this),this.depthTest=new VF(this),this.depthFunc=new jF(this),this.blend=new UF(this),this.blendFunc=new GF(this),this.blendColor=new XF(this),this.blendEquation=new qF(this),this.cullFace=new $F(this),this.cullFaceSide=new ZF(this),this.frontFace=new YF(this),this.program=new WF(this),this.activeTexture=new HF(this),this.viewport=new KF(this),this.bindFramebuffer=new JF(this),this.bindRenderbuffer=new QF(this),this.bindTexture=new eB(this),this.bindVertexBuffer=new tB(this),this.bindElementBuffer=new iB(this),this.bindVertexArray=new rB(this),this.pixelStoreUnpack=new nB(this),this.pixelStoreUnpackPremultiplyAlpha=new aB(this),this.pixelStoreUnpackFlipY=new oB(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),Br(e)){this.HALF_FLOAT=e.HALF_FLOAT;let r=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(t=e.RGBA16F)!=null?t:r==null?void 0:r.RGBA16F_EXT,this.RGB16F=(i=e.RGB16F)!=null?i:r==null?void 0:r.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let r=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=r==null?void 0:r.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new CF(this,e,t)}createVertexBuffer(e,t,i){return new AF(this,e,t,i)}createRenderbuffer(e,t,i){let r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new pB(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){let r=this.gl,n=0;e&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof i<"u"&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){ar(e.blendFunction,it.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return Br(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return Br(this.gl)?this.gl.deleteVertexArray(e):(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}},Yd=fe(ge(),1),bl;function v_(e,t,i,r,n){let a=e.context,o=e.transform,s=a.gl,l=e.useProgram("collisionBox"),u=[],h=0,c=0;for(let _=0;_<r.length;_++){let b=r[_],v=t.getTile(b).getBucket(i);if(!v)continue;let w=n?v.textCollisionBox:v.iconCollisionBox,P=v.collisionCircleArray;P.length>0&&(u.push({circleArray:P,circleOffset:c,coord:b}),h+=P.length/4,c=h),w&&l.draw(a,s.LINES,ve.disabled,Fe.disabled,e.colorModeForRenderPass(),Le.disabled,X5(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(b),o.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,e.transform.zoom,null,null,w.collisionVertexBuffer)}if(!n||!u.length)return;let p=e.useProgram("collisionCircle"),d=new yk;d.resize(h*4),d._trim();let f=0;for(let _ of u)for(let b=0;b<_.circleArray.length/4;b++){let v=b*4,w=_.circleArray[v+0],P=_.circleArray[v+1],S=_.circleArray[v+2],C=_.circleArray[v+3];d.emplace(f++,w,P,S,C,0),d.emplace(f++,w,P,S,C,1),d.emplace(f++,w,P,S,C,2),d.emplace(f++,w,P,S,C,3)}(!bl||bl.length<h*2)&&(bl=fB(h));let y=a.createIndexBuffer(bl,!0),g=a.createVertexBuffer(d,pD.members,!0);for(let _ of u){let b=q5(e.transform);p.draw(a,s.TRIANGLES,ve.disabled,Fe.disabled,e.colorModeForRenderPass(),Le.disabled,b,e.style.map.terrain&&e.style.map.terrain.getTerrainData(_.coord),null,i.id,g,y,Qe.simpleSegment(0,_.circleOffset*2,_.circleArray.length,_.circleArray.length/2),null,e.transform.zoom,null,null,null)}g.destroy(),y.destroy()}function fB(e){let t=e*2,i=new _k;i.resize(t),i._trim();for(let r=0;r<t;r++){let n=r*6;i.uint16[n+0]=r*4+0,i.uint16[n+1]=r*4+1,i.uint16[n+2]=r*4+2,i.uint16[n+3]=r*4+2,i.uint16[n+4]=r*4+3,i.uint16[n+5]=r*4+0}return i}var mB=q.identity(new Float32Array(16));function yB(e,t,i,r,n,a){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:o}=a,s=Fe.disabled,l=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&_B(r,e,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),n),i.paint.get("icon-opacity").constantOr(1)!==0&&b_(e,t,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),s,l,o),i.paint.get("text-opacity").constantOr(1)!==0&&b_(e,t,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),s,l,o),t.map.showCollisionBoxes&&(v_(e,t,i,r,!0),v_(e,t,i,r,!1))}function gB(e,t,i,r,n,a){let{horizontalAlign:o,verticalAlign:s}=Hv(e),l=-(o-.5)*t,u=-(s-.5)*i;return new Yd.default((l/n+r[0])*a,(u/n+r[1])*a)}function _B(e,t,i,r,n,a,o,s,l){let u=t.transform,h=t.style.map.terrain,c=n==="map",p=a==="map";for(let d of e){let f=r.getTile(d),y=f.getBucket(i);if(!y||!y.text||!y.text.segments.get().length)continue;let g=y.textSizeData,_=Ru(g,u.zoom),b=ci(f,1,t.transform.zoom),v=jd(c,t.transform,b),w=i.layout.get("icon-text-fit")!=="none"&&y.hasIconData();if(_){let P=Math.pow(2,u.zoom-f.tileID.overscaledZ),S=h?(E,F)=>h.getElevation(d,E,F):null,C=ln(u,f,o,s);vB(y,c,p,l,u,v,P,_,w,C,d.toUnwrapped(),S)}}}function xB(e,t,i,r,n,a){let o=t.tileAnchorPoint.add(new Yd.default(t.translation[0],t.translation[1]));if(t.pitchWithMap){let s=r.mult(a);i||(s=s.rotate(-n));let l=o.add(s);return Gd(l.x,l.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}else if(i){let s=On(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),l=Math.atan(s.y/s.x)+(s.x<0?Math.PI:0);return e.add(r.rotate(l))}else return e.add(r)}function vB(e,t,i,r,n,a,o,s,l,u,h,c){let p=e.text.placedSymbolArray,d=e.text.dynamicLayoutVertexArray,f=e.icon.dynamicLayoutVertexArray,y={};d.clear();for(let g=0;g<p.length;g++){let _=p.get(g),b=e.allowVerticalPlacement&&!_.placedOrientation,v=!_.hidden&&_.crossTileID&&!b?r[_.crossTileID]:null;if(!v)va(_.numGlyphs,d);else{let w=new Yd.default(_.anchorX,_.anchorY),P={getElevation:c,width:n.width,height:n.height,pitchedLabelPlaneMatrix:a,lineVertexArray:null,pitchWithMap:i,transform:n,projectionCache:null,tileAnchorPoint:w,translation:u,unwrappedTileID:h},S=i?mb(w.x,w.y,P):On(w.x,w.y,P),C=pb(n.cameraToCenterDistance,S.signedDistanceFromCamera),E=Vd(e.textSizeData,s,_)*C/Zv;i&&(E*=e.tilePixelRatio/o);let{width:F,height:B,anchor:R,textOffset:D,textBoxScale:z}=v,x=gB(R,F,B,D,z,E),T=n.getPitchedTextCorrection(w.x+u[0],w.y+u[1],h),I=xB(S.point,P,t,x,-n.bearingInRadians,T),U=e.allowVerticalPlacement&&_.placedOrientation===2?Math.PI/2:0;for(let X=0;X<_.numGlyphs;X++)Qo(d,I,U);l&&_.associatedIconIndex>=0&&(y[_.associatedIconIndex]={shiftedAnchor:I,angle:U})}}if(l){f.clear();let g=e.icon.placedSymbolArray;for(let _=0;_<g.length;_++){let b=g.get(_);if(b.hidden)va(b.numGlyphs,f);else{let v=y[_];if(!v)va(b.numGlyphs,f);else for(let w=0;w<b.numGlyphs;w++)Qo(f,v.shiftedAnchor,v.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(f)}e.text.dynamicLayoutVertexBuffer.updateData(d)}function bB(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function b_(e,t,i,r,n,a,o,s,l,u,h,c,p){let d=e.context,f=d.gl,y=e.transform,g=s==="map",_=l==="map",b=s!=="viewport"&&i.layout.get("symbol-placement")!=="point",v=g&&!_&&!b,w=!i.layout.get("symbol-sort-key").isConstant(),P=!1,S=e.getDepthModeForSublayer(0,ve.ReadOnly),C=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],F=y.getCircleRadiusCorrection();for(let B of r){let R=t.getTile(B),D=R.getBucket(i);if(!D)continue;let z=n?D.text:D.icon;if(!z||!z.segments.get().length||!z.hasVisibleVertices)continue;let x=z.programConfigurations.get(i.id),T=n||D.sdfIcons,I=n?D.textSizeData:D.iconSizeData,U=_||y.pitch!==0,X=e.useProgram(bB(T,n,D),x),Z=Ru(I,y.zoom),ie=e.style.map.terrain&&e.style.map.terrain.getTerrainData(B),pe,je=[0,0],le,Oe,qe=null,gt;if(n){if(le=R.glyphAtlasTexture,Oe=f.LINEAR,pe=R.glyphAtlasTexture.size,D.iconsInText){je=R.imageAtlasTexture.size,qe=R.imageAtlasTexture;let Ot=I.kind==="composite"||I.kind==="camera";gt=U||e.options.rotating||e.options.zooming||Ot?f.LINEAR:f.NEAREST}}else{let Ot=i.layout.get("icon-size").constantOr(0)!==1||D.iconsNeedLinear;le=R.imageAtlasTexture,Oe=T||e.options.rotating||e.options.zooming||Ot||U?f.LINEAR:f.NEAREST,pe=R.imageAtlasTexture.size}let kt=ci(R,1,e.transform.zoom),Dt=jd(g,e.transform,kt),jt=q.create();q.invert(jt,Dt);let yi=tz(_,g,e.transform,kt),Lt=ln(y,R,a,o),xn=y.getProjectionData({overscaledTileID:B,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),Cr=C&&D.hasTextData(),Hi=i.layout.get("icon-text-fit")!=="none"&&Cr&&D.hasIconData();if(b){let Ot=e.style.map.terrain?(et,Gt)=>e.style.map.terrain.getElevation(B,et,Gt):null,pt=i.layout.get("text-rotation-alignment")==="map";rz(D,e,n,Dt,jt,_,u,pt,B.toUnwrapped(),y.width,y.height,Lt,Ot)}let gi=n&&C||Hi,Ki=_?Dt:e.transform.clipSpaceToPixelsMatrix,_i=b||gi?mB:Ki,Ht=T&&i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Ut;T?D.iconsInText?Ut=gF(I.kind,Z,v,_,b,gi,e,_i,yi,Lt,pe,je,F):Ut=Yb(I.kind,Z,v,_,b,gi,e,_i,yi,Lt,n,pe,!0,F):Ut=Zb(I.kind,Z,v,_,b,gi,e,_i,yi,Lt,n,pe,F);let xi={program:X,buffers:z,uniformValues:Ut,projectionData:xn,atlasTexture:le,atlasTextureIcon:qe,atlasInterpolation:Oe,atlasInterpolationIcon:gt,isSDF:T,hasHalo:Ht};if(w&&D.canOverlap){P=!0;let Ot=z.segments.get();for(let pt of Ot)E.push({segments:new Qe([pt]),sortKey:pt.sortKey,state:xi,terrainData:ie})}else E.push({segments:z.segments,sortKey:0,state:xi,terrainData:ie})}P&&E.sort((B,R)=>B.sortKey-R.sortKey);for(let B of E){let R=B.state;if(d.activeTexture.set(f.TEXTURE0),R.atlasTexture.bind(R.atlasInterpolation,f.CLAMP_TO_EDGE),R.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),R.atlasTextureIcon&&R.atlasTextureIcon.bind(R.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),R.isSDF){let D=R.uniformValues;R.hasHalo&&(D.u_is_halo=1,w_(R.buffers,B.segments,i,e,R.program,S,h,c,D,R.projectionData,B.terrainData)),D.u_is_halo=0}w_(R.buffers,B.segments,i,e,R.program,S,h,c,R.uniformValues,R.projectionData,B.terrainData)}}function w_(e,t,i,r,n,a,o,s,l,u,h){let c=r.context,p=c.gl;n.draw(c,p.TRIANGLES,a,o,s,Le.backCCW,l,h,u,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function wB(e,t,i,r,n){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=i.paint.get("circle-opacity"),s=i.paint.get("circle-stroke-width"),l=i.paint.get("circle-stroke-opacity"),u=!i.layout.get("circle-sort-key").isConstant();if(o.constantOr(1)===0&&(s.constantOr(1)===0||l.constantOr(1)===0))return;let h=e.context,c=h.gl,p=e.transform,d=e.getDepthModeForSublayer(0,ve.ReadOnly),f=Fe.disabled,y=e.colorModeForRenderPass(),g=[],_=p.getCircleRadiusCorrection();for(let b=0;b<r.length;b++){let v=r[b],w=t.getTile(v),P=w.getBucket(i);if(!P)continue;let S=i.paint.get("circle-translate"),C=i.paint.get("circle-translate-anchor"),E=ln(p,w,S,C),F=P.programConfigurations.get(i.id),B=e.useProgram("circle",F),R=P.layoutVertexBuffer,D=P.indexBuffer,z=e.style.map.terrain&&e.style.map.terrain.getTerrainData(v),x=j5(e,w,i,E,_),T=p.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),I={programConfiguration:F,program:B,layoutVertexBuffer:R,indexBuffer:D,uniformValues:x,terrainData:z,projectionData:T};if(u){let U=P.segments.get();for(let X of U)g.push({segments:new Qe([X]),sortKey:X.sortKey,state:I})}else g.push({segments:P.segments,sortKey:0,state:I})}u&&g.sort((b,v)=>b.sortKey-v.sortKey);for(let b of g){let{programConfiguration:v,program:w,layoutVertexBuffer:P,indexBuffer:S,uniformValues:C,terrainData:E,projectionData:F}=b.state,B=b.segments;w.draw(h,c.TRIANGLES,d,f,y,Le.backCCW,C,E,F,i.id,P,S,B,i.paint,e.transform.zoom,v)}}function PB(e,t,i,r,n){if(i.paint.get("heatmap-opacity")===0)return;let a=e.context,{isRenderingToTexture:o,isRenderingGlobe:s}=n;if(e.style.map.terrain){for(let l of r){let u=t.getTile(l);t.hasRenderableParent(l)||(e.renderPass==="offscreen"?MB(e,u,i,l,s):e.renderPass==="translucent"&&CB(e,i,l,o,s))}a.viewport.set([0,0,e.width,e.height])}else e.renderPass==="offscreen"?SB(e,t,i,r):e.renderPass==="translucent"&&TB(e,i)}function SB(e,t,i,r){let n=e.context,a=n.gl,o=e.transform,s=Fe.disabled,l=new it([a.ONE,a.ONE],oe.transparent,[!0,!0,!0,!0]);IB(n,e,i),n.clear({color:oe.transparent});for(let u=0;u<r.length;u++){let h=r[u];if(t.hasRenderableParent(h))continue;let c=t.getTile(h),p=c.getBucket(i);if(!p)continue;let d=p.programConfigurations.get(i.id),f=e.useProgram("heatmap",d),y=o.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=o.getCircleRadiusCorrection();f.draw(n,a.TRIANGLES,ve.disabled,s,l,Le.backCCW,Gb(c,o.zoom,i.paint.get("heatmap-intensity"),g),null,y,i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,i.paint,o.zoom,d)}n.viewport.set([0,0,e.width,e.height])}function TB(e,t){let i=e.context,r=i.gl;i.setColorMode(e.colorModeForRenderPass());let n=t.heatmapFbos.get(Wo);n&&(i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),i.activeTexture.set(r.TEXTURE1),Kb(i,t).bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,r.TRIANGLES,ve.disabled,Fe.disabled,e.colorModeForRenderPass(),Le.disabled,Xb(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function MB(e,t,i,r,n){let a=e.context,o=a.gl,s=Fe.disabled,l=new it([o.ONE,o.ONE],oe.transparent,[!0,!0,!0,!0]),u=t.getBucket(i);if(!u)return;let h=r.key,c=i.heatmapFbos.get(h);c||(c=Hb(a,t.tileSize,t.tileSize),i.heatmapFbos.set(h,c)),a.bindFramebuffer.set(c.framebuffer),a.viewport.set([0,0,t.tileSize,t.tileSize]),a.clear({color:oe.transparent});let p=u.programConfigurations.get(i.id),d=e.useProgram("heatmap",p,!n),f=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),y=e.style.map.terrain.getTerrainData(r);d.draw(a,o.TRIANGLES,ve.disabled,s,l,Le.disabled,Gb(t,e.transform.zoom,i.paint.get("heatmap-intensity"),1),y,f,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,e.transform.zoom,p)}function CB(e,t,i,r,n){let a=e.context,o=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let l=Kb(a,t),u=i.key,h=t.heatmapFbos.get(u);if(!h)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,h.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),l.bind(o.LINEAR,o.CLAMP_TO_EDGE);let c=s.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(a,o.TRIANGLES,ve.disabled,Fe.disabled,e.colorModeForRenderPass(),Le.disabled,Xb(e,t,0,1),null,c,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),h.destroy(),t.heatmapFbos.delete(u)}function IB(e,t,i){let r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let n=i.heatmapFbos.get(Wo);n?(r.bindTexture(r.TEXTURE_2D,n.colorAttachment.get()),e.bindFramebuffer.set(n.framebuffer)):(n=Hb(e,t.width/4,t.height/4),i.heatmapFbos.set(Wo,n))}function Hb(e,t,i){var l,u;let r=e.gl,n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);let a=(l=e.HALF_FLOAT)!=null?l:r.UNSIGNED_BYTE,o=(u=e.RGBA16F)!=null?u:r.RGBA;r.texImage2D(r.TEXTURE_2D,0,o,t,i,0,r.RGBA,a,null);let s=e.createFramebuffer(t,i,!1,!1);return s.colorAttachment.set(n),s}function Kb(e,t){return t.colorRampTexture||(t.colorRampTexture=new vt(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function AB(e,t,i,r,n){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=i.paint.get("line-opacity"),s=i.paint.get("line-width");if(o.constantOr(1)===0||s.constantOr(1)===0)return;let l=e.getDepthModeForSublayer(0,ve.ReadOnly),u=e.colorModeForRenderPass(),h=i.paint.get("line-dasharray"),c=i.paint.get("line-pattern"),p=c.constantOr(1),d=i.paint.get("line-gradient"),f=i.getCrossfadeParameters(),y=p?"linePattern":h?"lineSDF":d?"lineGradient":"line",g=e.context,_=g.gl,b=e.transform,v=!0;for(let w of r){let P=t.getTile(w);if(p&&!P.patternsLoaded())continue;let S=P.getBucket(i);if(!S)continue;let C=S.programConfigurations.get(i.id),E=e.context.program.get(),F=e.useProgram(y,C),B=v||F.program!==E,R=e.style.map.terrain&&e.style.map.terrain.getTerrainData(w),D=c.constantOr(null);if(D&&P.imageAtlas){let U=P.imageAtlas,X=U.patternPositions[D.to.toString()],Z=U.patternPositions[D.from.toString()];X&&Z&&C.setConstantPatternPositions(X,Z)}let z=b.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),x=b.getPixelScale(),T=p?sF(e,P,i,x,f):h?lF(e,P,i,x,h,f):d?oF(e,P,i,x,S.lineClipsArray.length):$d(e,P,i,x);if(p)g.activeTexture.set(_.TEXTURE0),P.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),C.updatePaintBuffers(f);else if(h&&(B||e.lineAtlas.dirty))g.activeTexture.set(_.TEXTURE0),e.lineAtlas.bind(g);else if(d){let U=S.gradients[i.id],X=U.texture;if(i.gradientVersion!==U.version){let Z=256;if(i.stepInterpolant){let ie=t.getSource().maxzoom,pe=w.canonical.z===ie?Math.ceil(1<<e.transform.maxZoom-w.canonical.z):1,je=S.maxLineLength/8192*1024*pe;Z=Ne(MC(je),256,g.maxTextureSize)}U.gradient=Rv({expression:i.gradientExpression(),evaluationKey:"lineProgress",resolution:Z,image:U.gradient||void 0,clips:S.lineClipsArray}),U.texture?U.texture.update(U.gradient):U.texture=new vt(g,U.gradient,_.RGBA),U.version=i.gradientVersion,X=U.texture}g.activeTexture.set(_.TEXTURE0),X.bind(i.stepInterpolant?_.NEAREST:_.LINEAR,_.CLAMP_TO_EDGE)}let I=e.stencilModeForClipping(w);F.draw(g,_.TRIANGLES,l,I,u,Le.disabled,T,R,z,i.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,i.paint,e.transform.zoom,C,S.layoutVertexBuffer2),v=!1}}function Jb(e,t,i,r,n){if(!i||!r||!r.imageAtlas)return;let a=r.imageAtlas.patternPositions,o=a[i.to.toString()],s=a[i.from.toString()];if(!o&&s&&(o=s),!s&&o&&(s=o),!o||!s){let l=n.getPaintProperty(t);o=a[l],s=a[l]}o&&s&&e.setConstantPatternPositions(o,s)}function EB(e,t,i,r,n){let a=i.paint.get("fill-color"),o=i.paint.get("fill-opacity");if(o.constantOr(1)===0)return;let{isRenderingToTexture:s}=n,l=e.colorModeForRenderPass(),u=i.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&a.constantOr(oe.transparent).a===1&&o.constantOr(0)===1?"opaque":"translucent";if(e.renderPass===h){let c=e.getDepthModeForSublayer(1,e.renderPass==="opaque"?ve.ReadWrite:ve.ReadOnly);P_(e,t,i,r,c,l,!1,s)}if(e.renderPass==="translucent"&&i.paint.get("fill-antialias")){let c=e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,ve.ReadOnly);P_(e,t,i,r,c,l,!0,s)}}function P_(e,t,i,r,n,a,o,s){let l=e.context.gl,u="fill-pattern",h=i.paint.get(u),c=h&&h.constantOr(1),p=i.getCrossfadeParameters(),d,f,y,g,_,b=e.transform,v=i.paint.get("fill-translate"),w=i.paint.get("fill-translate-anchor");o?(f=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(f=c?"fillPattern":"fill",d=l.TRIANGLES);let P=h.constantOr(null);for(let S of r){let C=t.getTile(S);if(c&&!C.patternsLoaded())continue;let E=C.getBucket(i);if(!E)continue;let F=E.programConfigurations.get(i.id),B=e.useProgram(f,F),R=e.style.map.terrain&&e.style.map.terrain.getTerrainData(S);c&&(e.context.activeTexture.set(l.TEXTURE0),C.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),F.updatePaintBuffers(p)),Jb(F,u,P,C,i);let D=b.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),z=ln(b,C,v,w);if(!o)g=E.indexBuffer,_=E.segments,y=c?Ub(e,p,C,z):B5(z);else{g=E.indexBuffer2,_=E.segments2;let T=[l.drawingBufferWidth,l.drawingBufferHeight];y=f==="fillOutlinePattern"&&c?N5(e,p,C,T,z):O5(T,z)}let x=e.stencilModeForClipping(S);B.draw(e.context,d,n,x,a,Le.backCCW,y,R,D,i.id,E.layoutVertexBuffer,g,_,i.paint,e.transform.zoom,F)}}function kB(e,t,i,r,n){let a=i.paint.get("fill-extrusion-opacity");if(a===0)return;let{isRenderingToTexture:o}=n;if(e.renderPass==="translucent"){let s=new ve(e.context.gl.LEQUAL,ve.ReadWrite,e.depthRangeFor3D);if(a===1&&!i.paint.get("fill-extrusion-pattern").constantOr(1)){let l=e.colorModeForRenderPass();Tc(e,t,i,r,s,Fe.disabled,l,o)}else Tc(e,t,i,r,s,Fe.disabled,it.disabled,o),Tc(e,t,i,r,s,e.stencilModeFor3D(),e.colorModeForRenderPass(),o)}}function Tc(e,t,i,r,n,a,o,s){let l=e.context,u=l.gl,h="fill-extrusion-pattern",c=i.paint.get(h),p=c.constantOr(1),d=i.getCrossfadeParameters(),f=i.paint.get("fill-extrusion-opacity"),y=c.constantOr(null),g=e.transform;for(let _ of r){let b=t.getTile(_),v=b.getBucket(i);if(!v)continue;let w=e.style.map.terrain&&e.style.map.terrain.getTerrainData(_),P=v.programConfigurations.get(i.id),S=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",P);p&&(e.context.activeTexture.set(u.TEXTURE0),b.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),P.updatePaintBuffers(d));let C=g.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!s,applyTerrainMatrix:!0});Jb(P,h,y,b,i);let E=ln(g,b,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),F=i.paint.get("fill-extrusion-vertical-gradient"),B=p?D5(e,F,f,E,_,d,b):jb(e,F,f,E);S.draw(l,l.gl.TRIANGLES,n,a,o,Le.backCCW,B,w,C,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,e.transform.zoom,P,e.style.map.terrain&&v.centroidVertexBuffer)}}function DB(e,t,i,r,n){if(e.renderPass!=="offscreen"&&e.renderPass!=="translucent")return;let{isRenderingToTexture:a}=n,o=e.context,s=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,ve.ReadOnly),u=e.colorModeForRenderPass();if(e.renderPass==="offscreen")LB(e,t,r,i,l,Fe.disabled,u),o.viewport.set([0,0,e.width,e.height]);else if(e.renderPass==="translucent")if(s){let[h,c,p]=e.stencilConfigForOverlapTwoPass(r);Mc(e,t,i,p,h,l,u,!1,a),Mc(e,t,i,p,c,l,u,!0,a)}else{let[h,c]=e.getStencilConfigForOverlapAndUpdateStencilID(r);Mc(e,t,i,c,h,l,u,!1,a)}}function Mc(e,t,i,r,n,a,o,s,l){var g;let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=["#define NUM_ILLUMINATION_SOURCES ".concat(i.paint.get("hillshade-highlight-color").values.length)],f=e.useProgram("hillshade",null,!1,d),y=!e.options.moving;for(let _ of r){let b=t.getTile(_),v=b.fbo;if(!v)continue;let w=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),P=(g=e.style.map.terrain)==null?void 0:g.getTerrainData(_);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,v.colorAttachment.get());let S=c.getProjectionData({overscaledTileID:_,aligned:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(h,p.TRIANGLES,a,n[_.overscaledZ],o,Le.backCCW,K5(e,b,i),P,S,i.id,w.vertexBuffer,w.indexBuffer,w.segments)}}function LB(e,t,i,r,n,a,o){let s=e.context,l=s.gl;for(let u of i){let h=t.getTile(u),c=h.dem;if(!c||!c.data||!h.needsHillshadePrepare)continue;let p=c.dim,d=c.stride,f=c.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),h.demTexture=h.demTexture||e.getTileTexture(d),h.demTexture){let g=h.demTexture;g.update(f,{premultiply:!1}),g.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else h.demTexture=new vt(s,f,l.RGBA,{premultiply:!1}),h.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let y=h.fbo;if(!y){let g=new vt(s,{width:p,height:p,data:null},l.RGBA);g.bind(l.LINEAR,l.CLAMP_TO_EDGE),y=h.fbo=s.createFramebuffer(p,p,!0,!1),y.colorAttachment.set(g.texture)}s.bindFramebuffer.set(y.framebuffer),s.viewport.set([0,0,p,p]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,a,o,Le.disabled,J5(h.tileID,c),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),h.needsHillshadePrepare=!1}}function zB(e,t,i,r,n){if(e.renderPass!=="translucent"||!r.length)return;let{isRenderingToTexture:a}=n,o=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,ve.ReadOnly),l=e.colorModeForRenderPass();if(o){let[u,h,c]=e.stencilConfigForOverlapTwoPass(r);Cc(e,t,i,c,u,s,l,!1,a),Cc(e,t,i,c,h,s,l,!0,a)}else{let[u,h]=e.getStencilConfigForOverlapAndUpdateStencilID(r);Cc(e,t,i,h,u,s,l,!1,a)}}function Cc(e,t,i,r,n,a,o,s,l){var g;let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=e.useProgram("colorRelief"),f=!e.options.moving,y=!0;for(let _ of r){let b=t.getTile(_),v=b.dem;if(y){let F=p.getParameter(p.MAX_TEXTURE_SIZE),{elevationTexture:B,colorTexture:R}=i.getColorRampTextures(h,F,v.getUnpackVector());h.activeTexture.set(p.TEXTURE1),B.bind(p.NEAREST,p.CLAMP_TO_EDGE),h.activeTexture.set(p.TEXTURE4),R.bind(p.LINEAR,p.CLAMP_TO_EDGE),y=!1}if(!v||!v.data)continue;let w=v.stride,P=v.getPixels();if(h.activeTexture.set(p.TEXTURE0),h.pixelStoreUnpackPremultiplyAlpha.set(!1),b.demTexture=b.demTexture||e.getTileTexture(w),b.demTexture){let F=b.demTexture;F.update(P,{premultiply:!1}),F.bind(p.LINEAR,p.CLAMP_TO_EDGE)}else b.demTexture=new vt(h,P,p.RGBA,{premultiply:!1}),b.demTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE);let S=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),C=(g=e.style.map.terrain)==null?void 0:g.getTerrainData(_),E=c.getProjectionData({overscaledTileID:_,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});d.draw(h,p.TRIANGLES,a,n[_.overscaledZ],o,Le.backCCW,tF(i,b.dem),C,E,i.id,S.vertexBuffer,S.indexBuffer,S.segments)}}var wl=fe(ge(),1),Ic=[new wl.default(0,0),new wl.default(8192,0),new wl.default(8192,8192),new wl.default(0,8192)];function RB(e,t,i,r,n){if(e.renderPass!=="translucent"||i.paint.get("raster-opacity")===0||!r.length)return;let{isRenderingToTexture:a}=n,o=t.getSource(),s=e.style.projection.useSubdivision;if(o instanceof cs)Pl(e,t,i,r,null,!1,!1,o.tileCoords,o.flippedWindingOrder,a);else if(s){let[l,u,h]=e.stencilConfigForOverlapTwoPass(r);Pl(e,t,i,h,l,!1,!0,Ic,!1,a),Pl(e,t,i,h,u,!0,!0,Ic,!1,a)}else{let[l,u]=e.getStencilConfigForOverlapAndUpdateStencilID(r);Pl(e,t,i,u,l,!1,!0,Ic,!1,a)}}function Pl(e,t,i,r,n,a,o,s,l=!1,u=!1){let h=r[r.length-1].overscaledZ,c=e.context,p=c.gl,d=e.useProgram("raster"),f=e.transform,y=e.style.projection,g=e.colorModeForRenderPass(),_=!e.options.moving;for(let b of r){let v=e.getDepthModeForSublayer(b.overscaledZ-h,i.paint.get("raster-opacity")===1?ve.ReadWrite:ve.ReadOnly,p.LESS),w=t.getTile(b);w.registerFadeDuration(i.paint.get("raster-fade-duration"));let P=t.findLoadedParent(b,0),S=t.findLoadedSibling(b),C=FB(w,P||S||null,t,i,e.transform,e.style.map.terrain),E,F,B=i.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;c.activeTexture.set(p.TEXTURE0),w.texture.bind(B,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),c.activeTexture.set(p.TEXTURE1),P?(P.texture.bind(B,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),E=Math.pow(2,P.tileID.overscaledZ-w.tileID.overscaledZ),F=[w.tileID.canonical.x*E%1,w.tileID.canonical.y*E%1]):w.texture.bind(B,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),w.texture.useMipmap&&c.extTextureFilterAnisotropic&&e.transform.pitch>20&&p.texParameterf(p.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax);let R=e.style.map.terrain&&e.style.map.terrain.getTerrainData(b),D=f.getProjectionData({overscaledTileID:b,aligned:_,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),z=hF(F||[0,0],E||1,C,i,s),x=y.getMeshFromTileID(c,b.canonical,a,o,"raster"),T=n?n[b.overscaledZ]:Fe.disabled;d.draw(c,p.TRIANGLES,v,T,g,l?Le.frontCCW:Le.backCCW,z,R,D,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}function FB(e,t,i,r,n,a){let o=r.paint.get("raster-fade-duration");if(!a&&o>0){let s=Me.now(),l=(s-e.timeAdded)/o,u=t?(s-t.timeAdded)/o:-1,h=i.getSource(),c=Bu(n,{tileSize:h.tileSize,roundZoom:h.roundZoom}),p=!t||Math.abs(t.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),d=p&&e.refreshedUponExpiration?1:Ne(p?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),t?{opacity:1,mix:1-d}:{opacity:d,mix:0}}else return{opacity:1,mix:0}}function BB(e,t,i,r,n){let a=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(o===0)return;let{isRenderingToTexture:s}=n,l=e.context,u=l.gl,h=e.style.projection,c=e.transform,p=c.tileSize,d=i.paint.get("background-pattern");if(e.isPatternMissing(d))return;let f=!d&&a.a===1&&o===1&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==f)return;let y=Fe.disabled,g=e.getDepthModeForSublayer(0,f==="opaque"?ve.ReadWrite:ve.ReadOnly),_=e.colorModeForRenderPass(),b=e.useProgram(d?"backgroundPattern":"background"),v=r||Ou(c,{tileSize:p,terrain:e.style.map.terrain});d&&(l.activeTexture.set(u.TEXTURE0),e.imageManager.bind(e.context));let w=i.getCrossfadeParameters();for(let P of v){let S=c.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),C=d?bF(o,e,d,{tileID:P,tileSize:p},w):vF(o,a),E=e.style.map.terrain&&e.style.map.terrain.getTerrainData(P),F=h.getMeshFromTileID(l,P.canonical,!1,!0,"raster");b.draw(l,u.TRIANGLES,g,y,_,Le.backCCW,C,E,S,i.id,F.vertexBuffer,F.indexBuffer,F.segments)}}var OB=new oe(1,0,0,1),NB=new oe(0,1,0,1),VB=new oe(0,0,1,1),jB=new oe(1,0,1,1),UB=new oe(0,1,1,1);function GB(e){let t=e.transform.padding,i=3;S_(e,e.transform.height-(t.top||0),i,OB),S_(e,t.bottom||0,i,NB),T_(e,t.left||0,i,VB),T_(e,e.transform.width-(t.right||0),i,jB);let r=e.transform.centerPoint;XB(e,r.x,e.transform.height-r.y,UB)}function XB(e,t,i,r){nu(e,t-2/2,i-20/2,2,20,r),nu(e,t-20/2,i-2/2,20,2,r)}function S_(e,t,i,r){nu(e,0,t+i/2,e.transform.width,i,r)}function T_(e,t,i,r){nu(e,t-i/2,0,i,e.transform.height,r)}function nu(e,t,i,r,n,a){let o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,n*e.pixelRatio),o.clear({color:a}),s.disable(s.SCISSOR_TEST)}function qB(e,t,i){for(let r=0;r<i.length;r++)$B(e,t,i[r])}function $B(e,t,i){let r=e.context,n=r.gl,a=e.useProgram("debug"),o=ve.disabled,s=Fe.disabled,l=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(i);r.activeTexture.set(n.TEXTURE0);let c=t.getTileByID(i.key).latestRawTileData,p=c&&c.byteLength||0,d=Math.floor(p/1024),f=t.getTile(i).tileSize,y=512/Math.min(f,512)*(i.overscaledZ/e.transform.zoom)*.5,g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=" => ".concat(i.overscaledZ));let _="".concat(g," ").concat(d,"kB");ZB(e,_);let b=e.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(r,n.TRIANGLES,o,s,it.alphaBlended,Le.disabled,__(oe.transparent,y),null,b,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(r,n.LINE_STRIP,o,s,l,Le.disabled,__(oe.red),h,b,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function ZB(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}function YB(e,t){let i=null,r=Object.values(e._layers).flatMap(s=>s.source&&!s.isHidden(t)?[e.sourceCaches[s.source]]:[]),n=r.filter(s=>s.getSource().type==="vector"),a=r.filter(s=>s.getSource().type!=="vector"),o=s=>{(!i||i.getSource().maxzoom<s.getSource().maxzoom)&&(i=s)};return n.forEach(s=>o(s)),i||a.forEach(s=>o(s)),i}function WB(e,t,i,r){let{isRenderingGlobe:n}=r,a=e.context,o=i.implementation,s=e.style.projection,l=e.transform,u=l.getProjectionDataForCustomLayer(n),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:"const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n".concat(s.shaderPreludeCode.vertexSource),define:s.shaderDefine},defaultProjectionData:u},c=o.renderingMode?o.renderingMode:"2d";if(e.renderPass==="offscreen"){let p=o.prerender;p&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),p.call(o,a.gl,h),a.setDirty(),e.setBaseState())}else if(e.renderPass==="translucent"){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(Fe.disabled);let p=c==="3d"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,ve.ReadOnly);a.setDepthMode(p),o.render(a.gl,h),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}function HB(e,t){let i=e.context,r=i.gl,n=e.transform,a=it.unblended,o=new ve(r.LEQUAL,ve.ReadWrite,[0,1]),s=t.sourceCache.getRenderableTiles(),l=e.useProgram("terrainDepth");i.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:oe.transparent,depth:1});for(let u of s){let h=t.getTerrainMesh(u.tileID),c=t.getTerrainData(u.tileID),p=n.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d=S5(t.getMeshFrameDelta(n.zoom));l.draw(i,r.TRIANGLES,o,Fe.disabled,a,Le.backCCW,d,c,p,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}function KB(e,t){let i=e.context,r=i.gl,n=e.transform,a=it.unblended,o=new ve(r.LEQUAL,ve.ReadWrite,[0,1]),s=t.getCoordsTexture(),l=t.sourceCache.getRenderableTiles(),u=e.useProgram("terrainCoords");i.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:oe.transparent,depth:1}),t.coordsIndex=[];for(let h of l){let c=t.getTerrainMesh(h.tileID),p=t.getTerrainData(h.tileID);i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s.texture);let d=T5(255-t.coordsIndex.length,t.getMeshFrameDelta(n.zoom)),f=n.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(i,r.TRIANGLES,o,Fe.disabled,a,Le.backCCW,d,p,f,"terrain",c.vertexBuffer,c.indexBuffer,c.segments),t.coordsIndex.push(h.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}function M_(e,t,i,r){let{isRenderingGlobe:n}=r,a=e.context,o=a.gl,s=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram("terrain");a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]);for(let c of i){let p=t.getTerrainMesh(c.tileID),d=e.renderToTexture.getTexture(c),f=t.getTerrainData(c.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,d.texture);let y=t.getMeshFrameDelta(s.zoom),g=s.calculateFogMatrix(c.tileID.toUnwrapped()),_=P5(y,g,e.style.sky,s.pitch,n),b=s.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(a,o.TRIANGLES,u,Fe.disabled,l,Le.backCCW,_,f,b,"terrain",p.vertexBuffer,p.indexBuffer,p.segments)}}function Qb(e,t){if(!t.mesh){let i=new zr;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let r=new qi;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),t.mesh=new za(e.createVertexBuffer(i,on.members),e.createIndexBuffer(r),Qe.simpleSegment(0,0,i.length,r.length))}return t.mesh}function JB(e,t){let i=e.context,r=i.gl,n=TF(t,e.style.map.transform,e.pixelRatio),a=new ve(r.LEQUAL,ve.ReadWrite,[0,1]),o=Fe.disabled,s=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=Qb(i,t);l.draw(i,r.TRIANGLES,a,o,s,Le.disabled,n,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function QB(e,t){let i=e.properties.get("position"),r=[-i.x,-i.y,-i.z],n=q.identity(new Float64Array(16));return e.properties.get("anchor")==="map"&&(q.rotateZ(n,n,t.rollInRadians),q.rotateX(n,n,-t.pitchInRadians),q.rotateZ(n,n,t.bearingInRadians),q.rotateX(n,n,t.center.lat*Math.PI/180),q.rotateY(n,n,-t.center.lng*Math.PI/180)),$.transformMat4(r,r,n),r}function eO(e,t,i){let r=e.context,n=r.gl,a=e.useProgram("atmosphere"),o=new ve(n.LEQUAL,ve.ReadOnly,[0,1]),s=e.transform,l=QB(i,e.transform),u=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=t.properties.get("atmosphere-blend")*u.projectionTransition;if(h===0)return;let c=Nu(s.worldSize,s.center.lat),p=s.inverseProjectionMatrix,d=new Float64Array(4);d[3]=1,_t.transformMat4(d,d,s.modelViewProjectionMatrix),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1,_t.transformMat4(d,d,p),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1;let f=[d[0],d[1],d[2]],y=PF(l,h,f,c,p),g=Qb(r,t);a.draw(r,n.TRIANGLES,o,Fe.disabled,it.alphaBlended,Le.disabled,y,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}var tO=class{constructor(e,t){this.context=new dB(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:q.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ts.maxUnderzooming+ts.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new vb}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let r of this.style._order)this.style._layers[r].resize()}setup(){let e=this.context,t=new zr;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,on.members),this.tileExtentSegments=Qe.simpleSegment(0,0,4,2);let i=new zr;i.emplaceBack(0,0),i.emplaceBack(8192,0),i.emplaceBack(0,8192),i.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(i,on.members),this.debugSegments=Qe.simpleSegment(0,0,4,5);let r=new sk;r.emplaceBack(0,0,0,0),r.emplaceBack(8192,0,8192,0),r.emplaceBack(0,8192,0,8192),r.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(r,g5.members),this.rasterBoundsSegments=Qe.simpleSegment(0,0,4,2);let n=new zr;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(n,on.members),this.rasterBoundsSegmentsPosOnly=Qe.simpleSegment(0,0,4,5);let a=new zr;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,on.members),this.viewportSegments=Qe.simpleSegment(0,0,4,2);let o=new xk;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let s=new qi;s.emplaceBack(1,0,2),s.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new Fe({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new za(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=q.create();q.ortho(i,0,this.width,this.height,0,0,1),q.scale(i,i,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let r={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,ve.disabled,this.stencilClearMode,it.disabled,Le.disabled,null,null,r,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(it.disabled),r.setDepthMode(ve.disabled);let n={};for(let a of t)n[a.key]=this.nextStencilID++;this._renderTileMasks(n,t,i,!0),this._renderTileMasks(n,t,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,i,r){let n=this.context,a=n.gl,o=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(let u of t){let h=e[u.key],c=this.style.map.terrain&&this.style.map.terrain.getTerrainData(u),p=o.getMeshFromTileID(this.context,u.canonical,r,!0,"stencil"),d=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(n,a.TRIANGLES,ve.disabled,new Fe({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),it.disabled,i?Le.disabled:Le.backCCW,null,c,d,"$clipping",p.vertexBuffer,p.indexBuffer,p.segments)}}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),a=this.getDepthModeFor3D(),o=Ou(r,{tileSize:r.tileSize});for(let s of o){let l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),u=i.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),h=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,a,Fe.disabled,it.disabled,Le.backCCW,null,l,h,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new Fe({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new Fe({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,i=e.sort((a,o)=>o.overscaledZ-a.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let a={};for(let o=0;o<n;o++)a[o+r]=new Fe({func:t.GEQUAL,mask:255},o+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[a,i]}return[{[r]:Fe.disabled},i]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,i=e.sort((a,o)=>o.overscaledZ-a.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){let a={},o={};for(let s=0;s<n;s++)a[s+r]=new Fe({func:t.GREATER,mask:255},n+1+s,255,t.KEEP,t.KEEP,t.REPLACE),o[s+r]=new Fe({func:t.GREATER,mask:255},1+s,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=n*2+1,[a,o,i]}else return this.nextStencilID=3,[{[r]:new Fe({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new Fe({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new it([e.CONSTANT_COLOR,e.ONE],new oe(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?it.unblended:it.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return ve.disabled;let r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ve(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new ve(this.context.gl.LEQUAL,ve.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){var u,h;this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(Me.now()),this.imageManager.beginFrame();let i=this.style._order,r=this.style.sourceCaches,n={},a={},o={},s={isRenderingToTexture:!1,isRenderingGlobe:((u=e.projection)==null?void 0:u.transitionState)>0};for(let c in r){let p=r[c];p.used&&p.prepare(this.context),n[c]=p.getVisibleCoordinates(!1),a[c]=n[c].slice().reverse(),o[c]=p.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let c=0;c<i.length;c++){let p=i[c];if(this.style._layers[p].is3D()){this.opaquePassCutoff=c;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let c of i){let p=this.style._layers[c];if(!p.hasOffscreenPass()||p.isHidden(this.transform.zoom))continue;let d=a[p.source];p.type!=="custom"&&!d.length||this.renderLayer(this,r[p.source],p,d,s)}if((h=this.style.projection)==null||h.updateGPUdependent({context:this.context,useProgram:c=>this.useProgram(c)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?oe.black:oe.transparent,depth:1}),this.clearStencil(),this.style.sky&&JB(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){let c=this.style._layers[i[this.currentLayer]],p=r[c.source],d=n[c.source];this._renderTileClippingMasks(c,d,!1),this.renderLayer(this,p,c,d,s)}this.renderPass="translucent";let l=!1;for(this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let c=this.style._layers[i[this.currentLayer]],p=r[c.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(c,s))continue;!this.opaquePassEnabledForLayer()&&!l&&(l=!0,s.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let d=(c.type==="symbol"?o:a)[c.source];this._renderTileClippingMasks(c,n[c.source],!!this.renderToTexture),this.renderLayer(this,p,c,d,s)}if(s.isRenderingGlobe&&eO(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=YB(this.style,this.transform.zoom);c&&qB(this,c,c.getVisibleCoordinates())}this.options.showPadding&&GB(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let t=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix,r=this.terrainFacilitator.dirty;r||(r=e?!q.exactEquals(t,i):!q.equals(t,i)),r||(r=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),r&&(q.copy(t,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,HB(this,this.style.map.terrain),KB(this,this.style.map.terrain))}renderLayer(e,t,i,r,n){i.isHidden(this.transform.zoom)||i.type!=="background"&&i.type!=="custom"&&!(r||[]).length||(this.id=i.id,DD(i)?yB(e,t,i,r,this.style.placement.variableOffsets,n):Vk(i)?wB(e,t,i,r,n):qk(i)?PB(e,t,i,r,n):sD(i)?AB(e,t,i,r,n):k3(i)?EB(e,t,i,r,n):G3(i)?kB(e,t,i,r,n):Wk(i)?DB(e,t,i,r,n):e3(i)?zB(e,t,i,r,n):VD(i)?RB(e,t,i,r,n):FD(i)?BB(e,t,i,r,n):GD(i)&&WB(e,t,i,n))}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,r=[]){this.cache=this.cache||{};let n=!!this.style.map.terrain,a=this.style.projection,o=i?hr.projectionMercator:a.shaderPreludeCode,s=i?bb:a.shaderDefine,l="/".concat(i?wb:a.shaderVariantName),u=t?t.cacheKey:"",h=this._showOverdrawInspector?"/overdraw":"",c=n?"/terrain":"",p=r?"/".concat(r.join("/")):"",d=e+u+l+h+c+p;return this.cache[d]||(this.cache[d]=new I5(this.context,hr[e],t,MF[e],this._showOverdrawInspector,n,o,s,r)),this.cache[d]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new vt(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}};function e1(e,t){let i=!1,r=null,n=null,a,o=()=>{r=null,i&&(e.apply(n,a),r=setTimeout(o,t),i=!1)};return(...s)=>(i=!0,n=this,a=s,r||o(),r)}var iO=class{constructor(e){this._getCurrentHash=()=>{let t=window.location.hash.replace("#","");if(this._hashName){let i;return t.split("&").map(r=>r.split("=")).forEach(r=>{r[0]===this._hashName&&(i=r)}),(i&&i[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getCurrentHash();if(t.length===0)return;let i=t.join("/"),r=i;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r="".concat(this._hashName,"=").concat(i));let n=window.location.hash.replace(r,"");n.startsWith("#&")?n=n.slice(0,1)+n.slice(2):n==="#"&&(n="");let a=window.location.href.replace(/(#.+)?$/,n);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=e1(this._updateHashUnthrottled,30*1e3/100),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(this._map.getZoom()*100)/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),a=Math.round(t.lng*n)/n,o=Math.round(t.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch(),u="";if(e?u+="/".concat(a,"/").concat(o,"/").concat(i):u+="".concat(i,"/").concat(o,"/").concat(a),(s||l)&&(u+="/".concat(Math.round(s*10)/10)),l&&(u+="/".concat(Math.round(l))),this._hashName){let h=this._hashName,c=!1,p=window.location.hash.slice(1).split("&").map(d=>{let f=d.split("=")[0];return f===h?(c=!0,"".concat(f,"=").concat(u)):d}).filter(d=>d);return c||p.push("".concat(h,"=").concat(u)),"#".concat(p.join("&"))}return"#".concat(u)}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new de(+e[2],+e[1])}catch(n){return!1}let t=+e[0],i=+(e[3]||0),r=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&i>=-180&&i<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}},rO=fe(ge(),1),ps={linearity:.3,easing:Np(0,0,.3,1)},nO=re({deceleration:2500,maxSpeed:1400},ps),aO=re({deceleration:20,maxSpeed:1400},ps),oO=re({deceleration:1e3,maxSpeed:360},ps),sO=re({deceleration:1e3,maxSpeed:90},ps),lO=re({deceleration:1e3,maxSpeed:360},ps),uO=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Me.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=Me.now(),i=160;for(;e.length>0&&t-e[0].time>i;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,roll:0,pan:new rO.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of this._inertiaBuffer)t.zoom+=n.zoomDelta||0,t.bearing+=n.bearingDelta||0,t.pitch+=n.pitchDelta||0,t.roll+=n.rollDelta||0,n.panDelta&&t.pan._add(n.panDelta),n.around&&(t.around=n.around),n.pinchAround&&(t.pinchAround=n.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(t.pan.mag()){let n=_o(t.pan.mag(),i,re({},nO,e||{})),a=t.pan.mult(n.amount/t.pan.mag()),o=this._map.cameraHelper.handlePanInertia(a,this._map.transform);r.center=o.easingCenter,r.offset=o.easingOffset,go(r,n)}if(t.zoom){let n=_o(t.zoom,i,aO);r.zoom=this._map.transform.zoom+n.amount,go(r,n)}if(t.bearing){let n=_o(t.bearing,i,oO);r.bearing=this._map.transform.bearing+Ne(n.amount,-179,179),go(r,n)}if(t.pitch){let n=_o(t.pitch,i,sO);r.pitch=this._map.transform.pitch+n.amount,go(r,n)}if(t.roll){let n=_o(t.roll,i,lO);r.roll=this._map.transform.roll+Ne(n.amount,-179,179),go(r,n)}if(r.zoom||r.bearing){let n=t.pinchAround===void 0?t.around:t.pinchAround;r.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),re(r,{noMoveStart:!0})}};function go(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function _o(e,t,i){let{maxSpeed:r,linearity:n,deceleration:a}=i,o=Ne(e*n/(t/1e3),-r,r),s=Math.abs(o)/(a*n);return{easing:i.easing,duration:s*1e3,amount:o*(s/2)}}var hO=fe(ge(),1),Mi=class extends H{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,r={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);let n=Ie.mousePos(t.getCanvas(),i),a=t.unproject(n);super(e,re({point:n,lngLat:a,originalEvent:i},r)),this._defaultPrevented=!1,this.target=t}},Sl=class extends H{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let r=e==="touchend"?i.changedTouches:i.touches,n=Ie.touchPos(t.getCanvasContainer(),r),a=n.map(l=>t.unproject(l)),o=n.reduce((l,u,h,c)=>l.add(u.div(c.length)),new hO.default(0,0)),s=t.unproject(o);super(e,{points:n,point:o,lngLats:a,lngLat:s,originalEvent:i}),this._defaultPrevented=!1}},cO=class extends H{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}},pO=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new cO(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new Mi(e.type,this._map,e))}mouseup(e){this._map.fire(new Mi(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new Mi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Mi(e.type,this._map,e))}mouseover(e){this._map.fire(new Mi(e.type,this._map,e))}mouseout(e){this._map.fire(new Mi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Sl(e.type,this._map,e))}touchmove(e){this._map.fire(new Sl(e.type,this._map,e))}touchend(e){this._map.fire(new Sl(e.type,this._map,e))}touchcancel(e){this._map.fire(new Sl(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},dO=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Mi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Mi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Mi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},fO=fe(ge(),1),ds=class{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(fO.default.convert(e),this._map.terrain)}},mO=class{constructor(e,t){this._map=e,this._tr=new ds(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(Ie.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=Ie.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(r.x,i.x),a=Math.max(r.x,i.x),o=Math.min(r.y,i.y),s=Math.max(r.y,i.y);Ie.setTransform(this._box,"translate(".concat(n,"px,").concat(o,"px)")),this._box.style.width="".concat(a-n,"px"),this._box.style.height="".concat(s-o,"px")}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let i=this._startPos,r=t;if(this.reset(),Ie.suppressClick(),i.x===r.x&&i.y===r.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new H("boxzoomend",{originalEvent:e})),{cameraAnimation:n=>n.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(Ie.remove(this._box),this._box=null),Ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new H(e,{originalEvent:t}))}},yO=fe(ge(),1);function Ep(e,t){if(e.length!==t.length)throw new Error("The number of touches and points are not equal - touches ".concat(e.length,", points ").concat(t.length));let i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}function gO(e){let t=new yO.default(0,0);for(let i of e)t._add(i);return t.div(e.length)}var t1=500,_O=500,Wd=30,xO=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=gO(t),this.touches=Ep(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let r=Ep(i,t);for(let n in this.touches){let a=this.touches[n],o=r[n];(!o||o.dist(a)>Wd)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>_O)&&(this.aborted=!0),i.length===0){let r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}},kp=class{constructor(e){this.singleTap=new xO(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let r=this.singleTap.touchend(e,t,i);if(r){let n=e.timeStamp-this.lastTime<t1,a=!this.lastTap||this.lastTap.dist(r)<Wd;if((!n||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},vO=class{constructor(e){this._tr=new ds(e),this._zoomIn=new kp({numTouches:1,numTaps:2}),this._zoomOut=new kp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i),a=this._tr;if(r)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:o=>o.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(r)},{originalEvent:e})};if(n)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:o=>o.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(n)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},bO=fe(ge(),1),Vu=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let r=Array.isArray(t)?t[0]:t;if(!(!this._moved&&r.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(i,r)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&Ie.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}},wO=0,PO=2,SO={[wO]:1,[PO]:2};function TO(e,t){let i=SO[t];return e.buttons===void 0||(e.buttons&i)!==i}var ju=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=Ie.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!TO(e,this._eventButton)}isValidEndEvent(e){return Ie.mouseButton(e)===this._eventButton}};var Hd=0,Kd=2,Uu=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};function MO({enable:e,clickTolerance:t}){let i=new ju({checkCorrectEvent:r=>Ie.mouseButton(r)===Hd&&!r.ctrlKey});return new Vu({clickTolerance:t,move:(r,n)=>({around:n,panDelta:n.sub(r)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:Uu})}function CO({enable:e,clickTolerance:t,aroundCenter:i=!0,minPixelCenterThreshold:r=100,rotateDegreesPerPixelMoved:n=.8},a){let o=new ju({checkCorrectEvent:s=>Ie.mouseButton(s)===Hd&&s.ctrlKey||Ie.mouseButton(s)===Kd&&!s.ctrlKey});return new Vu({clickTolerance:t,move:(s,l)=>{let u=a();if(i&&Math.abs(u.y-s.y)>r)return{bearingDelta:FC(new bO.default(s.x,l.y),l,u)};let h=(l.x-s.x)*n;return i&&l.y<u.y&&(h=-h),{bearingDelta:h}},moveStateManager:o,enable:e,assignEvents:Uu})}function IO({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){let r=new ju({checkCorrectEvent:n=>Ie.mouseButton(n)===Hd&&n.ctrlKey||Ie.mouseButton(n)===Kd});return new Vu({clickTolerance:t,move:(n,a)=>({pitchDelta:(a.y-n.y)*i}),moveStateManager:r,enable:e,assignEvents:Uu})}function AO({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){let n=new ju({checkCorrectEvent:a=>Ie.mouseButton(a)===Kd&&a.ctrlKey});return new Vu({clickTolerance:t,move:(a,o)=>{let s=r(),l=(o.x-a.x)*i;return o.y<s.y&&(l=-l),{rollDelta:l}},moveStateManager:n,enable:e,assignEvents:Uu})}var Ac=fe(ge(),1),EO=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Ac.default(0,0)}_shouldBePrevented(e){let t=this._map.cooperativeGestures.isEnabled()?2:1;return e<t}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(this._shouldBePrevented(i.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,i)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let r=Ep(i,t),n=new Ac.default(0,0),a=new Ac.default(0,0),o=0;for(let l in r){let u=r[l],h=this._touches[l];h&&(n._add(u),a._add(u.sub(h)),o++,r[l]=u)}if(this._touches=r,this._shouldBePrevented(o)||!a.mag())return;let s=a.div(o);return this._sum._add(s),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(o),panDelta:s}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Jd=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[r,n]=this._firstTwoTouches,a=Tl(i,t,r),o=Tl(i,t,n);if(!a||!o)return;let s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[r,n]=this._firstTwoTouches,a=Tl(i,t,r),o=Tl(i,t,n);a&&o||(this._active&&Ie.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function Tl(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}var kO=.1;function C_(e,t){return Math.log(e/t)/Math.LN2}var DO=class extends Jd{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(C_(this._distance,this._startDistance))<kO))return this._active=!0,{zoomDelta:C_(this._distance,i),pinchAround:t}}},LO=25;function I_(e,t){return e.angleWith(t)*180/Math.PI}var zO=class extends Jd{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:I_(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,i=LO/t*360,r=I_(e,this._startVector);return Math.abs(r)<i}};function Ec(e){return Math.abs(e.y)>Math.abs(e.x)}var RO=100,FO=class extends Jd{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,Ec(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(this._valid!==void 0)return this._valid;let r=2,n=e.mag()>=r,a=t.mag()>=r;if(!n&&!a)return;if(!n||!a)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<RO?void 0:!1;let o=e.y>0==t.y>0;return Ec(e)&&Ec(t)&&o}},BO={panStep:100,bearingStep:15,pitchStep:10},OO=class{constructor(e){this._tr=new ds(e);let t=BO;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:o=>{let s=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:NO,zoom:t?Math.round(s.zoom)+t*(e.shiftKey?2:1):s.zoom,bearing:s.bearing+i*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-n*this._panStep,-a*this._panStep],center:s.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function NO(e){return e*(2-e)}var A_=4.000244140625,VO=1/100,jO=1/450,UO=2,GO=5,XO=class{constructor(e,t){this._onTimeout=i=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)},this._map=e,this._tr=new ds(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=VO,this._wheelZoomRate=jO}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,i=Me.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,t!==0&&t%A_===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t=t/4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=Ie.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundCenter?this._aroundPoint=i.transform.locationToScreenPoint(de.convert(i.center)):this._aroundPoint=t,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let o=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=o),typeof this._targetZoom=="number"&&(this._targetZoom+=o)}if(this._delta!==0){let o=this._type==="wheel"&&Math.abs(this._delta)>A_?this._wheelZoomRate:this._defaultZoomRate,s=UO/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&s!==0&&(s=1/s);let l=typeof this._targetZoom!="number"?e.scale:qt(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),$t(l*s)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,i=this._startZoom,r=this._easing,n=!1,a;if(this._type==="wheel"&&i&&r){let o=Me.now()-this._lastWheelEventTime,s=Math.min((o+GO)/200,1),l=r(s);a=ht.number(i,t,l),s<1?this._frameId||(this._frameId=!0):n=!0}else a=t,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!n,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=Oc;if(this._prevEase){let i=this._prevEase,r=(Me.now()-i.start)/i.duration,n=i.easing(r+.01)-i.easing(r),a=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.27*.27-a*a);t=Np(a,o,.25,1)}return this._prevEase={start:Me.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},qO=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},$O=class{constructor(e){this._tr=new ds(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},ZO=class{constructor(){this._tap=new kp({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,i);else{let r=t[0],n=e.timeStamp-this._tapTime<t1,a=this._tapPoint.dist(r)<Wd;!n||!a?this.reset():i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier)}}touchmove(e,t,i){if(!this._tapTime)this._tap.touchmove(e,t,i);else if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}touchend(e,t,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},YO=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},WO=class{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},HO=class{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},KO=class{constructor(e,t){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=Ie.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(Ie.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new H("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},JO=fe(ge(),1),Ml=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate,QO=class extends H{};function kc(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var e4=class{constructor(e,t){this.handleWindowEvent=r=>{this.handleEvent(r,"".concat(r.type,"Window"))},this.handleEvent=(r,n)=>{if(r.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let a=r.type==="renderFrame"?void 0:r,o={needsRenderFrame:!1},s={},l={};for(let{handlerName:c,handler:p,allowed:d}of this._handlers){if(!p.isEnabled())continue;let f;if(this._blockedByActive(l,d,c))p.reset();else if(p[n||r.type]){if(OC(r,n||r.type)){let y=Ie.mousePos(this._map.getCanvas(),r);f=p[n||r.type](r,y)}else if(BC(r,n||r.type)){let y=r.touches,g=this._getMapTouches(y),_=Ie.touchPos(this._map.getCanvas(),g);f=p[n||r.type](r,_,g)}else NC(n||r.type)||(f=p[n||r.type](r));this.mergeHandlerResult(o,s,f,c,a),f&&f.needsRenderFrame&&this._triggerRenderFrame()}(f||p.isActive())&&(l[c]=p)}let u={};for(let c in this._previousActiveHandlers)l[c]||(u[c]=a);this._previousActiveHandlers=l,(Object.keys(u).length||kc(o))&&(this._changes.push([o,s,u]),this._triggerRenderFrame()),(Object.keys(l).length||kc(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=o;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new uO(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(let[r,n,a]of this._listeners)Ie.addEventListener(r,n,r===document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(let[e,t,i]of this._listeners)Ie.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new pO(t,e));let r=t.boxZoom=new mO(t,e);this._add("boxZoom",r),e.interactive&&e.boxZoom&&r.enable();let n=t.cooperativeGestures=new KO(t,e.cooperativeGestures);this._add("cooperativeGestures",n),e.cooperativeGestures&&n.enable();let a=new vO(t),o=new $O(t);t.doubleClickZoom=new qO(o,a),this._add("tapZoom",a),this._add("clickZoom",o),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let s=new ZO;this._add("tapDragZoom",s);let l=t.touchPitch=new FO(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>t.project(t.getCenter()),h=CO(e,u),c=IO(e),p=AO(e,u);t.dragRotate=new WO(e,h,c,p),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",p,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let d=MO(e),f=new EO(e,t);t.dragPan=new YO(i,d,f),this._add("mousePan",d),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let y=new zO,g=new DO;t.touchZoomRotate=new HO(i,g,y,s),this._add("touchRotate",y,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let _=t.scrollZoom=new XO(t,()=>this._triggerRenderFrame());this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let b=t.keyboard=new OO(t);this._add("keyboard",b),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new dO(t))}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ml(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let r=i.target;this._el.contains(r)&&t.push(i)}return t}mergeHandlerResult(e,t,i,r,n){if(!i)return;re(e,i);let a={handlerName:r,originalEvent:i.originalEvent||n};i.zoomDelta!==void 0&&(t.zoom=a),i.panDelta!==void 0&&(t.drag=a),i.rollDelta!==void 0&&(t.roll=a),i.pitchDelta!==void 0&&(t.pitch=a),i.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},i={};for(let[r,n,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new JO.default(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(e.rollDelta=(e.rollDelta||0)+r.rollDelta),r.around!==void 0&&(e.around=r.around),r.pinchAround!==void 0&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),re(t,n),re(i,a);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let r=this._map,n=r._getTransformForUpdate(),a=r.terrain;if(!kc(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:l,pitchDelta:u,rollDelta:h,around:c,pinchAround:p}=e;p!==void 0&&(c=p),c=c||r.transform.centerPoint,a&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let d={panDelta:o,zoomDelta:s,rollDelta:h,pitchDelta:u,bearingDelta:l,around:c};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let f=c.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(o?c.sub(o):c);a?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(d,n,f)):t.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(o))):this._map.cameraHelper.handleMapControlsPan(d,n,f)):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._map.cameraHelper.handleMapControlsPan(d,n,f)),r._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,t,i){let r=Ml(this._eventsInProgress),n=Ml(e),a={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(a["".concat(h,"start")]=c),this._eventsInProgress[h]=e[h]}!r&&n&&this._fireEvent("movestart",n.originalEvent);for(let h in a)this._fireEvent(h,a[h]);n&&this._fireEvent("move",n.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let o={},s;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:p}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],s=t[c]||p,o["".concat(h,"end")]=s)}for(let h in o)this._fireEvent(h,o[h]);let l=Ml(this._eventsInProgress),u=(r||n)&&!l;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let h=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(h)}if(i&&u){this._updatingCamera=!0;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),c=p=>p!==0&&-this._bearingSnap<p&&p<this._bearingSnap;h&&(h.essential||!Me.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:s})):(this._map.fire(new H("moveend",{originalEvent:s})),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new H(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new QO("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},xo=fe(ge(),1),t4=class extends ei{constructor(e,t,i){super(),this._renderFrameCallback=()=>{let r=Math.min((Me.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new de(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,i){return e=xo.default.convert(e).mult(-1),this.panTo(this.transform.center,re({offset:e},t),i)}panTo(e,t,i){return this.easeTo(re({center:e},t),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo(re({zoom:e},t),i)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new H("movestart",t)).fire(new H("move",t)).fire(new H("moveend",t))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,i){return this.easeTo(re({bearing:e},t),i)}resetNorth(e,t){return this.rotateTo(0,re({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(re({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=yr.convert(e).adjustAntiMeridian();let i=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,t,i,r){let n={top:0,bottom:0,right:0,left:0};if(r=re({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},r),typeof r.padding=="number"){let l=r.padding;r.padding={top:l,bottom:l,right:l,left:l}}let a=re(n,r.padding);r.padding=a;let o=this.transform,s=new yr(e,t);return this.cameraHelper.cameraForBoxAndBearing(r,a,s,i,o)}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,t,i,r,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(xo.default.convert(e)),this.transform.screenPointToLocation(xo.default.convert(t)),i,r),r,n)}_fitInternal(e,t,i){return e?(t=re(e,t),delete t.padding,t.linear?this.easeTo(t,i):this.flyTo(t,i)):this}jumpTo(e,t){this.stop();let i=this._getTransformForUpdate(),r=!1,n=!1,a=!1,o=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,e);let s=i.zoom!==o;return"elevation"in e&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),"bearing"in e&&i.bearing!==+e.bearing&&(r=!0,i.setBearing(+e.bearing)),"pitch"in e&&i.pitch!==+e.pitch&&(n=!0,i.setPitch(+e.pitch)),"roll"in e&&i.roll!==+e.roll&&(a=!0,i.setRoll(+e.roll)),e.padding!=null&&!i.isPaddingEqual(e.padding)&&i.setPadding(e.padding),this._applyUpdatedTransform(i),this.fire(new H("movestart",t)).fire(new H("move",t)),s&&this.fire(new H("zoomstart",t)).fire(new H("zoom",t)).fire(new H("zoomend",t)),r&&this.fire(new H("rotatestart",t)).fire(new H("rotate",t)).fire(new H("rotateend",t)),n&&this.fire(new H("pitchstart",t)).fire(new H("pitch",t)).fire(new H("pitchend",t)),a&&this.fire(new H("rollstart",t)).fire(new H("roll",t)).fire(new H("rollend",t)),this.fire(new H("moveend",t))}calculateCameraOptionsFromTo(e,t,i,r=0){let n=Ke.fromLngLat(e,t),a=Ke.fromLngLat(i,r),o=a.x-n.x,s=a.y-n.y,l=a.z-n.z,u=Math.hypot(o,s,l);if(u===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(o,s),c=$t(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=Math.atan2(o,-s)*180/Math.PI,d=Math.acos(h/u)*180/Math.PI;return d=l<0?90-d:90+d,{center:a.toLngLat(),elevation:r,zoom:c,pitch:d,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,n){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,r);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:i,pitch:r,roll:n}}easeTo(e,t){this._stop(!1,e.easeId),e=re({offset:[0,0],duration:500,easing:Oc},e),(e.animate===!1||!e.essential&&Me.prefersReducedMotion)&&(e.duration=0);let i=this._getTransformForUpdate(),r=this.getBearing(),n=i.pitch,a=i.roll,o="bearing"in e?this._normalizeBearing(e.bearing,r):r,s="pitch"in e?+e.pitch:n,l="roll"in e?this._normalizeBearing(e.roll,a):a,u="padding"in e?e.padding:i.padding,h=xo.default.convert(e.offset),c,p;e.around&&(c=de.convert(e.around),p=i.locationToScreenPoint(c));let d={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(i,{bearing:o,pitch:s,roll:l,padding:u,around:c,aroundPoint:p,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||r!==o,this._pitching=this._pitching||s!==n,this._rolling=this._rolling||l!==a,this._padding=!i.isPaddingEqual(u),this._zooming=this._zooming||f.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,d),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(y=>{f.easeFunc(y),this.terrain&&!e.freezeElevation&&this._updateElevation(y),this._applyUpdatedTransform(i),this._fireMoveEvents(t)},y=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,y)},e),this}_prepareEase(e,t,i={}){this._moving=!0,!t&&!i.moving&&this.fire(new H("movestart",e)),this._zooming&&!i.zooming&&this.fire(new H("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new H("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new H("pitchstart",e)),this._rolling&&!i.rolling&&this.fire(new H("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&t!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,r=(t-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-r),this._elevationTarget=t}this.transform.setElevation(ht.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){return{}}_applyUpdatedTransform(e){let t=[];if(t.push(r=>this._elevateCameraIfInsideTerrain(r)),this.transformCameraUpdate&&t.push(r=>this.transformCameraUpdate(r)),!t.length)return;let i=e.clone();for(let r of t){let n=i.clone(),{center:a,zoom:o,roll:s,pitch:l,bearing:u,elevation:h}=r(n);a&&n.setCenter(a),h!==void 0&&n.setElevation(h),o!==void 0&&n.setZoom(o),s!==void 0&&n.setRoll(s),l!==void 0&&n.setPitch(l),u!==void 0&&n.setBearing(u),i.apply(n)}this.transform.apply(i)}_fireMoveEvents(e){this.fire(new H("move",e)),this._zooming&&this.fire(new H("zoom",e)),this._rotating&&this.fire(new H("rotate",e)),this._pitching&&this.fire(new H("pitch",e)),this._rolling&&this.fire(new H("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let i=this._zooming,r=this._rotating,n=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new H("zoomend",e)),r&&this.fire(new H("rotateend",e)),n&&this.fire(new H("pitchend",e)),a&&this.fire(new H("rollend",e)),this.fire(new H("moveend",e))}flyTo(e,t){if(!e.essential&&Me.prefersReducedMotion){let D=rs(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(D,t)}this.stop(),e=re({offset:[0,0],speed:1.2,curve:1.42,easing:Oc},e);let i=this._getTransformForUpdate(),r=i.bearing,n=i.pitch,a=i.roll,o=i.padding,s="bearing"in e?this._normalizeBearing(e.bearing,r):r,l="pitch"in e?+e.pitch:n,u="roll"in e?this._normalizeBearing(e.roll,a):a,h="padding"in e?e.padding:i.padding,c=xo.default.convert(e.offset),p=i.centerPoint.add(c),d=i.screenPointToLocation(p),f=this.cameraHelper.handleFlyTo(i,{bearing:s,pitch:l,roll:u,padding:h,locationAtOffset:d,offsetAsPoint:c,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),y=e.curve,g=Math.max(i.width,i.height),_=g/f.scaleOfZoom,b=f.pixelPathLength;if(typeof f.scaleOfMinZoom=="number"){let D=g/f.scaleOfMinZoom;y=Math.sqrt(D/b*2)}let v=y*y;function w(D){let z=(_*_-g*g+(D?-1:1)*v*v*b*b)/(2*(D?_:g)*v*b);return Math.log(Math.sqrt(z*z+1)-z)}function P(D){return(Math.exp(D)-Math.exp(-D))/2}function S(D){return(Math.exp(D)+Math.exp(-D))/2}function C(D){return P(D)/S(D)}let E=w(!1),F=function(D){return S(E)/S(E+y*D)},B=function(D){return g*((S(E)*C(E+y*D)-P(E))/v)/b},R=(w(!0)-E)/y;if(Math.abs(b)<2e-6||!isFinite(R)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let D=_<g?-1:1;R=Math.abs(Math.log(_/g))/y,B=()=>0,F=z=>Math.exp(D*y*z)}if("duration"in e)e.duration=+e.duration;else{let D="screenSpeed"in e?+e.screenSpeed/y:+e.speed;e.duration=1e3*R/D}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==s,this._pitching=l!==n,this._rolling=u!==a,this._padding=!i.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(D=>{let z=D*R,x=1/F(z),T=B(z);this._rotating&&i.setBearing(ht.number(r,s,D)),this._pitching&&i.setPitch(ht.number(n,l,D)),this._rolling&&i.setRoll(ht.number(a,u,D)),this._padding&&(i.interpolatePadding(o,h,D),p=i.centerPoint.add(c)),f.easeFunc(D,x,T,p),this.terrain&&!e.freezeElevation&&this._updateElevation(D),this._applyUpdatedTransform(i),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,t)}return e||((i=this.handlers)==null||i.stop(!1)),this}_ease(e,t,i){i.animate===!1||i.duration===0?(e(1),t()):(this._easeStart=Me.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=An(e,-180,180);let i=Math.abs(e-t);return Math.abs(e-360-t)<i&&(e-=360),Math.abs(e+360-t)<i&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(de.convert(e),this.transform.tileZoom):null}},Kr=fe(ge(),1),i1={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},i4=class{constructor(e=i1){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"||t.dataType==="style"||t.type==="terrain")&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=Ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=Ie.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Ie.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){Ie.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let i=this._map._getUIString("AttributionControl.".concat(t));e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(r=>typeof r!="string"?"":r)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let r=this._map.style.stylesheet;this.styleOwner=r.owner,this.styleId=r.id}let t=this._map.style.sourceCaches;for(let r in t){let n=t[r];if(n.used||n.usedForTerrain){let a=n.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(r=>String(r).trim()),e.sort((r,n)=>r.length-n.length),e=e.filter((r,n)=>{for(let a=n+1;a<e.length;a++)if(e[a].indexOf(r)>=0)return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=Ie.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},r4=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=Ie.create("div","maplibregl-ctrl");let t=Ie.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){Ie.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},n4=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(let r of i)if(r.id===e){r.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},Dp=(e=>(e.create="create",e.load="load",e.fullLoad="fullLoad",e))(Dp||{}),Cl=null,vo=[],a4=60,Dc=1e3/a4,Lc="loadTime",zc="fullLoadTime",bo={mark(e){performance.mark(e)},frame(e){let t=e;if(Cl!=null){let i=t-Cl;vo.push(i)}Cl=t},clearMetrics(){Cl=null,vo=[],performance.clearMeasures(Lc),performance.clearMeasures(zc);for(let e in Dp)performance.clearMarks(Dp[e])},getPerformanceMetrics(){performance.measure(Lc,"create","load"),performance.measure(zc,"create","fullLoad");let e=performance.getEntriesByName(Lc)[0].duration,t=performance.getEntriesByName(zc)[0].duration,i=vo.length,r=1/(vo.reduce((o,s)=>o+s,0)/i/1e3),n=vo.filter(o=>o>Dc).reduce((o,s)=>o+(s-Dc)/Dc,0),a=n/(i+n)*100;return{loadTime:e,fullLoadTime:t,fps:r,percentDroppedFrames:a,totalFrames:i}}},o4=yt([{name:"a_pos3d",type:"Int16",components:3}]),s4=class extends ei{constructor(e){super(),this._lastTilesetChange=Me.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,t){this.sourceCache.update(e,t),this._renderableTilesKeys=[];let i={};for(let r of Ou(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))i[r.key]=!0,this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.terrainRttPosMatrix32f=new Float64Array(16),q.ortho(r.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[r.key]=new cb(r,this.tileSize),this._lastTilesetChange=Me.now());for(let r in this._tiles)i[r]||delete this._tiles[r]}freeRtt(e){for(let t in this._tiles){let i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let i of this._renderableTilesKeys){let r=this._tiles[i].tileID,n=e.clone(),a=nn();if(r.canonical.equals(e.canonical))q.ortho(a,0,8192,8192,0,0,1);else if(r.canonical.isChildOf(e.canonical)){let o=r.canonical.z-e.canonical.z,s=r.canonical.x-(r.canonical.x>>o<<o),l=r.canonical.y-(r.canonical.y>>o<<o),u=8192>>o;q.ortho(a,0,u,u,0,0,1),q.translate(a,a,[-s*u,-l*u,0])}else if(e.canonical.isChildOf(r.canonical)){let o=e.canonical.z-r.canonical.z,s=e.canonical.x-(e.canonical.x>>o<<o),l=e.canonical.y-(e.canonical.y>>o<<o),u=8192>>o;q.ortho(a,0,8192,8192,0,0,1),q.translate(a,a,[s*u,l*u,0]),q.scale(a,a,[1/2**o,1/2**o,0])}else continue;n.terrainRttPosMatrix32f=new Float32Array(a),t[i]=n}return t}_getTerrainCoordsForTileRanges(e,t){let i={};for(let r of this._renderableTilesKeys){let n=this._tiles[r].tileID;if(!this._isWithinTileRanges(n,t))continue;let a=e.clone(),o=nn();if(n.canonical.z===e.canonical.z){let s=e.canonical.x-n.canonical.x,l=e.canonical.y-n.canonical.y;q.ortho(o,0,8192,8192,0,0,1),q.translate(o,o,[s*8192,l*8192,0])}else if(n.canonical.z>e.canonical.z){let s=n.canonical.z-e.canonical.z,l=n.canonical.x-(n.canonical.x>>s<<s),u=n.canonical.y-(n.canonical.y>>s<<s),h=e.canonical.x-(n.canonical.x>>s),c=e.canonical.y-(n.canonical.y>>s),p=8192>>s;q.ortho(o,0,p,p,0,0,1),q.translate(o,o,[-l*p+h*8192,-u*p+c*8192,0])}else{let s=e.canonical.z-n.canonical.z,l=e.canonical.x-(e.canonical.x>>s<<s),u=e.canonical.y-(e.canonical.y>>s<<s),h=(e.canonical.x>>s)-n.canonical.x,c=(e.canonical.y>>s)-n.canonical.y,p=8192<<s;q.ortho(o,0,p,p,0,0,1),q.translate(o,o,[l*8192+h*p,u*8192+c*p,0])}a.terrainRttPosMatrix32f=new Float32Array(o),i[r]=a}return i}getSourceTile(e,t){let i=this.sourceCache._source,r=e.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(r).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(n&&n.dem)&&t)for(;r>=i.minzoom&&!(n&&n.dem);)n=this.sourceCache.getTileByID(e.scaledTo(r--).key);return n}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}},l4=class{constructor(e,t,i){this._meshCache={},this.painter=e,this.sourceCache=new s4(t),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,i,r=8192){var p;if(!(t>=0&&t<r&&i>=0&&i<r))return 0;let n=this.getTerrainData(e),a=(p=n.tile)==null?void 0:p.dem;if(!a)return 0;let o=Jt.transformMat4([],[t/r*8192,i/r*8192],n.u_terrain_matrix),s=[o[0]*a.dim,o[1]*a.dim],l=Math.floor(s[0]),u=Math.floor(s[1]),h=s[0]-l,c=s[1]-u;return a.get(l,u)*(1-h)*(1-c)+a.get(l+1,u)*h*(1-c)+a.get(l,u+1)*(1-h)*c+a.get(l+1,u+1)*h*c}getElevationForLngLatZoom(e,t){if(!TL(t,e.wrap()))return 0;let{tileID:i,mercatorX:r,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,r%8192,n%8192,8192)}getElevation(e,t,i,r=8192){return this.getDEMElevation(e,t,i,r)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let r=this.painter.context,n=new tt({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new vt(r,n,r.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new vt(r,new tt({width:1,height:1}),r.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=q.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let r=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new vt(r,t.dem.getPixels(),r.gl.RGBA,{premultiply:!1}),t.demTexture.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t&&t+t.tileID.key+e.key;if(i&&!this._demMatrixCache[i]){let r=this.sourceCache.sourceCache._source.maxzoom,n=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?n=e.canonical.z-r:Tt("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>n<<n),o=e.canonical.y-(e.canonical.y>>n<<n),s=q.fromScaling(new Float64Array(16),[1/(8192<<n),1/(8192<<n),0]);q.translate(s,s,[a*8192,o*8192,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:t&&t.dem&&t.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t&&t.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(e){let t=this.painter,i=t.width/devicePixelRatio,r=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==i||this._fbo.height!==r)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new vt(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new vt(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let n=0,a=0;n<this._coordsTextureSize;n++)for(let o=0;o<this._coordsTextureSize;o++,a+=4)t[a+0]=o&255,t[a+1]=n&255,t[a+2]=o>>8<<4|n>>8,t[a+3]=0;let i=new tt({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),r=new vt(e,i,e.gl.RGBA,{premultiply:!1});return r.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),i=this.painter.context,r=i.gl,n=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),o=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),r.readPixels(n,o-a-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null);let s=t[0]+(t[2]>>4<<8),l=t[1]+((t[2]&15)<<8),u=this.coordsIndex[255-t[3]],h=u&&this.sourceCache.getTileByID(u);if(!h)return null;let c=this._coordsTextureSize,p=(1<<h.tileID.canonical.z)*c;return new Ke((h.tileID.canonical.x*c+s)/p+h.tileID.wrap,(h.tileID.canonical.y*c+l)/p,this.getElevation(h.tileID,s,l,c))}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(e){var S;let t=((S=this.painter.style.projection)==null?void 0:S.transitionState)>0,i=t&&e.canonical.y===0,r=t&&e.canonical.y===(1<<e.canonical.z)-1,n="m_".concat(i?"n":"","_").concat(r?"s":"");if(this._meshCache[n])return this._meshCache[n];let a=this.painter.context,o=new ok,s=new qi,l=this.meshSize,u=8192/l,h=l*l;for(let C=0;C<=l;C++)for(let E=0;E<=l;E++)o.emplaceBack(E*u,C*u,0);for(let C=0;C<h;C+=l+1)for(let E=0;E<l;E++)s.emplaceBack(E+C,l+E+C+1,l+E+C+2),s.emplaceBack(E+C,l+E+C+2,E+C+1);let c=o.length,p=0,d=c+(l+1),f=(l+1)*l,y=i?rn:0,g=i?0:1,_=r?Cn:8192,b=r?0:1;for(let C=0;C<=l;C++)o.emplaceBack(C*u,y,g);for(let C=0;C<=l;C++)o.emplaceBack(C*u,_,b);for(let C=0;C<l;C++)s.emplaceBack(f+C,d+C,d+C+1),s.emplaceBack(f+C,d+C+1,f+C+1),s.emplaceBack(p+C,c+C+1,c+C),s.emplaceBack(p+C,p+C+1,c+C+1);let v=o.length,w=v+(l+1)*2;for(let C of[0,1])for(let E=0;E<=l;E++)for(let F of[0,1])o.emplaceBack(C*8192,E*u,F);for(let C=0;C<l*2;C+=2)s.emplaceBack(v+C,v+C+1,v+C+3),s.emplaceBack(v+C,v+C+3,v+C+2),s.emplaceBack(w+C,w+C+3,w+C+1),s.emplaceBack(w+C,w+C+2,w+C+3);let P=new za(a.createVertexBuffer(o,o4.members),a.createIndexBuffer(s),Qe.simpleSegment(0,0,o.length,s.length));return this._meshCache[n]=P,P}getMeshFrameDelta(e){return 2*Math.PI*sr/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){var r;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return(r=this.getMinMaxElevation(i).minElevation)!=null?r:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t){let i=Ke.fromLngLat(e.wrap()),r=(1<<t)*8192,n=i.x*r,a=i.y*r,o=Math.floor(n/8192),s=Math.floor(a/8192);return{tileID:new Vt(t,0,t,o,s),mercatorX:n,mercatorY:a}}},u4=class{constructor(e,t,i){this._context=e,this._size=t,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new vt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(i.texture),{id:e,fbo:t,texture:i,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return this._objects.length<this._size?!1:this._objects.some(e=>!e.inUse)===!1}},ra={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},h4=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new u4(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t)),this._coordsAscending={};for(let i in e.sourceCaches){this._coordsAscending[i]={};let r=e.sourceCaches[i].getVisibleCoordinates(),n=e.sourceCaches[i].getSource(),a=n instanceof cs?n.terrainTileRanges:null;for(let o of r){let s=this.terrain.sourceCache.getTerrainCoords(o,a);for(let l in s)this._coordsAscending[i][l]||(this._coordsAscending[i][l]=[]),this._coordsAscending[i][l].push(s[l])}}this._coordsAscendingStr={};for(let i of e._order){let r=e._layers[i],n=r.source;if(ra[r.type]&&!this._coordsAscendingStr[n]){this._coordsAscendingStr[n]={};for(let a in this._coordsAscending[n])this._coordsAscendingStr[n][a]=this._coordsAscending[n][a].map(o=>o.key).sort().join()}}for(let i of this._renderableTiles)for(let r in this._coordsAscendingStr){let n=this._coordsAscendingStr[r][i.tileID.key];n&&n!==i.rttCoords[r]&&(i.rtt=[])}}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let i=bi(zt({},t),{isRenderingToTexture:!0}),r=e.type,n=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ra[r]&&((!this._prevType||!ra[this._prevType])&&this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(ra[this._prevType]||ra[r]&&a){this._prevType=r;let o=this._stacks.length-1,s=this._stacks[o]||[];for(let l of this._renderableTiles){if(this.pool.isFull()&&(M_(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(l),l.rtt[o]){let h=this.pool.getObjectForId(l.rtt[o].id);if(h.stamp===l.rtt[o].stamp){this.pool.useObject(h);continue}}let u=this.pool.getOrCreateFreeObject();this.pool.useObject(u),this.pool.stampObject(u),l.rtt[o]={id:u.id,stamp:u.stamp},n.context.bindFramebuffer.set(u.fbo.framebuffer),n.context.clear({color:oe.transparent,stencil:0}),n.currentStencilSource=void 0;for(let h=0;h<s.length;h++){let c=n.style._layers[s[h]],p=c.source?this._coordsAscending[c.source][l.tileID.key]:[l.tileID];n.context.viewport.set([0,0,u.fbo.width,u.fbo.height]),n._renderTileClippingMasks(c,p,!0),n.renderLayer(n,n.style.sourceCaches[c.source],c,p,i),c.source&&(l.rttCoords[c.source]=this._coordsAscendingStr[c.source][l.tileID.key])}}return M_(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),ra[r]}return!1}},c4={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},p4=R_.version,jl=-2,r1=22,tn=0,n1=60,Il=180,E_={hash:!1,interactive:!0,bearingSnap:7,attributionControl:i1,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:jl,maxZoom:r1,minPitch:tn,maxPitch:n1,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:un.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},lU=class extends t4{constructor(e){var o,s;bo.mark("create");let t=bi(zt(zt({},E_),e),{canvasContextAttributes:zt(zt({},E_.canvasContextAttributes),e.canvasContextAttributes)});if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<tn)throw new Error("minPitch must be greater than or equal to ".concat(tn));if(t.maxPitch!=null&&t.maxPitch>Il)throw new Error("maxPitch must be less than or equal to ".concat(Il));let i=new tu,r=new iu;if(t.minZoom!==void 0&&i.setMinZoom(t.minZoom),t.maxZoom!==void 0&&i.setMaxZoom(t.maxZoom),t.minPitch!==void 0&&i.setMinPitch(t.minPitch),t.maxPitch!==void 0&&i.setMaxPitch(t.maxPitch),t.renderWorldCopies!==void 0&&i.setRenderWorldCopies(t.renderWorldCopies),super(i,r,{bearingSnap:t.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new n4,this._controls=[],this._mapId=V0(),this._contextLost=l=>{l.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new H("webglcontextlost",{originalEvent:l}))},this._contextRestored=l=>{this._setupPainter(),this.resize(),this._update(),this.fire(new H("webglcontextrestored",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes=zt({},t.canvasContextAttributes),this._trackResize=t.trackResize===!0,this._bearingSnap=t.bearingSnap,this._centerClampedToGround=t.centerClampedToGround,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale=zt(zt({},c4),t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=cr.addThrottleControl(()=>this.isMoving()),this._requestManager=new WC(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error("Container '".concat(t.container,"' not found."))}else if(t.container instanceof HTMLElement)this._container=t.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let l=!1,u=e1(h=>{this._trackResize&&!this._removed&&(this.resize(h),this.redraw())},50);this._resizeObserver=new ResizeObserver(h=>{if(!l){l=!0;return}u(h)}),this._resizeObserver.observe(this._container)}this.handlers=new e4(this,t);let n=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash&&new iO(n).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,re({},t.fitBoundsOptions,{duration:0}))));let a=typeof t.style=="string"||((s=(o=t.style)==null?void 0:o.projection)==null?void 0:s.type)!=="globe";this.resize(null,a),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new i4(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new r4,t.logoPosition),this.on("style.load",()=>{if(a||this._resizeTransform(),this.transform.unmodified){let l=rs(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(l)}}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new H("".concat(l.dataType,"data"),l))}),this.on("dataloading",l=>{this.fire(new H("".concat(l.dataType,"dataloading"),l))}),this.on("dataabort",l=>{this.fire(new H("sourcedataabort",l))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(e.getDefaultPosition?t=e.getDefaultPosition():t="top-right"),!e||!e.onAdd)return this.fire(new he(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let r=this._controlPositions[t];return t.indexOf("bottom")!==-1?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new he(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,i,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,t=!0){let[i,r]=this._containerDimensions(),n=this._getClampedPixelRatio(i,r);if(this._resizeCanvas(i,r,n),this.painter.resize(i,r,n),this.painter.overLimit()){let o=this.painter.context.gl;this._maxCanvasSize=[o.drawingBufferWidth,o.drawingBufferHeight];let s=this._getClampedPixelRatio(i,r);this._resizeCanvas(i,r,s),this.painter.resize(i,r,s)}this._resizeTransform(t);let a=!this._moving;return a&&(this.stop(),this.fire(new H("movestart",e)).fire(new H("move",e))),this.fire(new H("resize",e)),a&&this.fire(new H("moveend",e)),this}_resizeTransform(e=!0){var r;let[t,i]=this._containerDimensions();this.transform.resize(t,i,e),(r=this._requestedCameraState)==null||r.resize(t,i,e)}_getClampedPixelRatio(e,t){let{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),a=e*n,o=t*n,s=a>i?i/a:1,l=o>r?r/o:1;return Math.min(s,l)*n}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(yr.convert(e)),this._update()}setMinZoom(e){if(e=e!=null?e:jl,e>=jl&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between ".concat(jl," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if(e=e!=null?e:r1,e>=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if(e=e!=null?e:tn,e<tn)throw new Error("minPitch must be greater than or equal to ".concat(tn));if(e>=tn&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between ".concat(tn," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if(e=e!=null?e:n1,e>Il)throw new Error("maxPitch must be less than or equal to ".concat(Il));if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}project(e){return this.transform.locationToScreenPoint(de.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(Kr.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||((e=this.handlers)==null?void 0:e.isMoving())}isZooming(){var e;return this._zooming||((e=this.handlers)==null?void 0:e.isZooming())}isRotating(){var e;return this._rotating||((e=this.handlers)==null?void 0:e.isRotating())}_createDelegatedListener(e,t,i){if(e==="mouseenter"||e==="mouseover"){let r=!1;return{layers:t,listener:i,delegates:{mousemove:n=>{let a=t.filter(s=>this.getLayer(s)),o=a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[];o.length?r||(r=!0,i.call(this,new Mi(e,this,n.originalEvent,{features:o}))):r=!1},mouseout:()=>{r=!1}}}}else if(e==="mouseleave"||e==="mouseout"){let r=!1;return{layers:t,listener:i,delegates:{mousemove:n=>{let a=t.filter(o=>this.getLayer(o));(a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[]).length?r=!0:r&&(r=!1,i.call(this,new Mi(e,this,n.originalEvent)))},mouseout:n=>{r&&(r=!1,i.call(this,new Mi(e,this,n.originalEvent)))}}}}else{let r=n=>{let a=t.filter(s=>this.getLayer(s)),o=a.length!==0?this.queryRenderedFeatures(n.point,{layers:a}):[];o.length&&(n.features=o,i.call(this,n),delete n.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners||!this._delegatedListeners[e])return;let r=this._delegatedListeners[e];for(let n=0;n<r.length;n++){let a=r[n];if(a.listener===i&&a.layers.length===t.length&&a.layers.every(o=>t.includes(o))){for(let o in a.delegates)this.off(o,a.delegates[o]);r.splice(n,1);return}}}on(e,t,i){if(i===void 0)return super.on(e,t);let r=typeof t=="string"?[t]:t,n=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,n);for(let a in n.delegates)this.on(a,n.delegates[a]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(i===void 0)return super.once(e,t);let r=typeof t=="string"?[t]:t,n=this._createDelegatedListener(e,r,i);for(let a in n.delegates){let o=n.delegates[a];n.delegates[a]=(...s)=>{this._removeDelegatedListener(e,r,i),o(...s)}}this._saveDelegatedListener(e,n);for(let a in n.delegates)this.once(a,n.delegates[a]);return this}off(e,t,i){if(i===void 0)return super.off(e,t);let r=typeof t=="string"?[t]:t;return this._removeDelegatedListener(e,r,i),this}queryRenderedFeatures(e,t){if(!this.style)return[];let i,r=e instanceof Kr.default||Array.isArray(e),n=r?e:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(r?{}:e)||{},n instanceof Kr.default||typeof n[0]=="number")i=[Kr.default.convert(n)];else{let a=Kr.default.convert(n[0]),o=Kr.default.convert(n[1]);i=[a,new Kr.default(o.x,a.y),o,new Kr.default(a.x,o.y),a]}return this.style.queryRenderedFeatures(i,t,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=re({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw new Error("Missing UI string '".concat(e,"'"));return t}_updateStyle(e,t){var r,n;if(t.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t));return}let i=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new g_(this,t||{});else return(n=(r=this.style)==null?void 0:r.projection)==null||n.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,t,i):this.style.loadJSON(e,t,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new g_(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,t){if(typeof e=="string"){let i=e,r=this._requestManager.transformRequest(i,"Style");hu(r,new AbortController).then(n=>{this._updateDiff(n.data,t)}).catch(n=>{n&&this.fire(new he(n))})}else typeof e=="object"&&this._updateDiff(e,t)}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(i){Tt("Unable to perform style diff: ".concat(i.message||i.error||i,". Rebuilding the style from scratch.")),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():Tt("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style&&this.style.sourceCaches[e];if(t===void 0){this.fire(new he(new Error("There is no source with ID '".concat(e,"'"))));return}return t.loaded()}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this._centerClampedToGround&&this.transform.setElevation(0);else{let t=this.style.sourceCaches[e.source];if(!t)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(e.source));this.terrain===null&&t.reload();for(let i in this.style._layers){let r=this.style._layers[i];r.type==="hillshade"&&r.source===e.source&&Tt("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),r.type==="color-relief"&&r.source===e.source&&Tt("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new l4(this.painter,t,e),this.painter.renderToTexture=new h4(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var r;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId===e.source&&!this._elevationFreeze&&(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((r=i.source)==null?void 0:r.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new H("terrain",{terrain:e})),this}getTerrain(){var e,t;return(t=(e=this.terrain)==null?void 0:e.options)!=null?t:null}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let t in e){let i=e[t]._tiles;for(let r in i){let n=i[r];if(!(n.state==="loaded"||n.state==="errored"))return!1}}return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let r=this.getSource(i);if(!r)throw new Error('There is no source with ID "'.concat(i,'", cannot set LOD parameters'));r.calculateTileZoom=Pp(Math.max(1,e),Math.max(1,t))}else for(let r in this.style.sourceCaches)this.style.sourceCaches[r].getSource().calculateTileZoom=Pp(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let i=this.style.sourceCaches[e];if(!i)throw new Error('There is no source cache with ID "'.concat(e,'", cannot refresh tile'));t===void 0?i.reload(!0):i.refreshTiles(t.map(r=>new Fu(r.z,r.x,r.y)))}addImage(e,t,i={}){let{pixelRatio:r=1,sdf:n=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u}=i;this._lazyInitEmptyStyle();let h=0;if(t instanceof HTMLImageElement||Fr(t)){let{width:c,height:p,data:d}=Me.getImageData(t);this.style.addImage(e,{data:new tt({width:c,height:p},d),pixelRatio:r,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:h})}else{if(t.width===void 0||t.height===void 0)return this.fire(new he(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:c,height:p,data:d}=t,f=t;return this.style.addImage(e,{data:new tt({width:c,height:p},new Uint8Array(d)),pixelRatio:r,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:h,userImage:f}),f.onAdd&&f.onAdd(this,e),this}}}updateImage(e,t){let i=this.style.getImage(e);if(!i)return this.fire(new he(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let r=t instanceof HTMLImageElement||Fr(t)?Me.getImageData(t):t,{width:n,height:a,data:o}=r;if(n===void 0||a===void 0)return this.fire(new he(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(n!==i.data.width||a!==i.data.height)return this.fire(new he(new Error("The width and height of the updated image must be that same as the previous version of the image")));let s=!(t instanceof HTMLImageElement||Fr(t));return i.data.replace(o,s),this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new he(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return cr.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,r=>{r||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,i=>{i||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=Ie.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=Ie.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);let n=this._controlContainer=Ie.create("div","maplibregl-control-container",e),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(o=>{a[o]=Ie.create("div","maplibregl-ctrl-".concat(o," "),n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width="".concat(e,"px"),this._canvas.style.height="".concat(t,"px")}_setupPainter(){let e=bi(zt({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{t={requestedAttributes:e},r&&(t.statusMessage=r.statusMessage,t.type=r.type)},{once:!0});let i=null;if(this._canvasContextAttributes.contextType?i=this._canvas.getContext(this._canvasContextAttributes.contextType,e):i=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){let r="Failed to initialize WebGL";throw t?(t.message=r,new Error(JSON.stringify(t))):new Error(r)}this.painter=new tO(i,this.transform),Gp.testSupport(i)}migrateProjection(e,t){super.migrateProjection(e,t),this.painter.transform=e,this.fire(new H("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var o,s,l,u,h;let t=this._idleTriggered?this._fadeDuration:0,i=((o=this.style.projection)==null?void 0:o.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let c=this.transform.zoom,p=Me.now();this.style.zoomHistory.update(c,p);let d=new bt(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),f=d.crossFadingFactor();(f!==1||f!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=f),this.style.update(d)}let n=((s=this.style.projection)==null?void 0:s.transitionState)>0!==i;(l=this.style.projection)==null||l.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((u=this.style.projection)==null?void 0:u.transitionState,(h=this.style.projection)==null?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||n)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):this._centerClampedToGround&&this.transform.setElevation(0),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,n),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new H("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,bo.mark("load"),this.fire(new H("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new H("idle")),this._loaded&&!this._fullyLoaded&&!a&&(this._fullyLoaded=!0,bo.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),cr.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)==null||t.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),Ie.remove(this._canvasContainer),Ie.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),bo.clearMetrics(),this._removed=!0,this.fire(new H("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Me.frame(this._frameRequest,e=>{bo.frame(e),this._frameRequest=null;try{this._render(e)}catch(t){if(!VC(t)&&!hB(t))throw t}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return p4}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},uU=fe(ge(),1);var hU=fe(ge(),1);var cU=fe(ge(),1);var pU=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var d4=fe(ge(),1),dU=R_.version;function fU(e){un.WORKER_URL=e}var mU=d4.default;O();var v$={top:0,bottom:0,left:0,right:0,type:"pixel"},fs={enabled:!1,thickness:0,size:0,offset:0,segments:3};function b$(e,t){var i,r,n,a,o;return{bevelEnabled:(i=e==null?void 0:e.enabled)!=null?i:fs.enabled,bevelThickness:(r=e==null?void 0:e.thickness)!=null?r:fs.thickness,bevelSize:(n=e==null?void 0:e.size)!=null?n:(e==null?void 0:e.thickness)||fs.size,bevelOffset:(a=e==null?void 0:e.offset)!=null?a:fs.offset,bevelSegments:(o=e==null?void 0:e.segments)!=null?o:fs.segments,depth:t}}var a1="mappedin";var o1={MASKS:12,GEOMETRY:0,IMAGE_MESH:1,XRAY_PATH:9,STENCIL_PATH:10,ALWAYS_ON_TOP_PATHS:11,ALWAYS_ON_TOP_MODELS:12},w$={SHOULD_CAST_SHADOWS:30},P$={PATH:1,UNDERGROUND_MASK:251,CLIPPING_BASELINE:252},S$=250,T$={tension:0,cornerRadius:.5};O();function f4(e,t,i){let r={translateX:e.x,translateY:e.y,translateZ:e.z,scale:e.meterInMercatorCoordinateUnits()},n=new Ir,a=new Ir().makeTranslation(r.translateX,r.translateY,r.translateZ).scale(new We(r.scale,-r.scale,r.scale));return{id:a1,type:"custom",renderingMode:"3d",render:(o,s)=>{n.fromArray(s.defaultProjectionData.mainMatrix),t.projectionMatrix.copy(n).multiply(a),i()}}}O();function m4(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}O();var y4=e=>t=>{if(!t.includes("mappedin")){let i={};for(let r in e){let n=e[r];t.includes("mappedin")||(e[r]=n)}return{url:t,headers:i}}return{url:t,headers:e}};O();function Gu(e){return(e%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}O();var g4=1e4;function _4(e,t){var n;let i=(n=t==null?void 0:t.timeout)!=null?n:g4,r=t==null?void 0:t.styleUrl;return new Promise((a,o)=>{let s=!1,l=()=>{e.off("style.load",u),e.off("error",h),clearTimeout(c)},u=()=>{s||(s=!0,l(),a())},h=p=>{var y,g;let d=(y=p.error)==null?void 0:y.url;if((d==null?void 0:d.includes("style"))||r&&d===r){if(s)return;s=!0,l(),o(new Error("Style loading failed: ".concat(((g=p.error)==null?void 0:g.message)||"Unknown error")))}},c=setTimeout(()=>{s||(s=!0,l(),o(new Error("Style loading timed out")))},i);e.once("style.load",u),e.on("error",h)})}O();O();O();O();O();O();O();O();var Zt=63710088e-1,l1={centimeters:Zt*100,centimetres:Zt*100,degrees:Zt/111325,feet:Zt*3.28084,inches:Zt*39.37,kilometers:Zt/1e3,kilometres:Zt/1e3,meters:Zt,metres:Zt,miles:Zt/1609.344,millimeters:Zt*1e3,millimetres:Zt*1e3,nauticalmiles:Zt/1852,radians:1,yards:Zt*1.0936},U$={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Zt,yards:1.0936133};function dn(e,t,i){i===void 0&&(i={});var r={type:"Feature"};return(i.id===0||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function x4(e,t,i){if(i===void 0&&(i={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!s1(e[0])||!s1(e[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:e};return dn(r,t,i)}function G$(e,t,i){i===void 0&&(i={});for(var r=0,n=e;r<n.length;r++){var a=n[r];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var o=0;o<a[a.length-1].length;o++)if(a[a.length-1][o]!==a[0][o])throw new Error("First and last Position are not equivalent.")}var s={type:"Polygon",coordinates:e};return dn(s,t,i)}function u1(e,t,i){if(i===void 0&&(i={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var r={type:"LineString",coordinates:e};return dn(r,t,i)}function X$(e,t){t===void 0&&(t={});var i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function q$(e,t,i){i===void 0&&(i={});var r={type:"MultiLineString",coordinates:e};return dn(r,t,i)}function $$(e,t,i){i===void 0&&(i={});var r={type:"MultiPolygon",coordinates:e};return dn(r,t,i)}function Z$(e,t){t===void 0&&(t="kilometers");var i=l1[t];if(!i)throw new Error(t+" units is invalid");return e*i}function Y$(e,t){t===void 0&&(t="kilometers");var i=l1[t];if(!i)throw new Error(t+" units is invalid");return e/i}function W$(e){var t=e%(2*Math.PI);return t*180/Math.PI}function H$(e){var t=e%360;return t*Math.PI/180}function s1(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Xu(e,t,i){if(e!==null)for(var r,n,a,o,s,l,u,h=0,c=0,p,d=e.type,f=d==="FeatureCollection",y=d==="Feature",g=f?e.features.length:1,_=0;_<g;_++){u=f?e.features[_].geometry:y?e.geometry:e,p=u?u.type==="GeometryCollection":!1,s=p?u.geometries.length:1;for(var b=0;b<s;b++){var v=0,w=0;if(o=p?u.geometries[b]:u,o!==null){l=o.coordinates;var P=o.type;switch(h=i&&(P==="Polygon"||P==="MultiPolygon")?1:0,P){case null:break;case"Point":if(t(l,c,_,v,w)===!1)return!1;c++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(t(l[r],c,_,v,w)===!1)return!1;c++,P==="MultiPoint"&&v++}P==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-h;n++){if(t(l[r][n],c,_,v,w)===!1)return!1;c++}P==="MultiLineString"&&v++,P==="Polygon"&&w++}P==="Polygon"&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(w=0,n=0;n<l[r].length;n++){for(a=0;a<l[r][n].length-h;a++){if(t(l[r][n][a],c,_,v,w)===!1)return!1;c++}w++}v++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(Xu(o.geometries[r],t,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function t7(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var i=0;i<e.features.length&&t(e.features[i],i)!==!1;i++);}function v4(e,t){var i,r,n,a,o,s,l,u,h,c,p=0,d=e.type==="FeatureCollection",f=e.type==="Feature",y=d?e.features.length:1;for(i=0;i<y;i++){for(s=d?e.features[i].geometry:f?e.geometry:e,u=d?e.features[i].properties:f?e.properties:{},h=d?e.features[i].bbox:f?e.bbox:void 0,c=d?e.features[i].id:f?e.id:void 0,l=s?s.type==="GeometryCollection":!1,o=l?s.geometries.length:1,n=0;n<o;n++){if(a=l?s.geometries[n]:s,a===null){if(t(null,p,u,h,c)===!1)return!1;continue}switch(a.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(a,p,u,h,c)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<a.geometries.length;r++)if(t(a.geometries[r],p,u,h,c)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}p++}}function b4(e,t){v4(e,function(i,r,n,a,o){var s=i===null?null:i.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(dn(i,n,{bbox:a,id:o}),r,0)===!1?!1:void 0}var l;switch(s){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var u=0;u<i.coordinates.length;u++){var h=i.coordinates[u],c={type:l,coordinates:h};if(t(dn(c,n),r,u)===!1)return!1}})}function w4(e,t){b4(e,function(i,r,n){var a=0;if(i.geometry){var o=i.geometry.type;if(!(o==="Point"||o==="MultiPoint")){var s,l=0,u=0,h=0;if(Xu(i,function(c,p,d,f,y){if(s===void 0||r>l||f>u||y>h){s=c,l=r,u=f,h=y,a=0;return}var g=u1([s,c],i.properties);if(t(g,r,n,y,a)===!1)return!1;a++,s=c})===!1)return!1}}})}function i7(e,t,i){var r=i,n=!1;return w4(e,function(a,o,s,l,u){n===!1&&i===void 0?r=a:r=t(r,a,o,s,l,u),n=!0}),r}function Qd(e){var t=[1/0,1/0,-1/0,-1/0];return Xu(e,function(i){t[0]>i[0]&&(t[0]=i[0]),t[1]>i[1]&&(t[1]=i[1]),t[2]<i[0]&&(t[2]=i[0]),t[3]<i[1]&&(t[3]=i[1])}),t}Qd.default=Qd;var h1=Qd;function c1(e){return h1(e)}O();O();var P4=new Set(Object.keys(Ri.NAMES));var S4=e=>P4.has(e.toLowerCase()),T4=e=>{if(!e.startsWith("#"))return!1;let t=e.slice(1);if(t.length!==3&&t.length!==6)return!1;for(let i=0;i<t.length;i++)if(!(t[i]>="0"&&t[i]<="9"||t[i]>="A"&&t[i]<="F"||t[i]>="a"&&t[i]<="f"))return!1;return!0},M4=e=>{if(!e.startsWith("rgb(")&&!e.startsWith("rgba("))return!1;let t=e.indexOf("("),i=e.lastIndexOf(")");if(t===-1||i===-1||i<=t||i!==e.length-1)return!1;let r=e.slice(t+1,i).split(",");if(r.length!==3&&r.length!==4)return!1;for(let n=0;n<r.length;n++){let a=r[n].trim();if(n<3)if(a.endsWith("%")){let o=parseFloat(a.slice(0,-1));if(isNaN(o)||o<0||o>100)return!1}else{let o=parseInt(a,10);if(isNaN(o)||o<0||o>255)return!1}else{let o=parseFloat(a);if(isNaN(o)||o<0||o>1)return!1}}return!0},C4=e=>{if(!e.startsWith("hsl(")&&!e.startsWith("hsla("))return!1;let t=e.indexOf("("),i=e.lastIndexOf(")");if(t===-1||i===-1||i<=t||i!==e.length-1)return!1;let r=e.slice(t+1,i).split(",");if(r.length!==3&&r.length!==4)return!1;for(let n=0;n<r.length;n++){let a=r[n].trim();if(n===0){let o=parseFloat(a);if(isNaN(o))return!1}else if(n<3){if(!a.endsWith("%"))return!1;let o=parseFloat(a.slice(0,-1));if(isNaN(o)||o<0||o>100)return!1}else{let o=parseFloat(a);if(isNaN(o)||o<0||o>1)return!1}}return!0};var qu=e=>e==null||typeof e!="string"?!1:!!(T4(e)||M4(e)||C4(e)||S4(e));O();O();O();O();var Ra=class{constructor(){k(this,"type","interaction");k(this,"hover",!1);k(this,"dirty",!1)}};O();import{z as tf}from"zod";import{z as Be}from"zod";var I4=Object.create,ih=Object.defineProperty,A4=Object.getOwnPropertyDescriptor,E4=Object.getOwnPropertyNames,p1=Object.getOwnPropertySymbols,k4=Object.getPrototypeOf,g1=Object.prototype.hasOwnProperty,D4=Object.prototype.propertyIsEnumerable,_1=e=>{throw TypeError(e)},rf=(e,t,i)=>t in e?ih(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,x1=(e,t)=>{for(var i in t||(t={}))g1.call(t,i)&&rf(e,i,t[i]);if(p1)for(var i of p1(t))D4.call(t,i)&&rf(e,i,t[i]);return e},A=(e,t)=>ih(e,"name",{value:t,configurable:!0}),L4=(e,t)=>()=>(e&&(t=e(e=0)),t),z4=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),R4=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of E4(t))!g1.call(e,n)&&n!==i&&ih(e,n,{get:()=>t[n],enumerable:!(r=A4(t,n))||r.enumerable});return e},F4=(e,t,i)=>(i=e!=null?I4(k4(e)):{},R4(t||!e||!e.__esModule?ih(i,"default",{value:e,enumerable:!0}):i,e)),N=(e,t,i)=>rf(e,typeof t!="symbol"?t+"":t,i),bf=(e,t,i)=>t.has(e)||_1("Cannot "+i),G=(e,t,i)=>(bf(e,t,"read from private field"),i?i.call(e):t.get(e)),Ge=(e,t,i)=>t.has(e)?_1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),_e=(e,t,i,r)=>(bf(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),nf=(e,t,i)=>(bf(e,t,"access private method"),i),B4=(e,t,i,r)=>({set _(n){_e(e,t,n,i)},get _(){return G(e,t,r)}}),v1,Ce=L4(()=>{v1={env:{NODE_ENV:"production",npm_package_version:"0.1.0"}}}),O4=z4((e,t)=>{Ce();var i=200,r="__lodash_hash_undefined__",n=800,a=16,o=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",h="[object Boolean]",c="[object Date]",p="[object Error]",d="[object Function]",f="[object GeneratorFunction]",y="[object Map]",g="[object Number]",_="[object Null]",b="[object Object]",v="[object Proxy]",w="[object RegExp]",P="[object Set]",S="[object String]",C="[object Undefined]",E="[object WeakMap]",F="[object ArrayBuffer]",B="[object DataView]",R="[object Float32Array]",D="[object Float64Array]",z="[object Int8Array]",x="[object Int16Array]",T="[object Int32Array]",I="[object Uint8Array]",U="[object Uint8ClampedArray]",X="[object Uint16Array]",Z="[object Uint32Array]",ie=/[\\^$.*+?()[\]{}|]/g,pe=/^\[object .+?Constructor\]$/,je=/^(?:0|[1-9]\d*)$/,le={};le[R]=le[D]=le[z]=le[x]=le[T]=le[I]=le[U]=le[X]=le[Z]=!0,le[s]=le[l]=le[F]=le[h]=le[B]=le[c]=le[p]=le[d]=le[y]=le[g]=le[b]=le[w]=le[P]=le[S]=le[E]=!1;var Oe=typeof global=="object"&&global&&global.Object===Object&&global,qe=typeof self=="object"&&self&&self.Object===Object&&self,gt=Oe||qe||Function("return this")(),kt=typeof e=="object"&&e&&!e.nodeType&&e,Dt=kt&&typeof t=="object"&&t&&!t.nodeType&&t,jt=Dt&&Dt.exports===kt,yi=jt&&Oe.process,Lt=(function(){try{var M=Dt&&Dt.require&&Dt.require("util").types;return M||yi&&yi.binding&&yi.binding("util")}catch(L){}})(),xn=Lt&&Lt.isTypedArray;function Cr(M,L,j){switch(j.length){case 0:return M.call(L);case 1:return M.call(L,j[0]);case 2:return M.call(L,j[0],j[1]);case 3:return M.call(L,j[0],j[1],j[2])}return M.apply(L,j)}A(Cr,"apply");function Hi(M,L){for(var j=-1,ne=Array(M);++j<M;)ne[j]=L(j);return ne}A(Hi,"baseTimes");function gi(M){return function(L){return M(L)}}A(gi,"baseUnary");function Ki(M,L){return M==null?void 0:M[L]}A(Ki,"getValue");function _i(M,L){return function(j){return M(L(j))}}A(_i,"overArg");var Ht=Array.prototype,Ut=Function.prototype,xi=Object.prototype,Ot=gt["__core-js_shared__"],pt=Ut.toString,et=xi.hasOwnProperty,Gt=(function(){var M=/[^.]+$/.exec(Ot&&Ot.keys&&Ot.keys.IE_PROTO||"");return M?"Symbol(src)_1."+M:""})(),Ct=xi.toString,Wa=pt.call(Object),Ah=RegExp("^"+pt.call(et).replace(ie,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Qn=jt?gt.Buffer:void 0,Ls=gt.Symbol,zs=gt.Uint8Array,Rs=Qn?Qn.allocUnsafe:void 0,Ji=_i(Object.getPrototypeOf,Object),Ha=Object.create,Fs=xi.propertyIsEnumerable,Bs=Ht.splice,Li=Ls?Ls.toStringTag:void 0,vn=(function(){try{var M=Vs(Object,"defineProperty");return M({},"",{}),M}catch(L){}})(),Ka=Qn?Qn.isBuffer:void 0,em=Math.max,E2=Date.now,tm=Vs(gt,"Map"),Ja=Vs(Object,"create"),k2=(function(){function M(){}return A(M,"object"),function(L){if(!Zr(L))return{};if(Ha)return Ha(L);M.prototype=L;var j=new M;return M.prototype=void 0,j}})();function $r(M){var L=-1,j=M==null?0:M.length;for(this.clear();++L<j;){var ne=M[L];this.set(ne[0],ne[1])}}A($r,"Hash");function im(){this.__data__=Ja?Ja(null):{},this.size=0}A(im,"hashClear");function rm(M){var L=this.has(M)&&delete this.__data__[M];return this.size-=L?1:0,L}A(rm,"hashDelete");function nm(M){var L=this.__data__;if(Ja){var j=L[M];return j===r?void 0:j}return et.call(L,M)?L[M]:void 0}A(nm,"hashGet");function am(M){var L=this.__data__;return Ja?L[M]!==void 0:et.call(L,M)}A(am,"hashHas");function om(M,L){var j=this.__data__;return this.size+=this.has(M)?0:1,j[M]=Ja&&L===void 0?r:L,this}A(om,"hashSet"),$r.prototype.clear=im,$r.prototype.delete=rm,$r.prototype.get=nm,$r.prototype.has=am,$r.prototype.set=om;function Qi(M){var L=-1,j=M==null?0:M.length;for(this.clear();++L<j;){var ne=M[L];this.set(ne[0],ne[1])}}A(Qi,"ListCache");function sm(){this.__data__=[],this.size=0}A(sm,"listCacheClear");function lm(M){var L=this.__data__,j=Qa(L,M);if(j<0)return!1;var ne=L.length-1;return j==ne?L.pop():Bs.call(L,j,1),--this.size,!0}A(lm,"listCacheDelete");function um(M){var L=this.__data__,j=Qa(L,M);return j<0?void 0:L[j][1]}A(um,"listCacheGet");function hm(M){return Qa(this.__data__,M)>-1}A(hm,"listCacheHas");function cm(M,L){var j=this.__data__,ne=Qa(j,M);return ne<0?(++this.size,j.push([M,L])):j[ne][1]=L,this}A(cm,"listCacheSet"),Qi.prototype.clear=sm,Qi.prototype.delete=lm,Qi.prototype.get=um,Qi.prototype.has=hm,Qi.prototype.set=cm;function bn(M){var L=-1,j=M==null?0:M.length;for(this.clear();++L<j;){var ne=M[L];this.set(ne[0],ne[1])}}A(bn,"MapCache");function pm(){this.size=0,this.__data__={hash:new $r,map:new(tm||Qi),string:new $r}}A(pm,"mapCacheClear");function dm(M){var L=to(this,M).delete(M);return this.size-=L?1:0,L}A(dm,"mapCacheDelete");function fm(M){return to(this,M).get(M)}A(fm,"mapCacheGet");function mm(M){return to(this,M).has(M)}A(mm,"mapCacheHas");function ym(M,L){var j=to(this,M),ne=j.size;return j.set(M,L),this.size+=j.size==ne?0:1,this}A(ym,"mapCacheSet"),bn.prototype.clear=pm,bn.prototype.delete=dm,bn.prototype.get=fm,bn.prototype.has=mm,bn.prototype.set=ym;function wn(M){var L=this.__data__=new Qi(M);this.size=L.size}A(wn,"Stack");function gm(){this.__data__=new Qi,this.size=0}A(gm,"stackClear");function _m(M){var L=this.__data__,j=L.delete(M);return this.size=L.size,j}A(_m,"stackDelete");function xm(M){return this.__data__.get(M)}A(xm,"stackGet");function vm(M){return this.__data__.has(M)}A(vm,"stackHas");function bm(M,L){var j=this.__data__;if(j instanceof Qi){var ne=j.__data__;if(!tm||ne.length<i-1)return ne.push([M,L]),this.size=++j.size,this;j=this.__data__=new bn(ne)}return j.set(M,L),this.size=j.size,this}A(bm,"stackSet"),wn.prototype.clear=gm,wn.prototype.delete=_m,wn.prototype.get=xm,wn.prototype.has=vm,wn.prototype.set=bm;function wm(M,L){var j=Rh(M),ne=!j&&zh(M),Re=!j&&!ne&&Zm(M),Ye=!j&&!ne&&!Re&&Wm(M),st=j||ne||Re||Ye,De=st?Hi(M.length,String):[],lt=De.length;for(var vi in M)(L||et.call(M,vi))&&!(st&&(vi=="length"||Re&&(vi=="offset"||vi=="parent")||Ye&&(vi=="buffer"||vi=="byteLength"||vi=="byteOffset")||Dh(vi,lt)))&&De.push(vi);return De}A(wm,"arrayLikeKeys");function Os(M,L,j){(j!==void 0&&!io(M[L],j)||j===void 0&&!(L in M))&&Ns(M,L,j)}A(Os,"assignMergeValue");function Pm(M,L,j){var ne=M[L];(!(et.call(M,L)&&io(ne,j))||j===void 0&&!(L in M))&&Ns(M,L,j)}A(Pm,"assignValue");function Qa(M,L){for(var j=M.length;j--;)if(io(M[j][0],L))return j;return-1}A(Qa,"assocIndexOf");function Ns(M,L,j){L=="__proto__"&&vn?vn(M,L,{configurable:!0,enumerable:!0,value:j,writable:!0}):M[L]=j}A(Ns,"baseAssignValue");var D2=Rm();function eo(M){return M==null?M===void 0?C:_:Li&&Li in Object(M)?Fm(M):Um(M)}A(eo,"baseGetTag");function Eh(M){return ea(M)&&eo(M)==s}A(Eh,"baseIsArguments");function Sm(M){if(!Zr(M)||Vm(M))return!1;var L=Gs(M)?Ah:pe;return L.test(qm(M))}A(Sm,"baseIsNative");function Tm(M){return ea(M)&&Fh(M.length)&&!!le[eo(M)]}A(Tm,"baseIsTypedArray");function Mm(M){if(!Zr(M))return jm(M);var L=Lh(M),j=[];for(var ne in M)ne=="constructor"&&(L||!et.call(M,ne))||j.push(ne);return j}A(Mm,"baseKeysIn");function kh(M,L,j,ne,Re){M!==L&&D2(L,function(Ye,st){if(Re||(Re=new wn),Zr(Ye))Cm(M,L,st,j,kh,ne,Re);else{var De=ne?ne(js(M,st),Ye,st+"",M,L,Re):void 0;De===void 0&&(De=Ye),Os(M,st,De)}},Bh)}A(kh,"baseMerge");function Cm(M,L,j,ne,Re,Ye,st){var De=js(M,j),lt=js(L,j),vi=st.get(lt);if(vi){Os(M,j,vi);return}var ai=Ye?Ye(De,lt,j+"",M,L,st):void 0,ro=ai===void 0;if(ro){var Nh=Rh(lt),Vh=!Nh&&Zm(lt),Qm=!Nh&&!Vh&&Wm(lt);ai=lt,Nh||Vh||Qm?Rh(De)?ai=De:$m(De)?ai=Dm(De):Vh?(ro=!1,ai=Am(lt,!0)):Qm?(ro=!1,ai=km(lt,!0)):ai=[]:Ym(lt)||zh(lt)?(ai=De,zh(De)?ai=Hm(De):(!Zr(De)||Gs(De))&&(ai=Bm(lt))):ro=!1}ro&&(st.set(lt,ai),Re(ai,lt,ne,Ye,st),st.delete(lt)),Os(M,j,ai)}A(Cm,"baseMergeDeep");function Im(M,L){return z2(Gm(M,L,Oh),M+"")}A(Im,"baseRest");var L2=vn?function(M,L){return vn(M,"toString",{configurable:!0,enumerable:!1,value:Km(L),writable:!0})}:Oh;function Am(M,L){if(L)return M.slice();var j=M.length,ne=Rs?Rs(j):new M.constructor(j);return M.copy(ne),ne}A(Am,"cloneBuffer");function Em(M){var L=new M.constructor(M.byteLength);return new zs(L).set(new zs(M)),L}A(Em,"cloneArrayBuffer");function km(M,L){var j=L?Em(M.buffer):M.buffer;return new M.constructor(j,M.byteOffset,M.length)}A(km,"cloneTypedArray");function Dm(M,L){var j=-1,ne=M.length;for(L||(L=Array(ne));++j<ne;)L[j]=M[j];return L}A(Dm,"copyArray");function Lm(M,L,j,ne){var Re=!j;j||(j={});for(var Ye=-1,st=L.length;++Ye<st;){var De=L[Ye],lt=ne?ne(j[De],M[De],De,j,M):void 0;lt===void 0&&(lt=M[De]),Re?Ns(j,De,lt):Pm(j,De,lt)}return j}A(Lm,"copyObject");function zm(M){return Im(function(L,j){var ne=-1,Re=j.length,Ye=Re>1?j[Re-1]:void 0,st=Re>2?j[2]:void 0;for(Ye=M.length>3&&typeof Ye=="function"?(Re--,Ye):void 0,st&&Om(j[0],j[1],st)&&(Ye=Re<3?void 0:Ye,Re=1),L=Object(L);++ne<Re;){var De=j[ne];De&&M(L,De,ne,Ye)}return L})}A(zm,"createAssigner");function Rm(M){return function(L,j,ne){for(var Re=-1,Ye=Object(L),st=ne(L),De=st.length;De--;){var lt=st[M?De:++Re];if(j(Ye[lt],lt,Ye)===!1)break}return L}}A(Rm,"createBaseFor");function to(M,L){var j=M.__data__;return Nm(L)?j[typeof L=="string"?"string":"hash"]:j.map}A(to,"getMapData");function Vs(M,L){var j=Ki(M,L);return Sm(j)?j:void 0}A(Vs,"getNative");function Fm(M){var L=et.call(M,Li),j=M[Li];try{M[Li]=void 0;var ne=!0}catch(Ye){}var Re=Ct.call(M);return ne&&(L?M[Li]=j:delete M[Li]),Re}A(Fm,"getRawTag");function Bm(M){return typeof M.constructor=="function"&&!Lh(M)?k2(Ji(M)):{}}A(Bm,"initCloneObject");function Dh(M,L){var j=typeof M;return L=L==null?o:L,!!L&&(j=="number"||j!="symbol"&&je.test(M))&&M>-1&&M%1==0&&M<L}A(Dh,"isIndex");function Om(M,L,j){if(!Zr(j))return!1;var ne=typeof L;return(ne=="number"?Us(j)&&Dh(L,j.length):ne=="string"&&L in j)?io(j[L],M):!1}A(Om,"isIterateeCall");function Nm(M){var L=typeof M;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?M!=="__proto__":M===null}A(Nm,"isKeyable");function Vm(M){return!!Gt&&Gt in M}A(Vm,"isMasked");function Lh(M){var L=M&&M.constructor,j=typeof L=="function"&&L.prototype||xi;return M===j}A(Lh,"isPrototype");function jm(M){var L=[];if(M!=null)for(var j in Object(M))L.push(j);return L}A(jm,"nativeKeysIn");function Um(M){return Ct.call(M)}A(Um,"objectToString");function Gm(M,L,j){return L=em(L===void 0?M.length-1:L,0),function(){for(var ne=arguments,Re=-1,Ye=em(ne.length-L,0),st=Array(Ye);++Re<Ye;)st[Re]=ne[L+Re];Re=-1;for(var De=Array(L+1);++Re<L;)De[Re]=ne[Re];return De[L]=j(st),Cr(M,this,De)}}A(Gm,"overRest");function js(M,L){if(!(L==="constructor"&&typeof M[L]=="function")&&L!="__proto__")return M[L]}A(js,"safeGet");var z2=Xm(L2);function Xm(M){var L=0,j=0;return function(){var ne=E2(),Re=a-(ne-j);if(j=ne,Re>0){if(++L>=n)return arguments[0]}else L=0;return M.apply(void 0,arguments)}}A(Xm,"shortOut");function qm(M){if(M!=null){try{return pt.call(M)}catch(L){}try{return M+""}catch(L){}}return""}A(qm,"toSource");function io(M,L){return M===L||M!==M&&L!==L}A(io,"eq");var zh=Eh((function(){return arguments})())?Eh:function(M){return ea(M)&&et.call(M,"callee")&&!Fs.call(M,"callee")},Rh=Array.isArray;function Us(M){return M!=null&&Fh(M.length)&&!Gs(M)}A(Us,"isArrayLike");function $m(M){return ea(M)&&Us(M)}A($m,"isArrayLikeObject");var Zm=Ka||Jm;function Gs(M){if(!Zr(M))return!1;var L=eo(M);return L==d||L==f||L==u||L==v}A(Gs,"isFunction");function Fh(M){return typeof M=="number"&&M>-1&&M%1==0&&M<=o}A(Fh,"isLength");function Zr(M){var L=typeof M;return M!=null&&(L=="object"||L=="function")}A(Zr,"isObject");function ea(M){return M!=null&&typeof M=="object"}A(ea,"isObjectLike");function Ym(M){if(!ea(M)||eo(M)!=b)return!1;var L=Ji(M);if(L===null)return!0;var j=et.call(L,"constructor")&&L.constructor;return typeof j=="function"&&j instanceof j&&pt.call(j)==Wa}A(Ym,"isPlainObject");var Wm=xn?gi(xn):Tm;function Hm(M){return Lm(M,Bh(M))}A(Hm,"toPlainObject");function Bh(M){return Us(M)?wm(M,!0):Mm(M)}A(Bh,"keysIn");var R2=zm(function(M,L,j){kh(M,L,j)});function Km(M){return function(){return M}}A(Km,"constant");function Oh(M){return M}A(Oh,"identity");function Jm(){return!1}A(Jm,"stubFalse"),t.exports=R2});Ce();Ce();var b1=class{constructor(t,i,r=0,n){N(this,"id"),N(this,"type"),N(this,"component"),N(this,"worldPosition"),N(this,"verticalOffset"),N(this,"disposed",!1),N(this,"positionDirty",!0),N(this,"parentId"),this.id=t.id,this.component=t,this.type=t.type,this.worldPosition={x:i.x,y:i.y,z:i.z+r},this.verticalOffset=r,this.parentId=n}updatePosition(t,i,r){this.worldPosition.x=t,this.worldPosition.y=i,this.worldPosition.z=r,this.positionDirty=!0}setAltitude(t){this.worldPosition.z=t,this.positionDirty=!0}};A(b1,"Entity2D");var w1=b1;Ce();Ce();Ce();var ef=[0,4,6,8,10],P1=A(()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let r=0;r<e.length;r++)r>0&&(r&3)===0&&(t=Math.random()*4294967296),e[r]=t>>>((r&3)<<3)&255;let i=e.map(r=>r.toString(16).padStart(2,"0"));return i[6]="4"+i[6][1],i[8]=["8","9","a","b"].includes(i[7][0])?i[7]:"a"+i[7][1],ef.map((r,n)=>i.slice(r,n===ef.length-1?void 0:ef[n+1]).join("")).join("-")},"randomId");Ce();Ce();var S1=tf.union([tf.enum(["low","medium","high","always-visible"]),tf.number()]),T1=["","","low","medium","high","always-visible"];function wf(e){return Math.min(5,Math.max(2,e))}A(wf,"clampTierNumber");function vs(e){if(typeof e=="number")return wf(e);let t=T1.indexOf(e);return t===-1?3:t}A(vs,"convertCollisionRankingTierToNumber");function N4(e){let t=wf(e);return T1[t]}A(N4,"convertNumberToCollisionRankingTier");Ce();var V4=(e=>(e[e.ACTIVE=1]="ACTIVE",e[e.INACTIVE=.5]="INACTIVE",e[e.HIDDEN=0]="HIDDEN",e))(V4||{}),j4=(e=>(e.LEFT="left",e.CENTER="center",e.RIGHT="right",e))(j4||{});Ce();Ce();function xs(e){"@babel/helpers - typeof";return xs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xs(e)}A(xs,"_typeof");var U4=/^\s+/,G4=/\s+$/;function ae(e,t){if(e=e||"",t=t||{},e instanceof ae)return e;if(!(this instanceof ae))return new ae(e,t);var i=M1(e);this._originalInput=e,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||i.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}A(ae,"tinycolor");ae.prototype={isDark:A(function(){return this.getBrightness()<128},"isDark"),isLight:A(function(){return!this.isDark()},"isLight"),isValid:A(function(){return this._ok},"isValid"),getOriginalInput:A(function(){return this._originalInput},"getOriginalInput"),getFormat:A(function(){return this._format},"getFormat"),getAlpha:A(function(){return this._a},"getAlpha"),getBrightness:A(function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},"getBrightness"),getLuminance:A(function(){var e=this.toRgb(),t,i,r,n,a,o;return t=e.r/255,i=e.g/255,r=e.b/255,t<=.03928?n=t/12.92:n=Math.pow((t+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),.2126*n+.7152*a+.0722*o},"getLuminance"),setAlpha:A(function(e){return this._a=Pf(e),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:A(function(){var e=of(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},"toHsv"),toHsvString:A(function(){var e=of(this._r,this._g,this._b),t=Math.round(e.h*360),i=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+i+"%, "+r+"%)":"hsva("+t+", "+i+"%, "+r+"%, "+this._roundA+")"},"toHsvString"),toHsl:A(function(){var e=af(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},"toHsl"),toHslString:A(function(){var e=af(this._r,this._g,this._b),t=Math.round(e.h*360),i=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+i+"%, "+r+"%)":"hsla("+t+", "+i+"%, "+r+"%, "+this._roundA+")"},"toHslString"),toHex:A(function(e){return sf(this._r,this._g,this._b,e)},"toHex"),toHexString:A(function(e){return"#"+this.toHex(e)},"toHexString"),toHex8:A(function(e){return E1(this._r,this._g,this._b,this._a,e)},"toHex8"),toHex8String:A(function(e){return"#"+this.toHex8(e)},"toHex8String"),toRgb:A(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:A(function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},"toRgbString"),toPercentageRgb:A(function(){return{r:Math.round(ot(this._r,255)*100)+"%",g:Math.round(ot(this._g,255)*100)+"%",b:Math.round(ot(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:A(function(){return this._a==1?"rgb("+Math.round(ot(this._r,255)*100)+"%, "+Math.round(ot(this._g,255)*100)+"%, "+Math.round(ot(this._b,255)*100)+"%)":"rgba("+Math.round(ot(this._r,255)*100)+"%, "+Math.round(ot(this._g,255)*100)+"%, "+Math.round(ot(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:A(function(){return this._a===0?"transparent":this._a<1?!1:X4[sf(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:A(function(e){var t="#"+lf(this._r,this._g,this._b,this._a),i=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var n=ae(e);i="#"+lf(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+i+")"},"toFilter"),toString:A(function(e){var t=!!e;e=e||this._format;var i=!1,r=this._a<1&&this._a>=0,n=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return n?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(i=this.toRgbString()),e==="prgb"&&(i=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(i=this.toHexString()),e==="hex3"&&(i=this.toHexString(!0)),e==="hex4"&&(i=this.toHex8String(!0)),e==="hex8"&&(i=this.toHex8String()),e==="name"&&(i=this.toName()),e==="hsl"&&(i=this.toHslString()),e==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},"toString"),clone:A(function(){return ae(this.toString())},"clone"),_applyModification:A(function(e,t){var i=e.apply(null,[this].concat([].slice.call(t)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},"_applyModification"),lighten:A(function(){return this._applyModification(z1,arguments)},"lighten"),brighten:A(function(){return this._applyModification(R1,arguments)},"brighten"),darken:A(function(){return this._applyModification(F1,arguments)},"darken"),desaturate:A(function(){return this._applyModification(k1,arguments)},"desaturate"),saturate:A(function(){return this._applyModification(D1,arguments)},"saturate"),greyscale:A(function(){return this._applyModification(L1,arguments)},"greyscale"),spin:A(function(){return this._applyModification(B1,arguments)},"spin"),_applyCombination:A(function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},"_applyCombination"),analogous:A(function(){return this._applyCombination(V1,arguments)},"analogous"),complement:A(function(){return this._applyCombination(O1,arguments)},"complement"),monochromatic:A(function(){return this._applyCombination(j1,arguments)},"monochromatic"),splitcomplement:A(function(){return this._applyCombination(N1,arguments)},"splitcomplement"),triad:A(function(){return this._applyCombination(uf,[3])},"triad"),tetrad:A(function(){return this._applyCombination(uf,[4])},"tetrad")};ae.fromRatio=function(e,t){if(xs(e)=="object"){var i={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?i[r]=e[r]:i[r]=Ga(e[r]));e=i}return ae(e,t)};function M1(e){var t={r:0,g:0,b:0},i=1,r=null,n=null,a=null,o=!1,s=!1;return typeof e=="string"&&(e=q1(e)),xs(e)=="object"&&(xr(e.r)&&xr(e.g)&&xr(e.b)?(t=C1(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):xr(e.h)&&xr(e.s)&&xr(e.v)?(r=Ga(e.s),n=Ga(e.v),t=A1(e.h,r,n),o=!0,s="hsv"):xr(e.h)&&xr(e.s)&&xr(e.l)&&(r=Ga(e.s),a=Ga(e.l),t=I1(e.h,r,a),o=!0,s="hsl"),e.hasOwnProperty("a")&&(i=e.a)),i=Pf(i),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:i}}A(M1,"inputToRGB");function C1(e,t,i){return{r:ot(e,255)*255,g:ot(t,255)*255,b:ot(i,255)*255}}A(C1,"rgbToRgb");function af(e,t,i){e=ot(e,255),t=ot(t,255),i=ot(i,255);var r=Math.max(e,t,i),n=Math.min(e,t,i),a,o,s=(r+n)/2;if(r==n)a=o=0;else{var l=r-n;switch(o=s>.5?l/(2-r-n):l/(r+n),r){case e:a=(t-i)/l+(t<i?6:0);break;case t:a=(i-e)/l+2;break;case i:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,l:s}}A(af,"rgbToHsl");function I1(e,t,i){var r,n,a;e=ot(e,360),t=ot(t,100),i=ot(i,100);function o(u,h,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?u+(h-u)*6*c:c<1/2?h:c<2/3?u+(h-u)*(2/3-c)*6:u}if(A(o,"hue2rgb"),t===0)r=n=a=i;else{var s=i<.5?i*(1+t):i+t-i*t,l=2*i-s;r=o(l,s,e+1/3),n=o(l,s,e),a=o(l,s,e-1/3)}return{r:r*255,g:n*255,b:a*255}}A(I1,"hslToRgb");function of(e,t,i){e=ot(e,255),t=ot(t,255),i=ot(i,255);var r=Math.max(e,t,i),n=Math.min(e,t,i),a,o,s=r,l=r-n;if(o=r===0?0:l/r,r==n)a=0;else{switch(r){case e:a=(t-i)/l+(t<i?6:0);break;case t:a=(i-e)/l+2;break;case i:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,v:s}}A(of,"rgbToHsv");function A1(e,t,i){e=ot(e,360)*6,t=ot(t,100),i=ot(i,100);var r=Math.floor(e),n=e-r,a=i*(1-t),o=i*(1-n*t),s=i*(1-(1-n)*t),l=r%6,u=[i,o,a,a,s,i][l],h=[s,i,i,o,a,a][l],c=[a,a,s,i,i,o][l];return{r:u*255,g:h*255,b:c*255}}A(A1,"hsvToRgb");function sf(e,t,i,r){var n=[ki(Math.round(e).toString(16)),ki(Math.round(t).toString(16)),ki(Math.round(i).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}A(sf,"rgbToHex");function E1(e,t,i,r,n){var a=[ki(Math.round(e).toString(16)),ki(Math.round(t).toString(16)),ki(Math.round(i).toString(16)),ki(Sf(r))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}A(E1,"rgbaToHex");function lf(e,t,i,r){var n=[ki(Sf(r)),ki(Math.round(e).toString(16)),ki(Math.round(t).toString(16)),ki(Math.round(i).toString(16))];return n.join("")}A(lf,"rgbaToArgbHex");ae.equals=function(e,t){return!e||!t?!1:ae(e).toRgbString()==ae(t).toRgbString()};ae.random=function(){return ae.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function k1(e,t){t=t===0?0:t||10;var i=ae(e).toHsl();return i.s-=t/100,i.s=bs(i.s),ae(i)}A(k1,"_desaturate");function D1(e,t){t=t===0?0:t||10;var i=ae(e).toHsl();return i.s+=t/100,i.s=bs(i.s),ae(i)}A(D1,"_saturate");function L1(e){return ae(e).desaturate(100)}A(L1,"_greyscale");function z1(e,t){t=t===0?0:t||10;var i=ae(e).toHsl();return i.l+=t/100,i.l=bs(i.l),ae(i)}A(z1,"_lighten");function R1(e,t){t=t===0?0:t||10;var i=ae(e).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(t/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(t/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(t/100)))),ae(i)}A(R1,"_brighten");function F1(e,t){t=t===0?0:t||10;var i=ae(e).toHsl();return i.l-=t/100,i.l=bs(i.l),ae(i)}A(F1,"_darken");function B1(e,t){var i=ae(e).toHsl(),r=(i.h+t)%360;return i.h=r<0?360+r:r,ae(i)}A(B1,"_spin");function O1(e){var t=ae(e).toHsl();return t.h=(t.h+180)%360,ae(t)}A(O1,"_complement");function uf(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var i=ae(e).toHsl(),r=[ae(e)],n=360/t,a=1;a<t;a++)r.push(ae({h:(i.h+a*n)%360,s:i.s,l:i.l}));return r}A(uf,"polyad");function N1(e){var t=ae(e).toHsl(),i=t.h;return[ae(e),ae({h:(i+72)%360,s:t.s,l:t.l}),ae({h:(i+216)%360,s:t.s,l:t.l})]}A(N1,"_splitcomplement");function V1(e,t,i){t=t||6,i=i||30;var r=ae(e).toHsl(),n=360/i,a=[ae(e)];for(r.h=(r.h-(n*t>>1)+720)%360;--t;)r.h=(r.h+n)%360,a.push(ae(r));return a}A(V1,"_analogous");function j1(e,t){t=t||6;for(var i=ae(e).toHsv(),r=i.h,n=i.s,a=i.v,o=[],s=1/t;t--;)o.push(ae({h:r,s:n,v:a})),a=(a+s)%1;return o}A(j1,"_monochromatic");ae.mix=function(e,t,i){i=i===0?0:i||50;var r=ae(e).toRgb(),n=ae(t).toRgb(),a=i/100,o={r:(n.r-r.r)*a+r.r,g:(n.g-r.g)*a+r.g,b:(n.b-r.b)*a+r.b,a:(n.a-r.a)*a+r.a};return ae(o)};ae.readability=function(e,t){var i=ae(e),r=ae(t);return(Math.max(i.getLuminance(),r.getLuminance())+.05)/(Math.min(i.getLuminance(),r.getLuminance())+.05)};ae.isReadable=function(e,t,i){var r=ae.readability(e,t),n,a;switch(a=!1,n=$1(i),n.level+n.size){case"AAsmall":case"AAAlarge":a=r>=4.5;break;case"AAlarge":a=r>=3;break;case"AAAsmall":a=r>=7;break}return a};ae.mostReadable=function(e,t,i){var r=null,n=0,a,o,s,l;i=i||{},o=i.includeFallbackColors,s=i.level,l=i.size;for(var u=0;u<t.length;u++)a=ae.readability(e,t[u]),a>n&&(n=a,r=ae(t[u]));return ae.isReadable(e,r,{level:s,size:l})||!o?r:(i.includeFallbackColors=!1,ae.mostReadable(e,["#fff","#000"],i))};var hf=ae.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},X4=ae.hexNames=U1(hf);function U1(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}A(U1,"flip");function Pf(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}A(Pf,"boundAlpha");function ot(e,t){G1(e)&&(e="100%");var i=X1(e);return e=Math.min(t,Math.max(0,parseFloat(e))),i&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}A(ot,"bound01");function bs(e){return Math.min(1,Math.max(0,e))}A(bs,"clamp01");function ti(e){return parseInt(e,16)}A(ti,"parseIntFromHex");function G1(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}A(G1,"isOnePointZero");function X1(e){return typeof e=="string"&&e.indexOf("%")!=-1}A(X1,"isPercentage");function ki(e){return e.length==1?"0"+e:""+e}A(ki,"pad2");function Ga(e){return e<=1&&(e=e*100+"%"),e}A(Ga,"convertToPercentage");function Sf(e){return Math.round(parseFloat(e)*255).toString(16)}A(Sf,"convertDecimalToHex");function cf(e){return ti(e)/255}A(cf,"convertHexToDecimal");var $i=(function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",i="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",n="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function xr(e){return!!$i.CSS_UNIT.exec(e)}A(xr,"isValidCSSUnit");function q1(e){e=e.replace(U4,"").replace(G4,"").toLowerCase();var t=!1;if(hf[e])e=hf[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=$i.rgb.exec(e))?{r:i[1],g:i[2],b:i[3]}:(i=$i.rgba.exec(e))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=$i.hsl.exec(e))?{h:i[1],s:i[2],l:i[3]}:(i=$i.hsla.exec(e))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=$i.hsv.exec(e))?{h:i[1],s:i[2],v:i[3]}:(i=$i.hsva.exec(e))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=$i.hex8.exec(e))?{r:ti(i[1]),g:ti(i[2]),b:ti(i[3]),a:cf(i[4]),format:t?"name":"hex8"}:(i=$i.hex6.exec(e))?{r:ti(i[1]),g:ti(i[2]),b:ti(i[3]),format:t?"name":"hex"}:(i=$i.hex4.exec(e))?{r:ti(i[1]+""+i[1]),g:ti(i[2]+""+i[2]),b:ti(i[3]+""+i[3]),a:cf(i[4]+""+i[4]),format:t?"name":"hex8"}:(i=$i.hex3.exec(e))?{r:ti(i[1]+""+i[1]),g:ti(i[2]+""+i[2]),b:ti(i[3]+""+i[3]),format:t?"name":"hex"}:!1}A(q1,"stringInputToObject");function $1(e){var t,i;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),i=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:t,size:i}}A($1,"validateWCAG2Parms");var At={RIGHT:"right",LEFT:"left",TOP:"top",HIDDEN:"hidden",CENTER:"center"},Fa="low-priority",Z1=Object.values(At),Tf=[At.RIGHT,At.LEFT,At.TOP,At.HIDDEN],q4=Be.string(),$4=Be.object({on:Be.literal("zoom-level"),input:Be.tuple([Be.number()]).rest(Be.number()),output:Be.tuple([Be.number()]).rest(Be.number()),easing:q4.default("linear")}).refine(e=>e.input.length===e.output.length,{message:"input and output must have the same length"}),Z4=Be.object({margin:Be.number().min(6).default(6),maxLines:Be.number().min(1).default(2),textSize:Be.number().min(0).default(11.5),maxWidth:Be.number().min(0).default(150),lineHeight:Be.number().min(0).default(1.2),color:Be.string().default("#333"),outlineColor:Be.string().default("white"),textColor:Be.string().optional(),textOutlineColor:Be.string().optional(),pinColor:Be.string().optional(),pinOutlineColor:Be.string().optional(),pinColorInactive:Be.string().optional(),pinOutlineColorInactive:Be.string().optional(),icon:Be.string().optional(),iconSize:Be.number().min(0).default(20),iconScale:Be.union([Be.number(),$4]).default(1),iconPadding:Be.number().min(0).default(2),iconFit:Be.enum(["fill","contain","cover"]).default("cover"),iconOverflow:Be.enum(["visible","hidden"]).default("hidden"),iconVisible:Be.union([Be.boolean(),Be.number()]).default(!0),opacity:Be.number().min(0).max(1).default(1)}),Mf=A(e=>{var t,i;let r=x1({},e);r.color!=null&&(r.textColor==null&&(r.textColor=r.color),r.pinColor==null&&(r.pinColor=r.color)),r.outlineColor!=null&&(r.textOutlineColor==null&&(r.textOutlineColor=r.outlineColor),r.pinOutlineColor==null&&(r.pinOutlineColor=r.outlineColor));let n=(t=r.pinColor)!=null?t:r.color,a=(i=r.pinOutlineColor)!=null?i:r.outlineColor;return n!=null&&r.pinColorInactive==null&&(r.pinColorInactive=ae(n).toRgbString()),a!=null&&r.pinOutlineColorInactive==null&&(r.pinOutlineColorInactive=ae(a).toRgbString()),r},"applyLabelAppearanceShorthands"),Cf=Z4.transform(e=>Mf(e)),Y4=A(e=>Cf.parse(e),"parseLabelAppearance"),Y1=A((e,t)=>["color","outlineColor","maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"].some(i=>t[i]!=null&&e[i]!==t[i]),"isOneOfTextDirtyOptions"),W1=A((e,t)=>["color","outlineColor","icon","iconSize","iconScale","iconVisible","iconPadding","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"].some(i=>t[i]!=null&&e[i]!==t[i]),"isOneOfPinDirtyOptions"),H1=A((e,t)=>{var i,r;return t.textPlacement!=null&&e.textPlacement!==t.textPlacement||((i=t.appearance)==null?void 0:i.margin)!=null&&((r=e.appearance)==null?void 0:r.margin)!==t.appearance.margin},"isOneOfColliderDirtyOptions"),d1=4,W4=6,K1=6.5,$u=K1/2,f1=[$u,$u,$u,$u],pf=class df{constructor(t,i,r){N(this,"lines",0),N(this,"id"),N(this,"rank"),N(this,"type","label"),N(this,"initialRank"),N(this,"contextConfigured",!1),N(this,"fillText"),N(this,"newStyle",{}),N(this,"currentOpacity",0),N(this,"visibilityNeedsUpdate",!1),N(this,"activePlacement",At.RIGHT),N(this,"text"),N(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"}),N(this,"projection",{x:0,y:0}),N(this,"labelCacheId"),N(this,"_cache",{}),N(this,"appearance"),N(this,"options"),N(this,"visible",!0),N(this,"enabled",!0),N(this,"interactive",!1),N(this,"isOccluded",!1),N(this,"offscreen",!1),N(this,"canShow",!1),N(this,"activeBoundingBox",{x:0,y:0,w:0,h:0}),N(this,"dimensions",{width:0,height:0}),N(this,"currentStrategyIndex",-1),N(this,"totalPinSize",0),N(this,"iconScale",1),N(this,"iconPadding"),N(this,"dirty",!0),N(this,"textDirty",!0),N(this,"pinDirty",!0),N(this,"attachedDirty",!0),N(this,"collisionDirty",!0),N(this,"lastTextAlign"),N(this,"imageHash"),N(this,"pinSize",0),N(this,"iconVisible",!1),N(this,"dp"),N(this,"_cachedStrategies",null),N(this,"animate",!0),N(this,"onStrategySelected",A(l=>{var u;if(this.currentStrategyIndex===l)return;this.currentStrategyIndex=l;let h=this.strategies[l];if(this.activePlacement=(u=h==null?void 0:h.name)!=null?u:this.activePlacement,h){h.onStrategySelected();let c=this.style;this.style=this.newStyle,this.newStyle=c}},"onStrategySelected")),N(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var n,a,o;if(this.id=(n=i.id)!=null?n:P1(),this.options=i!=null?i:{},this.text=t,this.dp=(l=1)=>l*r,typeof i.rank=="string")this.rank=vs(i.rank),this.initialRank=this.rank;else if(i.rank!=null&&i.rank>0)this.rank=i.rank,this.initialRank=i.rank;else{let l=Math.trunc(df.testId*10)/10;df.testId+=.001,this.rank=l,this.initialRank=l}this.options.textPlacement=(a=i.textPlacement)!=null?a:Tf;let s=Y4((o=i.appearance)!=null?o:{});this.appearance=s,this.iconPadding=s.iconPadding}get scaledPinSize(){return this.totalPinSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}get textVisible(){return this.offscreen||!this.visible||!this.canShow||!this.enabled?!1:this.style.textLabelVisible===!0&&this.style.textAlign!=null&&this.style.left!=null&&this.style.top!=null}calculatePinSize(){let t=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.pinSize=this.dp(this.appearance.iconSize):this.pinSize=this.dp(K1),this.totalPinSize=Math.ceil((this.pinSize+2.5)/t)}getNoTextBbox(t){let i=this.scaledPinSize/2+t;return[i,i,i,i]}getHiddenTextPlacementBbox(t){return this.iconVisible?this.getNoTextBbox(t):f1}getBoundingBoxForPlacement(t){let{width:i,height:r}=this.dimensions,{margin:n}=this.appearance,a=Math.max(W4,n);if(this.text==="")return this.getNoTextBbox(a);let o=Math.max(this.scaledPinSize,r);switch(t){case At.RIGHT:return[o/2+a,o/2+a,this.scaledPinSize/2+a,this.scaledPinSize/2+i+a];case At.LEFT:return[o/2+a,o/2+a,this.scaledPinSize/2+i+a,this.scaledPinSize/2+a];case At.TOP:{let s=this.dp();return[r+this.scaledPinSize/2/s+a,this.scaledPinSize/2+a,i/2+a,i/2+a]}case At.CENTER:return[r/2+a,r/2+a,i/2+a,i/2+a];case At.HIDDEN:return this.getHiddenTextPlacementBbox(a);case Fa:return f1;default:return this.getNoTextBbox(a)}}getStrategyStyleForPlacement(t){let{width:i,height:r}=this.dimensions;switch(t){case At.TOP:this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.scaledPinSize/2,this.newStyle.left=-i/2;return;case At.LEFT:this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-i-this.scaledPinSize/2-d1,this.newStyle.textLabelVisible=!0;return;case At.RIGHT:this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.scaledPinSize/2+d1,this.newStyle.textLabelVisible=!0;return;case At.CENTER:this.newStyle.pinVisibility=0,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r/2,this.newStyle.left=-i/2;return;case At.HIDDEN:this.newStyle.pinVisibility=this.iconVisible?1:.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return;case Fa:default:this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return}}invalidateStrategies(){this._cachedStrategies=null}get strategies(){if(this._cachedStrategies)return this._cachedStrategies;let t=Array.isArray(this.options.textPlacement)?this.options.textPlacement:[this.options.textPlacement],i=[],r=!1;for(let n of t)this.options.rank==="always-visible"&&n===At.HIDDEN&&t.length>1||(i.push({name:n,getBoundingBox:A(()=>this.getBoundingBoxForPlacement(n),"getBoundingBox"),onStrategySelected:A(()=>this.getStrategyStyleForPlacement(n),"onStrategySelected")}),n===At.HIDDEN&&(r=!0));return r&&i.push({name:Fa,getBoundingBox:A(()=>this.getBoundingBoxForPlacement(Fa),"getBoundingBox"),onStrategySelected:A(()=>this.getStrategyStyleForPlacement(Fa),"onStrategySelected")}),this._cachedStrategies=i,i}recomputeCurrentStrategy(t=this.iconScale){let i=this.iconScale!==t;if(i||this.dirty){let r=this.pinDirty,n=this.strategies[this.currentStrategyIndex];if(this.iconScale=t,this.collisionDirty=!0,i&&!r&&this.calculatePinSize(),n){n.onStrategySelected();let a=this.style;this.style=this.newStyle,this.newStyle=a}this.dirty=!1}}toPackedMessage(t=!1){var i;let r=this.strategies[this.currentStrategyIndex],n=this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.text!==""&&r!=null&&r.name!==At.HIDDEN&&r.name!==Fa;if(this.visible&&t&&this.collisionDirty===!1&&n?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,n&&this.currentStrategyIndex!==((i=this.packedMessage.bboxes[0])==null?void 0:i[4])){let l=this.packedMessage.bboxes;for(let u=1;u<l.length;u++)if(l[u][4]===this.currentStrategyIndex){let h=l[0];l[0]=l[u],l[u]=h;break}}if(!this.collisionDirty)return this.packedMessage;let a=[],o=this.strategies,s=-1;for(let l=0;l<o.length;l++){let u=o[l].getBoundingBox();a.push([u[0],u[1],u[2],u[3],l]),n&&l===this.currentStrategyIndex&&(s=a.length-1)}if(s>0){let l=a[0];a[0]=a[s],a[s]=l}return this.packedMessage.bboxes=a,this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};A(pf,"LabelComponent"),N(pf,"testId",0);var rh=pf,J1=rh;Ce();var H4=F4(O4());Ce();var rt={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center",TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",HIDDEN:"hidden"},Q1=Object.values(rt),K4=[rt.CENTER,rt.HIDDEN],J4=Object.freeze({size:8,color:"#666"}),ff=class mf{constructor(t,i={}){N(this,"id"),N(this,"type","marker"),N(this,"rank",0),N(this,"initialRank",0),N(this,"activePlacement","center"),N(this,"pointerEvents","none"),N(this,"options",{rank:"low",interactive:!1,id:"",placement:K4,dynamicResize:!1,occlude:!0,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:x1({},J4)}),N(this,"projection",{x:0,y:0}),N(this,"enabled",!0),N(this,"interactive",!1),N(this,"canShow",!1),N(this,"visible",!0),N(this,"isOccluded",!1),N(this,"offscreen",!1),N(this,"strategyIndex",-1),N(this,"activeBoundingBox",{x:0,y:0,w:0,h:0}),N(this,"dimensions",{width:0,height:0}),N(this,"markerContainer"),N(this,"containerEl"),N(this,"contentEl",null),N(this,"contentHtml",""),N(this,"style",{top:"0px",left:"0px"}),N(this,"dirty",!1),N(this,"attachedDirty",!0),N(this,"collisionDirty",!0),N(this,"visibilityNeedsUpdate","show"),N(this,"animation",null),N(this,"currentStrategyIndex",-1),N(this,"onStrategySelected",A((s,l=!1)=>{var u;if(this.currentStrategyIndex===s&&!l)return;this.currentStrategyIndex=s;let h=this.strategies[s];if(this.activePlacement=(u=h==null?void 0:h.name)!=null?u:"center",this.activePlacement===rt.HIDDEN){this.markerContainer.setAttribute("data-placement",rt.HIDDEN);let c=this.options.lowPriorityPin,p=c.size,d=c.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(p,"px")),this.markerContainer.style.setProperty("--pin-color",d),this.markerContainer.style.opacity="0.6",this.style.top=-p/2+"px",this.style.left=-p/2+"px"}else{this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:c,height:p}=this.dimensions,d=-p/2+"px",f=-c/2+"px";switch(this.style.top=d,this.style.left=f,this.activePlacement){case rt.TOP:this.style.top=-p+"px";break;case rt.BOTTOM:this.style.top="0px";break;case rt.LEFT:this.style.left=-c+"px";break;case rt.RIGHT:this.style.left="0px";break;case rt.TOP_LEFT:this.style.top=-p+"px",this.style.left=-c+"px";break;case rt.TOP_RIGHT:this.style.top=-p+"px",this.style.left="0px";break;case rt.BOTTOM_LEFT:this.style.top="0px",this.style.left=-c+"px";break;case rt.BOTTOM_RIGHT:this.style.top="0px",this.style.left="0px";break;case rt.CENTER:default:this.style.top=d,this.style.left=f}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left},"onStrategySelected")),N(this,"_cachedStrategies",null),N(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!0}),N(this,"_cachedLowPriorityPinIndex",null);var r,n,a,o;if(this.id=(i==null?void 0:i.id)||P1(),this.options=(0,H4.default)(this.options,i),this.options.placement=(r=i.placement)!=null?r:this.options.placement,typeof i.rank=="string")this.rank=vs(i.rank);else if(i.rank!=null&&i.rank>0)this.rank=i.rank;else{let s=Math.trunc(mf.testId*10)/10;mf.testId+=.001,this.rank=s}typeof i.interactive=="string"&&(this.pointerEvents=i.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=t,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML='<div class="mappedin-marker-content">'.concat(this.contentHtml,"</div>"),this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=(n=this.markerContainer.firstElementChild)!=null?n:null,this.contentEl=(o=(a=this.markerContainer.firstElementChild)==null?void 0:a.firstElementChild)!=null?o:null}updateDimensionsIfZeroWidthHeight(t,i){this.dimensions.width===0&&this.dimensions.height===0&&this.updateDimensions(t,i)}updateDimensions(t,i){if(t!=null&&i!=null)this.dimensions={width:t,height:i};else{let{width:r,height:n}=this.markerContainer.getBoundingClientRect();this.dimensions={width:r,height:n}}this.currentStrategyIndex=-1,this.invalidateStrategies()}invalidateStrategies(){this._cachedStrategies=null,this._cachedLowPriorityPinIndex=null}getBoundingBoxForPlacement(t){let{width:i,height:r}=this.dimensions;switch(t){case rt.TOP:return[r+4,4,i/2+4,i/2+4];case rt.BOTTOM:return[4,r+4,i/2+4,i/2+4];case rt.LEFT:return[r/2+4,r/2+4,i+4,4];case rt.RIGHT:return[r/2+4,r/2+4,4,i+4];case rt.TOP_LEFT:return[r+4,4,i+4,4];case rt.TOP_RIGHT:return[r+4,4,4,i+4];case rt.BOTTOM_LEFT:return[4,r+4,i+4,4];case rt.BOTTOM_RIGHT:return[4,r+4,4,i+4];case rt.HIDDEN:{let n=Math.max(2,2),a=this.options.lowPriorityPin.size/2+n;return[a,a,a,a]}default:return[r/2+4,r/2+4,i/2+4,i/2+4]}}get strategies(){if(this._cachedStrategies)return this._cachedStrategies;let{width:t,height:i}=this.dimensions;if(t===0||i===0)return[];let r=Array.isArray(this.options.placement)?this.options.placement:[this.options.placement],n=[];for(let a of r)this.options.rank==="always-visible"&&a===rt.HIDDEN&&r.length>1||n.push({name:a,getBoundingBox:A(()=>this.getBoundingBoxForPlacement(a),"getBoundingBox")});return this._cachedStrategies=n,n}toPackedMessage(t=!1){var i;this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let r=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&t&&r&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,r&&this.currentStrategyIndex!==((i=this.packedMessage.bboxes[0])==null?void 0:i[4])){let s=this.packedMessage.bboxes;for(let l=1;l<s.length;l++)if(s[l][4]===this.currentStrategyIndex){let u=s[0];s[0]=s[l],s[l]=u;break}}if(!this.collisionDirty)return this.packedMessage;let n=[],a=this.strategies,o=-1;for(let s=0;s<a.length;s++){let l=a[s].getBoundingBox();n.push([l[0],l[1],l[2],l[3],s]),s===this.currentStrategyIndex&&r&&(o=n.length-1)}if(o>0){let s=n[0];n[0]=n[o],n[o]=s}return this.packedMessage.bboxes=n,this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return this._cachedLowPriorityPinIndex!=null?this._cachedLowPriorityPinIndex:this.options.rank==="always-visible"?(this._cachedLowPriorityPinIndex=-1,-1):(this._cachedLowPriorityPinIndex=this.strategies.findIndex(t=>t.name===rt.HIDDEN),this._cachedLowPriorityPinIndex)}destroy(){}};A(ff,"MarkerComponent"),N(ff,"testId",0);var If=ff;Ce();Ce();Ce();Ce();Ce();Ce();function ew(e,t){return t.x+t.w<e.x+e.w&&t.x>e.x&&t.y>e.y&&t.y+t.h<e.y+e.h}A(ew,"contains");Ce();function tw(e,t){let[i,r]=t;return i>=e.x&&i<=e.x+e.w&&r>=e.y&&r<=e.y+e.h}A(tw,"intersectPoint");Ce();function iw(e,t){let i=t.x,r=t.y,n=t.x+t.w,a=t.y+t.h,o=e.x,s=e.y,l=e.x+e.w,u=e.y+e.h;return i<l&&o<n&&r<u&&s<a}A(iw,"intersects");Ce();function jr(e,t){for(let i=0;i<t.length;i++)e.push(t[i])}A(jr,"appendItems");Ce();var rw=class{constructor(t,i,r,n,a){N(this,"x"),N(this,"y"),N(this,"w"),N(this,"h"),N(this,"userData"),this.userData=typeof a>"u"?null:a,this.x=t,this.y=i,this.w=r,this.h=n}contains(t){return t===this?!1:ew(this,t)}intersects(t){return iw(this,t)}intersectsPoint(t){return tw(this,t)}draw(t){t.fillStyle="rgba(123,222,26, 0.8)",t.fillRect(this.x,this.y,this.w,this.h)}};A(rw,"Rectangle");var at=rw,nw=class ms{constructor(t,i){N(this,"topLeft"),N(this,"topRight"),N(this,"bottomLeft"),N(this,"bottomRight"),N(this,"divided",!1),N(this,"boundary"),N(this,"capacity",16),N(this,"objects",[]),N(this,"parent"),this.parent=i,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:i,w:r,h:n}=this.boundary;this.topLeft=new ms(new at(t,i,r/2,n/2),this),this.topRight=new ms(new at(t+r/2,i,r/2,n/2),this),this.bottomLeft=new ms(new at(t,i+n/2,r/2,n/2),this),this.bottomRight=new ms(new at(t+r/2,i+n/2,r/2,n/2),this),this.divided=!0}queryRect(t){let i=[];if(this.boundary.intersects(t))i.push(...this.objects);else return[];return this.divided&&(jr(i,this.topLeft.queryRect(t)),jr(i,this.topRight.queryRect(t)),jr(i,this.bottomLeft.queryRect(t)),jr(i,this.bottomRight.queryRect(t))),i}queryPoint(t){let i=[];if(this.boundary.intersectsPoint(t))i.push(...this.objects);else return[];return this.divided&&(jr(i,this.topLeft.queryPoint(t)),jr(i,this.topRight.queryPoint(t)),jr(i,this.bottomLeft.queryPoint(t)),jr(i,this.bottomRight.queryPoint(t))),i}insert(t){return(this.parent?!this.boundary.contains(t):!this.boundary.intersects(t))?!1:this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0)}drawObjects(t){this.objects.forEach(i=>i.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};A(nw,"QuadTree");var ys=nw;Ce();var aw=class{constructor(){N(this,"_subscribers",{}),N(this,"_abortController",new AbortController),N(this,"_cleanupFunctions",[])}get signal(){return this._abortController.signal}publish(t,i){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(r){typeof r=="function"&&r(i)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,i,r){let n=r==null?void 0:r.signal;if(n!=null&&n.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(i);let a=A(()=>this.off(t,i),"cleanup");return n&&n.addEventListener("abort",a,{once:!0}),this._cleanupFunctions.push(a),a}off(t,i){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let r=this._subscribers[t].indexOf(i);r!==-1&&this._subscribers[t].splice(r,1)}destroy(){if(!this.signal.aborted){for(let t of this._cleanupFunctions)t();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}};A(aw,"PubSub");var nh=aw;Ce();var ow=9,Ei=200,Zu=10;function sw(e,t,i,r,n,a,o="-1"){var s,l;let u=1/0,h=1/0,c=-1/0,p=-1/0,d=new at(-Zu,0,5,i),f=new at(-Zu,0,t,5),y=new at(t-5,0,t+Zu,i),g=new at(0,i-5,t,i+Zu),_=lw(t,i,r,n,a),b=[d,f,y,g],v=new at(-Ei,-Ei,t+Ei*2,i+Ei*2);for(let D of e){let z,x;for(let T=0;T<D.bboxes.length;T++){if(D.bboxes[T]==null||(z=D.bboxes[T].boundingBox,x=D.bboxes[T].index,D.lockedToStrategyIndex!==-1&&x!==D.lockedToStrategyIndex))continue;let[I,U,X,Z]=z,[ie,pe,je,le]=[D.y-I,D.y+U,D.x-X,D.x+Z],Oe=je,qe=ie,gt=le-je,kt=pe-ie;u=Math.min(u,Oe)-Ei,h=Math.min(h,qe)-Ei,c=Math.max(c,Oe+gt)+Ei,p=Math.max(p,qe+kt)+Ei,D.bboxes[T].boundingRect=new at(Oe,qe,gt,kt)}}let w=new ys(new at(u,h,c-u,p-h)),P={msgId:o,colliders:new Array(e.length),staticColliders:[],debug:[]},S=0;for(let D=0;D<e.length;D++){let z=e[D];((l=(s=z.bboxes)==null?void 0:s[0])==null?void 0:l.index)===ow&&(P.staticColliders.push(z.bboxes[0].boundingRect),w.insert(z.bboxes[0].boundingRect),S++)}e=e.slice(S,e.length);let C=-Ei,E=t+Ei,F=-Ei,B=i+Ei,R;for(let D=0;D<e.length;D++){R=e[D];let z=R.x<C||R.x>E||R.y<F||R.y>B?1:0;if(P.colliders[D]=[-1,z],R.enabledAndVisible){let[x,T,I]=[1/0,-1,void 0];for(let{index:U,boundingRect:X}of R.bboxes){if(X==null)continue;let Z=[];if(Z=w.queryRect(X).filter(ie=>X.intersects(ie)),R.shouldCollideWithScreenEdges)for(let ie of b)X.intersects(ie)&&Z.push(ie);if(X.intersects(_)){P.colliders[D]=[-1,z,X];break}if(Z.length<x&&(I=X,T=U,x=Z.length),Z.length===0){w.insert(X),P.colliders[D]=[U,v.contains(X)?0:1,X];break}}R.rank===5&&I!=null&&(w.insert(I),P.colliders[D]=[T,v.contains(I)?0:1,I])}}return P}A(sw,"processColliders");function lw(e,t,i,r,n){switch(n){case"top-left":return new at(0,0,i,r);case"top-right":return new at(e-i,0,i,r);case"bottom-left":return new at(0,t-r,i,r);case"bottom-right":return new at(e-i,t-r,i,r);case"center":return new at((e-i)/2,(t-r)/2,i,r);case"top":return new at((e-i)/2,0,i,r);case"bottom":return new at((e-i)/2,t-r,i,r);case"left":return new at(0,(t-r)/2,i,r);case"right":return new at(e-i,(t-r)/2,i,r);default:return new at(0,t-r,i,r)}}A(lw,"getWatermarkBoundary");Ce();Ce();function uw(e){let t=e[0].map(i=>{let r=i[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:i[1]===1,rank:i[2]===1?5:0,x:i[3],y:i[4],shouldCollideWithScreenEdges:i[5]===1,bboxes:r,lockedToStrategyIndex:i[6]}});return{msgId:"-1",totalWidth:e[3],totalHeight:e[2],watermarkWidth:e[4],watermarkHeight:e[5],watermarkPosition:e[6],colliders:t,devicePixelRatio:e[1]}}A(uw,"unpackMessage");var hw=class{constructor(){N(this,"onerror",A(()=>{},"onerror")),N(this,"onmessage",A(()=>{},"onmessage")),N(this,"postMessage",A(t=>{let i=uw(t);this.onmessage({data:sw(i.colliders,i.totalWidth,i.totalHeight,i.watermarkWidth,i.watermarkHeight,i.watermarkPosition,i.msgId)})},"postMessage")),N(this,"terminate",A(()=>{},"terminate"))}};A(hw,"SyncWorker");var Yu=hw;Ce();var m1='"use strict";(()=>{var ne=Object.defineProperty;var oe=(n,e,t)=>e in n?ne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var u=(n,e,t)=>oe(n,typeof e!="symbol"?e+"":e,t);function O(n,e){return e.x+e.w<n.x+n.w&&e.x>n.x&&e.y>n.y&&e.y+e.h<n.y+n.h}function Q(n,e){let[t,o]=e;return t>=n.x&&t<=n.x+n.w&&o>=n.y&&o<=n.y+n.h}function Y(n,e){let t=e.x,o=e.y,r=e.x+e.w,h=e.y+e.h,L=n.x,m=n.y,x=n.x+n.w,T=n.y+n.h;return t<x&&L<r&&o<T&&m<h}function f(n,e){for(let t=0;t<e.length;t++)n.push(e[t])}var i=class{constructor(e,t,o,r,h){u(this,"x");u(this,"y");u(this,"w");u(this,"h");u(this,"userData");this.userData=typeof h>"u"?null:h,this.x=e,this.y=t,this.w=o,this.h=r}contains(e){return e===this?!1:O(this,e)}intersects(e){return Y(this,e)}intersectsPoint(e){return Q(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var S=class n{constructor(e,t){u(this,"topLeft");u(this,"topRight");u(this,"bottomLeft");u(this,"bottomRight");u(this,"divided",!1);u(this,"boundary");u(this,"capacity",16);u(this,"objects",[]);u(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:o,h:r}=this.boundary;this.topLeft=new n(new i(e,t,o/2,r/2),this),this.topRight=new n(new i(e+o/2,t,o/2,r/2),this),this.bottomLeft=new n(new i(e,t+r/2,o/2,r/2),this),this.bottomRight=new n(new i(e+o/2,t+r/2,o/2,r/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(f(t,this.topLeft.queryRect(e)),f(t,this.topRight.queryRect(e)),f(t,this.bottomLeft.queryRect(e)),f(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(f(t,this.topLeft.queryPoint(e)),f(t,this.topRight.queryPoint(e)),f(t,this.bottomLeft.queryPoint(e)),f(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var ie=9,l=200,C=10;function K(n,e,t,o,r,h,L="-1"){var j,N;let m=1/0,x=1/0,T=-1/0,B=-1/0,F=new i(-C,0,5,t),k=new i(-C,0,e,5),U=new i(e-5,0,e+C,t),G=new i(0,t-5,e,t+C),J=se(e,t,o,r,h),Z=[F,k,U,G],M=new i(-l,-l,e+l*2,t+l*2);for(let s of n){let b,I;for(let p=0;p<s.bboxes.length;p++){if(s.bboxes[p]==null||(b=s.bboxes[p].boundingBox,I=s.bboxes[p].index,s.lockedToStrategyIndex!==-1&&I!==s.lockedToStrategyIndex))continue;let[a,P,c,y]=b,[E,g,z,te]=[s.y-a,s.y+P,s.x-c,s.x+y],v=z,D=E,q=te-z,X=g-E;m=Math.min(m,v)-l,x=Math.min(x,D)-l,T=Math.max(T,v+q)+l,B=Math.max(B,D+X)+l,s.bboxes[p].boundingRect=new i(v,D,q,X)}}let w=new S(new i(m,x,T-m,B-x)),R={msgId:L,colliders:new Array(n.length),staticColliders:[],debug:[]},_=0;for(let s=0;s<n.length;s++){let b=n[s];((N=(j=b.bboxes)==null?void 0:j[0])==null?void 0:N.index)===ie&&(R.staticColliders.push(b.bboxes[0].boundingRect),w.insert(b.bboxes[0].boundingRect),_++)}n=n.slice(_,n.length);let $=-l,W=e+l,H=-l,ee=t+l,d;for(let s=0;s<n.length;s++){d=n[s];let b=d.x<$||d.x>W||d.y<H||d.y>ee?1:0;if(R.colliders[s]=[-1,b],d.enabledAndVisible){let[I,p,a]=[1/0,-1,void 0];for(let{index:P,boundingRect:c}of d.bboxes){if(c==null)continue;let y=[];if(y=w.queryRect(c).filter(g=>c.intersects(g)),d.shouldCollideWithScreenEdges)for(let g of Z)c.intersects(g)&&y.push(g);if(c.intersects(J)){R.colliders[s]=[-1,b,c];break}if(y.length<I&&(a=c,p=P,I=y.length),y.length===0){w.insert(c),R.colliders[s]=[P,M.contains(c)?0:1,c];break}}d.rank===5&&a!=null&&(w.insert(a),R.colliders[s]=[p,M.contains(a)?0:1,a])}}return R}function se(n,e,t,o,r){switch(r){case"top-left":return new i(0,0,t,o);case"top-right":return new i(n-t,0,t,o);case"bottom-left":return new i(0,e-o,t,o);case"bottom-right":return new i(n-t,e-o,t,o);case"center":return new i((n-t)/2,(e-o)/2,t,o);case"top":return new i((n-t)/2,0,t,o);case"bottom":return new i((n-t)/2,e-o,t,o);case"left":return new i(0,(e-o)/2,t,o);case"right":return new i(n-t,(e-o)/2,t,o);default:return new i(0,e-o,t,o)}}function V(n){let e=n[0].map(t=>{let o=t[0].map(r=>({index:r[4],boundingBox:[r[0],r[1],r[2],r[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?5:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:o,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:n[3],totalHeight:n[2],watermarkWidth:n[4],watermarkHeight:n[5],watermarkPosition:n[6],colliders:e,devicePixelRatio:n[1]}}self.onmessage=n=>{let e=V(n.data);self.postMessage(K(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n',Hu,Ba,Oa,_s,nt,mn,yf,cw,pw=class extends nh{constructor(t,i,r,n,a=!0,o){if(super(),Ge(this,yf),N(this,"worker"),N(this,"collidersDirty",!0),N(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]),N(this,"visibleCollidersQTree",new ys(new at(0,0,0,0))),N(this,"interactiveCollidersQTree",new ys(new at(0,0,0,0))),Ge(this,Hu),Ge(this,Ba),Ge(this,Oa),Ge(this,_s,!1),Ge(this,nt,null),Ge(this,mn,null),N(this,"working",!1),N(this,"componentArray",[]),N(this,"update",A((s,l,u="bottom-left",h=!1,c=[])=>{let p=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];for(let b of G(this,Hu).entities)this.componentArray.push(b.component);this.resize(s,l,u),this.collidersDirty=!1,p=!0}else for(let b=0;b<this.componentArray.length;b++)if(this.componentArray[b].collisionDirty){p=!0;break}p&&this.componentArray.sort((b,v)=>v.rank-b.rank);let d=this.packedMessage[0],f=c.length+this.componentArray.length,y=h;d.length=f;let g=0,_;for(let b=0;b<c.length;b++){let v=c[b];d[g]==null&&(d[g]=[[],0,0,0,0,0,-1]),_=d[g],_[0]=[[v.h/2,v.h/2,v.w/2,v.w/2,ow]],_[1]=1,_[2]=1,_[3]=v.x,_[4]=v.y,_[5]=0,_[6]=-1,g++}for(let b=0;b<this.componentArray.length;b++){let v=this.componentArray[b],w=v.toPackedMessage(y);d[g]==null&&(d[g]=[[],0,0,0,0,0,-1]),_=d[g],_[0]=w.bboxes,_[1]=w.enabled&&v.visible&&!v.isOccluded?1:0,_[2]=w.rank===5?1:0,_[3]=w.x,_[4]=w.y,_[5]=w.shouldCollideWithScreenEdges?1:0,_[6]=w.lockedToStrategyIndex,g++}this.working||(this.working=!0,this.worker.postMessage(this.packedMessage))},"update")),N(this,"resolve",A(s=>{if(this.working=!1,this.collidersDirty||!s.data)return;let l=s.data.colliders,u=-1,h,c,p=new at(0,0,G(this,Ba),G(this,Oa));this.visibleCollidersQTree=new ys(p),this.interactiveCollidersQTree=new ys(p);for(let d=0;d<this.componentArray.length;d++){let f=this.componentArray[d];if(l[d]==null)continue;u=l[d][0],h=l[d][2];let y=f.offscreen,g=l[d][1]===1;f.offscreen=g,u!==-1&&h!=null?(c=new at(h.x,h.y,h.w,h.h,{entityId:f.id}),this.visibleCollidersQTree.insert(c),f.interactive&&this.interactiveCollidersQTree.insert(c),(f.canShow===!1||f.visibilityNeedsUpdate!==!1||y&&!g)&&"visibilityNeedsUpdate"in f&&(f.visibilityNeedsUpdate="show"),u!==-1&&u!==f.currentStrategyIndex&&(f.activeBoundingBox=c,f.onStrategySelected(u))):((f.canShow===!0||f.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in f&&(f.visibilityNeedsUpdate="hide"),u!==-1&&u!==f.currentStrategyIndex&&f.onStrategySelected(u))}nf(this,yf,cw).call(this),this.publish("visibility-changed")},"resolve")),N(this,"destroy",A(()=>{var s;this.worker.terminate(),(s=G(this,nt))==null||s.remove()},"destroy")),_e(this,Hu,t),_e(this,Ba,i),_e(this,Oa,r),!a)this.worker=new Yu;else if(n)this.worker=new Worker(n);else if(m1)try{this.worker=new Worker(URL.createObjectURL(new Blob([m1])))}catch(s){this.worker=new Yu}else this.worker=new Yu;this.worker.onerror=()=>{this.working=!1,this.worker=new Yu,this.worker.onmessage=s=>this.resolve(s)},this.worker.onmessage=s=>this.resolve(s),o&&(_e(this,nt,document.createElement("canvas")),G(this,nt).style.cssText="position:absolute;top:0;left:0;pointer-events:none;z-index:0;display:none;",G(this,nt).width=i,G(this,nt).height=r,G(this,nt).style.width=i+"px",G(this,nt).style.height=r+"px",o.appendChild(G(this,nt)),_e(this,mn,G(this,nt).getContext("2d")))}resizeCanvas(t,i){_e(this,Ba,t),_e(this,Oa,i),G(this,nt)&&(G(this,nt).width=t,G(this,nt).height=i,G(this,nt).style.width=t+"px",G(this,nt).style.height=i+"px")}resize(t,i,r){this.packedMessage[6]=r,this.packedMessage[5]=i,this.packedMessage[4]=t,this.packedMessage[3]=G(this,Ba),this.packedMessage[2]=G(this,Oa)}showCollisionBoxes(){_e(this,_s,!0),G(this,nt)&&(G(this,nt).style.display="block")}hideCollisionBoxes(){_e(this,_s,!1),G(this,mn)&&G(this,nt)&&(G(this,mn).clearRect(0,0,G(this,nt).width,G(this,nt).height),G(this,nt).style.display="none")}};Hu=new WeakMap,Ba=new WeakMap,Oa=new WeakMap,_s=new WeakMap,nt=new WeakMap,mn=new WeakMap,yf=new WeakSet,cw=A(function(){!G(this,_s)||!G(this,mn)||!G(this,nt)||(G(this,mn).clearRect(0,0,G(this,nt).width,G(this,nt).height),this.visibleCollidersQTree.drawObjects(G(this,mn)))},"#drawDebug"),A(pw,"CollisionSystem");var Q4=pw;Ce();Ce();Ce();var e6=A((function(){let e,t;return i=>{if((!t||!t)&&(e=document.createElement("canvas"),e.width=500*i,e.height=500*i,e.style.width="500px",e.style.height="500px",t=e.getContext("2d")),!t)throw new Error("Could not get 2D context");return{measureCanvas:e,measureCanvasContext:t}}}),"createMeasureCanvasContext")(),t6=A(({text:e,size:t,maxWidth:i,pixelRatio:r,maxLines:n=2,lineHeight:a=1.2,options:o={strokeText:!0}})=>{let s="bold ".concat(t*r,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:l}=e6(r);l.font=s;let u=[],h=e.split(" "),c=0,p=0,d=0;for(;p<h.length;){let g=h[p];if(c===n&&c>0){u[c-1]+="...";break}if(u[c]==null&&(u[c]=g,p++),h.length===1){u[c]=g;break}if(h[p]==null)break;let{width:_}=l.measureText(u[c]+" "+h[p]);_<=i*r?(u[c]+=" "+h[p],p++):c++}u.forEach(g=>{let{width:_}=l.measureText(g);d=Math.max(_,d)});let f=t*r*a,y=u.length*f;return{maxWidth:d,maxHeight:y,lines:u.length,draw:A((g,_,b)=>{u.length===1?(o.strokeText&&g.strokeText(u[0],_,b),g.fillText(u[0],_,b)):(o.strokeText&&(g.strokeText(u[0],_,b-f/2),g.strokeText(u[1],_,b+f/2)),g.fillText(u[0],_,b-f/2),g.fillText(u[1],_,b+f/2))},"draw")}},"shaveText");Ce();var dw="[MappedinJS]";function fw(e="",{prefix:t=dw}={}){let i="".concat(t).concat(e?"-".concat(e):""),r=A((n,a)=>{if(typeof window<"u"&&window.rnDebug){let o=a.map(s=>s instanceof Error&&s.stack?"".concat(s.message,"\n").concat(s.stack):s);window.rnDebug("".concat(e," ").concat(n,": ").concat(o.join(" ")))}},"rnDebug");return{logState:v1.env.NODE_ENV==="test"?3:0,log(...n){this.logState<=0&&(console.log(i,...n),r("log",n))},warn(...n){this.logState<=1&&(console.warn(i,...n),r("warn",n))},error(...n){this.logState<=2&&(console.error(i,...n),r("error",n))},assert(...n){console.assert(...n)},time(n){console.time(n)},timeEnd(n){console.timeEnd(n)},setLevel(n){0<=n&&n<=3&&(this.logState=n)}}}A(fw,"createLogger");var i6=fw(),r6=i6;Ce();Ce();function mw(e,t){return"".concat(t," ").concat(e)}A(mw,"formatMessage");var yw=class extends Error{constructor(t,i=dw){super(mw(t,i)),this.name="MappedinError"}};A(yw,"MappedinError");var n6=yw,Af=A(e=>e,"linearEase"),a6=A(e=>e*e,"quadEaseIn"),gw=A(e=>1-Math.cos(e*Math.PI/2),"easeIn"),o6=A(e=>1-(1-e)*(1-e),"quadEaseOut"),s6=A(e=>1-Math.pow(1-e,3),"cubicEaseOut"),_w={linear:Af,"ease-in":a6,"ease-out":o6,"ease-in-out":gw,"ease-out-cubic":s6};function xw(e,t,i,r,n,a=Af){if(t===i)return n;e=Math.max(t,Math.min(e,i));let o=(e-Math.min(t,i))/Math.abs(i-t),s=typeof a=="function"?a(o):_w[a](o);return r+s*(n-r)}A(xw,"interpolate");function vw(e,t){let i=0;if(t.length<2)return i;let r=t[0]<t[1]?(n,a)=>n>a:(n,a)=>n<a;for(;i<t.length-1&&r(e,t[i+1]);)i++;return i>t.length-2?Math.max(0,t.length-2):i}A(vw,"getInterpolationBreakpoint");function bw(e,t,i,r="ease-in"){if(t.length!==i.length)throw new n6("Input and output ranges must have the same number of values.");e=Math.max(t[0],Math.min(e,t[t.length-1]));let n=vw(e,t),a=(e-t[n])/(t[n+1]-t[n]),o=typeof r=="function"?r(a):_w[r](a);return i[n]+o*(i[n+1]-i[n])}A(bw,"interpolateMulti");Ce();var l6=(()=>{let e;return{getDeviceType(){if(e)return e;let{userAgent:t,platform:i,maxTouchPoints:r}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),a=i==="iPad"||i.indexOf("Mac")===0&&r>0&&!window.MSStream,o=/android/i.test(t);return e={isIpad:a,isMobile:o||n||a,isIOS:n,isAndroid:o,isSafari12:/Version\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},e},_reset(){e=void 0}}})(),y1=l6.getDeviceType,ww=(()=>{let e,t,i;function r(){if(t!==void 0)return t;e||(e=document.createElement("canvas"));let a=e.getContext("webgl")||e.getContext("experimental-webgl");if(!a)return t;try{let o=y1().isFirefox?null:a.getExtension("WEBGL_debug_renderer_info");return t=o?a.getParameter(o.UNMASKED_RENDERER_WEBGL):a.getParameter(a.RENDERER),t}catch(o){let s=new Error("Failed getting device info");throw s.name="FailedGettingDeviceInfo",s}}A(r,"getInfo");function n(){var a,o;if(!y1().isWindows)return!1;if(i!==void 0)return i;let s=(o=(a=u6())==null?void 0:a.toLowerCase())!=null?o:"";return i=s.includes("intel")&&(s.includes("uhd")||s.includes("iris")),i}return A(n,"shouldDisableOffscreenCanvas"),{getInfo:r,shouldDisableOffscreenCanvas:n,_setCanvas(a){e=a,t=void 0,i=void 0}}})(),u6=ww.getInfo,h6=ww.shouldDisableOffscreenCanvas;Ce();function Pw(e){let t=new Image;return e&&(/<svg[\s\S]*>/i.test(e)?t.src="data:image/svg+xml;base64,".concat(btoa(e)):t.src=e),t}A(Pw,"createImage");function gf(e){return(e*100|0)/100}A(gf,"fastTrunc");function Sw(e,t=0){let i=3735928559^t,r=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),i=Math.imul(i^a,2654435761),r=Math.imul(r^a,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&r)+(i>>>0)}A(Sw,"cyrb53");var Tw=class extends nh{constructor(t,i,r){super(),N(this,"dirty",!1),N(this,"state"),N(this,"colliderContext"),N(this,"colliderCanvas"),N(this,"transformRequestFunc"),N(this,"transformRequest",A(async n=>this.transformRequestFunc?await this.transformRequestFunc(n):{url:n},"transformRequest")),N(this,"pinCache",{}),N(this,"imageCache",{}),N(this,"imagePromiseCache",{}),N(this,"imageDimensionsCache",{}),N(this,"textCache",{}),N(this,"update",A(n=>{let a=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let o,s,l,u,h,c;for(let p of this.state.entities)if((p==null?void 0:p.component)instanceof J1&&!p.disposed){if(c=p.component,h=c.appearance.iconVisible,c.appearance.icon!=null&&h!=null){let f=typeof h=="boolean"?h:n>=h;f!==c.iconVisible&&(c.iconVisible=f,c.dirty=!0)}if((c.pinDirty||c.dirty||this.dirty)&&c.calculatePinSize(),c.offscreen||!c.visible)continue;if(s={active:c.appearance.pinColor,inactive:c.appearance.pinColorInactive},l={active:c.appearance.pinOutlineColor,inactive:c.appearance.pinOutlineColorInactive},u=gf(c.pinSize),o="".concat(s.active,"-").concat(s.inactive,"-").concat(l.active,"-").concat(l.inactive,"-").concat(u,"-").concat(c.iconVisible),c.labelCacheId=o,(!this.pinCache[o]||this.dirty)&&(this.prepare(c,o,this.colliderContext),c.dirty=!0),(c.appearance.icon&&(!c.imageHash||c.pinDirty)||this.dirty)&&this.cacheImage(c),this.textCache[c.id]==null||c.textDirty||this.dirty){c.dirty=!0,this.textCache[c.id]={};let{textDrawFn:f,width:y,height:g}=this.processText(c.text,c.appearance.textSize,c.appearance.maxWidth,c.appearance.maxLines,c.appearance.lineHeight),_=["left","center","right"];for(let b of _)this.textCache[c.id][b]=this.textToCanvas(f,c.appearance.textSize,b,y,g,c.appearance.textColor,c.appearance.textOutlineColor);c.dimensions={width:Math.ceil(y/a),height:Math.ceil(g/a)}}let d=1;if(c.appearance.iconScale)if(typeof c.appearance.iconScale=="number")d=c.appearance.iconScale;else{let{on:f,input:y,output:g,easing:_}=c.appearance.iconScale;f==="zoom-level"?d=gf(bw(n,y,g,_!=null?_:"linear")):r6.warn("Unsupported interpolation property: ".concat(f))}c.recomputeCurrentStrategy(c.iconVisible?d:1),c.canShow&&(c.enabled||c.visibilityNeedsUpdate!==!1)&&this.draw(c,o,this.colliderContext),c.textDirty=!1,c.pinDirty=!1}this.dirty=!1},"update")),N(this,"processText",A((n,a,o,s,l)=>{let u=this.state.pixelRatio,{draw:h,maxWidth:c,maxHeight:p}=t6({text:n,size:a,pixelRatio:u,maxWidth:o,maxLines:s,lineHeight:l});return{textDrawFn:h,width:c+2.5*u*2,height:p+2.5*u*2}},"processText")),N(this,"textToCanvas",A((n,a,o,s,l,u,h)=>{let c=this.state.pixelRatio,p,d=s,f=l;window.OffscreenCanvas!=null&&!h6()?p=new OffscreenCanvas(d,f):(p=document.createElement("canvas"),p.width=d,p.height=f,p.style.width=d+"px",p.style.height=f+"px");let y=p.getContext("2d",{willReadFrequently:!0});if(!y)return;let g=2.5*c;y.textAlign=o,y.font="bold ".concat(a*c,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),y.textBaseline="middle",y.lineJoin="miter",y.miterLimit=2,y.strokeStyle="white",y.lineWidth=g,y.fillStyle=u,y.strokeStyle=h;let _=o==="left"?g/2:o==="center"?d/2:d-g/2;return n(y,_,(f+g/2)/2),p},"textToCanvas")),N(this,"cacheImage",A(n=>{if(!n.appearance.icon)return;let a=Sw(n.appearance.icon);this.imagePromiseCache[a]||(this.imagePromiseCache[a]=new Promise(o=>{this.transformRequest(n.appearance.icon).then(s=>{let l=Pw(s.url);l.onload=()=>{this.imageCache[a]=l,this.publish("img:loaded"),o(l)}})})),n.imageHash!==a&&(n.imageHash=a,this.imagePromiseCache[a].then(()=>{n.dirty=!0}))},"cacheImage")),N(this,"createPinCanvas",A((n,a,o,s,l=1)=>{let u,h=this.state.pixelRatio,c=n.totalPinSize*2*h*l;window.OffscreenCanvas!=null?u=new OffscreenCanvas(c,c):(u=document.createElement("canvas"),u.width=c,u.height=c,u.style.width=c/h+"px",u.style.height=c/h+"px");let p=u.getContext("2d");return p.shadowColor="rgba(0,0,0,0.3)",p.shadowOffsetY=2*h,p.shadowBlur=5*h,p.beginPath(),p.arc(c/2,c/2,(a/2+2.5*h/2)*l,0,2*Math.PI),p.fillStyle=o,p.fill(),p.beginPath(),p.arc(c/2,c/2,a/2*l,0,2*Math.PI),p.shadowColor="transparent",p.fillStyle=s,p.fill(),u},"createPinCanvas")),N(this,"prepare",A((n,a,o)=>{let s=this.state.pixelRatio;o.lineWidth=4*s;let l=typeof n.appearance.iconScale=="number"?[n.appearance.iconScale]:n.appearance.iconScale==null?[]:n.appearance.iconScale.output,u=l.length>0?Math.max(...l):void 0,h=this.createPinCanvas(n,n.pinSize,n.appearance.pinOutlineColor,n.appearance.pinColor,u),c=this.createPinCanvas(n,3.5*s,n.appearance.pinOutlineColorInactive,n.appearance.pinColorInactive,u);this.pinCache[a]=[h,c]},"prepare")),this.state=t,this.colliderCanvas=i,this.colliderContext=i.getContext("2d"),this.transformRequestFunc=r}draw(t,i,r){var n;if(!t.canShow||!t.visible)return;r.save(),r.globalAlpha=t.currentOpacity;let a=this.state.pixelRatio,o=t.projection.x*a,s=t.projection.y*a,l=t.style.pinVisibility===1?this.pinCache[i][0]:this.pinCache[i][1],u=t.style.pinVisibility===1?t.scaledPinSize*a:t.totalPinSize*a;if(t.style.pinVisibility!==0&&r.drawImage(l,o-u,s-u,u*2,u*2),t.appearance.icon&&t.iconVisible&&t.imageHash&&t.appearance.iconSize&&this.imageCache[t.imageHash]&&t.style.pinVisibility===1){let h=this.imageCache[t.imageHash],c=(t.scaledPinSize-t.scaledIconPadding)*a,p=t.appearance.iconFit,d=c,f=c,y="".concat(t.imageHash,"_").concat(p);if(this.imageDimensionsCache[y])d=this.imageDimensionsCache[y].width,f=this.imageDimensionsCache[y].height;else{let g=h.width*a,_=h.height*a;if(p==="contain"){let b=Math.sqrt(g**2+_**2),v=c/b;d=g*v,f=_*v}if(p==="cover"){let b=c/g,v=c/_,w=Math.max(b,v);d=g*w,f=_*w}}r.save(),r.beginPath(),r.arc(o,s,c/2,0,2*Math.PI),r.closePath(),((n=t==null?void 0:t.appearance)==null?void 0:n.iconOverflow)!=="visible"&&r.clip(),r.drawImage(h,o-d/2,s-f/2,d,f),r.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left!=null&&t.style.top!=null&&r.drawImage(this.textCache[t.id][t.style.textAlign],o+t.style.left*a,s+t.style.top*a),r.restore()}};A(Tw,"TwoDDrawSystem");var c6=Tw;Ce();var Mw=class extends nh{constructor(t){super(),N(this,"state"),N(this,"animating",new Map),N(this,"isAnimating",!1),N(this,"startTime",-1),N(this,"showDuration",300),N(this,"hideDuration",250),N(this,"update",A(()=>{var i;this.animating.clear();for(let r of this.state.entities){let n=r.component;n instanceof J1&&(n.visibilityNeedsUpdate==="show"?(n.canShow=!0,this.animating.set(n,[n.currentOpacity,(i=n.appearance.opacity)!=null?i:1])):n.visibilityNeedsUpdate==="hide"&&this.animating.set(n,[n.currentOpacity,0]))}this.startTime=performance.now(),this.publish("animate:2d")},"update")),N(this,"playAnimations"),this.state=t,this.playAnimations=this._playAnimations}_playAnimations(){let t=performance.now();for(let[i,[r,n]]of this.animating.entries()){let a=n===1?this.showDuration:this.hideDuration,o=(t-this.startTime)/a;i.currentOpacity=xw(o,0,1,r,n,n===0?Af:gw),t-this.startTime>=a&&(n===1?i.canShow=!0:n===0&&(i.canShow=!1),i.visibilityNeedsUpdate=!1,this.animating.delete(i))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};A(Mw,"TwoDVisibilitySystem");var p6=Mw;Ce();var d6=["running","paused"],Cw=class{constructor(t){N(this,"state"),this.state=t}update(t){let i;for(let r of this.state.entities)if(r&&(i=r.component,i&&"containerEl"in i&&i.markerContainer!=null)){let n=i;n.visibilityNeedsUpdate!==!1&&(n.visibilityNeedsUpdate==="show"?n.canShow=!0:n.canShow=!1),n.offscreen&&(n.animation&&(n.animation.cancel(),n.animation=null),n.markerContainer.style.opacity="0");let a=n.animation!=null&&(n.animation.pending===!0||d6.includes(n.animation.playState));if((n.canShow&&n.visible===!0||a)&&!n.offscreen&&(n.markerContainer.style.transform="translate3D(".concat(n.projection.x,"px, ").concat(n.projection.y,"px, 0px)")),n.canShow===!0&&n.visible===!0&&!n.offscreen?n.markerContainer.style.pointerEvents=t?"none":n.pointerEvents:n.markerContainer.style.pointerEvents="none",n.currentStrategyIndex===-1&&n.visible&&n.visibilityNeedsUpdate==="show")continue;n.visibilityNeedsUpdate!==!1&&!n.offscreen&&(n.visibilityNeedsUpdate==="show"&&(n.markerContainer.style.opacity="0"),n.animation&&n.animation.cancel(),n.animation=n.markerContainer.animate([{opacity:n.canShow&&n.visible?"1":"0"}],{duration:300,easing:"ease-in-out",fill:"forwards"}),n.visibilityNeedsUpdate=!1)}}};A(Cw,"DOMDrawSystem");var f6=Cw;Ce();var Iw=class{constructor(t,i){N(this,"state"),N(this,"dirty",!0),N(this,"domTree"),this.state=t,this.domTree=i}update(){var t;if(this.dirty){for(let i of Array.from(this.domTree.children)){let r=(t=i.userData)==null?void 0:t.entityId,n=r!=null?this.state.entityMap.get(r):void 0;if(n){let a=n.component;(!a.enabled||!a.visible||!this.state.entityIds.has(r))&&this.domTree.removeChild(i)}else this.domTree.removeChild(i)}for(let i of this.state.entities){let r=i.component;r instanceof If&&r.enabled&&r.markerContainer&&!this.domTree.contains(r.markerContainer)&&(r.markerContainer.userData={entityId:i.id},this.domTree.appendChild(r.markerContainer),r.updateDimensionsIfZeroWidthHeight())}this.dirty=!1}}};A(Iw,"DOMVisibilitySystem");var m6=Iw;Ce();var Aw=class extends nh{constructor(t,i){super(),N(this,"state"),N(this,"dirty",!0),N(this,"domTree"),N(this,"observers",new Map),N(this,"updateDimensions",A(r=>{var n;for(let a of r){let o=(n=a.target.parentElement)==null?void 0:n.getAttribute("data-marker-id");if(o){let s=this.state.entityMap.get(o);if(s){let l=s.component;l instanceof If&&(l.updateDimensions(a.contentRect.width,a.contentRect.height),l.collisionDirty=!0)}}}this.publish("dimensions-update")},"updateDimensions")),this.state=t,this.domTree=i}setupObserver(){var t;for(let i of this.observers.values())i.disconnect();this.observers.clear();for(let i of this.domTree.children){let r=i.getAttribute("data-marker-id");if(r!=null){let n=this.state.entityMap.get(r);if(n){let a=n.component;if((t=a.options)!=null&&t.dynamicResize){let o=new ResizeObserver(this.updateDimensions);o.observe(a.containerEl),this.observers.set(i.userData.entityId,o)}}}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};A(Aw,"DOMResizeSystem");var y6=Aw,Wu=9,wt,Na,eh,Zi,Va,ii,ja,Ur,Ua,gs,fn,Xn,Pr,vr,br,wr,Sr,Ku,th,Ju,Ew,kw,_f,Qu,xf,vf,Dw=class{constructor(t,i,r,n={}){Ge(this,Ju),Ge(this,wt),Ge(this,Na),Ge(this,eh),Ge(this,Zi),Ge(this,Va),Ge(this,ii),Ge(this,ja),Ge(this,Ur),Ge(this,Ua),Ge(this,gs),Ge(this,fn),Ge(this,Xn,Wu),Ge(this,Pr,null),Ge(this,vr,null),Ge(this,br,null),Ge(this,wr,null),N(this,"collidersNeedRecomputing",!0),Ge(this,Sr),Ge(this,Ku,0),Ge(this,th,[]),Ge(this,_f,A(()=>{G(this,wr)&&(cancelAnimationFrame(G(this,wr)),_e(this,wr,null)),_e(this,wr,requestAnimationFrame(()=>{_e(this,wr,null),G(this,Ur).update(),G(this,Qu).call(this)}))},"#onVisibilityChanged")),Ge(this,Qu,A(()=>{_e(this,vr,requestAnimationFrame(()=>{_e(this,vr,null),G(this,ja).update(G(this,Ku)),G(this,Ua).update(!1)}))},"#draw2DEntities")),Ge(this,xf,A(()=>{G(this,Qu).call(this)},"#onDraw2D")),Ge(this,vf,A(()=>{G(this,br)&&(cancelAnimationFrame(G(this,br)),_e(this,br,null)),_e(this,br,requestAnimationFrame(()=>{_e(this,br,null),G(this,Ur).playAnimations()}))},"#onAnimate2D"));var a,o;_e(this,wt,i),_e(this,Na,t),_e(this,eh,r),_e(this,Sr,(a=n.watermark)!=null?a:{width:0,height:0,position:"bottom-left"}),_e(this,Zi,document.createElement("canvas")),G(this,Zi).style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1;",t.appendChild(G(this,Zi));let s=document.createElement("div");s.classList.add("mappedin-2d-entities"),Object.assign(s.style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",overflow:"hidden",pointerEvents:"none",zIndex:"2",transformStyle:"preserve-3d"}),t.appendChild(s),_e(this,Va,s),this.resize(),_e(this,ii,new Q4(i,G(this,Na).clientWidth,G(this,Na).clientHeight,n.workerUrl,(o=n.useCollisionWorker)!=null?o:!0,t)),_e(this,ja,new c6(i,G(this,Zi),n.transformImageRequest)),_e(this,Ur,new p6(i)),_e(this,Ua,new f6(i)),_e(this,gs,new m6(i,G(this,Va))),_e(this,fn,new y6(i,G(this,Va))),G(this,ii).on("visibility-changed",G(this,_f),{signal:G(this,ii).signal}),G(this,Ur).on("draw:2d",G(this,xf),{signal:G(this,Ur).signal}),G(this,Ur).on("animate:2d",G(this,vf),{signal:G(this,Ur).signal}),G(this,fn).on("dimensions-update",()=>{G(this,ii).collidersDirty=!0,nf(this,Ju,kw).call(this)},{signal:G(this,fn).signal})}get collisionSystem(){return G(this,ii)}get drawSystem(){return G(this,ja)}get domDrawSystem(){return G(this,Ua)}registerEntity(t){G(this,wt).entityMap.set(t.id,t)}addEntity(t){G(this,wt).entityMap.set(t.id,t),G(this,wt).entities.add(t),G(this,wt).entityIds.add(t.id)}activateEntity(t){G(this,wt).entities.add(t),G(this,wt).entityIds.add(t.id)}deactivateEntity(t){G(this,wt).entities.delete(t),G(this,wt).entityIds.delete(t.id)}removeEntity(t){G(this,wt).entities.delete(t),G(this,wt).entityMap.delete(t.id),G(this,wt).entityIds.delete(t.id)}clearEntities(){G(this,wt).entities.clear(),G(this,wt).entityMap.clear(),G(this,wt).entityIds.clear()}getEntity(t){return G(this,wt).entityMap.get(t)}hasActiveEntity(t){return G(this,wt).entities.has(t)}resize(){var t;let{clientWidth:i,clientHeight:r}=G(this,Na),n=G(this,wt).pixelRatio;G(this,Zi).width=i*n,G(this,Zi).height=r*n,G(this,Zi).style.width=i+"px",G(this,Zi).style.height=r+"px",(t=G(this,ii))==null||t.resizeCanvas(i,r)}update(t,i,r=!1,n=[]){_e(this,Ku,t),_e(this,th,n),nf(this,Ju,Ew).call(this),G(this,gs).update(),G(this,fn).update(),G(this,vr)&&(cancelAnimationFrame(G(this,vr)),_e(this,vr,null)),G(this,ja).update(t),G(this,Ua).update(i);let a=this.collidersNeedRecomputing,o=!a&&r;a&&_e(this,Xn,Wu),B4(this,Xn)._++,G(this,Xn)>=Wu&&(_e(this,Xn,0),G(this,ii).update(G(this,Sr).width,G(this,Sr).height,G(this,Sr).position,o,n)),this.collidersNeedRecomputing=!1}updateWatermark(t){_e(this,Sr,t)}markDirty(){G(this,gs).dirty=!0,G(this,fn).dirty=!0,G(this,ii).collidersDirty=!0,this.collidersNeedRecomputing=!0,_e(this,Xn,Wu)}cancelPendingFrames(){G(this,Pr)&&(cancelAnimationFrame(G(this,Pr)),_e(this,Pr,null)),G(this,vr)&&(cancelAnimationFrame(G(this,vr)),_e(this,vr,null)),G(this,br)&&(cancelAnimationFrame(G(this,br)),_e(this,br,null)),G(this,wr)&&(cancelAnimationFrame(G(this,wr)),_e(this,wr,null))}createLabel(t,i){return new rh(t,i,G(this,wt).pixelRatio)}createMarker(t,i={}){return new If(t,i)}showCollisionBoxes(){G(this,ii).showCollisionBoxes()}hideCollisionBoxes(){G(this,ii).hideCollisionBoxes()}destroy(){this.cancelPendingFrames(),G(this,ii).destroy(),G(this,fn).destroy(),G(this,Zi).remove(),G(this,Va).remove()}};wt=new WeakMap,Na=new WeakMap,eh=new WeakMap,Zi=new WeakMap,Va=new WeakMap,ii=new WeakMap,ja=new WeakMap,Ur=new WeakMap,Ua=new WeakMap,gs=new WeakMap,fn=new WeakMap,Xn=new WeakMap,Pr=new WeakMap,vr=new WeakMap,br=new WeakMap,wr=new WeakMap,Sr=new WeakMap,Ku=new WeakMap,th=new WeakMap,Ju=new WeakSet,Ew=A(function(){for(let e of G(this,wt).entities){let t=e.worldPosition,i=G(this,eh).call(this,t.x,t.y,t.z);i?(e.component.projection.x=i.x,e.component.projection.y=i.y,e.component.offscreen=!1):e.component.offscreen=!0}},"#projectEntities"),kw=A(function(){G(this,Pr)&&(cancelAnimationFrame(G(this,Pr)),_e(this,Pr,null)),_e(this,Pr,requestAnimationFrame(()=>{_e(this,Pr,null),G(this,ii).update(G(this,Sr).width,G(this,Sr).height,G(this,Sr).position,!1,G(this,th))}))},"#scheduleCollisionUpdate"),_f=new WeakMap,Qu=new WeakMap,xf=new WeakMap,vf=new WeakMap,A(Dw,"TwoDPipeline");var k7=Dw;O();import{z as Xe}from"zod";var Lw=Z1,zw=Q1,g6=Xe.object({rank:S1.optional(),appearance:Cf.optional(),interactive:Xe.boolean().default(!1),textPlacement:Xe.union([Xe.enum(Lw),Xe.array(Xe.enum(Lw))]).default(Tf),occlude:Xe.boolean().default(!0)}),Ef=Xe.object({rank:Xe.union([Xe.enum(["low","medium","high","always-visible"]),Xe.number()]).optional(),interactive:Xe.union([Xe.boolean(),Xe.literal("pointer-events-auto")]).optional(),id:Xe.string().optional(),placement:Xe.union([Xe.enum(zw),Xe.array(Xe.enum(zw))]).optional(),dynamicResize:Xe.boolean().optional(),zIndex:Xe.number().optional(),lowPriorityPin:Xe.object({size:Xe.number().positive().optional(),color:Xe.string().optional()}).optional()}),_6=e=>{g6.parse(e!=null?e:{})},F7=(e,t,i)=>{Xe.array(Xe.number()).min(2).max(3).parse(e),Xe.string().parse(t),_6(i)};function B7(e,t,i){Xe.array(Xe.number()).min(2).max(3).parse(e),Xe.string().parse(t),Ef.parse(i)}O();O();var kf=[0,4,6,8,10],ah=()=>{let e=new Array(16).fill(0),t=Math.random()*4294967296;for(let r=0;r<e.length;r++)r>0&&(r&3)===0&&(t=Math.random()*4294967296),e[r]=t>>>((r&3)<<3)&255;let i=e.map(r=>r.toString(16).padStart(2,"0"));return i[6]="4"+i[6][1],i[8]=["8","9","a","b"].includes(i[7][0])?i[7]:"a"+i[7][1],kf.map((r,n)=>i.slice(r,n===kf.length-1?void 0:kf[n+1]).join("")).join("-")};function V7(e,t=0){let i=3735928559^t,r=1103547991^t;for(let n=0,a;n<e.length;n++)a=e.charCodeAt(n),i=Math.imul(i^a,2654435761),r=Math.imul(r^a,1597334677);return i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),4294967296*(2097151&r)+(i>>>0)}var qn=class extends Kt{constructor(){super(...arguments);k(this,"type","geometry");k(this,"userData",{entityId:"",type:"geometry"});k(this,"components",[])}raycast(i,r){this.userData.type==="model"&&this.children[0]&&i.intersectObject(this.children[0],!0).forEach(n=>{r.push(n)})}},di=class{constructor(t,i){k(this,"id",ah());k(this,"components");k(this,"parentId");k(this,"type");k(this,"entities2D",new Map);this.components=[t,i],this.type=t.type}getComponent(t){return this.components.find(i=>(i==null?void 0:i.type)===t)}get object3d(){return this.components[0].mesh}get parentObject3D(){var t;return(t=this.components[0].mesh)==null?void 0:t.parent}attach(t){this.parentObject3D instanceof ri?t.object3d.userData.attachedEntityId=this.id:this.entities2D.set(t.id,t)}detach(t){this.parentObject3D instanceof ri&&(t.object3d.userData.parentEntityId=void 0),this.entities2D.delete(t.id)}removeAllEntities(){for(let t of this.entities2D.values())this.detach(t)}};O();var Tr=class extends Kt{},Gr=class{constructor(t,i,r=0){k(this,"id");k(this,"type");k(this,"entity2D");k(this,"verticalOffset");k(this,"object3d",new Tr);k(this,"components");k(this,"disposed",!1);k(this,"worldPosition",new We);this.id=t.id||ah(),this.components=[t],this.verticalOffset=r,this.object3d=new Tr,this.object3d.position.set(i.x,i.y,i.z+r),this.object3d.userData.entityId=this.id,this.type=t.type,this.object3d.userData.type=this.type,this.positionDirty=!0,this.entity2D=new w1(t,{x:i.x,y:i.y,z:i.z+r})}get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}getComponent(t){return this.components.find(i=>(i==null?void 0:i.type)===t)}get position(){return this.positionDirty&&(this.object3d.matrixAutoUpdate=!0,this.object3d.getWorldPosition(this.worldPosition),this.positionDirty=!1,this.object3d.matrixAutoUpdate=!1),this.worldPosition}get positionDirty(){return this.object3d.userData.worldPositionDirty}set positionDirty(t){this.object3d.userData.worldPositionDirty=t}updatePosition(t){this.object3d.position.copy(t),this.positionDirty=!0}setAltitude(t){this.object3d.position.z=t,this.positionDirty=!0}syncPosition(){let t=this.position;this.entity2D.worldPosition.x=t.x,this.entity2D.worldPosition.y=t.y,this.entity2D.worldPosition.z=t.z}};O();function Df(e){return e instanceof Xs?Number.isFinite(e.min.x)&&Number.isFinite(e.min.y)&&Number.isFinite(e.max.x)&&Number.isFinite(e.max.y):Number.isFinite(e.min.x)&&Number.isFinite(e.min.y)&&Number.isFinite(e.max.x)&&Number.isFinite(e.max.y)&&Number.isFinite(e.min.z)&&Number.isFinite(e.max.z)}O();import{z as we}from"zod";O();O();var oh=class{constructor(){k(this,"_subscribers",{});k(this,"_abortController",new AbortController);k(this,"_cleanupFunctions",[])}get signal(){return this._abortController.signal}publish(t,i){!this._subscribers||!this._subscribers[t]||this.signal.aborted||this._subscribers[t].forEach(function(r){typeof r=="function"&&r(i)})}onAbort(t){this.signal.addEventListener("abort",()=>t(),{once:!0})}on(t,i,r){let n=r==null?void 0:r.signal;if(n!=null&&n.aborted||this._abortController&&this._abortController.signal.aborted)return()=>{};this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(i);let a=()=>this.off(t,i);return n&&n.addEventListener("abort",a,{once:!0}),this._cleanupFunctions.push(a),a}off(t,i){if(!this._subscribers||this._subscribers[t]==null||this.signal.aborted)return;let r=this._subscribers[t].indexOf(i);r!==-1&&this._subscribers[t].splice(r,1)}destroy(){if(!this.signal.aborted){for(let t of this._cleanupFunctions)t();this._cleanupFunctions=[],this._subscribers={},this._abortController.abort()}}};var Rw=class extends oh{constructor(i,r,n=!0){super();k(this,"rendererState");k(this,"convertTo3DMapPosition");k(this,"textSet",new Set);k(this,"batchedTextMap",new Map);k(this,"resolvedBatchedTextMap",new Map);k(this,"useWorker",!0);k(this,"debugTextAreaMesh",new Map);(n===!1||!Yh())&&(this.useWorker=!1,x6(!1)),this.rendererState=i,this.convertTo3DMapPosition=r}remove(i){this.textSet.delete(i)}getBatchedText(i){return this.resolvedBatchedTextMap.get(i)}update(i){var s,l,u;let r,n,a,o=[];for(let h of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(h),(r==null?void 0:r.type)==="text3d"){n=r.components[0],a=r.components[1];let c=(s=n.mesh)==null?void 0:s.parent;if(!c||!(c instanceof ni)||!(n instanceof lh))continue;if("textArea"in n.feature.properties&&n.mesh!=null&&n.polygonEntityId!=null&&n.textMesh==null&&n.mesh.parent!=null&&((u=(l=n.feature.properties)==null?void 0:l.textArea)==null?void 0:u.position)!=null){if(this.textSet.has(n.polygonEntityId))continue;this.textSet.add(n.polygonEntityId),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,Xa().then(({BatchedText:f})=>{let y=new f;return y.type="batchedtext",c.add(y),this.resolvedBatchedTextMap.set(c,y),y}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");o.push(Fw({entityId:h,textComponent:n,styleComponent:a,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"text-area"}).then(f=>(f&&f.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(f.textComponent,i),f)))}else if(n.mesh!=null&&n.textMesh==null&&n.mesh.parent!=null){if(this.textSet.has(h.toString()))continue;this.textSet.add(h.toString()),this.batchedTextMap.has(c)||this.batchedTextMap.set(c,Xa().then(({BatchedText:f})=>{let y=new f;return y.type="batchedtext",c.add(y),this.resolvedBatchedTextMap.set(c,y),y}));let d=this.batchedTextMap.get(c);if(!d)throw new Error("batched text required");o.push(Fw({entityId:h,textComponent:n,styleComponent:a,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:d,rendererState:this.rendererState,type:"point"}).then(f=>(f&&f.styleComponent.flipToFaceCamera!==!1&&this.flipIfNeeded(f.textComponent,i),f)))}let p=this.batchedTextMap.get(c);n.textMesh&&p&&Promise.all([p,Promise.resolve({meshComponent:n,styleComponent:a})]).then(([d,{meshComponent:f,styleComponent:y}])=>{let{textMesh:g}=f;if(g){if(d){let _=Rf(d,g);f.visible&&!_?d.add(g):!f.visible&&_&&d.remove(g)}y.flipToFaceCamera&&this.flipIfNeeded(f,i)}})}return Promise.all(o).then(h=>{if(h.length===0)return;let c=new Set(h.map(d=>d==null?void 0:d.batchedText)),p=[];return c.forEach(d=>{p.push(new Promise(f=>{d?d.sync(()=>{f()}):f()}))}),this.publish("render"),Promise.all(p)})}flipIfNeeded(i,r){let n=i.textMesh;if(!n)return!1;let a=n.rotation.z,o=Gu(a+r);return o>Math.PI/2&&o<3*Math.PI/2?(n.rotation.z=Gu(a+Math.PI),n.updateMatrix(),!0):!1}showTextAreaMesh(){let i,r;for(let n of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(n),(i==null?void 0:i.type)==="text3d"&&(r=i.components[0],"textArea"in r.feature.properties)){let a=r.feature.properties.textArea;if(!a)continue;let o=new cy(a.maxWidth,a.maxHeight),s=new Yr(o,new Sn({color:"pink"})),{textMesh:l}=r;if(!l)continue;let u=this.convertTo3DMapPosition(a.position,ws);s.position.copy(u),s.position.z=l.position.z-.1,s.rotation.z=l.rotation.z,Lf.identity(),Lf.makeRotationAxis(new We(0,0,1),l.userData.rotationZ),ws.set(a.maxWidth/2,0,0),ws.applyMatrix4(Lf),s.position.x-=ws.x,s.position.y-=ws.y,this.rendererState.geometryScene.add(s),this.debugTextAreaMesh.set(n,s)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(i=>{this.rendererState.geometryScene.remove(i)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function x6(e){Xa().then(({configureTroikaTextBuilder:t})=>{t({useWorker:e})})}var Lf=new Ir,ws=new We,zf;async function mZ(e){let{preloadFont:t}=await Xa();return t(e)}function Xa(){return zf||(zf=import("./text3d-I6QPYM5K.js").then(e=>e)),zf}async function Fw({entityId:e,textComponent:t,styleComponent:i,convertTo3DMapPosition:r,batchedMeshPromise:n,rendererState:a,type:o="text-area"}){return Promise.all([Xa(),Promise.resolve({entityId:e,meshComponent:t,styleComponent:i})]).then(([{createTroikaTextPoint:s,createTroikaTextArea:l},u])=>o==="text-area"?l(u.entityId,u.meshComponent,u.styleComponent,r):s(u.entityId,u.meshComponent,u.styleComponent,r)).catch(s=>{Ft.warn("Trouble creating text: ",s)}).then(s=>{if(!(s!=null&&s.text))return;let l=[Promise.resolve(s.text),n,Promise.resolve()];if(t.polygonEntityId){let u=a.geometry3DMap.get(t.polygonEntityId);if((u==null?void 0:u.type)==="geometry"){let h=u.components[0],c=u.components[1];h.textMesh=s.text,s.text.position.z=c.altitude+c.height+v6}}else l[2]=Xa().then(({syncText:u})=>u(s.text));return Promise.all(l)}).then(s=>{if(!s)return;let[l,u]=s;return u.add(l),t.batchedText||(t.batchedText=u),{text:l,batchedText:u,textComponent:t,styleComponent:i}})}function Rf(e,t){return e._members.has(t)}var v6=.5;var b6=we.object({visible:we.boolean(),color:we.string(),flipToFaceCamera:we.boolean(),font:we.string().optional(),fontSize:we.number(),margin:we.union([we.number(),we.tuple([we.number(),we.number(),we.number(),we.number()])]),outlineColor:we.string(),outlineOpacity:we.number(),outlineBlur:we.union([we.number(),we.string()]),outlineWidth:we.number(),outlineOffsetX:we.number(),outlineOffsetY:we.number(),strokeWidth:we.number(),maxWidth:we.number().optional(),maxHeight:we.number().optional(),strokeOpacity:we.number(),strokeColor:we.string(),fillOpacity:we.number(),hoverColor:we.string().optional(),id:we.union([we.string(),we.number()]),type:we.literal("text3d"),position:we.tuple([we.number(),we.number(),we.number()]),content:we.string(),rotation:we.number()}),Bw=we.strictObject(b6.partial().omit({id:!0,type:!0}).shape),Ow=we.strictObject(Bw.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0,rotation:!0}).shape),wZ=we.strictObject({appearance:Bw.optional(),parentId:we.string().optional()}),lh=class{constructor(t){k(this,"mesh",new qn);k(this,"textMesh");k(this,"type","text3d");k(this,"feature");k(this,"parent");k(this,"batchedText");k(this,"polygonEntityId");this.feature=t}get visible(){return this.batchedText&&this.textMesh?Rf(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(t){this.batchedText&&this.textMesh?t?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=t),this.mesh.visible=t}};O();var qa,uh=class{constructor(t){k(this,"type","outline");k(this,"color");k(this,"dirty",!0);k(this,"enabled",!0);zi(this,qa,!1);k(this,"edgeColors");k(this,"edgeVisibility");k(this,"geometry");k(this,"ranges");k(this,"topFaceVerticesIndices");this.color=t}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(t){if(!this.edgeVisibility||!this.ranges||Xt(this,qa)===t)return;wi(this,qa,t);let i=this.edgeVisibility.array,r=t?1:0;for(let n=0;n<this.ranges.count;n++){let a=this.ranges.start+n;i[a]=r}this.edgeVisibility.needsUpdate=!0}get visible(){return Xt(this,qa)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};qa=new WeakMap;O();O();function kZ(e){return e instanceof Mr?e.material:null}function Ff(e,t){return e==="auto"?t===1?jh:Uh:e==="back"?ty:e==="front"?jh:Uh}function DZ(e,t,i=1){let r=Ff(t,i);e.side!==r&&(e.side=r)}O();O();var hh=class extends oy{constructor(i){let r=i,n=3,a=n*4;super(new Uint8Array(i*a),n,i,ry,iy);k(this,"_width");k(this,"_height");k(this,"_propertiesLength");this._width=a,this._height=r,this._propertiesLength=n}setColor(i,r,n){let a=this.image.data,o=i*this._width;a[o]=Math.round(r.r*255),a[o+1]=Math.round(r.g*255),a[o+2]=Math.round(r.b*255),a[o+3]=0,a[o+4]=Math.round(n.r*255),a[o+5]=Math.round(n.g*255),a[o+6]=Math.round(n.b*255),a[o+7]=0,this.needsUpdate=!0}getColor(i){let r=this.image.data,n=i*this._width,a=new Ri(r[n]/255,r[n+1]/255,r[n+2]/255),o=new Ri(r[n+4]/255,r[n+5]/255,r[n+6]/255);return{color:a,topColor:o}}setTexture(i,r,n){let a=this.image.data,o=i*this._width;a[o+8]=r?255:0,a[o+9]=n?255:0,a[o+10]=0,a[o+11]=0,this.needsUpdate=!0}getTexture(i){let r=this.image.data,n=i*this._width,a=r[n+8]===255,o=r[n+9]===255;return{texture:a,topTexture:o}}};O();var Nw="#define LAMBERT\nvarying vec3 vViewPosition;\nvarying vec4 vPosition;\nvarying vec2 vUv;\nvarying vec4 finalPosition;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\nvarying float vBatchId;\nvarying vec4 vWorldPosition;\nvarying vec3 vWorldNormal;\n\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n vWorldNormal = normalize((modelMatrix * vec4(objectNormal, 0.0)).xyz);\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n vec4 _fogWorldPos = vec4(transformed, 1.0);\n #ifdef USE_BATCHING\n _fogWorldPos = batchingMatrix * _fogWorldPos;\n #endif\n vWorldPosition = modelMatrix * _fogWorldPos;\n \n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n \n // To mitigate visual defects on machines such as windows and iOS\n vBatchId = getIndirectIndex(gl_DrawID) + 0.5;\n vViewPosition = - mvPosition.xyz;\n worldNormal = normal;\n vUv = uv;\n vVerticalOffset = position.z;\n}\n";O();var Vw="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform float uGradientEnd;\nuniform float uGradientIntensity;\nuniform float uMinSideAlpha;\nuniform float uMaxSideAlpha;\nuniform float uGradientStart;\nuniform highp sampler2D uPropertiesTexture;\nuniform highp sampler2D uTopTexture;\nuniform highp sampler2D uTexture;\nuniform float uRepeatYFactor;\nuniform bool uBlendTexture;\nuniform float effectStart;\nuniform float effectDistance;\nuniform float darkenAmount;\nuniform float darkenUseDepth;\nuniform float desaturateAmount;\nuniform float desaturateUseDepth;\nuniform float washOutAmount;\nuniform float washOutUseDepth;\nvarying float vBatchId;\n\nvarying vec2 vUv;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\n\nfloat shadowThreshold = 0.05;\nfloat shadowStrengthMultiplier = 0.6;\n\n#include <common>\nuniform sampler2D shadowMap;\nuniform mat4 lightMatrix;\nuniform float cameraNear;\nuniform float cameraFar;\nuniform float shadowBias;\nuniform float shadowOpacity;\nuniform vec3 baseColor;\nuniform float shadowMapSize;\nuniform float pcfSpread;\nuniform vec3 sunDir;\nuniform float normalBias;\nuniform bool shadowEnabled;\nuniform float depthRangeMax;\nvarying vec4 vWorldPosition;\nvarying vec3 vWorldNormal;\n\nfloat interleavedGradientNoise(vec2 position) {\n vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);\n return fract(magic.z * fract(dot(position, magic.xy)));\n}\n\n// Compile-time sample count for loop unrolling (injected via material)\n#ifndef PCF_SAMPLES\n#define PCF_SAMPLES 4\n#endif\n\n// Poisson disk samples - only define what we need based on sample count\n#if PCF_SAMPLES <= 4\nconst vec2 poissonDisk[4] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760)\n);\n#elif PCF_SAMPLES <= 8\nconst vec2 poissonDisk[8] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(-0.38277543, 0.27676845),\n vec2(0.97484398, 0.75648379)\n);\n#else\nconst vec2 poissonDisk[16] = vec2[](\n vec2(-0.94201624, -0.39906216),\n vec2(0.94558609, -0.76890725),\n vec2(-0.094184101, -0.92938870),\n vec2(0.34495938, 0.29387760),\n vec2(-0.91588581, 0.45771432),\n vec2(-0.81544232, -0.87912464),\n vec2(-0.38277543, 0.27676845),\n vec2(0.97484398, 0.75648379),\n vec2(0.44323325, -0.97511554),\n vec2(0.53742981, -0.47373420),\n vec2(-0.26496911, -0.41893023),\n vec2(0.79197514, 0.19090188),\n vec2(-0.24188840, 0.99706507),\n vec2(-0.81409955, 0.91437590),\n vec2(0.19984126, 0.78641367),\n vec2(0.14383161, -0.14100790)\n);\n#endif\n\n/**\n * Samples the shadow map using PCF (Percentage Closer Filtering)\n * Uses compile-time loop count for GPU optimization\n * @param lightSpacePos Position in light space coordinates\n * @param outDepthGap Output: average depth gap between receiver and caster (for self-shadow detection)\n * @returns Visibility factor (1.0 = fully lit, 0.0 = fully shadowed)\n */\nfloat sampleShadowWithDepthGap(vec3 lightSpacePos, out float outDepthGap) {\n float scaledTexelSize = (1.0 / shadowMapSize) * pcfSpread;\n float currentDepth = lightSpacePos.z * depthRangeMax;\n \n // Rotation for temporal stability\n float noise = interleavedGradientNoise(gl_FragCoord.xy) * 6.283185;\n float cosNoise = cos(noise);\n float sinNoise = sin(noise);\n mat2 rotation = mat2(cosNoise, -sinNoise, sinNoise, cosNoise);\n \n float shadow = 0.0;\n float totalDepthGap = 0.0;\n float shadowSamples = 0.0;\n \n // Compile-time unrolled loop - GPU can optimize this efficiently\n for(int i = 0; i < PCF_SAMPLES; i++) {\n vec2 offset = rotation * poissonDisk[i] * scaledTexelSize;\n vec2 uv = clamp(lightSpacePos.xy + offset, 0.0, 1.0);\n \n float sampledDepth = texture2D(shadowMap, uv).r;\n float inShadow = step(sampledDepth + shadowBias, currentDepth);\n shadow += inShadow;\n \n // Track depth gap for shadow samples\n if(inShadow > 0.5) {\n totalDepthGap += currentDepth - sampledDepth;\n shadowSamples += 1.0;\n }\n }\n \n // Calculate average depth gap (0 if no shadow samples)\n outDepthGap = shadowSamples > 0.0 ? totalDepthGap / shadowSamples : 0.0;\n \n return 1.0 - shadow / float(PCF_SAMPLES);\n}\n\n/**\n * Samples the shadow map using PCF (Percentage Closer Filtering)\n * Uses compile-time loop count for GPU optimization\n * @param lightSpacePos Position in light space coordinates\n * @returns Visibility factor (1.0 = fully lit, 0.0 = fully shadowed)\n */\nfloat sampleShadow(vec3 lightSpacePos) {\n float unusedDepthGap;\n return sampleShadowWithDepthGap(lightSpacePos, unusedDepthGap);\n}\n\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec3 blendTextureColor(vec3 diffuseColor, vec4 texColor) {\n vec3 texturedColor = diffuseColor * texColor.rgb;\n return mix(diffuseColor, texturedColor, texColor.a);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n\n // get the normalized world normal of vertex fragment\n vec3 surfaceNormal = normalize(worldNormal);\n\n // dot product with Z up (1.0 = horizontal top, 0.0 = vertical side)\n float dotUp = abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)));\n\n int idx = int(vBatchId) * 1;\n vec3 diffuse = texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb;\n bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r > 0.99;\n\n if(shouldShowTexture) {\n vec4 tex2d = texture2D(uTexture, vec2(vUv.x, vUv.y * uRepeatYFactor));\n diffuse = uBlendTexture ? blendTextureColor(diffuse, tex2d) : tex2d.rgb;\n }\n\n // if this is a fragment facing upwards, use topColor (dotUp > 0.99996 \u2248 angle < 0.02\xB0)\n if(dotUp > 0.99996) {\n bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g > 0.99;\n\n if(shouldShowTopTexture) {\n vec4 topTex2d = texture2D(uTopTexture, vUv);\n diffuse = uBlendTexture ? blendTextureColor(diffuse, topTex2d) : topTex2d.rgb;\n } else {\n diffuse = texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb;\n }\n }\n\n vec4 diffuseColor = vec4(diffuse, opacity);\n\n // only for vertical surfaces (dotUp < 0.0175 \u2248 angle > 89\xB0)\n if(dotUp < 0.0175) {\n\n // get the percentage of the z position from the ground, up\n float percentFromZeroZ = max((abs(vVerticalOffset) - uGradientStart) / uGradientEnd, 0.0);\n\n // gradient based on percentage\n float alpha = smoothstep(uMinSideAlpha, uMaxSideAlpha, percentFromZeroZ);\n\n // mix the shadow color with the diffuse color based on the alpha and opacity\n diffuseColor = vec4(mix(diffuseColor.rgb, diffuseColor.rgb * (1.0 - uGradientIntensity), 1.0 - alpha), opacity);\n }\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n\n // accumulation\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n if (shadowEnabled){\n vec3 surfaceNormal = normalize(vWorldNormal);\n float ndl = max(dot(surfaceNormal, -sunDir), 0.0);\n \n // Apply normal offset bias to prevent self-shadowing on thin geometry\n // Offset the position along the surface normal before shadow calculation\n vec3 normalOffset = surfaceNormal * normalBias;\n vec4 offsetWorldPos = vWorldPosition + vec4(normalOffset, 0.0);\n \n // Calculate shadow in light space using offset position\n vec4 shadowCoord = lightMatrix * offsetWorldPos;\n vec3 projCoords = shadowCoord.xyz / shadowCoord.w;\n \n // Check if fragment is within shadow map bounds\n bool inBounds = projCoords.x >= 0.0 && projCoords.x <= 1.0 && \n projCoords.y >= 0.0 && projCoords.y <= 1.0 && \n projCoords.z >= 0.0 && projCoords.z <= 1.0;\n \n \n if(inBounds){\n float depthGap;\n float visibility = sampleShadowWithDepthGap(projCoords, depthGap);\n float shadowIntensity = 1.0 - visibility;\n \n // Prevent self-shadowing on sun-facing surfaces, but keep real shadows from objects above\n // depthGap is small for self-shadowing, larger for real shadows from other objects\n // Only apply normal-based fade when depth gap is small (likely self-shadow)\n float selfShadowThreshold = 0.001; // Depth gap threshold for self-shadow detection\n float isSelfShadow = 1.0 - smoothstep(0.0, selfShadowThreshold, depthGap);\n \n // Normal-based fade: reduce shadows on sun-facing surfaces\n float normalFade = 1.0 - smoothstep(0.3, 0.7, ndl);\n \n // Combine: only apply normal fade for self-shadows, keep full intensity for real shadows\n float combinedFade = mix(1.0, normalFade, isSelfShadow);\n shadowIntensity *= combinedFade;\n \n // Only apply shadow if intensity is significant (prevents subtle darkening)\n if(shadowIntensity > shadowThreshold) {\n float shadowStrength = shadowIntensity * shadowOpacity;\n vec3 shadowedColor = mix(gl_FragColor.rgb, baseColor * gl_FragColor.rgb, shadowStrength * shadowStrengthMultiplier);\n gl_FragColor.rgb = shadowedColor;\n }\n }\n }\n\n // Depth-based visual effects: de-emphasize geometry below a given altitude.\n // effectStart = altitude where effects begin,\n // effectDistance = range over which effects reach full strength.\n if(effectDistance > 0.0) {\n // Normalized depth: 0 at effectStart altitude, 1 at the furthest affected geometry\n float t = clamp((effectStart - vWorldPosition.z) / effectDistance, 0.0, 1.0);\n // Depth curve: ramps quickly then plateaus (max ~0.9 to keep layers distinguishable)\n float fade = pow(t, 0.65) * 0.9;\n\n // Desaturate towards grayscale using perceptual luminance weights\n float luma = dot(gl_FragColor.rgb, vec3(0.299, 0.587, 0.114));\n float dsFade = desaturateUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(luma), desaturateAmount * dsFade);\n\n // Darken towards #333333\n float dkFade = darkenUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.2), darkenAmount * dkFade);\n\n // Wash out towards white\n float woFade = washOutUseDepth > 0.5 ? fade : 1.0;\n gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(1.0), washOutAmount * woFade);\n }\n\n #include <dithering_fragment>\n\n}\n";var w6=-.05,P6=1,Ps=class e extends py{constructor(i,r,n=1){super(i);k(this,"propertiesTexture");k(this,"texturesVisible",!1);k(this,"pcfSampleCount",4);k(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:void 0},uTexture:{value:void 0},uRepeatYFactor:{value:1},uBlendTexture:{value:!1},effectStart:{value:0},effectDistance:{value:0},darkenAmount:{value:0},darkenUseDepth:{value:1},desaturateAmount:{value:0},desaturateUseDepth:{value:1},washOutAmount:{value:0},washOutUseDepth:{value:0},shadowOpacity:{value:.5},shadowMapSize:{value:1024},pcfSpread:{value:1},sunDir:{value:new We(0,1,0)},normalBias:{value:.05},shadowEnabled:{value:!1},depthRangeMax:{value:1},shadowMap:{value:null},lightMatrix:{value:new Ir},cameraNear:{value:.1},cameraFar:{value:1e3},shadowBias:{value:1e-5},baseColor:{value:new We(0,0,0)}});k(this,"colorSpace",Gh);k(this,"showTextures",i=>{this.texturesVisible=!0;let r=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(r||n)&&(this.propertiesTexture.setTexture(i,r,n),this.needsUpdate=!0)});this.alphaTest=.01,this.propertiesTexture=new hh(r),this.uniforms.uRepeatYFactor.value=n,this.onBeforeCompile=a=>{let o=this.uniforms.uGradientIntensity,s=this.uniforms.uGradientEnd,l=this.uniforms.uGradientStart,u=this.uniforms.uTopTexture,h=this.uniforms.uTexture,c=this.uniforms.uRepeatYFactor,p=this.uniforms.uBlendTexture,d=this.uniforms.effectStart,f=this.uniforms.effectDistance,y=this.uniforms.darkenAmount,g=this.uniforms.darkenUseDepth,_=this.uniforms.desaturateAmount,b=this.uniforms.desaturateUseDepth,v=this.uniforms.washOutAmount,w=this.uniforms.washOutUseDepth,P=this.uniforms.shadowOpacity,S=this.uniforms.shadowMapSize,C=this.uniforms.pcfSpread,E=this.uniforms.sunDir,F=this.uniforms.normalBias,B=this.uniforms.shadowEnabled,R=this.uniforms.depthRangeMax,D=this.uniforms.shadowMap,z=this.uniforms.lightMatrix,x=this.uniforms.cameraNear,T=this.uniforms.cameraFar,I=this.uniforms.shadowBias,U=this.uniforms.baseColor;this.uniforms=a.uniforms,a.vertexShader=Nw,a.fragmentShader="#define PCF_SAMPLES ".concat(this.pcfSampleCount,"\n")+Vw,D!=null&&D.value&&(B!=null&&B.value)&&(z!=null&&z.value)&&(a.uniforms.shadowMap={value:D.value},a.uniforms.lightMatrix={value:z.value},a.uniforms.cameraNear={value:x.value},a.uniforms.cameraFar={value:T.value},a.uniforms.shadowBias={value:I.value},a.uniforms.baseColor={value:U.value},a.uniforms.shadowMapSize={value:S.value},a.uniforms.pcfSpread={value:C.value},a.uniforms.sunDir={value:E.value},a.uniforms.normalBias={value:F.value},a.uniforms.shadowEnabled={value:!0},a.uniforms.depthRangeMax={value:R.value}),Object.assign(this.uniforms,{uGradientIntensity:o,uGradientEnd:s,uGradientStart:l,effectStart:d,effectDistance:f,darkenAmount:y,darkenUseDepth:g,desaturateAmount:_,desaturateUseDepth:b,washOutAmount:v,washOutUseDepth:w,shadowOpacity:P,shadowMapSize:S,pcfSpread:C,sunDir:E,normalBias:F,shadowEnabled:B,depthRangeMax:R,shadowMap:D,lightMatrix:z,cameraNear:x,cameraFar:T,shadowBias:I,baseColor:U,uMinSideAlpha:{value:w6},uMaxSideAlpha:{value:P6},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:u,uTexture:h,uRepeatYFactor:c,uBlendTexture:p}),this.userData||(this.userData={}),this.userData.shadowUniforms=a.uniforms}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(i){i!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=i,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(i){if(i==null){this.uniforms.uTexture.value=null;return}i.wrapS=no,i.wrapT=no,i.colorSpace=this.colorSpace,this.uniforms.uTexture.value=i}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(i){if(i==null){this.uniforms.uTopTexture.value=null;return}i.wrapS=no,i.wrapT=no,i.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=i}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(i){i!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=i,this.colorSpace=i?ny:Gh,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(i,r,n){this.uniforms.uGradientStart.value=i,this.uniforms.uGradientEnd.value=r,this.uniforms.uGradientIntensity.value=n}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setEffectRange(i,r){this.uniforms.effectStart.value=i,this.uniforms.effectDistance.value=r}getEffectRange(){return{start:this.uniforms.effectStart.value,distance:this.uniforms.effectDistance.value}}setVisualEffect(i,r,n,a,o,s){this.uniforms.darkenAmount.value=i,this.uniforms.darkenUseDepth.value=r?1:0,this.uniforms.desaturateAmount.value=n,this.uniforms.desaturateUseDepth.value=a?1:0,this.uniforms.washOutAmount.value=o,this.uniforms.washOutUseDepth.value=s?1:0}getVisualEffect(){return{darkenAmount:this.uniforms.darkenAmount.value,darkenUseDepth:this.uniforms.darkenUseDepth.value,desaturateAmount:this.uniforms.desaturateAmount.value,desaturateUseDepth:this.uniforms.desaturateUseDepth.value,washOutAmount:this.uniforms.washOutAmount.value,washOutUseDepth:this.uniforms.washOutUseDepth.value}}setColor(i,r,n){this.propertiesTexture.setColor(i,r,n)}getColor(i){return this.propertiesTexture.getColor(i)}hideTextures(i){this.texturesVisible=!1;let r=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(r||n)&&(this.propertiesTexture.setTexture(i,!1,!1),this.needsUpdate=!0)}removeSideTexture(i){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let r=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(i,!1,r),this.needsUpdate=!0}}removeTopTexture(i){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let r=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(i,r,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}setShadowUniforms(i,r,n,a,o,s,l,u,h,c,p,d,f,y){this.uniforms.lightMatrix.value.copy(r),this.uniforms.shadowMap.value=i,this.uniforms.sunDir.value.copy(p),this.uniforms.shadowOpacity.value=s,this.uniforms.baseColor.value=l,this.uniforms.shadowBias.value=o,this.uniforms.normalBias.value=d,this.uniforms.pcfSpread.value=h,this.uniforms.shadowMapSize.value=u,this.uniforms.shadowEnabled.value=y,this.uniforms.depthRangeMax.value=f,this.uniforms.cameraNear.value=n,this.uniforms.cameraFar.value=a,c!==this.pcfSampleCount&&(this.pcfSampleCount=c,this.needsUpdate=!0)}clone(i){let r=new e(i!=null?i:{},1,this.repeatYFactor);this.texture&&(r.texture=this.texture),this.topTexture&&(r.topTexture=this.topTexture),this.blendTexture&&(r.blendTexture=this.blendTexture);let n=this.getGradientShading();return n.intensity>0&&r.setGradientShading(n.start,n.end,n.intensity),r}};O();O();function ch(e){"@babel/helpers - typeof";return ch=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ch(e)}var S6=/^\s+/,T6=/\s+$/;function se(e,t){if(e=e||"",t=t||{},e instanceof se)return e;if(!(this instanceof se))return new se(e,t);var i=M6(e);this._originalInput=e,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||i.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}se.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),i,r,n,a,o,s;return i=t.r/255,r=t.g/255,n=t.b/255,i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),.2126*a+.7152*o+.0722*s},setAlpha:function(t){return this._a=Zw(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Uw(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Uw(this._r,this._g,this._b),i=Math.round(t.h*360),r=Math.round(t.s*100),n=Math.round(t.v*100);return this._a==1?"hsv("+i+", "+r+"%, "+n+"%)":"hsva("+i+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=jw(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=jw(this._r,this._g,this._b),i=Math.round(t.h*360),r=Math.round(t.s*100),n=Math.round(t.l*100);return this._a==1?"hsl("+i+", "+r+"%, "+n+"%)":"hsla("+i+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return Gw(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return E6(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(ct(this._r,255)*100)+"%",g:Math.round(ct(this._g,255)*100)+"%",b:Math.round(ct(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(ct(this._r,255)*100)+"%, "+Math.round(ct(this._g,255)*100)+"%, "+Math.round(ct(this._b,255)*100)+"%)":"rgba("+Math.round(ct(this._r,255)*100)+"%, "+Math.round(ct(this._g,255)*100)+"%, "+Math.round(ct(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U6[Gw(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var i="#"+Xw(this._r,this._g,this._b,this._a),r=i,n=this._gradientType?"GradientType = 1, ":"";if(t){var a=se(t);r="#"+Xw(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+i+",endColorstr="+r+")"},toString:function(t){var i=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0,a=!i&&n&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return a?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return se(this.toString())},_applyModification:function(t,i){var r=t.apply(null,[this].concat([].slice.call(i)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(z6,arguments)},brighten:function(){return this._applyModification(R6,arguments)},darken:function(){return this._applyModification(F6,arguments)},desaturate:function(){return this._applyModification(k6,arguments)},saturate:function(){return this._applyModification(D6,arguments)},greyscale:function(){return this._applyModification(L6,arguments)},spin:function(){return this._applyModification(B6,arguments)},_applyCombination:function(t,i){return t.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(V6,arguments)},complement:function(){return this._applyCombination(O6,arguments)},monochromatic:function(){return this._applyCombination(j6,arguments)},splitcomplement:function(){return this._applyCombination(N6,arguments)},triad:function(){return this._applyCombination(qw,[3])},tetrad:function(){return this._applyCombination(qw,[4])}};se.fromRatio=function(e,t){if(ch(e)=="object"){var i={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?i[r]=e[r]:i[r]=Ss(e[r]));e=i}return se(e,t)};function M6(e){var t={r:0,g:0,b:0},i=1,r=null,n=null,a=null,o=!1,s=!1;return typeof e=="string"&&(e=$6(e)),ch(e)=="object"&&(Xr(e.r)&&Xr(e.g)&&Xr(e.b)?(t=C6(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Xr(e.h)&&Xr(e.s)&&Xr(e.v)?(r=Ss(e.s),n=Ss(e.v),t=A6(e.h,r,n),o=!0,s="hsv"):Xr(e.h)&&Xr(e.s)&&Xr(e.l)&&(r=Ss(e.s),a=Ss(e.l),t=I6(e.h,r,a),o=!0,s="hsl"),e.hasOwnProperty("a")&&(i=e.a)),i=Zw(i),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:i}}function C6(e,t,i){return{r:ct(e,255)*255,g:ct(t,255)*255,b:ct(i,255)*255}}function jw(e,t,i){e=ct(e,255),t=ct(t,255),i=ct(i,255);var r=Math.max(e,t,i),n=Math.min(e,t,i),a,o,s=(r+n)/2;if(r==n)a=o=0;else{var l=r-n;switch(o=s>.5?l/(2-r-n):l/(r+n),r){case e:a=(t-i)/l+(t<i?6:0);break;case t:a=(i-e)/l+2;break;case i:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,l:s}}function I6(e,t,i){var r,n,a;e=ct(e,360),t=ct(t,100),i=ct(i,100);function o(u,h,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?u+(h-u)*6*c:c<1/2?h:c<2/3?u+(h-u)*(2/3-c)*6:u}if(t===0)r=n=a=i;else{var s=i<.5?i*(1+t):i+t-i*t,l=2*i-s;r=o(l,s,e+1/3),n=o(l,s,e),a=o(l,s,e-1/3)}return{r:r*255,g:n*255,b:a*255}}function Uw(e,t,i){e=ct(e,255),t=ct(t,255),i=ct(i,255);var r=Math.max(e,t,i),n=Math.min(e,t,i),a,o,s=r,l=r-n;if(o=r===0?0:l/r,r==n)a=0;else{switch(r){case e:a=(t-i)/l+(t<i?6:0);break;case t:a=(i-e)/l+2;break;case i:a=(e-t)/l+4;break}a/=6}return{h:a,s:o,v:s}}function A6(e,t,i){e=ct(e,360)*6,t=ct(t,100),i=ct(i,100);var r=Math.floor(e),n=e-r,a=i*(1-t),o=i*(1-n*t),s=i*(1-(1-n)*t),l=r%6,u=[i,o,a,a,s,i][l],h=[s,i,i,o,a,a][l],c=[a,a,s,i,i,o][l];return{r:u*255,g:h*255,b:c*255}}function Gw(e,t,i,r){var n=[Wi(Math.round(e).toString(16)),Wi(Math.round(t).toString(16)),Wi(Math.round(i).toString(16))];return r&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function E6(e,t,i,r,n){var a=[Wi(Math.round(e).toString(16)),Wi(Math.round(t).toString(16)),Wi(Math.round(i).toString(16)),Wi(Yw(r))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function Xw(e,t,i,r){var n=[Wi(Yw(r)),Wi(Math.round(e).toString(16)),Wi(Math.round(t).toString(16)),Wi(Math.round(i).toString(16))];return n.join("")}se.equals=function(e,t){return!e||!t?!1:se(e).toRgbString()==se(t).toRgbString()};se.random=function(){return se.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function k6(e,t){t=t===0?0:t||10;var i=se(e).toHsl();return i.s-=t/100,i.s=ph(i.s),se(i)}function D6(e,t){t=t===0?0:t||10;var i=se(e).toHsl();return i.s+=t/100,i.s=ph(i.s),se(i)}function L6(e){return se(e).desaturate(100)}function z6(e,t){t=t===0?0:t||10;var i=se(e).toHsl();return i.l+=t/100,i.l=ph(i.l),se(i)}function R6(e,t){t=t===0?0:t||10;var i=se(e).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(t/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(t/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(t/100)))),se(i)}function F6(e,t){t=t===0?0:t||10;var i=se(e).toHsl();return i.l-=t/100,i.l=ph(i.l),se(i)}function B6(e,t){var i=se(e).toHsl(),r=(i.h+t)%360;return i.h=r<0?360+r:r,se(i)}function O6(e){var t=se(e).toHsl();return t.h=(t.h+180)%360,se(t)}function qw(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var i=se(e).toHsl(),r=[se(e)],n=360/t,a=1;a<t;a++)r.push(se({h:(i.h+a*n)%360,s:i.s,l:i.l}));return r}function N6(e){var t=se(e).toHsl(),i=t.h;return[se(e),se({h:(i+72)%360,s:t.s,l:t.l}),se({h:(i+216)%360,s:t.s,l:t.l})]}function V6(e,t,i){t=t||6,i=i||30;var r=se(e).toHsl(),n=360/i,a=[se(e)];for(r.h=(r.h-(n*t>>1)+720)%360;--t;)r.h=(r.h+n)%360,a.push(se(r));return a}function j6(e,t){t=t||6;for(var i=se(e).toHsv(),r=i.h,n=i.s,a=i.v,o=[],s=1/t;t--;)o.push(se({h:r,s:n,v:a})),a=(a+s)%1;return o}se.mix=function(e,t,i){i=i===0?0:i||50;var r=se(e).toRgb(),n=se(t).toRgb(),a=i/100,o={r:(n.r-r.r)*a+r.r,g:(n.g-r.g)*a+r.g,b:(n.b-r.b)*a+r.b,a:(n.a-r.a)*a+r.a};return se(o)};se.readability=function(e,t){var i=se(e),r=se(t);return(Math.max(i.getLuminance(),r.getLuminance())+.05)/(Math.min(i.getLuminance(),r.getLuminance())+.05)};se.isReadable=function(e,t,i){var r=se.readability(e,t),n,a;switch(a=!1,n=Z6(i),n.level+n.size){case"AAsmall":case"AAAlarge":a=r>=4.5;break;case"AAlarge":a=r>=3;break;case"AAAsmall":a=r>=7;break}return a};se.mostReadable=function(e,t,i){var r=null,n=0,a,o,s,l;i=i||{},o=i.includeFallbackColors,s=i.level,l=i.size;for(var u=0;u<t.length;u++)a=se.readability(e,t[u]),a>n&&(n=a,r=se(t[u]));return se.isReadable(e,r,{level:s,size:l})||!o?r:(i.includeFallbackColors=!1,se.mostReadable(e,["#fff","#000"],i))};var Bf=se.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U6=se.hexNames=G6(Bf);function G6(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}function Zw(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function ct(e,t){X6(e)&&(e="100%");var i=q6(e);return e=Math.min(t,Math.max(0,parseFloat(e))),i&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function ph(e){return Math.min(1,Math.max(0,e))}function fi(e){return parseInt(e,16)}function X6(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function q6(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Wi(e){return e.length==1?"0"+e:""+e}function Ss(e){return e<=1&&(e=e*100+"%"),e}function Yw(e){return Math.round(parseFloat(e)*255).toString(16)}function $w(e){return fi(e)/255}var Yi=(function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",i="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",n="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Xr(e){return!!Yi.CSS_UNIT.exec(e)}function $6(e){e=e.replace(S6,"").replace(T6,"").toLowerCase();var t=!1;if(Bf[e])e=Bf[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=Yi.rgb.exec(e))?{r:i[1],g:i[2],b:i[3]}:(i=Yi.rgba.exec(e))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=Yi.hsl.exec(e))?{h:i[1],s:i[2],l:i[3]}:(i=Yi.hsla.exec(e))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=Yi.hsv.exec(e))?{h:i[1],s:i[2],v:i[3]}:(i=Yi.hsva.exec(e))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=Yi.hex8.exec(e))?{r:fi(i[1]),g:fi(i[2]),b:fi(i[3]),a:$w(i[4]),format:t?"name":"hex8"}:(i=Yi.hex6.exec(e))?{r:fi(i[1]),g:fi(i[2]),b:fi(i[3]),format:t?"name":"hex"}:(i=Yi.hex4.exec(e))?{r:fi(i[1]+""+i[1]),g:fi(i[2]+""+i[2]),b:fi(i[3]+""+i[3]),a:$w(i[4]+""+i[4]),format:t?"name":"hex8"}:(i=Yi.hex3.exec(e))?{r:fi(i[1]+""+i[1]),g:fi(i[2]+""+i[2]),b:fi(i[3]+""+i[3]),format:t?"name":"hex"}:!1}function Z6(e){var t,i;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),i=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:t,size:i}}function fY(e,t){var h,c,p,d;let i=0;for(let f of e)i+=((c=(h=f.components[0])==null?void 0:h.geometry)==null?void 0:c.attributes.position.count)||0;let r=new Ri(t.color),n=(p=t.opacity)!=null?p:1,a=new Ps({color:r,side:Ff((d=t.side)!=null?d:"auto",n),opacity:n,transparent:n<1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},e.length),o=new $a(e.length,i,0,a);o.renderOrder=o1.GEOMETRY;let s,l,u;for(let f of e)s=f.components[0],!(!(s instanceof Mr)||!s.geometry)&&(s.mesh=o,s.material=a,s.instanceIndex=o.addGeometry(s.geometry),o.addInstance(s.instanceIndex),o.userData.entities[s.instanceIndex]=f.id,a instanceof Ps&&a.setColor(s.instanceIndex,r,t.topColor?new Ri(t.topColor):r),l=o.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(u=o.getGeometryRangeAt(l),u&&(s.batchedProps.range=u),s.batchedProps.geometryId=l));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}function Of(e,t=30){return se(e).darken(t).toRgbString()}function mY(e,t,i,r){if(t.length<1)return;e.boundingBox||e.computeBoundingBox();let n=e.boundingBox,a=e.getAttribute("position"),o=e.getAttribute("normal"),s=e.getAttribute("uv"),l,u;e.index?(l=e.index.count/3,u=function(v,w){return e.index.getX(v*3+w)}):(l=a.count/3,u=function(v,w){return v*3+w});let h=new Ir;h.makeRotationFromQuaternion(new Xh().setFromEuler(new qh(0,0,i/180*Math.PI)));let c=t.find(v=>v.face==="top"),p;c&&(p={min:r(c.bounds[1],c.bounds[0],0),max:r(c.bounds[3],c.bounds[2],n.max.z)});let d=t.find(v=>v.face==="side"),f;if(d&&(f={min:r(d.bounds[1],d.bounds[0],0),max:r(d.bounds[3],d.bounds[2],n.max.z)}),!(!f&&!p))for(let v=0;v<l;++v){let w=o.getX(u(v,0))+o.getX(u(v,1))+o.getX(u(v,2)),P=o.getY(u(v,0))+o.getY(u(v,1))+o.getY(u(v,2)),S=o.getZ(u(v,0))+o.getZ(u(v,1))+o.getZ(u(v,2)),C=Math.abs(w),E=Math.abs(P),F=Math.abs(S);var y,g;C<=E&&C<=F?(y="x",E<=F?g="y":g="z"):E<=C&&E<=F?(y="y",C<=F?g="x":g="z"):(y="z",C<=E?g="x":g="y"),y==="z"&&(y=g,g="z");let B,R,D,z,x,T;if(g==="z"||y==="z"){if(!d||!f)continue;B=d.repeat.u,R=d.repeat.v,D=d.offset.u,z=d.offset.v,x=d.rotation,T=f}else{if(!c||!p)continue;B=c.repeat.u,R=c.repeat.v,D=c.offset.u,z=c.offset.v,x=(360-i+c.rotation)%360,T=p}let{min:I,max:U}=T,X=new Kt;X.position.set(I.x,I.y,0),X.updateMatrix(),X.updateMatrixWorld();let Z=I.clone().applyMatrix4(h),ie=U.clone().applyMatrix4(h),pe=Math.abs(ie.x-Z.x),je=Math.abs(ie.y-Z.y),le=new We(pe,je,U.z).applyMatrix4(X.matrixWorld),Oe=Math.abs(le[y]-I[y]),qe=Math.abs(le[g]-I[g]),gt=x*Math.PI/180||0,kt=Math.cos(gt),Dt=Math.sin(gt),jt=X.matrixWorld.clone().invert(),yi=new Xh().setFromEuler(new qh(0,0,i/180*Math.PI));for(let Lt=0;Lt<3;Lt++){let Cr=new We(a.getX(u(v,Lt)),a.getY(u(v,Lt)),a.getZ(u(v,Lt))).applyMatrix4(jt);Cr.applyQuaternion(yi);let Hi=Cr.applyMatrix4(X.matrixWorld),gi=Hi.x,Ki=Hi.y,_i=Hi.z;var _,b;y==="x"?_=B*(gi-I[y])/Oe+D:y==="y"?_=B*(Ki-I[y])/Oe+D:_=B*(_i-I[y])/Oe+D,g==="x"?b=R*(gi-I[g])/qe+z:g==="y"?b=R*(Ki-I[g])/qe+z:b=R*(_i-I[g])/qe+z,_-=.5,b-=.5;let Ht=_*kt-b*Dt+.5,Ut=_*Dt+b*kt+.5;s.setX(u(v,Lt),Ht),s.setY(u(v,Lt),Ut)}}}function dh(e){if(!e.startsWith("data:"))return;let t=e.indexOf(",");if(t===-1)return;let i=e.slice(5,t),r=e.slice(t+1),n=i.split(";"),a=n[0]||"",o=n.includes("base64");return{mimeType:a,isBase64:o,data:r}}function yY(e){if(e.trimStart().startsWith("{"))return!0;let t=dh(e);return t!=null&&t.mimeType==="application/json"}function gY(e){let t=dh(e);return t?atob(t.data):e}function _Y(e){let t=dh(e);return!t||!t.isBase64?!1:t.mimeType==="application/gltf-binary"||t.mimeType==="application/octet-stream"}function xY(e){let t=dh(e);if(!t)return Ft.error("Invalid binary data URI",e),new ArrayBuffer(0);let i=atob(t.data),r=new Uint8Array(i.length);for(let n=0;n<i.length;n++)r[n]=i.charCodeAt(n);return r.buffer}O();var fh=class{constructor(){k(this,"type","focusable");k(this,"dirty",!0);k(this,"vertices");k(this,"boundingBox",new Pn)}};O();var mh=class{constructor(t,i){k(this,"type","texture");k(this,"texture");k(this,"topTexture");k(this,"showTexture",!0);k(this,"showTopTexture",!0);k(this,"textureInstance");k(this,"topTextureInstance");k(this,"dirty",!0);this.texture=typeof t=="string"?{path:t}:t,this.topTexture=typeof i=="string"?{path:i}:i}};O();var yh=class{constructor(){k(this,"type","border");k(this,"dirty",!0);k(this,"needsRebuild",!1);k(this,"mesh")}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}};O();var gh=class{constructor(){k(this,"type","mask");k(this,"maskId",0);k(this,"enabled",!0);k(this,"mode","mask");k(this,"effect","hide");k(this,"dirty",!0)}};O();var _h=class{constructor(){k(this,"type","clippingPlane");k(this,"dirty",!0);k(this,"needsRebuild",!1);k(this,"verticalOffset",1/0);k(this,"plane");k(this,"holeFillMesh");k(this,"topColor");k(this,"topVisible",!0)}};function Ts(e,t,i){if(t!==void 0){if(e.type==="model"||e.type==="path"||e.type==="marker"||e.type==="label"||e.type==="geometry"||e.type==="group-container"||e.type==="custom-geometry")return t===!0?(e instanceof Gr&&e.components[1]===void 0?(e.components[1]=new Ra,e.components[1].dirty=!0,e.components[0].interactive=!0):e instanceof di&&e.components[2]===void 0?(e.components[2]=new Ra,e.components[2].dirty=!0):e instanceof ni&&e.components[0]===void 0&&(e.components[0]=new Ra,e.components[0].dirty=!0),!0):(e instanceof Gr?(e.components[1]=void 0,e.components[0].interactive=!1):e instanceof di?e.components[2]=void 0:e instanceof ni&&(e.components[0]=void 0),!0);if(e.type==="geometry-group"){let r;for(let n of e.userData.entities3D.values())r=i.geometry3DMap.get(n),Ts(r,t,i);return!0}}return!1}function aW(e,t,i){var r;if(!(!(i!=null&&i.color)&&!("topColor"in i))){if(i!==void 0&&e.type==="geometry-group"){let n,a=(r=t.outlinesOptions)==null?void 0:r.darkenFactor;for(let o of e.userData.entities3D.values())n=t.geometry3DMap.get(o),n&&Hw(n,i,a);return!0}return!1}}function H6(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].shading=t,e.components[1].dirty=!0)}function oW(e,t,i){if(i!==void 0&&e.type==="geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);n&&H6(n,i)}return!0}return!1}function sW(e,t){t!==void 0&&e.type==="geometry"&&(t.showImage!==void 0&&(e.components[1].showImage=t.showImage),t.flipImageToFaceCamera!==void 0&&(e.components[1].flipImageToFaceCamera=t.flipImageToFaceCamera))}function K6(e,t,i){if(i!==void 0){if(e.type==="geometry"){let r=e.components[1];if(r.height!==i)return r.height=i,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),e.components[5]&&(e.components[5].needsRebuild=!0,e.components[5].dirty=!0),!0}else if(e.type==="geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&K6(n,t,i)}return!0}}return!1}function Hw(e,t,i){if(t!==void 0){let r=!1;(e.type==="path"||e.type==="geometry")&&(t.initialColor!==void 0&&t.initialColor!==e.components[1].initialColor&&(e.components[1].initialColor=t.initialColor,r=!0),t.color!==void 0&&t.color!==e.components[1].color&&(e.components[1].color=t.color,r=!0,e.components[3]&&(e.components[3].color=Of(t.color,i),e.components[3].dirty=!0)),"topColor"in t&&(e.components[1].topColor=t.topColor,r=!0),r&&(e.components[1].dirty=!0))}}function lW(e,t,i,r){if(t!==void 0){if(e.type==="label"||e.type==="marker"){let n=i(t[1],t[0],t[2]||0);e.updatePosition(n),r==null||r.expandBoundsIfOutside(n)}else if(e.type==="custom-geometry"){let n=e.components[0],a=i(t[1],t[0],t[2]||0);n.position.copy(a),r==null||r.expandBoundsIfOutside(a)}}}function uW(e,t){var i;return t!==void 0&&(e.type==="marker"||e.type==="label"||e.type==="custom-geometry")&&e.parentObject3D!==t&&e.parentObject3D instanceof ni?((i=e.parentObject3D)==null||i.removeEntity(e),t.addEntity(e),!0):!1}function hW(e,t){t!==void 0&&(e.type==="marker"||e.type==="label")&&e.components[0].enabled!==t&&(e.components[0].enabled=t)}function cW(e,t,i){var r;if(t!==void 0&&e.type==="marker"){let n=e.components[0],a=!1;if(t.contentHTML!==void 0&&(n.containerEl.innerHTML=t.contentHTML,n.contentHtml=t.contentHTML,a=!0),Qw(e,t.placement)&&(n.collisionDirty=!0,a=!0),t.dynamicResize!==void 0&&(n.options.dynamicResize=t.dynamicResize,a=!0),Jw(e,(r=t.options)==null?void 0:r.occlude)&&(a=!0),t.options!=null){try{Ef.parse(t.options||{})}catch(o){return Ft.error(o),!1}t.options.interactive!=null&&(t.options.interactive==="pointer-events-auto"?(n.pointerEvents="auto",Ts(e,!1,i)):(n.pointerEvents="none",Ts(e,t.options.interactive,i))),t.options.zIndex!=null&&(n.options.zIndex=t.options.zIndex),Kw(e,t.options.rank),a=!0}return a}return!1}function Kw(e,t){return t!==void 0&&(e.type==="marker"||e.type==="label")?(e.components[0].rank=vs(t),!0):!1}function J6(e,t){var o;if(((o=t==null?void 0:t.options)==null?void 0:o.appearance)==null)return;let i=Mf(t.options.appearance||{}),r=i.opacity!=null&&i.opacity!==e.appearance.opacity,a=i.iconScale!=null&&i.iconScale!==e.appearance.iconScale&&typeof i.iconScale=="number"&&Number.isFinite(i.iconScale);r&&(i.opacity=Nf(i.opacity)),a&&(i.iconScale=Nf(i.iconScale)),jf(e.appearance,i),r&&e.canShow&&e.visibilityNeedsUpdate!=="hide"&&(e.visibilityNeedsUpdate="show")}function pW(e,t,i){var r,n,a,o,s,l;if(t!==void 0&&e.type==="label"){let u=e.components[0];t.text!==void 0&&t.text!==u.text&&(u.text=t.text,u.textDirty=!0),Y1(u.appearance,((r=t.options)==null?void 0:r.appearance)||{})&&(u.textDirty=!0),W1(u.appearance,((n=t.options)==null?void 0:n.appearance)||{})&&(u.pinDirty=!0),J6(u,t),H1(u.options,t.options||{})&&(Qw(e,(a=t.options)==null?void 0:a.textPlacement),u.currentStrategyIndex=-1,u.collisionDirty=!0),Ts(e,(o=t.options)==null?void 0:o.interactive,i),Kw(e,(s=t.options)==null?void 0:s.rank),Jw(e,(l=t.options)==null?void 0:l.occlude)}}function Jw(e,t){if(t!==void 0&&(e.type==="label"||e.type==="marker")){let i=e.components[2];if(i)return i.enabled=t,!0}return!1}function Qw(e,t){if(t!==void 0){if(e.type==="label"){let i=e.components[0];return i.options.textPlacement=t,i.invalidateStrategies(),!0}else if(e.type==="marker"){let i=e.components[0];return i.options.placement=t,i.invalidateStrategies(),!0}}return!1}function dW(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].hoverColor=t,e.components[1].dirty=!0)}function fW(e,t){if(t!==void 0){let i=e.components[2];if(e.type==="geometry"&&i!=null)return i.hover=t,i.dirty=!0,!0}return!1}function mW(e,t){t!==void 0&&e.type==="image"&&(e.components[1].flipImageToFaceCamera=t)}function yW(e,t){t!==void 0&&e.type==="geometry"&&(e.components[1].enableImageCollisions=t)}function e2(e,t,i){if(i!==void 0){if(e.type==="model"||e.type==="path"||e.type==="geometry"||e.type==="custom-geometry"||e.type==="image"||e.type==="text3d"){let r=!1;i!==e.components[1].visible&&(e.components[1].visible=i,e.components[1].dirty=!0,r=!0);let n=e.components[3];return n&&r&&(n.dirty=!0),r}else if(e.type==="geometry-group"){if(e.visible!==i)return e.setVisible(i),!0}else if(e.type==="group-container"){if(e.visible!==i)return e.setVisible(i),i===!1&&e.traverse(r=>{if(r instanceof Tr){let n=t.geometry2DMap.get(r.userData.entityId);if(n){let a=n.components[0];a instanceof rh&&(a.canShow=i)}}}),!0}else if(e.type==="label"&&e.components[0].visible!==i)return e.components[0].visible=i,!0}return!1}function Q6(e,t,i){if(i!==void 0)if(e.type==="geometry-group"){for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&Q6(n,t,i)}return!0}else if(e.type==="group-container"){if(e.opacity!==i){e.setOpacity(i);let r=1;return e.parent instanceof ni&&(r=e.parent.opacity),t2(e,t,r),!0}}else e instanceof di&&e.components[1].opacity!==i&&(e.components[1].opacity=i,e.components[1].dirty=!0);return!1}function t2(e,t,i=1){if(e.type==="group-container"&&"children"in e&&e.children.length>0){let r=i*e.opacity;e.userData.computedOpacity=r;for(let n of e.children)(n instanceof ri&&n.type==="geometry-group"||n instanceof ni&&n.type==="group-container")&&t2(n,t,r)}else if(e.type==="geometry-group")for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r),a;((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&(a=n.components[1],a.dirty=!0)}}function gW(e,t,i){let r=!1;if((i==null?void 0:i.texture)!=null||(i==null?void 0:i.topTexture)!=null){if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let a=t.geometry3DMap.get(n);a&&eN(a,i)}return!0}return r}function eN(e,t){if(e.type==="geometry"&&((t==null?void 0:t.texture)!=null||(t==null?void 0:t.topTexture)!=null)){let i=!1,r=e.components[6];if(r==null?(e.components[6]=new mh(t==null?void 0:t.texture,t==null?void 0:t.topTexture),i=!0):((t==null?void 0:t.texture)!=null&&(r==null?void 0:r.texture)!==(t==null?void 0:t.texture)&&(r.texture=typeof t.texture=="string"?{path:t.texture}:t.texture,i=!0,r.dirty=!0),(t==null?void 0:t.topTexture)!=null&&(r==null?void 0:r.topTexture)!==(t==null?void 0:t.topTexture)&&(r.topTexture=typeof t.topTexture=="string"?{path:t.topTexture}:t.topTexture,i=!0,r.dirty=!0)),i&&e.components[0]instanceof Mr){let n=e.components[0];return n.detached===!1&&(n.shouldDetach=!0,n.dirty=!0),!0}}return!1}function tN(e,t){let i=!1,r;for(r in t)t[r]!=null&&e[r]!==t[r]&&(e[r]=t[r],i=!0);return i&&(e.dirty=!0),i}function iN(e,t,i){if(e.type==="geometry")tN(e.components[1],i);else if(e.type==="geometry-group"){let r;for(let n of e.userData.entities3D.values())r=t.geometry3DMap.get(n),(r==null?void 0:r.type)==="geometry"&&iN(r,t,i)}}function _W(e,t){if(Object.keys(t!=null?t:{}).length===0||t==null)return!1;if(e.type==="geometry-group"){e.components[0]==null&&t.enabled===!0&&(e.components[0]=new gh);let i=e.components[0];if(i==null)return!1;t.enabled!=null&&i.enabled!==t.enabled&&(i.enabled=t.enabled,i.dirty=!0),t.maskId!=null&&Number.isInteger(t.maskId)&&i.maskId!==t.maskId&&(i.maskId=t.maskId,i.dirty=!0),t.effect!=null&&i&&i.effect!==t.effect&&(i.effect=t.effect,i.dirty=!0),t.mode!=null&&i&&i.mode!==t.mode&&(i.mode=t.mode,i.dirty=!0)}return!1}function xW(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1];if(i.opacity!==t){i.opacity=t;let r=e.components[0],n=e.components[3];n&&(n.dirty=!0),r.detached===!1&&(r.shouldDetach=!0,r.dirty=!0),i.dirty=!0;let a=e.parentObject3D;return(a==null?void 0:a.type)==="geometry-group"&&(a.userData.shadingDirty=!0),!0}}return!1}function rN(e,t,i){if(i!==void 0)if(e.type==="geometry"||e.type==="path"||e.type==="custom-geometry"){let r=e.components[1];if(r.altitude!==i)return r.altitude=i,r.dirty=!0,e.components[3]&&(e.components[3].dirty=!0),e.components[5]&&(e.components[5].needsRebuild=!0,e.components[5].dirty=!0),!0}else{if(e.type==="group-container"&&e.altitude!==i)return e.setAltitude(i),!0;if(e.type==="geometry-group"){let r;for(let n of e.userData.entities3D.values())r=t.geometry3DMap.get(n),r&&rN(r,t,i)}}return!1}function nN(e,t,i){var r;if(i!==void 0){if(e.type==="geometry-group")for(let n of e.userData.entities3D.values()){let a=t.geometry3DMap.get(n);a instanceof di&&nN(a,t,i)}else if(e.type==="geometry"){let n=e.components[3],a=e.components[1];if(!n&&i===!0){let o=(r=t.outlinesOptions)==null?void 0:r.darkenFactor;e.components[3]=new uh(Of(a.color,o))}else n&&(n.enabled=i,n.dirty=!0)}return!0}return!1}function vW(e,t){if(t!==void 0){let i,r=4;if(e.type==="geometry"?(i=e.components[4],r=4):e.type==="group-container"&&(i=e.components[1],r=1),t===!0&&i==null)return e.components[r]=new fh,!0;if(t===!1&&i!=null)return e.components[r]=void 0,!0}return!1}function bW(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1];if(i.renderOrder!==t){i.renderOrder=t;let r=e.components[0];return r.detached===!1&&(r.shouldDetach=!0,r.dirty=!0),r.imageMesh&&(r.imageMesh.renderOrder=t+1),i.dirty=!0,!0}}return!1}function aN(e,t,i){if(i!=null){if(e.type==="geometry"){let r=e.components[1];r.side!==i&&(r.side=i,r.dirty=!0)}else if(e.type==="geometry-group")for(let r of e.userData.entities3D.values()){let n=t.geometry3DMap.get(r);n instanceof di&&aN(n,t,i)}}}function wW(e,t){if(t!==void 0&&e.type==="geometry"){let i=e.components[1],r;if(r=e.components[5],t.borderVisible!==i.borderVisible&&t.borderVisible!=null){if(t.borderVisible===!0){if(r==null){let n=new yh;e.components[5]=n,r=e.components[5]}r.visible=!0,r.dirty=!0}else t.borderVisible===!1&&r!=null&&(r.visible=!1,r.dirty=!0);i.borderVisible=t.borderVisible}i.borderColor!==t.borderColor&&t.borderColor!=null&&(i.borderColor=t.borderColor,r&&(r.dirty=!0)),i.borderWidth!==t.borderWidth&&t.borderWidth!=null&&(i.borderWidth=t.borderWidth,r&&(r.needsRebuild=!0))}}function PW(e,t,i){var o;let{visible:r,color:n}=i;if(e.type!=="path")return;let a=e.components[0];r!=null&&e2(e,t,r),n!=null&&Hw(e,{color:n},(o=t.outlinesOptions)==null?void 0:o.darkenFactor),Object.assign(a,oN(i)),Vf(i)||(a.materialDirty=!0,i.width!=null&&(a.dirty=!0),(i.smoothingTension!=null||i.smoothingCornerRadius!=null)&&(a.dirty=!0),i.__EXPERIMENTAL_GEOMETRY!=null&&(a.dirty=!0),i.__EXPERIMENTAL_ENDCAP_EXTENSION!=null&&(a.dirty=!0))}function oN(e){return Ms(e,sN)}var sN=["smoothingTension","smoothingCornerRadius","animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","highlightCompleteFraction","highlightStartFraction","highlightEndFraction","highlightColor","highlightWidthMultiplier","dashed","visibleThroughGeometry","xrayOpacity","dashLength","dashGap","dashRelativeToWidth","dashSize","gapSize","dashAbsolute","dashMeters","gapMeters","__EXPERIMENTAL_GEOMETRY","__EXPERIMENTAL_ENDCAP_EXTENSION","__EXPERIMENTAL_BILLBOARDING","__EXPERIMENTAL_BORDER","__EXPERIMENTAL_PREVENT_SELF_OVERLAP"];function SW(e){if(!(e instanceof di&&e.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var lN=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function TW(e,t,i){e2(e,t,i.visible);let r=e.components[1],n=Ms(i,lN);"margin"in i&&Ft.warn("update to margin is not supported atm"),"content"in i&&Ft.warn("content update is not supported atm");try{Ow.parse(n)}catch(a){Ft.error(a);return}Object.keys(n).length>0&&(Object.assign(r,n),r.dirty=!0)}var uN=["color","material","opacity","verticalOffset","rotation","position","scale"];function MW(e,t,i,r){var s;let n=Ms(t,uN),a=e.components[1],o=e.components[0];if(Object.keys(n).length>0){if(n.material&&(a.material=n.material),n.opacity!=null&&(a.opacity=n.opacity),n.verticalOffset!=null&&(a.verticalOffset=n.verticalOffset),n.color!=null&&(a.color=n.color),n.position!=null&&(o.feature.geometry.coordinates=n.position,o.positionDirty=!0,i&&r)){let l=i(n.position[1],n.position[0],(s=n.position[2])!=null?s:0);r.expandBoundsIfOutside(l)}n.rotation!=null&&(a.rotation=n.rotation),n.scale!=null&&(a.scale=n.scale),n.visibleThroughGeometry!=null&&(o.visibleThroughGeometry=n.visibleThroughGeometry),a.dirty=!0}}function CW(e,t){if(t!==void 0&&e.type==="model"){if(!e.components[1].EXPERIMENTAL_clippingEnabled)return;let r=e.components[7];r==null&&(e.components[7]=new _h,r=e.components[7]),r=e.components[7],t.clippingPlaneZOffset!=null&&r.verticalOffset!==t.clippingPlaneZOffset&&(r.verticalOffset=t.clippingPlaneZOffset,r.dirty=!0),t.clippingPlaneTopColor!=null&&r.topColor!==t.clippingPlaneTopColor&&(r.topColor=t.clippingPlaneTopColor,r.dirty=!0),t.clippingPlaneTopVisible!=null&&r.topVisible!==t.clippingPlaneTopVisible&&(r.topVisible=t.clippingPlaneTopVisible,r.dirty=!0)}}var xh=new Pn,Ww=new We;function hN(e,t,i){if(xh.makeEmpty(),xh.setFromObject(e),Df(xh)){xh.getCenter(Ww);let c=i(Ww);return[c[0],c[1]]}let r=1/0,n=1/0,a=-1/0,o=-1/0,s,l,u;for(let c of e.userData.entities3D.values())s=t.geometry3DMap.get(c),(s==null?void 0:s.type)==="geometry"&&(l=s.components[0],l&&(u=l.featureBbox,u[0]<r&&(r=u[0]),u[1]<n&&(n=u[1]),u[2]>a&&(a=u[2]),u[3]>o&&(o=u[3])));if(r!==1/0)return[(r+a)/2,(n+o)/2];let h=i(e.position);return[h[0],h[1]]}function IW(e,t,i){if(e.userData.centroid)return e.userData.centroid;let r=hN(e,t,i);return e.userData.centroid=r,r}O();O();var Xf=B2(c2());function p2(e){this.name="JSClipperError",this.message=e,this.stack=new Error().stack}p2.prototype=Error.prototype;Xf.default.Error=function(e){throw new p2(e)};var qr=Xf.default;var nV="gray",qf=new qr.ClipperOffset,Wt=100;function $f(e,t,i){let{color:r=nV,opacity:n=1,width:a=1,join:o="round",cap:s="round",height:l=.01,altitude:u=0}=i||{};Array.isArray(n)&&(n=0);let h=[],c=e.geometry.coordinates.every(_=>_[2]!=null);for(let _=0;_<e.geometry.coordinates.length-1;_++){let b=t(e.geometry.coordinates[_][1],e.geometry.coordinates[_][0],e.geometry.coordinates[_][2]),v=t(e.geometry.coordinates[_+1][1],e.geometry.coordinates[_+1][0],e.geometry.coordinates[_+1][2]);h.push([b,v])}let p=h[0][0].y;qf.AddPaths(h.map(_=>_.map(b=>({X:b.x*Wt,Y:(c?b.z:b.y)*Wt}))),o==="round"?qr.JoinType.jsRound:o==="miter"?qr.JoinType.jsMiter:qr.JoinType.jsSquare,s==="round"?qr.EndType.etOpenRound:s==="butt"?qr.EndType.etOpenButt:qr.EndType.etOpenSquare);let d=new qr.PolyTree;qf.Execute(d,a/2*Wt);let f=[],y={bevelEnabled:!1,depth:l};for(let _ of d.m_AllPolys){let b=new uy;if(_.IsHole())continue;let v=_.m_polygon;b.moveTo(v[0].X/Wt,v[0].Y/Wt),v.slice(1).forEach(w=>b.lineTo(w.X/Wt,w.Y/Wt)),b.lineTo(v[0].X/Wt,v[0].Y/Wt),b.holes=_.m_Childs.map(w=>{let P=new ly,S=w.m_polygon;return P.moveTo(S[0].X/Wt,S[0].Y/Wt),S.slice(1).forEach(C=>P.lineTo(C.X/Wt,C.Y/Wt)),P.lineTo(S[0].X/Wt,S[0].Y/Wt),P}),f.push(new hy(b,y))}let g=qs(f);return c&&(g.rotateX(Math.PI/2),g.translate(0,p+l/2,u||0)),g.userData={style:{color:r,opacity:n}},qf.Clear(),g}O();O();var mi=63710088e-1,$W={centimeters:mi*100,centimetres:mi*100,degrees:360/(2*Math.PI),feet:mi*3.28084,inches:mi*39.37,kilometers:mi/1e3,kilometres:mi/1e3,meters:mi,metres:mi,miles:mi/1609.344,millimeters:mi*1e3,millimetres:mi*1e3,nauticalmiles:mi/1852,radians:1,yards:mi*1.0936};function d2(e,t,i={}){let r={type:"Feature"};return(i.id===0||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function f2(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return d2({type:"LineString",coordinates:e},t,i)}function m2(e,t={}){let i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function y2(e,t,i={}){return d2({type:"MultiLineString",coordinates:e},t,i)}O();function Sh(e){return e.type==="Feature"?e.geometry:e}function aV(e,t={}){let i=Sh(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),i.type){case"Polygon":return oV(i,t);case"MultiPolygon":return sV(i,t);default:throw new Error("invalid poly")}}function oV(e,t={}){let r=Sh(e).coordinates,n=t.properties?t.properties:e.type==="Feature"?e.properties:{};return g2(r,n)}function sV(e,t={}){let r=Sh(e).coordinates,n=t.properties?t.properties:e.type==="Feature"?e.properties:{},a=[];return r.forEach(o=>{a.push(g2(o,n))}),m2(a)}function g2(e,t){return e.length>1?y2(e,t):f2(e[0],t)}var Zf=aV;O();function _2(e){e&&(e.map&&(e.map.dispose(),e.map=void 0),e.dispose())}function Yf(e){for(;e.children.length>0;)Yf(e.children[0]);"geometry"in e&&e.geometry&&e.geometry.dispose(),"material"in e&&Array.isArray(e.material)?e.material.forEach(function(t){_2(t)}):"material"in e&&typeof e.material<"u"&&_2(e.material),e.parent&&e.parent.remove(e)}O();function x2(e){return e!=null&&e.geometry.type==="Polygon"&&e.geometry.coordinates[0].length>2}function lV(e,t){let i=e[0]*t[0]+e[1]*t[1],r=Math.sqrt(e[0]*e[0]+e[1]*e[1]),n=Math.sqrt(t[0]*t[0]+t[1]*t[1]);if(r===0||n===0)return 0;let a=i/(r*n),o=Math.max(-1,Math.min(1,a));return Math.acos(o)*(180/Math.PI)}function uV(e,t=5){if(e.length<3)return e;let i=e.length>3&&e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1],r=[],n=i?e.length-1:e.length;for(let a=0;a<n;a++){let o=i&&a===0?e[e.length-2]:e[a-1],s=e[a],l=i&&a===e.length-1?e[1]:e[a+1];if(o==null||l==null){r.push(s);continue}let u=[s[0]-o[0],s[1]-o[1]],h=[l[0]-s[0],l[1]-s[1]];lV(u,h)>t&&r.push(s)}if(i&&r.length>0){let a=r[0],o=r[r.length-1];(a[0]!==o[0]||a[1]!==o[1])&&r.push([a[0],a[1]])}return r}function v2(e,t=5){return bi(zt({},e),{geometry:bi(zt({},e.geometry),{coordinates:e.geometry.coordinates.map(i=>uV(i,t))})})}var w2=.1,hV=15,cV=.25,b2=class{constructor(t,i){k(this,"rendererState");k(this,"dirty",!1);k(this,"convertTo3DMapPosition");k(this,"colorToMaterialCache",{});this.rendererState=t,this.convertTo3DMapPosition=i}update(){var n,a,o;let t,i,r;for(let s of this.rendererState.geometry3DsInScene)if(r=s.components[0],t=s.components[1],i=s.components[5],s.type==="geometry"&&r instanceof Mr&&i!=null){if(i!=null&&i.dirty){if(i.mesh==null)try{if(!x2(r.feature))continue;let l=this.buildBorder(r.feature,t,i);l!=null&&((n=r.mesh)==null||n.add(l))}catch(l){Ft.error(l),i.dirty=!1}(a=i.mesh)==null||a.children.forEach(l=>{i&&l.material.color.set(t.borderColor)}),i.dirty=!1,i.visible=t.borderVisible}if(i!=null&&i.needsRebuild){i.mesh!=null&&(Yf(i.mesh),i.mesh=void 0);try{let l=this.buildBorder(r.feature,t,i);l!=null&&((o=r.mesh)==null||o.add(l))}catch(l){Ft.error(l)}i.needsRebuild=!1,i.visible=t.borderVisible}}}buildBorder(t,i,r){var v,w,P,S,C;let n=Zf(t),a=v2(t,hV);if(((w=(v=a.geometry.coordinates[0])==null?void 0:v.length)!=null?w:0)<3)return;let o=Zf(a),s=i.borderWidth/2,l=i.borderColor,u=$f(n,this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"square"}),h=u.clone();h.translate(0,0,i.height);let c;o.geometry.type==="LineString"?c=o.geometry.coordinates:c=o.geometry.coordinates.flat();let p=[];c.pop();for(let E of c||[])try{let F=$f({type:"Feature",geometry:{type:"LineString",coordinates:[[E[0],E[1],0],[E[0],E[1],i.height]]},properties:{}},this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"butt"});p.push(F)}catch(F){Ft.warn(F)}let d=qs([u,h,...p]),f=(P=this.colorToMaterialCache[l])==null?void 0:P[0];f==null&&(f=new Sn({color:l}));let y=(S=this.colorToMaterialCache[l])==null?void 0:S[1];y==null&&(y=new Sn({color:l})),this.colorToMaterialCache[l]=[f,y];let g=new Kt,_=new Yr(d,f),b=new Yr(d,y);return g.add(_),g.add(b),b.material.depthWrite=!1,b.material.depthTest=!1,b.material.opacity=cV,b.material.transparent=!0,g.position.z=(C=i.altitude)!=null?C:0,r.mesh=g,g}destroy(){for(let[t,[i,r]]of Object.entries(this.colorToMaterialCache))i.dispose(),r.dispose();this.colorToMaterialCache={}}};var Wf="#ffffff",pV=.1,Th=.1,dV="#333333",As,Es,ks,Hf=class{constructor(t={}){k(this,"type","style");k(this,"initialColor",Wf);zi(this,As,Wf);k(this,"initialTopColor");zi(this,Es);zi(this,ks);k(this,"dirty",!0);k(this,"visible",!0);k(this,"opacity",1);k(this,"width",pV);k(this,"height",Th);k(this,"initialHeight",Th);k(this,"altitude",0);k(this,"join","round");k(this,"cap","round");k(this,"showImage",!0);k(this,"flipImageToFaceCamera",!0);k(this,"enableImageCollisions",!1);k(this,"url");k(this,"side","double");k(this,"renderOrder",0);k(this,"shading");k(this,"bevel");k(this,"borderVisible",!1);k(this,"borderColor",dV);k(this,"borderWidth");k(this,"effectStart",0);k(this,"effectDistance",0);k(this,"darkenAmount",0);k(this,"darkenUseDepth",!0);k(this,"desaturateAmount",0);k(this,"desaturateUseDepth",!0);k(this,"washOutAmount",0);k(this,"washOutUseDepth",!1);k(this,"maxImageSize");this.color=(t==null?void 0:t.color)!==void 0?t.color:this.color,this.initialColor=this.color,this.width=(t==null?void 0:t.width)!==void 0?t.width:this.width,this.opacity=(t==null?void 0:t.opacity)!==void 0?t.opacity:this.opacity,this.visible=(t==null?void 0:t.visible)!==void 0?t.visible:this.visible,this.height=(t==null?void 0:t.height)!==void 0?t.height:this.height,this.initialHeight=this.height,this.altitude=(t==null?void 0:t.altitude)!==void 0?t.altitude:this.altitude,this.join=(t==null?void 0:t.join)!==void 0?t.join:this.join,this.cap=(t==null?void 0:t.cap)!==void 0?t.cap:this.cap,this.topColor=t==null?void 0:t.topColor,this.initialTopColor=this.topColor,this.showImage=(t==null?void 0:t.showImage)!==void 0?t.showImage:this.showImage,this.flipImageToFaceCamera=(t==null?void 0:t.flipImageToFaceCamera)!==void 0?t.flipImageToFaceCamera:this.flipImageToFaceCamera,this.url=t==null?void 0:t.url,this.side=(t==null?void 0:t.side)!==void 0?t.side:this.side,this.renderOrder=(t==null?void 0:t.renderOrder)!==void 0?t.renderOrder:this.renderOrder,this.shading=t==null?void 0:t.shading,this.bevel=t==null?void 0:t.bevel,this.borderVisible=(t==null?void 0:t.borderVisible)!==void 0?t.borderVisible:this.borderVisible,this.borderColor=(t==null?void 0:t.borderColor)!==void 0?t.borderColor:this.borderColor,this.borderWidth=(t==null?void 0:t.borderWidth)!==void 0?t.borderWidth:w2,this.enableImageCollisions=(t==null?void 0:t.enableImageCollisions)!==void 0?t.enableImageCollisions:this.enableImageCollisions,this.effectStart=(t==null?void 0:t.effectStart)!==void 0?t.effectStart:this.effectStart,this.effectDistance=(t==null?void 0:t.effectDistance)!==void 0?t.effectDistance:this.effectDistance,this.darkenAmount=(t==null?void 0:t.darkenAmount)!==void 0?t.darkenAmount:this.darkenAmount,this.darkenUseDepth=(t==null?void 0:t.darkenUseDepth)!==void 0?t.darkenUseDepth:this.darkenUseDepth,this.desaturateAmount=(t==null?void 0:t.desaturateAmount)!==void 0?t.desaturateAmount:this.desaturateAmount,this.desaturateUseDepth=(t==null?void 0:t.desaturateUseDepth)!==void 0?t.desaturateUseDepth:this.desaturateUseDepth,this.washOutAmount=(t==null?void 0:t.washOutAmount)!==void 0?t.washOutAmount:this.washOutAmount,this.washOutUseDepth=(t==null?void 0:t.washOutUseDepth)!==void 0?t.washOutUseDepth:this.washOutUseDepth,this.maxImageSize=t==null?void 0:t.maxImageSize}set color(t){qu(t)?wi(this,As,t):Ft.warn('Failed to update color. Invalid color "'.concat(t,'".'))}get color(){return Xt(this,As)}set topColor(t){t===void 0||qu(t)?wi(this,Es,t):Ft.warn('Failed to update top color. Invalid color "'.concat(t,'".'))}get topColor(){return Xt(this,Es)}set hoverColor(t){qu(t)?wi(this,ks,t):Ft.warn('Failed to update hover color. Invalid color "'.concat(t,'".'))}get hoverColor(){return Xt(this,ks)}};As=new WeakMap,Es=new WeakMap,ks=new WeakMap;var $a=class extends sy{constructor(){super(...arguments);k(this,"type","entityBatchedMesh");k(this,"userData",{entities:{}})}},Ds,Wn,Mr=class{constructor(t){k(this,"mesh");k(this,"imageMesh");k(this,"textMesh");k(this,"textEntityId");k(this,"type","geometry");k(this,"dirty",!0);k(this,"shouldDetach",!1);k(this,"detached",!1);k(this,"instanceIndex",-1);k(this,"geometry");k(this,"batchedProps");k(this,"material");k(this,"feature");k(this,"currentHeight",Th);k(this,"color",new Ri);k(this,"topColor",new Ri);k(this,"position",new We);k(this,"altitude",0);zi(this,Ds,1);zi(this,Wn);this.feature=t}get visible(){return this.mesh&&this.instanceIndex!==-1?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(t){this.mesh&&this.instanceIndex!==-1&&this.mesh.setVisibleAt(this.instanceIndex,t)}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(t){this.mesh&&(this.mesh.renderOrder=t)}setColor(t,i){this.color.set(t),this.topColor.set(i),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}getColor(){var t;return(t=this.material)==null?void 0:t.getColor(this.instanceIndex)}get opacity(){return Xt(this,Ds)}set opacity(t){wi(this,Ds,t)}get featureBbox(){return Xt(this,Wn)?Xt(this,Wn):(wi(this,Wn,c1(this.feature)),Xt(this,Wn))}};Ds=new WeakMap,Wn=new WeakMap;var ri=class extends Kt{constructor(i){super();k(this,"visible",!0);k(this,"type","geometry-group");k(this,"components",[]);k(this,"userData",{entityId:"",entities3D:new Set,dirty:!0,shadingDirty:!0,positionDirty:!1});this.userData.entityId=i}getComponent(i){return this.components.find(r=>(r==null?void 0:r.type)===i)}setVisible(i){this.visible!==i&&(this.visible=i,this.dispatchEvent({type:"childremoved",child:this}))}removeEntity(){this.dispatchEvent({type:"childremoved",child:this})}getfirstChildEntityId(){let i;for(let n of this.children)if(!n.userData.detached){i=n;break}return i instanceof $a?Object.values(i.userData.entities)[0]:void 0}};var ni=class e extends Kt{constructor(i){super();k(this,"childrenIds",new Set);k(this,"children",[]);k(this,"type","group-container");k(this,"userData",{entityId:"",entities2D:new Set,dirty:!0,occluderDirty:!1,opacity:1,computedOpacity:1,preloadGeometry:!1});k(this,"components",[]);this.userData.entityId=i}getComponent(){}addOccluderFeature(i,r){this.userData.occluderFeature=i,this.userData.occluderId=r,this.userData.occluderDirty=!0}addEntity(i){i instanceof e?(this.childrenIds.add(i.userData.entityId),this.add(i)):i instanceof Gr?(this.childrenIds.add(i.id),this.add(i.object3d),this.userData.entities2D.add(i.id),i.positionDirty=!0):i instanceof ri?(this.childrenIds.add(i.userData.entityId),this.add(i)):i instanceof di&&i.object3d&&(this.childrenIds.add(i.id),this.add(i.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(i){i instanceof e?(this.childrenIds.delete(i.userData.entityId),this.remove(i)):i instanceof Gr?(this.childrenIds.delete(i.id),this.userData.entities2D.delete(i.id),this.remove(i.object3d)):i instanceof ri?(this.childrenIds.delete(i.userData.entityId),this.remove(i)):i instanceof di&&i.object3d&&(this.childrenIds.delete(i.id),this.add(i.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(i){this.visible!==i&&(this.visible=i,this.dispatchEvent({type:"childremoved",child:this}))}setAltitude(i){if(this.position.z!==i){let r=!1;this.matrixWorldAutoUpdate===!1&&(r=!0,Hn(this)),this.position.z=i,this.updateMatrixWorld(),r&&Kn(this),this.dispatchEvent({type:"childremoved",child:this}),this.set2DGeometryChildrenPositionDirty()}}set2DGeometryChildrenPositionDirty(){this.children.forEach(i=>{i instanceof Tr?i.userData.worldPositionDirty=!0:i instanceof e&&i.set2DGeometryChildrenPositionDirty()})}get altitude(){return this.position.z}setOpacity(i){this.userData.opacity=i}get opacity(){return this.userData.opacity}};O();O();var Kf=63710088e-1;function P2(e){return(2*Math.atan(Math.exp((.5-e)*2*Math.PI))-Math.PI/2)*180/Math.PI}function S2(e){return e*360-180}function Mh(e){let t=e*Math.PI/180;return .5-Math.log(Math.tan(Math.PI/4+t/2))/(2*Math.PI)}function Ch(e){return(e+180)/360}function fV(e,t,i,r){let n=e*Math.PI/180,a=2*Math.PI*Kf*Math.cos(n),o=i/a,s=r/a,l=Ch(t),u=Mh(e),h=l+o,c=u-s,p=S2(h);return{lat:P2(c),lon:p}}function mV(e,t,i,r){let n=Ch(t),a=Mh(e),o=Ch(r),s=Mh(i),l=o-n,u=a-s,h=e*Math.PI/180,c=2*Math.PI*Kf*Math.cos(h),p=l*c,d=u*c;return{x:p,y:d}}function yV(e,t,i=1e-10){if(e.length!==t.length)return!1;let r=Math.abs(e[0]-t[0])<i,n=Math.abs(e[1]-t[1])<i;if(e.length===3&&t.length===3){let a=Math.abs(e[2]-t[2])<i;return r&&n&&a}return r&&n}O();function gV(e){let t=e.min,i=e.max,r=new We(t.x,t.y,t.z),n=new We(i.x,t.y,t.z),a=new We(t.x,i.y,t.z),o=new We(i.x,i.y,t.z);return[r,n,a,o]}O();function T2(e,t){let i;return typeof t=="string"||typeof t=="number"?(i=e.geometry2DMap.get(t),i==null&&(i=e.geometry3DMap.get(t))):typeof(t==null?void 0:t.id)=="string"||typeof(t==null?void 0:t.id)=="number"?(i=e.geometry2DMap.get(t.id),i==null&&(i=e.geometry3DMap.get(t.id))):i=t,i}function JH(e,t,i=[],r=new Pn,n){(e.getSystems().renderSystem.threeDdirty||e.getSystems().renderSystem.twoDdirty)&&e.renderSync();let a=T2(e.getInternalState(),t);return M2(a,i,r,n),i}var Ih=new We;function M2(e,t=[],i=new Pn,r){if(e.visible){if(e.isMesh||e.isLine||e.isPoints){let n=e.geometry;if(n.isBufferGeometry){let a=n.attributes.position;for(let o=0;o<a.count;o++)Ih.fromBufferAttribute(a,o),r!==void 0&&(Ih.z=r),t.push(Ih.clone()),i.expandByPoint(Ih)}}for(let n of e.children)M2(n,t,i,r)}}O();function Ms(e,t){let i={};for(let r=0;r<t.length;r++){let n=t[r];n in e&&(i[n]=e[n])}return i}function Vf(e){return Object.keys(e).length===0}var _V=()=>{};function Hn(e,t=!1){t?e.traverse(i=>{Hn(i)}):(e.matrixWorldAutoUpdate=!0,e.updateMatrixWorld=Kt.prototype.updateMatrixWorld)}function Kn(e,t=!1){t?e.traverse(i=>{Kn(i)}):(e.matrixWorldAutoUpdate=!1,e.updateMatrixWorld=_V)}var xV=(e,t,i,r,n,a=!1)=>{var l;let o=e instanceof ni&&e.userData.preloadGeometry,s=a||o&&!e.visible;if(e.children&&(e.visible||o)){Hn(e);for(let u of e.children){if(u.visible&&u.type&&!s)if(Hn(u),"entities3D"in u.userData&&((l=u.userData)!=null&&l.entities3D)&&u instanceof ri){i.add(u.userData.entityId),r.add(u);for(let h of u.userData.entities3D.values())i.add(h),t.has(h)&&r.add(t.get(h))}else u.type==="group-container"||u.type==="custom-geometry"?(i.add(u.userData.entityId),r.add(u)):u instanceof qn&&(i.add(u.userData.entityId),t.has(u.userData.entityId)&&r.add(t.get(u.userData.entityId)));else Kn(u);u instanceof ri&&u.userData.dirty&&n.add(u.userData.entityId),xV(u,t,i,r,n,s)}}else Kn(e);return i},vV=(e,t,i,r)=>{var n;if(e.children&&e.visible&&!((n=e.userData)!=null&&n.hidden)){Hn(e);for(let a of e.children)a instanceof Tr&&(a.visible?(Hn(a),i.add(a.userData.entityId),t.has(a.userData.entityId)&&r.add(t.get(a.userData.entityId))):Kn(a)),vV(a,t,i,r)}else Kn(e);return i};function jf(e,t){for(let i in t)if(!(i==="__proto__"||i==="constructor"||i==="prototype")){if(t[i]==null){e[i]=void 0;continue}Array.isArray(t[i])?e[i]=t[i]:typeof t[i]=="object"&&typeof e[i]=="object"&&e[i]!==null&&!Array.isArray(e[i])?jf(e[i],t[i]):e[i]=t[i]}return e}function bV(e){return fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}async function fK(e){let t=await bV(e),{access_token:i}=await t.json();return{"x-mappedin-tiles-key":i}}function mK(e,t,i){let r=e*(Math.PI/180)/2,n=t/2;return i*Math.tan(r)/n}function yK(e){return new yr(new de(e[0][0],e[0][1]),new de(e[1][0],e[1][1])).getCenter().toArray()}function gK(e,t){return e<t||t<=12}function _K(e){let t=1;return e.type==="geometry-group"&&e.parent!=null&&e.parent instanceof ni?t=e.parent.userData.computedOpacity:(e.type==="geometry"||e.type==="custom-geometry"||e.type==="model")&&e.parentObject3D!=null&&e.parentObject3D instanceof ri&&e.parentObject3D.parent!=null&&e.parentObject3D.parent instanceof ni&&(t=e.parentObject3D.parent.userData.computedOpacity),t}var wV="maplibre-frustum-culling-hack";function xK(){let e=new ay(.01,.01,.01),t=new Sn({opacity:0,depthWrite:!1,transparent:!0}),i=new Yr(e,t);return i.position.copy(new We(0,50,0)),i.frustumCulled=!1,i.name=wV,i}var _n=new We,C2=new ao;function vK(e,t,i=new Xs){return e.updateMatrixWorld(),e.traverse(r=>{if(r instanceof Yr){let a=r.geometry.attributes.position;if(t.position.distanceTo(r.position)<t.near)return;for(let s=0;s<a.count;s++)_n.fromBufferAttribute(a,s),_n.applyMatrix4(r.matrixWorld),_n.applyMatrix4(t.matrixWorldInverse),_n.applyMatrix4(t.projectionMatrix),_n.z<1&&_n.z>0&&(C2.set(_n.x,_n.y),i.expandByPoint(C2))}}),i}function I2(e,t){let i=t.clientWidth,r=t.clientHeight;return new ao((e.x+1)*i/2,(1-e.y)*r/2)}function bK(e,t,i){let r=document.createElement("div");r.style.position="absolute",r.style.border="2px solid ".concat(t),r.style.pointerEvents="none";let n=I2(new ao(e.min.x,e.min.y),i),a=I2(new ao(e.max.x,e.max.y),i);r.style.left="".concat(n.x,"px"),r.style.top="".concat(a.y,"px");let o=Math.abs(a.x-n.x),s=Math.abs(a.y-n.y);return r.style.width="".concat(o,"px"),r.style.height="".concat(s,"px"),i.appendChild(r),r}function wK(e,t){let i=0,r=0,n=e.clientWidth,a=e.clientHeight;if(t){let{left:o,top:s,right:l,bottom:u,type:h}=t,c=o!=null?o:0,p=s!=null?s:0,d=l!=null?l:0,f=u!=null?u:0;h==="portion"?(i=c*n,r=p*a,n=n-i-d*n,a=a-r-f*a):(i=c,r=p,n=n-i-d,a=a-r-f)}return[i,r,n,a].map(o=>Math.max(o,0))}function Nf(e){return(e*100|0)/100}function PK(e,t,i){t>e.getMaxZoom()?(e.setMaxZoom(i),e.setMinZoom(t)):(e.setMinZoom(t),e.setMaxZoom(i))}O();var Jf=class{constructor(t){k(this,"type","text3dStyle");k(this,"visible");k(this,"altitude");k(this,"color");k(this,"dirty",!0);k(this,"maxWidth");k(this,"maxHeight");k(this,"hoverByPolygon");k(this,"flipToFaceCamera",A2.flipToFaceCamera);k(this,"font");k(this,"fillOpacity");k(this,"fontSize");k(this,"margin");k(this,"outlineWidth");k(this,"outlineBlur");k(this,"outlineOffsetX");k(this,"strokeColor");k(this,"strokeOpacity");k(this,"strokeWidth");k(this,"hoverColor");k(this,"outlineOffsetY");k(this,"outlineColor");k(this,"outlineOpacity");t&&Object.assign(this,t)}getState(t=!1){let i={};for(let r in this)!t&&r==="dirty"||this[r]!==void 0&&(i[r]=this[r]);return i}},A2=Object.freeze({visible:!0,color:"black",flipToFaceCamera:!0,fillOpacity:1,font:void 0,fontSize:2,margin:[.2,1,.2,1.5],outlineColor:"black",outlineOpacity:1,outlineWidth:0,outlineOffsetX:0,outlineOffsetY:0,outlineBlur:0,strokeOpacity:1,strokeWidth:0,maxWidth:void 0,maxHeight:void 0,strokeColor:"black",hoverColor:void 0});O();O();var Jn,Qf=class{constructor(t){k(this,"type","modelStyle");k(this,"dirty",!0);k(this,"renderOrderDirty",!0);k(this,"visible",!0);k(this,"opacity",1);k(this,"verticalOffset",0);k(this,"interactive",!1);k(this,"color");k(this,"material");k(this,"rotation");k(this,"scale");zi(this,Jn,!1);k(this,"EXPERIMENTAL_clippingEnabled",!1);k(this,"clippingPlaneZOffset",1/0);k(this,"clippingPlaneTopColor");k(this,"clippingPlaneTopVisible",!0);if(t){let i=t,{visibleThroughGeometry:r,EXPERIMENTAL_clippingEnabled:n}=i,a=ey(i,["visibleThroughGeometry","EXPERIMENTAL_clippingEnabled"]);Object.assign(this,a),r!==void 0&&wi(this,Jn,r),n!==void 0&&(this.EXPERIMENTAL_clippingEnabled=n)}}get visibleThroughGeometry(){return Xt(this,Jn)}set visibleThroughGeometry(t){Xt(this,Jn)!==t&&(wi(this,Jn,t),this.renderOrderDirty=!0)}};Jn=new WeakMap;O();var PV=[1,1,1],SV=[0,0,0];export{O2 as a,N2 as b,TV as c,Ft as d,ah as e,V7 as f,fy as g,IV as h,oh as i,dn as j,x4 as k,G$ as l,u1 as m,X$ as n,q$ as o,$$ as p,Z$ as q,Y$ as r,W$ as s,H$ as t,Xu as u,t7 as v,b4 as w,i7 as x,h1 as y,Kf as z,Zs as A,my as B,$2 as C,RV as D,Ty as E,My as F,Wh as G,Cy as H,er as I,Z2 as J,OV as K,Y2 as L,W2 as M,H2 as N,xy as O,vy as P,Zh as Q,by as R,wy as S,K2 as T,Q2 as U,eP as V,qu as W,S1 as X,N4 as Y,Z1 as Z,Tf as _,Z4 as $,Y4 as aa,rh as ba,Q1 as ca,If as da,k7 as ea,F7 as fa,B7 as ga,Ke as ha,lU as ia,fU as ja,mU as ka,Gr as la,qn as ma,di as na,Df as oa,v$ as pa,b$ as qa,a1 as ra,o1 as sa,w$ as ta,P$ as ua,S$ as va,T$ as wa,f4 as xa,fV as ya,mV as za,yV as Aa,gV as Ba,T2 as Ca,JH as Da,m4 as Ea,y4 as Fa,Gu as Ga,_4 as Ha,Hn as Ia,Kn as Ja,xV as Ka,vV as La,fK as Ma,mK as Na,yK as Oa,gK as Pa,_K as Qa,xK as Ra,vK as Sa,bK as Ta,wK as Ua,PK as Va,Jf as Wa,A2 as Xa,Qf as Ya,PV as Za,SV as _a,Rw as $a,x6 as ab,mZ as bb,wZ as cb,lh as db,uh as eb,kZ as fb,Ff as gb,DZ as hb,Ps as ib,se as jb,fY as kb,Of as lb,mY as mb,yY as nb,gY as ob,_Y as pb,xY as qb,fh as rb,mh as sb,_h as tb,Ts as ub,aW as vb,oW as wb,sW as xb,K6 as yb,Hw as zb,lW as Ab,uW as Bb,hW as Cb,cW as Db,pW as Eb,Jw as Fb,dW as Gb,fW as Hb,mW as Ib,yW as Jb,e2 as Kb,Q6 as Lb,gW as Mb,eN as Nb,iN as Ob,_W as Pb,xW as Qb,rN as Rb,nN as Sb,vW as Tb,bW as Ub,aN as Vb,wW as Wb,PW as Xb,oN as Yb,SW as Zb,lN as _b,TW as $b,MW as ac,CW as bc,IW as cc,qr as dc,$f as ec,Yf as fc,b2 as gc,Wf as hc,Hf as ic,$a as jc,Mr as kc,ri as lc,ni as mc};
|