@mappedin/react-sdk 6.0.1-beta.52 → 6.0.1-beta.53

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.
@@ -0,0 +1 @@
1
+ import{a as _2}from"./chunk-WVB6PZOJ.js";import{a as d}from"./chunk-5SHMBNLX.js";import{a as Vt,b as Zr,c as l,g as Tt,h as Ci,i as ae}from"./chunk-PEDEW3M6.js";var ge=Tt((ID,Gx)=>{"use strict";d();Gx.exports=Ei;function Ei(r,e){this.x=r,this.y=e}l(Ei,"Point");Ei.prototype={clone:l(function(){return new Ei(this.x,this.y)},"clone"),add:l(function(r){return this.clone()._add(r)},"add"),sub:l(function(r){return this.clone()._sub(r)},"sub"),multByPoint:l(function(r){return this.clone()._multByPoint(r)},"multByPoint"),divByPoint:l(function(r){return this.clone()._divByPoint(r)},"divByPoint"),mult:l(function(r){return this.clone()._mult(r)},"mult"),div:l(function(r){return this.clone()._div(r)},"div"),rotate:l(function(r){return this.clone()._rotate(r)},"rotate"),rotateAround:l(function(r,e){return this.clone()._rotateAround(r,e)},"rotateAround"),matMult:l(function(r){return this.clone()._matMult(r)},"matMult"),unit:l(function(){return this.clone()._unit()},"unit"),perp:l(function(){return this.clone()._perp()},"perp"),round:l(function(){return this.clone()._round()},"round"),mag:l(function(){return Math.sqrt(this.x*this.x+this.y*this.y)},"mag"),equals:l(function(r){return this.x===r.x&&this.y===r.y},"equals"),dist:l(function(r){return Math.sqrt(this.distSqr(r))},"dist"),distSqr:l(function(r){var e=r.x-this.x,t=r.y-this.y;return e*e+t*t},"distSqr"),angle:l(function(){return Math.atan2(this.y,this.x)},"angle"),angleTo:l(function(r){return Math.atan2(this.y-r.y,this.x-r.x)},"angleTo"),angleWith:l(function(r){return this.angleWithSep(r.x,r.y)},"angleWith"),angleWithSep:l(function(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},"angleWithSep"),_matMult:l(function(r){var e=r[0]*this.x+r[1]*this.y,t=r[2]*this.x+r[3]*this.y;return this.x=e,this.y=t,this},"_matMult"),_add:l(function(r){return this.x+=r.x,this.y+=r.y,this},"_add"),_sub:l(function(r){return this.x-=r.x,this.y-=r.y,this},"_sub"),_mult:l(function(r){return this.x*=r,this.y*=r,this},"_mult"),_div:l(function(r){return this.x/=r,this.y/=r,this},"_div"),_multByPoint:l(function(r){return this.x*=r.x,this.y*=r.y,this},"_multByPoint"),_divByPoint:l(function(r){return this.x/=r.x,this.y/=r.y,this},"_divByPoint"),_unit:l(function(){return this._div(this.mag()),this},"_unit"),_perp:l(function(){var r=this.y;return this.y=this.x,this.x=-r,this},"_perp"),_rotate:l(function(r){var e=Math.cos(r),t=Math.sin(r),i=e*this.x-t*this.y,n=t*this.x+e*this.y;return this.x=i,this.y=n,this},"_rotate"),_rotateAround:l(function(r,e){var t=Math.cos(r),i=Math.sin(r),n=e.x+t*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+t*(this.y-e.y);return this.x=n,this.y=o,this},"_rotateAround"),_round:l(function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},"_round")};Ei.convert=function(r){return r instanceof Ei?r:Array.isArray(r)?new Ei(r[0],r[1]):r}});var Zx=Tt((kD,jx)=>{"use strict";d();jx.exports=qx;function qx(r,e,t,i){this.cx=3*r,this.bx=3*(t-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=e,this.p2x=t,this.p2y=i}l(qx,"UnitBezier");qx.prototype={sampleCurveX:l(function(r){return((this.ax*r+this.bx)*r+this.cx)*r},"sampleCurveX"),sampleCurveY:l(function(r){return((this.ay*r+this.by)*r+this.cy)*r},"sampleCurveY"),sampleCurveDerivativeX:l(function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},"sampleCurveDerivativeX"),solveCurveX:l(function(r,e){if(e===void 0&&(e=1e-6),r<0)return 0;if(r>1)return 1;for(var t=r,i=0;i<8;i++){var n=this.sampleCurveX(t)-r;if(Math.abs(n)<e)return t;var o=this.sampleCurveDerivativeX(t);if(Math.abs(o)<1e-6)break;t=t-n/o}var a=0,s=1;for(t=r,i=0;i<20&&(n=this.sampleCurveX(t),!(Math.abs(n-r)<e));i++)r>n?a=t:s=t,t=(s-a)*.5+a;return t},"solveCurveX"),solve:l(function(r,e){return this.sampleCurveY(this.solveCurveX(r,e))},"solve")}});var z_=Tt((_R,Kf)=>{d();function pM(r,e){var t,i,n,o,a,s,u,c,p,h;for(t=r.length&3,i=r.length-t,n=e,a=3432918353,u=461845907,h=0;h<i;)p=r.charCodeAt(h)&255|(r.charCodeAt(++h)&255)<<8|(r.charCodeAt(++h)&255)<<16|(r.charCodeAt(++h)&255)<<24,++h,p=(p&65535)*a+(((p>>>16)*a&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*u+(((p>>>16)*u&65535)<<16)&4294967295,n^=p,n=n<<13|n>>>19,o=(n&65535)*5+(((n>>>16)*5&65535)<<16)&4294967295,n=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(p=0,t){case 3:p^=(r.charCodeAt(h+2)&255)<<16;case 2:p^=(r.charCodeAt(h+1)&255)<<8;case 1:p^=r.charCodeAt(h)&255,p=(p&65535)*a+(((p>>>16)*a&65535)<<16)&4294967295,p=p<<15|p>>>17,p=(p&65535)*u+(((p>>>16)*u&65535)<<16)&4294967295,n^=p}return n^=r.length,n^=n>>>16,n=(n&65535)*2246822507+(((n>>>16)*2246822507&65535)<<16)&4294967295,n^=n>>>13,n=(n&65535)*3266489909+(((n>>>16)*3266489909&65535)<<16)&4294967295,n^=n>>>16,n>>>0}l(pM,"murmurhash3_32_gc");typeof Kf<"u"&&(Kf.exports=pM)});var F_=Tt((SR,Jf)=>{d();function hM(r,e){for(var t=r.length,i=e^t,n=0,o;t>=4;)o=r.charCodeAt(n)&255|(r.charCodeAt(++n)&255)<<8|(r.charCodeAt(++n)&255)<<16|(r.charCodeAt(++n)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16)^o,t-=4,++n;switch(t){case 3:i^=(r.charCodeAt(n+2)&255)<<16;case 2:i^=(r.charCodeAt(n+1)&255)<<8;case 1:i^=r.charCodeAt(n)&255,i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16)}return i^=i>>>13,i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16),i^=i>>>15,i>>>0}l(hM,"murmurhash2_32_gc");typeof Jf!==void 0&&(Jf.exports=hM)});var Yf=Tt((MR,Tl)=>{d();var R_=z_(),fM=F_();Tl.exports=R_;Tl.exports.murmur3=R_;Tl.exports.murmur2=fM});var Em=Tt((mO,Cm)=>{"use strict";d();Cm.exports=Nl;Cm.exports.default=Nl;function Nl(r,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:r.length,o=Nv(r,0,n,t,!0),a=[];if(!o||o.next===o.prev)return a;var s,u,c,p,h,f,m;if(i&&(o=SE(r,e,o,t)),r.length>80*t){s=c=r[0],u=p=r[1];for(var y=t;y<n;y+=t)h=r[y],f=r[y+1],h<s&&(s=h),f<u&&(u=f),h>c&&(c=h),f>p&&(p=f);m=Math.max(c-s,p-u),m=m!==0?32767/m:0}return Go(o,a,t,s,u,m,0),a}l(Nl,"earcut");function Nv(r,e,t,i,n){var o,a;if(n===Im(r,e,t,i)>0)for(o=e;o<t;o+=i)a=Uv(o,r[o],r[o+1],a);else for(o=t-i;o>=e;o-=i)a=Uv(o,r[o],r[o+1],a);return a&&Gl(a,a.next)&&(jo(a),a=a.next),a}l(Nv,"linkedList");function di(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(Gl(t,t.next)||Oe(t.prev,t,t.next)===0)){if(jo(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}l(di,"filterPoints");function Go(r,e,t,i,n,o,a){if(r){!a&&o&&IE(r,i,n,o);for(var s=r,u,c;r.prev!==r.next;){if(u=r.prev,c=r.next,o?_E(r,i,n,o):bE(r)){e.push(u.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),jo(r),r=c.next,s=c.next;continue}if(r=c,r===s){a?a===1?(r=vE(di(r),e,t),Go(r,e,t,i,n,o,2)):a===2&&wE(r,e,t,i,n,o):Go(di(r),e,t,i,n,o,1);break}}}}l(Go,"earcutLinked");function bE(r){var e=r.prev,t=r,i=r.next;if(Oe(e,t,i)>=0)return!1;for(var n=e.x,o=t.x,a=i.x,s=e.y,u=t.y,c=i.y,p=n<o?n<a?n:a:o<a?o:a,h=s<u?s<c?s:c:u<c?u:c,f=n>o?n>a?n:a:o>a?o:a,m=s>u?s>c?s:c:u>c?u:c,y=i.next;y!==e;){if(y.x>=p&&y.x<=f&&y.y>=h&&y.y<=m&&ln(n,s,o,u,a,c,y.x,y.y)&&Oe(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}l(bE,"isEar");function _E(r,e,t,i){var n=r.prev,o=r,a=r.next;if(Oe(n,o,a)>=0)return!1;for(var s=n.x,u=o.x,c=a.x,p=n.y,h=o.y,f=a.y,m=s<u?s<c?s:c:u<c?u:c,y=p<h?p<f?p:f:h<f?h:f,g=s>u?s>c?s:c:u>c?u:c,x=p>h?p>f?p:f:h>f?h:f,b=Mm(m,y,e,t,i),w=Mm(g,x,e,t,i),_=r.prevZ,S=r.nextZ;_&&_.z>=b&&S&&S.z<=w;){if(_.x>=m&&_.x<=g&&_.y>=y&&_.y<=x&&_!==n&&_!==a&&ln(s,p,u,h,c,f,_.x,_.y)&&Oe(_.prev,_,_.next)>=0||(_=_.prevZ,S.x>=m&&S.x<=g&&S.y>=y&&S.y<=x&&S!==n&&S!==a&&ln(s,p,u,h,c,f,S.x,S.y)&&Oe(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;_&&_.z>=b;){if(_.x>=m&&_.x<=g&&_.y>=y&&_.y<=x&&_!==n&&_!==a&&ln(s,p,u,h,c,f,_.x,_.y)&&Oe(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;S&&S.z<=w;){if(S.x>=m&&S.x<=g&&S.y>=y&&S.y<=x&&S!==n&&S!==a&&ln(s,p,u,h,c,f,S.x,S.y)&&Oe(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}l(_E,"isEarHashed");function vE(r,e,t){var i=r;do{var n=i.prev,o=i.next.next;!Gl(n,o)&&Gv(n,i,i.next,o)&&qo(n,o)&&qo(o,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),jo(i),jo(i.next),i=r=o),i=i.next}while(i!==r);return di(i)}l(vE,"cureLocalIntersections");function wE(r,e,t,i,n,o){var a=r;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&kE(a,s)){var u=qv(a,s);a=di(a,a.next),u=di(u,u.next),Go(a,e,t,i,n,o,0),Go(u,e,t,i,n,o,0);return}s=s.next}a=a.next}while(a!==r)}l(wE,"splitEarcut");function SE(r,e,t,i){var n=[],o,a,s,u,c;for(o=0,a=e.length;o<a;o++)s=e[o]*i,u=o<a-1?e[o+1]*i:r.length,c=Nv(r,s,u,i,!1),c===c.next&&(c.steiner=!0),n.push(EE(c));for(n.sort(PE),o=0;o<n.length;o++)t=TE(n[o],t);return t}l(SE,"eliminateHoles");function PE(r,e){return r.x-e.x}l(PE,"compareX");function TE(r,e){var t=ME(r,e);if(!t)return e;var i=qv(t,r);return di(i,i.next),di(t,t.next)}l(TE,"eliminateHole");function ME(r,e){var t=e,i=r.x,n=r.y,o=-1/0,a;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var s=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(s<=i&&s>o&&(o=s,a=t.x<t.next.x?t:t.next,s===i))return a}t=t.next}while(t!==e);if(!a)return null;var u=a,c=a.x,p=a.y,h=1/0,f;t=a;do i>=t.x&&t.x>=c&&i!==t.x&&ln(n<p?i:o,n,c,p,n<p?o:i,n,t.x,t.y)&&(f=Math.abs(n-t.y)/(i-t.x),qo(t,r)&&(f<h||f===h&&(t.x>a.x||t.x===a.x&&AE(a,t)))&&(a=t,h=f)),t=t.next;while(t!==u);return a}l(ME,"findHoleBridge");function AE(r,e){return Oe(r.prev,r,e.prev)<0&&Oe(e.next,r,r.next)<0}l(AE,"sectorContainsSector");function IE(r,e,t,i){var n=r;do n.z===0&&(n.z=Mm(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,CE(n)}l(IE,"indexCurve");function CE(r){var e,t,i,n,o,a,s,u,c=1;do{for(t=r,r=null,o=null,a=0;t;){for(a++,i=t,s=0,e=0;e<c&&(s++,i=i.nextZ,!!i);e++);for(u=c;s>0||u>0&&i;)s!==0&&(u===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,s--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:r=n,n.prevZ=o,o=n;t=i}o.nextZ=null,c*=2}while(a>1);return r}l(CE,"sortLinked");function Mm(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}l(Mm,"zOrder");function EE(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}l(EE,"getLeftmost");function ln(r,e,t,i,n,o,a,s){return(n-a)*(e-s)>=(r-a)*(o-s)&&(r-a)*(i-s)>=(t-a)*(e-s)&&(t-a)*(o-s)>=(n-a)*(i-s)}l(ln,"pointInTriangle");function kE(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!LE(r,e)&&(qo(r,e)&&qo(e,r)&&DE(r,e)&&(Oe(r.prev,r,e.prev)||Oe(r,e.prev,e))||Gl(r,e)&&Oe(r.prev,r,r.next)>0&&Oe(e.prev,e,e.next)>0)}l(kE,"isValidDiagonal");function Oe(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}l(Oe,"area");function Gl(r,e){return r.x===e.x&&r.y===e.y}l(Gl,"equals");function Gv(r,e,t,i){var n=Ul(Oe(r,e,t)),o=Ul(Oe(r,e,i)),a=Ul(Oe(t,i,r)),s=Ul(Oe(t,i,e));return!!(n!==o&&a!==s||n===0&&Vl(r,t,e)||o===0&&Vl(r,i,e)||a===0&&Vl(t,r,i)||s===0&&Vl(t,e,i))}l(Gv,"intersects");function Vl(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}l(Vl,"onSegment");function Ul(r){return r>0?1:r<0?-1:0}l(Ul,"sign");function LE(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Gv(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}l(LE,"intersectsPolygon");function qo(r,e){return Oe(r.prev,r,r.next)<0?Oe(r,e,r.next)>=0&&Oe(r,r.prev,e)>=0:Oe(r,e,r.prev)<0||Oe(r,r.next,e)<0}l(qo,"locallyInside");function DE(r,e){var t=r,i=!1,n=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&n<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}l(DE,"middleInside");function qv(r,e){var t=new Am(r.i,r.x,r.y),i=new Am(e.i,e.x,e.y),n=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,o.next=i,i.prev=o,i}l(qv,"splitPolygon");function Uv(r,e,t,i){var n=new Am(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}l(Uv,"insertNode");function jo(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}l(jo,"removeNode");function Am(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}l(Am,"Node");Nl.deviation=function(r,e,t,i){var n=e&&e.length,o=n?e[0]*t:r.length,a=Math.abs(Im(r,0,o,t));if(n)for(var s=0,u=e.length;s<u;s++){var c=e[s]*t,p=s<u-1?e[s+1]*t:r.length;a-=Math.abs(Im(r,c,p,t))}var h=0;for(s=0;s<i.length;s+=3){var f=i[s]*t,m=i[s+1]*t,y=i[s+2]*t;h+=Math.abs((r[f]-r[y])*(r[m+1]-r[f+1])-(r[f]-r[m])*(r[y+1]-r[f+1]))}return a===0&&h===0?0:Math.abs((h-a)/a)};function Im(r,e,t,i){for(var n=0,o=e,a=t-i;o<t;o+=i)n+=(r[a]-r[o])*(r[o+1]+r[a+1]),a=o;return n}l(Im,"signedArea");Nl.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,n=0;n<r.length;n++){for(var o=0;o<r[n].length;o++)for(var a=0;a<e;a++)t.vertices.push(r[n][o][a]);n>0&&(i+=r[n-1].length,t.holes.push(i))}return t}});var zm=Tt((h4,Jv)=>{"use strict";d();var UE=ge();Jv.exports=pn;function pn(r,e,t,i,n){this.properties={},this.extent=t,this.type=0,this._pbf=r,this._geometry=-1,this._keys=i,this._values=n,r.readFields(NE,this,e)}l(pn,"VectorTileFeature");function NE(r,e,t){r==1?e.id=t.readVarint():r==2?GE(t,e):r==3?e.type=t.readVarint():r==4&&(e._geometry=t.pos)}l(NE,"readFeature");function GE(r,e){for(var t=r.readVarint()+r.pos;r.pos<t;){var i=e._keys[r.readVarint()],n=e._values[r.readVarint()];e.properties[i]=n}}l(GE,"readTag");pn.types=["Unknown","Point","LineString","Polygon"];pn.prototype.loadGeometry=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,i=0,n=0,o=0,a=[],s;r.pos<e;){if(i<=0){var u=r.readVarint();t=u&7,i=u>>3}if(i--,t===1||t===2)n+=r.readSVarint(),o+=r.readSVarint(),t===1&&(s&&a.push(s),s=[]),s.push(new UE(n,o));else if(t===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+t)}return s&&a.push(s),a};pn.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,i=0,n=0,o=0,a=1/0,s=-1/0,u=1/0,c=-1/0;r.pos<e;){if(i<=0){var p=r.readVarint();t=p&7,i=p>>3}if(i--,t===1||t===2)n+=r.readSVarint(),o+=r.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<u&&(u=o),o>c&&(c=o);else if(t!==7)throw new Error("unknown command "+t)}return[a,u,s,c]};pn.prototype.toGeoJSON=function(r,e,t){var i=this.extent*Math.pow(2,t),n=this.extent*r,o=this.extent*e,a=this.loadGeometry(),s=pn.types[this.type],u,c;function p(m){for(var y=0;y<m.length;y++){var g=m[y],x=180-(g.y+o)*360/i;m[y]=[(g.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp(x*Math.PI/180))-90]}}switch(l(p,"project"),this.type){case 1:var h=[];for(u=0;u<a.length;u++)h[u]=a[u][0];a=h,p(a);break;case 2:for(u=0;u<a.length;u++)p(a[u]);break;case 3:for(a=qE(a),u=0;u<a.length;u++)for(c=0;c<a[u].length;c++)p(a[u][c]);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 qE(r){var e=r.length;if(e<=1)return[r];for(var t=[],i,n,o=0;o<e;o++){var a=jE(r[o]);a!==0&&(n===void 0&&(n=a<0),n===a<0?(i&&t.push(i),i=[r[o]]):i.push(r[o]))}return i&&t.push(i),t}l(qE,"classifyRings");function jE(r){for(var e=0,t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}l(jE,"signedArea")});var Fm=Tt((d4,Qv)=>{"use strict";d();var ZE=zm();Qv.exports=Yv;function Yv(r,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(HE,this,e),this.length=this._features.length}l(Yv,"VectorTileLayer");function HE(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push($E(t))}l(HE,"readLayer");function $E(r){for(var e=null,t=r.readVarint()+r.pos;r.pos<t;){var i=r.readVarint()>>3;e=i===1?r.readString():i===2?r.readFloat():i===3?r.readDouble():i===4?r.readVarint64():i===5?r.readVarint():i===6?r.readSVarint():i===7?r.readBoolean():null}return e}l($E,"readValueMessage");Yv.prototype.feature=function(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];var e=this._pbf.readVarint()+this._pbf.pos;return new ZE(this._pbf,e,this.extent,this._keys,this._values)}});var t0=Tt((x4,e0)=>{"use strict";d();var WE=Fm();e0.exports=XE;function XE(r,e){this.layers=r.readFields(KE,{},e)}l(XE,"VectorTile");function KE(r,e,t){if(r===3){var i=new WE(t,t.readVarint()+t.pos);i.length&&(e[i.name]=i)}}l(KE,"readTile")});var Wo=Tt((v4,jl)=>{d();jl.exports.VectorTile=t0();jl.exports.VectorTileFeature=zm();jl.exports.VectorTileLayer=Fm()});var S0=Tt(Zm=>{d();Zm.read=function(r,e,t,i,n){var o,a,s=n*8-i-1,u=(1<<s)-1,c=u>>1,p=-7,h=t?n-1:0,f=t?-1:1,m=r[e+h];for(h+=f,o=m&(1<<-p)-1,m>>=-p,p+=s;p>0;o=o*256+r[e+h],h+=f,p-=8);for(a=o&(1<<-p)-1,o>>=-p,p+=i;p>0;a=a*256+r[e+h],h+=f,p-=8);if(o===0)o=1-c;else{if(o===u)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-c}return(m?-1:1)*a*Math.pow(2,o-i)};Zm.write=function(r,e,t,i,n,o){var a,s,u,c=o*8-n-1,p=(1<<c)-1,h=p>>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:o-1,y=i?1:-1,g=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=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+h>=1?e+=f/u:e+=f*Math.pow(2,1-h),e*u>=2&&(a++,u/=2),a+h>=p?(s=0,a=p):a+h>=1?(s=(e*u-1)*Math.pow(2,n),a=a+h):(s=e*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;r[t+m]=s&255,m+=y,s/=256,n-=8);for(a=a<<n|s,c+=n;c>0;r[t+m]=a&255,m+=y,a/=256,c-=8);r[t+m-y]|=g*128}});var $m=Tt((AV,I0)=>{"use strict";d();I0.exports=Te;var Xl=S0();function Te(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}l(Te,"Pbf");Te.Varint=0;Te.Fixed64=1;Te.Bytes=2;Te.Fixed32=5;var Hm=65536*65536,P0=1/Hm,dk=12,A0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Te.prototype={destroy:l(function(){this.buf=null},"destroy"),readFields:l(function(r,e,t){for(t=t||this.length;this.pos<t;){var i=this.readVarint(),n=i>>3,o=this.pos;this.type=i&7,r(n,e,this),this.pos===o&&this.skip(i)}return e},"readFields"),readMessage:l(function(r,e){return this.readFields(r,e,this.readVarint()+this.pos)},"readMessage"),readFixed32:l(function(){var r=Kl(this.buf,this.pos);return this.pos+=4,r},"readFixed32"),readSFixed32:l(function(){var r=M0(this.buf,this.pos);return this.pos+=4,r},"readSFixed32"),readFixed64:l(function(){var r=Kl(this.buf,this.pos)+Kl(this.buf,this.pos+4)*Hm;return this.pos+=8,r},"readFixed64"),readSFixed64:l(function(){var r=Kl(this.buf,this.pos)+M0(this.buf,this.pos+4)*Hm;return this.pos+=8,r},"readSFixed64"),readFloat:l(function(){var r=Xl.read(this.buf,this.pos,!0,23,4);return this.pos+=4,r},"readFloat"),readDouble:l(function(){var r=Xl.read(this.buf,this.pos,!0,52,8);return this.pos+=8,r},"readDouble"),readVarint:l(function(r){var e=this.buf,t,i;return i=e[this.pos++],t=i&127,i<128||(i=e[this.pos++],t|=(i&127)<<7,i<128)||(i=e[this.pos++],t|=(i&127)<<14,i<128)||(i=e[this.pos++],t|=(i&127)<<21,i<128)?t:(i=e[this.pos],t|=(i&15)<<28,yk(t,r,this))},"readVarint"),readVarint64:l(function(){return this.readVarint(!0)},"readVarint64"),readSVarint:l(function(){var r=this.readVarint();return r%2===1?(r+1)/-2:r/2},"readSVarint"),readBoolean:l(function(){return!!this.readVarint()},"readBoolean"),readString:l(function(){var r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=dk&&A0?Ek(this.buf,e,r):Ck(this.buf,e,r)},"readString"),readBytes:l(function(){var r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e},"readBytes"),readPackedVarint:l(function(r,e){if(this.type!==Te.Bytes)return r.push(this.readVarint(e));var t=ur(this);for(r=r||[];this.pos<t;)r.push(this.readVarint(e));return r},"readPackedVarint"),readPackedSVarint:l(function(r){if(this.type!==Te.Bytes)return r.push(this.readSVarint());var e=ur(this);for(r=r||[];this.pos<e;)r.push(this.readSVarint());return r},"readPackedSVarint"),readPackedBoolean:l(function(r){if(this.type!==Te.Bytes)return r.push(this.readBoolean());var e=ur(this);for(r=r||[];this.pos<e;)r.push(this.readBoolean());return r},"readPackedBoolean"),readPackedFloat:l(function(r){if(this.type!==Te.Bytes)return r.push(this.readFloat());var e=ur(this);for(r=r||[];this.pos<e;)r.push(this.readFloat());return r},"readPackedFloat"),readPackedDouble:l(function(r){if(this.type!==Te.Bytes)return r.push(this.readDouble());var e=ur(this);for(r=r||[];this.pos<e;)r.push(this.readDouble());return r},"readPackedDouble"),readPackedFixed32:l(function(r){if(this.type!==Te.Bytes)return r.push(this.readFixed32());var e=ur(this);for(r=r||[];this.pos<e;)r.push(this.readFixed32());return r},"readPackedFixed32"),readPackedSFixed32:l(function(r){if(this.type!==Te.Bytes)return r.push(this.readSFixed32());var e=ur(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed32());return r},"readPackedSFixed32"),readPackedFixed64:l(function(r){if(this.type!==Te.Bytes)return r.push(this.readFixed64());var e=ur(this);for(r=r||[];this.pos<e;)r.push(this.readFixed64());return r},"readPackedFixed64"),readPackedSFixed64:l(function(r){if(this.type!==Te.Bytes)return r.push(this.readSFixed64());var e=ur(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed64());return r},"readPackedSFixed64"),skip:l(function(r){var e=r&7;if(e===Te.Varint)for(;this.buf[this.pos++]>127;);else if(e===Te.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Te.Fixed32)this.pos+=4;else if(e===Te.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},"skip"),writeTag:l(function(r,e){this.writeVarint(r<<3|e)},"writeTag"),realloc:l(function(r){for(var e=this.length||16;e<this.pos+r;)e*=2;if(e!==this.length){var t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.length=e}},"realloc"),finish:l(function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},"finish"),writeFixed32:l(function(r){this.realloc(4),fn(this.buf,r,this.pos),this.pos+=4},"writeFixed32"),writeSFixed32:l(function(r){this.realloc(4),fn(this.buf,r,this.pos),this.pos+=4},"writeSFixed32"),writeFixed64:l(function(r){this.realloc(8),fn(this.buf,r&-1,this.pos),fn(this.buf,Math.floor(r*P0),this.pos+4),this.pos+=8},"writeFixed64"),writeSFixed64:l(function(r){this.realloc(8),fn(this.buf,r&-1,this.pos),fn(this.buf,Math.floor(r*P0),this.pos+4),this.pos+=8},"writeSFixed64"),writeVarint:l(function(r){if(r=+r||0,r>268435455||r<0){gk(r,this);return}this.realloc(4),this.buf[this.pos++]=r&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=r>>>7&127)))},"writeVarint"),writeSVarint:l(function(r){this.writeVarint(r<0?-r*2-1:r*2)},"writeSVarint"),writeBoolean:l(function(r){this.writeVarint(!!r)},"writeBoolean"),writeString:l(function(r){r=String(r),this.realloc(r.length*4),this.pos++;var e=this.pos;this.pos=kk(this.buf,r,this.pos);var t=this.pos-e;t>=128&&T0(e,t,this),this.pos=e-1,this.writeVarint(t),this.pos+=t},"writeString"),writeFloat:l(function(r){this.realloc(4),Xl.write(this.buf,r,this.pos,!0,23,4),this.pos+=4},"writeFloat"),writeDouble:l(function(r){this.realloc(8),Xl.write(this.buf,r,this.pos,!0,52,8),this.pos+=8},"writeDouble"),writeBytes:l(function(r){var e=r.length;this.writeVarint(e),this.realloc(e);for(var t=0;t<e;t++)this.buf[this.pos++]=r[t]},"writeBytes"),writeRawMessage:l(function(r,e){this.pos++;var t=this.pos;r(e,this);var i=this.pos-t;i>=128&&T0(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},"writeRawMessage"),writeMessage:l(function(r,e,t){this.writeTag(r,Te.Bytes),this.writeRawMessage(e,t)},"writeMessage"),writePackedVarint:l(function(r,e){e.length&&this.writeMessage(r,_k,e)},"writePackedVarint"),writePackedSVarint:l(function(r,e){e.length&&this.writeMessage(r,vk,e)},"writePackedSVarint"),writePackedBoolean:l(function(r,e){e.length&&this.writeMessage(r,Pk,e)},"writePackedBoolean"),writePackedFloat:l(function(r,e){e.length&&this.writeMessage(r,wk,e)},"writePackedFloat"),writePackedDouble:l(function(r,e){e.length&&this.writeMessage(r,Sk,e)},"writePackedDouble"),writePackedFixed32:l(function(r,e){e.length&&this.writeMessage(r,Tk,e)},"writePackedFixed32"),writePackedSFixed32:l(function(r,e){e.length&&this.writeMessage(r,Mk,e)},"writePackedSFixed32"),writePackedFixed64:l(function(r,e){e.length&&this.writeMessage(r,Ak,e)},"writePackedFixed64"),writePackedSFixed64:l(function(r,e){e.length&&this.writeMessage(r,Ik,e)},"writePackedSFixed64"),writeBytesField:l(function(r,e){this.writeTag(r,Te.Bytes),this.writeBytes(e)},"writeBytesField"),writeFixed32Field:l(function(r,e){this.writeTag(r,Te.Fixed32),this.writeFixed32(e)},"writeFixed32Field"),writeSFixed32Field:l(function(r,e){this.writeTag(r,Te.Fixed32),this.writeSFixed32(e)},"writeSFixed32Field"),writeFixed64Field:l(function(r,e){this.writeTag(r,Te.Fixed64),this.writeFixed64(e)},"writeFixed64Field"),writeSFixed64Field:l(function(r,e){this.writeTag(r,Te.Fixed64),this.writeSFixed64(e)},"writeSFixed64Field"),writeVarintField:l(function(r,e){this.writeTag(r,Te.Varint),this.writeVarint(e)},"writeVarintField"),writeSVarintField:l(function(r,e){this.writeTag(r,Te.Varint),this.writeSVarint(e)},"writeSVarintField"),writeStringField:l(function(r,e){this.writeTag(r,Te.Bytes),this.writeString(e)},"writeStringField"),writeFloatField:l(function(r,e){this.writeTag(r,Te.Fixed32),this.writeFloat(e)},"writeFloatField"),writeDoubleField:l(function(r,e){this.writeTag(r,Te.Fixed64),this.writeDouble(e)},"writeDoubleField"),writeBooleanField:l(function(r,e){this.writeVarintField(r,!!e)},"writeBooleanField")};function yk(r,e,t){var i=t.buf,n,o;if(o=i[t.pos++],n=(o&112)>>4,o<128||(o=i[t.pos++],n|=(o&127)<<3,o<128)||(o=i[t.pos++],n|=(o&127)<<10,o<128)||(o=i[t.pos++],n|=(o&127)<<17,o<128)||(o=i[t.pos++],n|=(o&127)<<24,o<128)||(o=i[t.pos++],n|=(o&1)<<31,o<128))return hn(r,n,e);throw new Error("Expected varint not more than 10 bytes")}l(yk,"readVarintRemainder");function ur(r){return r.type===Te.Bytes?r.readVarint()+r.pos:r.pos+1}l(ur,"readPackedEnd");function hn(r,e,t){return t?e*4294967296+(r>>>0):(e>>>0)*4294967296+(r>>>0)}l(hn,"toNum");function gk(r,e){var t,i;if(r>=0?(t=r%4294967296|0,i=r/4294967296|0):(t=~(-r%4294967296),i=~(-r/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),xk(t,i,e),bk(i,e)}l(gk,"writeBigVarint");function xk(r,e,t){t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos]=r&127}l(xk,"writeBigVarintLow");function bk(r,e){var t=(r&7)<<4;e.buf[e.pos++]|=t|((r>>>=3)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127)))))}l(bk,"writeBigVarintHigh");function T0(r,e,t){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(var n=t.pos-1;n>=r;n--)t.buf[n+i]=t.buf[n]}l(T0,"makeRoomForExtraLength");function _k(r,e){for(var t=0;t<r.length;t++)e.writeVarint(r[t])}l(_k,"writePackedVarint");function vk(r,e){for(var t=0;t<r.length;t++)e.writeSVarint(r[t])}l(vk,"writePackedSVarint");function wk(r,e){for(var t=0;t<r.length;t++)e.writeFloat(r[t])}l(wk,"writePackedFloat");function Sk(r,e){for(var t=0;t<r.length;t++)e.writeDouble(r[t])}l(Sk,"writePackedDouble");function Pk(r,e){for(var t=0;t<r.length;t++)e.writeBoolean(r[t])}l(Pk,"writePackedBoolean");function Tk(r,e){for(var t=0;t<r.length;t++)e.writeFixed32(r[t])}l(Tk,"writePackedFixed32");function Mk(r,e){for(var t=0;t<r.length;t++)e.writeSFixed32(r[t])}l(Mk,"writePackedSFixed32");function Ak(r,e){for(var t=0;t<r.length;t++)e.writeFixed64(r[t])}l(Ak,"writePackedFixed64");function Ik(r,e){for(var t=0;t<r.length;t++)e.writeSFixed64(r[t])}l(Ik,"writePackedSFixed64");function Kl(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+r[e+3]*16777216}l(Kl,"readUInt32");function fn(r,e,t){r[t]=e,r[t+1]=e>>>8,r[t+2]=e>>>16,r[t+3]=e>>>24}l(fn,"writeInt32");function M0(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+(r[e+3]<<24)}l(M0,"readInt32");function Ck(r,e,t){for(var i="",n=e;n<t;){var o=r[n],a=null,s=o>239?4:o>223?3:o>191?2:1;if(n+s>t)break;var u,c,p;s===1?o<128&&(a=o):s===2?(u=r[n+1],(u&192)===128&&(a=(o&31)<<6|u&63,a<=127&&(a=null))):s===3?(u=r[n+1],c=r[n+2],(u&192)===128&&(c&192)===128&&(a=(o&15)<<12|(u&63)<<6|c&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(u=r[n+1],c=r[n+2],p=r[n+3],(u&192)===128&&(c&192)===128&&(p&192)===128&&(a=(o&15)<<18|(u&63)<<12|(c&63)<<6|p&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,i+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),i+=String.fromCharCode(a),n+=s}return i}l(Ck,"readUtf8");function Ek(r,e,t){return A0.decode(r.subarray(e,t))}l(Ek,"readUtf8TextDecoder");function kk(r,e,t){for(var i=0,n,o;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(o)if(n<56320){r[t++]=239,r[t++]=191,r[t++]=189,o=n;continue}else n=o-55296<<10|n-56320|65536,o=null;else{n>56319||i+1===e.length?(r[t++]=239,r[t++]=191,r[t++]=189):o=n;continue}else o&&(r[t++]=239,r[t++]=191,r[t++]=189,o=null);n<128?r[t++]=n:(n<2048?r[t++]=n>>6|192:(n<65536?r[t++]=n>>12|224:(r[t++]=n>>18|240,r[t++]=n>>12&63|128),r[t++]=n>>6&63|128),r[t++]=n&63|128)}return t}l(kk,"writeUtf8")});d();var ts={name:"@packages/outdoor-context-v4",version:"6.0.1-beta.51",private:!0,main:"dist/maplibre-gl.js",style:"dist/maplibre-gl.css",license:"BSD-3-Clause",homepage:"https://maplibre.org/",funding:"https://github.com/maplibre/maplibre-gl-js?sponsor=1",bugs:{url:"https://github.com/maplibre/maplibre-gl-js/issues/"},repository:{type:"git",url:"git://github.com/maplibre/maplibre-gl-js.git"},types:"dist/maplibre-gl.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":"^20.1.1","@types/geojson":"^7946.0.14","@types/geojson-vt":"3.2.5","@types/junit-report-builder":"^3.0.2","@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:"^2.2.4","geojson-vt":"^3.2.1","gl-matrix":"^3.4.3","global-prefix":"^3.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.2.1",potpack:"^2.0.0",quickselect:"^2.0.0",supercluster:"^8.0.1",tinyqueue:"^2.0.3","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.2.3","@mapbox/mvt-fixtures":"^3.10.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-replace":"^5.0.5","@rollup/plugin-strip":"^3.0.4","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/benchmark":"^2.1.5","@types/cssnano":"^5.0.0","@types/d3":"^7.4.3","@types/diff":"^5.2.0","@types/earcut":"^2.1.4","@types/eslint":"^8.56.7","@types/gl":"^6.0.5","@types/glob":"^8.1.0","@types/jest":"^29.5.12","@types/jsdom":"^21.1.6","@types/minimist":"^1.2.5","@types/murmurhash-js":"^1.0.6","@types/nise":"^1.4.4","@types/node":"^20.12.7","@types/offscreencanvas":"^2019.7.3","@types/pixelmatch":"^5.2.6","@types/pngjs":"^6.0.4","@types/react":"^18.2.79","@types/react-dom":"^18.2.25","@types/request":"^2.48.12","@types/shuffle-seed":"^1.1.3","@types/window-or-global":"^1.0.6","@typescript-eslint/eslint-plugin":"^7.7.1","@typescript-eslint/parser":"^7.7.1",address:"^2.0.2",benchmark:"^2.1.4",canvas:"^2.11.2",cssnano:"^6.1.2",d3:"^7.9.0","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1291694",diff:"^5.2.0","dts-bundle-generator":"^9.5.1",eslint:"^8.57.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^8.1.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.2.0","eslint-plugin-react":"^7.34.1","eslint-plugin-tsdoc":"0.2.17",expect:"^29.7.0",glob:"^10.3.12","is-builtin-module":"^3.2.1",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0","jest-junit":"^16.0.0","jest-monocart-coverage":"^1.1.0","jest-webgl-canvas-mock":"^2.5.3",jsdom:"^24.0.0","json-stringify-pretty-compact":"^4.0.0","junit-report-builder":"^3.2.1",minimist:"^1.2.8","mock-geolocation":"^1.0.11","monocart-coverage-reports":"^2.7.9",nise:"^5.1.9","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5","pdf-merger-js":"^5.1.1",pixelmatch:"^5.3.0",pngjs:"^7.0.0",postcss:"^8.4.38","postcss-cli":"^11.0.0","postcss-inline-svg":"^6.0.0","pretty-bytes":"^6.1.1",puppeteer:"^22.7.0",react:"^18.2.0","react-dom":"^18.2.0",rollup:"^4.16.4","rollup-plugin-sourcemaps":"^0.6.3",rw:"^1.3.3",semver:"^7.6.0","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.0",stylelint:"^16.4.0","stylelint-config-standard":"^36.0.0","ts-jest":"^29.1.2","ts-node":"^10.9.2",tslib:"^2.6.2",typedoc:"^0.25.13","typedoc-plugin-markdown":"^3.17.1","typedoc-plugin-missing-exports":"^2.2.0",typescript:"^5.4.5"},overrides:{"postcss-inline-svg":{"css-select":"^5.1.0","dom-serializer":"^2.0.0",htmlparser2:"^8.0.1","postcss-value-parser":"^4.2.0"}},scripts:{build:"tsc -b","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/maplibre-gl.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 build-dev && npm run build-csp-dev && npm run build-prod && npm run build-csp","build-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev","watch-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch","build-prod":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production","build-csp":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts","build-csp-dev":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts --environment BUILD:dev","build-css":"postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css","watch-css":"postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-benchmarks":"npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts","watch-benchmarks":"rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch","start-server":"st --no-cache -H 0.0.0.0 --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 --cache --ext .ts,.tsx,.js,.html --ignore-path .gitignore .","lint-css":"stylelint src/css/maplibre-gl.css",test:"run-p lint lint-css test-render jest",jest:"jest","test-build":"jest --selectProjects=build --reporters=default","test-build-ci":"jest --selectProjects=build","test-integration":"jest --selectProjects=integration --reporters=default","test-integration-ci":"jest --selectProjects=integration","test-render":"node --no-warnings --loader ts-node/esm test/integration/render/run_render_tests.ts","test-unit":"jest --selectProjects=unit --reporters=default","test-unit-ci":"jest --coverage --selectProjects unit","test-watch-roots":"jest --watch",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:backup":"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0"}};d();d();var Wx=ae(ge(),1),Xx=ae(Zx(),1);d();d();var bp;function rs(){return bp==null&&(bp=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),bp}l(rs,"offscreenCanvasSupported");var is;function _p(){if(is==null&&(is=!1,rs())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let n=0;n<5*5;n++){let o=n*4;t.fillStyle="rgb(".concat(o,",").concat(o+1,",").concat(o+2,")"),t.fillRect(n%5,Math.floor(n/5),1,1)}let i=t.getImageData(0,0,5,5).data;for(let n=0;n<5*5*4;n++)if(n%4!==3&&i[n]!==n){is=!0;break}}}return is||!1}l(_p,"isOffscreenCanvasDistorted");function Kx(r){if(r<=0)return 0;if(r>=1)return 1;let e=r*r,t=e*r;return 4*(r<.5?t:3*(r-e)+t-.75)}l(Kx,"easeCubicInOut");function kn(r,e,t,i){let n=new Xx.default(r,e,t,i);return function(o){return n.solve(o)}}l(kn,"bezier");var Ln=kn(.25,.1,.25,1);function Ae(r,e,t){return Math.min(t,Math.max(e,r))}l(Ae,"clamp");function er(r,e,t){let i=t-e,n=((r-e)%i+i)%i+e;return n===e?t:n}l(er,"wrap");function Jx(r,e){let t=[];for(let i in r)i in e||t.push(i);return t}l(Jx,"keysDifference");function V(r,...e){for(let t of e)for(let i in t)r[i]=t[i];return r}l(V,"extend");function yr(r,e){let t={};for(let i=0;i<e.length;i++){let n=e[i];n in r&&(t[n]=r[n])}return t}l(yr,"pick");var w2=1;function ns(){return w2++}l(ns,"uniqueId");function Yx(r){return Math.log(r)/Math.LN2%1===0}l(Yx,"isPowerOfTwo");function Qx(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}l(Qx,"nextPowerOfTwo");function Dn(r,e,t){let i={};for(let n in r)i[n]=e.call(t||this,r[n],n,r);return i}l(Dn,"mapObject");function os(r,e,t){let i={};for(let n in r)e.call(t||this,r[n],n,r)&&(i[n]=r[n]);return i}l(os,"filterObject");function Qt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Qt(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let i in r)if(!Qt(r[i],e[i]))return!1;return!0}return r===e}l(Qt,"deepEqual");function pt(r){return Array.isArray(r)?r.map(pt):typeof r=="object"&&r?Dn(r,pt):r}l(pt,"clone");function eb(r,e){for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>=0)return!0;return!1}l(eb,"arraysIntersect");var Hx={};function Le(r){Hx[r]||(typeof console<"u"&&console.warn(r),Hx[r]=!0)}l(Le,"warnOnce");function tr(r,e,t){return(t.y-r.y)*(e.x-r.x)>(e.y-r.y)*(t.x-r.x)}l(tr,"isCounterClockwise");function tb(r,e,t,i){let n=e.y-r.y,o=e.x-r.x,a=i.y-t.y,s=i.x-t.x,u=a*o-s*n;if(u===0)return null;let c=r.y-t.y,p=r.x-t.x,h=(s*c-a*p)/u;return new Wx.default(r.x+h*o,r.y+h*n)}l(tb,"findLineIntersection");function rb(r){let e=0;for(let t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}l(rb,"calculateSignedArea");function ib([r,e,t]){return e+=90,e*=Math.PI/180,t*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(t),y:r*Math.sin(e)*Math.sin(t),z:r*Math.cos(t)}}l(ib,"sphericalToCartesian");function rr(r){return typeof WorkerGlobalScope<"u"&&typeof r<"u"&&r instanceof WorkerGlobalScope}l(rr,"isWorker");function nb(r){let e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,t={};if(r.replace(e,(i,n,o,a)=>{let s=o||a;return t[n]=s?s.toLowerCase():!0,""}),t["max-age"]){let i=parseInt(t["max-age"],10);isNaN(i)?delete t["max-age"]:t["max-age"]=i}return t}l(nb,"parseCacheControl");var vp=null;function ob(r){if(vp==null){let e=r.navigator?r.navigator.userAgent:null;vp=!!r.safari||!!(e&&(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return vp}l(ob,"isSafari");function ht(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}l(ht,"isImageBitmap");var ab=l(async r=>{if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));let e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error("Could not load image because of ".concat(t.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}},"arrayBufferToImageBitmap"),$x="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",sb=l(r=>new Promise((e,t)=>{let i=new Image;i.onload=()=>{e(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=$x})},i.onerror=()=>t(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(r)],{type:"image/png"});i.src=r.byteLength?URL.createObjectURL(n):$x}),"arrayBufferToImage");function S2(r,e,t,i,n){let o=Math.max(-e,0)*4,u=(Math.max(0,t)-t)*i*4+o,c=i*4,p=Math.max(0,e),h=Math.max(0,t),f=Math.min(r.width,e+i),m=Math.min(r.height,t+n);return{rect:{x:p,y:h,width:f-p,height:m-h},layout:[{offset:u,stride:c}]}}l(S2,"computeVideoFrameParameters");async function lb(r,e,t,i,n){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(r,{timestamp:0});try{let a=o==null?void 0:o.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error("Unrecognized format ".concat(a));let s=a.startsWith("BGR"),u=new Uint8ClampedArray(i*n*4);if(await o.copyTo(u,S2(r,e,t,i,n)),s)for(let c=0;c<u.length;c+=4){let p=u[c];u[c]=u[c+2],u[c+2]=p}return u}finally{o.close()}}l(lb,"readImageUsingVideoFrame");function ub(r,e,t,i){return r.addEventListener(e,t,i),{unsubscribe:l(()=>{r.removeEventListener(e,t,i)},"unsubscribe")}}l(ub,"subscribe");function wp(r){return r*Math.PI/180}l(wp,"degreesToRadians");d();d();var P2="AbortError";function Hr(){return new Error(P2)}l(Hr,"createAbortError");var T2=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),as,Sp,Y={now:T2,frameAsync(r){return new Promise((e,t)=>{let i=requestAnimationFrame(e);r.signal.addEventListener("abort",()=>{cancelAnimationFrame(i),t(Hr())})})},getImageData(r,e=0){return this.getImageCanvasContext(r).getImageData(-e,-e,r.width+2*e,r.height+2*e)},getImageCanvasContext(r){let e=window.document.createElement("canvas"),t=e.getContext("2d",{willReadFrequently:!0});if(!t)throw new Error("failed to create canvas 2d context");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0,r.width,r.height),t},resolveURL(r){return as||(as=document.createElement("a")),as.href=r,as.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Sp==null&&(Sp=matchMedia("(prefers-reduced-motion: reduce)")),Sp.matches):!1}};d();var cb=ae(ge(),1);var Ie=class Ie{static testProp(e){if(!Ie.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in Ie.docStyle)return e[t];return e[0]}static create(e,t,i){let n=window.document.createElement(e);return t!==void 0&&(n.className=t),i&&i.appendChild(n),n}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){Ie.docStyle&&Ie.selectProp&&(Ie.userSelect=Ie.docStyle[Ie.selectProp],Ie.docStyle[Ie.selectProp]="none")}static enableDrag(){Ie.docStyle&&Ie.selectProp&&(Ie.docStyle[Ie.selectProp]=Ie.userSelect)}static setTransform(e,t){e.style[Ie.transformProp]=t}static addEventListener(e,t,i,n={}){"passive"in n?e.addEventListener(t,i,n):e.addEventListener(t,i,n.capture)}static removeEventListener(e,t,i,n={}){"passive"in n?e.removeEventListener(t,i,n):e.removeEventListener(t,i,n.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",Ie.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Ie.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Ie.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,i){let n=t.boundingClientRect;return new cb.default((i.clientX-n.left)/t.x-e.clientLeft,(i.clientY-n.top)/t.y-e.clientTop)}static mousePos(e,t){let i=Ie.getScale(e);return Ie.getPoint(e,i,t)}static touchPos(e,t){let i=[],n=Ie.getScale(e);for(let o=0;o<t.length;o++)i.push(Ie.getPoint(e,n,t[o]));return i}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}};l(Ie,"DOM"),Ie.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Ie.selectProp=Ie.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Ie.transformProp=Ie.testProp(["transform","WebkitTransform"]);var D=Ie;d();d();d();var Ke={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ss(r){return Ke.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}l(ss,"getProtocol");function M2(r,e){Ke.REGISTERED_PROTOCOLS[r]=e}l(M2,"addProtocol");function A2(r){delete Ke.REGISTERED_PROTOCOLS[r]}l(A2,"removeProtocol");d();var ls="global-dispatcher",Tp=class Tp extends Error{constructor(e,t,i,n){super("AJAXError: ".concat(t," (").concat(e,"): ").concat(i)),this.status=e,this.statusText=t,this.url=i,this.body=n}};l(Tp,"AJAXError");var $r=Tp,us=l(()=>rr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,"getReferrer"),I2=l(r=>/^file:/.test(r)||/^file:/.test(us())&&!/^\w+:/.test(r),"isFileURL");async function C2(r,e){let t=new Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,cache:r.cache,referrer:us(),signal:e.signal});r.type==="json"&&t.headers.set("Accept","application/json");let i=await fetch(t);if(!i.ok){let a=await i.blob();throw new $r(i.status,i.statusText,r.url,a)}let n;r.type==="arrayBuffer"||r.type==="image"?n=i.arrayBuffer():r.type==="json"?n=i.json():n=i.text();let o=await n;if(e.signal.aborted)throw Hr();return{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}}l(C2,"makeFetchRequest");function E2(r,e){return new Promise((t,i)=>{let n=new XMLHttpRequest;n.open(r.method||"GET",r.url,!0),(r.type==="arrayBuffer"||r.type==="image")&&(n.responseType="arraybuffer");for(let o in r.headers)n.setRequestHeader(o,r.headers[o]);r.type==="json"&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials=r.credentials==="include",n.onerror=()=>{i(new Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let o=n.response;if(r.type==="json")try{o=JSON.parse(n.response)}catch(a){i(a);return}t({data:o,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let o=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new $r(n.status,n.statusText,r.url,o))}},e.signal.addEventListener("abort",()=>{n.abort(),i(Hr())}),n.send(r.body)})}l(E2,"makeXMLHttpRequest");var ki=l(function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){let t=ss(r.url);if(t)return t(r,e);if(rr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:ls},e)}if(!I2(r.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return C2(r,e);if(rr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:ls},e)}return E2(r,e)},"makeRequest"),gr=l((r,e)=>ki(V(r,{type:"json"}),e),"getJSON"),pb=l((r,e)=>ki(V(r,{type:"arrayBuffer"}),e),"getArrayBuffer");function Pp(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;let e=new URL(r),t=window.location;return e.protocol===t.protocol&&e.host===t.host}l(Pp,"sameOrigin");var hb=l(r=>{let e=window.document.createElement("video");return e.muted=!0,new Promise(t=>{e.onloadstart=()=>{t(e)};for(let i of r){let n=window.document.createElement("source");Pp(i)||(e.crossOrigin="Anonymous"),n.src=i,e.appendChild(n)}})},"getVideo");d();d();var Fn={supported:!1,testSupport:k2},zn,Mp=!1,Li,fb=!1;typeof document<"u"&&(Li=document.createElement("img"),Li.onload=function(){zn&&mb(zn),zn=null,fb=!0},Li.onerror=function(){Mp=!0,zn=null},Li.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function k2(r){Mp||!Li||(fb?mb(r):zn=r)}l(k2,"testSupport");function mb(r){let e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,Li),r.isContextLost())return;Fn.supported=!0}catch(t){}r.deleteTexture(e),Mp=!0}l(mb,"testWebpTextureUpload");var st;(m=>{let r,e,t,i;m.resetRequestQueue=l(()=>{r=[],e=0,t=0,i={}},"resetRequestQueue"),m.addThrottleControl=l(y=>{let g=t++;return i[g]=y,g},"addThrottleControl"),m.removeThrottleControl=l(y=>{delete i[y],h()},"removeThrottleControl");let s=l(()=>{for(let y of Object.keys(i))if(i[y]())return!0;return!1},"isThrottled");m.getImage=l((y,g,x=!0)=>new Promise((b,w)=>{Fn.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*"),V(y,{type:"image"});let _={abortController:g,requestParameters:y,supportImageRefresh:x,state:"queued",onError:l(S=>{w(S)},"onError"),onSuccess:l(S=>{b(S)},"onSuccess")};r.push(_),h()}),"getImage");let c=l(y=>typeof createImageBitmap=="function"?ab(y):sb(y),"arrayBufferToCanvasImageSource"),p=l(async y=>{y.state="running";let{requestParameters:g,supportImageRefresh:x,onError:b,onSuccess:w,abortController:_}=y,S=x===!1&&!rr(self)&&!ss(g.url)&&(!g.headers||Object.keys(g.headers).reduce((T,L)=>T&&L==="accept",!0));e++;let P=S?f(g,_):ki(g,_);try{let T=await P;if(delete y.abortController,y.state="completed",T.data instanceof HTMLImageElement||ht(T.data))w(T);else if(T.data){let L=await c(T.data);w({data:L,cacheControl:T.cacheControl,expires:T.expires})}}catch(T){delete y.abortController,b(T)}finally{e--,h()}},"doImageRequest"),h=l(()=>{let y=s()?Ke.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Ke.MAX_PARALLEL_IMAGE_REQUESTS;for(let g=e;g<y&&r.length>0;g++){let x=r.shift();if(x.abortController.signal.aborted){g--;continue}p(x)}},"processQueue"),f=l((y,g)=>new Promise((x,b)=>{let w=new Image,_=y.url,S=y.credentials;S&&S==="include"?w.crossOrigin="use-credentials":(S&&S==="same-origin"||!Pp(_))&&(w.crossOrigin="anonymous"),g.signal.addEventListener("abort",()=>{w.src="",b(Hr())}),w.fetchPriority="high",w.onload=()=>{w.onerror=w.onload=null,x({data:w})},w.onerror=()=>{w.onerror=w.onload=null,!g.signal.aborted&&b(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."))},w.src=_}),"getImageUsingHtmlImage")})(st||(st={}));st.resetRequestQueue();d();var Ap=class Ap{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn?this._transformRequestFn(e,t)||{url:e}:{url:e}}normalizeSpriteURL(e,t,i){let n=D2(e);return n.path+="".concat(t).concat(i),z2(n)}setTransformRequest(e){this._transformRequestFn=e}};l(Ap,"RequestManager");var cs=Ap,L2=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function D2(r){let e=r.match(L2);if(!e)throw new Error('Unable to parse URL "'.concat(r,'"'));return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}l(D2,"parseUrl");function z2(r){let e=r.params.length?"?".concat(r.params.join("&")):"";return"".concat(r.protocol,"://").concat(r.authority).concat(r.path).concat(e)}l(z2,"formatUrl");d();d();function db(r,e,t){t[r]&&t[r].indexOf(e)!==-1||(t[r]=t[r]||[],t[r].push(e))}l(db,"_addEventListener");function Ip(r,e,t){if(t&&t[r]){let i=t[r].indexOf(e);i!==-1&&t[r].splice(i,1)}}l(Ip,"_removeEventListener");var Cp=class Cp{constructor(e,t={}){V(this,t),this.type=e}};l(Cp,"Event");var F=Cp,Ep=class Ep extends F{constructor(e,t={}){super("error",V({error:e},t))}};l(Ep,"ErrorEvent");var H=Ep,kp=class kp{on(e,t){return this._listeners=this._listeners||{},db(e,t,this._listeners),this}off(e,t){return Ip(e,t,this._listeners),Ip(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},db(e,t,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t){typeof e=="string"&&(e=new F(e,t||{}));let i=e.type;if(this.listens(i)){e.target=this;let n=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(let s of n)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(let s of o)Ip(i,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(V(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof H&&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}};l(kp,"Evented");var de=kp;d();d();d();d();var F2=8,R2={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"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"},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"}},B2={"*":{type:"source"}},O2=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],V2={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:"*"}},U2={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:"*"}},N2={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:"*"}},G2={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"}},q2={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"}}},j2={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"}}},Z2={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},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"}},H2=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],$2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},W2={"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"}},X2={"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"}},K2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},J2={"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"}},Y2={"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"}},Q2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eP={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},tP={type:"array",value:"*"},rP={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},iP={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},nP={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},oP={type:"array",value:"*",minimum:1},aP={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}},sP={"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}},lP={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},uP={type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},cP=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],pP={"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"}},hP={"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"}},fP={"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"}},mP={"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"}},dP={"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"}},yP={"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"}},gP={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},xP={"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"}},bP={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},_P={"*":{type:"string"}},A={$version:F2,$root:R2,sources:B2,source:O2,source_vector:V2,source_raster:U2,source_raster_dem:N2,source_geojson:G2,source_video:q2,source_image:j2,layer:Z2,layout:H2,layout_background:$2,layout_fill:W2,layout_circle:X2,layout_heatmap:K2,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:J2,layout_symbol:Y2,layout_raster:Q2,layout_hillshade:eP,filter:tP,filter_operator:rP,geometry_type:iP,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:nP,expression:oP,light:aP,sky:sP,terrain:lP,projection:uP,paint:cP,paint_fill:pP,"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:hP,paint_circle:fP,paint_heatmap:mP,paint_symbol:dP,paint_raster:yP,paint_hillshade:gP,paint_background:xP,transition:bP,"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:_P},vP=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function wP(r,e){let t={};for(let i in r)i!=="ref"&&(t[i]=r[i]);return vP.forEach(i=>{i in e&&(t[i]=e[i])}),t}l(wP,"deref");function ih(r){r=r.slice();let e=Object.create(null);for(let t=0;t<r.length;t++)e[r[t].id]=r[t];for(let t=0;t<r.length;t++)"ref"in r[t]&&(r[t]=wP(r[t],e[r[t].ref]));return r}l(ih,"derefLayers");function Ce(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Ce(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let i in r)if(!Ce(r[i],e[i]))return!1;return!0}return r===e}l(Ce,"deepEqual");function Mt(r,e){r.push(e)}l(Mt,"addCommand");function Vb(r,e,t){Mt(t,{command:"addSource",args:[r,e[r]]})}l(Vb,"addSource");function Ub(r,e,t){Mt(e,{command:"removeSource",args:[r]}),t[r]=!0}l(Ub,"removeSource");function SP(r,e,t,i){Ub(r,t,i),Vb(r,e,t)}l(SP,"updateSource");function PP(r,e,t){let i;for(i in r[t])if(Object.prototype.hasOwnProperty.call(r[t],i)&&i!=="data"&&!Ce(r[t][i],e[t][i]))return!1;for(i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)&&i!=="data"&&!Ce(r[t][i],e[t][i]))return!1;return!0}l(PP,"canUpdateGeoJSON");function TP(r,e,t,i){r=r||{},e=e||{};let n;for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(Object.prototype.hasOwnProperty.call(e,n)||Ub(n,t,i));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(r,n)?Ce(r[n],e[n])||(r[n].type==="geojson"&&e[n].type==="geojson"&&PP(r,e,n)?Mt(t,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):SP(n,e,t,i)):Vb(n,e,t))}l(TP,"diffSources");function ps(r,e,t,i,n,o){r=r||{},e=e||{};for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&(Ce(r[a],e[a])||t.push({command:o,args:[i,a,e[a],n]}));for(let a in e)!Object.prototype.hasOwnProperty.call(e,a)||Object.prototype.hasOwnProperty.call(r,a)||Ce(r[a],e[a])||t.push({command:o,args:[i,a,e[a],n]})}l(ps,"diffLayerPropertyChanges");function yb(r){return r.id}l(yb,"pluckId");function gb(r,e){return r[e.id]=e,r}l(gb,"indexById");function MP(r,e,t){r=r||[],e=e||[];let i=r.map(yb),n=e.map(yb),o=r.reduce(gb,{}),a=e.reduce(gb,{}),s=i.slice(),u=Object.create(null),c,p,h,f,m;for(let y=0,g=0;y<i.length;y++)c=i[y],Object.prototype.hasOwnProperty.call(a,c)?g++:(Mt(t,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,g),1));for(let y=0,g=0;y<n.length;y++)c=n[n.length-1-y],s[s.length-1-y]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(Mt(t,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-g),1)):g++,f=s[s.length-y],Mt(t,{command:"addLayer",args:[a[c],f]}),s.splice(s.length-y,0,c),u[c]=!0);for(let y=0;y<n.length;y++)if(c=n[y],p=o[c],h=a[c],!(u[c]||Ce(p,h))){if(!Ce(p.source,h.source)||!Ce(p["source-layer"],h["source-layer"])||!Ce(p.type,h.type)){Mt(t,{command:"removeLayer",args:[c]}),f=s[s.lastIndexOf(c)+1],Mt(t,{command:"addLayer",args:[h,f]});continue}ps(p.layout,h.layout,t,c,null,"setLayoutProperty"),ps(p.paint,h.paint,t,c,null,"setPaintProperty"),Ce(p.filter,h.filter)||Mt(t,{command:"setFilter",args:[c,h.filter]}),(!Ce(p.minzoom,h.minzoom)||!Ce(p.maxzoom,h.maxzoom))&&Mt(t,{command:"setLayerZoomRange",args:[c,h.minzoom,h.maxzoom]});for(m in p)Object.prototype.hasOwnProperty.call(p,m)&&(m==="layout"||m==="paint"||m==="filter"||m==="metadata"||m==="minzoom"||m==="maxzoom"||(m.indexOf("paint.")===0?ps(p[m],h[m],t,c,m.slice(6),"setPaintProperty"):Ce(p[m],h[m])||Mt(t,{command:"setLayerProperty",args:[c,m,h[m]]})));for(m in h)!Object.prototype.hasOwnProperty.call(h,m)||Object.prototype.hasOwnProperty.call(p,m)||m==="layout"||m==="paint"||m==="filter"||m==="metadata"||m==="minzoom"||m==="maxzoom"||(m.indexOf("paint.")===0?ps(p[m],h[m],t,c,m.slice(6),"setPaintProperty"):Ce(p[m],h[m])||Mt(t,{command:"setLayerProperty",args:[c,m,h[m]]}))}}l(MP,"diffLayers");function Nb(r,e){if(!r)return[{command:"setStyle",args:[e]}];let t=[];try{if(!Ce(r.version,e.version))return[{command:"setStyle",args:[e]}];Ce(r.center,e.center)||t.push({command:"setCenter",args:[e.center]}),Ce(r.zoom,e.zoom)||t.push({command:"setZoom",args:[e.zoom]}),Ce(r.bearing,e.bearing)||t.push({command:"setBearing",args:[e.bearing]}),Ce(r.pitch,e.pitch)||t.push({command:"setPitch",args:[e.pitch]}),Ce(r.roll,e.roll)||t.push({command:"setRoll",args:[e.roll]}),Ce(r.sprite,e.sprite)||t.push({command:"setSprite",args:[e.sprite]}),Ce(r.glyphs,e.glyphs)||t.push({command:"setGlyphs",args:[e.glyphs]}),Ce(r.transition,e.transition)||t.push({command:"setTransition",args:[e.transition]}),Ce(r.light,e.light)||t.push({command:"setLight",args:[e.light]}),Ce(r.terrain,e.terrain)||t.push({command:"setTerrain",args:[e.terrain]}),Ce(r.sky,e.sky)||t.push({command:"setSky",args:[e.sky]}),Ce(r.projection,e.projection)||t.push({command:"setProjection",args:[e.projection]});let i={},n=[];TP(r.sources,e.sources,n,i);let o=[];r.layers&&r.layers.forEach(a=>{"source"in a&&i[a.source]?t.push({command:"removeLayer",args:[a.id]}):o.push(a)}),t=t.concat(n),MP(o,e.layers,t)}catch(i){console.warn("Unable to compute style diff:",i),t=[{command:"setStyle",args:[e]}]}return t}l(Nb,"diffStyles");var dh=class dh{constructor(e,t,i,n){this.message=(e?"".concat(e,": "):"")+i,n&&(this.identifier=n),t!=null&&t.__line__&&(this.line=t.__line__)}};l(dh,"ValidationError");var B=dh;function Ni(r,...e){for(let t of e)for(let i in t)r[i]=t[i];return r}l(Ni,"extendBy");var yh=class yh extends Error{constructor(e,t){super(t),this.message=t,this.key=e}};l(yh,"ExpressionParsingError");var At=yh,Es=class Es{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[i,n]of t)this.bindings[i]=n}concat(e){return new Es(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}};l(Es,"Scope");var Np=Es,ji={kind:"null"},j={kind:"number"},pe={kind:"string"},se={kind:"boolean"},Ct={kind:"color"},Vi={kind:"object"},le={kind:"value"},AP={kind:"error"},Xs={kind:"collator"},Zi={kind:"formatted"},Ks={kind:"padding"},no={kind:"resolvedImage"},Js={kind:"variableAnchorOffsetCollection"};function _t(r,e){return{kind:"array",itemType:r,N:e}}l(_t,"array$1");function Re(r){if(r.kind==="array"){let e=Re(r.itemType);return typeof r.N=="number"?"array<".concat(e,", ").concat(r.N,">"):r.itemType.kind==="value"?"array":"array<".concat(e,">")}else return r.kind}l(Re,"toString$1");var IP=[ji,j,pe,se,Ct,Zi,Vi,_t(le),Ks,no,Js];function Hn(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Hn(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(let t of IP)if(!Hn(t,e))return null}}return"Expected ".concat(Re(r)," but found ").concat(Re(e)," instead.")}l(Hn,"checkSubtype");function nh(r,e){return e.some(t=>t.kind===r.kind)}l(nh,"isValidType");function Yr(r,e){return e.some(t=>t==="null"?r===null:t==="array"?Array.isArray(r):t==="object"?r&&!Array.isArray(r)&&typeof r=="object":t===typeof r)}l(Yr,"isValidNativeType");function Rn(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}l(Rn,"verifyType");var Gb=.96422,qb=1,jb=.82521,Zb=4/29,Ui=6/29,Hb=3*Ui*Ui,CP=Ui*Ui*Ui,EP=Math.PI/180,kP=180/Math.PI;function $b(r){return r=r%360,r<0&&(r+=360),r}l($b,"constrainAngle");function Wb([r,e,t,i]){r=Lp(r),e=Lp(e),t=Lp(t);let n,o,a=Dp((.2225045*r+.7168786*e+.0606169*t)/qb);r===e&&e===t?n=o=a:(n=Dp((.4360747*r+.3850649*e+.1430804*t)/Gb),o=Dp((.0139322*r+.0971045*e+.7141733*t)/jb));let s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),i]}l(Wb,"rgbToLab");function Lp(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}l(Lp,"rgb2xyz");function Dp(r){return r>CP?Math.pow(r,1/3):r/Hb+Zb}l(Dp,"xyz2lab");function Xb([r,e,t,i]){let n=(r+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(t)?n:n-t/200;return n=qb*Fp(n),o=Gb*Fp(o),a=jb*Fp(a),[zp(3.1338561*o-1.6168667*n-.4906146*a),zp(-.9787684*o+1.9161415*n+.033454*a),zp(.0719453*o-.2289914*n+1.4052427*a),i]}l(Xb,"labToRgb");function zp(r){return r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055,r<0?0:r>1?1:r}l(zp,"xyz2rgb");function Fp(r){return r>Ui?r*r*r:Hb*(r-Zb)}l(Fp,"lab2xyz");function LP(r){let[e,t,i,n]=Wb(r),o=Math.sqrt(t*t+i*i);return[Math.round(o*1e4)?$b(Math.atan2(i,t)*kP):NaN,o,e,n]}l(LP,"rgbToHcl");function DP([r,e,t,i]){return r=isNaN(r)?0:r*EP,Xb([t,Math.cos(r)*e,Math.sin(r)*e,i])}l(DP,"hclToRgb");function zP([r,e,t,i]){r=$b(r),e/=100,t/=100;function n(o){let a=(o+r/30)%12,s=e*Math.min(t,1-t);return t-s*Math.max(-1,Math.min(a-3,9-a,1))}return l(n,"f"),[n(0),n(8),n(4),i]}l(zP,"hslToRgb");function FP(r){if(r=r.toLowerCase().trim(),r==="transparent")return[0,0,0,0];let e=RP[r];if(e){let[n,o,a]=e;return[n/255,o/255,a/255,1]}if(r.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(r)){let o=r.length<6?1:2,a=1;return[hs(r.slice(a,a+=o)),hs(r.slice(a,a+=o)),hs(r.slice(a,a+=o)),hs(r.slice(a,a+o)||"ff")]}if(r.startsWith("rgb")){let n=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=r.match(n);if(o){let[a,s,u,c,p,h,f,m,y,g,x,b]=o,w=[c||" ",f||" ",g].join("");if(w===" "||w===" /"||w===",,"||w===",,,"){let _=[u,h,y].join(""),S=_==="%%%"?100:_===""?255:0;if(S){let P=[Di(+s/S,0,1),Di(+p/S,0,1),Di(+m/S,0,1),x?xb(+x,b):1];if(bb(P))return P}}return}}let t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=r.match(t);if(i){let[n,o,a,s,u,c,p,h,f]=i,m=[a||" ",u||" ",p].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let y=[+o,Di(+s,0,100),Di(+c,0,100),h?xb(+h,f):1];if(bb(y))return zP(y)}}}l(FP,"parseCssColor");function hs(r){return parseInt(r.padEnd(2,r),16)/255}l(hs,"parseHex");function xb(r,e){return Di(e?r/100:r,0,1)}l(xb,"parseAlpha");function Di(r,e,t){return Math.min(Math.max(e,r),t)}l(Di,"clamp");function bb(r){return!r.some(Number.isNaN)}l(bb,"validateNumbers");var RP={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]},Un=class Un{constructor(e,t,i,n=1,o=!0){this.r=e,this.g=t,this.b=i,this.a=n,o||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,t,i,n]))}static parse(e){if(e instanceof Un)return e;if(typeof e!="string")return;let t=FP(e);if(t)return new Un(...t,!1)}get rgb(){let{r:e,g:t,b:i,a:n}=this,o=n||1/0;return this.overwriteGetter("rgb",[e/o,t/o,i/o,n])}get hcl(){return this.overwriteGetter("hcl",LP(this.rgb))}get lab(){return this.overwriteGetter("lab",Wb(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,i,n]=this.rgb;return"rgba(".concat([e,t,i].map(o=>Math.round(o*255)).join(","),",").concat(n,")")}};l(Un,"Color");var X=Un;X.black=new X(0,0,0,1);X.white=new X(1,1,1,1);X.transparent=new X(0,0,0,0);X.red=new X(1,0,0,1);var gh=class gh{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}};l(gh,"Collator");var $n=gh,xh=class xh{constructor(e,t,i,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=n,this.textColor=o}};l(xh,"FormattedSection");var Wn=xh,Fi=class Fi{constructor(e){this.sections=e}static fromString(e){return new Fi([new Wn(e,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 Fi?e:Fi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}};l(Fi,"Formatted");var wt=Fi,Ri=class Ri{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ri)return e;if(typeof e=="number")return new Ri([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!="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 Ri(e)}}toString(){return JSON.stringify(this.values)}};l(Ri,"Padding");var Rt=Ri,BP=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Nn=class Nn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Nn)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){let i=e[t],n=e[t+1];if(typeof i!="string"||!BP.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new Nn(e)}}toString(){return JSON.stringify(this.values)}};l(Nn,"VariableAnchorOffsetCollection");var ir=Nn,ks=class ks{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ks({name:e,available:!1}):null}};l(ks,"ResolvedImage");var ft=ks;function Kb(r,e,t,i){if(!(typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255)){let n=typeof i=="number"?[r,e,t,i]:[r,e,t];return"Invalid rgba value [".concat(n.join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}return typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:"Invalid rgba value [".concat([r,e,t,i].join(", "),"]: 'a' must be between 0 and 1.")}l(Kb,"validateRGBA");function Xn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof X||r instanceof $n||r instanceof wt||r instanceof Rt||r instanceof ir||r instanceof ft)return!0;if(Array.isArray(r)){for(let e of r)if(!Xn(e))return!1;return!0}else if(typeof r=="object"){for(let e in r)if(!Xn(r[e]))return!1;return!0}else return!1}l(Xn,"isValue");function He(r){if(r===null)return ji;if(typeof r=="string")return pe;if(typeof r=="boolean")return se;if(typeof r=="number")return j;if(r instanceof X)return Ct;if(r instanceof $n)return Xs;if(r instanceof wt)return Zi;if(r instanceof Rt)return Ks;if(r instanceof ir)return Js;if(r instanceof ft)return no;if(Array.isArray(r)){let e=r.length,t;for(let i of r){let n=He(i);if(!t)t=n;else{if(t===n)continue;t=le;break}}return _t(t||le,e)}else return Vi}l(He,"typeOf");function On(r){let e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof X||r instanceof wt||r instanceof Rt||r instanceof ir||r instanceof ft?r.toString():JSON.stringify(r)}l(On,"toString");var Ls=class Ls{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error("'literal' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(!Xn(e[1]))return t.error("invalid value");let i=e[1],n=He(i),o=t.expectedType;return n.kind==="array"&&n.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(n=o),new Ls(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};l(Ls,"Literal");var br=Ls,bh=class bh{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};l(bh,"RuntimeError");var Be=bh,fs={string:pe,number:j,boolean:se,object:Vi},Ds=class Ds{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=1,n,o=e[0];if(o==="array"){let s;if(e.length>2){let c=e[1];if(typeof c!="string"||!(c in fs)||c==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);s=fs[c],i++}else s=le;let u;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);u=e[2],i++}n=_t(s,u)}else{if(!fs[o])throw new Error("Types doesn't contain name = ".concat(o));n=fs[o]}let a=[];for(;i<e.length;i++){let s=t.parse(e[i],i,le);if(!s)return null;a.push(s)}return new Ds(n,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let i=this.args[t].evaluate(e);if(Hn(this.type,He(i))){if(t===this.args.length-1)throw new Be("Expected value to be of type ".concat(Re(this.type),", but found ").concat(Re(He(i))," instead."))}else return i}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};l(Ds,"Assertion");var Ft=Ds,_b={"to-boolean":se,"to-color":Ct,"to-number":j,"to-string":pe},zs=class zs{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[0];if(!_b[i])throw new Error("Can't parse ".concat(i," as it is not part of the known types"));if((i==="to-boolean"||i==="to-string")&&e.length!==2)return t.error("Expected one argument.");let n=_b[i],o=[];for(let a=1;a<e.length;a++){let s=t.parse(e[a],a,le);if(!s)return null;o.push(s)}return new zs(n,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(let n of this.args){if(t=n.evaluate(e),i=null,t instanceof X)return t;if(typeof t=="string"){let o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?i="Invalid rgba value ".concat(JSON.stringify(t),": expected an array containing either three or four numeric values."):i=Kb(t[0],t[1],t[2],t[3]),!i))return new X(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Be(i||"Could not parse color from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"padding":{let t;for(let i of this.args){t=i.evaluate(e);let n=Rt.parse(t);if(n)return n}throw new Be("Could not parse padding from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"variableAnchorOffsetCollection":{let t;for(let i of this.args){t=i.evaluate(e);let n=ir.parse(t);if(n)return n}throw new Be("Could not parse variableAnchorOffsetCollection from value '".concat(typeof t=="string"?t:JSON.stringify(t),"'"))}case"number":{let t=null;for(let i of this.args){if(t=i.evaluate(e),t===null)return 0;let n=Number(t);if(!isNaN(n))return n}throw new Be("Could not convert ".concat(JSON.stringify(t)," to number."))}case"formatted":return wt.fromString(On(this.args[0].evaluate(e)));case"resolvedImage":return ft.fromString(On(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())}};l(zs,"Coercion");var xr=zs,OP=["Unknown","Point","LineString","Polygon"],_h=class _h{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?OP[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[e];return t||(t=this._parseColorCache[e]=X.parse(e)),t}};l(_h,"EvaluationContext");var gs=_h,Fs=class Fs{constructor(e,t,i=[],n,o=new Np,a=[]){this.registry=e,this.path=i,this.key=i.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=n,this._isConstant=t}parse(e,t,i,n,o={}){return t?this.concat(t,i,n)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function i(n,o,a){return a==="assert"?new Ft(o,[n]):a==="coerce"?new xr(o,[n]):n}if(l(i,"annotate"),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 n=e[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 o=this.registry[n];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,u=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&u.kind==="value")a=i(a,s,t.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(u.kind==="value"||u.kind==="string"))a=i(a,s,t.typeAnnotation||"coerce");else if(s.kind==="padding"&&(u.kind==="value"||u.kind==="number"||u.kind==="array"))a=i(a,s,t.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(u.kind==="value"||u.kind==="array"))a=i(a,s,t.typeAnnotation||"coerce");else if(this.checkSubtype(s,u))return null}if(!(a instanceof br)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new gs;try{a=new br(a.type,a.evaluate(s))}catch(u){return this.error(u.message),null}}return a}return this.error('Unknown expression "'.concat(n,'". 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 ".concat(typeof e," instead."))}concat(e,t,i){let n=typeof e=="number"?this.path.concat(e):this.path,o=i?this.scope.concat(i):this.scope;return new Fs(this.registry,this._isConstant,n,t||null,o,this.errors)}error(e,...t){let i="".concat(this.key).concat(t.map(n=>"[".concat(n,"]")).join(""));this.errors.push(new At(i,e))}checkSubtype(e,t){let i=Hn(e,t);return i&&this.error(i),i}};l(Fs,"ParsingContext");var xs=Fs,Rs=class Rs{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found ".concat(e.length-1," instead."));let i=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return t.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);let s=t.parse(e[o+1],o+1);if(!s)return null;i.push([a,s])}let n=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return n?new Rs(i,n):null}outputDefined(){return this.result.outputDefined()}};l(Rs,"Let");var bs=Rs,Bs=class Bs{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");let i=e[1];return t.scope.has(i)?new Bs(i,t.scope.get(i)):t.error('Unknown variable "'.concat(i,'". Make sure "').concat(i,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}};l(Bs,"Var");var _s=Bs,Os=class Os{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(e.length!==3)return t.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1,j),n=t.parse(e[2],2,_t(t.expectedType||le));if(!i||!n)return null;let o=n.type;return new Os(o.itemType,i,n)}evaluate(e){let t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Be("Array index out of bounds: ".concat(t," < 0."));if(t>=i.length)throw new Be("Array index out of bounds: ".concat(t," > ").concat(i.length-1,"."));if(t!==Math.floor(t))throw new Be("Array index must be an integer, but found ".concat(t," instead."));return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}};l(Os,"At");var Gp=Os,Vs=class Vs{constructor(e,t){this.type=se,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1,le),n=t.parse(e[2],2,le);return!i||!n?null:nh(i.type,[se,pe,j,ji,le])?new Vs(i,n):t.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Re(i.type)," instead"))}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Yr(t,["boolean","string","number","null"]))throw new Be("Expected first argument to be of type boolean, string, number or null, but found ".concat(Re(He(t))," instead."));if(!Yr(i,["string","array"]))throw new Be("Expected second argument to be of type array or string, but found ".concat(Re(He(i))," instead."));return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}};l(Vs,"In");var qp=Vs,Gn=class Gn{constructor(e,t,i){this.type=j,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1,le),n=t.parse(e[2],2,le);if(!i||!n)return null;if(!nh(i.type,[se,pe,j,ji,le]))return t.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Re(i.type)," instead"));if(e.length===4){let o=t.parse(e[3],3,j);return o?new Gn(i,n,o):null}else return new Gn(i,n)}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Yr(t,["boolean","string","number","null"]))throw new Be("Expected first argument to be of type boolean, string, number or null, but found ".concat(Re(He(t))," instead."));let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),Yr(i,["string"])){let o=i.indexOf(t,n);return o===-1?-1:[...i.slice(0,o)].length}else{if(Yr(i,["array"]))return i.indexOf(t,n);throw new Be("Expected second argument to be of type array or string, but found ".concat(Re(He(i))," instead."))}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}};l(Gn,"IndexOf");var jp=Gn,Us=class Us{constructor(e,t,i,n,o,a){this.inputType=e,this.type=t,this.input=i,this.cases=n,this.outputs=o,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==1)return t.error("Expected an even number of arguments.");let i,n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);let o={},a=[];for(let c=2;c<e.length-1;c+=2){let p=e[c],h=e[c+1];Array.isArray(p)||(p=[p]);let f=t.concat(c);if(p.length===0)return f.error("Expected at least one branch label.");for(let y of p){if(typeof y!="number"&&typeof y!="string")return f.error("Branch labels must be numbers or strings.");if(typeof y=="number"&&Math.abs(y)>Number.MAX_SAFE_INTEGER)return f.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof y=="number"&&Math.floor(y)!==y)return f.error("Numeric branch labels must be integer values.");if(!i)i=He(y);else if(f.checkSubtype(i,He(y)))return null;if(typeof o[String(y)]<"u")return f.error("Branch labels must be unique.");o[String(y)]=a.length}let m=t.parse(h,c,n);if(!m)return null;n=n||m.type,a.push(m)}let s=t.parse(e[1],1,le);if(!s)return null;let u=t.parse(e[e.length-1],e.length-1,n);return!u||s.type.kind!=="value"&&t.concat(1).checkSubtype(i,s.type)?null:new Us(i,n,s,o,a,u)}evaluate(e){let t=this.input.evaluate(e);return(He(t)===this.inputType&&this.outputs[this.cases[t]]||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()}};l(Us,"Match");var Zp=Us,Ns=class Ns{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);let n=[];for(let a=1;a<e.length-1;a+=2){let s=t.parse(e[a],a,se);if(!s)return null;let u=t.parse(e[a+1],a+1,i);if(!u)return null;n.push([s,u]),i=i||u.type}let o=t.parse(e[e.length-1],e.length-1,i);if(!o)return null;if(!i)throw new Error("Can't infer output type");return new Ns(i,n,o)}evaluate(e){for(let[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}};l(Ns,"Case");var Hp=Ns,qn=class qn{constructor(e,t,i,n){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1,le),n=t.parse(e[2],2,j);if(!i||!n)return null;if(!nh(i.type,[_t(le),pe,le]))return t.error("Expected first argument to be of type array or string, but found ".concat(Re(i.type)," instead"));if(e.length===4){let o=t.parse(e[3],3,j);return o?new qn(i.type,i,n,o):null}else return new qn(i.type,i,n)}evaluate(e){let t=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),Yr(t,["string"]))return[...t].slice(i,n).join("");if(Yr(t,["array"]))return t.slice(i,n);throw new Be("Expected first argument to be of type array or string, but found ".concat(Re(He(t))," instead."))}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};l(qn,"Slice");var $p=qn;function Ys(r,e){let t=r.length-1,i=0,n=t,o=0,a,s;for(;i<=n;)if(o=Math.floor((i+n)/2),a=r[o],s=r[o+1],a<=e){if(o===t||e<s)return o;i=o+1}else if(a>e)n=o-1;else throw new Be("Input is not a number.");return 0}l(Ys,"findStopLessThanOrEqualTo");var Gs=class Gs{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[n,o]of i)this.labels.push(n),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");let i=t.parse(e[1],1,j);if(!i)return null;let n=[],o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],u=e[a+1],c=a,p=a+1;if(typeof s!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(n.length&&n[n.length-1][0]>=s)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);let h=t.parse(u,p,o);if(!h)return null;o=o||h.type,n.push([s,h])}return new Gs(o,i,n)}evaluate(e){let t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);let o=t.length;if(n>=t[o-1])return i[o-1].evaluate(e);let a=Ys(t,n);return i[a].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};l(Gs,"Step");var Gi=Gs;function VP(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}l(VP,"getDefaultExportFromCjs");var Rp,vb;function UP(){if(vb)return Rp;vb=1,Rp=r;function r(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}return l(r,"UnitBezier"),r.prototype={sampleCurveX:l(function(e){return((this.ax*e+this.bx)*e+this.cx)*e},"sampleCurveX"),sampleCurveY:l(function(e){return((this.ay*e+this.by)*e+this.cy)*e},"sampleCurveY"),sampleCurveDerivativeX:l(function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},"sampleCurveDerivativeX"),solveCurveX:l(function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var o=this.sampleCurveX(i)-e;if(Math.abs(o)<t)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i=i-o/a}var s=0,u=1;for(i=e,n=0;n<20&&(o=this.sampleCurveX(i),!(Math.abs(o-e)<t));n++)e>o?s=i:u=i,i=(u-s)*.5+s;return i},"solveCurveX"),solve:l(function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))},"solve")},Rp}l(UP,"requireUnitbezier");var NP=UP(),GP=VP(NP);function qP(r){return r==="rgb"||r==="hcl"||r==="lab"}l(qP,"isSupportedInterpolationColorSpace");function Qr(r,e,t){return r+t*(e-r)}l(Qr,"number");function jP(r,e,t,i="rgb"){switch(i){case"rgb":{let[n,o,a,s]=vs(r.rgb,e.rgb,t);return new X(n,o,a,s,!1)}case"hcl":{let[n,o,a,s]=r.hcl,[u,c,p,h]=e.hcl,f,m;if(!isNaN(n)&&!isNaN(u)){let w=u-n;u>n&&w>180?w-=360:u<n&&n-u>180&&(w+=360),f=n+t*w}else isNaN(n)?isNaN(u)?f=NaN:(f=u,(a===1||a===0)&&(m=c)):(f=n,(p===1||p===0)&&(m=o));let[y,g,x,b]=DP([f,m!=null?m:Qr(o,c,t),Qr(a,p,t),Qr(s,h,t)]);return new X(y,g,x,b,!1)}case"lab":{let[n,o,a,s]=Xb(vs(r.lab,e.lab,t));return new X(n,o,a,s,!1)}}}l(jP,"color");function vs(r,e,t){return r.map((i,n)=>Qr(i,e[n],t))}l(vs,"array");function ZP(r,e,t){return new Rt(vs(r.values,e.values,t))}l(ZP,"padding");function HP(r,e,t){let i=r.values,n=e.values;if(i.length!==n.length)throw new Be("Cannot interpolate values of different length. from: ".concat(r.toString(),", to: ").concat(e.toString()));let o=[];for(let a=0;a<i.length;a+=2){if(i[a]!==n[a])throw new Be("Cannot interpolate values containing mismatched anchors. from[".concat(a,"]: ").concat(i[a],", to[").concat(a,"]: ").concat(n[a]));o.push(i[a]);let[s,u]=i[a+1],[c,p]=n[a+1];o.push([Qr(s,c,t),Qr(u,p,t)])}return new ir(o)}l(HP,"variableAnchorOffsetCollection");var Pe={number:Qr,color:jP,array:vs,padding:ZP,variableAnchorOffsetCollection:HP},jn=class jn{constructor(e,t,i,n,o){this.type=e,this.operator=t,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,t,i,n){let o=0;if(e.name==="exponential")o=Bp(t,e.base,i,n);else if(e.name==="linear")o=Bp(t,1,i,n);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new GP(a[0],a[1],a[2],a[3]).solve(Bp(t,1,i,n))}return o}static parse(e,t){let[i,n,o,...a]=e;if(!Array.isArray(n)||n.length===0)return t.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let c=n[1];if(typeof c!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:c}}else if(n[0]==="cubic-bezier"){let c=n.slice(1);if(c.length!==4||c.some(p=>typeof p!="number"||p<0||p>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:c}}else return t.error("Unknown interpolation type ".concat(String(n[0])),1,0);if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,j),!o)return null;let s=[],u=null;i==="interpolate-hcl"||i==="interpolate-lab"?u=Ct:t.expectedType&&t.expectedType.kind!=="value"&&(u=t.expectedType);for(let c=0;c<a.length;c+=2){let p=a[c],h=a[c+1],f=c+3,m=c+4;if(typeof p!="number")return t.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]>=p)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);let y=t.parse(h,m,u);if(!y)return null;u=u||y.type,s.push([p,y])}return!Rn(u,j)&&!Rn(u,Ct)&&!Rn(u,Ks)&&!Rn(u,Js)&&!Rn(u,_t(j))?t.error("Type ".concat(Re(u)," is not interpolatable.")):new jn(u,i,n,o,s)}evaluate(e){let t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);let o=t.length;if(n>=t[o-1])return i[o-1].evaluate(e);let a=Ys(t,n),s=t[a],u=t[a+1],c=jn.interpolationFactor(this.interpolation,n,s,u),p=i[a].evaluate(e),h=i[a+1].evaluate(e);switch(this.operator){case"interpolate":return Pe[this.type.kind](p,h,c);case"interpolate-hcl":return Pe.color(p,h,c,"hcl");case"interpolate-lab":return Pe.color(p,h,c,"lab")}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};l(jn,"Interpolate");var vt=jn;function Bp(r,e,t,i){let n=i-t,o=r-t;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}l(Bp,"exponentialInterpolation");var Zn=class Zn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null,n=t.expectedType;n&&n.kind!=="value"&&(i=n);let o=[];for(let s of e.slice(1)){let u=t.parse(s,1+o.length,i,void 0,{typeAnnotation:"omit"});if(!u)return null;i=i||u.type,o.push(u)}if(!i)throw new Error("No output type");return n&&o.some(s=>Hn(n,s.type))?new Zn(le,o):new Zn(i,o)}evaluate(e){let t=null,i=0,n;for(let o of this.args)if(i++,t=o.evaluate(e),t&&t instanceof ft&&!t.available&&(n||(n=t.name),t=null,i===this.args.length&&(t=n)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};l(Zn,"Coalesce");var ws=Zn;function wb(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}l(wb,"isComparableType");function $P(r,e,t){return e===t}l($P,"eq");function WP(r,e,t){return e!==t}l(WP,"neq");function XP(r,e,t){return e<t}l(XP,"lt");function KP(r,e,t){return e>t}l(KP,"gt");function JP(r,e,t){return e<=t}l(JP,"lteq");function YP(r,e,t){return e>=t}l(YP,"gteq");function Jb(r,e,t,i){return i.compare(e,t)===0}l(Jb,"eqCollate");function QP(r,e,t,i){return!Jb(r,e,t,i)}l(QP,"neqCollate");function eT(r,e,t,i){return i.compare(e,t)<0}l(eT,"ltCollate");function tT(r,e,t,i){return i.compare(e,t)>0}l(tT,"gtCollate");function rT(r,e,t,i){return i.compare(e,t)<=0}l(rT,"lteqCollate");function iT(r,e,t,i){return i.compare(e,t)>=0}l(iT,"gteqCollate");function Hi(r,e,t){var n;let i=r!=="=="&&r!=="!=";return n=class{constructor(a,s,u){this.type=se,this.lhs=a,this.rhs=s,this.collator=u,this.hasUntypedArgument=a.type.kind==="value"||s.type.kind==="value"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error("Expected two or three arguments.");let u=a[0],c=s.parse(a[1],1,le);if(!c)return null;if(!wb(u,c.type))return s.concat(1).error('"'.concat(u,"\" comparisons are not supported for type '").concat(Re(c.type),"'."));let p=s.parse(a[2],2,le);if(!p)return null;if(!wb(u,p.type))return s.concat(2).error('"'.concat(u,"\" comparisons are not supported for type '").concat(Re(p.type),"'."));if(c.type.kind!==p.type.kind&&c.type.kind!=="value"&&p.type.kind!=="value")return s.error("Cannot compare types '".concat(Re(c.type),"' and '").concat(Re(p.type),"'."));i&&(c.type.kind==="value"&&p.type.kind!=="value"?c=new Ft(p.type,[c]):c.type.kind!=="value"&&p.type.kind==="value"&&(p=new Ft(c.type,[p])));let h=null;if(a.length===4){if(c.type.kind!=="string"&&p.type.kind!=="string"&&c.type.kind!=="value"&&p.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(h=s.parse(a[3],3,Xs),!h)return null}return new n(c,p,h)}evaluate(a){let s=this.lhs.evaluate(a),u=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let c=He(s),p=He(u);if(c.kind!==p.kind||!(c.kind==="string"||c.kind==="number"))throw new Be('Expected arguments for "'.concat(r,'" to be (string, string) or (number, number), but found (').concat(c.kind,", ").concat(p.kind,") instead."))}if(this.collator&&!i&&this.hasUntypedArgument){let c=He(s),p=He(u);if(c.kind!=="string"||p.kind!=="string")return e(a,s,u)}return this.collator?t(a,s,u,this.collator.evaluate(a)):e(a,s,u)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}},l(n,"Comparison"),n}l(Hi,"makeComparison");var nT=Hi("==",$P,Jb),oT=Hi("!=",WP,QP),aT=Hi("<",XP,eT),sT=Hi(">",KP,tT),lT=Hi("<=",JP,rT),uT=Hi(">=",YP,iT),qs=class qs{constructor(e,t,i){this.type=Xs,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");let i=e[1];if(typeof i!="object"||Array.isArray(i))return t.error("Collator options argument must be an object.");let n=t.parse(i["case-sensitive"]===void 0?!1:i["case-sensitive"],1,se);if(!n)return null;let o=t.parse(i["diacritic-sensitive"]===void 0?!1:i["diacritic-sensitive"],1,se);if(!o)return null;let a=null;return i.locale&&(a=t.parse(i.locale,1,pe),!a)?null:new qs(n,o,a)}evaluate(e){return new $n(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}};l(qs,"CollatorExpression");var Ss=qs,js=class js{constructor(e,t,i,n,o){this.type=pe,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");let i=t.parse(e[1],1,j);if(!i)return null;let n=e[2];if(typeof n!="object"||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&(o=t.parse(n.locale,1,pe),!o))return null;let a=null;if(n.currency&&(a=t.parse(n.currency,1,pe),!a))return null;let s=null;if(n["min-fraction-digits"]&&(s=t.parse(n["min-fraction-digits"],1,j),!s))return null;let u=null;return n["max-fraction-digits"]&&(u=t.parse(n["max-fraction-digits"],1,j),!u)?null:new js(i,o,a,s,u)}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}};l(js,"NumberFormat");var Wp=js,Zs=class Zs{constructor(e){this.type=Zi,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&typeof i=="object")return t.error("First argument must be an image or text section.");let n=[],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 u=null;if(s["font-scale"]&&(u=t.parse(s["font-scale"],1,j),!u))return null;let c=null;if(s["text-font"]&&(c=t.parse(s["text-font"],1,_t(pe)),!c))return null;let p=null;if(s["text-color"]&&(p=t.parse(s["text-color"],1,Ct),!p))return null;let h=n[n.length-1];h.scale=u,h.font=c,h.textColor=p}else{let u=t.parse(e[a],1,le);if(!u)return null;let c=u.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:u,scale:null,font:null,textColor:null})}}return new Zs(n)}evaluate(e){let t=l(i=>{let n=i.content.evaluate(e);return He(n)===no?new Wn("",n,null,null,null):new Wn(On(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)},"evaluateSection");return new wt(this.sections.map(t))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}};l(Zs,"FormatExpression");var Kn=Zs,Hs=class Hs{constructor(e){this.type=no,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");let i=t.parse(e[1],1,pe);return i?new Hs(i):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),i=ft.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}};l(Hs,"ImageExpression");var Xp=Hs,$s=class $s{constructor(e){this.type=j,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected 1 argument, but found ".concat(e.length-1," instead."));let i=t.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?t.error("Expected argument of type string or array, but found ".concat(Re(i.type)," instead.")):new $s(i):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new Be("Expected value to be of type string or array, but found ".concat(Re(He(t))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}};l($s,"Length");var Kp=$s,Ut=8192;function cT(r,e){let t=pT(r[0]),i=fT(r[1]),n=Math.pow(2,e.z);return[Math.round(t*n*Ut),Math.round(i*n*Ut)]}l(cT,"getTileCoordinates");function oh(r,e){let t=Math.pow(2,e.z),i=(r[0]/Ut+e.x)/t,n=(r[1]/Ut+e.y)/t;return[hT(i),mT(n)]}l(oh,"getLngLatFromTileCoord");function pT(r){return(180+r)/360}l(pT,"mercatorXfromLng");function hT(r){return r*360-180}l(hT,"lngFromMercatorXfromLng");function fT(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}l(fT,"mercatorYfromLat");function mT(r){return 360/Math.PI*Math.atan(Math.exp((180-r*360)*Math.PI/180))-90}l(mT,"latFromMercatorY");function oo(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}l(oo,"updateBBox");function Jn(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}l(Jn,"boxWithinBox");function dT(r,e,t){return e[1]>r[1]!=t[1]>r[1]&&r[0]<(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1])+e[0]}l(dT,"rayIntersect");function yT(r,e,t){let i=r[0]-e[0],n=r[1]-e[1],o=r[0]-t[0],a=r[1]-t[1];return i*a-o*n===0&&i*o<=0&&n*a<=0}l(yT,"pointOnBoundary");function Qs(r,e,t,i){let n=[e[0]-r[0],e[1]-r[1]],o=[i[0]-t[0],i[1]-t[1]];return _T(o,n)===0?!1:!!(Sb(r,e,t,i)&&Sb(t,i,r,e))}l(Qs,"segmentIntersectSegment");function gT(r,e,t){for(let i of t)for(let n=0;n<i.length-1;++n)if(Qs(r,e,i[n],i[n+1]))return!0;return!1}l(gT,"lineIntersectPolygon");function $i(r,e,t=!1){let i=!1;for(let n of e)for(let o=0;o<n.length-1;o++){if(yT(r,n[o],n[o+1]))return t;dT(r,n[o],n[o+1])&&(i=!i)}return i}l($i,"pointWithinPolygon");function xT(r,e){for(let t of e)if($i(r,t))return!0;return!1}l(xT,"pointWithinPolygons");function Yb(r,e){for(let t of r)if(!$i(t,e))return!1;for(let t=0;t<r.length-1;++t)if(gT(r[t],r[t+1],e))return!1;return!0}l(Yb,"lineStringWithinPolygon");function bT(r,e){for(let t of e)if(Yb(r,t))return!0;return!1}l(bT,"lineStringWithinPolygons");function _T(r,e){return r[0]*e[1]-r[1]*e[0]}l(_T,"perp");function Sb(r,e,t,i){let n=r[0]-t[0],o=r[1]-t[1],a=e[0]-t[0],s=e[1]-t[1],u=i[0]-t[0],c=i[1]-t[1],p=n*c-u*o,h=a*c-u*s;return p>0&&h<0||p<0&&h>0}l(Sb,"twoSided");function ah(r,e,t){let i=[];for(let n=0;n<r.length;n++){let o=[];for(let a=0;a<r[n].length;a++){let s=cT(r[n][a],t);oo(e,s),o.push(s)}i.push(o)}return i}l(ah,"getTilePolygon");function Qb(r,e,t){let i=[];for(let n=0;n<r.length;n++){let o=ah(r[n],e,t);i.push(o)}return i}l(Qb,"getTilePolygons");function e_(r,e,t,i){if(r[0]<t[0]||r[0]>t[2]){let n=i*.5,o=r[0]-t[0]>n?-i:t[0]-r[0]>n?i:0;o===0&&(o=r[0]-t[2]>n?-i:t[2]-r[0]>n?i:0),r[0]+=o}oo(e,r)}l(e_,"updatePoint");function vT(r){r[0]=r[1]=1/0,r[2]=r[3]=-1/0}l(vT,"resetBBox");function Pb(r,e,t,i){let n=Math.pow(2,i.z)*Ut,o=[i.x*Ut,i.y*Ut],a=[];for(let s of r)for(let u of s){let c=[u.x+o[0],u.y+o[1]];e_(c,e,t,n),a.push(c)}return a}l(Pb,"getTilePoints");function Tb(r,e,t,i){let n=Math.pow(2,i.z)*Ut,o=[i.x*Ut,i.y*Ut],a=[];for(let s of r){let u=[];for(let c of s){let p=[c.x+o[0],c.y+o[1]];oo(e,p),u.push(p)}a.push(u)}if(e[2]-e[0]<=n/2){vT(e);for(let s of a)for(let u of s)e_(u,e,t,n)}return a}l(Tb,"getTileLines");function wT(r,e){let t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=r.canonicalID();if(e.type==="Polygon"){let o=ah(e.coordinates,i,n),a=Pb(r.geometry(),t,i,n);if(!Jn(t,i))return!1;for(let s of a)if(!$i(s,o))return!1}if(e.type==="MultiPolygon"){let o=Qb(e.coordinates,i,n),a=Pb(r.geometry(),t,i,n);if(!Jn(t,i))return!1;for(let s of a)if(!xT(s,o))return!1}return!0}l(wT,"pointsWithinPolygons");function ST(r,e){let t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=r.canonicalID();if(e.type==="Polygon"){let o=ah(e.coordinates,i,n),a=Tb(r.geometry(),t,i,n);if(!Jn(t,i))return!1;for(let s of a)if(!Yb(s,o))return!1}if(e.type==="MultiPolygon"){let o=Qb(e.coordinates,i,n),a=Tb(r.geometry(),t,i,n);if(!Jn(t,i))return!1;for(let s of a)if(!bT(s,o))return!1}return!0}l(ST,"linesWithinPolygons");var Bi=class Bi{constructor(e,t){this.type=se,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error("'within' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(Xn(e[1])){let i=e[1];if(i.type==="FeatureCollection"){let n=[];for(let o of i.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&n.push(s),a==="MultiPolygon"&&n.push(...s)}if(n.length){let o={type:"MultiPolygon",coordinates:n};return new Bi(i,o)}}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new Bi(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Bi(i,i)}return t.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 wT(e,this.geometries);if(e.geometryType()==="LineString")return ST(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}};l(Bi,"Within");var Yn=Bi,vh=class vh{constructor(e=[],t=(i,n)=>i<n?-1:i>n?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,n=t[e];for(;e>0;){let o=e-1>>1,a=t[o];if(i(n,a)>=0)break;t[e]=a,e=o}t[e]=n}_down(e){let{data:t,compare:i}=this,n=this.length>>1,o=t[e];for(;e<n;){let a=(e<<1)+1,s=a+1;if(s<this.length&&i(t[s],t[a])<0&&(a=s),i(t[a],o)>=0)break;t[e]=t[a],e=a}t[e]=o}};l(vh,"TinyQueue");var Ps=vh;function PT(r,e,t,i,n){t_(r,e,t,i||r.length-1,n||TT)}l(PT,"quickselect");function t_(r,e,t,i,n){for(;i>t;){if(i-t>600){var o=i-t+1,a=e-t+1,s=Math.log(o),u=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1),p=Math.max(t,Math.floor(e-a*u/o+c)),h=Math.min(i,Math.floor(e+(o-a)*u/o+c));t_(r,e,p,h,n)}var f=r[e],m=t,y=i;for(Bn(r,t,e),n(r[i],f)>0&&Bn(r,t,i);m<y;){for(Bn(r,m,y),m++,y--;n(r[m],f)<0;)m++;for(;n(r[y],f)>0;)y--}n(r[t],f)===0?Bn(r,t,y):(y++,Bn(r,y,i)),y<=e&&(t=y+1),e<=y&&(i=y-1)}}l(t_,"quickselectStep");function Bn(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}l(Bn,"swap");function TT(r,e){return r<e?-1:r>e?1:0}l(TT,"defaultCompare");function MT(r,e){if(r.length<=1)return[r];let i=[],n,o;for(let a of r){let s=IT(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(n&&i.push(n),n=[a]):n.push(a))}if(n&&i.push(n),e>1)for(let a=0;a<i.length;a++)i[a].length<=e||(PT(i[a],e,1,i[a].length-1,AT),i[a]=i[a].slice(0,e));return i}l(MT,"classifyRings");function AT(r,e){return e.area-r.area}l(AT,"compareAreas");function IT(r){let e=0;for(let t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}l(IT,"calculateSignedArea");var CT=6378.137,Mb=1/298.257223563,Ab=Mb*(2-Mb),Ib=Math.PI/180,wh=class wh{constructor(e){let t=Ib*CT*1e3,i=Math.cos(e*Ib),n=1/(1-Ab*(1-i*i)),o=Math.sqrt(n);this.kx=t*o*i,this.ky=t*o*n*(1-Ab)}distance(e,t){let i=this.wrap(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(e,t){let i=1/0,n,o,a,s;for(let u=0;u<e.length-1;u++){let c=e[u][0],p=e[u][1],h=this.wrap(e[u+1][0]-c)*this.kx,f=(e[u+1][1]-p)*this.ky,m=0;(h!==0||f!==0)&&(m=(this.wrap(t[0]-c)*this.kx*h+(t[1]-p)*this.ky*f)/(h*h+f*f),m>1?(c=e[u+1][0],p=e[u+1][1]):m>0&&(c+=h/this.kx*m,p+=f/this.ky*m)),h=this.wrap(t[0]-c)*this.kx,f=(t[1]-p)*this.ky;let y=h*h+f*f;y<i&&(i=y,n=c,o=p,a=u,s=m)}return{point:[n,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}};l(wh,"CheapRuler");var Qn=wh,Jp=100,Yp=50;function r_(r,e){return e[0]-r[0]}l(r_,"compareDistPair");function Ts(r){return r[1]-r[0]+1}l(Ts,"getRangeSize");function nr(r,e){return r[1]>=r[0]&&r[1]<e}l(nr,"isRangeSafe");function Qp(r,e){if(r[0]>r[1])return[null,null];let t=Ts(r);if(e){if(t===2)return[r,null];let n=Math.floor(t/2);return[[r[0],r[0]+n],[r[0]+n,r[1]]]}if(t===1)return[r,null];let i=Math.floor(t/2)-1;return[[r[0],r[0]+i],[r[0]+i+1,r[1]]]}l(Qp,"splitRange");function eh(r,e){if(!nr(e,r.length))return[1/0,1/0,-1/0,-1/0];let t=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)oo(t,r[i]);return t}l(eh,"getBBox");function th(r){let e=[1/0,1/0,-1/0,-1/0];for(let t of r)for(let i of t)oo(e,i);return e}l(th,"getPolygonBBox");function Cb(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}l(Cb,"isValidBBox");function sh(r,e,t){if(!Cb(r)||!Cb(e))return NaN;let i=0,n=0;return r[2]<e[0]&&(i=e[0]-r[2]),r[0]>e[2]&&(i=r[0]-e[2]),r[1]>e[3]&&(n=r[1]-e[3]),r[3]<e[1]&&(n=e[1]-r[3]),t.distance([0,0],[i,n])}l(sh,"bboxToBBoxDistance");function Jr(r,e,t){let i=t.pointOnLine(e,r);return t.distance(r,i.point)}l(Jr,"pointToLineDistance");function lh(r,e,t,i,n){let o=Math.min(Jr(r,[t,i],n),Jr(e,[t,i],n)),a=Math.min(Jr(t,[r,e],n),Jr(i,[r,e],n));return Math.min(o,a)}l(lh,"segmentToSegmentDistance");function ET(r,e,t,i,n){if(!(nr(e,r.length)&&nr(i,t.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let u=r[s],c=r[s+1];for(let p=i[0];p<i[1];++p){let h=t[p],f=t[p+1];if(Qs(u,c,h,f))return 0;a=Math.min(a,lh(u,c,h,f,n))}}return a}l(ET,"lineToLineDistance");function kT(r,e,t,i,n){if(!(nr(e,r.length)&&nr(i,t.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let u=i[0];u<=i[1];++u)if(a=Math.min(a,n.distance(r[s],t[u])),a===0)return a;return a}l(kT,"pointsToPointsDistance");function LT(r,e,t){if($i(r,e,!0))return 0;let i=1/0;for(let n of e){let o=n[0],a=n[n.length-1];if(o!==a&&(i=Math.min(i,Jr(r,[a,o],t)),i===0))return i;let s=t.pointOnLine(n,r);if(i=Math.min(i,t.distance(r,s.point)),i===0)return i}return i}l(LT,"pointToPolygonDistance");function DT(r,e,t,i){if(!nr(e,r.length))return NaN;for(let o=e[0];o<=e[1];++o)if($i(r[o],t,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){let a=r[o],s=r[o+1];for(let u of t)for(let c=0,p=u.length,h=p-1;c<p;h=c++){let f=u[h],m=u[c];if(Qs(a,s,f,m))return 0;n=Math.min(n,lh(a,s,f,m,i))}}return n}l(DT,"lineToPolygonDistance");function Eb(r,e){for(let t of r)for(let i of t)if($i(i,e,!0))return!0;return!1}l(Eb,"polygonIntersect");function zT(r,e,t,i=1/0){let n=th(r),o=th(e);if(i!==1/0&&sh(n,o,t)>=i)return i;if(Jn(n,o)){if(Eb(r,e))return 0}else if(Eb(e,r))return 0;let a=1/0;for(let s of r)for(let u=0,c=s.length,p=c-1;u<c;p=u++){let h=s[p],f=s[u];for(let m of e)for(let y=0,g=m.length,x=g-1;y<g;x=y++){let b=m[x],w=m[y];if(Qs(h,f,b,w))return 0;a=Math.min(a,lh(h,f,b,w,t))}}return a}l(zT,"polygonToPolygonDistance");function kb(r,e,t,i,n,o){if(!o)return;let a=sh(eh(i,o),n,t);a<e&&r.push([a,o,[0,0]])}l(kb,"updateQueue");function ms(r,e,t,i,n,o,a){if(!o||!a)return;let s=sh(eh(i,o),eh(n,a),t);s<e&&r.push([s,o,a])}l(ms,"updateQueueTwoSets");function Ms(r,e,t,i,n=1/0){let o=Math.min(i.distance(r[0],t[0][0]),n);if(o===0)return o;let a=new Ps([[0,[0,r.length-1],[0,0]]],r_),s=th(t);for(;a.length>0;){let u=a.pop();if(u[0]>=o)continue;let c=u[1],p=e?Yp:Jp;if(Ts(c)<=p){if(!nr(c,r.length))return NaN;if(e){let h=DT(r,c,t,i);if(isNaN(h)||h===0)return h;o=Math.min(o,h)}else for(let h=c[0];h<=c[1];++h){let f=LT(r[h],t,i);if(o=Math.min(o,f),o===0)return 0}}else{let h=Qp(c,e);kb(a,o,i,r,s,h[0]),kb(a,o,i,r,s,h[1])}}return o}l(Ms,"pointsToPolygonDistance");function As(r,e,t,i,n,o=1/0){let a=Math.min(o,n.distance(r[0],t[0]));if(a===0)return a;let s=new Ps([[0,[0,r.length-1],[0,t.length-1]]],r_);for(;s.length>0;){let u=s.pop();if(u[0]>=a)continue;let c=u[1],p=u[2],h=e?Yp:Jp,f=i?Yp:Jp;if(Ts(c)<=h&&Ts(p)<=f){if(!nr(c,r.length)&&nr(p,t.length))return NaN;let m;if(e&&i)m=ET(r,c,t,p,n),a=Math.min(a,m);else if(e&&!i){let y=r.slice(c[0],c[1]+1);for(let g=p[0];g<=p[1];++g)if(m=Jr(t[g],y,n),a=Math.min(a,m),a===0)return a}else if(!e&&i){let y=t.slice(p[0],p[1]+1);for(let g=c[0];g<=c[1];++g)if(m=Jr(r[g],y,n),a=Math.min(a,m),a===0)return a}else m=kT(r,c,t,p,n),a=Math.min(a,m)}else{let m=Qp(c,e),y=Qp(p,i);ms(s,a,n,r,t,m[0],y[0]),ms(s,a,n,r,t,m[0],y[1]),ms(s,a,n,r,t,m[1],y[0]),ms(s,a,n,r,t,m[1],y[1])}}return a}l(As,"pointSetToPointSetDistance");function FT(r,e){let t=r.geometry(),i=t.flat().map(a=>oh([a.x,a.y],r.canonical));if(t.length===0)return NaN;let n=new Qn(i[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,As(i,!1,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,As(i,!1,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Ms(i,!1,a.coordinates,n,o));break}if(o===0)return o}return o}l(FT,"pointToGeometryDistance");function RT(r,e){let t=r.geometry(),i=t.flat().map(a=>oh([a.x,a.y],r.canonical));if(t.length===0)return NaN;let n=new Qn(i[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,As(i,!0,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,As(i,!0,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Ms(i,!0,a.coordinates,n,o));break}if(o===0)return o}return o}l(RT,"lineStringToGeometryDistance");function BT(r,e){let t=r.geometry();if(t.length===0||t[0].length===0)return NaN;let i=MT(t,0).map(a=>a.map(s=>s.map(u=>oh([u.x,u.y],r.canonical)))),n=new Qn(i[0][0][0][1]),o=1/0;for(let a of e)for(let s of i){switch(a.type){case"Point":o=Math.min(o,Ms([a.coordinates],!1,s,n,o));break;case"LineString":o=Math.min(o,Ms(a.coordinates,!0,s,n,o));break;case"Polygon":o=Math.min(o,zT(s,a.coordinates,n,o));break}if(o===0)return o}return o}l(BT,"polygonToGeometryDistance");function Op(r){return r.type==="MultiPolygon"?r.coordinates.map(e=>({type:"Polygon",coordinates:e})):r.type==="MultiLineString"?r.coordinates.map(e=>({type:"LineString",coordinates:e})):r.type==="MultiPoint"?r.coordinates.map(e=>({type:"Point",coordinates:e})):[r]}l(Op,"toSimpleGeometry");var Oi=class Oi{constructor(e,t){this.type=j,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error("'distance' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(Xn(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new Oi(i,i.features.map(n=>Op(n.geometry)).flat());if(i.type==="Feature")return new Oi(i,Op(i.geometry));if("type"in i&&"coordinates"in i)return new Oi(i,Op(i))}return t.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 FT(e,this.geometries);if(e.geometryType()==="LineString")return RT(e,this.geometries);if(e.geometryType()==="Polygon")return BT(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}};l(Oi,"Distance");var eo=Oi,ii={"==":nT,"!=":oT,">":sT,"<":aT,">=":uT,"<=":lT,array:Ft,at:Gp,boolean:Ft,case:Hp,coalesce:ws,collator:Ss,format:Kn,image:Xp,in:qp,"index-of":jp,interpolate:vt,"interpolate-hcl":vt,"interpolate-lab":vt,length:Kp,let:bs,literal:br,match:Zp,number:Ft,"number-format":Wp,object:Ft,slice:$p,step:Gi,string:Ft,"to-boolean":xr,"to-color":xr,"to-number":xr,"to-string":xr,var:_s,within:Yn,distance:eo},Kr=class Kr{constructor(e,t,i,n){this.name=e,this.type=t,this._evaluate=i,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let i=e[0],n=Kr.definitions[i];if(!n)return t.error('Unknown expression "'.concat(i,'". If you wanted a literal array, use ["literal", [...]].'),0);let o=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=a.filter(([c])=>!Array.isArray(c)||c.length===e.length-1),u=null;for(let[c,p]of s){u=new xs(t.registry,Is,t.path,null,t.scope);let h=[],f=!1;for(let m=1;m<e.length;m++){let y=e[m],g=Array.isArray(c)?c[m-1]:c.type,x=u.parse(y,1+h.length,g);if(!x){f=!0;break}h.push(x)}if(!f){if(Array.isArray(c)&&c.length!==h.length){u.error("Expected ".concat(c.length," arguments, but found ").concat(h.length," instead."));continue}for(let m=0;m<h.length;m++){let y=Array.isArray(c)?c[m]:c.type,g=h[m];u.concat(m+1).checkSubtype(y,g.type)}if(u.errors.length===0)return new Kr(i,o,p,h)}}if(s.length===1)t.errors.push(...u.errors);else{let p=(s.length?s:a).map(([f])=>VT(f)).join(" | "),h=[];for(let f=1;f<e.length;f++){let m=t.parse(e[f],1+h.length);if(!m)return null;h.push(Re(m.type))}t.error("Expected arguments of type ".concat(p,", but found (").concat(h.join(", "),") instead."))}return null}static register(e,t){Kr.definitions=t;for(let i in t)e[i]=Kr}};l(Kr,"CompoundExpression");var Nt=Kr;function Lb(r,[e,t,i,n]){e=e.evaluate(r),t=t.evaluate(r),i=i.evaluate(r);let o=n?n.evaluate(r):1,a=Kb(e,t,i,o);if(a)throw new Be(a);return new X(e/255,t/255,i/255,o,!1)}l(Lb,"rgba");function Db(r,e){return r in e}l(Db,"has");function Vp(r,e){let t=e[r];return typeof t>"u"?null:t}l(Vp,"get");function OT(r,e,t,i){for(;t<=i;){let n=t+i>>1;if(e[n]===r)return!0;e[n]>r?i=n-1:t=n+1}return!1}l(OT,"binarySearch");function Xr(r){return{type:r}}l(Xr,"varargs");Nt.register(ii,{error:[AP,[pe],(r,[e])=>{throw new Be(e.evaluate(r))}],typeof:[pe,[le],(r,[e])=>Re(He(e.evaluate(r)))],"to-rgba":[_t(j,4),[Ct],(r,[e])=>{let[t,i,n,o]=e.evaluate(r).rgb;return[t*255,i*255,n*255,o]}],rgb:[Ct,[j,j,j],Lb],rgba:[Ct,[j,j,j,j],Lb],has:{type:se,overloads:[[[pe],(r,[e])=>Db(e.evaluate(r),r.properties())],[[pe,Vi],(r,[e,t])=>Db(e.evaluate(r),t.evaluate(r))]]},get:{type:le,overloads:[[[pe],(r,[e])=>Vp(e.evaluate(r),r.properties())],[[pe,Vi],(r,[e,t])=>Vp(e.evaluate(r),t.evaluate(r))]]},"feature-state":[le,[pe],(r,[e])=>Vp(e.evaluate(r),r.featureState||{})],properties:[Vi,[],r=>r.properties()],"geometry-type":[pe,[],r=>r.geometryType()],id:[le,[],r=>r.id()],zoom:[j,[],r=>r.globals.zoom],"heatmap-density":[j,[],r=>r.globals.heatmapDensity||0],"line-progress":[j,[],r=>r.globals.lineProgress||0],accumulated:[le,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[j,Xr(j),(r,e)=>{let t=0;for(let i of e)t+=i.evaluate(r);return t}],"*":[j,Xr(j),(r,e)=>{let t=1;for(let i of e)t*=i.evaluate(r);return t}],"-":{type:j,overloads:[[[j,j],(r,[e,t])=>e.evaluate(r)-t.evaluate(r)],[[j],(r,[e])=>-e.evaluate(r)]]},"/":[j,[j,j],(r,[e,t])=>e.evaluate(r)/t.evaluate(r)],"%":[j,[j,j],(r,[e,t])=>e.evaluate(r)%t.evaluate(r)],ln2:[j,[],()=>Math.LN2],pi:[j,[],()=>Math.PI],e:[j,[],()=>Math.E],"^":[j,[j,j],(r,[e,t])=>Math.pow(e.evaluate(r),t.evaluate(r))],sqrt:[j,[j],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[j,[j],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[j,[j],(r,[e])=>Math.log(e.evaluate(r))],log2:[j,[j],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[j,[j],(r,[e])=>Math.sin(e.evaluate(r))],cos:[j,[j],(r,[e])=>Math.cos(e.evaluate(r))],tan:[j,[j],(r,[e])=>Math.tan(e.evaluate(r))],asin:[j,[j],(r,[e])=>Math.asin(e.evaluate(r))],acos:[j,[j],(r,[e])=>Math.acos(e.evaluate(r))],atan:[j,[j],(r,[e])=>Math.atan(e.evaluate(r))],min:[j,Xr(j),(r,e)=>Math.min(...e.map(t=>t.evaluate(r)))],max:[j,Xr(j),(r,e)=>Math.max(...e.map(t=>t.evaluate(r)))],abs:[j,[j],(r,[e])=>Math.abs(e.evaluate(r))],round:[j,[j],(r,[e])=>{let t=e.evaluate(r);return t<0?-Math.round(-t):Math.round(t)}],floor:[j,[j],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[j,[j],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[se,[pe,le],(r,[e,t])=>r.properties()[e.value]===t.value],"filter-id-==":[se,[le],(r,[e])=>r.id()===e.value],"filter-type-==":[se,[pe],(r,[e])=>r.geometryType()===e.value],"filter-<":[se,[pe,le],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i<n}],"filter-id-<":[se,[le],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t<i}],"filter->":[se,[pe,le],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i>n}],"filter-id->":[se,[le],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t>i}],"filter-<=":[se,[pe,le],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[se,[le],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t<=i}],"filter->=":[se,[pe,le],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[se,[le],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t>=i}],"filter-has":[se,[le],(r,[e])=>e.value in r.properties()],"filter-has-id":[se,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[se,[_t(pe)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[se,[_t(le)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[se,[pe,_t(le)],(r,[e,t])=>t.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[se,[pe,_t(le)],(r,[e,t])=>OT(r.properties()[e.value],t.value,0,t.value.length-1)],all:{type:se,overloads:[[[se,se],(r,[e,t])=>e.evaluate(r)&&t.evaluate(r)],[Xr(se),(r,e)=>{for(let t of e)if(!t.evaluate(r))return!1;return!0}]]},any:{type:se,overloads:[[[se,se],(r,[e,t])=>e.evaluate(r)||t.evaluate(r)],[Xr(se),(r,e)=>{for(let t of e)if(t.evaluate(r))return!0;return!1}]]},"!":[se,[se],(r,[e])=>!e.evaluate(r)],"is-supported-script":[se,[pe],(r,[e])=>{let t=r.globals&&r.globals.isSupportedScript;return t?t(e.evaluate(r)):!0}],upcase:[pe,[pe],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[pe,[pe],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[pe,Xr(le),(r,e)=>e.map(t=>On(t.evaluate(r))).join("")],"resolved-locale":[pe,[Xs],(r,[e])=>e.evaluate(r).resolvedLocale()]});function VT(r){return Array.isArray(r)?"(".concat(r.map(Re).join(", "),")"):"(".concat(Re(r.type),"...)")}l(VT,"stringifySignature");function Is(r){if(r instanceof _s)return Is(r.boundExpression);if(r instanceof Nt&&r.name==="error")return!1;if(r instanceof Ss)return!1;if(r instanceof Yn)return!1;if(r instanceof eo)return!1;let e=r instanceof xr||r instanceof Ft,t=!0;return r.eachChild(i=>{e?t=t&&Is(i):t=t&&i instanceof br}),t?el(r)&&tl(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}l(Is,"isExpressionConstant");function el(r){if(r instanceof Nt){if(r.name==="get"&&r.args.length===1)return!1;if(r.name==="feature-state")return!1;if(r.name==="has"&&r.args.length===1)return!1;if(r.name==="properties"||r.name==="geometry-type"||r.name==="id")return!1;if(/^filter-/.test(r.name))return!1}if(r instanceof Yn||r instanceof eo)return!1;let e=!0;return r.eachChild(t=>{e&&!el(t)&&(e=!1)}),e}l(el,"isFeatureConstant");function to(r){if(r instanceof Nt&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(t=>{e&&!to(t)&&(e=!1)}),e}l(to,"isStateConstant");function tl(r,e){if(r instanceof Nt&&e.indexOf(r.name)>=0)return!1;let t=!0;return r.eachChild(i=>{t&&!tl(i,e)&&(t=!1)}),t}l(tl,"isGlobalPropertyConstant");function rh(r){return{result:"success",value:r}}l(rh,"success");function zi(r){return{result:"error",value:r}}l(zi,"error");function _r(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}l(_r,"supportsPropertyExpression");function i_(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}l(i_,"supportsZoomExpression");function uh(r){return!!r.expression&&r.expression.interpolated}l(uh,"supportsInterpolation");function xe(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}l(xe,"getType");function rl(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}l(rl,"isFunction$1");function UT(r){return r}l(UT,"identityFunction");function n_(r,e){let t=e.type==="color",i=r.stops&&typeof r.stops[0][0]=="object",n=i||r.property!==void 0,o=i||!n,a=r.type||(uh(e)?"exponential":"interval");if(t||e.type==="padding"){let p=t?X.parse:Rt.parse;r=Ni({},r),r.stops&&(r.stops=r.stops.map(h=>[h[0],p(h[1])])),r.default?r.default=p(r.default):r.default=p(e.default)}if(r.colorSpace&&!qP(r.colorSpace))throw new Error('Unknown color space: "'.concat(r.colorSpace,'"'));let s,u,c;if(a==="exponential")s=zb;else if(a==="interval")s=GT;else if(a==="categorical"){s=NT,u=Object.create(null);for(let p of r.stops)u[p[0]]=p[1];c=typeof r.stops[0][0]}else if(a==="identity")s=qT;else throw new Error('Unknown function type "'.concat(a,'"'));if(i){let p={},h=[];for(let y=0;y<r.stops.length;y++){let g=r.stops[y],x=g[0].zoom;p[x]===void 0&&(p[x]={zoom:x,type:r.type,property:r.property,default:r.default,stops:[]},h.push(x)),p[x].stops.push([g[0].value,g[1]])}let f=[];for(let y of h)f.push([p[y].zoom,n_(p[y],e)]);let m={name:"linear"};return{kind:"composite",interpolationType:m,interpolationFactor:vt.interpolationFactor.bind(void 0,m),zoomStops:f.map(y=>y[0]),evaluate({zoom:y},g){return zb({stops:f,base:r.base},e,y).evaluate(y,g)}}}else if(o){let p=a==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:p,interpolationFactor:vt.interpolationFactor.bind(void 0,p),zoomStops:r.stops.map(h=>h[0]),evaluate:l(({zoom:h})=>s(r,e,h,u,c),"evaluate")}}else return{kind:"source",evaluate(p,h){let f=h&&h.properties?h.properties[r.property]:void 0;return f===void 0?ao(r.default,e.default):s(r,e,f,u,c)}}}l(n_,"createFunction");function ao(r,e,t){if(r!==void 0)return r;if(e!==void 0)return e;if(t!==void 0)return t}l(ao,"coalesce$1");function NT(r,e,t,i,n){let o=typeof t===n?i[t]:void 0;return ao(o,r.default,e.default)}l(NT,"evaluateCategoricalFunction");function GT(r,e,t){if(xe(t)!=="number")return ao(r.default,e.default);let i=r.stops.length;if(i===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[i-1][0])return r.stops[i-1][1];let n=Ys(r.stops.map(o=>o[0]),t);return r.stops[n][1]}l(GT,"evaluateIntervalFunction");function zb(r,e,t){let i=r.base!==void 0?r.base:1;if(xe(t)!=="number")return ao(r.default,e.default);let n=r.stops.length;if(n===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[n-1][0])return r.stops[n-1][1];let o=Ys(r.stops.map(p=>p[0]),t),a=jT(t,i,r.stops[o][0],r.stops[o+1][0]),s=r.stops[o][1],u=r.stops[o+1][1],c=Pe[e.type]||UT;return typeof s.evaluate=="function"?{evaluate(...p){let h=s.evaluate.apply(void 0,p),f=u.evaluate.apply(void 0,p);if(!(h===void 0||f===void 0))return c(h,f,a,r.colorSpace)}}:c(s,u,a,r.colorSpace)}l(zb,"evaluateExponentialFunction");function qT(r,e,t){switch(e.type){case"color":t=X.parse(t);break;case"formatted":t=wt.fromString(t.toString());break;case"resolvedImage":t=ft.fromString(t.toString());break;case"padding":t=Rt.parse(t);break;default:xe(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return ao(t,r.default,e.default)}l(qT,"evaluateIdentityFunction");function jT(r,e,t,i){let n=i-t,o=r-t;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}l(jT,"interpolationFactor");var Sh=class Sh{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new gs,this._defaultValue=t?HT(t):null,this._enumValues=t&&t.type==="enum"?t.values:null}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,n,o,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,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 Be("Expected value to be one of ".concat(Object.keys(this._enumValues).map(u=>JSON.stringify(u)).join(", "),", but found ").concat(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}}};l(Sh,"StyleExpression");var ei=Sh;function ni(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ii}l(ni,"isExpression");function ch(r,e){let t=new xs(ii,Is,[],e?ZT(e):void 0),i=t.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return i?rh(new ei(i,e)):zi(t.errors)}l(ch,"createExpression");var Ph=class Ph{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!to(t.expression)}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,o,a)}evaluate(e,t,i,n,o,a){return this._styleExpression.evaluate(e,t,i,n,o,a)}};l(Ph,"ZoomConstantExpression");var vr=Ph,Th=class Th{constructor(e,t,i,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!to(t.expression),this.interpolationType=n}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,o,a)}evaluate(e,t,i,n,o,a){return this._styleExpression.evaluate(e,t,i,n,o,a)}interpolationFactor(e,t,i){return this.interpolationType?vt.interpolationFactor(this.interpolationType,e,t,i):0}};l(Th,"ZoomDependentExpression");var wr=Th;function o_(r,e){let t=ch(r,e);if(t.result==="error")return t;let i=t.value.expression,n=el(i);if(!n&&!_r(e))return zi([new At("","data expressions not supported")]);let o=tl(i,["zoom"]);if(!o&&!i_(e))return zi([new At("","zoom expressions not supported")]);let a=ys(i);if(!a&&!o)return zi([new At("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof At)return zi([a]);if(a instanceof vt&&!uh(e))return zi([new At("",'"interpolate" expressions cannot be used with this property')]);if(!a)return rh(n?new vr("constant",t.value):new vr("source",t.value));let s=a instanceof vt?a.interpolation:void 0;return rh(n?new wr("camera",t.value,a.labels,s):new wr("composite",t.value,a.labels,s))}l(o_,"createPropertyExpression");var Ws=class Ws{constructor(e,t){this._parameters=e,this._specification=t,Ni(this,n_(this._parameters,this._specification))}static deserialize(e){return new Ws(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};l(Ws,"StylePropertyFunction");var ro=Ws;function a_(r,e){if(rl(r))return new ro(r,e);if(ni(r)){let t=o_(r,e);if(t.result==="error")throw new Error(t.value.map(i=>"".concat(i.key,": ").concat(i.message)).join(", "));return t.value}else{let t=r;return e.type==="color"&&typeof r=="string"?t=X.parse(r):e.type==="padding"&&(typeof r=="number"||Array.isArray(r))?t=Rt.parse(r):e.type==="variableAnchorOffsetCollection"&&Array.isArray(r)&&(t=ir.parse(r)),{kind:"constant",evaluate:l(()=>t,"evaluate")}}}l(a_,"normalizePropertyExpression");function ys(r){let e=null;if(r instanceof bs)e=ys(r.result);else if(r instanceof ws){for(let t of r.args)if(e=ys(t),e)break}else(r instanceof Gi||r instanceof vt)&&r.input instanceof Nt&&r.input.name==="zoom"&&(e=r);return e instanceof At||r.eachChild(t=>{let i=ys(t);i instanceof At?e=i:!e&&i?e=new At("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new At("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}l(ys,"findZoomCurve");function ZT(r){let e={color:Ct,string:pe,number:j,enum:pe,boolean:se,formatted:Zi,padding:Ks,resolvedImage:no,variableAnchorOffsetCollection:Js};return r.type==="array"?_t(e[r.value]||le,r.length):e[r.type]}l(ZT,"getExpectedType");function HT(r){return r.type==="color"&&rl(r.default)?new X(0,0,0,0):r.type==="color"?X.parse(r.default)||null:r.type==="padding"?Rt.parse(r.default)||null:r.type==="variableAnchorOffsetCollection"?ir.parse(r.default)||null:r.default===void 0?null:r.default}l(HT,"getDefaultValue");function ph(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(let e of r.slice(1))if(!ph(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}l(ph,"isExpressionFilter");var $T={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function so(r){if(r==null)return{filter:l(()=>!0,"filter"),needGeometry:!1};ph(r)||(r=Cs(r));let e=ch(r,$T);if(e.result==="error")throw new Error(e.value.map(t=>"".concat(t.key,": ").concat(t.message)).join(", "));{let t=s_(r);return{filter:l((i,n,o)=>e.value.evaluate(i,n,{},o),"filter"),needGeometry:t}}}l(so,"createFilter");function WT(r,e){return r<e?-1:r>e?1:0}l(WT,"compare");function s_(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(s_(r[e]))return!0;return!1}l(s_,"geometryNeeded");function Cs(r){if(!r)return!0;let e=r[0];return r.length<=1?e!=="any":e==="=="?Up(r[1],r[2],"=="):e==="!="?ds(Up(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Up(r[1],r[2],e):e==="any"?XT(r.slice(1)):e==="all"?["all"].concat(r.slice(1).map(Cs)):e==="none"?["all"].concat(r.slice(1).map(Cs).map(ds)):e==="in"?Fb(r[1],r.slice(2)):e==="!in"?ds(Fb(r[1],r.slice(2))):e==="has"?Rb(r[1]):e==="!has"?ds(Rb(r[1])):!0}l(Cs,"convertFilter$1");function Up(r,e,t){switch(r){case"$type":return["filter-type-".concat(t),e];case"$id":return["filter-id-".concat(t),e];default:return["filter-".concat(t),r,e]}}l(Up,"convertComparisonOp$1");function XT(r){return["any"].concat(r.map(Cs))}l(XT,"convertDisjunctionOp");function Fb(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",r,["literal",e.sort(WT)]]:["filter-in-small",r,["literal",e]]}}l(Fb,"convertInOp$1");function Rb(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}l(Rb,"convertHasOp$1");function ds(r){return["!",r]}l(ds,"convertNegation");function l_(){let r={},e=A.$version;for(let t in A.$root){let i=A.$root[t];if(i.required){let n=null;t==="version"?n=e:i.type==="array"?n=[]:n={},n!=null&&(r[t]=n)}}return r}l(l_,"emptyStyle");function u_(r){let e=r.key,t=r.value;return t?[new B(e,t,"constants have been deprecated as of v8")]:[]}l(u_,"validateConstants");function Ue(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}l(Ue,"unbundle");function ti(r){if(Array.isArray(r))return r.map(ti);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){let e={};for(let t in r)e[t]=ti(r[t]);return e}return Ue(r)}l(ti,"deepUnbundle");function It(r){let e=r.key,t=r.value,i=r.valueSpec||{},n=r.objectElementValidators||{},o=r.style,a=r.styleSpec,s=r.validateSpec,u=[],c=xe(t);if(c!=="object")return[new B(e,t,"object expected, ".concat(c," found"))];for(let p in t){let h=p.split(".")[0],f=i[h]||i["*"],m;if(n[h])m=n[h];else if(i[h])m=s;else if(n["*"])m=n["*"];else if(i["*"])m=s;else{u.push(new B(e,t[p],'unknown property "'.concat(p,'"')));continue}u=u.concat(m({key:(e&&"".concat(e,"."))+p,value:t[p],valueSpec:f,style:o,styleSpec:a,object:t,objectKey:p,validateSpec:s},t))}for(let p in i)n[p]||i[p].required&&i[p].default===void 0&&t[p]===void 0&&u.push(new B(e,t,'missing required property "'.concat(p,'"')));return u}l(It,"validateObject");function hh(r){let e=r.value,t=r.valueSpec,i=r.validateSpec,n=r.style,o=r.styleSpec,a=r.key,s=r.arrayElementValidator||i;if(xe(e)!=="array")return[new B(a,e,"array expected, ".concat(xe(e)," found"))];if(t.length&&e.length!==t.length)return[new B(a,e,"array length ".concat(t.length," expected, length ").concat(e.length," found"))];if(t["min-length"]&&e.length<t["min-length"])return[new B(a,e,"array length at least ".concat(t["min-length"]," expected, length ").concat(e.length," found"))];let u={type:t.value,values:t.values};o.$version<7&&(u.function=t.function),xe(t.value)==="object"&&(u=t.value);let c=[];for(let p=0;p<e.length;p++)c=c.concat(s({array:e,arrayIndex:p,value:e[p],valueSpec:u,validateSpec:r.validateSpec,style:n,styleSpec:o,key:"".concat(a,"[").concat(p,"]")}));return c}l(hh,"validateArray");function fh(r){let e=r.key,t=r.value,i=r.valueSpec,n=xe(t);return n==="number"&&t!==t&&(n="NaN"),n!=="number"?[new B(e,t,"number expected, ".concat(n," found"))]:"minimum"in i&&t<i.minimum?[new B(e,t,"".concat(t," is less than the minimum value ").concat(i.minimum))]:"maximum"in i&&t>i.maximum?[new B(e,t,"".concat(t," is greater than the maximum value ").concat(i.maximum))]:[]}l(fh,"validateNumber");function c_(r){let e=r.valueSpec,t=Ue(r.value.type),i,n={},o,a,s=t!=="categorical"&&r.value.property===void 0,u=!s,c=xe(r.value.stops)==="array"&&xe(r.value.stops[0])==="array"&&xe(r.value.stops[0][0])==="object",p=It({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:h,default:y}});return t==="identity"&&s&&p.push(new B(r.key,r.value,'missing required property "property"')),t!=="identity"&&!r.value.stops&&p.push(new B(r.key,r.value,'missing required property "stops"')),t==="exponential"&&r.valueSpec.expression&&!uh(r.valueSpec)&&p.push(new B(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(u&&!_r(r.valueSpec)?p.push(new B(r.key,r.value,"property functions not supported")):s&&!i_(r.valueSpec)&&p.push(new B(r.key,r.value,"zoom functions not supported"))),(t==="categorical"||c)&&r.value.property===void 0&&p.push(new B(r.key,r.value,'"property" property is required')),p;function h(g){if(t==="identity")return[new B(g.key,g.value,'identity function may not have a "stops" property')];let x=[],b=g.value;return x=x.concat(hh({key:g.key,value:b,valueSpec:g.valueSpec,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec,arrayElementValidator:f})),xe(b)==="array"&&b.length===0&&x.push(new B(g.key,b,"array must have at least one stop")),x}l(h,"validateFunctionStops");function f(g){let x=[],b=g.value,w=g.key;if(xe(b)!=="array")return[new B(w,b,"array expected, ".concat(xe(b)," found"))];if(b.length!==2)return[new B(w,b,"array length 2 expected, length ".concat(b.length," found"))];if(c){if(xe(b[0])!=="object")return[new B(w,b,"object expected, ".concat(xe(b[0])," found"))];if(b[0].zoom===void 0)return[new B(w,b,"object stop key must have zoom")];if(b[0].value===void 0)return[new B(w,b,"object stop key must have value")];if(a&&a>Ue(b[0].zoom))return[new B(w,b[0].zoom,"stop zoom values must appear in ascending order")];Ue(b[0].zoom)!==a&&(a=Ue(b[0].zoom),o=void 0,n={}),x=x.concat(It({key:"".concat(w,"[0]"),value:b[0],valueSpec:{zoom:{}},validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{zoom:fh,value:m}}))}else x=x.concat(m({key:"".concat(w,"[0]"),value:b[0],valueSpec:{},validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec},b));return ni(ti(b[1]))?x.concat([new B("".concat(w,"[1]"),b[1],"expressions are not allowed in function stops.")]):x.concat(g.validateSpec({key:"".concat(w,"[1]"),value:b[1],valueSpec:e,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec}))}l(f,"validateFunctionStop");function m(g,x){let b=xe(g.value),w=Ue(g.value),_=g.value!==null?g.value:x;if(!i)i=b;else if(b!==i)return[new B(g.key,_,"".concat(b," stop domain type must match previous stop domain type ").concat(i))];if(b!=="number"&&b!=="string"&&b!=="boolean")return[new B(g.key,_,"stop domain value must be a number, string, or boolean")];if(b!=="number"&&t!=="categorical"){let S="number expected, ".concat(b," found");return _r(e)&&t===void 0&&(S+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new B(g.key,_,S)]}return t==="categorical"&&b==="number"&&(!isFinite(w)||Math.floor(w)!==w)?[new B(g.key,_,"integer expected, found ".concat(w))]:t!=="categorical"&&b==="number"&&o!==void 0&&w<o?[new B(g.key,_,"stop domain values must appear in ascending order")]:(o=w,t==="categorical"&&w in n?[new B(g.key,_,"stop domain values must be unique")]:(n[w]=!0,[]))}l(m,"validateStopDomainValue");function y(g){return g.validateSpec({key:g.key,value:g.value,valueSpec:e,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec})}l(y,"validateFunctionDefault")}l(c_,"validateFunction");function qi(r){let e=(r.expressionContext==="property"?o_:ch)(ti(r.value),r.valueSpec);if(e.result==="error")return e.value.map(i=>new B("".concat(r.key).concat(i.key),r.value,i.message));let t=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!t.outputDefined())return[new B(r.key,r.value,'Invalid data expression for "'.concat(r.propertyKey,'". Output values must be contained as literals within the expression.'))];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!to(t))return[new B(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!to(t))return[new B(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!tl(t,["zoom","feature-state"]))return[new B(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!el(t))return[new B(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}l(qi,"validateExpression");function KT(r){let e=r.value,t=r.key,i=xe(e);return i!=="boolean"?[new B(t,e,"boolean expected, ".concat(i," found"))]:[]}l(KT,"validateBoolean");function JT(r){let e=r.key,t=r.value,i=xe(t);return i!=="string"?[new B(e,t,"color expected, ".concat(i," found"))]:X.parse(String(t))?[]:[new B(e,t,'color expected, "'.concat(t,'" found'))]}l(JT,"validateColor");function io(r){let e=r.key,t=r.value,i=r.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Ue(t))===-1&&n.push(new B(e,t,"expected one of [".concat(i.values.join(", "),"], ").concat(JSON.stringify(t)," found"))):Object.keys(i.values).indexOf(Ue(t))===-1&&n.push(new B(e,t,"expected one of [".concat(Object.keys(i.values).join(", "),"], ").concat(JSON.stringify(t)," found"))),n}l(io,"validateEnum");function mh(r){return ph(ti(r.value))?qi(Ni({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):p_(r)}l(mh,"validateFilter");function p_(r){let e=r.value,t=r.key;if(xe(e)!=="array")return[new B(t,e,"array expected, ".concat(xe(e)," found"))];let i=r.styleSpec,n,o=[];if(e.length<1)return[new B(t,e,"filter array must have at least 1 element")];switch(o=o.concat(io({key:"".concat(t,"[0]"),value:e[0],valueSpec:i.filter_operator,style:r.style,styleSpec:r.styleSpec})),Ue(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ue(e[1])==="$type"&&o.push(new B(t,e,'"$type" cannot be use with operator "'.concat(e[0],'"')));case"==":case"!=":e.length!==3&&o.push(new B(t,e,'filter array for operator "'.concat(e[0],'" must have 3 elements')));case"in":case"!in":e.length>=2&&(n=xe(e[1]),n!=="string"&&o.push(new B("".concat(t,"[1]"),e[1],"string expected, ".concat(n," found"))));for(let a=2;a<e.length;a++)n=xe(e[a]),Ue(e[1])==="$type"?o=o.concat(io({key:"".concat(t,"[").concat(a,"]"),value:e[a],valueSpec:i.geometry_type,style:r.style,styleSpec:r.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&o.push(new B("".concat(t,"[").concat(a,"]"),e[a],"string, number, or boolean expected, ".concat(n," found")));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(p_({key:"".concat(t,"[").concat(a,"]"),value:e[a],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":n=xe(e[1]),e.length!==2?o.push(new B(t,e,'filter array for "'.concat(e[0],'" operator must have 2 elements'))):n!=="string"&&o.push(new B("".concat(t,"[1]"),e[1],"string expected, ".concat(n," found")));break}return o}l(p_,"validateNonExpressionFilter");function h_(r,e){let t=r.key,i=r.validateSpec,n=r.style,o=r.styleSpec,a=r.value,s=r.objectKey,u=o["".concat(e,"_").concat(r.layerType)];if(!u)return[];let c=s.match(/^(.*)-transition$/);if(e==="paint"&&c&&u[c[1]]&&u[c[1]].transition)return i({key:t,value:a,valueSpec:o.transition,style:n,styleSpec:o});let p=r.valueSpec||u[s];if(!p)return[new B(t,a,'unknown property "'.concat(s,'"'))];let h;if(xe(a)==="string"&&_r(p)&&!p.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new B(t,a,'"'.concat(s,'" does not support interpolation syntax\n')+'Use an identity property function instead: `{ "type": "identity", "property": '.concat(JSON.stringify(h[1])," }`."))];let f=[];return r.layerType==="symbol"&&(s==="text-field"&&n&&!n.glyphs&&f.push(new B(t,a,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&rl(ti(a))&&Ue(a.type)==="identity"&&f.push(new B(t,a,'"text-font" does not support identity functions'))),f.concat(i({key:r.key,value:a,valueSpec:p,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}l(h_,"validateProperty");function f_(r){return h_(r,"paint")}l(f_,"validatePaintProperty");function m_(r){return h_(r,"layout")}l(m_,"validateLayoutProperty");function d_(r){let e=[],t=r.value,i=r.key,n=r.style,o=r.styleSpec;!t.type&&!t.ref&&e.push(new B(i,t,'either "type" or "ref" is required'));let a=Ue(t.type),s=Ue(t.ref);if(t.id){let u=Ue(t.id);for(let c=0;c<r.arrayIndex;c++){let p=n.layers[c];Ue(p.id)===u&&e.push(new B(i,t.id,'duplicate layer id "'.concat(t.id,'", previously used at line ').concat(p.id.__line__)))}}if("ref"in t){["type","source","source-layer","filter","layout"].forEach(c=>{c in t&&e.push(new B(i,t[c],'"'.concat(c,'" is prohibited for ref layers')))});let u;n.layers.forEach(c=>{Ue(c.id)===s&&(u=c)}),u?u.ref?e.push(new B(i,t.ref,"ref cannot reference another ref layer")):a=Ue(u.type):e.push(new B(i,t.ref,'ref layer "'.concat(s,'" not found')))}else if(a!=="background")if(!t.source)e.push(new B(i,t,'missing required property "source"'));else{let u=n.sources&&n.sources[t.source],c=u&&Ue(u.type);u?c==="vector"&&a==="raster"?e.push(new B(i,t.source,'layer "'.concat(t.id,'" requires a raster source'))):c!=="raster-dem"&&a==="hillshade"?e.push(new B(i,t.source,'layer "'.concat(t.id,'" requires a raster-dem source'))):c==="raster"&&a!=="raster"?e.push(new B(i,t.source,'layer "'.concat(t.id,'" requires a vector source'))):c==="vector"&&!t["source-layer"]?e.push(new B(i,t,'layer "'.concat(t.id,'" must specify a "source-layer"'))):c==="raster-dem"&&a!=="hillshade"?e.push(new B(i,t.source,"raster-dem source can only be used with layer type 'hillshade'.")):a==="line"&&t.paint&&t.paint["line-gradient"]&&(c!=="geojson"||!u.lineMetrics)&&e.push(new B(i,t,'layer "'.concat(t.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):e.push(new B(i,t.source,'source "'.concat(t.source,'" not found')))}return e=e.concat(It({key:i,value:t,valueSpec:o.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*"(){return[]},type(){return r.validateSpec({key:"".concat(i,".type"),value:t.type,valueSpec:o.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:t,objectKey:"type"})},filter:mh,layout(u){return It({layer:t,key:u.key,value:u.value,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*"(c){return m_(Ni({layerType:a},c))}}})},paint(u){return It({layer:t,key:u.key,value:u.value,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*"(c){return f_(Ni({layerType:a},c))}}})}}})),e}l(d_,"validateLayer");function ri(r){let e=r.value,t=r.key,i=xe(e);return i!=="string"?[new B(t,e,"string expected, ".concat(i," found"))]:[]}l(ri,"validateString");function YT(r){var e;let t=(e=r.sourceName)!==null&&e!==void 0?e:"",i=r.value,n=r.styleSpec,o=n.source_raster_dem,a=r.style,s=[],u=xe(i);if(i===void 0)return s;if(u!=="object")return s.push(new B("source_raster_dem",i,"object expected, ".concat(u," found"))),s;let p=Ue(i.encoding)==="custom",h=["redFactor","greenFactor","blueFactor","baseShift"],f=r.value.encoding?'"'.concat(r.value.encoding,'"'):"Default";for(let m in i)!p&&h.includes(m)?s.push(new B(m,i[m],'In "'.concat(t,'": "').concat(m,'" is only valid when "encoding" is set to "custom". ').concat(f," encoding found"))):o[m]?s=s.concat(r.validateSpec({key:m,value:i[m],valueSpec:o[m],validateSpec:r.validateSpec,style:a,styleSpec:n})):s.push(new B(m,i[m],'unknown property "'.concat(m,'"')));return s}l(YT,"validateRasterDEMSource");var Bb={promoteId:QT};function y_(r){let e=r.value,t=r.key,i=r.styleSpec,n=r.style,o=r.validateSpec;if(!e.type)return[new B(t,e,'"type" is required')];let a=Ue(e.type),s;switch(a){case"vector":case"raster":return s=It({key:t,value:e,valueSpec:i["source_".concat(a.replace("-","_"))],style:r.style,styleSpec:i,objectElementValidators:Bb,validateSpec:o}),s;case"raster-dem":return s=YT({sourceName:t,value:e,style:r.style,styleSpec:i,validateSpec:o}),s;case"geojson":if(s=It({key:t,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:o,objectElementValidators:Bb}),e.cluster)for(let u in e.clusterProperties){let[c,p]=e.clusterProperties[u],h=typeof c=="string"?[c,["accumulated"],["get",u]]:c;s.push(...qi({key:"".concat(t,".").concat(u,".map"),value:p,validateSpec:o,expressionContext:"cluster-map"})),s.push(...qi({key:"".concat(t,".").concat(u,".reduce"),value:h,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return It({key:t,value:e,valueSpec:i.source_video,style:n,validateSpec:o,styleSpec:i});case"image":return It({key:t,value:e,valueSpec:i.source_image,style:n,validateSpec:o,styleSpec:i});case"canvas":return[new B(t,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return io({key:"".concat(t,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:o,styleSpec:i})}}l(y_,"validateSource");function QT({key:r,value:e}){if(xe(e)==="string")return ri({key:r,value:e});{let t=[];for(let i in e)t.push(...ri({key:"".concat(r,".").concat(i),value:e[i]}));return t}}l(QT,"validatePromoteId");function g_(r){let e=r.value,t=r.styleSpec,i=t.light,n=r.style,o=[],a=xe(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new B("light",e,"object expected, ".concat(a," found"))]),o;for(let s in e){let u=s.match(/^(.*)-transition$/);u&&i[u[1]]&&i[u[1]].transition?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:t.transition,validateSpec:r.validateSpec,style:n,styleSpec:t})):i[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],validateSpec:r.validateSpec,style:n,styleSpec:t})):o=o.concat([new B(s,e[s],'unknown property "'.concat(s,'"'))])}return o}l(g_,"validateLight");function x_(r){let e=r.value,t=r.styleSpec,i=t.sky,n=r.style,o=xe(e);if(e===void 0)return[];if(o!=="object")return[new B("sky",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)i[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:t})):a=a.concat([new B(s,e[s],'unknown property "'.concat(s,'"'))]);return a}l(x_,"validateSky");function b_(r){let e=r.value,t=r.styleSpec,i=t.terrain,n=r.style,o=[],a=xe(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new B("terrain",e,"object expected, ".concat(a," found"))]),o;for(let s in e)i[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],validateSpec:r.validateSpec,style:n,styleSpec:t})):o=o.concat([new B(s,e[s],'unknown property "'.concat(s,'"'))]);return o}l(b_,"validateTerrain");function eM(r){return ri(r).length===0?[]:qi(r)}l(eM,"validateFormatted");function tM(r){return ri(r).length===0?[]:qi(r)}l(tM,"validateImage");function rM(r){let e=r.key,t=r.value;if(xe(t)==="array"){if(t.length<1||t.length>4)return[new B(e,t,"padding requires 1 to 4 values; ".concat(t.length," values found"))];let n={type:"number"},o=[];for(let a=0;a<t.length;a++)o=o.concat(r.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:t[a],validateSpec:r.validateSpec,valueSpec:n}));return o}else return fh({key:e,value:t,valueSpec:{}})}l(rM,"validatePadding");function iM(r){let e=r.key,t=r.value,i=xe(t),n=r.styleSpec;if(i!=="array"||t.length<1||t.length%2!==0)return[new B(e,t,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<t.length;a+=2)o=o.concat(io({key:"".concat(e,"[").concat(a,"]"),value:t[a],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(hh({key:"".concat(e,"[").concat(a+1,"]"),value:t[a+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:n}));return o}l(iM,"validateVariableAnchorOffsetCollection");function __(r){let e=[],t=r.value,i=r.key;if(Array.isArray(t)){let n=[],o=[];for(let a in t){t[a].id&&n.includes(t[a].id)&&e.push(new B(i,t,"all the sprites' ids must be unique, but ".concat(t[a].id," is duplicated"))),n.push(t[a].id),t[a].url&&o.includes(t[a].url)&&e.push(new B(i,t,"all the sprites' URLs must be unique, but ".concat(t[a].url," is duplicated"))),o.push(t[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(It({key:"".concat(i,"[").concat(a,"]"),value:t[a],valueSpec:s,validateSpec:r.validateSpec}))}return e}else return ri({key:i,value:t})}l(__,"validateSprite");function nM(r){let e=r.value,t=r.styleSpec,i=t.projection,n=r.style,o=xe(e);if(e===void 0)return[];if(o!=="object")return[new B("projection",e,"object expected, ".concat(o," found"))];let a=[];for(let s in e)i[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:t})):a=a.concat([new B(s,e[s],'unknown property "'.concat(s,'"'))]);return a}l(nM,"validateProjection");var Ob={"*"(){return[]},array:hh,boolean:KT,number:fh,color:JT,constants:u_,enum:io,filter:mh,function:c_,layer:d_,object:It,source:y_,light:g_,sky:x_,terrain:b_,projection:nM,string:ri,formatted:eM,resolvedImage:tM,padding:rM,variableAnchorOffsetCollection:iM,sprite:__};function Vn(r){let e=r.value,t=r.valueSpec,i=r.styleSpec;return r.validateSpec=Vn,t.expression&&rl(Ue(e))?c_(r):t.expression&&ni(ti(e))?qi(r):t.type&&Ob[t.type]?Ob[t.type](r):It(Ni({},r,{valueSpec:t.type?i[t.type]:t}))}l(Vn,"validate");function v_(r){let e=r.value,t=r.key,i=ri(r);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new B(t,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&i.push(new B(t,e,'"glyphs" url must include a "{range}" token'))),i}l(v_,"validateGlyphsUrl");function Et(r,e=A){let t=[];return t=t.concat(Vn({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:Vn,objectElementValidators:{glyphs:v_,"*"(){return[]}}})),r.constants&&(t=t.concat(u_({key:"constants",value:r.constants,style:r,styleSpec:e,validateSpec:Vn}))),w_(t)}l(Et,"validateStyleMin");Et.source=qt(Gt(y_));Et.sprite=qt(Gt(__));Et.glyphs=qt(Gt(v_));Et.light=qt(Gt(g_));Et.sky=qt(Gt(x_));Et.terrain=qt(Gt(b_));Et.layer=qt(Gt(d_));Et.filter=qt(Gt(mh));Et.paintProperty=qt(Gt(f_));Et.layoutProperty=qt(Gt(m_));function Gt(r){return function(e){return r(Zr(Vt({},e),{validateSpec:Vn}))}}l(Gt,"injectValidateSpec");function w_(r){return[].concat(r).sort((e,t)=>e.line-t.line)}l(w_,"sortErrors");function qt(r){return function(...e){return w_(r.apply(this,e))}}l(qt,"wrapCleanErrors");d();var Ne=Et,Gz=Ne.source,S_=Ne.light,qz=Ne.terrain,jz=Ne.filter,P_=Ne.paintProperty,T_=Ne.layoutProperty;function Wi(r,e){let t=!1;if(e&&e.length)for(let i of e)r.fire(new H(new Error(i.message))),t=!0;return t}l(Wi,"emitValidationErrors");d();d();d();var il=class il{constructor(e,t,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],t=a[1],i=a[2],this.d=t+2*i;for(let c=0;c<this.d*this.d;c++){let p=a[3+c],h=a[3+c+1];n.push(p===h?null:a.subarray(p,h))}let s=a[3+n.length],u=a[3+n.length+1];this.keys=a.subarray(s,u),this.bboxes=a.subarray(u),this.insert=this._insertReadonly}else{this.d=t+2*i;for(let a=0;a<this.d*this.d;a++)n.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;let o=i/t*e;this.min=-o,this.max=e+o}insert(e,t,i,n,o){this._forEachCell(t,i,n,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,i,n,o,a){this.cells[o].push(a)}query(e,t,i,n,o){let a=this.min,s=this.max;if(e<=a&&t<=a&&s<=i&&s<=n&&!o)return Array.prototype.slice.call(this.keys);{let u=[],c={};return this._forEachCell(e,t,i,n,this._queryCell,u,c,o),u}}_queryCell(e,t,i,n,o,a,s,u){let c=this.cells[o];if(c!==null){let p=this.keys,h=this.bboxes;for(let f=0;f<c.length;f++){let m=c[f];if(s[m]===void 0){let y=m*4;(u?u(h[y+0],h[y+1],h[y+2],h[y+3]):e<=h[y+2]&&t<=h[y+3]&&i>=h[y+0]&&n>=h[y+1])?(s[m]=!0,a.push(p[m])):s[m]=!1}}}}_forEachCell(e,t,i,n,o,a,s,u){let c=this._convertToCellCoord(e),p=this._convertToCellCoord(t),h=this._convertToCellCoord(i),f=this._convertToCellCoord(n);for(let m=c;m<=h;m++)for(let y=p;y<=f;y++){let g=this.d*y+m;if(!(u&&!u(this._convertFromCellCoord(m),this._convertFromCellCoord(y),this._convertFromCellCoord(m+1),this._convertFromCellCoord(y+1)))&&o.call(this,e,t,i,n,g,a,s,u))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,t=3+this.cells.length+1+1,i=0;for(let a=0;a<this.cells.length;a++)i+=this.cells[a].length;let n=new Int32Array(t+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let o=t;for(let a=0;a<e.length;a++){let s=e[a];n[3+a]=o,n.set(s,o),o+=s.length}return n[3+e.length]=o,n.set(this.keys,o),o+=this.keys.length,n[3+e.length+1]=o,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer}static serialize(e,t){let i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}}static deserialize(e){return new il(e.buffer)}};l(il,"TransferableGridIndex");var oi=il;var Sr={};function N(r,e,t={}){if(Sr[r])throw new Error("".concat(r," is already registered."));Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),Sr[r]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}l(N,"register");N("Object",Object);N("TransferableGridIndex",oi);N("Color",X);N("Error",Error);N("AJAXError",$r);N("ResolvedImage",ft);N("StylePropertyFunction",ro);N("StyleExpression",ei,{omit:["_evaluator"]});N("ZoomDependentExpression",wr);N("ZoomConstantExpression",vr);N("CompoundExpression",Nt,{omit:["_evaluate"]});for(let r in ii)ii[r]._classRegistryKey||N("Expression_".concat(r),ii[r]);function M_(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}l(M_,"isArrayBuffer");function Xi(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error)return r;if(M_(r)||ht(r))return e&&e.push(r),r;if(ArrayBuffer.isView(r)){let t=r;return e&&e.push(t.buffer),t}if(r instanceof ImageData)return e&&e.push(r.data.buffer),r;if(Array.isArray(r)){let t=[];for(let i of r)t.push(Xi(i,e));return t}if(typeof r=="object"){let t=r.constructor,i=t._classRegistryKey;if(!i)throw new Error("can't serialize object of unregistered class ".concat(t.name));if(!Sr[i])throw new Error("".concat(i," is not registered."));let n=t.serialize?t.serialize(r,e):{};if(t.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let o in r){if(!r.hasOwnProperty(o)||Sr[i].omit.indexOf(o)>=0)continue;let a=r[o];n[o]=Sr[i].shallow.indexOf(o)>=0?a:Xi(a,e)}r instanceof Error&&(n.message=r.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(n.$name=i),n}throw new Error("can't serialize object of type ".concat(typeof r))}l(Xi,"serialize");function Ki(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||M_(r)||ht(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(Ki);if(typeof r=="object"){let e=r.$name||"Object";if(!Sr[e])throw new Error("can't deserialize unregistered class ".concat(e));let{klass:t}=Sr[e];if(!t)throw new Error("can't deserialize unregistered class ".concat(e));if(t.deserialize)return t.deserialize(r);let i=Object.create(t.prototype);for(let n of Object.keys(r)){if(n==="$name")continue;let o=r[n];i[n]=Sr[e].shallow.indexOf(n)>=0?o:Ki(o)}return i}throw new Error("can't deserialize object of type ".concat(typeof r))}l(Ki,"deserialize");d();d();var Mh=class Mh{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)}};l(Mh,"ZoomHistory");var Ji=Mh;d();d();var he={"Latin-1 Supplement":l(r=>r>=128&&r<=255,"Latin-1 Supplement"),Arabic:l(r=>r>=1536&&r<=1791,"Arabic"),"Arabic Supplement":l(r=>r>=1872&&r<=1919,"Arabic Supplement"),"Arabic Extended-A":l(r=>r>=2208&&r<=2303,"Arabic Extended-A"),"Hangul Jamo":l(r=>r>=4352&&r<=4607,"Hangul Jamo"),"Unified Canadian Aboriginal Syllabics":l(r=>r>=5120&&r<=5759,"Unified Canadian Aboriginal Syllabics"),Khmer:l(r=>r>=6016&&r<=6143,"Khmer"),"Unified Canadian Aboriginal Syllabics Extended":l(r=>r>=6320&&r<=6399,"Unified Canadian Aboriginal Syllabics Extended"),"General Punctuation":l(r=>r>=8192&&r<=8303,"General Punctuation"),"Letterlike Symbols":l(r=>r>=8448&&r<=8527,"Letterlike Symbols"),"Number Forms":l(r=>r>=8528&&r<=8591,"Number Forms"),"Miscellaneous Technical":l(r=>r>=8960&&r<=9215,"Miscellaneous Technical"),"Control Pictures":l(r=>r>=9216&&r<=9279,"Control Pictures"),"Optical Character Recognition":l(r=>r>=9280&&r<=9311,"Optical Character Recognition"),"Enclosed Alphanumerics":l(r=>r>=9312&&r<=9471,"Enclosed Alphanumerics"),"Geometric Shapes":l(r=>r>=9632&&r<=9727,"Geometric Shapes"),"Miscellaneous Symbols":l(r=>r>=9728&&r<=9983,"Miscellaneous Symbols"),"Miscellaneous Symbols and Arrows":l(r=>r>=11008&&r<=11263,"Miscellaneous Symbols and Arrows"),"CJK Radicals Supplement":l(r=>r>=11904&&r<=12031,"CJK Radicals Supplement"),"Kangxi Radicals":l(r=>r>=12032&&r<=12255,"Kangxi Radicals"),"Ideographic Description Characters":l(r=>r>=12272&&r<=12287,"Ideographic Description Characters"),"CJK Symbols and Punctuation":l(r=>r>=12288&&r<=12351,"CJK Symbols and Punctuation"),Hiragana:l(r=>r>=12352&&r<=12447,"Hiragana"),Katakana:l(r=>r>=12448&&r<=12543,"Katakana"),Bopomofo:l(r=>r>=12544&&r<=12591,"Bopomofo"),"Hangul Compatibility Jamo":l(r=>r>=12592&&r<=12687,"Hangul Compatibility Jamo"),Kanbun:l(r=>r>=12688&&r<=12703,"Kanbun"),"Bopomofo Extended":l(r=>r>=12704&&r<=12735,"Bopomofo Extended"),"CJK Strokes":l(r=>r>=12736&&r<=12783,"CJK Strokes"),"Katakana Phonetic Extensions":l(r=>r>=12784&&r<=12799,"Katakana Phonetic Extensions"),"Enclosed CJK Letters and Months":l(r=>r>=12800&&r<=13055,"Enclosed CJK Letters and Months"),"CJK Compatibility":l(r=>r>=13056&&r<=13311,"CJK Compatibility"),"CJK Unified Ideographs Extension A":l(r=>r>=13312&&r<=19903,"CJK Unified Ideographs Extension A"),"Yijing Hexagram Symbols":l(r=>r>=19904&&r<=19967,"Yijing Hexagram Symbols"),"CJK Unified Ideographs":l(r=>r>=19968&&r<=40959,"CJK Unified Ideographs"),"Yi Syllables":l(r=>r>=40960&&r<=42127,"Yi Syllables"),"Yi Radicals":l(r=>r>=42128&&r<=42191,"Yi Radicals"),"Hangul Jamo Extended-A":l(r=>r>=43360&&r<=43391,"Hangul Jamo Extended-A"),"Hangul Syllables":l(r=>r>=44032&&r<=55215,"Hangul Syllables"),"Hangul Jamo Extended-B":l(r=>r>=55216&&r<=55295,"Hangul Jamo Extended-B"),"Private Use Area":l(r=>r>=57344&&r<=63743,"Private Use Area"),"CJK Compatibility Ideographs":l(r=>r>=63744&&r<=64255,"CJK Compatibility Ideographs"),"Arabic Presentation Forms-A":l(r=>r>=64336&&r<=65023,"Arabic Presentation Forms-A"),"Vertical Forms":l(r=>r>=65040&&r<=65055,"Vertical Forms"),"CJK Compatibility Forms":l(r=>r>=65072&&r<=65103,"CJK Compatibility Forms"),"Small Form Variants":l(r=>r>=65104&&r<=65135,"Small Form Variants"),"Arabic Presentation Forms-B":l(r=>r>=65136&&r<=65279,"Arabic Presentation Forms-B"),"Halfwidth and Fullwidth Forms":l(r=>r>=65280&&r<=65519,"Halfwidth and Fullwidth Forms")};function Ah(r){for(let e of r)if(A_(e.charCodeAt(0)))return!0;return!1}l(Ah,"allowsVerticalWritingMode");function A_(r){return r===746||r===747?!0:r<4352?!1:!!(he["Bopomofo Extended"](r)||he.Bopomofo(r)||he["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||he["CJK Compatibility Ideographs"](r)||he["CJK Compatibility"](r)||he["CJK Radicals Supplement"](r)||he["CJK Strokes"](r)||he["CJK Symbols and Punctuation"](r)&&!(r>=12296&&r<=12305)&&!(r>=12308&&r<=12319)&&r!==12336||he["CJK Unified Ideographs Extension A"](r)||he["CJK Unified Ideographs"](r)||he["Enclosed CJK Letters and Months"](r)||he["Hangul Compatibility Jamo"](r)||he["Hangul Jamo Extended-A"](r)||he["Hangul Jamo Extended-B"](r)||he["Hangul Jamo"](r)||he["Hangul Syllables"](r)||he.Hiragana(r)||he["Ideographic Description Characters"](r)||he.Kanbun(r)||he["Kangxi Radicals"](r)||he["Katakana Phonetic Extensions"](r)||he.Katakana(r)&&r!==12540||he["Halfwidth and Fullwidth Forms"](r)&&r!==65288&&r!==65289&&r!==65293&&!(r>=65306&&r<=65310)&&r!==65339&&r!==65341&&r!==65343&&!(r>=65371&&r<=65503)&&r!==65507&&!(r>=65512&&r<=65519)||he["Small Form Variants"](r)&&!(r>=65112&&r<=65118)&&!(r>=65123&&r<=65126)||he["Unified Canadian Aboriginal Syllabics"](r)||he["Unified Canadian Aboriginal Syllabics Extended"](r)||he["Vertical Forms"](r)||he["Yijing Hexagram Symbols"](r)||he["Yi Syllables"](r)||he["Yi Radicals"](r))}l(A_,"charHasUprightVerticalOrientation");function I_(r){return r>=1424&&r<=2303||he["Arabic Presentation Forms-A"](r)||he["Arabic Presentation Forms-B"](r)}l(I_,"charInRTLScript");function oM(r,e){return!(!e&&I_(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||he.Khmer(r))}l(oM,"charInSupportedScript");function C_(r){for(let e of r)if(I_(e.charCodeAt(0)))return!0;return!1}l(C_,"stringContainsRTLText");function E_(r,e){for(let t of r)if(!oM(t.charCodeAt(0),e))return!1;return!0}l(E_,"isStringInSupportedScript");d();var Ch=class Ch{constructor(){this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};l(Ch,"RTLWorkerPlugin");var Ih=Ch,or=new Ih;var Eh=class Eh{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ji,this.transition={})}isSupportedScript(e){return E_(e,or.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}}};l(Eh,"EvaluationParameters");var ye=Eh;var kh=class kh{constructor(e,t){this.property=e,this.value=t,this.expression=a_(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}};l(kh,"PropertyValue");var Yi=kh,Lh=class Lh{constructor(e){this.property=e,this.value=new Yi(e,void 0)}transitioned(e,t){return new nl(this.property,this.value,t,V({},e.transition,this.transition),e.now)}untransitioned(){return new nl(this.property,this.value,null,{},0)}};l(Lh,"TransitionablePropertyValue");var lo=Lh,Dh=class Dh{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return pt(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new lo(this._values[e].property)),this._values[e].value=new Yi(this._values[e].property,t===null?void 0:pt(t))}getTransition(e){return pt(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new lo(this._values[e].property)),this._values[e].transition=pt(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 n=this.getTransition(t);n!==void 0&&(e["".concat(t,"-transition")]=n)}return e}transitioned(e,t){let i=new ol(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(e,t._values[n]);return i}untransitioned(){let e=new ol(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}};l(Dh,"Transitionable");var Qi=Dh,zh=class zh{constructor(e,t,i,n,o){this.property=e,this.value=t,this.begin=o+n.delay||0,this.end=this.begin+n.duration||0,e.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){let n=e.now||0,o=this.value.possiblyEvaluate(e,t,i),a=this.prior;if(a){if(n>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(n<this.begin)return a.possiblyEvaluate(e,t,i);{let s=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),o,Kx(s))}}else return o}};l(zh,"TransitioningPropertyValue");var nl=zh,Fh=class Fh{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let n=new Pr(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i);return n}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}};l(Fh,"Transitioning");var ol=Fh,Rh=class Rh{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return pt(this._values[e].value)}setValue(e,t){this._values[e]=new Yi(this._values[e].property,t===null?void 0:pt(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 n=new Pr(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i);return n}};l(Rh,"Layout");var al=Rh,Bh=class Bh{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,n){return this.property.evaluate(this.value,this.parameters,e,t,i,n)}};l(Bh,"PossiblyEvaluatedPropertyValue");var at=Bh,Oh=class Oh{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}};l(Oh,"PossiblyEvaluated");var Pr=Oh,Vh=class Vh{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 n=this.specification.type,o=Pe[n];return o?o(e,t,i):e}};l(Vh,"DataConstantProperty");var Z=Vh,Uh=class Uh{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,n){return e.expression.kind==="constant"||e.expression.kind==="camera"?new at(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,n)},t):new at(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 at(this,{kind:"constant",value:void 0},e.parameters);let n=this.specification.type,o=Pe[n];if(o){let a=o(e.value.value,t.value.value,i);return new at(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,t,i,n,o,a){return e.kind==="constant"?e.value:e.evaluate(t,i,n,o,a)}};l(Uh,"DataDrivenProperty");var $=Uh,Nh=class Nh extends ${possiblyEvaluate(e,t,i,n){if(e.value===void 0)return new at(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},i,n),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,u=this._calculate(s,s,s,t);return new at(this,{kind:"constant",value:u},t)}else if(e.expression.kind==="camera"){let o=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 at(this,{kind:"constant",value:o},t)}else return new at(this,e.expression,t)}evaluate(e,t,i,n,o,a){if(e.kind==="source"){let s=e.evaluate(t,i,n,o,a);return this._calculate(s,s,s,t)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,n),e.evaluate({zoom:Math.floor(t.zoom)},i,n),e.evaluate({zoom:Math.floor(t.zoom)+1},i,n),t):e.value}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}};l(Nh,"CrossFadedDataDrivenProperty");var ar=Nh,Gh=class Gh{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},i,n);return this._calculate(o,o,o,t)}else return this._calculate(e.expression.evaluate(new ye(Math.floor(t.zoom-1),t)),e.expression.evaluate(new ye(Math.floor(t.zoom),t)),e.expression.evaluate(new ye(Math.floor(t.zoom+1),t)),t)}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}};l(Gh,"CrossFadedProperty");var ai=Gh,qh=class qh{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){return!!e.expression.evaluate(t,null,{},i,n)}interpolate(){return!1}};l(qh,"ColorRampProperty");var si=qh,jh=class jh{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 n=this.defaultPropertyValues[t]=new Yi(i,void 0),o=this.defaultTransitionablePropertyValues[t]=new lo(i);this.defaultTransitioningPropertyValues[t]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=n.possiblyEvaluate({})}}};l(jh,"Properties");var De=jh;N("DataDrivenProperty",$);N("DataConstantProperty",Z);N("CrossFadedDataDrivenProperty",ar);N("CrossFadedProperty",ai);N("ColorRampProperty",si);var sl="-transition",Zh=class Zh extends de{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:l(()=>!0,"filter"),needGeometry:!1},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),t.layout&&(this._unevaluatedLayout=new al(t.layout)),t.paint)){this._transitionablePaint=new Qi(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 Pr(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){if(t!=null){let n="layers.".concat(this.id,".layout.").concat(e);if(this._validate(T_,n,e,t,i))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(sl)?this._transitionablePaint.getTransition(e.slice(0,-sl.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(t!=null){let n="layers.".concat(this.id,".paint.").concat(e);if(this._validate(P_,n,e,t,i))return!1}if(e.endsWith(sl))return this._transitionablePaint.setTransition(e.slice(0,-sl.length),t||void 0),!1;{let n=this._transitionablePaint._values[e],o=n.property.specification["property-type"]==="cross-faded-data-driven",a=n.value.isDataDriven(),s=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let u=this._transitionablePaint._values[e].value;return u.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,u)}}_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),os(e,(t,i)=>t!==void 0&&!(i==="layout"&&!Object.keys(t).length)&&!(i==="paint"&&!Object.keys(t).length))}_validate(e,t,i,n,o={}){return o&&o.validate===!1?!1:Wi(this,e.call(Ne,{key:t,layerType:this.type,objectKey:i,value:n,styleSpec:A,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 at)||!_r(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}};l(Zh,"StyleLayer");var Ge=Zh;d();d();d();var aM={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Hh=class Hh{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}};l(Hh,"Struct");var Tr=Hh,sM=128,lM=5,$h=class $h{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*lM),sM),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")}};l($h,"StructArray");var ze=$h;function _e(r,e=1){let t=0,i=0,n=r.map(a=>{let s=uM(a.type),u=t=k_(t,Math.max(e,s)),c=a.components||1;return i=Math.max(i,s),t+=s*c,{name:a.name,type:a.type,components:c,offset:u}}),o=k_(t,Math.max(i,e));return{members:n,size:o,alignment:e}}l(_e,"createLayout");function uM(r){return aM[r].BYTES_PER_ELEMENT}l(uM,"sizeOf");function k_(r,e){return Math.ceil(r/e)*e}l(k_,"align");var L_=ae(ge(),1);var Wh=class Wh extends ze{_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 n=e*2;return this.int16[n+0]=t,this.int16[n+1]=i,e}};l(Wh,"StructArrayLayout2i4");var li=Wh;li.prototype.bytesPerElement=4;N("StructArrayLayout2i4",li);var Xh=class Xh extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=n,e}};l(Xh,"StructArrayLayout3i6");var en=Xh;en.prototype.bytesPerElement=6;N("StructArrayLayout3i6",en);var Kh=class Kh extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=o,e}};l(Kh,"StructArrayLayout4i8");var uo=Kh;uo.prototype.bytesPerElement=8;N("StructArrayLayout4i8",uo);var Jh=class Jh extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let u=e*6;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=n,this.int16[u+3]=o,this.int16[u+4]=a,this.int16[u+5]=s,e}};l(Jh,"StructArrayLayout2i4i12");var co=Jh;co.prototype.bytesPerElement=12;N("StructArrayLayout2i4i12",co);var Yh=class Yh extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let u=e*4,c=e*8;return this.int16[u+0]=t,this.int16[u+1]=i,this.uint8[c+4]=n,this.uint8[c+5]=o,this.uint8[c+6]=a,this.uint8[c+7]=s,e}};l(Yh,"StructArrayLayout2i4ub8");var po=Yh;po.prototype.bytesPerElement=8;N("StructArrayLayout2i4ub8",po);var Qh=class Qh extends ze{_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 n=e*2;return this.float32[n+0]=t,this.float32[n+1]=i,e}};l(Qh,"StructArrayLayout2f8");var Mr=Qh;Mr.prototype.bytesPerElement=8;N("StructArrayLayout2f8",Mr);var ef=class ef extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,u,c,p){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,n,o,a,s,u,c,p)}emplace(e,t,i,n,o,a,s,u,c,p,h){let f=e*10;return this.uint16[f+0]=t,this.uint16[f+1]=i,this.uint16[f+2]=n,this.uint16[f+3]=o,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=u,this.uint16[f+7]=c,this.uint16[f+8]=p,this.uint16[f+9]=h,e}};l(ef,"StructArrayLayout10ui20");var ho=ef;ho.prototype.bytesPerElement=20;N("StructArrayLayout10ui20",ho);var tf=class tf extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,u,c,p,h,f){let m=this.length;return this.resize(m+1),this.emplace(m,e,t,i,n,o,a,s,u,c,p,h,f)}emplace(e,t,i,n,o,a,s,u,c,p,h,f,m){let y=e*12;return this.int16[y+0]=t,this.int16[y+1]=i,this.int16[y+2]=n,this.int16[y+3]=o,this.uint16[y+4]=a,this.uint16[y+5]=s,this.uint16[y+6]=u,this.uint16[y+7]=c,this.int16[y+8]=p,this.int16[y+9]=h,this.int16[y+10]=f,this.int16[y+11]=m,e}};l(tf,"StructArrayLayout4i4ui4i24");var fo=tf;fo.prototype.bytesPerElement=24;N("StructArrayLayout4i4ui4i24",fo);var rf=class rf extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,e}};l(rf,"StructArrayLayout3f12");var mo=rf;mo.prototype.bytesPerElement=12;N("StructArrayLayout3f12",mo);var nf=class nf extends ze{_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}};l(nf,"StructArrayLayout1ul4");var yo=nf;yo.prototype.bytesPerElement=4;N("StructArrayLayout1ul4",yo);var of=class of extends ze{_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,n,o,a,s,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,n,o,a,s,u,c)}emplace(e,t,i,n,o,a,s,u,c,p){let h=e*10,f=e*5;return this.int16[h+0]=t,this.int16[h+1]=i,this.int16[h+2]=n,this.int16[h+3]=o,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[f+3]=u,this.uint16[h+8]=c,this.uint16[h+9]=p,e}};l(of,"StructArrayLayout6i1ul2ui20");var go=of;go.prototype.bytesPerElement=20;N("StructArrayLayout6i1ul2ui20",go);var af=class af extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let u=e*6;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=n,this.int16[u+3]=o,this.int16[u+4]=a,this.int16[u+5]=s,e}};l(af,"StructArrayLayout2i2i2i12");var xo=af;xo.prototype.bytesPerElement=12;N("StructArrayLayout2i2i2i12",xo);var sf=class sf extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,o)}emplace(e,t,i,n,o,a){let s=e*4,u=e*8;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=n,this.int16[u+6]=o,this.int16[u+7]=a,e}};l(sf,"StructArrayLayout2f1f2i16");var bo=sf;bo.prototype.bytesPerElement=16;N("StructArrayLayout2f1f2i16",bo);var lf=class lf extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*12,s=e*3;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[s+1]=n,this.float32[s+2]=o,e}};l(lf,"StructArrayLayout2ub2f12");var _o=lf;_o.prototype.bytesPerElement=12;N("StructArrayLayout2ub2f12",_o);var uf=class uf extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=n,e}};l(uf,"StructArrayLayout3ui6");var tn=uf;tn.prototype.bytesPerElement=6;N("StructArrayLayout3ui6",tn);var cf=class cf extends ze{_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,n,o,a,s,u,c,p,h,f,m,y,g,x,b){let w=this.length;return this.resize(w+1),this.emplace(w,e,t,i,n,o,a,s,u,c,p,h,f,m,y,g,x,b)}emplace(e,t,i,n,o,a,s,u,c,p,h,f,m,y,g,x,b,w){let _=e*24,S=e*12,P=e*48;return this.int16[_+0]=t,this.int16[_+1]=i,this.uint16[_+2]=n,this.uint16[_+3]=o,this.uint32[S+2]=a,this.uint32[S+3]=s,this.uint32[S+4]=u,this.uint16[_+10]=c,this.uint16[_+11]=p,this.uint16[_+12]=h,this.float32[S+7]=f,this.float32[S+8]=m,this.uint8[P+36]=y,this.uint8[P+37]=g,this.uint8[P+38]=x,this.uint32[S+10]=b,this.int16[_+22]=w,e}};l(cf,"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48");var vo=cf;vo.prototype.bytesPerElement=48;N("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",vo);var pf=class pf extends ze{_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,n,o,a,s,u,c,p,h,f,m,y,g,x,b,w,_,S,P,T,L,C,E,I,R,z){let k=this.length;return this.resize(k+1),this.emplace(k,e,t,i,n,o,a,s,u,c,p,h,f,m,y,g,x,b,w,_,S,P,T,L,C,E,I,R,z)}emplace(e,t,i,n,o,a,s,u,c,p,h,f,m,y,g,x,b,w,_,S,P,T,L,C,E,I,R,z,k){let M=e*32,G=e*16;return this.int16[M+0]=t,this.int16[M+1]=i,this.int16[M+2]=n,this.int16[M+3]=o,this.int16[M+4]=a,this.int16[M+5]=s,this.int16[M+6]=u,this.int16[M+7]=c,this.uint16[M+8]=p,this.uint16[M+9]=h,this.uint16[M+10]=f,this.uint16[M+11]=m,this.uint16[M+12]=y,this.uint16[M+13]=g,this.uint16[M+14]=x,this.uint16[M+15]=b,this.uint16[M+16]=w,this.uint16[M+17]=_,this.uint16[M+18]=S,this.uint16[M+19]=P,this.uint16[M+20]=T,this.uint16[M+21]=L,this.uint16[M+22]=C,this.uint32[G+12]=E,this.float32[G+13]=I,this.float32[G+14]=R,this.uint16[M+30]=z,this.uint16[M+31]=k,e}};l(pf,"StructArrayLayout8i15ui1ul2f2ui64");var wo=pf;wo.prototype.bytesPerElement=64;N("StructArrayLayout8i15ui1ul2f2ui64",wo);var hf=class hf extends ze{_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}};l(hf,"StructArrayLayout1f4");var ui=hf;ui.prototype.bytesPerElement=4;N("StructArrayLayout1f4",ui);var ff=class ff extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*6,a=e*3;return this.uint16[o+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,e}};l(ff,"StructArrayLayout1ui2f12");var So=ff;So.prototype.bytesPerElement=12;N("StructArrayLayout1ui2f12",So);var mf=class mf extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*2,a=e*4;return this.uint32[o+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=n,e}};l(mf,"StructArrayLayout1ul2ui8");var Po=mf;Po.prototype.bytesPerElement=8;N("StructArrayLayout1ul2ui8",Po);var df=class df extends ze{_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 n=e*2;return this.uint16[n+0]=t,this.uint16[n+1]=i,e}};l(df,"StructArrayLayout2ui4");var To=df;To.prototype.bytesPerElement=4;N("StructArrayLayout2ui4",To);var yf=class yf extends ze{_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}};l(yf,"StructArrayLayout1ui2");var Mo=yf;Mo.prototype.bytesPerElement=2;N("StructArrayLayout1ui2",Mo);var gf=class gf extends ze{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,this.float32[a+3]=o,e}};l(gf,"StructArrayLayout4f16");var rn=gf;rn.prototype.bytesPerElement=16;N("StructArrayLayout4f16",rn);var xf=class xf extends Tr{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 L_.default(this.anchorPointX,this.anchorPointY)}};l(xf,"CollisionBoxStruct");var ll=xf;ll.prototype.size=20;var bf=class bf extends go{get(e){return new ll(this,e)}};l(bf,"CollisionBoxArray");var Ao=bf;N("CollisionBoxArray",Ao);var _f=class _f extends Tr{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]}};l(_f,"PlacedSymbolStruct");var ul=_f;ul.prototype.size=48;var vf=class vf extends vo{get(e){return new ul(this,e)}};l(vf,"PlacedSymbolArray");var Io=vf;N("PlacedSymbolArray",Io);var wf=class wf extends Tr{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]}};l(wf,"SymbolInstanceStruct");var cl=wf;cl.prototype.size=64;var Sf=class Sf extends wo{get(e){return new cl(this,e)}};l(Sf,"SymbolInstanceArray");var Co=Sf;N("SymbolInstanceArray",Co);var Pf=class Pf extends ui{getoffsetX(e){return this.float32[e*1+0]}};l(Pf,"GlyphOffsetArray");var Eo=Pf;N("GlyphOffsetArray",Eo);var Tf=class Tf extends en{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};l(Tf,"SymbolLineVertexArray");var ko=Tf;N("SymbolLineVertexArray",ko);var Mf=class Mf extends Tr{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]}};l(Mf,"TextAnchorOffsetStruct");var pl=Mf;pl.prototype.size=12;var Af=class Af extends So{get(e){return new pl(this,e)}};l(Af,"TextAnchorOffsetArray");var Lo=Af;N("TextAnchorOffsetArray",Lo);var If=class If extends Tr{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]}};l(If,"FeatureIndexStruct");var hl=If;hl.prototype.size=8;var Cf=class Cf extends Po{get(e){return new hl(this,e)}};l(Cf,"FeatureIndexArray");var Do=Cf;N("FeatureIndexArray",Do);var Ef=class Ef extends li{};l(Ef,"PosArray");var Ar=Ef,kf=class kf extends en{};l(kf,"Pos3dArray");var fl=kf,Lf=class Lf extends uo{};l(Lf,"RasterBoundsArray");var nn=Lf,Df=class Df extends li{};l(Df,"CircleLayoutArray");var ml=Df,zf=class zf extends li{};l(zf,"FillLayoutArray");var dl=zf,Ff=class Ff extends co{};l(Ff,"FillExtrusionLayoutArray");var yl=Ff;var Rf=class Rf extends po{};l(Rf,"LineLayoutArray");var gl=Rf,Bf=class Bf extends Mr{};l(Bf,"LineExtLayoutArray");var xl=Bf,Of=class Of extends ho{};l(Of,"PatternLayoutArray");var sr=Of,Vf=class Vf extends fo{};l(Vf,"SymbolLayoutArray");var bl=Vf,Uf=class Uf extends mo{};l(Uf,"SymbolDynamicLayoutArray");var _l=Uf,Nf=class Nf extends yo{};l(Nf,"SymbolOpacityArray");var vl=Nf,Gf=class Gf extends xo{};l(Gf,"CollisionBoxLayoutArray");var zo=Gf,qf=class qf extends bo{};l(qf,"CollisionCircleLayoutArray");var wl=qf,jf=class jf extends _o{};l(jf,"CollisionVertexArray");var Sl=jf,Zf=class Zf extends tn{};l(Zf,"QuadTriangleArray");var Pl=Zf,Hf=class Hf extends tn{};l(Hf,"TriangleIndexArray");var it=Hf,$f=class $f extends To{};l($f,"LineIndexArray");var Ir=$f,Wf=class Wf extends Mo{};l(Wf,"LineStripIndexArray");var Fo=Wf;d();var cM=_e([{name:"a_pos",components:2,type:"Int16"}],4);var{members:D_,size:nR,alignment:oR}=cM;d();var ci=class ci{constructor(e=[]){this.segments=e}prepareSegment(e,t,i,n){let o=this.segments[this.segments.length-1];return e>ci.MAX_VERTEX_ARRAY_LENGTH&&Le("Max vertices per segment is ".concat(ci.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(e)),(!o||o.vertexLength+e>ci.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==n)&&(o={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},n!==void 0&&(o.sortKey=n),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,n){return new ci([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};l(ci,"SegmentVector");var me=ci;me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;N("SegmentVector",me);d();d();function Xf(r,e){return r=Ae(Math.floor(r),0,255),e=Ae(Math.floor(e),0,255),256*r+e}l(Xf,"packUint8ToFloat");d();var Ro=_e([{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"}]);d();var O_=ae(Yf(),1);var Al=class Al{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,n){this.ids.push(B_(e)),this.positions.push(t,i,n)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let t=B_(e),i=0,n=this.ids.length-1;for(;i<n;){let a=i+n>>1;this.ids[a]>=t?n=a:i=a+1}let o=[];for(;this.ids[i]===t;){let a=this.positions[3*i],s=this.positions[3*i+1],u=this.positions[3*i+2];o.push({index:a,start:s,end:u}),i++}return o}static serialize(e,t){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Qf(i,n,0,i.length-1),t&&t.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let t=new Al;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}};l(Al,"FeaturePositionMap");var Bo=Al;function B_(r){let e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,O_.default)(String(r))}l(B_,"getNumericId");function Qf(r,e,t,i){for(;t<i;){let n=r[t+i>>1],o=t-1,a=i+1;for(;;){do o++;while(r[o]<n);do a--;while(r[a]>n);if(o>=a)break;Ml(r,o,a),Ml(e,3*o,3*a),Ml(e,3*o+1,3*a+1),Ml(e,3*o+2,3*a+2)}a-t<i-a?(Qf(r,e,t,a),t=a+1):(Qf(r,e,a+1,i),i=a)}}l(Qf,"sort");function Ml(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}l(Ml,"swap");N("FeaturePositionMap",Bo);d();var em=class em{constructor(e,t){this.gl=e.gl,this.location=t}};l(em,"Uniform");var lr=em,tm=class tm extends lr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}};l(tm,"Uniform1i");var Q=tm,rm=class rm extends lr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};l(rm,"Uniform1f");var U=rm,im=class im extends lr{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]))}};l(im,"Uniform2f");var te=im,nm=class nm extends lr{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]))}};l(nm,"Uniform3f");var lt=nm,om=class om extends lr{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]))}};l(om,"Uniform4f");var Cr=om,am=class am extends lr{constructor(e,t){super(e,t),this.current=X.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))}};l(am,"UniformColor");var kt=am,mM=new Float32Array(16),sm=class sm extends lr{constructor(e,t){super(e,t),this.current=mM}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}}};l(sm,"UniformMatrix4f");var re=sm;function lm(r){return[Xf(255*r.r,255*r.g),Xf(255*r.b,255*r.a)]}l(lm,"packColor");var um=class um{constructor(e,t,i){this.value=e,this.uniformNames=t.map(n=>"u_".concat(n)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return this.type==="color"?new kt(e,t):new U(e,t)}};l(um,"ConstantBinder");var pi=um,cm=class cm{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,n){let o=n==="u_pattern_to"?this.patternTo:n==="u_pattern_from"?this.patternFrom:n==="u_pixel_ratio_to"?this.pixelRatioTo:n==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,t,i){return i.substr(0,9)==="u_pattern"?new Cr(e,t):new U(e,t)}};l(cm,"CrossFadedConstantBinder");var Er=cm,pm=class pm{constructor(e,t,i,n){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:"a_".concat(o),type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,i,n,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new ye(0),t,{},n,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,t,i,n){let o=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(e,t,o)}_setPaintValue(e,t,i){if(this.type==="color"){let n=lm(i);for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,n[0],n[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,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()}};l(pm,"SourceExpressionBinder");var Bt=pm,hm=class hm{constructor(e,t,i,n,o,a){this.expression=e,this.uniformNames=t.map(s=>"u_".concat(s,"_t")),this.type=i,this.useIntegerZoom=n,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=t.map(s=>({name:"a_".concat(s),type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,i,n,o){let a=this.expression.evaluate(new ye(this.zoom),t,{},n,[],o),s=this.expression.evaluate(new ye(this.zoom+1),t,{},n,[],o),u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(u,e,a,s)}updatePaintArray(e,t,i,n){let o=this.expression.evaluate({zoom:this.zoom},i,n),a=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,i,n){if(this.type==="color"){let o=lm(i),a=lm(n);for(let s=e;s<t;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),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()}setUniform(e,t){let i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,n=Ae(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(n)}getBinding(e,t,i){return new U(e,t)}};l(hm,"CompositeExpressionBinder");var St=hm,fm=class fm{constructor(e,t,i,n,o,a){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=n,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,t,i){let n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(n,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,n,o){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(e,t,i,n){if(!n||!i)return;let{min:o,mid:a,max:s}=i,u=n[o],c=n[a],p=n[s];if(!(!u||!c||!p))for(let h=e;h<t;h++)this.zoomInPaintVertexArray.emplace(h,c.tl[0],c.tl[1],c.br[0],c.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],c.pixelRatio,u.pixelRatio),this.zoomOutPaintVertexArray.emplace(h,c.tl[0],c.tl[1],c.br[0],c.br[1],p.tl[0],p.tl[1],p.br[0],p.br[1],c.pixelRatio,p.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Ro.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Ro.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}};l(fm,"CrossFadedCompositeBinder");var jt=fm,mm=class mm{constructor(e,t,i){this.binders={},this._buffers=[];let n=[];for(let o in e.paint._values){if(!i(o))continue;let a=e.paint.get(o);if(!(a instanceof at)||!_r(a.property.specification))continue;let s=dM(o,e.type),u=a.value,c=a.property.specification.type,p=a.property.useIntegerZoom,h=a.property.specification["property-type"],f=h==="cross-faded"||h==="cross-faded-data-driven";if(u.kind==="constant")this.binders[o]=f?new Er(u.value,s):new pi(u.value,s,c),n.push("/u_".concat(o));else if(u.kind==="source"||f){let m=V_(o,c,"source");this.binders[o]=f?new jt(u,c,p,t,m,e.id):new Bt(u,s,c,m),n.push("/a_".concat(o))}else{let m=V_(o,c,"composite");this.binders[o]=new St(u,s,c,p,t,m),n.push("/z_".concat(o))}}this.cacheKey=n.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Bt||t instanceof St?t.maxValue:0}populatePaintArrays(e,t,i,n,o){for(let a in this.binders){let s=this.binders[a];(s instanceof Bt||s instanceof St||s instanceof jt)&&s.populatePaintArray(e,t,i,n,o)}}setConstantPatternPositions(e,t){for(let i in this.binders){let n=this.binders[i];n instanceof Er&&n.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,n,o){let a=!1;for(let s in e){let u=t.getPositions(s);for(let c of u){let p=i.feature(c.index);for(let h in this.binders){let f=this.binders[h];if((f instanceof Bt||f instanceof St||f instanceof jt)&&f.expression.isStateDependent===!0){let m=n.paint.get(h);f.expression=m.value,f.updatePaintArray(c.start,c.end,p,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof pi||i instanceof Er)&&e.push(...i.uniformNames.map(n=>"#define HAS_UNIFORM_".concat(n)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Bt||i instanceof St)for(let n=0;n<i.paintVertexAttributes.length;n++)e.push(i.paintVertexAttributes[n].name);else if(i instanceof jt)for(let n=0;n<Ro.members.length;n++)e.push(Ro.members[n].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof pi||i instanceof Er||i instanceof St)for(let n of i.uniformNames)e.push(n)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let i=[];for(let n in this.binders){let o=this.binders[n];if(o instanceof pi||o instanceof Er||o instanceof St){for(let a of o.uniformNames)if(t[a]){let s=o.getBinding(e,t[a],a);i.push({name:a,property:n,binding:s})}}}return i}setUniforms(e,t,i,n){for(let{name:o,property:a,binding:s}of t)this.binders[a].setUniform(s,n,i.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let i=this.binders[t];if(e&&i instanceof jt){let n=e.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;n&&this._buffers.push(n)}else(i instanceof Bt||i instanceof St)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof Bt||i instanceof St||i instanceof jt)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Bt||t instanceof St||t instanceof jt)&&t.destroy()}}};l(mm,"ProgramConfiguration");var Il=mm,dm=class dm{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let n of e)this.programConfigurations[n.id]=new Il(n,t,i);this.needsUpload=!1,this._featureMap=new Bo,this._bufferOffset=0}populatePaintArrays(e,t,i,n,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,t,n,o,a);t.id!==void 0&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,n){for(let o of i)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,t,o,n)||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()}};l(dm,"ProgramConfigurationSet");var mt=dm;function dM(r,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"]}[r]||[r.replace("".concat(e,"-"),"").replace(/-/g,"_")]}l(dM,"paintAttributeNames");function yM(r){return{"line-pattern":{source:sr,composite:sr},"fill-pattern":{source:sr,composite:sr},"fill-extrusion-pattern":{source:sr,composite:sr}}[r]}l(yM,"getLayoutException");function V_(r,e,t){let i={color:{source:Mr,composite:rn},number:{source:ui,composite:Mr}},n=yM(r);return n&&n[t]||i[e][t]}l(V_,"layoutType");N("ConstantBinder",pi);N("CrossFadedConstantBinder",Er);N("SourceExpressionBinder",Bt);N("CrossFadedCompositeBinder",jt);N("CompositeExpressionBinder",St);N("ProgramConfiguration",Il,{omit:["_buffers"]});N("ProgramConfigurationSet",mt);d();d();d();var gM=15,ym=Math.pow(2,gM-1)-1,U_=-ym-1;function dt(r){let e=8192/r.extent,t=r.loadGeometry();for(let i=0;i<t.length;i++){let n=t[i];for(let o=0;o<n.length;o++){let a=n[o],s=Math.round(a.x*e),u=Math.round(a.y*e);a.x=Ae(s,U_,ym),a.y=Ae(u,U_,ym),(s<a.x||s>a.x+1||u<a.y||u>a.y+1)&&Le("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return t}l(dt,"loadGeometry");d();function yt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?dt(r):[]}}l(yt,"toEvaluationFeature");function Cl(r,e,t,i,n){r.emplaceBack(e*2+(i+1)/2,t*2+(n+1)/2)}l(Cl,"addCircleVertex");var gm=class gm{constructor(e){this.zoom=e.zoom,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 ml,this.indexArray=new it,this.segments=new me,this.programConfigurations=new mt(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){let n=this.layers[0],o=[],a=null,s=!1;n.type==="circle"&&(a=n.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:u,id:c,index:p,sourceLayerIndex:h}of e){let f=this.layers[0]._featureFilter.needGeometry,m=yt(u,f);if(!this.layers[0]._featureFilter.filter(new ye(this.zoom),m,i))continue;let y=s?a.evaluate(m,{},i):void 0,g={id:c,properties:u.properties,type:u.type,sourceLayerIndex:h,index:p,geometry:f?m.geometry:dt(u),patterns:{},sortKey:y};o.push(g)}s&&o.sort((u,c)=>u.sortKey-c.sortKey);for(let u of o){let{geometry:c,index:p,sourceLayerIndex:h}=u,f=e[p].feature;this.addFeature(u,c,p,i),t.featureIndex.insert(f,c,p,h,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,D_),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,n){for(let o of t)for(let a of o){let s=a.x,u=a.y;if(s<0||s>=8192||u<0||u>=8192)continue;let c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),p=c.vertexLength;Cl(this.layoutVertexArray,s,u,-1,-1),Cl(this.layoutVertexArray,s,u,1,-1),Cl(this.layoutVertexArray,s,u,1,1),Cl(this.layoutVertexArray,s,u,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),c.vertexLength+=4,c.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},n)}};l(gm,"CircleBucket");var hi=gm;N("CircleBucket",hi,{omit:["layers"]});d();var Oo=ae(ge(),1);function El(r,e){for(let t=0;t<r.length;t++)if(on(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(on(r,e[t]))return!0;return!!bm(r,e)}l(El,"polygonIntersectsPolygon");function G_(r,e,t){return!!(on(r,e)||xm(e,r,t))}l(G_,"polygonIntersectsBufferedPoint");function kl(r,e){if(r.length===1)return N_(e,r[0]);for(let t=0;t<e.length;t++){let i=e[t];for(let n=0;n<i.length;n++)if(on(r,i[n]))return!0}for(let t=0;t<r.length;t++)if(N_(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(bm(r,e[t]))return!0;return!1}l(kl,"polygonIntersectsMultiPolygon");function q_(r,e,t){for(let i=0;i<e.length;i++){let n=e[i];if(r.length>=3){for(let o=0;o<n.length;o++)if(on(r,n[o]))return!0}if(xM(r,n,t))return!0}return!1}l(q_,"polygonIntersectsBufferedMultiLine");function xM(r,e,t){if(r.length>1){if(bm(r,e))return!0;for(let i=0;i<e.length;i++)if(xm(e[i],r,t))return!0}for(let i=0;i<r.length;i++)if(xm(r[i],e,t))return!0;return!1}l(xM,"lineIntersectsBufferedLine");function bm(r,e){if(r.length===0||e.length===0)return!1;for(let t=0;t<r.length-1;t++){let i=r[t],n=r[t+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(bM(i,n,a,s))return!0}}return!1}l(bm,"lineIntersectsLine");function bM(r,e,t,i){return tr(r,t,i)!==tr(e,t,i)&&tr(r,e,t)!==tr(r,e,i)}l(bM,"lineSegmentIntersectsLineSegment");function xm(r,e,t){let i=t*t;if(e.length===1)return r.distSqr(e[0])<i;for(let n=1;n<e.length;n++){let o=e[n-1],a=e[n];if(j_(r,o,a)<i)return!0}return!1}l(xm,"pointIntersectsBufferedLine");function j_(r,e,t){let i=e.distSqr(t);if(i===0)return r.distSqr(e);let n=((r.x-e.x)*(t.x-e.x)+(r.y-e.y)*(t.y-e.y))/i;return n<0?r.distSqr(e):n>1?r.distSqr(t):r.distSqr(t.sub(e)._mult(n)._add(e))}l(j_,"distToSegmentSquared");function N_(r,e){let t=!1,i,n,o;for(let a=0;a<r.length;a++){i=r[a];for(let s=0,u=i.length-1;s<i.length;u=s++)n=i[s],o=i[u],n.y>e.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(t=!t)}return t}l(N_,"multiPolygonContainsPoint");function on(r,e){let t=!1;for(let i=0,n=r.length-1;i<r.length;n=i++){let o=r[i],a=r[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(t=!t)}return t}l(on,"polygonContainsPoint");function Z_(r,e,t,i,n){for(let a of r)if(e<=a.x&&t<=a.y&&i>=a.x&&n>=a.y)return!0;let o=[new Oo.default(e,t),new Oo.default(e,n),new Oo.default(i,n),new Oo.default(i,t)];if(r.length>2){for(let a of o)if(on(r,a))return!0}for(let a=0;a<r.length-1;a++){let s=r[a],u=r[a+1];if(_M(s,u,o))return!0}return!1}l(Z_,"polygonIntersectsBox");function _M(r,e,t){let i=t[0],n=t[2];if(r.x<i.x&&e.x<i.x||r.x>n.x&&e.x>n.x||r.y<i.y&&e.y<i.y||r.y>n.y&&e.y>n.y)return!1;let o=tr(r,e,t[0]);return o!==tr(r,e,t[1])||o!==tr(r,e,t[2])||o!==tr(r,e,t[3])}l(_M,"edgeIntersectsBox");d();var Ll=ae(ge(),1);function fi(r,e,t){let i=e.paint.get(r).value;return i.kind==="constant"?i.value:t.programConfigurations.get(e.id).getMaxValue(r)}l(fi,"getMaximumPaintValue");function kr(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}l(kr,"translateDistance");function Lr(r,e,t,i,n){if(!e[0]&&!e[1])return r;let o=Ll.default.convert(e)._mult(n);t==="viewport"&&o._rotate(-i);let a=[];for(let s=0;s<r.length;s++){let u=r[s];a.push(u.sub(o))}return a}l(Lr,"translate");function H_(r,e){let t=[];for(let i=0;i<r.length;i++){let n=r[i],o=[];for(let a=0;a<n.length;a++){let s=n[a-1],u=n[a],c=n[a+1],p=a===0?new Ll.default(0,0):u.sub(s)._unit()._perp(),h=a===n.length-1?new Ll.default(0,0):c.sub(u)._unit()._perp(),f=p._add(h)._unit(),m=f.x*h.x+f.y*h.y;m!==0&&f._mult(1/m),o.push(f._mult(e)._add(u))}t.push(o)}return t}l(H_,"offsetLine");d();var $_,wM=l(()=>$_=$_||new De({"circle-sort-key":new $(A.layout_circle["circle-sort-key"])}),"getLayout"),W_,SM=l(()=>W_=W_||new De({"circle-radius":new $(A.paint_circle["circle-radius"]),"circle-color":new $(A.paint_circle["circle-color"]),"circle-blur":new $(A.paint_circle["circle-blur"]),"circle-opacity":new $(A.paint_circle["circle-opacity"]),"circle-translate":new Z(A.paint_circle["circle-translate"]),"circle-translate-anchor":new Z(A.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Z(A.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Z(A.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new $(A.paint_circle["circle-stroke-width"]),"circle-stroke-color":new $(A.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new $(A.paint_circle["circle-stroke-opacity"])}),"getPaint"),X_={get paint(){return SM()},get layout(){return wM()}};d();d();var oe=1e-6,we=typeof Float32Array<"u"?Float32Array:Array,Zt=Math.random;var U3=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var Vo={};Ci(Vo,{LDU:()=>UM,add:()=>NM,adjoint:()=>LM,clone:()=>TM,copy:()=>MM,create:()=>PM,determinant:()=>DM,equals:()=>qM,exactEquals:()=>GM,frob:()=>VM,fromRotation:()=>RM,fromScaling:()=>BM,fromValues:()=>IM,identity:()=>AM,invert:()=>kM,mul:()=>HM,multiply:()=>K_,multiplyScalar:()=>jM,multiplyScalarAndAdd:()=>ZM,rotate:()=>zM,scale:()=>FM,set:()=>CM,str:()=>OM,sub:()=>$M,subtract:()=>J_,transpose:()=>EM});d();function PM(){var r=new we(4);return we!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}l(PM,"create");function TM(r){var e=new we(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}l(TM,"clone");function MM(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}l(MM,"copy");function AM(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}l(AM,"identity");function IM(r,e,t,i){var n=new we(4);return n[0]=r,n[1]=e,n[2]=t,n[3]=i,n}l(IM,"fromValues");function CM(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}l(CM,"set");function EM(r,e){if(r===e){var t=e[1];r[1]=e[2],r[2]=t}else r[0]=e[0],r[1]=e[2],r[2]=e[1],r[3]=e[3];return r}l(EM,"transpose");function kM(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t*o-n*i;return a?(a=1/a,r[0]=o*a,r[1]=-i*a,r[2]=-n*a,r[3]=t*a,r):null}l(kM,"invert");function LM(r,e){var t=e[0];return r[0]=e[3],r[1]=-e[1],r[2]=-e[2],r[3]=t,r}l(LM,"adjoint");function DM(r){return r[0]*r[3]-r[2]*r[1]}l(DM,"determinant");function K_(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=t[0],u=t[1],c=t[2],p=t[3];return r[0]=i*s+o*u,r[1]=n*s+a*u,r[2]=i*c+o*p,r[3]=n*c+a*p,r}l(K_,"multiply");function zM(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=i*u+o*s,r[1]=n*u+a*s,r[2]=i*-s+o*u,r[3]=n*-s+a*u,r}l(zM,"rotate");function FM(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=t[0],u=t[1];return r[0]=i*s,r[1]=n*s,r[2]=o*u,r[3]=a*u,r}l(FM,"scale");function RM(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=-t,r[3]=i,r}l(RM,"fromRotation");function BM(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r}l(BM,"fromScaling");function OM(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}l(OM,"str");function VM(r){return Math.hypot(r[0],r[1],r[2],r[3])}l(VM,"frob");function UM(r,e,t,i){return r[2]=i[2]/i[0],t[0]=i[0],t[1]=i[1],t[3]=i[3]-r[2]*t[1],[r,e,t]}l(UM,"LDU");function NM(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}l(NM,"add");function J_(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}l(J_,"subtract");function GM(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}l(GM,"exactEquals");function qM(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=e[0],s=e[1],u=e[2],c=e[3];return Math.abs(t-a)<=oe*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(i-s)<=oe*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-u)<=oe*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-c)<=oe*Math.max(1,Math.abs(o),Math.abs(c))}l(qM,"equals");function jM(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}l(jM,"multiplyScalar");function ZM(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r}l(ZM,"multiplyScalarAndAdd");var HM=K_,$M=J_;var Uo={};Ci(Uo,{add:()=>gA,adjoint:()=>iA,clone:()=>KM,copy:()=>JM,create:()=>WM,determinant:()=>nA,equals:()=>vA,exactEquals:()=>_A,frob:()=>yA,fromMat2d:()=>pA,fromMat4:()=>XM,fromQuat:()=>hA,fromRotation:()=>uA,fromScaling:()=>cA,fromTranslation:()=>lA,fromValues:()=>YM,identity:()=>eA,invert:()=>rA,mul:()=>wA,multiply:()=>Y_,multiplyScalar:()=>xA,multiplyScalarAndAdd:()=>bA,normalFromMat4:()=>fA,projection:()=>mA,rotate:()=>aA,scale:()=>sA,set:()=>QM,str:()=>dA,sub:()=>SA,subtract:()=>Q_,translate:()=>oA,transpose:()=>tA});d();function WM(){var r=new we(9);return we!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}l(WM,"create");function XM(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}l(XM,"fromMat4");function KM(r){var e=new we(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}l(KM,"clone");function JM(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}l(JM,"copy");function YM(r,e,t,i,n,o,a,s,u){var c=new we(9);return c[0]=r,c[1]=e,c[2]=t,c[3]=i,c[4]=n,c[5]=o,c[6]=a,c[7]=s,c[8]=u,c}l(YM,"fromValues");function QM(r,e,t,i,n,o,a,s,u,c){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r[4]=o,r[5]=a,r[6]=s,r[7]=u,r[8]=c,r}l(QM,"set");function eA(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}l(eA,"identity");function tA(r,e){if(r===e){var t=e[1],i=e[2],n=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=i,r[7]=n}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}l(tA,"transpose");function rA(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8],h=p*a-s*c,f=-p*o+s*u,m=c*o-a*u,y=t*h+i*f+n*m;return y?(y=1/y,r[0]=h*y,r[1]=(-p*i+n*c)*y,r[2]=(s*i-n*a)*y,r[3]=f*y,r[4]=(p*t-n*u)*y,r[5]=(-s*t+n*o)*y,r[6]=m*y,r[7]=(-c*t+i*u)*y,r[8]=(a*t-i*o)*y,r):null}l(rA,"invert");function iA(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8];return r[0]=a*p-s*c,r[1]=n*c-i*p,r[2]=i*s-n*a,r[3]=s*u-o*p,r[4]=t*p-n*u,r[5]=n*o-t*s,r[6]=o*c-a*u,r[7]=i*u-t*c,r[8]=t*a-i*o,r}l(iA,"adjoint");function nA(r){var e=r[0],t=r[1],i=r[2],n=r[3],o=r[4],a=r[5],s=r[6],u=r[7],c=r[8];return e*(c*o-a*u)+t*(-c*n+a*s)+i*(u*n-o*s)}l(nA,"determinant");function Y_(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=e[8],f=t[0],m=t[1],y=t[2],g=t[3],x=t[4],b=t[5],w=t[6],_=t[7],S=t[8];return r[0]=f*i+m*a+y*c,r[1]=f*n+m*s+y*p,r[2]=f*o+m*u+y*h,r[3]=g*i+x*a+b*c,r[4]=g*n+x*s+b*p,r[5]=g*o+x*u+b*h,r[6]=w*i+_*a+S*c,r[7]=w*n+_*s+S*p,r[8]=w*o+_*u+S*h,r}l(Y_,"multiply");function oA(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=e[8],f=t[0],m=t[1];return r[0]=i,r[1]=n,r[2]=o,r[3]=a,r[4]=s,r[5]=u,r[6]=f*i+m*a+c,r[7]=f*n+m*s+p,r[8]=f*o+m*u+h,r}l(oA,"translate");function aA(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=e[8],f=Math.sin(t),m=Math.cos(t);return r[0]=m*i+f*a,r[1]=m*n+f*s,r[2]=m*o+f*u,r[3]=m*a-f*i,r[4]=m*s-f*n,r[5]=m*u-f*o,r[6]=c,r[7]=p,r[8]=h,r}l(aA,"rotate");function sA(r,e,t){var i=t[0],n=t[1];return r[0]=i*e[0],r[1]=i*e[1],r[2]=i*e[2],r[3]=n*e[3],r[4]=n*e[4],r[5]=n*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}l(sA,"scale");function lA(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}l(lA,"fromTranslation");function uA(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=0,r[3]=-t,r[4]=i,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}l(uA,"fromRotation");function cA(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}l(cA,"fromScaling");function pA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=0,r[3]=e[2],r[4]=e[3],r[5]=0,r[6]=e[4],r[7]=e[5],r[8]=1,r}l(pA,"fromMat2d");function hA(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t+t,s=i+i,u=n+n,c=t*a,p=i*a,h=i*s,f=n*a,m=n*s,y=n*u,g=o*a,x=o*s,b=o*u;return r[0]=1-h-y,r[3]=p-b,r[6]=f+x,r[1]=p+b,r[4]=1-c-y,r[7]=m-g,r[2]=f-x,r[5]=m+g,r[8]=1-c-h,r}l(hA,"fromQuat");function fA(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],m=e[11],y=e[12],g=e[13],x=e[14],b=e[15],w=t*s-i*a,_=t*u-n*a,S=t*c-o*a,P=i*u-n*s,T=i*c-o*s,L=n*c-o*u,C=p*g-h*y,E=p*x-f*y,I=p*b-m*y,R=h*x-f*g,z=h*b-m*g,k=f*b-m*x,M=w*k-_*z+S*R+P*I-T*E+L*C;return M?(M=1/M,r[0]=(s*k-u*z+c*R)*M,r[1]=(u*I-a*k-c*E)*M,r[2]=(a*z-s*I+c*C)*M,r[3]=(n*z-i*k-o*R)*M,r[4]=(t*k-n*I+o*E)*M,r[5]=(i*I-t*z-o*C)*M,r[6]=(g*L-x*T+b*P)*M,r[7]=(x*S-y*L-b*_)*M,r[8]=(y*T-g*S+b*w)*M,r):null}l(fA,"normalFromMat4");function mA(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}l(mA,"projection");function dA(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}l(dA,"str");function yA(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}l(yA,"frob");function gA(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r}l(gA,"add");function Q_(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r}l(Q_,"subtract");function xA(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r}l(xA,"multiplyScalar");function bA(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r[4]=e[4]+t[4]*i,r[5]=e[5]+t[5]*i,r[6]=e[6]+t[6]*i,r[7]=e[7]+t[7]*i,r[8]=e[8]+t[8]*i,r}l(bA,"multiplyScalarAndAdd");function _A(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]}l(_A,"exactEquals");function vA(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],p=r[8],h=e[0],f=e[1],m=e[2],y=e[3],g=e[4],x=e[5],b=e[6],w=e[7],_=e[8];return Math.abs(t-h)<=oe*Math.max(1,Math.abs(t),Math.abs(h))&&Math.abs(i-f)<=oe*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(n-m)<=oe*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(o-y)<=oe*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(a-g)<=oe*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(s-x)<=oe*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(u-b)<=oe*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(c-w)<=oe*Math.max(1,Math.abs(c),Math.abs(w))&&Math.abs(p-_)<=oe*Math.max(1,Math.abs(p),Math.abs(_))}l(vA,"equals");var wA=Y_,SA=Q_;var q={};Ci(q,{add:()=>sI,adjoint:()=>kA,clone:()=>TA,copy:()=>MA,create:()=>PA,determinant:()=>LA,equals:()=>pI,exactEquals:()=>cI,frob:()=>aI,fromQuat:()=>KA,fromQuat2:()=>ZA,fromRotation:()=>NA,fromRotationTranslation:()=>rv,fromRotationTranslationScale:()=>WA,fromRotationTranslationScaleOrigin:()=>XA,fromScaling:()=>UA,fromTranslation:()=>VA,fromValues:()=>AA,fromXRotation:()=>GA,fromYRotation:()=>qA,fromZRotation:()=>jA,frustum:()=>JA,getRotation:()=>$A,getScaling:()=>iv,getTranslation:()=>HA,identity:()=>ev,invert:()=>EA,lookAt:()=>iI,mul:()=>hI,multiply:()=>tv,multiplyScalar:()=>lI,multiplyScalarAndAdd:()=>uI,ortho:()=>tI,orthoNO:()=>ov,orthoZO:()=>rI,perspective:()=>YA,perspectiveFromFieldOfView:()=>eI,perspectiveNO:()=>nv,perspectiveZO:()=>QA,rotate:()=>FA,rotateX:()=>RA,rotateY:()=>BA,rotateZ:()=>OA,scale:()=>zA,set:()=>IA,str:()=>oI,sub:()=>fI,subtract:()=>av,targetTo:()=>nI,translate:()=>DA,transpose:()=>CA});d();function PA(){var r=new we(16);return we!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}l(PA,"create");function TA(r){var e=new we(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}l(TA,"clone");function MA(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}l(MA,"copy");function AA(r,e,t,i,n,o,a,s,u,c,p,h,f,m,y,g){var x=new we(16);return x[0]=r,x[1]=e,x[2]=t,x[3]=i,x[4]=n,x[5]=o,x[6]=a,x[7]=s,x[8]=u,x[9]=c,x[10]=p,x[11]=h,x[12]=f,x[13]=m,x[14]=y,x[15]=g,x}l(AA,"fromValues");function IA(r,e,t,i,n,o,a,s,u,c,p,h,f,m,y,g,x){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r[4]=o,r[5]=a,r[6]=s,r[7]=u,r[8]=c,r[9]=p,r[10]=h,r[11]=f,r[12]=m,r[13]=y,r[14]=g,r[15]=x,r}l(IA,"set");function ev(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(ev,"identity");function CA(r,e){if(r===e){var t=e[1],i=e[2],n=e[3],o=e[6],a=e[7],s=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=i,r[9]=o,r[11]=e[14],r[12]=n,r[13]=a,r[14]=s}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}l(CA,"transpose");function EA(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],m=e[11],y=e[12],g=e[13],x=e[14],b=e[15],w=t*s-i*a,_=t*u-n*a,S=t*c-o*a,P=i*u-n*s,T=i*c-o*s,L=n*c-o*u,C=p*g-h*y,E=p*x-f*y,I=p*b-m*y,R=h*x-f*g,z=h*b-m*g,k=f*b-m*x,M=w*k-_*z+S*R+P*I-T*E+L*C;return M?(M=1/M,r[0]=(s*k-u*z+c*R)*M,r[1]=(n*z-i*k-o*R)*M,r[2]=(g*L-x*T+b*P)*M,r[3]=(f*T-h*L-m*P)*M,r[4]=(u*I-a*k-c*E)*M,r[5]=(t*k-n*I+o*E)*M,r[6]=(x*S-y*L-b*_)*M,r[7]=(p*L-f*S+m*_)*M,r[8]=(a*z-s*I+c*C)*M,r[9]=(i*I-t*z-o*C)*M,r[10]=(y*T-g*S+b*w)*M,r[11]=(h*S-p*T-m*w)*M,r[12]=(s*E-a*R-u*C)*M,r[13]=(t*R-i*E+n*C)*M,r[14]=(g*_-y*P-x*w)*M,r[15]=(p*P-h*_+f*w)*M,r):null}l(EA,"invert");function kA(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],m=e[11],y=e[12],g=e[13],x=e[14],b=e[15];return r[0]=s*(f*b-m*x)-h*(u*b-c*x)+g*(u*m-c*f),r[1]=-(i*(f*b-m*x)-h*(n*b-o*x)+g*(n*m-o*f)),r[2]=i*(u*b-c*x)-s*(n*b-o*x)+g*(n*c-o*u),r[3]=-(i*(u*m-c*f)-s*(n*m-o*f)+h*(n*c-o*u)),r[4]=-(a*(f*b-m*x)-p*(u*b-c*x)+y*(u*m-c*f)),r[5]=t*(f*b-m*x)-p*(n*b-o*x)+y*(n*m-o*f),r[6]=-(t*(u*b-c*x)-a*(n*b-o*x)+y*(n*c-o*u)),r[7]=t*(u*m-c*f)-a*(n*m-o*f)+p*(n*c-o*u),r[8]=a*(h*b-m*g)-p*(s*b-c*g)+y*(s*m-c*h),r[9]=-(t*(h*b-m*g)-p*(i*b-o*g)+y*(i*m-o*h)),r[10]=t*(s*b-c*g)-a*(i*b-o*g)+y*(i*c-o*s),r[11]=-(t*(s*m-c*h)-a*(i*m-o*h)+p*(i*c-o*s)),r[12]=-(a*(h*x-f*g)-p*(s*x-u*g)+y*(s*f-u*h)),r[13]=t*(h*x-f*g)-p*(i*x-n*g)+y*(i*f-n*h),r[14]=-(t*(s*x-u*g)-a*(i*x-n*g)+y*(i*u-n*s)),r[15]=t*(s*f-u*h)-a*(i*f-n*h)+p*(i*u-n*s),r}l(kA,"adjoint");function LA(r){var e=r[0],t=r[1],i=r[2],n=r[3],o=r[4],a=r[5],s=r[6],u=r[7],c=r[8],p=r[9],h=r[10],f=r[11],m=r[12],y=r[13],g=r[14],x=r[15],b=e*a-t*o,w=e*s-i*o,_=e*u-n*o,S=t*s-i*a,P=t*u-n*a,T=i*u-n*s,L=c*y-p*m,C=c*g-h*m,E=c*x-f*m,I=p*g-h*y,R=p*x-f*y,z=h*x-f*g;return b*z-w*R+_*I+S*E-P*C+T*L}l(LA,"determinant");function tv(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=e[8],f=e[9],m=e[10],y=e[11],g=e[12],x=e[13],b=e[14],w=e[15],_=t[0],S=t[1],P=t[2],T=t[3];return r[0]=_*i+S*s+P*h+T*g,r[1]=_*n+S*u+P*f+T*x,r[2]=_*o+S*c+P*m+T*b,r[3]=_*a+S*p+P*y+T*w,_=t[4],S=t[5],P=t[6],T=t[7],r[4]=_*i+S*s+P*h+T*g,r[5]=_*n+S*u+P*f+T*x,r[6]=_*o+S*c+P*m+T*b,r[7]=_*a+S*p+P*y+T*w,_=t[8],S=t[9],P=t[10],T=t[11],r[8]=_*i+S*s+P*h+T*g,r[9]=_*n+S*u+P*f+T*x,r[10]=_*o+S*c+P*m+T*b,r[11]=_*a+S*p+P*y+T*w,_=t[12],S=t[13],P=t[14],T=t[15],r[12]=_*i+S*s+P*h+T*g,r[13]=_*n+S*u+P*f+T*x,r[14]=_*o+S*c+P*m+T*b,r[15]=_*a+S*p+P*y+T*w,r}l(tv,"multiply");function DA(r,e,t){var i=t[0],n=t[1],o=t[2],a,s,u,c,p,h,f,m,y,g,x,b;return e===r?(r[12]=e[0]*i+e[4]*n+e[8]*o+e[12],r[13]=e[1]*i+e[5]*n+e[9]*o+e[13],r[14]=e[2]*i+e[6]*n+e[10]*o+e[14],r[15]=e[3]*i+e[7]*n+e[11]*o+e[15]):(a=e[0],s=e[1],u=e[2],c=e[3],p=e[4],h=e[5],f=e[6],m=e[7],y=e[8],g=e[9],x=e[10],b=e[11],r[0]=a,r[1]=s,r[2]=u,r[3]=c,r[4]=p,r[5]=h,r[6]=f,r[7]=m,r[8]=y,r[9]=g,r[10]=x,r[11]=b,r[12]=a*i+p*n+y*o+e[12],r[13]=s*i+h*n+g*o+e[13],r[14]=u*i+f*n+x*o+e[14],r[15]=c*i+m*n+b*o+e[15]),r}l(DA,"translate");function zA(r,e,t){var i=t[0],n=t[1],o=t[2];return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r[4]=e[4]*n,r[5]=e[5]*n,r[6]=e[6]*n,r[7]=e[7]*n,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,r[11]=e[11]*o,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}l(zA,"scale");function FA(r,e,t,i){var n=i[0],o=i[1],a=i[2],s=Math.hypot(n,o,a),u,c,p,h,f,m,y,g,x,b,w,_,S,P,T,L,C,E,I,R,z,k,M,G;return s<oe?null:(s=1/s,n*=s,o*=s,a*=s,u=Math.sin(t),c=Math.cos(t),p=1-c,h=e[0],f=e[1],m=e[2],y=e[3],g=e[4],x=e[5],b=e[6],w=e[7],_=e[8],S=e[9],P=e[10],T=e[11],L=n*n*p+c,C=o*n*p+a*u,E=a*n*p-o*u,I=n*o*p-a*u,R=o*o*p+c,z=a*o*p+n*u,k=n*a*p+o*u,M=o*a*p-n*u,G=a*a*p+c,r[0]=h*L+g*C+_*E,r[1]=f*L+x*C+S*E,r[2]=m*L+b*C+P*E,r[3]=y*L+w*C+T*E,r[4]=h*I+g*R+_*z,r[5]=f*I+x*R+S*z,r[6]=m*I+b*R+P*z,r[7]=y*I+w*R+T*z,r[8]=h*k+g*M+_*G,r[9]=f*k+x*M+S*G,r[10]=m*k+b*M+P*G,r[11]=y*k+w*M+T*G,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}l(FA,"rotate");function RA(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=o*n+c*i,r[5]=a*n+p*i,r[6]=s*n+h*i,r[7]=u*n+f*i,r[8]=c*n-o*i,r[9]=p*n-a*i,r[10]=h*n-s*i,r[11]=f*n-u*i,r}l(RA,"rotateX");function BA(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[0],a=e[1],s=e[2],u=e[3],c=e[8],p=e[9],h=e[10],f=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*n-c*i,r[1]=a*n-p*i,r[2]=s*n-h*i,r[3]=u*n-f*i,r[8]=o*i+c*n,r[9]=a*i+p*n,r[10]=s*i+h*n,r[11]=u*i+f*n,r}l(BA,"rotateY");function OA(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[0],a=e[1],s=e[2],u=e[3],c=e[4],p=e[5],h=e[6],f=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*n+c*i,r[1]=a*n+p*i,r[2]=s*n+h*i,r[3]=u*n+f*i,r[4]=c*n-o*i,r[5]=p*n-a*i,r[6]=h*n-s*i,r[7]=f*n-u*i,r}l(OA,"rotateZ");function VA(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}l(VA,"fromTranslation");function UA(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(UA,"fromScaling");function NA(r,e,t){var i=t[0],n=t[1],o=t[2],a=Math.hypot(i,n,o),s,u,c;return a<oe?null:(a=1/a,i*=a,n*=a,o*=a,s=Math.sin(e),u=Math.cos(e),c=1-u,r[0]=i*i*c+u,r[1]=n*i*c+o*s,r[2]=o*i*c-n*s,r[3]=0,r[4]=i*n*c-o*s,r[5]=n*n*c+u,r[6]=o*n*c+i*s,r[7]=0,r[8]=i*o*c+n*s,r[9]=n*o*c-i*s,r[10]=o*o*c+u,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}l(NA,"fromRotation");function GA(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i,r[6]=t,r[7]=0,r[8]=0,r[9]=-t,r[10]=i,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(GA,"fromXRotation");function qA(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=0,r[2]=-t,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=t,r[9]=0,r[10]=i,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(qA,"fromYRotation");function jA(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=0,r[3]=0,r[4]=-t,r[5]=i,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(jA,"fromZRotation");function rv(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=i+i,u=n+n,c=o+o,p=i*s,h=i*u,f=i*c,m=n*u,y=n*c,g=o*c,x=a*s,b=a*u,w=a*c;return r[0]=1-(m+g),r[1]=h+w,r[2]=f-b,r[3]=0,r[4]=h-w,r[5]=1-(p+g),r[6]=y+x,r[7]=0,r[8]=f+b,r[9]=y-x,r[10]=1-(p+m),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}l(rv,"fromRotationTranslation");function ZA(r,e){var t=new we(3),i=-e[0],n=-e[1],o=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],p=e[7],h=i*i+n*n+o*o+a*a;return h>0?(t[0]=(s*a+p*i+u*o-c*n)*2/h,t[1]=(u*a+p*n+c*i-s*o)*2/h,t[2]=(c*a+p*o+s*n-u*i)*2/h):(t[0]=(s*a+p*i+u*o-c*n)*2,t[1]=(u*a+p*n+c*i-s*o)*2,t[2]=(c*a+p*o+s*n-u*i)*2),rv(r,e,t),r}l(ZA,"fromQuat2");function HA(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}l(HA,"getTranslation");function iv(r,e){var t=e[0],i=e[1],n=e[2],o=e[4],a=e[5],s=e[6],u=e[8],c=e[9],p=e[10];return r[0]=Math.hypot(t,i,n),r[1]=Math.hypot(o,a,s),r[2]=Math.hypot(u,c,p),r}l(iv,"getScaling");function $A(r,e){var t=new we(3);iv(t,e);var i=1/t[0],n=1/t[1],o=1/t[2],a=e[0]*i,s=e[1]*n,u=e[2]*o,c=e[4]*i,p=e[5]*n,h=e[6]*o,f=e[8]*i,m=e[9]*n,y=e[10]*o,g=a+p+y,x=0;return g>0?(x=Math.sqrt(g+1)*2,r[3]=.25*x,r[0]=(h-m)/x,r[1]=(f-u)/x,r[2]=(s-c)/x):a>p&&a>y?(x=Math.sqrt(1+a-p-y)*2,r[3]=(h-m)/x,r[0]=.25*x,r[1]=(s+c)/x,r[2]=(f+u)/x):p>y?(x=Math.sqrt(1+p-a-y)*2,r[3]=(f-u)/x,r[0]=(s+c)/x,r[1]=.25*x,r[2]=(h+m)/x):(x=Math.sqrt(1+y-a-p)*2,r[3]=(s-c)/x,r[0]=(f+u)/x,r[1]=(h+m)/x,r[2]=.25*x),r}l($A,"getRotation");function WA(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=e[3],u=n+n,c=o+o,p=a+a,h=n*u,f=n*c,m=n*p,y=o*c,g=o*p,x=a*p,b=s*u,w=s*c,_=s*p,S=i[0],P=i[1],T=i[2];return r[0]=(1-(y+x))*S,r[1]=(f+_)*S,r[2]=(m-w)*S,r[3]=0,r[4]=(f-_)*P,r[5]=(1-(h+x))*P,r[6]=(g+b)*P,r[7]=0,r[8]=(m+w)*T,r[9]=(g-b)*T,r[10]=(1-(h+y))*T,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}l(WA,"fromRotationTranslationScale");function XA(r,e,t,i,n){var o=e[0],a=e[1],s=e[2],u=e[3],c=o+o,p=a+a,h=s+s,f=o*c,m=o*p,y=o*h,g=a*p,x=a*h,b=s*h,w=u*c,_=u*p,S=u*h,P=i[0],T=i[1],L=i[2],C=n[0],E=n[1],I=n[2],R=(1-(g+b))*P,z=(m+S)*P,k=(y-_)*P,M=(m-S)*T,G=(1-(f+b))*T,K=(x+w)*T,ne=(y+_)*L,J=(x-w)*L,W=(1-(f+g))*L;return r[0]=R,r[1]=z,r[2]=k,r[3]=0,r[4]=M,r[5]=G,r[6]=K,r[7]=0,r[8]=ne,r[9]=J,r[10]=W,r[11]=0,r[12]=t[0]+C-(R*C+M*E+ne*I),r[13]=t[1]+E-(z*C+G*E+J*I),r[14]=t[2]+I-(k*C+K*E+W*I),r[15]=1,r}l(XA,"fromRotationTranslationScaleOrigin");function KA(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t+t,s=i+i,u=n+n,c=t*a,p=i*a,h=i*s,f=n*a,m=n*s,y=n*u,g=o*a,x=o*s,b=o*u;return r[0]=1-h-y,r[1]=p+b,r[2]=f-x,r[3]=0,r[4]=p-b,r[5]=1-c-y,r[6]=m+g,r[7]=0,r[8]=f+x,r[9]=m-g,r[10]=1-c-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}l(KA,"fromQuat");function JA(r,e,t,i,n,o,a){var s=1/(t-e),u=1/(n-i),c=1/(o-a);return r[0]=o*2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o*2*u,r[6]=0,r[7]=0,r[8]=(t+e)*s,r[9]=(n+i)*u,r[10]=(a+o)*c,r[11]=-1,r[12]=0,r[13]=0,r[14]=a*o*2*c,r[15]=0,r}l(JA,"frustum");function nv(r,e,t,i,n){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,n!=null&&n!==1/0?(a=1/(i-n),r[10]=(n+i)*a,r[14]=2*n*i*a):(r[10]=-1,r[14]=-2*i),r}l(nv,"perspectiveNO");var YA=nv;function QA(r,e,t,i,n){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,n!=null&&n!==1/0?(a=1/(i-n),r[10]=n*a,r[14]=n*i*a):(r[10]=-1,r[14]=-i),r}l(QA,"perspectiveZO");function eI(r,e,t,i){var n=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(a+s),c=2/(n+o);return r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=-((a-s)*u*.5),r[9]=(n-o)*c*.5,r[10]=i/(t-i),r[11]=-1,r[12]=0,r[13]=0,r[14]=i*t/(t-i),r[15]=0,r}l(eI,"perspectiveFromFieldOfView");function ov(r,e,t,i,n,o,a){var s=1/(e-t),u=1/(i-n),c=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*c,r[11]=0,r[12]=(e+t)*s,r[13]=(n+i)*u,r[14]=(a+o)*c,r[15]=1,r}l(ov,"orthoNO");var tI=ov;function rI(r,e,t,i,n,o,a){var s=1/(e-t),u=1/(i-n),c=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=c,r[11]=0,r[12]=(e+t)*s,r[13]=(n+i)*u,r[14]=o*c,r[15]=1,r}l(rI,"orthoZO");function iI(r,e,t,i){var n,o,a,s,u,c,p,h,f,m,y=e[0],g=e[1],x=e[2],b=i[0],w=i[1],_=i[2],S=t[0],P=t[1],T=t[2];return Math.abs(y-S)<oe&&Math.abs(g-P)<oe&&Math.abs(x-T)<oe?ev(r):(p=y-S,h=g-P,f=x-T,m=1/Math.hypot(p,h,f),p*=m,h*=m,f*=m,n=w*f-_*h,o=_*p-b*f,a=b*h-w*p,m=Math.hypot(n,o,a),m?(m=1/m,n*=m,o*=m,a*=m):(n=0,o=0,a=0),s=h*a-f*o,u=f*n-p*a,c=p*o-h*n,m=Math.hypot(s,u,c),m?(m=1/m,s*=m,u*=m,c*=m):(s=0,u=0,c=0),r[0]=n,r[1]=s,r[2]=p,r[3]=0,r[4]=o,r[5]=u,r[6]=h,r[7]=0,r[8]=a,r[9]=c,r[10]=f,r[11]=0,r[12]=-(n*y+o*g+a*x),r[13]=-(s*y+u*g+c*x),r[14]=-(p*y+h*g+f*x),r[15]=1,r)}l(iI,"lookAt");function nI(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=i[0],u=i[1],c=i[2],p=n-t[0],h=o-t[1],f=a-t[2],m=p*p+h*h+f*f;m>0&&(m=1/Math.sqrt(m),p*=m,h*=m,f*=m);var y=u*f-c*h,g=c*p-s*f,x=s*h-u*p;return m=y*y+g*g+x*x,m>0&&(m=1/Math.sqrt(m),y*=m,g*=m,x*=m),r[0]=y,r[1]=g,r[2]=x,r[3]=0,r[4]=h*x-f*g,r[5]=f*y-p*x,r[6]=p*g-h*y,r[7]=0,r[8]=p,r[9]=h,r[10]=f,r[11]=0,r[12]=n,r[13]=o,r[14]=a,r[15]=1,r}l(nI,"targetTo");function oI(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}l(oI,"str");function aI(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}l(aI,"frob");function sI(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}l(sI,"add");function av(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}l(av,"subtract");function lI(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}l(lI,"multiplyScalar");function uI(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r[4]=e[4]+t[4]*i,r[5]=e[5]+t[5]*i,r[6]=e[6]+t[6]*i,r[7]=e[7]+t[7]*i,r[8]=e[8]+t[8]*i,r[9]=e[9]+t[9]*i,r[10]=e[10]+t[10]*i,r[11]=e[11]+t[11]*i,r[12]=e[12]+t[12]*i,r[13]=e[13]+t[13]*i,r[14]=e[14]+t[14]*i,r[15]=e[15]+t[15]*i,r}l(uI,"multiplyScalarAndAdd");function cI(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}l(cI,"exactEquals");function pI(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=r[4],s=r[5],u=r[6],c=r[7],p=r[8],h=r[9],f=r[10],m=r[11],y=r[12],g=r[13],x=r[14],b=r[15],w=e[0],_=e[1],S=e[2],P=e[3],T=e[4],L=e[5],C=e[6],E=e[7],I=e[8],R=e[9],z=e[10],k=e[11],M=e[12],G=e[13],K=e[14],ne=e[15];return Math.abs(t-w)<=oe*Math.max(1,Math.abs(t),Math.abs(w))&&Math.abs(i-_)<=oe*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(n-S)<=oe*Math.max(1,Math.abs(n),Math.abs(S))&&Math.abs(o-P)<=oe*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-T)<=oe*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-L)<=oe*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(u-C)<=oe*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-E)<=oe*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(p-I)<=oe*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(h-R)<=oe*Math.max(1,Math.abs(h),Math.abs(R))&&Math.abs(f-z)<=oe*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(m-k)<=oe*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(y-M)<=oe*Math.max(1,Math.abs(y),Math.abs(M))&&Math.abs(g-G)<=oe*Math.max(1,Math.abs(g),Math.abs(G))&&Math.abs(x-K)<=oe*Math.max(1,Math.abs(x),Math.abs(K))&&Math.abs(b-ne)<=oe*Math.max(1,Math.abs(b),Math.abs(ne))}l(pI,"equals");var hI=tv,fI=av;var gt={};Ci(gt,{add:()=>xI,angle:()=>UI,bezier:()=>LI,ceil:()=>bI,clone:()=>mI,copy:()=>yI,create:()=>sv,cross:()=>CI,dist:()=>WI,distance:()=>hv,div:()=>$I,divide:()=>pv,dot:()=>dv,equals:()=>jI,exactEquals:()=>qI,floor:()=>_I,forEach:()=>YI,fromValues:()=>dI,hermite:()=>kI,inverse:()=>AI,len:()=>KI,length:()=>lv,lerp:()=>EI,max:()=>wI,min:()=>vI,mul:()=>HI,multiply:()=>cv,negate:()=>MI,normalize:()=>II,random:()=>DI,rotateX:()=>BI,rotateY:()=>OI,rotateZ:()=>VI,round:()=>SI,scale:()=>PI,scaleAndAdd:()=>TI,set:()=>gI,sqrDist:()=>XI,sqrLen:()=>JI,squaredDistance:()=>fv,squaredLength:()=>mv,str:()=>GI,sub:()=>ZI,subtract:()=>uv,transformMat3:()=>FI,transformMat4:()=>zI,transformQuat:()=>RI,zero:()=>NI});d();function sv(){var r=new we(3);return we!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}l(sv,"create");function mI(r){var e=new we(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}l(mI,"clone");function lv(r){var e=r[0],t=r[1],i=r[2];return Math.hypot(e,t,i)}l(lv,"length");function dI(r,e,t){var i=new we(3);return i[0]=r,i[1]=e,i[2]=t,i}l(dI,"fromValues");function yI(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}l(yI,"copy");function gI(r,e,t,i){return r[0]=e,r[1]=t,r[2]=i,r}l(gI,"set");function xI(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}l(xI,"add");function uv(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}l(uv,"subtract");function cv(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}l(cv,"multiply");function pv(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}l(pv,"divide");function bI(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}l(bI,"ceil");function _I(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}l(_I,"floor");function vI(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}l(vI,"min");function wI(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}l(wI,"max");function SI(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}l(SI,"round");function PI(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}l(PI,"scale");function TI(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r}l(TI,"scaleAndAdd");function hv(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2];return Math.hypot(t,i,n)}l(hv,"distance");function fv(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2];return t*t+i*i+n*n}l(fv,"squaredDistance");function mv(r){var e=r[0],t=r[1],i=r[2];return e*e+t*t+i*i}l(mv,"squaredLength");function MI(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}l(MI,"negate");function AI(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}l(AI,"inverse");function II(r,e){var t=e[0],i=e[1],n=e[2],o=t*t+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r}l(II,"normalize");function dv(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}l(dv,"dot");function CI(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[0],s=t[1],u=t[2];return r[0]=n*u-o*s,r[1]=o*a-i*u,r[2]=i*s-n*a,r}l(CI,"cross");function EI(r,e,t,i){var n=e[0],o=e[1],a=e[2];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r[2]=a+i*(t[2]-a),r}l(EI,"lerp");function kI(r,e,t,i,n,o){var a=o*o,s=a*(2*o-3)+1,u=a*(o-2)+o,c=a*(o-1),p=a*(3-2*o);return r[0]=e[0]*s+t[0]*u+i[0]*c+n[0]*p,r[1]=e[1]*s+t[1]*u+i[1]*c+n[1]*p,r[2]=e[2]*s+t[2]*u+i[2]*c+n[2]*p,r}l(kI,"hermite");function LI(r,e,t,i,n,o){var a=1-o,s=a*a,u=o*o,c=s*a,p=3*o*s,h=3*u*a,f=u*o;return r[0]=e[0]*c+t[0]*p+i[0]*h+n[0]*f,r[1]=e[1]*c+t[1]*p+i[1]*h+n[1]*f,r[2]=e[2]*c+t[2]*p+i[2]*h+n[2]*f,r}l(LI,"bezier");function DI(r,e){e=e||1;var t=Zt()*2*Math.PI,i=Zt()*2-1,n=Math.sqrt(1-i*i)*e;return r[0]=Math.cos(t)*n,r[1]=Math.sin(t)*n,r[2]=i*e,r}l(DI,"random");function zI(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[3]*i+t[7]*n+t[11]*o+t[15];return a=a||1,r[0]=(t[0]*i+t[4]*n+t[8]*o+t[12])/a,r[1]=(t[1]*i+t[5]*n+t[9]*o+t[13])/a,r[2]=(t[2]*i+t[6]*n+t[10]*o+t[14])/a,r}l(zI,"transformMat4");function FI(r,e,t){var i=e[0],n=e[1],o=e[2];return r[0]=i*t[0]+n*t[3]+o*t[6],r[1]=i*t[1]+n*t[4]+o*t[7],r[2]=i*t[2]+n*t[5]+o*t[8],r}l(FI,"transformMat3");function RI(r,e,t){var i=t[0],n=t[1],o=t[2],a=t[3],s=e[0],u=e[1],c=e[2],p=n*c-o*u,h=o*s-i*c,f=i*u-n*s,m=n*f-o*h,y=o*p-i*f,g=i*h-n*p,x=a*2;return p*=x,h*=x,f*=x,m*=2,y*=2,g*=2,r[0]=s+p+m,r[1]=u+h+y,r[2]=c+f+g,r}l(RI,"transformQuat");function BI(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}l(BI,"rotateX");function OI(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}l(OI,"rotateY");function VI(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}l(VI,"rotateZ");function UI(r,e){var t=r[0],i=r[1],n=r[2],o=e[0],a=e[1],s=e[2],u=Math.sqrt(t*t+i*i+n*n),c=Math.sqrt(o*o+a*a+s*s),p=u*c,h=p&&dv(r,e)/p;return Math.acos(Math.min(Math.max(h,-1),1))}l(UI,"angle");function NI(r){return r[0]=0,r[1]=0,r[2]=0,r}l(NI,"zero");function GI(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}l(GI,"str");function qI(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}l(qI,"exactEquals");function jI(r,e){var t=r[0],i=r[1],n=r[2],o=e[0],a=e[1],s=e[2];return Math.abs(t-o)<=oe*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(i-a)<=oe*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-s)<=oe*Math.max(1,Math.abs(n),Math.abs(s))}l(jI,"equals");var ZI=uv,HI=cv,$I=pv,WI=hv,XI=fv,KI=lv,JI=mv,YI=function(){var r=sv();return function(e,t,i,n,o,a){var s,u;for(t||(t=3),i||(i=0),n?u=Math.min(n*t+i,e.length):u=e.length,s=i;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];return e}}();var qe={};Ci(qe,{add:()=>iC,ceil:()=>nC,clone:()=>QI,copy:()=>tC,create:()=>yv,cross:()=>dC,dist:()=>AC,distance:()=>_v,div:()=>MC,divide:()=>bv,dot:()=>mC,equals:()=>SC,exactEquals:()=>wC,floor:()=>oC,forEach:()=>kC,fromValues:()=>eC,inverse:()=>hC,len:()=>CC,length:()=>wv,lerp:()=>yC,max:()=>sC,min:()=>aC,mul:()=>TC,multiply:()=>xv,negate:()=>pC,normalize:()=>fC,random:()=>gC,round:()=>lC,scale:()=>uC,scaleAndAdd:()=>cC,set:()=>rC,sqrDist:()=>IC,sqrLen:()=>EC,squaredDistance:()=>vv,squaredLength:()=>Sv,str:()=>vC,sub:()=>PC,subtract:()=>gv,transformMat4:()=>xC,transformQuat:()=>bC,zero:()=>_C});d();function yv(){var r=new we(4);return we!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}l(yv,"create");function QI(r){var e=new we(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}l(QI,"clone");function eC(r,e,t,i){var n=new we(4);return n[0]=r,n[1]=e,n[2]=t,n[3]=i,n}l(eC,"fromValues");function tC(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}l(tC,"copy");function rC(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}l(rC,"set");function iC(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}l(iC,"add");function gv(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}l(gv,"subtract");function xv(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3],r}l(xv,"multiply");function bv(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r[3]=e[3]/t[3],r}l(bv,"divide");function nC(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r[3]=Math.ceil(e[3]),r}l(nC,"ceil");function oC(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r[3]=Math.floor(e[3]),r}l(oC,"floor");function aC(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r}l(aC,"min");function sC(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3]),r}l(sC,"max");function lC(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r[3]=Math.round(e[3]),r}l(lC,"round");function uC(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}l(uC,"scale");function cC(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r}l(cC,"scaleAndAdd");function _v(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2],o=e[3]-r[3];return Math.hypot(t,i,n,o)}l(_v,"distance");function vv(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2],o=e[3]-r[3];return t*t+i*i+n*n+o*o}l(vv,"squaredDistance");function wv(r){var e=r[0],t=r[1],i=r[2],n=r[3];return Math.hypot(e,t,i,n)}l(wv,"length");function Sv(r){var e=r[0],t=r[1],i=r[2],n=r[3];return e*e+t*t+i*i+n*n}l(Sv,"squaredLength");function pC(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r}l(pC,"negate");function hC(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r[3]=1/e[3],r}l(hC,"inverse");function fC(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t*t+i*i+n*n+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=t*a,r[1]=i*a,r[2]=n*a,r[3]=o*a,r}l(fC,"normalize");function mC(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}l(mC,"dot");function dC(r,e,t,i){var n=t[0]*i[1]-t[1]*i[0],o=t[0]*i[2]-t[2]*i[0],a=t[0]*i[3]-t[3]*i[0],s=t[1]*i[2]-t[2]*i[1],u=t[1]*i[3]-t[3]*i[1],c=t[2]*i[3]-t[3]*i[2],p=e[0],h=e[1],f=e[2],m=e[3];return r[0]=h*c-f*u+m*s,r[1]=-(p*c)+f*a-m*o,r[2]=p*u-h*a+m*n,r[3]=-(p*s)+h*o-f*n,r}l(dC,"cross");function yC(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=e[3];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r[2]=a+i*(t[2]-a),r[3]=s+i*(t[3]-s),r}l(yC,"lerp");function gC(r,e){e=e||1;var t,i,n,o,a,s;do t=Zt()*2-1,i=Zt()*2-1,a=t*t+i*i;while(a>=1);do n=Zt()*2-1,o=Zt()*2-1,s=n*n+o*o;while(s>=1);var u=Math.sqrt((1-a)/s);return r[0]=e*t,r[1]=e*i,r[2]=e*n*u,r[3]=e*o*u,r}l(gC,"random");function xC(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3];return r[0]=t[0]*i+t[4]*n+t[8]*o+t[12]*a,r[1]=t[1]*i+t[5]*n+t[9]*o+t[13]*a,r[2]=t[2]*i+t[6]*n+t[10]*o+t[14]*a,r[3]=t[3]*i+t[7]*n+t[11]*o+t[15]*a,r}l(xC,"transformMat4");function bC(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[0],s=t[1],u=t[2],c=t[3],p=c*i+s*o-u*n,h=c*n+u*i-a*o,f=c*o+a*n-s*i,m=-a*i-s*n-u*o;return r[0]=p*c+m*-a+h*-u-f*-s,r[1]=h*c+m*-s+f*-a-p*-u,r[2]=f*c+m*-u+p*-s-h*-a,r[3]=e[3],r}l(bC,"transformQuat");function _C(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}l(_C,"zero");function vC(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}l(vC,"str");function wC(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}l(wC,"exactEquals");function SC(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=e[0],s=e[1],u=e[2],c=e[3];return Math.abs(t-a)<=oe*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(i-s)<=oe*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-u)<=oe*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-c)<=oe*Math.max(1,Math.abs(o),Math.abs(c))}l(SC,"equals");var PC=gv,TC=xv,MC=bv,AC=_v,IC=vv,CC=wv,EC=Sv,kC=function(){var r=yv();return function(e,t,i,n,o,a){var s,u;for(t||(t=4),i||(i=0),n?u=Math.min(n*t+i,e.length):u=e.length,s=i;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],r[3]=e[s+3],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2],e[s+3]=r[3];return e}}();var sn={};Ci(sn,{add:()=>RC,angle:()=>rE,ceil:()=>BC,clone:()=>LC,copy:()=>zC,create:()=>Pv,cross:()=>WC,dist:()=>pE,distance:()=>Iv,div:()=>cE,divide:()=>Av,dot:()=>$C,equals:()=>aE,exactEquals:()=>oE,floor:()=>OC,forEach:()=>mE,fromValues:()=>DC,inverse:()=>ZC,len:()=>sE,length:()=>Ev,lerp:()=>XC,max:()=>UC,min:()=>VC,mul:()=>uE,multiply:()=>Mv,negate:()=>jC,normalize:()=>HC,random:()=>KC,rotate:()=>tE,round:()=>NC,scale:()=>GC,scaleAndAdd:()=>qC,set:()=>FC,sqrDist:()=>hE,sqrLen:()=>fE,squaredDistance:()=>Cv,squaredLength:()=>kv,str:()=>nE,sub:()=>lE,subtract:()=>Tv,transformMat2:()=>JC,transformMat2d:()=>YC,transformMat3:()=>QC,transformMat4:()=>eE,zero:()=>iE});d();function Pv(){var r=new we(2);return we!=Float32Array&&(r[0]=0,r[1]=0),r}l(Pv,"create");function LC(r){var e=new we(2);return e[0]=r[0],e[1]=r[1],e}l(LC,"clone");function DC(r,e){var t=new we(2);return t[0]=r,t[1]=e,t}l(DC,"fromValues");function zC(r,e){return r[0]=e[0],r[1]=e[1],r}l(zC,"copy");function FC(r,e,t){return r[0]=e,r[1]=t,r}l(FC,"set");function RC(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}l(RC,"add");function Tv(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}l(Tv,"subtract");function Mv(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}l(Mv,"multiply");function Av(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}l(Av,"divide");function BC(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}l(BC,"ceil");function OC(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}l(OC,"floor");function VC(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}l(VC,"min");function UC(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}l(UC,"max");function NC(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}l(NC,"round");function GC(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}l(GC,"scale");function qC(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r}l(qC,"scaleAndAdd");function Iv(r,e){var t=e[0]-r[0],i=e[1]-r[1];return Math.hypot(t,i)}l(Iv,"distance");function Cv(r,e){var t=e[0]-r[0],i=e[1]-r[1];return t*t+i*i}l(Cv,"squaredDistance");function Ev(r){var e=r[0],t=r[1];return Math.hypot(e,t)}l(Ev,"length");function kv(r){var e=r[0],t=r[1];return e*e+t*t}l(kv,"squaredLength");function jC(r,e){return r[0]=-e[0],r[1]=-e[1],r}l(jC,"negate");function ZC(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}l(ZC,"inverse");function HC(r,e){var t=e[0],i=e[1],n=t*t+i*i;return n>0&&(n=1/Math.sqrt(n)),r[0]=e[0]*n,r[1]=e[1]*n,r}l(HC,"normalize");function $C(r,e){return r[0]*e[0]+r[1]*e[1]}l($C,"dot");function WC(r,e,t){var i=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=i,r}l(WC,"cross");function XC(r,e,t,i){var n=e[0],o=e[1];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r}l(XC,"lerp");function KC(r,e){e=e||1;var t=Zt()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}l(KC,"random");function JC(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[2]*n,r[1]=t[1]*i+t[3]*n,r}l(JC,"transformMat2");function YC(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[2]*n+t[4],r[1]=t[1]*i+t[3]*n+t[5],r}l(YC,"transformMat2d");function QC(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[3]*n+t[6],r[1]=t[1]*i+t[4]*n+t[7],r}l(QC,"transformMat3");function eE(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[4]*n+t[12],r[1]=t[1]*i+t[5]*n+t[13],r}l(eE,"transformMat4");function tE(r,e,t,i){var n=e[0]-t[0],o=e[1]-t[1],a=Math.sin(i),s=Math.cos(i);return r[0]=n*s-o*a+t[0],r[1]=n*a+o*s+t[1],r}l(tE,"rotate");function rE(r,e){var t=r[0],i=r[1],n=e[0],o=e[1],a=Math.sqrt(t*t+i*i)*Math.sqrt(n*n+o*o),s=a&&(t*n+i*o)/a;return Math.acos(Math.min(Math.max(s,-1),1))}l(rE,"angle");function iE(r){return r[0]=0,r[1]=0,r}l(iE,"zero");function nE(r){return"vec2("+r[0]+", "+r[1]+")"}l(nE,"str");function oE(r,e){return r[0]===e[0]&&r[1]===e[1]}l(oE,"exactEquals");function aE(r,e){var t=r[0],i=r[1],n=e[0],o=e[1];return Math.abs(t-n)<=oe*Math.max(1,Math.abs(t),Math.abs(n))&&Math.abs(i-o)<=oe*Math.max(1,Math.abs(i),Math.abs(o))}l(aE,"equals");var sE=Ev,lE=Tv,uE=Mv,cE=Av,pE=Iv,hE=Cv,fE=kv,mE=function(){var r=Pv();return function(e,t,i,n,o,a){var s,u;for(t||(t=2),i||(i=0),n?u=Math.min(n*t+i,e.length):u=e.length,s=i;s<u;s+=t)r[0]=e[s],r[1]=e[s+1],o(r,r,a),e[s]=r[0],e[s+1]=r[1];return e}}();var Lv=ae(ge(),1);var _m=class _m extends Ge{constructor(e){super(e,X_)}createBucket(e){return new hi(e)}queryRadius(e){let t=e;return fi("circle-radius",this,t)+fi("circle-stroke-width",this,t)+kr(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s,u){let c=Lr(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,s),p=this.paint.get("circle-radius").evaluate(t,i),h=this.paint.get("circle-stroke-width").evaluate(t,i),f=p+h,m=this.paint.get("circle-pitch-alignment")==="map",y=m?c:dE(c,u),g=m?f*s:f;for(let x of n)for(let b of x){let w=m?b:Dv(b,u),_=g,S=qe.transformMat4([],[b.x,b.y,0,1],u);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?_*=S[3]/a.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(_*=a.cameraToCenterDistance/S[3]),G_(y,w,_))return!0}return!1}};l(_m,"CircleStyleLayer");var Dl=_m;function Dv(r,e){let t=qe.transformMat4([],[r.x,r.y,0,1],e);return new Lv.default(t[0]/t[3],t[1]/t[3])}l(Dv,"projectPoint");function dE(r,e){return r.map(t=>Dv(t,e))}l(dE,"projectQueryGeometry");d();d();var vm=class vm extends hi{};l(vm,"HeatmapBucket");var No=vm;N("HeatmapBucket",No,{omit:["layers"]});d();var zv,yE=l(()=>zv=zv||new De({"heatmap-radius":new $(A.paint_heatmap["heatmap-radius"]),"heatmap-weight":new $(A.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Z(A.paint_heatmap["heatmap-intensity"]),"heatmap-color":new si(A.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Z(A.paint_heatmap["heatmap-opacity"])}),"getPaint"),Fv={get paint(){return yE()}};d();d();function wm(r,{width:e,height:t},i,n){if(!n)n=new Uint8Array(e*t*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*t*i)throw new RangeError("mismatched image size. expected: ".concat(n.length," but got: ").concat(e*t*i));return r.width=e,r.height=t,r.data=n,r}l(wm,"createImage");function Rv(r,{width:e,height:t},i){if(e===r.width&&t===r.height)return;let n=wm({},{width:e,height:t},i);Sm(r,n,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,t)},i),r.width=e,r.height=t,r.data=n.data}l(Rv,"resizeImage");function Sm(r,e,t,i,n,o){if(n.width===0||n.height===0)return e;if(n.width>r.width||n.height>r.height||t.x>r.width-n.width||t.y>r.height-n.height)throw new RangeError("out of range source coordinates for image copy");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 destination coordinates for image copy");let a=r.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let u=0;u<n.height;u++){let c=((t.y+u)*r.width+t.x)*o,p=((i.y+u)*e.width+i.x)*o;for(let h=0;h<n.width*o;h++)s[p+h]=a[c+h]}return e}l(Sm,"copyImage");var zl=class zl{constructor(e,t){wm(this,e,1,t)}resize(e){Rv(this,e,1)}clone(){return new zl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,n,o){Sm(e,t,i,n,o,1)}};l(zl,"AlphaImage");var mi=zl,Fl=class Fl{constructor(e,t){wm(this,e,4,t)}resize(e){Rv(this,e,4)}replace(e,t){t?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new Fl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,n,o){Sm(e,t,i,n,o,4)}};l(Fl,"RGBAImage");var Se=Fl;N("AlphaImage",mi);N("RGBAImage",Se);function Rl(r){let e={},t=r.resolution||256,i=r.clips?r.clips.length:1,n=r.image||new Se({width:t,height:i});if(!Yx(t))throw new Error("width is not a power of 2 - ".concat(t));let o=l((a,s,u)=>{e[r.evaluationKey]=u;let c=r.expression.evaluate(e);n.data[a+s+0]=Math.floor(c.r*255/c.a),n.data[a+s+1]=Math.floor(c.g*255/c.a),n.data[a+s+2]=Math.floor(c.b*255/c.a),n.data[a+s+3]=Math.floor(c.a*255)},"renderPixel");if(r.clips)for(let a=0,s=0;a<i;++a,s+=t*4)for(let u=0,c=0;u<t;u++,c+=4){let p=u/(t-1),{start:h,end:f}=r.clips[a],m=h*(1-p)+f*p;o(s,c,m)}else for(let a=0,s=0;a<t;a++,s+=4){let u=a/(t-1);o(0,s,u)}return n}l(Rl,"renderColorRamp");var Pm=class Pm extends Ge{createBucket(e){return new No(e)}constructor(e){super(e,Fv),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Rl({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};l(Pm,"HeatmapStyleLayer");var Bl=Pm;d();d();var Bv,gE=l(()=>Bv=Bv||new De({"hillshade-illumination-direction":new Z(A.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Z(A.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Z(A.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Z(A.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Z(A.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Z(A.paint_hillshade["hillshade-accent-color"])}),"getPaint"),Ov={get paint(){return gE()}};var Tm=class Tm extends Ge{constructor(e){super(e,Ov)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};l(Tm,"HillshadeStyleLayer");var Ol=Tm;d();d();d();var xE=_e([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Vv,size:cO,alignment:pO}=xE;var Zv=ae(Em(),1);d();d();function km(r,e,t,i,n){jv(r,e,t||0,i||r.length-1,n||zE)}l(km,"quickselect");function jv(r,e,t,i,n){for(;i>t;){if(i-t>600){var o=i-t+1,a=e-t+1,s=Math.log(o),u=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1),p=Math.max(t,Math.floor(e-a*u/o+c)),h=Math.min(i,Math.floor(e+(o-a)*u/o+c));jv(r,e,p,h,n)}var f=r[e],m=t,y=i;for(Zo(r,t,e),n(r[i],f)>0&&Zo(r,t,i);m<y;){for(Zo(r,m,y),m++,y--;n(r[m],f)<0;)m++;for(;n(r[y],f)>0;)y--}n(r[t],f)===0?Zo(r,t,y):(y++,Zo(r,y,i)),y<=e&&(t=y+1),e<=y&&(i=y-1)}}l(jv,"quickselectStep");function Zo(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}l(Zo,"swap");function zE(r,e){return r<e?-1:r>e?1:0}l(zE,"defaultCompare");function Ho(r,e){let t=r.length;if(t<=1)return[r];let i=[],n,o;for(let a=0;a<t;a++){let s=rb(r[a]);s!==0&&(r[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(n&&i.push(n),n=[r[a]]):n.push(r[a]))}if(n&&i.push(n),e>1)for(let a=0;a<i.length;a++)i[a].length<=e||(km(i[a],e,1,i[a].length-1,FE),i[a]=i[a].slice(0,e));return i}l(Ho,"classifyRings");function FE(r,e){return e.area-r.area}l(FE,"compareAreas");d();function un(r,e,t){let i=t.patternDependencies,n=!1;for(let o of e){let a=o.paint.get("".concat(r,"-pattern"));a.isConstant()||(n=!0);let s=a.constantOr(null);s&&(n=!0,i[s.to]=!0,i[s.from]=!0)}return n}l(un,"hasPattern");function cn(r,e,t,i,n){let o=n.patternDependencies;for(let a of e){let u=a.paint.get("".concat(r,"-pattern")).value;if(u.kind!=="constant"){let c=u.evaluate({zoom:i-1},t,{},n.availableImages),p=u.evaluate({zoom:i},t,{},n.availableImages),h=u.evaluate({zoom:i+1},t,{},n.availableImages);c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,h=h&&h.name?h.name:h,o[c]=!0,o[p]=!0,o[h]=!0,t.patterns[a.id]={min:c,mid:p,max:h}}}return t}l(cn,"addPatternDependencies");var RE=500,Lm=class Lm{constructor(e){this.zoom=e.zoom,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 dl,this.indexArray=new it,this.indexArray2=new Ir,this.programConfigurations=new mt(e.layers,e.zoom),this.segments=new me,this.segments2=new me,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=un("fill",this.layers,t);let n=this.layers[0].layout.get("fill-sort-key"),o=!n.isConstant(),a=[];for(let{feature:s,id:u,index:c,sourceLayerIndex:p}of e){let h=this.layers[0]._featureFilter.needGeometry,f=yt(s,h);if(!this.layers[0]._featureFilter.filter(new ye(this.zoom),f,i))continue;let m=o?n.evaluate(f,{},i,t.availableImages):void 0,y={id:u,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:h?f.geometry:dt(s),patterns:{},sortKey:m};a.push(y)}o&&a.sort((s,u)=>s.sortKey-u.sortKey);for(let s of a){let{geometry:u,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let f=cn("fill",this.layers,s,this.zoom,t);this.patternFeatures.push(f)}else this.addFeature(s,u,c,i,{});let h=e[c].feature;t.featureIndex.insert(h,u,c,p,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vv),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,n,o){for(let a of Ho(t,RE)){let s=0;for(let m of a)s+=m.length;let u=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),c=u.vertexLength,p=[],h=[];for(let m of a){if(m.length===0)continue;m!==a[0]&&h.push(p.length/2);let y=this.segments2.prepareSegment(m.length,this.layoutVertexArray,this.indexArray2),g=y.vertexLength;this.layoutVertexArray.emplaceBack(m[0].x,m[0].y),this.indexArray2.emplaceBack(g+m.length-1,g),p.push(m[0].x),p.push(m[0].y);for(let x=1;x<m.length;x++)this.layoutVertexArray.emplaceBack(m[x].x,m[x].y),this.indexArray2.emplaceBack(g+x-1,g+x),p.push(m[x].x),p.push(m[x].y);y.vertexLength+=m.length,y.primitiveLength+=m.length}let f=(0,Zv.default)(p,h);for(let m=0;m<f.length;m+=3)this.indexArray.emplaceBack(c+f[m],c+f[m+1],c+f[m+2]);u.vertexLength+=s,u.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,n)}};l(Lm,"FillBucket");var $o=Lm;N("FillBucket",$o,{omit:["layers","patternFeatures"]});d();var Hv,BE=l(()=>Hv=Hv||new De({"fill-sort-key":new $(A.layout_fill["fill-sort-key"])}),"getLayout"),$v,OE=l(()=>$v=$v||new De({"fill-antialias":new Z(A.paint_fill["fill-antialias"]),"fill-opacity":new $(A.paint_fill["fill-opacity"]),"fill-color":new $(A.paint_fill["fill-color"]),"fill-outline-color":new $(A.paint_fill["fill-outline-color"]),"fill-translate":new Z(A.paint_fill["fill-translate"]),"fill-translate-anchor":new Z(A.paint_fill["fill-translate-anchor"]),"fill-pattern":new ar(A.paint_fill["fill-pattern"])}),"getPaint"),Wv={get paint(){return OE()},get layout(){return BE()}};var Dm=class Dm extends Ge{constructor(e){super(e,Wv)}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 $o(e)}queryRadius(){return kr(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s){let u=Lr(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s);return kl(u,n)}isTileClipped(){return!0}};l(Dm,"FillStyleLayer");var ql=Dm;d();d();d();var VE=_e([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Xv=_e([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Kv,size:l4,alignment:u4}=VE;var r0=ae(Em(),1),i0=ae(Wo(),1);var JE=i0.default.VectorTileFeature.types,YE=500,Rm=Math.pow(2,13);function Xo(r,e,t,i,n,o,a,s){r.emplaceBack(e,t,Math.floor(i*Rm)*2+a,n*Rm*2,o*Rm*2,Math.round(s))}l(Xo,"addVertex");var Bm=class Bm{constructor(e){this.zoom=e.zoom,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 yl,this.centroidVertexArray=new Ar,this.indexArray=new it,this.programConfigurations=new mt(e.layers,e.zoom),this.segments=new me,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.features=[],this.hasPattern=un("fill-extrusion",this.layers,t);for(let{feature:n,id:o,index:a,sourceLayerIndex:s}of e){let u=this.layers[0]._featureFilter.needGeometry,c=yt(n,u);if(!this.layers[0]._featureFilter.filter(new ye(this.zoom),c,i))continue;let p={id:o,sourceLayerIndex:s,index:a,geometry:u?c.geometry:dt(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(cn("fill-extrusion",this.layers,p,this.zoom,t)):this.addFeature(p,p.geometry,a,i,{}),t.featureIndex.insert(n,p.geometry,a,s,this.index,!0)}}addFeatures(e,t,i){for(let n of this.features){let{geometry:o}=n;this.addFeature(n,o,n.index,t,i)}}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,Kv),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Xv.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,n,o){let a={x:0,y:0,vertexCount:0};for(let s of Ho(t,YE)){let u=0;for(let y of s)u+=y.length;let c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let y of s){if(y.length===0||ek(y))continue;let g=0;for(let x=0;x<y.length;x++){let b=y[x];if(x>=1){let w=y[x-1];if(!QE(b,w)){c.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let _=b.sub(w)._perp()._unit(),S=w.dist(b);g+S>32768&&(g=0),Xo(this.layoutVertexArray,b.x,b.y,_.x,_.y,0,0,g),Xo(this.layoutVertexArray,b.x,b.y,_.x,_.y,0,1,g),a.x+=2*b.x,a.y+=2*b.y,a.vertexCount+=2,g+=S,Xo(this.layoutVertexArray,w.x,w.y,_.x,_.y,0,0,g),Xo(this.layoutVertexArray,w.x,w.y,_.x,_.y,0,1,g),a.x+=2*w.x,a.y+=2*w.y,a.vertexCount+=2;let P=c.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),c.vertexLength+=4,c.primitiveLength+=2}}}}if(c.vertexLength+u>me.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),JE[e.type]!=="Polygon")continue;let p=[],h=[],f=c.vertexLength;for(let y of s)if(y.length!==0){y!==s[0]&&h.push(p.length/2);for(let g=0;g<y.length;g++){let x=y[g];Xo(this.layoutVertexArray,x.x,x.y,0,0,1,1,0),a.x+=x.x,a.y+=x.y,a.vertexCount+=1,p.push(x.x),p.push(x.y)}}let m=(0,r0.default)(p,h);for(let y=0;y<m.length;y+=3)this.indexArray.emplaceBack(f+m[y],f+m[y+2],f+m[y+1]);c.primitiveLength+=m.length/3,c.vertexLength+=u}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,n)}};l(Bm,"FillExtrusionBucket");var Ko=Bm;N("FillExtrusionBucket",Ko,{omit:["layers","features"]});function QE(r,e){return r.x===e.x&&(r.x<0||r.x>8192)||r.y===e.y&&(r.y<0||r.y>8192)}l(QE,"isBoundaryEdge");function ek(r){return r.every(e=>e.x<0)||r.every(e=>e.x>8192)||r.every(e=>e.y<0)||r.every(e=>e.y>8192)}l(ek,"isEntirelyOutside");d();var n0,tk=l(()=>n0=n0||new De({"fill-extrusion-opacity":new Z(A["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $(A["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Z(A["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Z(A["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ar(A["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new $(A["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $(A["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Z(A["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),"getPaint"),o0={get paint(){return tk()}};var Zl=ae(ge(),1);var Om=class Om extends Ge{constructor(e){super(e,o0)}createBucket(e){return new Ko(e)}queryRadius(){return kr(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,t,i,n,o,a,s,u){let c=Lr(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),p=this.paint.get("fill-extrusion-height").evaluate(t,i),h=this.paint.get("fill-extrusion-base").evaluate(t,i),f=nk(c,u,a,0),m=ik(n,h,p,u),y=m[0],g=m[1];return rk(y,g,f)}};l(Om,"FillExtrusionStyleLayer");var Hl=Om;function Jo(r,e){return r.x*e.x+r.y*e.y}l(Jo,"dot");function a0(r,e){if(r.length===1){let t=0,i=e[t++],n;for(;!n||i.equals(n);)if(n=e[t++],!n)return 1/0;for(;t<e.length;t++){let o=e[t],a=r[0],s=n.sub(i),u=o.sub(i),c=a.sub(i),p=Jo(s,s),h=Jo(s,u),f=Jo(u,u),m=Jo(c,s),y=Jo(c,u),g=p*f-h*h,x=(f*m-h*y)/g,b=(p*y-h*m)/g,w=1-x-b,_=i.z*w+n.z*x+o.z*b;if(isFinite(_))return _}return 1/0}else{let t=1/0;for(let i of e)t=Math.min(t,i.z);return t}}l(a0,"getIntersectionDistance");function rk(r,e,t){let i=1/0;kl(t,e)&&(i=a0(t,e[0]));for(let n=0;n<e.length;n++){let o=e[n],a=r[n];for(let s=0;s<o.length-1;s++){let u=o[s],c=o[s+1],p=a[s],h=a[s+1],f=[u,c,h,p,u];El(t,f)&&(i=Math.min(i,a0(t,f)))}}return i===1/0?!1:i}l(rk,"checkIntersection");function ik(r,e,t,i){let n=[],o=[],a=i[8]*e,s=i[9]*e,u=i[10]*e,c=i[11]*e,p=i[8]*t,h=i[9]*t,f=i[10]*t,m=i[11]*t;for(let y of r){let g=[],x=[];for(let b of y){let w=b.x,_=b.y,S=i[0]*w+i[4]*_+i[12],P=i[1]*w+i[5]*_+i[13],T=i[2]*w+i[6]*_+i[14],L=i[3]*w+i[7]*_+i[15],C=S+a,E=P+s,I=T+u,R=L+c,z=S+p,k=P+h,M=T+f,G=L+m,K=new Zl.default(C/R,E/R);K.z=I/R,g.push(K);let ne=new Zl.default(z/G,k/G);ne.z=M/G,x.push(ne)}n.push(g),o.push(x)}return[n,o]}l(ik,"projectExtrusion");function nk(r,e,t,i){let n=[];for(let o of r){let a=[o.x,o.y,i,1];qe.transformMat4(a,a,e),n.push(new Zl.default(a[0]/a[3],a[1]/a[3]))}return n}l(nk,"projectQueryGeometry");d();d();d();var ok=_e([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:s0,size:o5,alignment:a5}=ok;d();var ak=_e([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:l0,size:c5,alignment:p5}=ak;var p0=ae(Wo(),1);var sk=p0.default.VectorTileFeature.types,u0=63,lk=Math.cos(75/2*(Math.PI/180)),uk=15,ck=20,pk=15,h0=1/2,c0=Math.pow(2,pk-1)/h0,Vm=class Vm{constructor(e){this.zoom=e.zoom,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 gl,this.layoutVertexArray2=new xl,this.indexArray=new it,this.programConfigurations=new mt(e.layers,e.zoom),this.segments=new me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=un("line",this.layers,t);let n=this.layers[0].layout.get("line-sort-key"),o=!n.isConstant(),a=[];for(let{feature:s,id:u,index:c,sourceLayerIndex:p}of e){let h=this.layers[0]._featureFilter.needGeometry,f=yt(s,h);if(!this.layers[0]._featureFilter.filter(new ye(this.zoom),f,i))continue;let m=o?n.evaluate(f,{},i):void 0,y={id:u,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:h?f.geometry:dt(s),patterns:{},sortKey:m};a.push(y)}o&&a.sort((s,u)=>s.sortKey-u.sortKey);for(let s of a){let{geometry:u,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let f=cn("line",this.layers,s,this.zoom,t);this.patternFeatures.push(f)}else this.addFeature(s,u,c,i,{});let h=e[c].feature;t.featureIndex.insert(h,u,c,p,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i)}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,l0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,s0),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,n,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),u=a.get("line-cap"),c=a.get("line-miter-limit"),p=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let h of t)this.addLine(h,e,s,u,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,n)}addLine(e,t,i,n,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let b=0;b<e.length-1;b++)this.totalDistance+=e[b].dist(e[b+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=sk[t.type]==="Polygon",u=e.length;for(;u>=2&&e[u-1].equals(e[u-2]);)u--;let c=0;for(;c<u-1&&e[c].equals(e[c+1]);)c++;if(u<(s?3:2))return;i==="bevel"&&(o=1.05);let p=this.overscaling<=16?uk*8192/(512*this.overscaling):0,h=this.segments.prepareSegment(u*10,this.layoutVertexArray,this.indexArray),f,m,y,g,x;this.e1=this.e2=-1,s&&(f=e[u-2],x=e[c].sub(f)._unit()._perp());for(let b=c;b<u;b++){if(y=b===u-1?s?e[c+1]:void 0:e[b+1],y&&e[b].equals(y))continue;x&&(g=x),f&&(m=f),f=e[b],x=y?y.sub(f)._unit()._perp():g,g=g||x;let w=g.add(x);(w.x!==0||w.y!==0)&&w._unit();let _=g.x*x.x+g.y*x.y,S=w.x*x.x+w.y*x.y,P=S!==0?1/S:1/0,T=2*Math.sqrt(2-2*S),L=S<lk&&m&&y,C=g.x*x.y-g.y*x.x>0;if(L&&b>c){let R=f.dist(m);if(R>2*p){let z=f.sub(f.sub(m)._mult(p/R)._round());this.updateDistance(m,z),this.addCurrentVertex(z,g,0,0,h),m=z}}let E=m&&y,I=E?i:s?"butt":n;if(E&&I==="round"&&(P<a?I="miter":P<=2&&(I="fakeround")),I==="miter"&&P>o&&(I="bevel"),I==="bevel"&&(P>2&&(I="flipbevel"),P<o&&(I="miter")),m&&this.updateDistance(m,f),I==="miter")w._mult(P),this.addCurrentVertex(f,w,0,0,h);else if(I==="flipbevel"){if(P>100)w=x.mult(-1);else{let R=P*g.add(x).mag()/g.sub(x).mag();w._perp()._mult(R*(C?-1:1))}this.addCurrentVertex(f,w,0,0,h),this.addCurrentVertex(f,w.mult(-1),0,0,h)}else if(I==="bevel"||I==="fakeround"){let R=-Math.sqrt(P*P-1),z=C?R:0,k=C?0:R;if(m&&this.addCurrentVertex(f,g,z,k,h),I==="fakeround"){let M=Math.round(T*180/Math.PI/ck);for(let G=1;G<M;G++){let K=G/M;if(K!==.5){let J=K-.5,W=1.0904+_*(-3.2452+_*(3.55645-_*1.43519)),Ye=.848013+_*(-1.06021+_*.215638);K=K+K*J*(K-1)*(W*J*J+Ye)}let ne=x.sub(g)._mult(K)._add(g)._unit()._mult(C?-1:1);this.addHalfVertex(f,ne.x,ne.y,!1,C,0,h)}}y&&this.addCurrentVertex(f,x,-z,-k,h)}else if(I==="butt")this.addCurrentVertex(f,w,0,0,h);else if(I==="square"){let R=m?1:-1;this.addCurrentVertex(f,w,R,R,h)}else I==="round"&&(m&&(this.addCurrentVertex(f,g,0,0,h),this.addCurrentVertex(f,g,1,1,h,!0)),y&&(this.addCurrentVertex(f,x,-1,-1,h,!0),this.addCurrentVertex(f,x,0,0,h)));if(L&&b<u-1){let R=f.dist(y);if(R>2*p){let z=f.add(y.sub(f)._mult(p/R)._round());this.updateDistance(f,z),this.addCurrentVertex(z,x,0,0,h),f=z}}}}addCurrentVertex(e,t,i,n,o,a=!1){let s=t.x+t.y*i,u=t.y-t.x*i,c=-t.x+t.y*n,p=-t.y-t.x*n;this.addHalfVertex(e,s,u,a,!1,i,o),this.addHalfVertex(e,c,p,a,!0,-n,o),this.distance>c0/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,n,o,a))}addHalfVertex({x:e,y:t},i,n,o,a,s,u){let p=(this.lineClips?this.scaledDistance*(c0-1):this.scaledDistance)*h0;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(t<<1)+(a?1:0),Math.round(u0*i)+128,Math.round(u0*n)+128,(s===0?0:s<0?-1:1)+1|(p&63)<<2,p>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,m=this.lineClips.end-this.lineClips.start,y=f/m;this.layoutVertexArray2.emplaceBack(y,this.lineClipsArray.length)}let h=u.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,h),u.primitiveLength++),a?this.e2=h:this.e1=h}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()}};l(Vm,"LineBucket");var Yo=Vm;N("LineBucket",Yo,{omit:["layers","patternFeatures"]});d();var f0,hk=l(()=>f0=f0||new De({"line-cap":new Z(A.layout_line["line-cap"]),"line-join":new $(A.layout_line["line-join"]),"line-miter-limit":new Z(A.layout_line["line-miter-limit"]),"line-round-limit":new Z(A.layout_line["line-round-limit"]),"line-sort-key":new $(A.layout_line["line-sort-key"])}),"getLayout"),m0,fk=l(()=>m0=m0||new De({"line-opacity":new $(A.paint_line["line-opacity"]),"line-color":new $(A.paint_line["line-color"]),"line-translate":new Z(A.paint_line["line-translate"]),"line-translate-anchor":new Z(A.paint_line["line-translate-anchor"]),"line-width":new $(A.paint_line["line-width"]),"line-gap-width":new $(A.paint_line["line-gap-width"]),"line-offset":new $(A.paint_line["line-offset"]),"line-blur":new $(A.paint_line["line-blur"]),"line-dasharray":new ai(A.paint_line["line-dasharray"]),"line-pattern":new ar(A.paint_line["line-pattern"]),"line-gradient":new si(A.paint_line["line-gradient"])}),"getPaint"),Um={get paint(){return fk()},get layout(){return hk()}};var Gm=class Gm extends ${possiblyEvaluate(e,t){return t=new ye(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,n){return t=V({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,n)}};l(Gm,"LineFloorwidthProperty");var Nm=Gm,$l,qm=class qm extends Ge{constructor(e){super(e,Um),this.gradientVersion=0,$l||($l=new Nm(Um.paint.properties["line-width"].specification),$l.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();ni(t)?this.stepInterpolant=t._styleExpression.expression instanceof Gi: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"]=$l.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Yo(e)}queryRadius(e){let t=e,i=d0(fi("line-width",this,t),fi("line-gap-width",this,t)),n=fi("line-offset",this,t);return i/2+Math.abs(n)+kr(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s){let u=Lr(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),c=s/2*d0(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),p=this.paint.get("line-offset").evaluate(t,i);return p&&(n=H_(n,p*s)),q_(u,n,c)}isTileClipped(){return!0}};l(qm,"LineStyleLayer");var Wl=qm;function d0(r,e){return e>0?e+2*r:r}l(d0,"getLineWidth");d();d();d();var y0=_e([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),g0=_e([{name:"a_projected_pos",components:3,type:"Float32"}],4),tV=_e([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),x0=_e([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),rV=_e([{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"}]),jm=_e([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),b0=_e([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),iV=_e([{name:"triangle",components:3,type:"Uint16"}]),nV=_e([{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"}]),oV=_e([{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"}]),aV=_e([{type:"Float32",name:"offsetX"}]),sV=_e([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),lV=_e([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var ta=ae(ge(),1);d();function mk(r,e,t){let i=e.layout.get("text-transform").evaluate(t,{});return i==="uppercase"?r=r.toLocaleUpperCase():i==="lowercase"&&(r=r.toLocaleLowerCase()),or.applyArabicShaping&&(r=or.applyArabicShaping(r)),r}l(mk,"transformTextInternal");function _0(r,e,t){return r.sections.forEach(i=>{i.text=mk(i.text,e,t)}),r}l(_0,"transformText");d();function v0(r){let e={},t={},i=[],n=0;function o(c){i.push(r[c]),n++}l(o,"add");function a(c,p,h){let f=t[c];return delete t[c],t[p]=f,i[f].geometry[0].pop(),i[f].geometry[0]=i[f].geometry[0].concat(h[0]),f}l(a,"mergeFromRight");function s(c,p,h){let f=e[p];return delete e[p],e[c]=f,i[f].geometry[0].shift(),i[f].geometry[0]=h[0].concat(i[f].geometry[0]),f}l(s,"mergeFromLeft");function u(c,p,h){let f=h?p[0][p[0].length-1]:p[0][0];return"".concat(c,":").concat(f.x,":").concat(f.y)}l(u,"getKey");for(let c=0;c<r.length;c++){let p=r[c],h=p.geometry,f=p.text?p.text.toString():null;if(!f){o(c);continue}let m=u(f,h),y=u(f,h,!0);if(m in t&&y in e&&t[m]!==e[y]){let g=s(m,y,h),x=a(m,y,i[g].geometry);delete e[m],delete t[y],t[u(f,i[x].geometry,!0)]=x,i[g].geometry=null}else m in t?a(m,y,h):y in e?s(m,y,h):(o(c),e[m]=n-1,t[y]=n-1)}return i.filter(c=>c.geometry)}l(v0,"mergeLines");d();d();var w0={"!":"\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"};d();var Dr=24;d();var E0=ae($m(),1);var C0=3;function Lk(r,e,t){r===1&&t.readMessage(Dk,e)}l(Lk,"readFontstacks");function Dk(r,e,t){if(r===3){let{id:i,bitmap:n,width:o,height:a,left:s,top:u,advance:c}=t.readMessage(zk,{});e.push({id:i,bitmap:new mi({width:o+2*C0,height:a+2*C0},n),metrics:{width:o,height:a,left:s,top:u,advance:c}})}}l(Dk,"readFontstack");function zk(r,e,t){r===1?e.id=t.readVarint():r===2?e.bitmap=t.readBytes():r===3?e.width=t.readVarint():r===4?e.height=t.readVarint():r===5?e.left=t.readSVarint():r===6?e.top=t.readSVarint():r===7&&(e.advance=t.readVarint())}l(zk,"readGlyph");function k0(r){return new E0.default(r).readFields(Lk,[])}l(k0,"parseGlyphPbf");d();d();function Qo(r){let e=0,t=0;for(let s of r)e+=s.w*s.h,t=Math.max(t,s.w);r.sort((s,u)=>u.h-s.h);let n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),t),h:1/0}],o=0,a=0;for(let s of r)for(let u=n.length-1;u>=0;u--){let c=n[u];if(!(s.w>c.w||s.h>c.h)){if(s.x=c.x,s.y=c.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===c.w&&s.h===c.h){let p=n.pop();u<n.length&&(n[u]=p)}else s.h===c.h?(c.x+=s.w,c.w-=s.w):s.w===c.w?(c.y+=s.h,c.h-=s.h):(n.push({x:c.x+s.w,y:c.y,w:c.w-s.w,h:s.h}),c.y+=s.h,c.h-=s.h);break}}return{w:o,h:a,fill:e/(o*a)||0}}l(Qo,"potpack");var xt=1;var Xm=class Xm{constructor(e,{pixelRatio:t,version:i,stretchX:n,stretchY:o,content:a}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=n,this.stretchY=o,this.content=a,this.version=i}get tl(){return[this.paddedRect.x+xt,this.paddedRect.y+xt]}get br(){return[this.paddedRect.x+this.paddedRect.w-xt,this.paddedRect.y+this.paddedRect.h-xt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-xt*2)/this.pixelRatio,(this.paddedRect.h-xt*2)/this.pixelRatio]}};l(Xm,"ImagePosition");var mn=Xm,Km=class Km{constructor(e,t){let i={},n={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,i,o),this.addImages(t,n,o);let{w:a,h:s}=Qo(o),u=new Se({width:a||1,height:s||1});for(let c in e){let p=e[c],h=i[c].paddedRect;Se.copy(p.data,u,{x:0,y:0},{x:h.x+xt,y:h.y+xt},p.data)}for(let c in t){let p=t[c],h=n[c].paddedRect,f=h.x+xt,m=h.y+xt,y=p.data.width,g=p.data.height;Se.copy(p.data,u,{x:0,y:0},{x:f,y:m},p.data),Se.copy(p.data,u,{x:0,y:g-1},{x:f,y:m-1},{width:y,height:1}),Se.copy(p.data,u,{x:0,y:0},{x:f,y:m+g},{width:y,height:1}),Se.copy(p.data,u,{x:y-1,y:0},{x:f-1,y:m},{width:1,height:g}),Se.copy(p.data,u,{x:0,y:0},{x:f+y,y:m},{width:1,height:g})}this.image=u,this.iconPositions=i,this.patternPositions=n}addImages(e,t,i){for(let n in e){let o=e[n],a={x:0,y:0,w:o.data.width+2*xt,h:o.data.height+2*xt};i.push(a),t[n]=new mn(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}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[n,o]=e.tl;i.update(t.data,void 0,{x:n,y:o})}};l(Km,"ImageAtlas");var Wm=Km;N("ImagePosition",mn);N("ImageAtlas",Wm);var yi=(n=>(n[n.none=0]="none",n[n.horizontal=1]="horizontal",n[n.vertical=2]="vertical",n[n.horizontalOnly=3]="horizontalOnly",n))(yi||{});function Jl(r){let e=.5,t=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(r){case"bottom":case"bottom-right":case"bottom-left":t=1;break;case"top":case"top-right":case"top-left":t=0;break}return{horizontalAlign:e,verticalAlign:t}}l(Jl,"getAnchorAlignment");var z0=ae(Wo(),1);d();var L0=255,ea=128,Yl=L0*ea;function Jm(r,e){let{expression:t}=e;if(t.kind==="constant")return{kind:"constant",layoutSize:t.evaluate(new ye(r+1))};if(t.kind==="source")return{kind:"source"};{let{zoomStops:i,interpolationType:n}=t,o=0;for(;o<i.length&&i[o]<=r;)o++;o=Math.max(0,o-1);let a=o;for(;a<i.length&&i[a]<r+1;)a++;a=Math.min(i.length-1,a);let s=i[o],u=i[a];if(t.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:u,interpolationType:n};let c=t.evaluate(new ye(s)),p=t.evaluate(new ye(u));return{kind:"camera",minZoom:s,maxZoom:u,minSize:c,maxSize:p,interpolationType:n}}}l(Jm,"getSizeData");function dn(r,{uSize:e,uSizeT:t},{lowerSize:i,upperSize:n}){return r.kind==="source"?i/ea:r.kind==="composite"?Pe.number(i/ea,n/ea,t):e}l(dn,"evaluateSizeForFeature");function gi(r,e){let t=0,i=0;if(r.kind==="constant")i=r.layoutSize;else if(r.kind!=="source"){let{interpolationType:n,minZoom:o,maxZoom:a}=r,s=n?Ae(vt.interpolationFactor(n,e,o,a),0,1):0;r.kind==="camera"?i=Pe.number(r.minSize,r.maxSize,s):t=s}return{uSizeT:t,uSize:i}}l(gi,"evaluateSizeForZoom");d();function yn(r,e,t){let i="never",n=r.get(e);return n?i=n:r.get(t)&&(i="always"),i}l(yn,"getOverlapMode");var Rk=z0.default.VectorTileFeature.types,Bk=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ql(r,e,t,i,n,o,a,s,u,c,p,h,f){let m=s?Math.min(Yl,Math.round(s[0])):0,y=s?Math.min(Yl,Math.round(s[1])):0;r.emplaceBack(e,t,Math.round(i*32),Math.round(n*32),o,a,(m<<1)+(u?1:0),y,c*16,p*16,h*256,f*256)}l(Ql,"addVertex");function xi(r,e,t){r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t)}l(xi,"addDynamicAttributes");function Ok(r){for(let e of r.sections)if(C_(e.text))return!0;return!1}l(Ok,"containsRTLText");var Ym=class Ym{constructor(e){this.layoutVertexArray=new bl,this.indexArray=new it,this.programConfigurations=e,this.segments=new me,this.dynamicLayoutVertexArray=new _l,this.opacityVertexArray=new vl,this.hasVisibleVertices=!1,this.placedSymbolArray=new Io}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,y0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,g0.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Bk,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&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())}};l(Ym,"SymbolBuffers");var ra=Ym;N("SymbolBuffers",ra);var Qm=class Qm{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new me,this.collisionVertexArray=new Sl}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,x0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};l(Qm,"CollisionBuffers");var ia=Qm;N("CollisionBuffers",ia);var ed=class ed{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(u=>u.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=q.identity([]),this.placementViewportMatrix=q.identity([]);let i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Jm(this.zoom,i["text-size"]),this.iconSizeData=Jm(this.zoom,i["icon-size"]);let n=this.layers[0].layout,o=n.get("symbol-sort-key"),a=n.get("symbol-z-order");this.canOverlap=yn(n,"text-overlap","text-allow-overlap")!=="never"||yn(n,"icon-overlap","icon-allow-overlap")!=="never"||n.get("text-ignore-placement")||n.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,n.get("symbol-placement")==="point"&&(this.writingModes=n.get("text-writing-mode").map(u=>yi[u])),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.sourceID=e.sourceID}createArrays(){this.text=new ra(new mt(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new ra(new mt(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Eo,this.lineVertexArray=new ko,this.symbolInstances=new Co,this.textAnchorOffsets=new Lo}calculateGlyphDependencies(e,t,i,n,o){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(i||n)&&o){let s=w0[e.charAt(a)];s&&(t[s.charCodeAt(0)]=!0)}}populate(e,t,i){let n=this.layers[0],o=n.layout,a=o.get("text-font"),s=o.get("text-field"),u=o.get("icon-image"),c=(s.value.kind!=="constant"||s.value.value instanceof wt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),p=u.value.kind!=="constant"||!!u.value.value||Object.keys(u.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!p)return;let f=t.iconDependencies,m=t.glyphDependencies,y=t.availableImages,g=new ye(this.zoom);for(let{feature:x,id:b,index:w,sourceLayerIndex:_}of e){let S=n._featureFilter.needGeometry,P=yt(x,S);if(!n._featureFilter.filter(g,P,i))continue;S||(P.geometry=dt(x));let T;if(c){let I=n.getValueAndResolveTokens("text-field",P,i,y),R=wt.factory(I),z=this.hasRTLText=this.hasRTLText||Ok(R);(!z||or.getRTLTextPluginStatus()==="unavailable"||z&&or.isParsed())&&(T=_0(R,n,P))}let L;if(p){let I=n.getValueAndResolveTokens("icon-image",P,i,y);I instanceof ft?L=I:L=ft.fromString(I)}if(!T&&!L)continue;let C=this.sortFeaturesByKey?h.evaluate(P,{},i):void 0,E={id:b,text:T,icon:L,index:w,sourceLayerIndex:_,geometry:P.geometry,properties:x.properties,type:Rk[x.type],sortKey:C};if(this.features.push(E),L&&(f[L.name]=!0),T){let I=a.evaluate(P,{},i).join(","),R=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let z of T.sections)if(z.image)f[z.image.name]=!0;else{let k=Ah(T.toString()),M=z.fontStack||I,G=m[M]=m[M]||{};this.calculateGlyphDependencies(z.text,G,R,this.allowVerticalPlacement,k)}}}o.get("symbol-placement")==="line"&&(this.features=v0(this.features)),this.sortFeaturesByKey&&this.features.sort((x,b)=>x.sortKey-b.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 n=e.dist(t[e.segment+1]),o=e.dist(t[e.segment]),a={};for(let s=e.segment+1;s<t.length;s++)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:n},s<t.length-1&&(n+=t[s+1].dist(t[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=t[s-1].dist(t[s]));for(let s=0;s<t.length;s++){let u=a[s];this.lineVertexArray.emplaceBack(u.x,u.y,u.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,n,o,a,s,u,c,p,h,f){let m=e.indexArray,y=e.layoutVertexArray,g=e.segments.prepareSegment(4*t.length,y,m,this.canOverlap?a.sortKey:void 0),x=this.glyphOffsetArray.length,b=g.vertexLength,w=this.allowVerticalPlacement&&s===2?Math.PI/2:0,_=a.text&&a.text.sections;for(let S=0;S<t.length;S++){let{tl:P,tr:T,bl:L,br:C,tex:E,pixelOffsetTL:I,pixelOffsetBR:R,minFontScaleX:z,minFontScaleY:k,glyphOffset:M,isSDF:G,sectionIndex:K}=t[S],ne=g.vertexLength,J=M[1];Ql(y,u.x,u.y,P.x,J+P.y,E.x,E.y,i,G,I.x,I.y,z,k),Ql(y,u.x,u.y,T.x,J+T.y,E.x+E.w,E.y,i,G,R.x,I.y,z,k),Ql(y,u.x,u.y,L.x,J+L.y,E.x,E.y+E.h,i,G,I.x,R.y,z,k),Ql(y,u.x,u.y,C.x,J+C.y,E.x+E.w,E.y+E.h,i,G,R.x,R.y,z,k),xi(e.dynamicLayoutVertexArray,u,w),m.emplaceBack(ne,ne+1,ne+2),m.emplaceBack(ne+1,ne+2,ne+3),g.vertexLength+=4,g.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(M[0]),(S===t.length-1||K!==t[S+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(y.length,a,a.index,{},f,_&&_[K])}e.placedSymbolArray.emplaceBack(u.x,u.y,x,this.glyphOffsetArray.length-x,b,c,p,u.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,h)}_addCollisionDebugVertex(e,t,i,n,o,a){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,n,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,i,n,o,a,s){let u=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=u.vertexLength,p=o.layoutVertexArray,h=o.collisionVertexArray,f=s.anchorX,m=s.anchorY;this._addCollisionDebugVertex(p,h,a,f,m,new ta.default(e,t)),this._addCollisionDebugVertex(p,h,a,f,m,new ta.default(i,t)),this._addCollisionDebugVertex(p,h,a,f,m,new ta.default(i,n)),this._addCollisionDebugVertex(p,h,a,f,m,new ta.default(e,n)),u.vertexLength+=4;let y=o.indexArray;y.emplaceBack(c,c+1),y.emplaceBack(c+1,c+2),y.emplaceBack(c+2,c+3),y.emplaceBack(c+3,c),u.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,n){for(let o=e;o<t;o++){let a=this.collisionBoxArray.get(o),s=a.x1,u=a.y1,c=a.x2,p=a.y2;this.addCollisionDebugVertices(s,u,c,p,n?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ia(zo,jm.members,Ir),this.iconCollisionBox=new ia(zo,jm.members,Ir);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,n,o,a,s,u,c){let p={};for(let h=t;h<i;h++){let f=e.get(h);p.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},p.textFeatureIndex=f.featureIndex;break}for(let h=n;h<o;h++){let f=e.get(h);p.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},p.verticalTextFeatureIndex=f.featureIndex;break}for(let h=a;h<s;h++){let f=e.get(h);p.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},p.iconFeatureIndex=f.featureIndex;break}for(let h=u;h<c;h++){let f=e.get(h);p.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},p.verticalIconFeatureIndex=f.featureIndex;break}return p}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),n=i.vertexStartIndex+i.numGlyphs*4;for(let o=i.vertexStartIndex;o<n;o+=4)e.indexArray.emplaceBack(o,o+1,o+2),e.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),n=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let u=this.symbolInstances.get(s);n.push(Math.round(t*u.anchorX+i*u.anchorY)|0),o.push(u.featureIndex)}return a.sort((s,u)=>n[s]-n[u]||o[u]-o[s]),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((n,o,a)=>{n>=0&&a.indexOf(n)===o&&this.addIndicesForPlacedSymbol(this.text,n)}),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)}}};l(ed,"SymbolBucket");var Ot=ed;N("SymbolBucket",Ot,{omit:["layers","collisionBoxArray","features","compareText"]});Ot.MAX_GLYPHS=65535;Ot.addDynamicAttributes=xi;d();function F0(r,e){return e.replace(/{([^{}]+)}/g,(t,i)=>r&&i in r?String(r[i]):"")}l(F0,"resolveTokens");d();var R0,Vk=l(()=>R0=R0||new De({"symbol-placement":new Z(A.layout_symbol["symbol-placement"]),"symbol-spacing":new Z(A.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Z(A.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $(A.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Z(A.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Z(A.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Z(A.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Z(A.layout_symbol["icon-ignore-placement"]),"icon-optional":new Z(A.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Z(A.layout_symbol["icon-rotation-alignment"]),"icon-size":new $(A.layout_symbol["icon-size"]),"icon-text-fit":new Z(A.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Z(A.layout_symbol["icon-text-fit-padding"]),"icon-image":new $(A.layout_symbol["icon-image"]),"icon-rotate":new $(A.layout_symbol["icon-rotate"]),"icon-padding":new $(A.layout_symbol["icon-padding"]),"icon-keep-upright":new Z(A.layout_symbol["icon-keep-upright"]),"icon-offset":new $(A.layout_symbol["icon-offset"]),"icon-anchor":new $(A.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Z(A.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Z(A.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Z(A.layout_symbol["text-rotation-alignment"]),"text-field":new $(A.layout_symbol["text-field"]),"text-font":new $(A.layout_symbol["text-font"]),"text-size":new $(A.layout_symbol["text-size"]),"text-max-width":new $(A.layout_symbol["text-max-width"]),"text-line-height":new Z(A.layout_symbol["text-line-height"]),"text-letter-spacing":new $(A.layout_symbol["text-letter-spacing"]),"text-justify":new $(A.layout_symbol["text-justify"]),"text-radial-offset":new $(A.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Z(A.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new $(A.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new $(A.layout_symbol["text-anchor"]),"text-max-angle":new Z(A.layout_symbol["text-max-angle"]),"text-writing-mode":new Z(A.layout_symbol["text-writing-mode"]),"text-rotate":new $(A.layout_symbol["text-rotate"]),"text-padding":new Z(A.layout_symbol["text-padding"]),"text-keep-upright":new Z(A.layout_symbol["text-keep-upright"]),"text-transform":new $(A.layout_symbol["text-transform"]),"text-offset":new $(A.layout_symbol["text-offset"]),"text-allow-overlap":new Z(A.layout_symbol["text-allow-overlap"]),"text-overlap":new Z(A.layout_symbol["text-overlap"]),"text-ignore-placement":new Z(A.layout_symbol["text-ignore-placement"]),"text-optional":new Z(A.layout_symbol["text-optional"])}),"getLayout"),B0,Uk=l(()=>B0=B0||new De({"icon-opacity":new $(A.paint_symbol["icon-opacity"]),"icon-color":new $(A.paint_symbol["icon-color"]),"icon-halo-color":new $(A.paint_symbol["icon-halo-color"]),"icon-halo-width":new $(A.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $(A.paint_symbol["icon-halo-blur"]),"icon-translate":new Z(A.paint_symbol["icon-translate"]),"icon-translate-anchor":new Z(A.paint_symbol["icon-translate-anchor"]),"text-opacity":new $(A.paint_symbol["text-opacity"]),"text-color":new $(A.paint_symbol["text-color"],{runtimeType:Ct,getOverride:l(r=>r.textColor,"getOverride"),hasOverride:l(r=>!!r.textColor,"hasOverride")}),"text-halo-color":new $(A.paint_symbol["text-halo-color"]),"text-halo-width":new $(A.paint_symbol["text-halo-width"]),"text-halo-blur":new $(A.paint_symbol["text-halo-blur"]),"text-translate":new Z(A.paint_symbol["text-translate"]),"text-translate-anchor":new Z(A.paint_symbol["text-translate-anchor"])}),"getPaint"),eu={get paint(){return Uk()},get layout(){return Vk()}};d();var td=class td{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:ji,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}};l(td,"FormatSectionOverride");var na=td;N("FormatSectionOverride",na,{omit:["defaultValue"]});var oa=class oa extends Ge{constructor(e){super(e,eu)}recalculate(e,t){if(super.recalculate(e,t),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 i=this.layout.get("text-writing-mode");if(i){let n=[];for(let o of i)n.indexOf(o)<0&&n.push(o);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,n){let o=this.layout.get(e).evaluate(t,{},i,n),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!ni(a.value)&&o?F0(t.properties,o):o}createBucket(e){return new Ot(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of eu.paint.overridableProperties){if(!oa.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),i=new na(t),n=new ei(i,t.property.specification),o=null;t.value.kind==="constant"||t.value.kind==="source"?o=new vr("source",n):o=new wr("composite",n,t.value.zoomStops),this.paint._values[e]=new at(t.property,o,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!this.layout||t.isDataDriven()||i.isDataDriven()?!1:oa.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let i=e.get("text-field"),n=eu.paint.properties[t],o=!1,a=l(s=>{for(let u of s)if(n.overrides&&n.overrides.hasOverride(u)){o=!0;return}},"checkSections");if(i.value.kind==="constant"&&i.value.value instanceof wt)a(i.value.value.sections);else if(i.value.kind==="source"){let s=l(c=>{if(!o)if(c instanceof br&&He(c.value)===Zi){let p=c.value;a(p.sections)}else c instanceof Kn?a(c.sections):c.eachChild(s)},"checkExpression"),u=i.value;u._styleExpression&&s(u._styleExpression.expression)}return o}};l(oa,"SymbolStyleLayer");var tu=oa;d();d();var O0,Nk=l(()=>O0=O0||new De({"background-color":new Z(A.paint_background["background-color"]),"background-pattern":new ai(A.paint_background["background-pattern"]),"background-opacity":new Z(A.paint_background["background-opacity"])}),"getPaint"),V0={get paint(){return Nk()}};var rd=class rd extends Ge{constructor(e){super(e,V0)}};l(rd,"BackgroundStyleLayer");var ru=rd;d();d();var U0,Gk=l(()=>U0=U0||new De({"raster-opacity":new Z(A.paint_raster["raster-opacity"]),"raster-hue-rotate":new Z(A.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Z(A.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Z(A.paint_raster["raster-brightness-max"]),"raster-saturation":new Z(A.paint_raster["raster-saturation"]),"raster-contrast":new Z(A.paint_raster["raster-contrast"]),"raster-resampling":new Z(A.paint_raster["raster-resampling"]),"raster-fade-duration":new Z(A.paint_raster["raster-fade-duration"])}),"getPaint"),N0={get paint(){return Gk()}};var id=class id extends Ge{constructor(e){super(e,N0)}};l(id,"RasterStyleLayer");var iu=id;d();function G0(r){let e=[],t=r.id;return t===void 0&&e.push({message:"layers.".concat(t,': missing required property "id"')}),r.render===void 0&&e.push({message:"layers.".concat(t,': missing required method "render"')}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:"layers.".concat(t,': property "renderingMode" must be either "2d" or "3d"')}),e}l(G0,"validateCustomStyleLayer");var nd=class nd extends Ge{constructor(t){super(t,{});this.onAdd=l(t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},"onAdd");this.onRemove=l(t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},"onRemove");this.implementation=t}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")}};l(nd,"CustomStyleLayer");var nu=nd;function ou(r){if(r.type==="custom")return new nu(r);switch(r.type){case"background":return new ru(r);case"circle":return new Dl(r);case"fill":return new ql(r);case"fill-extrusion":return new Hl(r);case"heatmap":return new Bl(r);case"hillshade":return new Ol(r);case"line":return new Wl(r);case"raster":return new iu(r);case"symbol":return new tu(r)}}l(ou,"createStyleLayer");d();d();function gn(r){let e=[];if(typeof r=="string")e.push({id:"default",url:r});else if(r&&r.length>0){let t=[];for(let{id:i,url:n}of r){let o="".concat(i).concat(n);t.indexOf(o)===-1&&(t.push(o),e.push({id:i,url:n}))}}return e}l(gn,"coerceSpriteToArray");async function q0(r,e,t,i){let n=gn(r),o=t>1?"@2x":"",a={},s={};for(let{id:u,url:c}of n){let p=e.transformRequest(e.normalizeSpriteURL(c,o,".json"),"SpriteJSON");a[u]=gr(p,i);let h=e.transformRequest(e.normalizeSpriteURL(c,o,".png"),"SpriteImage");s[u]=st.getImage(h,i)}return await Promise.all([...Object.values(a),...Object.values(s)]),qk(a,s)}l(q0,"loadSprite");async function qk(r,e){let t={};for(let i in r){t[i]={};let n=Y.getImageCanvasContext((await e[i]).data),o=(await r[i]).data;for(let a in o){let{width:s,height:u,x:c,y:p,sdf:h,pixelRatio:f,stretchX:m,stretchY:y,content:g}=o[a],x={width:s,height:u,x:c,y:p,context:n};t[i][a]={data:null,pixelRatio:f,sdf:h,stretchX:m,stretchY:y,content:g,spriteData:x}}}return t}l(qk,"doOnceCompleted");d();d();var od=class od{constructor(e,t,i,n){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,n)}update(e,t,i){let{width:n,height:o}=e,a=(!this.size||this.size[0]!==n||this.size[1]!==o)&&!i,{context:s}=this,{gl:u}=s;if(this.useMipmap=!!(t&&t.useMipmap),u.bindTexture(u.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===u.RGBA&&(!t||t.premultiply!==!1)),a)this.size=[n,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ht(e)?u.texImage2D(u.TEXTURE_2D,0,this.format,this.format,u.UNSIGNED_BYTE,e):u.texImage2D(u.TEXTURE_2D,0,this.format,n,o,0,this.format,u.UNSIGNED_BYTE,e.data);else{let{x:c,y:p}=i||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ht(e)?u.texSubImage2D(u.TEXTURE_2D,0,c,p,u.RGBA,u.UNSIGNED_BYTE,e):u.texSubImage2D(u.TEXTURE_2D,0,c,p,n,o,u.RGBA,u.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&u.generateMipmap(u.TEXTURE_2D)}bind(e,t,i){let{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),i===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(i=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,t),o.texParameteri(o.TEXTURE_2D,o.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}};l(od,"Texture");var ve=od;d();function j0(r){let{userImage:e}=r;return e&&e.render&&e.render()?(r.data.replace(new Uint8Array(e.data.buffer)),!0):!1}l(j0,"renderStyleImage");var au=1,ad=class ad extends de{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new Se({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 Se({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,n=t.data||t.spriteData;return this._validateStretch(t.stretchX,n&&n.width)||(this.fire(new H(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),i=!1),this._validateStretch(t.stretchY,n&&n.height)||(this.fire(new H(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),i=!1),this._validateContent(t.content,t)||(this.fire(new H(new Error('Image "'.concat(e,'" has invalid "content" value')))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let n of e){if(n[0]<i||n[1]<n[0]||t<n[1])return!1;i=n[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let i=t.spriteData,n=i&&i.width||t.data.width,o=i&&i.height||t.data.height;return!(e[0]<0||n<e[0]||e[1]<0||o<e[1]||e[2]<0||n<e[2]||e[3]<0||o<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){let n=this.getImage(e);if(i&&(n.data.width!==t.data.width||n.data.height!==t.data.height))throw new Error("size mismatch between old image (".concat(n.data.width,"x").concat(n.data.height,") and new image (").concat(t.data.width,"x").concat(t.data.height,")."));t.version=n.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 n=!0;if(!this.isLoaded())for(let o of e)this.images[o]||(n=!1);this.isLoaded()||n?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let t={};for(let i of e){let n=this.getImage(i);n||(this.fire(new F("styleimagemissing",{id:i})),n=this.getImage(i)),n?t[i]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,hasRenderCallback:!!(n.userImage&&n.userImage.render)}:Le('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 n=i.data.width+au*2,o=i.data.height+au*2,a={w:n,h:o,x:0,y:0},s=new mn(a,i);this.patterns[e]={bin:a,position:s}}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 ve(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let o in this.patterns)e.push(this.patterns[o].bin);let{w:t,h:i}=Qo(e),n=this.atlasImage;n.resize({width:t||1,height:i||1});for(let o in this.patterns){let{bin:a}=this.patterns[o],s=a.x+au,u=a.y+au,c=this.getImage(o).data,p=c.width,h=c.height;Se.copy(c,n,{x:0,y:0},{x:s,y:u},{width:p,height:h}),Se.copy(c,n,{x:0,y:h-1},{x:s,y:u-1},{width:p,height:1}),Se.copy(c,n,{x:0,y:0},{x:s,y:u+h},{width:p,height:1}),Se.copy(c,n,{x:p-1,y:0},{x:s-1,y:u},{width:1,height:h}),Se.copy(c,n,{x:0,y:0},{x:s+p,y:u},{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||Le('Image with ID: "'.concat(t,'" was not found')),j0(i)&&this.updateImage(t,i)}}};l(ad,"ImageManager");var su=ad;d();d();async function Z0(r,e,t,i){let n=e*256,o=n+255,a=i.transformRequest(t.replace("{fontstack}",r).replace("{range}","".concat(n,"-").concat(o)),"Glyphs"),s=await pb(a,new AbortController);if(!s||!s.data)throw new Error("Could not load glyph range. range: ".concat(e,", ").concat(n,"-").concat(o));let u={};for(let c of k0(s.data))u[c.id]=c;return u}l(Z0,"loadGlyphRange");d();var sd=class sd{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:a="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=i;let u=this.size=e+t*4,c=this._createCanvas(u),p=this.ctx=c.getContext("2d",{willReadFrequently:!0});p.font="".concat(s," ").concat(a," ").concat(e,"px ").concat(o),p.textBaseline="alphabetic",p.textAlign="left",p.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:a}=this.ctx.measureText(e),s=Math.ceil(i),u=0,c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-o))),p=Math.min(this.size-this.buffer,s+Math.ceil(n)),h=c+2*this.buffer,f=p+2*this.buffer,m=Math.max(h*f,0),y=new Uint8ClampedArray(m),g={data:y,width:h,height:f,glyphWidth:c,glyphHeight:p,glyphTop:s,glyphLeft:u,glyphAdvance:t};if(c===0||p===0)return g;let{ctx:x,buffer:b,gridInner:w,gridOuter:_}=this;x.clearRect(b,b,c,p),x.fillText(e,b,b+s);let S=x.getImageData(b,b,c,p);_.fill(1e20,0,m),w.fill(0,0,m);for(let P=0;P<p;P++)for(let T=0;T<c;T++){let L=S.data[4*(P*c+T)+3]/255;if(L===0)continue;let C=(P+b)*h+T+b;if(L===1)_[C]=0,w[C]=1e20;else{let E=.5-L;_[C]=E>0?E*E:0,w[C]=E<0?E*E:0}}H0(_,0,0,h,f,h,this.f,this.v,this.z),H0(w,b,b,c,p,h,this.f,this.v,this.z);for(let P=0;P<m;P++){let T=Math.sqrt(_[P])-Math.sqrt(w[P]);y[P]=Math.round(255-255*(T/this.radius+this.cutoff))}return g}};l(sd,"TinySDF");var aa=sd;function H0(r,e,t,i,n,o,a,s,u){for(let c=e;c<e+i;c++)$0(r,t*o+c,o,n,a,s,u);for(let c=t;c<t+n;c++)$0(r,c*o+e,1,i,a,s,u)}l(H0,"edt");function $0(r,e,t,i,n,o,a){o[0]=0,a[0]=-1e20,a[1]=1e20,n[0]=r[e];for(let s=1,u=0,c=0;s<i;s++){n[s]=r[e+s*t];let p=s*s;do{let h=o[u];c=(n[s]-n[h]+p-h*h)/(s-h)/2}while(c<=a[u]&&--u>-1);u++,o[u]=s,a[u]=c,a[u+1]=1e20}for(let s=0,u=0;s<i;s++){for(;a[u+1]<s;)u++;let c=o[u],p=s-c;r[e+s*t]=n[c]+p*p}}l($0,"edt1d");var bi=class bi{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}async getGlyphs(e){let t=[];for(let o in e)for(let a of e[o])t.push(this._getAndCacheGlyphsPromise(o,a));let i=await Promise.all(t),n={};for(let{stack:o,id:a,glyph:s}of i)n[o]||(n[o]={}),n[o][a]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return n}async _getAndCacheGlyphsPromise(e,t){let i=this.entries[e];i||(i=this.entries[e]={glyphs:{},requests:{},ranges:{}});let n=i.glyphs[t];if(n!==void 0)return{stack:e,id:t,glyph:n};if(n=this._tinySDF(i,e,t),n)return i.glyphs[t]=n,{stack:e,id:t,glyph:n};let o=Math.floor(t/256);if(o*256>65535)throw new Error("glyphs > 65535 not supported");if(i.ranges[o])return{stack:e,id:t,glyph:n};if(!this.url)throw new Error("glyphsUrl is not set");if(!i.requests[o]){let s=bi.loadGlyphRange(e,o,this.url,this.requestManager);i.requests[o]=s}let a=await i.requests[o];for(let s in a)this._doesCharSupportLocalGlyph(+s)||(i.glyphs[+s]=a[+s]);return i.ranges[o]=!0,{stack:e,id:t,glyph:a[t]||null}}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(he["CJK Unified Ideographs"](e)||he["Hangul Syllables"](e)||he.Hiragana(e)||he.Katakana(e))}_tinySDF(e,t,i){let n=this.localIdeographFontFamily;if(!n||!this._doesCharSupportLocalGlyph(i))return;let o=2,a=e.tinySDF;if(!a){let p="400";/bold/i.test(t)?p="900":/medium/i.test(t)?p="500":/light/i.test(t)&&(p="200"),a=e.tinySDF=new bi.TinySDF({fontSize:24*o,buffer:3*o,radius:8*o,cutoff:.25,fontFamily:n,fontWeight:p})}let s=a.draw(String.fromCharCode(i));return{id:i,bitmap:new mi({width:s.width||30*o,height:s.height||30*o},s.data),metrics:{width:s.glyphWidth/o||24,height:s.glyphHeight/o||24,left:s.glyphLeft/o+.5||0,top:s.glyphTop/o-27.5||-8,advance:s.glyphAdvance/o||24,isDoubleResolution:!0}}}};l(bi,"GlyphManager"),bi.loadGlyphRange=Z0,bi.TinySDF=aa;var lu=bi;d();var cd=class cd{constructor(){this.specification=A.light.position}possiblyEvaluate(e,t){return ib(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Pe.number(e.x,t.x,i),y:Pe.number(e.y,t.y,i),z:Pe.number(e.z,t.z,i)}}};l(cd,"LightPositionProperty");var ud=cd,W0="-transition",ld,pd=class pd extends de{constructor(e){super(),ld=ld||new De({anchor:new Z(A.light.anchor),position:new ud,color:new Z(A.light.color),intensity:new Z(A.light.intensity)}),this._transitionable=new Qi(ld),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(S_,e,t))for(let i in e){let n=e[i];i.endsWith(W0)?this._transitionable.setTransition(i.slice(0,-W0.length),n):this._transitionable.setValue(i,n)}}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:Wi(this,e.call(Ne,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:A}))}};l(pd,"Light");var uu=pd;d();var hd=class hd{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 n=e.length%2===1,o=[],a=n?-e[e.length-1]*i:0,s=e[0]*i,u=!0;o.push({left:a,right:s,isDash:u,zeroLength:e[0]===0});let c=e[0];for(let p=1;p<e.length;p++){u=!u;let h=e[p];a=c*i,c+=h,s=c*i,o.push({left:a,right:s,isDash:u,zeroLength:h===0})}return o}addRoundDash(e,t,i){let n=t/2;for(let o=-i;o<=i;o++){let a=this.nextRow+i+o,s=this.width*a,u=0,c=e[u];for(let p=0;p<this.width;p++){p/c.right>1&&(c=e[++u]);let h=Math.abs(p-c.left),f=Math.abs(p-c.right),m=Math.min(h,f),y,g=o/i*(n+1);if(c.isDash){let x=n-Math.abs(g);y=Math.sqrt(m*m+x*x)}else y=n-Math.sqrt(m*m+g*g);this.data[s+p]=Math.max(0,Math.min(255,y+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){let u=e[s],c=e[s+1];u.zeroLength?e.splice(s,1):c&&c.isDash===u.isDash&&(c.left=u.left,e.splice(s,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 n=this.width*this.nextRow,o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);let u=Math.abs(s-a.left),c=Math.abs(s-a.right),p=Math.min(u,c),h=a.isDash?p:-p;this.data[n+s]=Math.max(0,Math.min(255,h+128))}}addDash(e,t){let i=t?7:0,n=2*i+1;if(this.nextRow+n>this.height)return Le("LineAtlas out of space"),null;let o=0;for(let s=0;s<e.length;s++)o+=e[s];if(o!==0){let s=this.width/o,u=this.getDashRanges(e,this.width,s);t?this.addRoundDash(u,s,i):this.addRegularDash(u)}let a={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:o};return this.nextRow+=n,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))}};l(hd,"LineAtlas");var cu=hd;d();d();d();var fd=class fd{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=()=>{}}};l(fd,"ThrottledInvoker");var pu=fd;var md=class md{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new pu(()=>this.process()),this.subscription=ub(this.target,"message",i=>this.receive(i),!1),this.globalScope=rr(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((i,n)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10);this.resolveRejects[o]={resolve:i,reject:n},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[o];let u={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(u)},{once:!0});let a=[],s=Zr(Vt({},e),{id:o,sourceMapId:this.mapId,origin:location.origin,data:Xi(e.data,a)});this.target.postMessage(s,{transfer:a})})}receive(e){let t=e.data,i=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!==location.origin)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[i];let n=this.abortControllers[i];delete this.abortControllers[i],n&&n.abort();return}if(rr(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 o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;t.error?o.reject(Ki(t.error)):o.resolve(Ki(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=Ki(t.data),n=new AbortController;this.abortControllers[e]=n;try{let o=await this.messageHandlers[t.type](t.sourceMapId,i,n);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,t,i){let n=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Xi(t):null,data:Xi(i,n)};this.target.postMessage(o,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};l(md,"Actor");var hu=md;d();d();d();d();var X0='(()=>{var _y=Object.create;var Ti=Object.defineProperty,Iy=Object.defineProperties,Ty=Object.getOwnPropertyDescriptor,Cy=Object.getOwnPropertyDescriptors,ky=Object.getOwnPropertyNames,Bl=Object.getOwnPropertySymbols,My=Object.getPrototypeOf,Rl=Object.prototype.hasOwnProperty,Ey=Object.prototype.propertyIsEnumerable;var zl=(t,e,r)=>e in t?Ti(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dt=(t,e)=>{for(var r in e||(e={}))Rl.call(e,r)&&zl(t,r,e[r]);if(Bl)for(var r of Bl(e))Ey.call(e,r)&&zl(t,r,e[r]);return t},Ci=(t,e)=>Iy(t,Cy(e));var Ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ol=(t,e)=>{for(var r in e)Ti(t,r,{get:e[r],enumerable:!0})},Fy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ky(e))!Rl.call(t,i)&&i!==r&&Ti(t,i,{get:()=>e[i],enumerable:!(n=Ty(e,i))||n.enumerable});return t};var Z=(t,e,r)=>(r=t!=null?_y(My(t)):{},Fy(e||!t||!t.__esModule?Ti(r,"default",{value:t,enumerable:!0}):r,t));var he=Ae((d0,Nl)=>{"use strict";Nl.exports=sr;function sr(t,e){this.x=t,this.y=e}sr.prototype={clone:function(){return new sr(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}};sr.convert=function(t){return t instanceof sr?t:Array.isArray(t)?new sr(t[0],t[1]):t}});var Gl=Ae((g0,$l)=>{"use strict";$l.exports=Ul;function Ul(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}Ul.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 Mc=Ae((Yv,Ts)=>{function hd(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 Ts<"u"&&(Ts.exports=hd)});var Ec=Ae((Qv,Cs)=>{function dd(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 Cs!==void 0&&(Cs.exports=dd)});var ks=Ae((e1,Lo)=>{var Fc=Mc(),gd=Ec();Lo.exports=Fc;Lo.exports.murmur3=Fc;Lo.exports.murmur2=gd});var $s=Ae((JP,Us)=>{"use strict";Us.exports=Jo;Us.exports.default=Jo;function Jo(t,e,r){r=r||2;var n=e&&e.length,i=n?e[0]*r:t.length,o=xp(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,f,y;if(n&&(o=nx(t,e,o,r)),t.length>80*r){s=u=t[0],l=c=t[1];for(var m=r;m<i;m+=r)p=t[m],f=t[m+1],p<s&&(s=p),f<l&&(l=f),p>u&&(u=p),f>c&&(c=f);y=Math.max(u-s,c-l),y=y!==0?32767/y:0}return Wn(o,a,r,s,l,y,0),a}function xp(t,e,r,n,i){var o,a;if(i===Ns(t,e,r,n)>0)for(o=e;o<r;o+=n)a=gp(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=gp(o,t[o],t[o+1],a);return a&&Zo(a,a.next)&&(Xn(a),a=a.next),a}function tr(t,e){if(!t)return t;e||(e=t);var r=t,n;do if(n=!1,!r.steiner&&(Zo(r,r.next)||oe(r.prev,r,r.next)===0)){if(Xn(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function Wn(t,e,r,n,i,o,a){if(t){!a&&o&&lx(t,n,i,o);for(var s=t,l,u;t.prev!==t.next;){if(l=t.prev,u=t.next,o?ex(t,n,i,o):Qg(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Xn(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=tx(tr(t),e,r),Wn(t,e,r,n,i,o,2)):a===2&&rx(t,e,r,n,i,o):Wn(tr(t),e,r,n,i,o,1);break}}}}function Qg(t){var e=t.prev,r=t,n=t.next;if(oe(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=i<o?i<a?i:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,f=i>o?i>a?i:a:o>a?o:a,y=s>l?s>u?s:u:l>u?l:u,m=n.next;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&Ir(i,s,o,l,a,u,m.x,m.y)&&oe(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function ex(t,e,r,n){var i=t.prev,o=t,a=t.next;if(oe(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=s<l?s<u?s:u:l<u?l:u,m=c<p?c<f?c:f:p<f?p:f,h=s>l?s>u?s:u:l>u?l:u,d=c>p?c>f?c:f:p>f?p:f,g=Rs(y,m,e,r,n),b=Rs(h,d,e,r,n),x=t.prevZ,v=t.nextZ;x&&x.z>=g&&v&&v.z<=b;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Ir(s,c,l,p,u,f,x.x,x.y)&&oe(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=d&&v!==i&&v!==a&&Ir(s,c,l,p,u,f,v.x,v.y)&&oe(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Ir(s,c,l,p,u,f,x.x,x.y)&&oe(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=b;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=d&&v!==i&&v!==a&&Ir(s,c,l,p,u,f,v.x,v.y)&&oe(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function tx(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Zo(i,o)&&bp(i,n,n.next,o)&&Hn(i,o)&&Hn(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Xn(n),Xn(n.next),n=t=o),n=n.next}while(n!==t);return tr(n)}function rx(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&px(a,s)){var l=vp(a,s);a=tr(a,a.next),l=tr(l,l.next),Wn(a,e,r,n,i,o,0),Wn(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function nx(t,e,r,n){var i=[],o,a,s,l,u;for(o=0,a=e.length;o<a;o++)s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=xp(t,s,l,n,!1),u===u.next&&(u.steiner=!0),i.push(cx(u));for(i.sort(ix),o=0;o<i.length;o++)r=ox(i[o],r);return r}function ix(t,e){return t.x-e.x}function ox(t,e){var r=ax(t,e);if(!r)return e;var n=vp(r,t);return tr(n,n.next),tr(r,r.next)}function ax(t,e){var r=e,n=t.x,i=t.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==e);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,f;r=a;do n>=r.x&&r.x>=u&&n!==r.x&&Ir(i<c?n:o,i,u,c,i<c?o:n,i,r.x,r.y)&&(f=Math.abs(i-r.y)/(n-r.x),Hn(r,t)&&(f<p||f===p&&(r.x>a.x||r.x===a.x&&sx(a,r)))&&(a=r,p=f)),r=r.next;while(r!==l);return a}function sx(t,e){return oe(t.prev,t,e.prev)<0&&oe(e.next,t,t.next)<0}function lx(t,e,r,n){var i=t;do i.z===0&&(i.z=Rs(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,ux(i)}function ux(t){var e,r,n,i,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<u&&(s++,n=n.nextZ,!!n);e++);for(l=u;s>0||l>0&&n;)s!==0&&(l===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return t}function Rs(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 cx(t){var 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 Ir(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 px(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!fx(t,e)&&(Hn(t,e)&&Hn(e,t)&&yx(t,e)&&(oe(t.prev,t,e.prev)||oe(t,e.prev,e))||Zo(t,e)&&oe(t.prev,t,t.next)>0&&oe(e.prev,e,e.next)>0)}function oe(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Zo(t,e){return t.x===e.x&&t.y===e.y}function bp(t,e,r,n){var i=jo(oe(t,e,r)),o=jo(oe(t,e,n)),a=jo(oe(r,n,t)),s=jo(oe(r,n,e));return!!(i!==o&&a!==s||i===0&&qo(t,r,e)||o===0&&qo(t,n,e)||a===0&&qo(r,t,n)||s===0&&qo(r,e,n))}function qo(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 jo(t){return t>0?1:t<0?-1:0}function fx(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&bp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Hn(t,e){return oe(t.prev,t,t.next)<0?oe(t,e,t.next)>=0&&oe(t,t.prev,e)>=0:oe(t,e,t.prev)<0||oe(t,t.next,e)<0}function yx(t,e){var 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 vp(t,e){var r=new Os(t.i,t.x,t.y),n=new Os(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 gp(t,e,r,n){var i=new Os(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 Xn(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 Os(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Jo.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(Ns(t,0,o,r));if(i)for(var s=0,l=e.length;s<l;s++){var u=e[s]*r,c=s<l-1?e[s+1]*r:t.length;a-=Math.abs(Ns(t,u,c,r))}var p=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,y=n[s+1]*r,m=n[s+2]*r;p+=Math.abs((t[f]-t[m])*(t[y+1]-t[f+1])-(t[f]-t[y])*(t[m+1]-t[f+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function Ns(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}Jo.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}});var qs=Ae((kS,Cp)=>{"use strict";var vx=he();Cp.exports=Mr;function Mr(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(Px,this,e)}function Px(t,e,r){t==1?e.id=r.readVarint():t==2?Sx(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function Sx(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}}Mr.types=["Unknown","Point","LineString","Polygon"];Mr.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 vx(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};Mr.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]};Mr.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=Mr.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],d=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(d*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=wx(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 wx(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=Ax(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 Ax(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 js=Ae((MS,Mp)=>{"use strict";var _x=qs();Mp.exports=kp;function kp(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(Ix,this,e),this.length=this._features.length}function Ix(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(Tx(r))}function Tx(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}kp.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 _x(this._pbf,e,this.extent,this._keys,this._values)}});var Fp=Ae((ES,Ep)=>{"use strict";var Cx=js();Ep.exports=kx;function kx(t,e){this.layers=t.readFields(Mx,{},e)}function Mx(t,e,r){if(t===3){var n=new Cx(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Tt=Ae((FS,Ho)=>{Ho.exports.VectorTile=Fp();Ho.exports.VectorTileFeature=qs();Ho.exports.VectorTileLayer=js()});var Qp=Ae(Xs=>{Xs.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)};Xs.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 ei=Ae((m2,of)=>{"use strict";of.exports=J;var ea=Qp();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 Ks=65536*65536,ef=1/Ks,Hx=12,nf=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=ta(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=rf(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=ta(this.buf,this.pos)+ta(this.buf,this.pos+4)*Ks;return this.pos+=8,t},readSFixed64:function(){var t=ta(this.buf,this.pos)+rf(this.buf,this.pos+4)*Ks;return this.pos+=8,t},readFloat:function(){var t=ea.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ea.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,Xx(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>=Hx&&nf?cb(this.buf,e,t):ub(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=ct(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=ct(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=ct(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=ct(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=ct(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=ct(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=ct(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=ct(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=ct(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),Lr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Lr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Lr(this.buf,t&-1,this.pos),Lr(this.buf,Math.floor(t*ef),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Lr(this.buf,t&-1,this.pos),Lr(this.buf,Math.floor(t*ef),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Kx(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=pb(this.buf,t,this.pos);var r=this.pos-e;r>=128&&tf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),ea.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ea.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&&tf(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,eb,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,tb,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,ib,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,rb,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,nb,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,ob,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,ab,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,sb,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,lb,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 Xx(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 Fr(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function ct(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Fr(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Kx(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),Yx(r,n,e),Qx(n,e)}function Yx(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 Qx(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 tf(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 eb(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function tb(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function rb(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function nb(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function ib(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function ob(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function ab(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function sb(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function lb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function ta(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Lr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function rf(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function ub(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 cb(t,e,r){return nf.decode(t.subarray(e,r))}function pb(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 ey=Ae((pT,Qf)=>{Qf.exports=Aa;function Aa(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Aa(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Aa(t.geometries[n],e);else if(r==="Feature")Aa(t.geometry,e);else if(r==="Polygon")Kf(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)Kf(t.coordinates[n],e);return t}function Kf(t,e){if(t.length!==0){Yf(t[0],e);for(var r=1;r<t.length;r++)Yf(t[r],!e)}}function Yf(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 iy=Ae((mT,ny)=>{"use strict";var Zb=he(),Wb=Tt().VectorTileFeature;ny.exports=ry;function ry(t,e){this.options=e||{},this.features=t,this.length=t.length}ry.prototype.feature=function(t){return new Ia(this.features[t],this.options.extent)};function Ia(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}Ia.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 Zb(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Ia.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]};Ia.prototype.toGeoJSON=Wb.prototype.toGeoJSON});var sy=Ae((hT,gi)=>{var Hb=ei(),ay=iy();gi.exports=dl;gi.exports.fromVectorTileJs=dl;gi.exports.fromGeojsonVt=Xb;gi.exports.GeoJSONWrapper=ay;function dl(t){var e=new Hb;return Kb(t,e),e.finish()}function Xb(t,e){e=e||{};var r={};for(var n in t)r[n]=new ay(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return dl({layers:r})}function Kb(t,e){for(var r in t.layers)e.writeMessage(3,Yb,t.layers[r])}function Yb(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,Qb,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,r0,o[r])}function Qb(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,e0,t),e.writeVarintField(3,r.type),e.writeMessage(4,t0,r)}function e0(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 hl(t,e){return(e<<3)+(t&7)}function oy(t){return t<<1^t>>31}function t0(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(hl(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(hl(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(oy(f)),e.writeVarint(oy(y)),i+=f,o+=y}n===3&&e.writeVarint(hl(7,1))}}function r0(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 Ly=Z(he(),1),Zl=Z(Gl(),1);var Oa;function ql(){return Oa==null&&(Oa=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Oa}var ki;function jl(){if(ki==null&&(ki=!1,ql())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<5*5;i++){let o=i*4;r.fillStyle="rgb(".concat(o,",").concat(o+1,",").concat(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<5*5*4;i++)if(i%4!==3&&n[i]!==i){ki=!0;break}}}return ki||!1}function Wl(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 Dy(t,e,r,n){let i=new Zl.default(t,e,r,n);return function(o){return i.solve(o)}}var S0=Dy(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function Hl(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function Pe(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function Xl(t){return Math.log(t)/Math.LN2%1===0}function jr(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function Kl(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?jr(t,nt):t}function Yl(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}var Jl={};function fe(t){Jl[t]||(typeof console<"u"&&console.warn(t),Jl[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 Ql(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}function at(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function Jr(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function Vy(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 By(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==null?void 0:o.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error("Unrecognized format ".concat(a));let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Vy(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 Gr,qr;function zy(t,e,r,n,i){let o=t.width,a=t.height;(!Gr||!qr)&&(Gr=new OffscreenCanvas(o,a),qr=Gr.getContext("2d",{willReadFrequently:!0})),Gr.width=o,Gr.height=a,qr.drawImage(t,0,0,o,a);let s=qr.getImageData(e,r,n,i);return qr.clearRect(0,0,o,a),s.data}async function eu(t,e,r,n,i){if(jl())try{return await By(t,e,r,n,i)}catch(o){}return zy(t,e,r,n,i)}function tu(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}var Vt=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 Ry=8,Oy={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"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"},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"}},Ny={"*":{type:"source"}},Uy=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],$y={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:"*"}},Gy={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:"*"}},qy={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:"*"}},jy={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"}},Jy={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"}}},Zy={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"}}},Wy={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},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"}},Hy=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Xy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ky={"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"}},Yy={"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"}},Qy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},em={"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"}},tm={"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"}},rm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},nm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},im={type:"array",value:"*"},om={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},am={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},sm={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},lm={type:"array",value:"*",minimum:1},um={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}},cm={"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}},pm={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},fm={type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},ym=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],mm={"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"}},hm={"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"}},dm={"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"}},gm={"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"}},xm={"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"}},bm={"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"}},vm={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},Pm={"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"}},Sm={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},wm={"*":{type:"string"}},S={$version:Ry,$root:Oy,sources:Ny,source:Uy,source_vector:$y,source_raster:Gy,source_raster_dem:qy,source_geojson:jy,source_video:Jy,source_image:Zy,layer:Wy,layout:Hy,layout_background:Xy,layout_fill:Ky,layout_circle:Yy,layout_heatmap:Qy,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:em,layout_symbol:tm,layout_raster:rm,layout_hillshade:nm,filter:im,filter_operator:om,geometry_type:am,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:sm,expression:lm,light:um,sky:cm,terrain:pm,projection:fm,paint:ym,paint_fill:mm,"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:hm,paint_circle:dm,paint_heatmap:gm,paint_symbol:xm,paint_raster:bm,paint_hillshade:vm,paint_background:Pm,transition:Sm,"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:wm},Am=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var M=class{constructor(e,r,n,i){this.message=(e?"".concat(e,": "):"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function fr(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}},Ha=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("".concat(e," not found in scope."))}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},hr={kind:"null"},L={kind:"number"},G={kind:"string"},U={kind:"boolean"},Re={kind:"color"},cr={kind:"object"},$={kind:"value"},_m={kind:"error"},Wi={kind:"collator"},dr={kind:"formatted"},Hi={kind:"padding"},cn={kind:"resolvedImage"},Xi={kind:"variableAnchorOffsetCollection"};function Ee(t,e){return{kind:"array",itemType:t,N:e}}function te(t){if(t.kind==="array"){let e=te(t.itemType);return typeof t.N=="number"?"array<".concat(e,", ").concat(t.N,">"):t.itemType.kind==="value"?"array":"array<".concat(e,">")}else return t.kind}var Im=[hr,L,G,U,Re,dr,cr,Ee($),Hi,cn,Xi];function Kr(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Kr(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 Im)if(!Kr(r,e))return null}}return"Expected ".concat(te(t)," but found ").concat(te(e)," instead.")}function fs(t,e){return e.some(r=>r.kind===t.kind)}function Rt(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 Zr(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var wu=.96422,Au=1,_u=.82521,Iu=4/29,pr=6/29,Tu=3*pr*pr,Tm=pr*pr*pr,Cm=Math.PI/180,km=180/Math.PI;function Cu(t){return t=t%360,t<0&&(t+=360),t}function ku([t,e,r,n]){t=Na(t),e=Na(e),r=Na(r);let i,o,a=Ua((.2225045*t+.7168786*e+.0606169*r)/Au);t===e&&e===r?i=o=a:(i=Ua((.4360747*t+.3850649*e+.1430804*r)/wu),o=Ua((.0139322*t+.0971045*e+.7141733*r)/_u));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function Na(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ua(t){return t>Tm?Math.pow(t,1/3):t/Tu+Iu}function Mu([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=Au*Ga(i),o=wu*Ga(o),a=_u*Ga(a),[$a(3.1338561*o-1.6168667*i-.4906146*a),$a(-.9787684*o+1.9161415*i+.033454*a),$a(.0719453*o-.2289914*i+1.4052427*a),n]}function $a(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 Ga(t){return t>pr?t*t*t:Tu*(t-Iu)}function Mm(t){let[e,r,n,i]=ku(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Cu(Math.atan2(n,r)*km):NaN,o,e,i]}function Em([t,e,r,n]){return t=isNaN(t)?0:t*Cm,Mu([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Fm([t,e,r,n]){t=Cu(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]}function Lm(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=Dm[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[Mi(t.slice(a,a+=o)),Mi(t.slice(a,a+=o)),Mi(t.slice(a,a+=o)),Mi(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,d,g]=o,b=[u||" ",f||" ",h].join("");if(b===" "||b===" /"||b===",,"||b===",,,"){let x=[l,p,m].join(""),v=x==="%%%"?100:x===""?255:0;if(v){let P=[lr(+s/v,0,1),lr(+c/v,0,1),lr(+y/v,0,1),d?ru(+d,g):1];if(nu(P))return P}}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,lr(+s,0,100),lr(+u,0,100),p?ru(+p,f):1];if(nu(m))return Fm(m)}}}function Mi(t){return parseInt(t.padEnd(2,t),16)/255}function ru(t,e){return lr(e?t/100:t,0,1)}function lr(t,e,r){return Math.min(Math.max(e,t),r)}function nu(t){return!t.some(Number.isNaN)}var Dm={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]},W=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=Lm(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",Mm(this.rgb))}get lab(){return this.overwriteGetter("lab",ku(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return"rgba(".concat([e,r,n].map(o=>Math.round(o*255)).join(","),",").concat(i,")")}};W.black=new W(0,0,0,1);W.white=new W(1,1,1,1);W.transparent=new W(0,0,0,0);W.red=new W(1,0,0,1);var Yr=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}},Qr=class{constructor(e,r,n,i,o){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o}},Fe=class t{constructor(e){this.sections=e}static fromString(e){return new t([new Qr(e,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("")}},Ze=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)}},Vm=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ne=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"||!Vm.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)}},Te=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}};function Eu(t,e,r,n){if(!(typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255)){let i=typeof n=="number"?[t,e,r,n]:[t,e,r];return"Invalid rgba value [".concat(i.join(", "),"]: \'r\', \'g\', and \'b\' must be between 0 and 255.")}return typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:"Invalid rgba value [".concat([t,e,r,n].join(", "),"]: \'a\' must be between 0 and 1.")}function en(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof W||t instanceof Yr||t instanceof Fe||t instanceof Ze||t instanceof Ne||t instanceof Te)return!0;if(Array.isArray(t)){for(let e of t)if(!en(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!en(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return hr;if(typeof t=="string")return G;if(typeof t=="boolean")return U;if(typeof t=="number")return L;if(t instanceof W)return Re;if(t instanceof Yr)return Wi;if(t instanceof Fe)return dr;if(t instanceof Ze)return Hi;if(t instanceof Ne)return Xi;if(t instanceof Te)return cn;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=$;break}}return Ee(r||$,e)}else return cr}function Hr(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof W||t instanceof Fe||t instanceof Ze||t instanceof Ne||t instanceof Te?t.toString():JSON.stringify(t)}var mt=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 ".concat(e.length-1," instead."));if(!en(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}},ie=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}},Ei={string:G,number:L,boolean:U,object:cr},je=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 Ei)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Ei[u],n++}else s=$;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=Ee(s,l)}else{if(!Ei[o])throw new Error("Types doesn\'t contain name = ".concat(o));i=Ei[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[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(Kr(this.type,ue(n))){if(r===this.args.length-1)throw new ie("Expected value to be of type ".concat(te(this.type),", but found ").concat(te(ue(n))," instead."))}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},iu={"to-boolean":U,"to-color":Re,"to-number":L,"to-string":G},yt=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(!iu[n])throw new Error("Can\'t parse ".concat(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=iu[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,$);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 W)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 ".concat(JSON.stringify(r),": expected an array containing either three or four numeric values."):n=Eu(r[0],r[1],r[2],r[3]),!n))return new W(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ie(n||"Could not parse color from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ze.parse(r);if(i)return i}throw new ie("Could not parse padding from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ne.parse(r);if(i)return i}throw new ie("Could not parse variableAnchorOffsetCollection from value \'".concat(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 ie("Could not convert ".concat(JSON.stringify(r)," to number."))}case"formatted":return Fe.fromString(Hr(this.args[0].evaluate(e)));case"resolvedImage":return Te.fromString(Hr(this.args[0].evaluate(e)));default:return Hr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Bm=["Unknown","Point","LineString","Polygon"],Vi=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?Bm[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[e];return r||(r=this._parseColorCache[e]=W.parse(e)),r}},Bi=class t{constructor(e,r,n=[],i,o=new Ha,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>"[".concat(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 je(o,[i]):a==="coerce"?new yt(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 ".concat(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==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof mt)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new Vi;try{a=new mt(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(\'Unknown expression "\'.concat(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 ".concat(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="".concat(this.key).concat(r.map(i=>"[".concat(i,"]")).join(""));this.errors.push(new Be(n,e))}checkSubtype(e,r){let n=Kr(e,r);return n&&this.error(n),n}},zi=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 ".concat(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 ".concat(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()}},Ri=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 "\'.concat(n,\'". Make sure "\').concat(n,\'" has been bound in an enclosing "let" expression before using it.\'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Xa=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 ".concat(e.length-1," instead."));let n=r.parse(e[1],1,L),i=r.parse(e[2],2,Ee(r.expectedType||$));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 ie("Array index out of bounds: ".concat(r," < 0."));if(r>=n.length)throw new ie("Array index out of bounds: ".concat(r," > ").concat(n.length-1,"."));if(r!==Math.floor(r))throw new ie("Array index must be an integer, but found ".concat(r," instead."));return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ka=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 ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);return!n||!i?null:fs(n.type,[U,G,L,hr,$])?new t(n,i):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(n.type)," instead"))}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Rt(r,["boolean","string","number","null"]))throw new ie("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(ue(r))," instead."));if(!Rt(n,["string","array"]))throw new ie("Expected second argument to be of type array or string, but found ".concat(te(ue(n))," instead."));return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Ya=class t{constructor(e,r,n){this.type=L,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 ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);if(!n||!i)return null;if(!fs(n.type,[U,G,L,hr,$]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,L);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(!Rt(r,["boolean","string","number","null"]))throw new ie("Expected first argument to be of type boolean, string, number or null, but found ".concat(te(ue(r))," instead."));let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Rt(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Rt(n,["array"]))return n.indexOf(r,i);throw new ie("Expected second argument to be of type array or string, but found ".concat(te(ue(n))," instead."))}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Qa=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 ".concat(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 ".concat(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,$);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()}},es=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 ".concat(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()}},ts=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 ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,L);if(!n||!i)return null;if(!fs(n.type,[Ee($),G,$]))return r.error("Expected first argument to be of type array or string, but found ".concat(te(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,L);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)),Rt(r,["string"]))return[...r].slice(n,i).join("");if(Rt(r,["array"]))return r.slice(n,i);throw new ie("Expected first argument to be of type array or string, but found ".concat(te(ue(r))," instead."))}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function Ki(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 ie("Input is not a number.");return 0}var yr=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 ".concat(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,L);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=Ki(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 zm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qa,ou;function Rm(){if(ou)return qa;ou=1,qa=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))}},qa}var Om=Rm(),Nm=zm(Om);function Um(t){return t==="rgb"||t==="hcl"||t==="lab"}function Ot(t,e,r){return t+r*(e-t)}function $m(t,e,r,n="rgb"){switch(n){case"rgb":{let[i,o,a,s]=Oi(t.rgb,e.rgb,r);return new W(i,o,a,s,!1)}case"hcl":{let[i,o,a,s]=t.hcl,[l,u,c,p]=e.hcl,f,y;if(!isNaN(i)&&!isNaN(l)){let b=l-i;l>i&&b>180?b-=360:l<i&&i-l>180&&(b+=360),f=i+r*b}else isNaN(i)?isNaN(l)?f=NaN:(f=l,(a===1||a===0)&&(y=u)):(f=i,(c===1||c===0)&&(y=o));let[m,h,d,g]=Em([f,y!=null?y:Ot(o,u,r),Ot(a,c,r),Ot(s,p,r)]);return new W(m,h,d,g,!1)}case"lab":{let[i,o,a,s]=Mu(Oi(t.lab,e.lab,r));return new W(i,o,a,s,!1)}}}function Oi(t,e,r){return t.map((n,i)=>Ot(n,e[i],r))}function Gm(t,e,r){return new Ze(Oi(t.values,e.values,r))}function qm(t,e,r){let n=t.values,i=e.values;if(n.length!==i.length)throw new ie("Cannot interpolate values of different length. from: ".concat(t.toString(),", to: ").concat(e.toString()));let o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==i[a])throw new ie("Cannot interpolate values containing mismatched anchors. from[".concat(a,"]: ").concat(n[a],", to[").concat(a,"]: ").concat(i[a]));o.push(n[a]);let[s,l]=n[a+1],[u,c]=i[a+1];o.push([Ot(s,u,r),Ot(l,c,r)])}return new Ne(o)}var Oe={number:Ot,color:$m,array:Oi,padding:Gm,variableAnchorOffsetCollection:qm},Je=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=ja(r,e.base,n,i);else if(e.name==="linear")o=ja(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Nm(a[0],a[1],a[2],a[3]).solve(ja(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 ".concat(String(i[0])),1,0);if(e.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,L),!o)return null;let s=[],l=null;n==="interpolate-hcl"||n==="interpolate-lab"?l=Re: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!Zr(l,L)&&!Zr(l,Re)&&!Zr(l,Hi)&&!Zr(l,Xi)&&!Zr(l,Ee(L))?r.error("Type ".concat(te(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=Ki(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":return Oe[this.type.kind](c,p,u);case"interpolate-hcl":return Oe.color(c,p,u,"hcl");case"interpolate-lab":return Oe.color(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 ja(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 Ni=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=>Kr(i,s.type))?new t($,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 Te&&!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 au(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 jm(t,e,r){return e===r}function Jm(t,e,r){return e!==r}function Zm(t,e,r){return e<r}function Wm(t,e,r){return e>r}function Hm(t,e,r){return e<=r}function Xm(t,e,r){return e>=r}function Fu(t,e,r,n){return n.compare(e,r)===0}function Km(t,e,r,n){return!Fu(t,e,r,n)}function Ym(t,e,r,n){return n.compare(e,r)<0}function Qm(t,e,r,n){return n.compare(e,r)>0}function eh(t,e,r,n){return n.compare(e,r)<=0}function th(t,e,r,n){return n.compare(e,r)>=0}function gr(t,e,r){let n=t!=="=="&&t!=="!=";return class Lu{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,$);if(!l)return null;if(!au(s,l.type))return a.concat(1).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(te(l.type),"\'."));let u=a.parse(o[2],2,$);if(!u)return null;if(!au(s,u.type))return a.concat(2).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(te(u.type),"\'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types \'".concat(te(l.type),"\' and \'").concat(te(u.type),"\'."));n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new je(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new je(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,Wi),!c)return null}return new Lu(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 ie(\'Expected arguments for "\'.concat(t,\'" to be (string, string) or (number, number), but found (\').concat(l.kind,", ").concat(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 rh=gr("==",jm,Fu),nh=gr("!=",Jm,Km),ih=gr("<",Zm,Ym),oh=gr(">",Wm,Qm),ah=gr("<=",Hm,eh),sh=gr(">=",Xm,th),Ui=class t{constructor(e,r,n){this.type=Wi,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,G),!a)?null:new t(i,o,a)}evaluate(e){return new Yr(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}},rs=class t{constructor(e,r,n,i,o){this.type=G,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,L);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,G),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,G),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,L),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,L),!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}},tn=class t{constructor(e){this.type=dr,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,L),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Ee(G)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,Re),!c))return null;let p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=r.parse(e[a],1,$);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})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return ue(i)===cn?new Qr("",i,null,null,null):new Qr(Hr(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null)};return new Fe(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)}outputDefined(){return!1}},ns=class t{constructor(e){this.type=cn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,G);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Te.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},is=class t{constructor(e){this.type=L,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected 1 argument, but found ".concat(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 ".concat(te(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 ie("Expected value to be of type string or array, but found ".concat(te(ue(r))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}},Xe=8192;function lh(t,e){let r=uh(t[0]),n=ph(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*Xe),Math.round(n*i*Xe)]}function ys(t,e){let r=Math.pow(2,e.z),n=(t[0]/Xe+e.x)/r,i=(t[1]/Xe+e.y)/r;return[ch(n),fh(i)]}function uh(t){return(180+t)/360}function ch(t){return t*360-180}function ph(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function fh(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 rn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function yh(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 mh(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 Yi(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return xh(o,i)===0?!1:!!(su(t,e,r,n)&&su(r,n,t,e))}function hh(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Yi(t,e,n[i],n[i+1]))return!0;return!1}function xr(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(mh(t,i[o],i[o+1]))return r;yh(t,i[o],i[o+1])&&(n=!n)}return n}function dh(t,e){for(let r of e)if(xr(t,r))return!0;return!1}function Du(t,e){for(let r of t)if(!xr(r,e))return!1;for(let r=0;r<t.length-1;++r)if(hh(t[r],t[r+1],e))return!1;return!0}function gh(t,e){for(let r of e)if(Du(t,r))return!0;return!1}function xh(t,e){return t[0]*e[1]-t[1]*e[0]}function su(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 ms(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=lh(t[i][a],r);pn(e,s),o.push(s)}n.push(o)}return n}function Vu(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=ms(t[i],e,r);n.push(o)}return n}function Bu(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 bh(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function lu(t,e,r,n){let i=Math.pow(2,n.z)*Xe,o=[n.x*Xe,n.y*Xe],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];Bu(u,e,r,i),a.push(u)}return a}function uu(t,e,r,n){let i=Math.pow(2,n.z)*Xe,o=[n.x*Xe,n.y*Xe],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){bh(e);for(let s of a)for(let l of s)Bu(l,e,r,i)}return a}function vh(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=ms(e.coordinates,n,i),a=lu(t.geometry(),r,n,i);if(!rn(r,n))return!1;for(let s of a)if(!xr(s,o))return!1}if(e.type==="MultiPolygon"){let o=Vu(e.coordinates,n,i),a=lu(t.geometry(),r,n,i);if(!rn(r,n))return!1;for(let s of a)if(!dh(s,o))return!1}return!0}function Ph(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=ms(e.coordinates,n,i),a=uu(t.geometry(),r,n,i);if(!rn(r,n))return!1;for(let s of a)if(!Du(s,o))return!1}if(e.type==="MultiPolygon"){let o=Vu(e.coordinates,n,i),a=uu(t.geometry(),r,n,i);if(!rn(r,n))return!1;for(let s of a)if(!gh(s,o))return!1}return!0}var nn=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 ".concat(e.length-1," instead."));if(en(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 vh(e,this.geometries);if(e.geometryType()==="LineString")return Ph(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},$i=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 Sh(t,e,r,n,i){zu(t,e,r,n||t.length-1,i||wh)}function zu(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(e-a*l/o+u)),p=Math.min(n,Math.floor(e+(o-a)*l/o+u));zu(t,e,c,p,i)}var f=t[e],y=r,m=n;for(Wr(t,r,e),i(t[n],f)>0&&Wr(t,r,n);y<m;){for(Wr(t,y,m),y++,m--;i(t[y],f)<0;)y++;for(;i(t[m],f)>0;)m--}i(t[r],f)===0?Wr(t,r,m):(m++,Wr(t,m,n)),m<=e&&(r=m+1),e<=m&&(n=m-1)}}function Wr(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function wh(t,e){return t<e?-1:t>e?1:0}function Ah(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=Ih(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||(Sh(n[a],e,1,n[a].length-1,_h),n[a]=n[a].slice(0,e));return n}function _h(t,e){return e.area-t.area}function Ih(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 Th=6378.137,cu=1/298.257223563,pu=cu*(2-cu),fu=Math.PI/180,on=class{constructor(e){let r=fu*Th*1e3,n=Math.cos(e*fu),i=1/(1-pu*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-pu)}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}},os=100,as=50;function Ru(t,e){return e[0]-t[0]}function Gi(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function ss(t,e){if(t[0]>t[1])return[null,null];let r=Gi(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 ls(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 us(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 yu(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function hs(t,e,r){if(!yu(t)||!yu(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 zt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function ds(t,e,r,n,i){let o=Math.min(zt(t,[r,n],i),zt(e,[r,n],i)),a=Math.min(zt(r,[t,e],i),zt(n,[t,e],i));return Math.min(o,a)}function Ch(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(Yi(l,u,p,f))return 0;a=Math.min(a,ds(l,u,p,f,i))}}return a}function kh(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 Mh(t,e,r){if(xr(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,zt(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 Eh(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(xr(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(Yi(a,s,f,y))return 0;i=Math.min(i,ds(a,s,f,y,n))}}return i}function mu(t,e){for(let r of t)for(let n of r)if(xr(n,e,!0))return!0;return!1}function Fh(t,e,r,n=1/0){let i=us(t),o=us(e);if(n!==1/0&&hs(i,o,r)>=n)return n;if(rn(i,o)){if(mu(t,e))return 0}else if(mu(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,d=h-1;m<h;d=m++){let g=y[d],b=y[m];if(Yi(p,f,g,b))return 0;a=Math.min(a,ds(p,f,g,b,r))}}return a}function hu(t,e,r,n,i,o){if(!o)return;let a=hs(ls(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function Fi(t,e,r,n,i,o,a){if(!o||!a)return;let s=hs(ls(n,o),ls(i,a),r);s<e&&t.push([s,o,a])}function qi(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 $i([[0,[0,t.length-1],[0,0]]],Ru),s=us(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?as:os;if(Gi(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Eh(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=Mh(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=ss(u,e);hu(a,o,n,t,s,p[0]),hu(a,o,n,t,s,p[1])}}return o}function ji(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 $i([[0,[0,t.length-1],[0,r.length-1]]],Ru);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?as:os,f=n?as:os;if(Gi(u)<=p&&Gi(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Ch(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=zt(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=zt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=kh(t,u,r,c,i),a=Math.min(a,y)}else{let y=ss(u,e),m=ss(c,n);Fi(s,a,i,t,r,y[0],m[0]),Fi(s,a,i,t,r,y[0],m[1]),Fi(s,a,i,t,r,y[1],m[0]),Fi(s,a,i,t,r,y[1],m[1])}}return a}function Lh(t,e){let r=t.geometry(),n=r.flat().map(a=>ys([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new on(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,ji(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,ji(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,qi(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Dh(t,e){let r=t.geometry(),n=r.flat().map(a=>ys([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new on(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,ji(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,ji(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,qi(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Vh(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Ah(r,0).map(a=>a.map(s=>s.map(l=>ys([l.x,l.y],t.canonical)))),i=new on(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,qi([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,qi(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,Fh(s,a.coordinates,i,o));break}if(o===0)return o}return o}function Ja(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 an=class t{constructor(e,r){this.type=L,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 ".concat(e.length-1," instead."));if(en(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>Ja(i.geometry)).flat());if(n.type==="Feature")return new t(n,Ja(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,Ja(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 Lh(e,this.geometries);if(e.geometryType()==="LineString")return Dh(e,this.geometries);if(e.geometryType()==="Polygon")return Vh(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Gt={"==":rh,"!=":nh,">":oh,"<":ih,">=":sh,"<=":ah,array:je,at:Xa,boolean:je,case:es,coalesce:Ni,collator:Ui,format:tn,image:ns,in:Ka,"index-of":Ya,interpolate:Je,"interpolate-hcl":Je,"interpolate-lab":Je,length:is,let:zi,literal:mt,match:Qa,number:je,"number-format":rs,object:je,slice:ts,step:yr,string:je,"to-boolean":yt,"to-color":yt,"to-number":yt,"to-string":yt,var:Ri,within:nn,distance:an},Ke=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 "\'.concat(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 Bi(r.registry,Ji,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,d=l.parse(m,1+p.length,h);if(!d){f=!0;break}p.push(d)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(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])=>zh(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(te(y.type))}r.error("Expected arguments of type ".concat(c,", but found (").concat(p.join(", "),") instead."))}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function du(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=Eu(e,r,n,o);if(a)throw new ie(a);return new W(e/255,r/255,n/255,o,!1)}function gu(t,e){return t in e}function Za(t,e){let r=e[t];return typeof r>"u"?null:r}function Bh(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 Bt(t){return{type:t}}Ke.register(Gt,{error:[_m,[G],(t,[e])=>{throw new ie(e.evaluate(t))}],typeof:[G,[$],(t,[e])=>te(ue(e.evaluate(t)))],"to-rgba":[Ee(L,4),[Re],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[Re,[L,L,L],du],rgba:[Re,[L,L,L,L],du],has:{type:U,overloads:[[[G],(t,[e])=>gu(e.evaluate(t),t.properties())],[[G,cr],(t,[e,r])=>gu(e.evaluate(t),r.evaluate(t))]]},get:{type:$,overloads:[[[G],(t,[e])=>Za(e.evaluate(t),t.properties())],[[G,cr],(t,[e,r])=>Za(e.evaluate(t),r.evaluate(t))]]},"feature-state":[$,[G],(t,[e])=>Za(e.evaluate(t),t.featureState||{})],properties:[cr,[],t=>t.properties()],"geometry-type":[G,[],t=>t.geometryType()],id:[$,[],t=>t.id()],zoom:[L,[],t=>t.globals.zoom],"heatmap-density":[L,[],t=>t.globals.heatmapDensity||0],"line-progress":[L,[],t=>t.globals.lineProgress||0],accumulated:[$,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[L,Bt(L),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[L,Bt(L),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:L,overloads:[[[L,L],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[L],(t,[e])=>-e.evaluate(t)]]},"/":[L,[L,L],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[L,[L,L],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[L,[],()=>Math.LN2],pi:[L,[],()=>Math.PI],e:[L,[],()=>Math.E],"^":[L,[L,L],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[L,[L],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[L,[L],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[L,[L],(t,[e])=>Math.log(e.evaluate(t))],log2:[L,[L],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[L,[L],(t,[e])=>Math.sin(e.evaluate(t))],cos:[L,[L],(t,[e])=>Math.cos(e.evaluate(t))],tan:[L,[L],(t,[e])=>Math.tan(e.evaluate(t))],asin:[L,[L],(t,[e])=>Math.asin(e.evaluate(t))],acos:[L,[L],(t,[e])=>Math.acos(e.evaluate(t))],atan:[L,[L],(t,[e])=>Math.atan(e.evaluate(t))],min:[L,Bt(L),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[L,Bt(L),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[L,[L],(t,[e])=>Math.abs(e.evaluate(t))],round:[L,[L],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[L,[L],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[L,[L],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[G,$],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[$],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[G],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[$],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Ee(G)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ee($)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[G,Ee($)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[G,Ee($)],(t,[e,r])=>Bh(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)],[Bt(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)],[Bt(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,[G],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[G,[G],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[G,[G],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[G,Bt($),(t,e)=>e.map(r=>Hr(r.evaluate(t))).join("")],"resolved-locale":[G,[Wi],(t,[e])=>e.evaluate(t).resolvedLocale()]});function zh(t){return Array.isArray(t)?"(".concat(t.map(te).join(", "),")"):"(".concat(te(t.type),"...)")}function Ji(t){if(t instanceof Ri)return Ji(t.boundExpression);if(t instanceof Ke&&t.name==="error")return!1;if(t instanceof Ui)return!1;if(t instanceof nn)return!1;if(t instanceof an)return!1;let e=t instanceof yt||t instanceof je,r=!0;return t.eachChild(n=>{e?r=r&&Ji(n):r=r&&n instanceof mt}),r?Qi(t)&&eo(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function Qi(t){if(t instanceof Ke){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 nn||t instanceof an)return!1;let e=!0;return t.eachChild(r=>{e&&!Qi(r)&&(e=!1)}),e}function sn(t){if(t instanceof Ke&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!sn(r)&&(e=!1)}),e}function eo(t,e){if(t instanceof Ke&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!eo(n,e)&&(r=!1)}),r}function cs(t){return{result:"success",value:t}}function ur(t){return{result:"error",value:t}}function ht(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Ou(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function gs(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 to(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Rh(t){return t}function Nu(t,e){let r=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",i=n||t.property!==void 0,o=n||!i,a=t.type||(gs(e)?"exponential":"interval");if(r||e.type==="padding"){let c=r?W.parse:Ze.parse;t=fr({},t),t.stops&&(t.stops=t.stops.map(p=>[p[0],c(p[1])])),t.default?t.default=c(t.default):t.default=c(e.default)}if(t.colorSpace&&!Um(t.colorSpace))throw new Error(\'Unknown color space: "\'.concat(t.colorSpace,\'"\'));let s,l,u;if(a==="exponential")s=xu;else if(a==="interval")s=Nh;else if(a==="categorical"){s=Oh,l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}else if(a==="identity")s=Uh;else throw new Error(\'Unknown function type "\'.concat(a,\'"\'));if(n){let c={},p=[];for(let m=0;m<t.stops.length;m++){let h=t.stops[m],d=h[0].zoom;c[d]===void 0&&(c[d]={zoom:d,type:t.type,property:t.property,default:t.default,stops:[]},p.push(d)),c[d].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,Nu(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:Je.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return xu({stops:f,base:t.base},e,m).evaluate(m,h)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:Je.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?fn(t.default,e.default):s(t,e,f,l,u)}}}function fn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Oh(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return fn(o,t.default,e.default)}function Nh(t,e,r){if(j(r)!=="number")return fn(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=Ki(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function xu(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return fn(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=Ki(t.stops.map(c=>c[0]),r),a=$h(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Oe[e.type]||Rh;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 Uh(t,e,r){switch(e.type){case"color":r=W.parse(r);break;case"formatted":r=Fe.fromString(r.toString());break;case"resolvedImage":r=Te.fromString(r.toString());break;case"padding":r=Ze.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return fn(r,t.default,e.default)}function $h(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 Nt=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Vi,this._defaultValue=r?qh(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 ie("Expected value to be one of ".concat(Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", "),", but found ").concat(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 qt(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Gt}function jt(t,e){let r=new Bi(Gt,Ji,[],e?Gh(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?cs(new Nt(n,e)):ur(r.errors)}var dt=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!sn(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)}},gt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!sn(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?Je.interpolationFactor(this.interpolationType,e,r,n):0}};function Uu(t,e){let r=jt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Qi(n);if(!i&&!ht(e))return ur([new Be("","data expressions not supported")]);let o=eo(n,["zoom"]);if(!o&&!Ou(e))return ur([new Be("","zoom expressions not supported")]);let a=Di(n);if(!a&&!o)return ur([new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Be)return ur([a]);if(a instanceof Je&&!gs(e))return ur([new Be("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return cs(i?new dt("constant",r.value):new dt("source",r.value));let s=a instanceof Je?a.interpolation:void 0;return cs(i?new gt("camera",r.value,a.labels,s):new gt("composite",r.value,a.labels,s))}var ln=class t{constructor(e,r){this._parameters=e,this._specification=r,fr(this,Nu(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 $u(t,e){if(to(t))return new ln(t,e);if(qt(t)){let r=Uu(t,e);if(r.result==="error")throw new Error(r.value.map(n=>"".concat(n.key,": ").concat(n.message)).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=W.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Ze.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)&&(r=Ne.parse(t)),{kind:"constant",evaluate:()=>r}}}function Di(t){let e=null;if(t instanceof zi)e=Di(t.result);else if(t instanceof Ni){for(let r of t.args)if(e=Di(r),e)break}else(t instanceof yr||t instanceof Je)&&t.input instanceof Ke&&t.input.name==="zoom"&&(e=t);return e instanceof Be||t.eachChild(r=>{let n=Di(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 Gh(t){let e={color:Re,string:G,number:L,enum:G,boolean:U,formatted:dr,padding:Hi,resolvedImage:cn,variableAnchorOffsetCollection:Xi};return t.type==="array"?Ee(e[t.value]||$,t.length):e[t.type]}function qh(t){return t.type==="color"&&to(t.default)?new W(0,0,0,0):t.type==="color"?W.parse(t.default)||null:t.type==="padding"?Ze.parse(t.default)||null:t.type==="variableAnchorOffsetCollection"?Ne.parse(t.default)||null:t.default===void 0?null:t.default}function xs(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(!xs(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var jh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yn(t){if(t==null)return{filter:()=>!0,needGeometry:!1};xs(t)||(t=Zi(t));let e=jt(t,jh);if(e.result==="error")throw new Error(e.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));{let r=Gu(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r}}}function Jh(t,e){return t<e?-1:t>e?1:0}function Gu(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(Gu(t[e]))return!0;return!1}function Zi(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?Wa(t[1],t[2],"=="):e==="!="?Li(Wa(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Wa(t[1],t[2],e):e==="any"?Zh(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(Zi)):e==="none"?["all"].concat(t.slice(1).map(Zi).map(Li)):e==="in"?bu(t[1],t.slice(2)):e==="!in"?Li(bu(t[1],t.slice(2))):e==="has"?vu(t[1]):e==="!has"?Li(vu(t[1])):!0}function Wa(t,e,r){switch(t){case"$type":return["filter-type-".concat(r),e];case"$id":return["filter-id-".concat(r),e];default:return["filter-".concat(r),t,e]}}function Zh(t){return["any"].concat(t.map(Zi))}function bu(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(Jh)]]:["filter-in-small",t,["literal",e]]}}function vu(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Li(t){return["!",t]}function ps(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+="".concat(ps(o),",");return"".concat(i,"]")}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+="".concat(JSON.stringify(r[i]),":").concat(ps(t[r[i]]),",");return"".concat(n,"}")}function Wh(t){let e="";for(let r of Am)e+="/".concat(ps(t[r]));return e}function qu(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||Wh(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 ju(t){let e=t.key,r=t.value;return r?[new M(e,r,"constants have been deprecated as of v8")]:[]}function ae(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ut(t){if(Array.isArray(t))return t.map(Ut);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Ut(t[r]);return e}return ae(t)}function ze(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 M(e,r,"object expected, ".concat(u," found"))];for(let c in r){let p=c.split(".")[0],f=n[p]||n["*"],y;if(i[p])y=i[p];else if(n[p])y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new M(e,r[c],\'unknown property "\'.concat(c,\'"\')));continue}l=l.concat(y({key:(e&&"".concat(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 M(e,r,\'missing required property "\'.concat(c,\'"\')));return l}function bs(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 M(a,e,"array expected, ".concat(j(e)," found"))];if(r.length&&e.length!==r.length)return[new M(a,e,"array length ".concat(r.length," expected, length ").concat(e.length," found"))];if(r["min-length"]&&e.length<r["min-length"])return[new M(a,e,"array length at least ".concat(r["min-length"]," expected, length ").concat(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:"".concat(a,"[").concat(c,"]")}));return u}function vs(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new M(e,r,"number expected, ".concat(i," found"))]:"minimum"in n&&r<n.minimum?[new M(e,r,"".concat(r," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&r>n.maximum?[new M(e,r,"".concat(r," is greater than the maximum value ").concat(n.maximum))]:[]}function Ju(t){let e=t.valueSpec,r=ae(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=ze({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 M(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new M(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!gs(t.valueSpec)&&c.push(new M(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ht(t.valueSpec)?c.push(new M(t.key,t.value,"property functions not supported")):s&&!Ou(t.valueSpec)&&c.push(new M(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new M(t.key,t.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new M(h.key,h.value,\'identity function may not have a "stops" property\')];let d=[],g=h.value;return d=d.concat(bs({key:h.key,value:g,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(g)==="array"&&g.length===0&&d.push(new M(h.key,g,"array must have at least one stop")),d}function f(h){let d=[],g=h.value,b=h.key;if(j(g)!=="array")return[new M(b,g,"array expected, ".concat(j(g)," found"))];if(g.length!==2)return[new M(b,g,"array length 2 expected, length ".concat(g.length," found"))];if(u){if(j(g[0])!=="object")return[new M(b,g,"object expected, ".concat(j(g[0])," found"))];if(g[0].zoom===void 0)return[new M(b,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new M(b,g,"object stop key must have value")];if(a&&a>ae(g[0].zoom))return[new M(b,g[0].zoom,"stop zoom values must appear in ascending order")];ae(g[0].zoom)!==a&&(a=ae(g[0].zoom),o=void 0,i={}),d=d.concat(ze({key:"".concat(b,"[0]"),value:g[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:vs,value:y}}))}else d=d.concat(y({key:"".concat(b,"[0]"),value:g[0],valueSpec:{},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},g));return qt(Ut(g[1]))?d.concat([new M("".concat(b,"[1]"),g[1],"expressions are not allowed in function stops.")]):d.concat(h.validateSpec({key:"".concat(b,"[1]"),value:g[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,d){let g=j(h.value),b=ae(h.value),x=h.value!==null?h.value:d;if(!n)n=g;else if(g!==n)return[new M(h.key,x,"".concat(g," stop domain type must match previous stop domain type ").concat(n))];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new M(h.key,x,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let v="number expected, ".concat(g," found");return ht(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new M(h.key,x,v)]}return r==="categorical"&&g==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new M(h.key,x,"integer expected, found ".concat(b))]:r!=="categorical"&&g==="number"&&o!==void 0&&b<o?[new M(h.key,x,"stop domain values must appear in ascending order")]:(o=b,r==="categorical"&&b in i?[new M(h.key,x,"stop domain values must be unique")]:(i[b]=!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 mr(t){let e=(t.expressionContext==="property"?Uu:jt)(Ut(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new M("".concat(t.key).concat(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 M(t.key,t.value,\'Invalid data expression for "\'.concat(t.propertyKey,\'". Output values must be contained as literals within the expression.\'))];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!sn(r))return[new M(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!sn(r))return[new M(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!eo(r,["zoom","feature-state"]))return[new M(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Qi(r))return[new M(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Hh(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new M(r,e,"boolean expected, ".concat(n," found"))]:[]}function Xh(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new M(e,r,"color expected, ".concat(n," found"))]:W.parse(String(r))?[]:[new M(e,r,\'color expected, "\'.concat(r,\'" found\'))]}function un(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(ae(r))===-1&&i.push(new M(e,r,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):Object.keys(n.values).indexOf(ae(r))===-1&&i.push(new M(e,r,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),i}function Ps(t){return xs(Ut(t.value))?mr(fr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Zu(t)}function Zu(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new M(r,e,"array expected, ".concat(j(e)," found"))];let n=t.styleSpec,i,o=[];if(e.length<1)return[new M(r,e,"filter array must have at least 1 element")];switch(o=o.concat(un({key:"".concat(r,"[0]"),value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),ae(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ae(e[1])==="$type"&&o.push(new M(r,e,\'"$type" cannot be use with operator "\'.concat(e[0],\'"\')));case"==":case"!=":e.length!==3&&o.push(new M(r,e,\'filter array for operator "\'.concat(e[0],\'" must have 3 elements\')));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new M("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found"))));for(let a=2;a<e.length;a++)i=j(e[a]),ae(e[1])==="$type"?o=o.concat(un({key:"".concat(r,"[").concat(a,"]"),value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new M("".concat(r,"[").concat(a,"]"),e[a],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(Zu({key:"".concat(r,"[").concat(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 M(r,e,\'filter array for "\'.concat(e[0],\'" operator must have 2 elements\'))):i!=="string"&&o.push(new M("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found")));break}return o}function Wu(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["".concat(e,"_").concat(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 M(r,a,\'unknown property "\'.concat(s,\'"\'))];let p;if(j(a)==="string"&&ht(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new M(r,a,\'"\'.concat(s,\'" does not support interpolation syntax\\n\')+\'Use an identity property function instead: `{ "type": "identity", "property": \'.concat(JSON.stringify(p[1])," }`."))];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new M(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&to(Ut(a))&&ae(a.type)==="identity"&&f.push(new M(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 Hu(t){return Wu(t,"paint")}function Xu(t){return Wu(t,"layout")}function Ku(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;!r.type&&!r.ref&&e.push(new M(n,r,\'either "type" or "ref" is required\'));let a=ae(r.type),s=ae(r.ref);if(r.id){let l=ae(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];ae(c.id)===l&&e.push(new M(n,r.id,\'duplicate layer id "\'.concat(r.id,\'", previously used at line \').concat(c.id.__line__)))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new M(n,r[u],\'"\'.concat(u,\'" is prohibited for ref layers\')))});let l;i.layers.forEach(u=>{ae(u.id)===s&&(l=u)}),l?l.ref?e.push(new M(n,r.ref,"ref cannot reference another ref layer")):a=ae(l.type):e.push(new M(n,r.ref,\'ref layer "\'.concat(s,\'" not found\')))}else if(a!=="background")if(!r.source)e.push(new M(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&ae(l.type);l?u==="vector"&&a==="raster"?e.push(new M(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster source\'))):u!=="raster-dem"&&a==="hillshade"?e.push(new M(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster-dem source\'))):u==="raster"&&a!=="raster"?e.push(new M(n,r.source,\'layer "\'.concat(r.id,\'" requires a vector source\'))):u==="vector"&&!r["source-layer"]?e.push(new M(n,r,\'layer "\'.concat(r.id,\'" must specify a "source-layer"\'))):u==="raster-dem"&&a!=="hillshade"?e.push(new M(n,r.source,"raster-dem source can only be used with layer type \'hillshade\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new M(n,r,\'layer "\'.concat(r.id,\'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.\'))):e.push(new M(n,r.source,\'source "\'.concat(r.source,\'" not found\')))}return e=e.concat(ze({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:"".concat(n,".type"),value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Ps,layout(l){return ze({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Xu(fr({layerType:a},u))}}})},paint(l){return ze({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Hu(fr({layerType:a},u))}}})}}})),e}function $t(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new M(r,e,"string expected, ".concat(n," found"))]:[]}function Kh(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 M("source_raster_dem",n,"object expected, ".concat(l," found"))),s;let c=ae(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?\'"\'.concat(t.value.encoding,\'"\'):"Default";for(let y in n)!c&&p.includes(y)?s.push(new M(y,n[y],\'In "\'.concat(r,\'": "\').concat(y,\'" is only valid when "encoding" is set to "custom". \').concat(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 M(y,n[y],\'unknown property "\'.concat(y,\'"\')));return s}var Pu={promoteId:Yh};function Yu(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new M(r,e,\'"type" is required\')];let a=ae(e.type),s;switch(a){case"vector":case"raster":return s=ze({key:r,value:e,valueSpec:n["source_".concat(a.replace("-","_"))],style:t.style,styleSpec:n,objectElementValidators:Pu,validateSpec:o}),s;case"raster-dem":return s=Kh({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=ze({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:Pu}),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(...mr({key:"".concat(r,".").concat(l,".map"),value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...mr({key:"".concat(r,".").concat(l,".reduce"),value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return ze({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return ze({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new M(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return un({key:"".concat(r,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function Yh({key:t,value:e}){if(j(e)==="string")return $t({key:t,value:e});{let r=[];for(let n in e)r.push(...$t({key:"".concat(t,".").concat(n),value:e[n]}));return r}}function Qu(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 M("light",e,"object expected, ".concat(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 M(s,e[s],\'unknown property "\'.concat(s,\'"\'))])}return o}function ec(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 M("sky",e,"object expected, ".concat(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 M(s,e[s],\'unknown property "\'.concat(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 M("terrain",e,"object expected, ".concat(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 M(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return o}function Qh(t){return $t(t).length===0?[]:mr(t)}function ed(t){return $t(t).length===0?[]:mr(t)}function td(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new M(e,r,"padding requires 1 to 4 values; ".concat(r.length," values found"))];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return vs({key:e,value:r,valueSpec:{}})}function rd(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 M(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(un({key:"".concat(e,"[").concat(a,"]"),value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(bs({key:"".concat(e,"[").concat(a+1,"]"),value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function rc(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 M(n,r,"all the sprites\' ids must be unique, but ".concat(r[a].id," is duplicated"))),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new M(n,r,"all the sprites\' URLs must be unique, but ".concat(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(ze({key:"".concat(n,"[").concat(a,"]"),value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return $t({key:n,value:r})}function nd(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 M("projection",e,"object expected, ".concat(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 M(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return a}var Su={"*"(){return[]},array:bs,boolean:Hh,number:vs,color:Xh,constants:ju,enum:un,filter:Ps,function:Ju,layer:Ku,object:ze,source:Yu,light:Qu,sky:ec,terrain:tc,projection:nd,string:$t,formatted:Qh,resolvedImage:ed,padding:td,variableAnchorOffsetCollection:rd,sprite:rc};function Xr(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=Xr,r.expression&&to(ae(e))?Ju(t):r.expression&&qt(Ut(e))?mr(t):r.type&&Su[r.type]?Su[r.type](t):ze(fr({},t,{valueSpec:r.type?n[r.type]:r}))}function nc(t){let e=t.value,r=t.key,n=$t(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new M(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new M(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Ue(t,e=S){let r=[];return r=r.concat(Xr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Xr,objectElementValidators:{glyphs:nc,"*"(){return[]}}})),t.constants&&(r=r.concat(ju({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Xr}))),ic(r)}Ue.source=Qe(Ye(Yu));Ue.sprite=Qe(Ye(rc));Ue.glyphs=Qe(Ye(nc));Ue.light=Qe(Ye(Qu));Ue.sky=Qe(Ye(ec));Ue.terrain=Qe(Ye(tc));Ue.layer=Qe(Ye(Ku));Ue.filter=Qe(Ye(Ps));Ue.paintProperty=Qe(Ye(Hu));Ue.layoutProperty=Qe(Ye(Xu));function Ye(t){return function(e){return t(Ci(Dt({},e),{validateSpec:Xr}))}}function ic(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function Qe(t){return function(...e){return ic(t.apply(this,e))}}var oc="AbortError";function ac(t){return t.message===oc}function Ss(){return new Error(oc)}var ro={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function sc(t){return ro.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function lc(t,e){ro.REGISTERED_PROTOCOLS[t]=e}function uc(t){delete ro.REGISTERED_PROTOCOLS[t]}var cc="global-dispatcher",br=class extends Error{constructor(e,r,n,i){super("AJAXError: ".concat(r," (").concat(e,"): ").concat(n)),this.status=e,this.statusText=r,this.url=n,this.body=i}},fc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,id=t=>/^file:/.test(t)||/^file:/.test(fc())&&!/^\\w+:/.test(t);async function od(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:fc(),signal:e.signal});t.type==="json"&&r.headers.set("Accept","application/json");let n=await fetch(r);if(!n.ok){let a=await n.blob();throw new br(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 Ss();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function ad(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",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 br(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Ss())}),i.send(t.body)})}var yc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=sc(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:cc},e)}if(!id(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return od(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:cc},e)}return ad(t,e)},mc=(t,e)=>yc(Pe(t,{type:"json"}),e),hc=(t,e)=>yc(Pe(t,{type:"arrayBuffer"}),e);var xt={};function C(t,e,r={}){if(xt[t])throw new Error("".concat(t," is already registered."));Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),xt[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}C("Object",Object);C("TransferableGridIndex",Vt);C("Color",W);C("Error",Error);C("AJAXError",br);C("ResolvedImage",Te);C("StylePropertyFunction",ln);C("StyleExpression",Nt,{omit:["_evaluator"]});C("ZoomDependentExpression",gt);C("ZoomConstantExpression",dt);C("CompoundExpression",Ke,{omit:["_evaluate"]});for(let t in Gt)Gt[t]._classRegistryKey||C("Expression_".concat(t),Gt[t]);function dc(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function vr(t,e){if(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)return t;if(dc(t)||Jr(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){let r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let r=[];for(let n of t)r.push(vr(n,e));return r}if(typeof t=="object"){let r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can\'t serialize object of unregistered class ".concat(r.name));if(!xt[n])throw new Error("".concat(n," is not registered."));let i=r.serialize?r.serialize(t,e):{};if(r.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)||xt[n].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=xt[n].shallow.indexOf(o)>=0?a:vr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(i.$name=n),i}throw new Error("can\'t serialize object of type ".concat(typeof t))}function Pr(t){if(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||dc(t)||Jr(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Pr);if(typeof t=="object"){let e=t.$name||"Object";if(!xt[e])throw new Error("can\'t deserialize unregistered class ".concat(e));let{klass:r}=xt[e];if(!r)throw new Error("can\'t deserialize unregistered class ".concat(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]=xt[e].shallow.indexOf(i)>=0?o:Pr(o)}return n}throw new Error("can\'t deserialize object of type ".concat(typeof t))}var no=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 io=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new no(()=>this.process()),this.subscription=tu(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);this.resolveRejects[o]={resolve:n,reject:i},r&&r.signal.addEventListener("abort",()=>{delete this.resolveRejects[o];let l={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},{once:!0});let a=[],s=Ci(Dt({},e),{id:o,sourceMapId:this.mapId,origin:location.origin,data:vr(e.data,a)});this.target.postMessage(s,{transfer:a})})}receive(e){let r=e.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&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(Pr(r.error)):o.resolve(Pr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error("Could not find a registered handler for ".concat(r.type,", map ID: ").concat(this.mapId,", available handlers: ").concat(Object.keys(this.messageHandlers).join(", "))));return}let n=Pr(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?vr(r):null,data:vr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function gc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function ws(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var oo=class{constructor(e,r={}){Pe(this,r),this.type=e}},mn=class extends oo{constructor(e,r={}){super("error",Pe({error:e},r))}},ao=class{on(e,r){return this._listeners=this._listeners||{},gc(e,r,this._listeners),this}off(e,r){return ws(e,r,this._listeners),ws(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},gc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new oo(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)ws(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(Pe(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof mn&&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 bt=Ue,tv=bt.source,rv=bt.light,nv=bt.terrain,iv=bt.filter,xc=bt.paintProperty,bc=bt.layoutProperty;function vc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new mn(new Error(n.message))),r=!0;return r}var so=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 D={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"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,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"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,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function hn(t){for(let e of t)if(lo(e.charCodeAt(0)))return!0;return!1}function Pc(t){for(let e of t)if(!sd(e.charCodeAt(0)))return!1;return!0}function sd(t){return!(D.Arabic(t)||D["Arabic Supplement"](t)||D["Arabic Extended-A"](t)||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t))}function Sc(t){return t<11904?!1:!!(D["Bopomofo Extended"](t)||D.Bopomofo(t)||D["CJK Compatibility Forms"](t)||D["CJK Compatibility Ideographs"](t)||D["CJK Compatibility"](t)||D["CJK Radicals Supplement"](t)||D["CJK Strokes"](t)||D["CJK Symbols and Punctuation"](t)||D["CJK Unified Ideographs Extension A"](t)||D["CJK Unified Ideographs"](t)||D["Enclosed CJK Letters and Months"](t)||D["Halfwidth and Fullwidth Forms"](t)||D.Hiragana(t)||D["Ideographic Description Characters"](t)||D["Kangxi Radicals"](t)||D["Katakana Phonetic Extensions"](t)||D.Katakana(t)||D["Vertical Forms"](t)||D["Yi Radicals"](t)||D["Yi Syllables"](t))}function lo(t){return t===746||t===747?!0:t<4352?!1:!!(D["Bopomofo Extended"](t)||D.Bopomofo(t)||D["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||D["CJK Compatibility Ideographs"](t)||D["CJK Compatibility"](t)||D["CJK Radicals Supplement"](t)||D["CJK Strokes"](t)||D["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||D["CJK Unified Ideographs Extension A"](t)||D["CJK Unified Ideographs"](t)||D["Enclosed CJK Letters and Months"](t)||D["Hangul Compatibility Jamo"](t)||D["Hangul Jamo Extended-A"](t)||D["Hangul Jamo Extended-B"](t)||D["Hangul Jamo"](t)||D["Hangul Syllables"](t)||D.Hiragana(t)||D["Ideographic Description Characters"](t)||D.Kanbun(t)||D["Kangxi Radicals"](t)||D["Katakana Phonetic Extensions"](t)||D.Katakana(t)&&t!==12540||D["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)||D["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||D["Unified Canadian Aboriginal Syllabics"](t)||D["Unified Canadian Aboriginal Syllabics Extended"](t)||D["Vertical Forms"](t)||D["Yijing Hexagram Symbols"](t)||D["Yi Syllables"](t)||D["Yi Radicals"](t))}function ld(t){return!!(D["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||D["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)||D["Letterlike Symbols"](t)||D["Number Forms"](t)||D["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)||D["Control Pictures"](t)&&t!==9251||D["Optical Character Recognition"](t)||D["Enclosed Alphanumerics"](t)||D["Geometric Shapes"](t)||D["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||D["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||D["CJK Symbols and Punctuation"](t)||D.Katakana(t)||D["Private Use Area"](t)||D["CJK Compatibility Forms"](t)||D["Small Form Variants"](t)||D["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function As(t){return!(lo(t)||ld(t))}function wc(t){return D.Arabic(t)||D["Arabic Supplement"](t)||D["Arabic Extended-A"](t)||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t)}function Ac(t){return t>=1424&&t<=2303||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t)}function ud(t,e){return!(!e&&Ac(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||D.Khmer(t))}function _c(t){for(let e of t)if(Ac(e.charCodeAt(0)))return!0;return!1}function Ic(t,e){for(let r of t)if(!ud(r.charCodeAt(0),e))return!1;return!0}var _s=class{constructor(){this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}},ye=new _s;var q=class{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new so,this.transition={})}isSupportedScript(e){return Ic(e,ye.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 Sr=class{constructor(e,r){this.property=e,this.value=r,this.expression=$u(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},dn=class{constructor(e){this.property=e,this.value=new Sr(e,void 0)}transitioned(e,r){return new co(this.property,this.value,r,Pe({},e.transition,this.transition),e.now)}untransitioned(){return new co(this.property,this.value,null,{},0)}},uo=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 dn(this._values[e].property)),this._values[e].value=new Sr(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 dn(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["".concat(r,"-transition")]=i)}return e}transitioned(e,r){let n=new po(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 po(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},co=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,Wl(s))}}else return o}},po=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new vt(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}},fo=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 Sr(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 vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},Se=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)}},vt=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},B=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=Oe[i];return o?o(e,r,n):e}},R=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 Se(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new Se(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 Se(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=Oe[i];if(o){let a=o(e.value.value,r.value.value,n);return new Se(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)}},lt=class extends R{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new Se(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 Se(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 Se(this,{kind:"constant",value:o},r)}else return new Se(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}},Jt=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 q(Math.floor(r.zoom-1),r)),e.expression.evaluate(new q(Math.floor(r.zoom),r)),e.expression.evaluate(new q(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}},Zt=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},re=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 Sr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new dn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",R);C("DataConstantProperty",B);C("CrossFadedDataDrivenProperty",lt);C("CrossFadedProperty",Jt);C("ColorRampProperty",Zt);var yo="-transition",se=class extends ao{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},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),r.layout&&(this._unevaluatedLayout=new fo(r.layout)),r.paint)){this._transitionablePaint=new uo(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 vt(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".layout.").concat(e);if(this._validate(bc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(yo)?this._transitionablePaint.getTransition(e.slice(0,-yo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".paint.").concat(e);if(this._validate(xc,i,e,r,n))return!1}if(e.endsWith(yo))return this._transitionablePaint.setTransition(e.slice(0,-yo.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),Kl(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:vc(this,e.call(bt,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:S,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 Se)||!ht(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var cd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Pt=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}},pd=128,fd=5,ee=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*fd),pd),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 Y(t,e=1){let r=0,n=0,i=t.map(a=>{let s=yd(a.type),l=r=Tc(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=Tc(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function yd(t){return cd[t].BYTES_PER_ELEMENT}function Tc(t,e){return Math.ceil(t/e)*e}var Cc=Z(he(),1),Wt=class extends ee{_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}};Wt.prototype.bytesPerElement=4;C("StructArrayLayout2i4",Wt);var gn=class extends ee{_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}};gn.prototype.bytesPerElement=6;C("StructArrayLayout3i6",gn);var mo=class extends ee{_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}};mo.prototype.bytesPerElement=8;C("StructArrayLayout4i8",mo);var xn=class extends ee{_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}};xn.prototype.bytesPerElement=12;C("StructArrayLayout2i4i12",xn);var bn=class extends ee{_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}};bn.prototype.bytesPerElement=8;C("StructArrayLayout2i4ub8",bn);var St=class extends ee{_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}};St.prototype.bytesPerElement=8;C("StructArrayLayout2f8",St);var vn=class extends ee{_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}};vn.prototype.bytesPerElement=20;C("StructArrayLayout10ui20",vn);var Pn=class extends ee{_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}};Pn.prototype.bytesPerElement=24;C("StructArrayLayout4i4ui4i24",Pn);var Sn=class extends ee{_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}};Sn.prototype.bytesPerElement=12;C("StructArrayLayout3f12",Sn);var wn=class extends ee{_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}};wn.prototype.bytesPerElement=4;C("StructArrayLayout1ul4",wn);var An=class extends ee{_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}};An.prototype.bytesPerElement=20;C("StructArrayLayout6i1ul2ui20",An);var _n=class extends ee{_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}};_n.prototype.bytesPerElement=12;C("StructArrayLayout2i2i2i12",_n);var ho=class extends ee{_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}};ho.prototype.bytesPerElement=16;C("StructArrayLayout2f1f2i16",ho);var In=class extends ee{_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*12,s=e*3;return this.uint8[a+0]=r,this.uint8[a+1]=n,this.float32[s+1]=i,this.float32[s+2]=o,e}};In.prototype.bytesPerElement=12;C("StructArrayLayout2ub2f12",In);var Tn=class extends ee{_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}};Tn.prototype.bytesPerElement=6;C("StructArrayLayout3ui6",Tn);var Cn=class extends ee{_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,d,g){let b=this.length;return this.resize(b+1),this.emplace(b,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b){let x=e*24,v=e*12,P=e*48;return this.int16[x+0]=r,this.int16[x+1]=n,this.uint16[x+2]=i,this.uint16[x+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[x+10]=u,this.uint16[x+11]=c,this.uint16[x+12]=p,this.float32[v+7]=f,this.float32[v+8]=y,this.uint8[P+36]=m,this.uint8[P+37]=h,this.uint8[P+38]=d,this.uint32[v+10]=g,this.int16[x+22]=b,e}};Cn.prototype.bytesPerElement=48;C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Cn);var kn=class extends ee{_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,d,g,b,x,v,P,w,T,F,E,_,I,k){let V=this.length;return this.resize(V+1),this.emplace(V,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k,V){let A=e*32,z=e*16;return this.int16[A+0]=r,this.int16[A+1]=n,this.int16[A+2]=i,this.int16[A+3]=o,this.int16[A+4]=a,this.int16[A+5]=s,this.int16[A+6]=l,this.int16[A+7]=u,this.uint16[A+8]=c,this.uint16[A+9]=p,this.uint16[A+10]=f,this.uint16[A+11]=y,this.uint16[A+12]=m,this.uint16[A+13]=h,this.uint16[A+14]=d,this.uint16[A+15]=g,this.uint16[A+16]=b,this.uint16[A+17]=x,this.uint16[A+18]=v,this.uint16[A+19]=P,this.uint16[A+20]=w,this.uint16[A+21]=T,this.uint16[A+22]=F,this.uint32[z+12]=E,this.float32[z+13]=_,this.float32[z+14]=I,this.uint16[A+30]=k,this.uint16[A+31]=V,e}};kn.prototype.bytesPerElement=64;C("StructArrayLayout8i15ui1ul2f2ui64",kn);var Ht=class extends ee{_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}};Ht.prototype.bytesPerElement=4;C("StructArrayLayout1f4",Ht);var Mn=class extends ee{_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}};Mn.prototype.bytesPerElement=12;C("StructArrayLayout1ui2f12",Mn);var En=class extends ee{_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}};En.prototype.bytesPerElement=8;C("StructArrayLayout1ul2ui8",En);var Fn=class extends ee{_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}};Fn.prototype.bytesPerElement=4;C("StructArrayLayout2ui4",Fn);var go=class extends ee{_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}};go.prototype.bytesPerElement=2;C("StructArrayLayout1ui2",go);var wr=class extends ee{_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}};wr.prototype.bytesPerElement=16;C("StructArrayLayout4f16",wr);var xo=class extends Pt{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 Cc.default(this.anchorPointX,this.anchorPointY)}};xo.prototype.size=20;var Ln=class extends An{get(e){return new xo(this,e)}};C("CollisionBoxArray",Ln);var bo=class extends Pt{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]}};bo.prototype.size=48;var Dn=class extends Cn{get(e){return new bo(this,e)}};C("PlacedSymbolArray",Dn);var vo=class extends Pt{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]}};vo.prototype.size=64;var Vn=class extends kn{get(e){return new vo(this,e)}};C("SymbolInstanceArray",Vn);var Bn=class extends Ht{getoffsetX(e){return this.float32[e*1+0]}};C("GlyphOffsetArray",Bn);var zn=class extends gn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};C("SymbolLineVertexArray",zn);var Po=class extends Pt{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]}};Po.prototype.size=12;var Rn=class extends Mn{get(e){return new Po(this,e)}};C("TextAnchorOffsetArray",Rn);var So=class extends Pt{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]}};So.prototype.size=8;var On=class extends En{get(e){return new So(this,e)}};C("FeatureIndexArray",On);var wo=class extends Wt{};var Ao=class extends Wt{},_o=class extends Wt{},Io=class extends xn{};var To=class extends bn{},Co=class extends St{},ut=class extends vn{},ko=class extends Pn{},Mo=class extends Sn{},Eo=class extends wn{},Nn=class extends _n{};var Fo=class extends In{};var Le=class extends Tn{},wt=class extends Fn{};var md=Y([{name:"a_pos",components:2,type:"Int16"}],4);var{members:kc,size:$v,alignment:Gv}=md;var me=class t{constructor(e=[]){this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&fe("Max vertices per segment is ".concat(t.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(e)),(!o||o.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}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}])}};me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;C("SegmentVector",me);function Is(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Un=Y([{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 Dc=Z(ks(),1);var $n=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(Lc(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=Lc(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 Ms(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 Lc(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Dc.default)(String(t))}function Ms(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;Do(t,o,a),Do(e,3*o,3*a),Do(e,3*o+1,3*a+1),Do(e,3*o+2,3*a+2)}a-r<n-a?(Ms(t,e,r,a),r=a+1):(Ms(t,e,a+1,n),n=a)}}function Do(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}C("FeaturePositionMap",$n);var Gn=class{constructor(e,r){this.gl=e.gl,this.location=r}};var Ar=class extends Gn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var Vo=class extends Gn{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]))}},Bo=class extends Gn{constructor(e,r){super(e,r),this.current=W.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))}},i1=new Float32Array(16);function Es(t){return[Is(255*t.r,255*t.g),Is(255*t.b,255*t.a)]}var Xt=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>"u_".concat(i)),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new Bo(e,r):new Ar(e,r)}},At=class{constructor(e,r){this.uniformNames=r.map(n=>"u_".concat(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 Vo(e,r):new Ar(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_".concat(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 q(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=Es(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_".concat(s,"_t")),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:"a_".concat(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 q(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new q(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=Es(n),a=Es(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 Ar(e,r)}},et=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,Un.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Un.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},zo=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 Se)||!ht(a.property.specification))continue;let s=xd(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 At(l.value,s):new Xt(l.value,s,u),i.push("/u_".concat(o));else if(l.kind==="source"||f){let y=Vc(o,u,"source");this.binders[o]=f?new et(l,u,c,r,y,e.id):new We(l,s,u,y),i.push("/a_".concat(o))}else{let y=Vc(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push("/z_".concat(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 et)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof At&&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 et)&&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 Xt||n instanceof At)&&e.push(...n.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(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 et)for(let i=0;i<Un.members.length;i++)e.push(Un.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Xt||n instanceof At||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 Xt||o instanceof At||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 et){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 et)&&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 et)&&r.destroy()}}},Ce=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new zo(i,r,n);this.needsUpload=!1,this._featureMap=new $n,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 xd(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("".concat(e,"-"),"").replace(/-/g,"_")]}function bd(t){return{"line-pattern":{source:ut,composite:ut},"fill-pattern":{source:ut,composite:ut},"fill-extrusion-pattern":{source:ut,composite:ut}}[t]}function Vc(t,e,r){let n={color:{source:St,composite:wr},number:{source:Ht,composite:St}},i=bd(t);return i&&i[r]||n[e][r]}C("ConstantBinder",Xt);C("CrossFadedConstantBinder",At);C("SourceExpressionBinder",We);C("CrossFadedCompositeBinder",et);C("CompositeExpressionBinder",De);C("ProgramConfiguration",zo,{omit:["_buffers"]});C("ProgramConfigurationSet",Ce);var vd=15,Fs=Math.pow(2,vd-1)-1,Bc=-Fs-1;function ke(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,Bc,Fs),a.y=it(l,Bc,Fs),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&fe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function $e(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?ke(t):[]}}function Ro(t,e,r,n,i){t.emplaceBack(e*2+(n+1)/2,r*2+(i+1)/2)}var Kt=class{constructor(e){this.zoom=e.zoom,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 Ao,this.indexArray=new Le,this.segments=new me,this.programConfigurations=new Ce(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;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of e){let f=this.layers[0]._featureFilter.needGeometry,y=$e(l,f);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),y,n))continue;let m=s?a.evaluate(y,{},n):void 0,h={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:f?y.geometry:ke(l),patterns:{},sortKey:m};o.push(h)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,f=e[c].feature;this.addFeature(l,u,c,n),r.featureIndex.insert(f,u,c,p,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,kc),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){for(let o of r)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),c=u.vertexLength;Ro(this.layoutVertexArray,s,l,-1,-1),Ro(this.layoutVertexArray,s,l,1,-1),Ro(this.layoutVertexArray,s,l,1,1),Ro(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};C("CircleBucket",Kt,{omit:["layers"]});var qn=Z(he(),1);function Rc(t,e){for(let r=0;r<t.length;r++)if(_r(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(_r(t,e[r]))return!0;return!!Ds(t,e)}function Oc(t,e,r){return!!(_r(t,e)||Ls(e,t,r))}function Oo(t,e){if(t.length===1)return zc(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(_r(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(zc(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Ds(t,e[r]))return!0;return!1}function Nc(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(_r(t,i[o]))return!0}if(Pd(t,i,r))return!0}return!1}function Pd(t,e,r){if(t.length>1){if(Ds(t,e))return!0;for(let n=0;n<e.length;n++)if(Ls(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Ls(t[n],e,r))return!0;return!1}function Ds(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(Sd(n,i,a,s))return!0}}return!1}function Sd(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function Ls(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(Vs(t,o,a)<n)return!0}return!1}function Vs(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 zc(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 _r(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 Uc(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 qn.default(e,r),new qn.default(e,i),new qn.default(n,i),new qn.default(n,r)];if(t.length>2){for(let a of o)if(_r(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(wd(s,l,o))return!0}return!1}function wd(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 No=Z(he(),1);function Yt(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function _t(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function It(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=No.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 $c(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 No.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new No.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 Gc,Ad=()=>Gc=Gc||new re({"circle-sort-key":new R(S.layout_circle["circle-sort-key"])}),qc,_d=()=>qc=qc||new re({"circle-radius":new R(S.paint_circle["circle-radius"]),"circle-color":new R(S.paint_circle["circle-color"]),"circle-blur":new R(S.paint_circle["circle-blur"]),"circle-opacity":new R(S.paint_circle["circle-opacity"]),"circle-translate":new B(S.paint_circle["circle-translate"]),"circle-translate-anchor":new B(S.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new B(S.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new B(S.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new R(S.paint_circle["circle-stroke-width"]),"circle-stroke-color":new R(S.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new R(S.paint_circle["circle-stroke-opacity"])}),jc={get paint(){return _d()},get layout(){return Ad()}};var Q=1e-6,Ge=typeof Float32Array<"u"?Float32Array:Array,jn=Math.random;var X1=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 Jn={};Ol(Jn,{add:()=>ug,adjoint:()=>Ld,clone:()=>Td,copy:()=>Cd,create:()=>Id,determinant:()=>Dd,equals:()=>yg,exactEquals:()=>fg,frob:()=>lg,fromQuat:()=>Yd,fromQuat2:()=>Zd,fromRotation:()=>Gd,fromRotationTranslation:()=>Hc,fromRotationTranslationScale:()=>Xd,fromRotationTranslationScaleOrigin:()=>Kd,fromScaling:()=>$d,fromTranslation:()=>Ud,fromValues:()=>kd,fromXRotation:()=>qd,fromYRotation:()=>jd,fromZRotation:()=>Jd,frustum:()=>Qd,getRotation:()=>Hd,getScaling:()=>Xc,getTranslation:()=>Wd,identity:()=>Zc,invert:()=>Fd,lookAt:()=>og,mul:()=>mg,multiply:()=>Wc,multiplyScalar:()=>cg,multiplyScalarAndAdd:()=>pg,ortho:()=>ng,orthoNO:()=>Yc,orthoZO:()=>ig,perspective:()=>eg,perspectiveFromFieldOfView:()=>rg,perspectiveNO:()=>Kc,perspectiveZO:()=>tg,rotate:()=>zd,rotateX:()=>Rd,rotateY:()=>Od,rotateZ:()=>Nd,scale:()=>Bd,set:()=>Md,str:()=>sg,sub:()=>hg,subtract:()=>Qc,targetTo:()=>ag,translate:()=>Vd,transpose:()=>Ed});function Id(){var t=new Ge(16);return Ge!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function Td(t){var e=new Ge(16);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 Cd(t,e){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 kd(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h){var d=new Ge(16);return d[0]=t,d[1]=e,d[2]=r,d[3]=n,d[4]=i,d[5]=o,d[6]=a,d[7]=s,d[8]=l,d[9]=u,d[10]=c,d[11]=p,d[12]=f,d[13]=y,d[14]=m,d[15]=h,d}function Md(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t[9]=c,t[10]=p,t[11]=f,t[12]=y,t[13]=m,t[14]=h,t[15]=d,t}function Zc(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ed(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Fd(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],h=e[13],d=e[14],g=e[15],b=r*s-n*a,x=r*l-i*a,v=r*u-o*a,P=n*l-i*s,w=n*u-o*s,T=i*u-o*l,F=c*h-p*m,E=c*d-f*m,_=c*g-y*m,I=p*d-f*h,k=p*g-y*h,V=f*g-y*d,A=b*V-x*k+v*I+P*_-w*E+T*F;return A?(A=1/A,t[0]=(s*V-l*k+u*I)*A,t[1]=(i*k-n*V-o*I)*A,t[2]=(h*T-d*w+g*P)*A,t[3]=(f*w-p*T-y*P)*A,t[4]=(l*_-a*V-u*E)*A,t[5]=(r*V-i*_+o*E)*A,t[6]=(d*v-m*T-g*x)*A,t[7]=(c*T-f*v+y*x)*A,t[8]=(a*k-s*_+u*F)*A,t[9]=(n*_-r*k-o*F)*A,t[10]=(m*w-h*v+g*b)*A,t[11]=(p*v-c*w-y*b)*A,t[12]=(s*E-a*I-l*F)*A,t[13]=(r*I-n*E+i*F)*A,t[14]=(h*x-m*P-d*b)*A,t[15]=(c*P-p*x+f*b)*A,t):null}function Ld(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],h=e[13],d=e[14],g=e[15];return t[0]=s*(f*g-y*d)-p*(l*g-u*d)+h*(l*y-u*f),t[1]=-(n*(f*g-y*d)-p*(i*g-o*d)+h*(i*y-o*f)),t[2]=n*(l*g-u*d)-s*(i*g-o*d)+h*(i*u-o*l),t[3]=-(n*(l*y-u*f)-s*(i*y-o*f)+p*(i*u-o*l)),t[4]=-(a*(f*g-y*d)-c*(l*g-u*d)+m*(l*y-u*f)),t[5]=r*(f*g-y*d)-c*(i*g-o*d)+m*(i*y-o*f),t[6]=-(r*(l*g-u*d)-a*(i*g-o*d)+m*(i*u-o*l)),t[7]=r*(l*y-u*f)-a*(i*y-o*f)+c*(i*u-o*l),t[8]=a*(p*g-y*h)-c*(s*g-u*h)+m*(s*y-u*p),t[9]=-(r*(p*g-y*h)-c*(n*g-o*h)+m*(n*y-o*p)),t[10]=r*(s*g-u*h)-a*(n*g-o*h)+m*(n*u-o*s),t[11]=-(r*(s*y-u*p)-a*(n*y-o*p)+c*(n*u-o*s)),t[12]=-(a*(p*d-f*h)-c*(s*d-l*h)+m*(s*f-l*p)),t[13]=r*(p*d-f*h)-c*(n*d-i*h)+m*(n*f-i*p),t[14]=-(r*(s*d-l*h)-a*(n*d-i*h)+m*(n*l-i*s)),t[15]=r*(s*f-l*p)-a*(n*f-i*p)+c*(n*l-i*s),t}function Dd(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],p=t[10],f=t[11],y=t[12],m=t[13],h=t[14],d=t[15],g=e*a-r*o,b=e*s-n*o,x=e*l-i*o,v=r*s-n*a,P=r*l-i*a,w=n*l-i*s,T=u*m-c*y,F=u*h-p*y,E=u*d-f*y,_=c*h-p*m,I=c*d-f*m,k=p*d-f*h;return g*k-b*I+x*_+v*E-P*F+w*T}function Wc(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],f=e[9],y=e[10],m=e[11],h=e[12],d=e[13],g=e[14],b=e[15],x=r[0],v=r[1],P=r[2],w=r[3];return t[0]=x*n+v*s+P*p+w*h,t[1]=x*i+v*l+P*f+w*d,t[2]=x*o+v*u+P*y+w*g,t[3]=x*a+v*c+P*m+w*b,x=r[4],v=r[5],P=r[6],w=r[7],t[4]=x*n+v*s+P*p+w*h,t[5]=x*i+v*l+P*f+w*d,t[6]=x*o+v*u+P*y+w*g,t[7]=x*a+v*c+P*m+w*b,x=r[8],v=r[9],P=r[10],w=r[11],t[8]=x*n+v*s+P*p+w*h,t[9]=x*i+v*l+P*f+w*d,t[10]=x*o+v*u+P*y+w*g,t[11]=x*a+v*c+P*m+w*b,x=r[12],v=r[13],P=r[14],w=r[15],t[12]=x*n+v*s+P*p+w*h,t[13]=x*i+v*l+P*f+w*d,t[14]=x*o+v*u+P*y+w*g,t[15]=x*a+v*c+P*m+w*b,t}function Vd(t,e,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,f,y,m,h,d,g;return e===t?(t[12]=e[0]*n+e[4]*i+e[8]*o+e[12],t[13]=e[1]*n+e[5]*i+e[9]*o+e[13],t[14]=e[2]*n+e[6]*i+e[10]*o+e[14],t[15]=e[3]*n+e[7]*i+e[11]*o+e[15]):(a=e[0],s=e[1],l=e[2],u=e[3],c=e[4],p=e[5],f=e[6],y=e[7],m=e[8],h=e[9],d=e[10],g=e[11],t[0]=a,t[1]=s,t[2]=l,t[3]=u,t[4]=c,t[5]=p,t[6]=f,t[7]=y,t[8]=m,t[9]=h,t[10]=d,t[11]=g,t[12]=a*n+c*i+m*o+e[12],t[13]=s*n+p*i+h*o+e[13],t[14]=l*n+f*i+d*o+e[14],t[15]=u*n+y*i+g*o+e[15]),t}function Bd(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function zd(t,e,r,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k,V,A,z;return s<Q?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,p=e[0],f=e[1],y=e[2],m=e[3],h=e[4],d=e[5],g=e[6],b=e[7],x=e[8],v=e[9],P=e[10],w=e[11],T=i*i*c+u,F=o*i*c+a*l,E=a*i*c-o*l,_=i*o*c-a*l,I=o*o*c+u,k=a*o*c+i*l,V=i*a*c+o*l,A=o*a*c-i*l,z=a*a*c+u,t[0]=p*T+h*F+x*E,t[1]=f*T+d*F+v*E,t[2]=y*T+g*F+P*E,t[3]=m*T+b*F+w*E,t[4]=p*_+h*I+x*k,t[5]=f*_+d*I+v*k,t[6]=y*_+g*I+P*k,t[7]=m*_+b*I+w*k,t[8]=p*V+h*A+x*z,t[9]=f*V+d*A+v*z,t[10]=y*V+g*A+P*z,t[11]=m*V+b*A+w*z,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Rd(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+p*n,t[7]=l*i+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=p*i-s*n,t[11]=f*i-l*n,t}function Od(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],p=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-p*n,t[3]=l*i-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+p*i,t[11]=l*n+f*i,t}function Nd(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],p=e[6],f=e[7];return e!==t&&(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[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+p*n,t[3]=l*i+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=p*i-s*n,t[7]=f*i-l*n,t}function Ud(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function $d(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Gd(t,e,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<Q?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(e),l=Math.cos(e),u=1-l,t[0]=n*n*u+l,t[1]=i*n*u+o*s,t[2]=o*n*u-i*s,t[3]=0,t[4]=n*i*u-o*s,t[5]=i*i*u+l,t[6]=o*i*u+n*s,t[7]=0,t[8]=n*o*u+i*s,t[9]=i*o*u-n*s,t[10]=o*o*u+l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function qd(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function jd(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jd(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Hc(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,p=n*l,f=n*u,y=i*l,m=i*u,h=o*u,d=a*s,g=a*l,b=a*u;return t[0]=1-(y+h),t[1]=p+b,t[2]=f-g,t[3]=0,t[4]=p-b,t[5]=1-(c+h),t[6]=m+d,t[7]=0,t[8]=f+g,t[9]=m-d,t[10]=1-(c+y),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Zd(t,e){var r=new Ge(3),n=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=n*n+i*i+o*o+a*a;return p>0?(r[0]=(s*a+c*n+l*o-u*i)*2/p,r[1]=(l*a+c*i+u*n-s*o)*2/p,r[2]=(u*a+c*o+s*i-l*n)*2/p):(r[0]=(s*a+c*n+l*o-u*i)*2,r[1]=(l*a+c*i+u*n-s*o)*2,r[2]=(u*a+c*o+s*i-l*n)*2),Hc(t,e,r),t}function Wd(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Xc(t,e){var r=e[0],n=e[1],i=e[2],o=e[4],a=e[5],s=e[6],l=e[8],u=e[9],c=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(l,u,c),t}function Hd(t,e){var r=new Ge(3);Xc(r,e);var n=1/r[0],i=1/r[1],o=1/r[2],a=e[0]*n,s=e[1]*i,l=e[2]*o,u=e[4]*n,c=e[5]*i,p=e[6]*o,f=e[8]*n,y=e[9]*i,m=e[10]*o,h=a+c+m,d=0;return h>0?(d=Math.sqrt(h+1)*2,t[3]=.25*d,t[0]=(p-y)/d,t[1]=(f-l)/d,t[2]=(s-u)/d):a>c&&a>m?(d=Math.sqrt(1+a-c-m)*2,t[3]=(p-y)/d,t[0]=.25*d,t[1]=(s+u)/d,t[2]=(f+l)/d):c>m?(d=Math.sqrt(1+c-a-m)*2,t[3]=(f-l)/d,t[0]=(s+u)/d,t[1]=.25*d,t[2]=(p+y)/d):(d=Math.sqrt(1+m-a-c)*2,t[3]=(s-u)/d,t[0]=(f+l)/d,t[1]=(p+y)/d,t[2]=.25*d),t}function Xd(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,p=i*l,f=i*u,y=i*c,m=o*u,h=o*c,d=a*c,g=s*l,b=s*u,x=s*c,v=n[0],P=n[1],w=n[2];return t[0]=(1-(m+d))*v,t[1]=(f+x)*v,t[2]=(y-b)*v,t[3]=0,t[4]=(f-x)*P,t[5]=(1-(p+d))*P,t[6]=(h+g)*P,t[7]=0,t[8]=(y+b)*w,t[9]=(h-g)*w,t[10]=(1-(p+m))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Kd(t,e,r,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,p=s+s,f=o*u,y=o*c,m=o*p,h=a*c,d=a*p,g=s*p,b=l*u,x=l*c,v=l*p,P=n[0],w=n[1],T=n[2],F=i[0],E=i[1],_=i[2],I=(1-(h+g))*P,k=(y+v)*P,V=(m-x)*P,A=(y-v)*w,z=(1-(f+g))*w,O=(d+b)*w,N=(m+x)*T,K=(d-b)*T,xe=(1-(f+h))*T;return t[0]=I,t[1]=k,t[2]=V,t[3]=0,t[4]=A,t[5]=z,t[6]=O,t[7]=0,t[8]=N,t[9]=K,t[10]=xe,t[11]=0,t[12]=r[0]+F-(I*F+A*E+N*_),t[13]=r[1]+E-(k*F+z*E+K*_),t[14]=r[2]+_-(V*F+O*E+xe*_),t[15]=1,t}function Yd(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,p=n*s,f=i*a,y=i*s,m=i*l,h=o*a,d=o*s,g=o*l;return t[0]=1-p-m,t[1]=c+g,t[2]=f-d,t[3]=0,t[4]=c-g,t[5]=1-u-m,t[6]=y+h,t[7]=0,t[8]=f+d,t[9]=y-h,t[10]=1-u-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Qd(t,e,r,n,i,o,a){var s=1/(r-e),l=1/(i-n),u=1/(o-a);return t[0]=o*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t}function Kc(t,e,r,n,i){var o=1/Math.tan(e/2),a;return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(a=1/(n-i),t[10]=(i+n)*a,t[14]=2*i*n*a):(t[10]=-1,t[14]=-2*n),t}var eg=Kc;function tg(t,e,r,n,i){var o=1/Math.tan(e/2),a;return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(a=1/(n-i),t[10]=i*a,t[14]=i*n*a):(t[10]=-1,t[14]=-n),t}function rg(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function Yc(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(a+o)*u,t[15]=1,t}var ng=Yc;function ig(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=o*u,t[15]=1,t}function og(t,e,r,n){var i,o,a,s,l,u,c,p,f,y,m=e[0],h=e[1],d=e[2],g=n[0],b=n[1],x=n[2],v=r[0],P=r[1],w=r[2];return Math.abs(m-v)<Q&&Math.abs(h-P)<Q&&Math.abs(d-w)<Q?Zc(t):(c=m-v,p=h-P,f=d-w,y=1/Math.hypot(c,p,f),c*=y,p*=y,f*=y,i=b*f-x*p,o=x*c-g*f,a=g*p-b*c,y=Math.hypot(i,o,a),y?(y=1/y,i*=y,o*=y,a*=y):(i=0,o=0,a=0),s=p*a-f*o,l=f*i-c*a,u=c*o-p*i,y=Math.hypot(s,l,u),y?(y=1/y,s*=y,l*=y,u*=y):(s=0,l=0,u=0),t[0]=i,t[1]=s,t[2]=c,t[3]=0,t[4]=o,t[5]=l,t[6]=p,t[7]=0,t[8]=a,t[9]=u,t[10]=f,t[11]=0,t[12]=-(i*m+o*h+a*d),t[13]=-(s*m+l*h+u*d),t[14]=-(c*m+p*h+f*d),t[15]=1,t)}function ag(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=n[2],c=i-r[0],p=o-r[1],f=a-r[2],y=c*c+p*p+f*f;y>0&&(y=1/Math.sqrt(y),c*=y,p*=y,f*=y);var m=l*f-u*p,h=u*c-s*f,d=s*p-l*c;return y=m*m+h*h+d*d,y>0&&(y=1/Math.sqrt(y),m*=y,h*=y,d*=y),t[0]=m,t[1]=h,t[2]=d,t[3]=0,t[4]=p*d-f*h,t[5]=f*m-c*d,t[6]=c*h-p*m,t[7]=0,t[8]=c,t[9]=p,t[10]=f,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t}function sg(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function lg(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function ug(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[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function Qc(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[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function cg(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[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function pg(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[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function fg(t,e){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]}function yg(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],h=t[13],d=t[14],g=t[15],b=e[0],x=e[1],v=e[2],P=e[3],w=e[4],T=e[5],F=e[6],E=e[7],_=e[8],I=e[9],k=e[10],V=e[11],A=e[12],z=e[13],O=e[14],N=e[15];return Math.abs(r-b)<=Q*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(n-x)<=Q*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-v)<=Q*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-P)<=Q*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-w)<=Q*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-T)<=Q*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-F)<=Q*Math.max(1,Math.abs(l),Math.abs(F))&&Math.abs(u-E)<=Q*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-_)<=Q*Math.max(1,Math.abs(c),Math.abs(_))&&Math.abs(p-I)<=Q*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(f-k)<=Q*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(y-V)<=Q*Math.max(1,Math.abs(y),Math.abs(V))&&Math.abs(m-A)<=Q*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-z)<=Q*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(d-O)<=Q*Math.max(1,Math.abs(d),Math.abs(O))&&Math.abs(g-N)<=Q*Math.max(1,Math.abs(g),Math.abs(N))}var mg=Wc,hg=Qc;var Qt={};Ol(Qt,{add:()=>vg,ceil:()=>Pg,clone:()=>dg,copy:()=>xg,create:()=>ep,cross:()=>Fg,dist:()=>qg,distance:()=>ip,div:()=>Gg,divide:()=>np,dot:()=>Eg,equals:()=>Ng,exactEquals:()=>Og,floor:()=>Sg,forEach:()=>Wg,fromValues:()=>gg,inverse:()=>kg,len:()=>Jg,length:()=>ap,lerp:()=>Lg,max:()=>Ag,min:()=>wg,mul:()=>$g,multiply:()=>rp,negate:()=>Cg,normalize:()=>Mg,random:()=>Dg,round:()=>_g,scale:()=>Ig,scaleAndAdd:()=>Tg,set:()=>bg,sqrDist:()=>jg,sqrLen:()=>Zg,squaredDistance:()=>op,squaredLength:()=>sp,str:()=>Rg,sub:()=>Ug,subtract:()=>tp,transformMat4:()=>Vg,transformQuat:()=>Bg,zero:()=>zg});function ep(){var t=new Ge(4);return Ge!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function dg(t){var e=new Ge(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function gg(t,e,r,n){var i=new Ge(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function xg(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function bg(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function vg(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 tp(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 rp(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 np(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 Pg(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 Sg(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 wg(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 Ag(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 _g(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 Ig(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 Tg(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 ip(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 op(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 ap(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function sp(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function Cg(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function kg(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 Mg(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 Eg(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Fg(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 Lg(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 Dg(t,e){e=e||1;var r,n,i,o,a,s;do r=jn()*2-1,n=jn()*2-1,a=r*r+n*n;while(a>=1);do i=jn()*2-1,o=jn()*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 Vg(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 Bg(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 zg(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Rg(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Og(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Ng(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)<=Q*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Q*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Q*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Q*Math.max(1,Math.abs(o),Math.abs(u))}var Ug=tp,$g=rp,Gg=np,qg=ip,jg=op,Jg=ap,Zg=sp,Wg=function(){var t=ep();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}}();var lp=Z(he(),1),Uo=class extends se{constructor(e){super(e,jc)}createBucket(e){return new Kt(e)}queryRadius(e){let r=e;return Yt("circle-radius",this,r)+Yt("circle-stroke-width",this,r)+_t(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=It(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,s),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:Hg(u,l),h=y?f*s:f;for(let d of i)for(let g of d){let b=y?g:up(g,l),x=h,v=Qt.transformMat4([],[g.x,g.y,0,1],l);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?x*=v[3]/a.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(x*=a.cameraToCenterDistance/v[3]),Oc(m,b,x))return!0}return!1}};function up(t,e){let r=Qt.transformMat4([],[t.x,t.y,0,1],e);return new lp.default(r[0]/r[3],r[1]/r[3])}function Hg(t,e){return t.map(r=>up(r,e))}var Zn=class extends Kt{};C("HeatmapBucket",Zn,{omit:["layers"]});var cp,Xg=()=>cp=cp||new re({"heatmap-radius":new R(S.paint_heatmap["heatmap-radius"]),"heatmap-weight":new R(S.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new B(S.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Zt(S.paint_heatmap["heatmap-color"]),"heatmap-opacity":new B(S.paint_heatmap["heatmap-opacity"])}),pp={get paint(){return Xg()}};function Bs(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: ".concat(i.length," but got: ").concat(e*r*n));return t.width=e,t.height=r,t.data=i,t}function fp(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=Bs({},{width:e,height:r},n);zs(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 zs(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 er=class t{constructor(e,r){Bs(this,e,1,r)}resize(e){fp(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){zs(e,r,n,i,o,1)}},de=class t{constructor(e,r){Bs(this,e,4,r)}resize(e){fp(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){zs(e,r,n,i,o,4)}};C("AlphaImage",er);C("RGBAImage",de);function yp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new de({width:r,height:n});if(!Xl(r))throw new Error("width is not a power of 2 - ".concat(r));let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.data[a+s+0]=Math.floor(u.r*255/u.a),i.data[a+s+1]=Math.floor(u.g*255/u.a),i.data[a+s+2]=Math.floor(u.b*255/u.a),i.data[a+s+3]=Math.floor(u.a*255)};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 $o=class extends se{createBucket(e){return new Zn(e)}constructor(e){super(e,pp),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=yp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var mp,Kg=()=>mp=mp||new re({"hillshade-illumination-direction":new B(S.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new B(S.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new B(S.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new B(S.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new B(S.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new B(S.paint_hillshade["hillshade-accent-color"])}),hp={get paint(){return Kg()}};var Go=class extends se{constructor(e){super(e,hp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Yg=Y([{name:"a_pos",components:2,type:"Int16"}],4);var{members:dp,size:GP,alignment:qP}=Yg;var Sp=Z($s(),1);function Gs(t,e,r,n,i){Pp(t,e,r||0,n||t.length-1,i||mx)}function Pp(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(e-a*l/o+u)),p=Math.min(n,Math.floor(e+(o-a)*l/o+u));Pp(t,e,c,p,i)}var f=t[e],y=r,m=n;for(Kn(t,r,e),i(t[n],f)>0&&Kn(t,r,n);y<m;){for(Kn(t,y,m),y++,m--;i(t[y],f)<0;)y++;for(;i(t[m],f)>0;)m--}i(t[r],f)===0?Kn(t,r,m):(m++,Kn(t,m,n)),m<=e&&(r=m+1),e<=m&&(n=m-1)}}function Kn(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function mx(t,e){return t<e?-1:t>e?1:0}function Tr(t,e){let r=t.length;if(r<=1)return[t];let n=[],i,o;for(let a=0;a<r;a++){let s=Ql(t[a]);s!==0&&(t[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[t[a]]):i.push(t[a]))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(Gs(n[a],e,1,n[a].length-1,hx),n[a]=n[a].slice(0,e));return n}function hx(t,e){return e.area-t.area}function Cr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get("".concat(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 kr(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get("".concat(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 dx=500,rr=class{constructor(e){this.zoom=e.zoom,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 _o,this.indexArray=new Le,this.indexArray2=new wt,this.programConfigurations=new Ce(e.layers,e.zoom),this.segments=new me,this.segments2=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Cr("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=$e(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),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:ke(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=kr("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});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)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dp),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){for(let a of Tr(r,dx)){let s=0;for(let y of a)s+=y.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let y of a){if(y.length===0)continue;y!==a[0]&&p.push(c.length/2);let m=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),h=m.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(h+y.length-1,h),c.push(y[0].x),c.push(y[0].y);for(let d=1;d<y.length;d++)this.layoutVertexArray.emplaceBack(y[d].x,y[d].y),this.indexArray2.emplaceBack(h+d-1,h+d),c.push(y[d].x),c.push(y[d].y);m.vertexLength+=y.length,m.primitiveLength+=y.length}let f=(0,Sp.default)(c,p);for(let y=0;y<f.length;y+=3)this.indexArray.emplaceBack(u+f[y],u+f[y+1],u+f[y+2]);l.vertexLength+=s,l.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};C("FillBucket",rr,{omit:["layers","patternFeatures"]});var wp,gx=()=>wp=wp||new re({"fill-sort-key":new R(S.layout_fill["fill-sort-key"])}),Ap,xx=()=>Ap=Ap||new re({"fill-antialias":new B(S.paint_fill["fill-antialias"]),"fill-opacity":new R(S.paint_fill["fill-opacity"]),"fill-color":new R(S.paint_fill["fill-color"]),"fill-outline-color":new R(S.paint_fill["fill-outline-color"]),"fill-translate":new B(S.paint_fill["fill-translate"]),"fill-translate-anchor":new B(S.paint_fill["fill-translate-anchor"]),"fill-pattern":new lt(S.paint_fill["fill-pattern"])}),_p={get paint(){return xx()},get layout(){return gx()}};var Wo=class extends se{constructor(e){super(e,_p)}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 rr(e)}queryRadius(){return _t(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=It(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s);return Oo(l,i)}isTileClipped(){return!0}};var bx=Y([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ip=Y([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Tp,size:IS,alignment:TS}=bx;var Lp=Z($s(),1),Dp=Z(Tt(),1);var Ex=Dp.default.VectorTileFeature.types,Fx=500,Js=Math.pow(2,13);function Yn(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*Js)*2+a,i*Js*2,o*Js*2,Math.round(s))}var nr=class{constructor(e){this.zoom=e.zoom,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 Io,this.centroidVertexArray=new wo,this.indexArray=new Le,this.programConfigurations=new Ce(e.layers,e.zoom),this.segments=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=Cr("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=$e(i,l);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:ke(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(kr("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{}),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)}}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,Tp),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ip.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){let a={x:0,y:0,vertexCount:0};for(let s of Tr(r,Fx)){let l=0;for(let m of s)l+=m.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let m of s){if(m.length===0||Dx(m))continue;let h=0;for(let d=0;d<m.length;d++){let g=m[d];if(d>=1){let b=m[d-1];if(!Lx(g,b)){u.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let x=g.sub(b)._perp()._unit(),v=b.dist(g);h+v>32768&&(h=0),Yn(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,0,h),Yn(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,1,h),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,h+=v,Yn(this.layoutVertexArray,b.x,b.y,x.x,x.y,0,0,h),Yn(this.layoutVertexArray,b.x,b.y,x.x,x.y,0,1,h),a.x+=2*b.x,a.y+=2*b.y,a.vertexCount+=2;let P=u.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),Ex[e.type]!=="Polygon")continue;let c=[],p=[],f=u.vertexLength;for(let m of s)if(m.length!==0){m!==s[0]&&p.push(c.length/2);for(let h=0;h<m.length;h++){let d=m[h];Yn(this.layoutVertexArray,d.x,d.y,0,0,1,1,0),a.x+=d.x,a.y+=d.y,a.vertexCount+=1,c.push(d.x),c.push(d.y)}}let y=(0,Lp.default)(c,p);for(let m=0;m<y.length;m+=3)this.indexArray.emplaceBack(f+y[m],f+y[m+2],f+y[m+1]);u.primitiveLength+=y.length/3,u.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};C("FillExtrusionBucket",nr,{omit:["layers","features"]});function Lx(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Dx(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 Vp,Vx=()=>Vp=Vp||new re({"fill-extrusion-opacity":new B(S["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new R(S["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new B(S["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new B(S["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new lt(S["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new R(S["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new R(S["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new B(S["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Bp={get paint(){return Vx()}};var Xo=Z(he(),1);var Ko=class extends se{constructor(e){super(e,Bp)}createBucket(e){return new nr(e)}queryRadius(){return _t(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=It(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(r,n),p=this.paint.get("fill-extrusion-base").evaluate(r,n),f=Rx(u,l,a,0),y=zx(i,p,c,l),m=y[0],h=y[1];return Bx(m,h,f)}};function Qn(t,e){return t.x*e.x+t.y*e.y}function zp(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=Qn(s,s),p=Qn(s,l),f=Qn(l,l),y=Qn(u,s),m=Qn(u,l),h=c*f-p*p,d=(f*y-p*m)/h,g=(c*m-p*y)/h,b=1-d-g,x=n.z*b+i.z*d+o.z*g;if(isFinite(x))return x}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function Bx(t,e,r){let n=1/0;Oo(r,e)&&(n=zp(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];Rc(r,f)&&(n=Math.min(n,zp(r,f)))}}return n===1/0?!1:n}function zx(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=[],d=[];for(let g of m){let b=g.x,x=g.y,v=n[0]*b+n[4]*x+n[12],P=n[1]*b+n[5]*x+n[13],w=n[2]*b+n[6]*x+n[14],T=n[3]*b+n[7]*x+n[15],F=v+a,E=P+s,_=w+l,I=T+u,k=v+c,V=P+p,A=w+f,z=T+y,O=new Xo.default(F/I,E/I);O.z=_/I,h.push(O);let N=new Xo.default(k/z,V/z);N.z=A/z,d.push(N)}i.push(h),o.push(d)}return[i,o]}function Rx(t,e,r,n){let i=[];for(let o of t){let a=[o.x,o.y,n,1];Qt.transformMat4(a,a,e),i.push(new Xo.default(a[0]/a[3],a[1]/a[3]))}return i}var Ox=Y([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Rp,size:uw,alignment:cw}=Ox;var Nx=Y([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Op,size:yw,alignment:mw}=Nx;var $p=Z(Tt(),1);var Ux=$p.default.VectorTileFeature.types,Np=63,$x=Math.cos(75/2*(Math.PI/180)),Gx=15,qx=20,jx=15,Gp=1/2,Up=Math.pow(2,jx-1)/Gp,ir=class{constructor(e){this.zoom=e.zoom,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 To,this.layoutVertexArray2=new Co,this.indexArray=new Le,this.programConfigurations=new Ce(e.layers,e.zoom),this.segments=new me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=Cr("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=$e(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),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:ke(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=kr("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});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)}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,Op)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rp),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){let a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),l=a.get("line-cap"),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let p of r)this.addLine(p,e,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let g=0;g<e.length-1;g++)this.totalDistance+=e[g].dist(e[g+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=Ux[r.type]==="Polygon",l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let u=0;for(;u<l-1&&e[u].equals(e[u+1]);)u++;if(l<(s?3:2))return;n==="bevel"&&(o=1.05);let c=this.overscaling<=16?Gx*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,y,m,h,d;this.e1=this.e2=-1,s&&(f=e[l-2],d=e[u].sub(f)._unit()._perp());for(let g=u;g<l;g++){if(m=g===l-1?s?e[u+1]:void 0:e[g+1],m&&e[g].equals(m))continue;d&&(h=d),f&&(y=f),f=e[g],d=m?m.sub(f)._unit()._perp():h,h=h||d;let b=h.add(d);(b.x!==0||b.y!==0)&&b._unit();let x=h.x*d.x+h.y*d.y,v=b.x*d.x+b.y*d.y,P=v!==0?1/v:1/0,w=2*Math.sqrt(2-2*v),T=v<$x&&y&&m,F=h.x*d.y-h.y*d.x>0;if(T&&g>u){let I=f.dist(y);if(I>2*c){let k=f.sub(f.sub(y)._mult(c/I)._round());this.updateDistance(y,k),this.addCurrentVertex(k,h,0,0,p),y=k}}let E=y&&m,_=E?n:s?"butt":i;if(E&&_==="round"&&(P<a?_="miter":P<=2&&(_="fakeround")),_==="miter"&&P>o&&(_="bevel"),_==="bevel"&&(P>2&&(_="flipbevel"),P<o&&(_="miter")),y&&this.updateDistance(y,f),_==="miter")b._mult(P),this.addCurrentVertex(f,b,0,0,p);else if(_==="flipbevel"){if(P>100)b=d.mult(-1);else{let I=P*h.add(d).mag()/h.sub(d).mag();b._perp()._mult(I*(F?-1:1))}this.addCurrentVertex(f,b,0,0,p),this.addCurrentVertex(f,b.mult(-1),0,0,p)}else if(_==="bevel"||_==="fakeround"){let I=-Math.sqrt(P*P-1),k=F?I:0,V=F?0:I;if(y&&this.addCurrentVertex(f,h,k,V,p),_==="fakeround"){let A=Math.round(w*180/Math.PI/qx);for(let z=1;z<A;z++){let O=z/A;if(O!==.5){let K=O-.5,xe=1.0904+x*(-3.2452+x*(3.55645-x*1.43519)),X=.848013+x*(-1.06021+x*.215638);O=O+O*K*(O-1)*(xe*K*K+X)}let N=d.sub(h)._mult(O)._add(h)._unit()._mult(F?-1:1);this.addHalfVertex(f,N.x,N.y,!1,F,0,p)}}m&&this.addCurrentVertex(f,d,-k,-V,p)}else if(_==="butt")this.addCurrentVertex(f,b,0,0,p);else if(_==="square"){let I=y?1:-1;this.addCurrentVertex(f,b,I,I,p)}else _==="round"&&(y&&(this.addCurrentVertex(f,h,0,0,p),this.addCurrentVertex(f,h,1,1,p,!0)),m&&(this.addCurrentVertex(f,d,-1,-1,p,!0),this.addCurrentVertex(f,d,0,0,p)));if(T&&g<l-1){let I=f.dist(m);if(I>2*c){let k=f.add(m.sub(f)._mult(c/I)._round());this.updateDistance(f,k),this.addCurrentVertex(k,d,0,0,p),f=k}}}}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>Up/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*(Up-1):this.scaledDistance)*Gp;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(Np*n)+128,Math.round(Np*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,this.e2,p),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()}};C("LineBucket",ir,{omit:["layers","patternFeatures"]});var qp,Jx=()=>qp=qp||new re({"line-cap":new B(S.layout_line["line-cap"]),"line-join":new R(S.layout_line["line-join"]),"line-miter-limit":new B(S.layout_line["line-miter-limit"]),"line-round-limit":new B(S.layout_line["line-round-limit"]),"line-sort-key":new R(S.layout_line["line-sort-key"])}),jp,Zx=()=>jp=jp||new re({"line-opacity":new R(S.paint_line["line-opacity"]),"line-color":new R(S.paint_line["line-color"]),"line-translate":new B(S.paint_line["line-translate"]),"line-translate-anchor":new B(S.paint_line["line-translate-anchor"]),"line-width":new R(S.paint_line["line-width"]),"line-gap-width":new R(S.paint_line["line-gap-width"]),"line-offset":new R(S.paint_line["line-offset"]),"line-blur":new R(S.paint_line["line-blur"]),"line-dasharray":new Jt(S.paint_line["line-dasharray"]),"line-pattern":new lt(S.paint_line["line-pattern"]),"line-gradient":new Zt(S.paint_line["line-gradient"])}),Zs={get paint(){return Zx()},get layout(){return Jx()}};var Ws=class extends R{possiblyEvaluate(e,r){return r=new q(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=Pe({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Yo,Qo=class extends se{constructor(e){super(e,Zs),this.gradientVersion=0,Yo||(Yo=new Ws(Zs.paint.properties["line-width"].specification),Yo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();qt(r)?this.stepInterpolant=r._styleExpression.expression instanceof yr: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"]=Yo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new ir(e)}queryRadius(e){let r=e,n=Jp(Yt("line-width",this,r),Yt("line-gap-width",this,r)),i=Yt("line-offset",this,r);return n/2+Math.abs(i)+_t(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=It(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*Jp(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),c=this.paint.get("line-offset").evaluate(r,n);return c&&(i=$c(i,c*s)),Nc(l,i,u)}isTileClipped(){return!0}};function Jp(t,e){return e>0?e+2*t:t}var Zp=Y([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Wp=Y([{name:"a_projected_pos",components:3,type:"Float32"}],4),Kw=Y([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Hp=Y([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Yw=Y([{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"}]),Hs=Y([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Qw=Y([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),e2=Y([{name:"triangle",components:3,type:"Uint16"}]),t2=Y([{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"}]),r2=Y([{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"}]),n2=Y([{type:"Float32",name:"offsetX"}]),i2=Y([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),o2=Y([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var oi=Z(he(),1);function Wx(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),ye.applyArabicShaping&&(t=ye.applyArabicShaping(t)),t}function Xp(t,e,r){return t.sections.forEach(n=>{n.text=Wx(n.text,e,r)}),t}function Kp(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"".concat(u,":").concat(f.x,":").concat(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),d=a(y,m,n[h].geometry);delete e[y],delete r[m],r[l(f,n[d].geometry,!0)]=d,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 Er={"!":"\\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 Yp(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||!As(n)||Er[t[r+1]])&&(!i||!As(i)||Er[t[r-1]])&&Er[t[r]]?e+=Er[t[r]]:e+=t[r]}return e}var ne=24;var fb=Z(ei(),1),yb=3;var ra=yb;function ti(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();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 ge=1;var na=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+ge,this.paddedRect.y+ge]}get br(){return[this.paddedRect.x+this.paddedRect.w-ge,this.paddedRect.y+this.paddedRect.h-ge]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-ge*2)/this.pixelRatio,(this.paddedRect.h-ge*2)/this.pixelRatio]}},ri=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}=ti(o),l=new de({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;de.copy(c.data,l,{x:0,y:0},{x:p.x+ge,y:p.y+ge},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+ge,y=p.y+ge,m=c.data.width,h=c.data.height;de.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),de.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),de.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),de.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),de.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*ge,h:o.data.height+2*ge};n.push(a),r[i]=new na(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})}};C("ImagePosition",na);C("ImageAtlas",ri);var aa=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(aa||{}),Dr=-17;function mb(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var af=57344,sf=63743,ia=class t{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){let n=new t;return n.scale=e||1,n.fontStack=r,n}static forImage(e){let r=new t;return r.imageName=e,r}},ni=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=Yp(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&oa[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&oa[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)}addTextSection(e,r){this.text+=e.text,this.sections.push(ia.forText(e.scale,e.fontStack||r));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){fe("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){fe("Reached maximum number of images ".concat(sf-af+2));return}this.text+=String.fromCharCode(n),this.sections.push(ia.forImage(r)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=sf?null:++this.imageSectionID:(this.imageSectionID=af,this.imageSectionID)}};function hb(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 ii(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h){let d=ni.fromFeature(t,i);p===2&&d.verticalizePunctuation();let g,{processBidirectionalText:b,processStyledBidirectionalText:x}=ye;if(b&&d.sections.length===1){g=[];let w=b(d.toString(),Ys(d,u,o,e,n,y,m));for(let T of w){let F=new ni;F.text=T,F.sections=d.sections;for(let E=0;E<T.length;E++)F.sectionIndex.push(0);g.push(F)}}else if(x){g=[];let w=x(d.text,d.sectionIndex,Ys(d,u,o,e,n,y,m));for(let T of w){let F=new ni;F.text=T[0],F.sectionIndex=T[1],F.sections=d.sections,g.push(F)}}else g=hb(d,Ys(d,u,o,e,n,y,m));let v=[],P={positionedLines:v,text:d.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return bb(P,e,r,n,g,a,s,l,p,u,f,h),mb(v)?!1:P}var oa={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},db={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function cf(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ne/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function gb(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=cf(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function lf(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 xb(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 uf(t,e,r,n,i,o){let a=null,s=lf(e,r,i,o);for(let l of n){let u=e-l.x,c=lf(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function pf(t){return t?pf(t.priorBreak).concat(t.index):[]}function Ys(t,e,r,n,i,o,a){if(o!=="point")return[];if(!t)return[];let s=[],l=gb(t,e,r,n,i,a),u=t.text.indexOf("\\u200B")>=0,c=0;for(let p=0;p<t.length();p++){let f=t.getSection(p),y=t.getCharCode(p);if(oa[y]||(c+=cf(y,f,n,i,e,a)),p<t.length()-1){let m=Sc(y);(db[y]||m||f.imageName)&&s.push(uf(p+1,c,l,s,xb(y,t.getCharCode(p+1),m&&u),!1))}}return pf(uf(t.length(),c,l,s,0,!0))}function ff(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 bb(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=Dr,m=0,h=0,d=s==="right"?1:s==="left"?0:.5,g=0;for(let P of i){P.trim();let w=P.getMaxScale(),T=(w-1)*ne,F={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=F;let E=F.positionedGlyphs,_=0;if(!P.length()){y+=o,++g;continue}for(let k=0;k<P.length();k++){let V=P.getSection(k),A=P.getSectionIndex(k),z=P.getCharCode(k),O=0,N=null,K=null,xe=null,X=ne,le=!(l===1||!c&&!lo(z)||c&&(oa[z]||wc(z)));if(V.imageName){let ce=n[V.imageName];if(!ce)continue;xe=V.imageName,t.iconsInText=t.iconsInText||!0,K=ce.paddedRect;let pe=ce.displaySize;V.scale=V.scale*ne/p,N={width:pe[0],height:pe[1],left:ge,top:-ra,advance:le?pe[1]:pe[0]};let _e=ne-pe[1]*V.scale;O=T+_e,X=N.advance;let be=le?pe[0]*V.scale-ne*w:pe[1]*V.scale-ne*w;be>0&&be>_&&(_=be)}else{let ce=r[V.fontStack],pe=ce&&ce[z];if(pe&&pe.rect)K=pe.rect,N=pe.metrics;else{let _e=e[V.fontStack],be=_e&&_e[z];if(!be)continue;N=be.metrics}O=(w-V.scale)*ne}le?(t.verticalizable=!0,E.push({glyph:z,imageName:xe,x:f,y:y+O,vertical:le,scale:V.scale,fontStack:V.fontStack,sectionIndex:A,metrics:N,rect:K}),f+=X*V.scale+u):(E.push({glyph:z,imageName:xe,x:f,y:y+O,vertical:le,scale:V.scale,fontStack:V.fontStack,sectionIndex:A,metrics:N,rect:K}),f+=N.advance*V.scale+u)}if(E.length!==0){let k=f-u;m=Math.max(k,m),vb(E,0,E.length-1,d,_)}f=0;let I=o*w+_;F.lineOffset=Math.max(_,T),y+=I,h=Math.max(I,h),++g}let b=y-Dr,{horizontalAlign:x,verticalAlign:v}=ff(a);Pb(t.positionedLines,d,x,v,m,h,o,b,i.length),t.top+=-v*b,t.bottom=t.top+b,t.left+=-x*m,t.right=t.left+m}function vb(t,e,r,n,i){if(!n&&!i)return;let o=t[r],a=o.metrics.advance*o.scale,s=(t[r].x+a)*n;for(let l=e;l<=r;l++)t[l].x-=s,t[l].y+=i}function Pb(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-Dr:c=(-n*l+.5)*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function yf(t,e,r){let{horizontalAlign:n,verticalAlign:i}=ff(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 Qs(t,e,r,n,i,o){let a=t.image,s;if(a.content){let d=a.content,g=a.pixelRatio||1;s=[d[0]/g,d[1]/g,a.displaySize[0]-d[2]/g,a.displaySize[1]-d[3]/g]}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=Z(Tt(),1);var Vr=255,Ct=128,tt=Vr*Ct;function el(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new q(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 q(s)),c=r.evaluate(new q(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 Sb=mf.default.VectorTileFeature.types,wb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function sa(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(tt,Math.round(s[0])):0,m=s?Math.min(tt,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 hf(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 Ab(t){for(let e of t.sections)if(_c(e.text))return!0;return!1}var ai=class{constructor(e){this.layoutVertexArray=new ko,this.indexArray=new Le,this.programConfigurations=e,this.segments=new me,this.dynamicLayoutVertexArray=new Mo,this.opacityVertexArray=new Eo,this.hasVisibleVertices=!1,this.placedSymbolArray=new Dn}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,Zp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Wp.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,wb,!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())}};C("SymbolBuffers",ai);var si=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new me,this.collisionVertexArray=new Fo}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Hp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};C("CollisionBuffers",si);var He=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,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=[],this.placementInvProjMatrix=Jn.identity([]),this.placementViewportMatrix=Jn.identity([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=el(this.zoom,n["text-size"]),this.iconSizeData=el(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=>aa[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new ai(new Ce(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new ai(new Ce(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Bn,this.lineVertexArray=new zn,this.symbolInstances=new Vn,this.textAnchorOffsets=new Rn}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=Er[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 Fe&&!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 q(this.zoom);for(let{feature:d,id:g,index:b,sourceLayerIndex:x}of e){let v=i._featureFilter.needGeometry,P=$e(d,v);if(!i._featureFilter.filter(h,P,n))continue;v||(P.geometry=ke(d));let w;if(u){let _=i.getValueAndResolveTokens("text-field",P,n,m),I=Fe.factory(_),k=this.hasRTLText=this.hasRTLText||Ab(I);(!k||ye.getRTLTextPluginStatus()==="unavailable"||k&&ye.isParsed())&&(w=Xp(I,i,P))}let T;if(c){let _=i.getValueAndResolveTokens("icon-image",P,n,m);_ instanceof Te?T=_:T=Te.fromString(_)}if(!w&&!T)continue;let F=this.sortFeaturesByKey?p.evaluate(P,{},n):void 0,E={id:g,text:w,icon:T,index:b,sourceLayerIndex:x,geometry:P.geometry,properties:d.properties,type:Sb[d.type],sortKey:F};if(this.features.push(E),T&&(f[T.name]=!0),w){let _=a.evaluate(P,{},n).join(","),I=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let k of w.sections)if(k.image)f[k.image.name]=!0;else{let V=hn(w.toString()),A=k.fontStack||_,z=y[A]=y[A]||{};this.calculateGlyphDependencies(k.text,z,I,this.allowVerticalPlacement,V)}}}o.get("symbol-placement")==="line"&&(this.features=Kp(this.features)),this.sortFeaturesByKey&&this.features.sort((d,g)=>d.sortKey-g.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),d=this.glyphOffsetArray.length,g=h.vertexLength,b=this.allowVerticalPlacement&&s===2?Math.PI/2:0,x=a.text&&a.text.sections;for(let v=0;v<r.length;v++){let{tl:P,tr:w,bl:T,br:F,tex:E,pixelOffsetTL:_,pixelOffsetBR:I,minFontScaleX:k,minFontScaleY:V,glyphOffset:A,isSDF:z,sectionIndex:O}=r[v],N=h.vertexLength,K=A[1];sa(m,l.x,l.y,P.x,K+P.y,E.x,E.y,n,z,_.x,_.y,k,V),sa(m,l.x,l.y,w.x,K+w.y,E.x+E.w,E.y,n,z,I.x,_.y,k,V),sa(m,l.x,l.y,T.x,K+T.y,E.x,E.y+E.h,n,z,_.x,I.y,k,V),sa(m,l.x,l.y,F.x,K+F.y,E.x+E.w,E.y+E.h,n,z,I.x,I.y,k,V),hf(e.dynamicLayoutVertexArray,l,b),y.emplaceBack(N,N+1,N+2),y.emplaceBack(N+1,N+2,N+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),(v===r.length-1||O!==r[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,x&&x[O])}e.placedSymbolArray.emplaceBack(l.x,l.y,d,this.glyphOffsetArray.length-d,g,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 oi.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new oi.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new oi.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new oi.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(Nn,Hs.members,wt),this.iconCollisionBox=new si(Nn,Hs.members,wt);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+1,o+2),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)}}};C("SymbolBucket",He,{omit:["layers","collisionBoxArray","features","compareText"]});He.MAX_GLYPHS=65535;He.addDynamicAttributes=hf;function df(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var gf,_b=()=>gf=gf||new re({"symbol-placement":new B(S.layout_symbol["symbol-placement"]),"symbol-spacing":new B(S.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new B(S.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new R(S.layout_symbol["symbol-sort-key"]),"symbol-z-order":new B(S.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new B(S.layout_symbol["icon-allow-overlap"]),"icon-overlap":new B(S.layout_symbol["icon-overlap"]),"icon-ignore-placement":new B(S.layout_symbol["icon-ignore-placement"]),"icon-optional":new B(S.layout_symbol["icon-optional"]),"icon-rotation-alignment":new B(S.layout_symbol["icon-rotation-alignment"]),"icon-size":new R(S.layout_symbol["icon-size"]),"icon-text-fit":new B(S.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new B(S.layout_symbol["icon-text-fit-padding"]),"icon-image":new R(S.layout_symbol["icon-image"]),"icon-rotate":new R(S.layout_symbol["icon-rotate"]),"icon-padding":new R(S.layout_symbol["icon-padding"]),"icon-keep-upright":new B(S.layout_symbol["icon-keep-upright"]),"icon-offset":new R(S.layout_symbol["icon-offset"]),"icon-anchor":new R(S.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new B(S.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new B(S.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new B(S.layout_symbol["text-rotation-alignment"]),"text-field":new R(S.layout_symbol["text-field"]),"text-font":new R(S.layout_symbol["text-font"]),"text-size":new R(S.layout_symbol["text-size"]),"text-max-width":new R(S.layout_symbol["text-max-width"]),"text-line-height":new B(S.layout_symbol["text-line-height"]),"text-letter-spacing":new R(S.layout_symbol["text-letter-spacing"]),"text-justify":new R(S.layout_symbol["text-justify"]),"text-radial-offset":new R(S.layout_symbol["text-radial-offset"]),"text-variable-anchor":new B(S.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new R(S.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new R(S.layout_symbol["text-anchor"]),"text-max-angle":new B(S.layout_symbol["text-max-angle"]),"text-writing-mode":new B(S.layout_symbol["text-writing-mode"]),"text-rotate":new R(S.layout_symbol["text-rotate"]),"text-padding":new B(S.layout_symbol["text-padding"]),"text-keep-upright":new B(S.layout_symbol["text-keep-upright"]),"text-transform":new R(S.layout_symbol["text-transform"]),"text-offset":new R(S.layout_symbol["text-offset"]),"text-allow-overlap":new B(S.layout_symbol["text-allow-overlap"]),"text-overlap":new B(S.layout_symbol["text-overlap"]),"text-ignore-placement":new B(S.layout_symbol["text-ignore-placement"]),"text-optional":new B(S.layout_symbol["text-optional"])}),xf,Ib=()=>xf=xf||new re({"icon-opacity":new R(S.paint_symbol["icon-opacity"]),"icon-color":new R(S.paint_symbol["icon-color"]),"icon-halo-color":new R(S.paint_symbol["icon-halo-color"]),"icon-halo-width":new R(S.paint_symbol["icon-halo-width"]),"icon-halo-blur":new R(S.paint_symbol["icon-halo-blur"]),"icon-translate":new B(S.paint_symbol["icon-translate"]),"icon-translate-anchor":new B(S.paint_symbol["icon-translate-anchor"]),"text-opacity":new R(S.paint_symbol["text-opacity"]),"text-color":new R(S.paint_symbol["text-color"],{runtimeType:Re,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new R(S.paint_symbol["text-halo-color"]),"text-halo-width":new R(S.paint_symbol["text-halo-width"]),"text-halo-blur":new R(S.paint_symbol["text-halo-blur"]),"text-translate":new B(S.paint_symbol["text-translate"]),"text-translate-anchor":new B(S.paint_symbol["text-translate-anchor"])}),la={get paint(){return Ib()},get layout(){return _b()}};var li=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:hr,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}};C("FormatSectionOverride",li,{omit:["defaultValue"]});var ua=class t extends se{constructor(e){super(e,la)}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()&&!qt(a.value)&&o?df(r.properties,o):o}createBucket(e){return new He(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of la.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new li(r),i=new Nt(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new dt("source",i):o=new gt("composite",i,r.value.zoomStops),this.paint._values[e]=new Se(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=la.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 Fe)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof mt&&ue(u.value)===dr){let c=u.value;a(c.sections)}else u instanceof tn?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 vf,Tb=()=>vf=vf||new re({"background-color":new B(S.paint_background["background-color"]),"background-pattern":new Jt(S.paint_background["background-pattern"]),"background-opacity":new B(S.paint_background["background-opacity"])}),Pf={get paint(){return Tb()}};var ca=class extends se{constructor(e){super(e,Pf)}};var Sf,Cb=()=>Sf=Sf||new re({"raster-opacity":new B(S.paint_raster["raster-opacity"]),"raster-hue-rotate":new B(S.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new B(S.paint_raster["raster-brightness-min"]),"raster-brightness-max":new B(S.paint_raster["raster-brightness-max"]),"raster-saturation":new B(S.paint_raster["raster-saturation"]),"raster-contrast":new B(S.paint_raster["raster-contrast"]),"raster-resampling":new B(S.paint_raster["raster-resampling"]),"raster-fade-duration":new B(S.paint_raster["raster-fade-duration"])}),wf={get paint(){return Cb()}};var pa=class extends se{constructor(e){super(e,wf)}};var fa=class extends se{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 Af(t){if(t.type==="custom")return new fa(t);switch(t.type){case"background":return new ca(t);case"circle":return new Uo(t);case"fill":return new Wo(t);case"fill-extrusion":return new Ko(t);case"heatmap":return new $o(t);case"hillshade":return new Go(t);case"line":return new Qo(t);case"raster":return new pa(t);case"symbol":return new ua(t)}}var ya=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]=Af(i);o._featureFilter=yn(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=qu(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 Hf=Z(Tt(),1),Xf=Z(ei(),1);var Br=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=".concat(e," can\'t be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}};var Tf=Z(Tt(),1),Cf=Z(ei(),1);var ma=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 ui=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 Vt(8192,16,0),this.grid3D=new Vt(8192,16,0),this.featureIndexArray=new On,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 Tf.default.VectorTile(new Cf.default(this.rawTileData)).layers,this.sourceLayerCoder=new Br(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=yn(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=If(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=If(e.cameraQueryGeometry),y=this.grid3D.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u,(d,g,b,x)=>Uc(e.cameraQueryGeometry,d-u,g-u,b+u,x+u));for(let d of y)p.push(d);p.sort(kb);let m={},h;for(let d=0;d<p.length;d++){let g=p[d];if(g===h)continue;h=g;let b=this.featureIndexArray.get(g),x=null;this.loadMatchingFeature(m,b.bucketIndex,b.sourceLayerIndex,b.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,P,w)=>(x||(x=ke(v)),P.queryIntersectsFeature(l,v,w,x,this.z,e.transform,a,e.pixelPosMatrix)))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!Yl(a,f))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let g=$e(h,!0);if(!o.filter(new q(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!o.filter(new q(this.tileID.overscaledZ),h))return;let d=this.getId(h,y);for(let g=0;g<f.length;g++){let b=f[g];if(a&&a.indexOf(b)<0)continue;let x=l[b];if(!x)continue;let v={};d&&c&&(v=c.getState(x.sourceLayer||"_geojsonTileLayer",d));let P=Pe({},u[b]);P.paint=_f(P.paint,x.paint,h,v,s),P.layout=_f(P.layout,x.layout,h,v,s);let w=!p||p(h,x,v);if(!w)continue;let T=new ma(h,this.z,this.x,this.y,d);T.layer=P;let F=e[b];F===void 0&&(F=e[b]=[]),F.push({featureIndex:i,feature:T,intersectionZ:w})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=yn(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))}return n}};C("FeatureIndex",ui,{omit:["rawTileData","sourceLayerCoder"]});function _f(t,e,r,n,i){return jr(t,(o,a)=>{let s=e instanceof vt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function If(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return{minX:e,minY:r,maxX:n,maxY:i}}function kb(t,e){return e-t}var kf=Z(he(),1);var rt=class t extends kf.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)}};C("Anchor",rt);function rl(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 Mf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Ef(t,e,r){return t?3/5*e*r:0}function Ff(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Lf(t,e,r,n,i,o){let a=Ef(r,i,o),s=Ff(r,n)*o,l=0,u=Mf(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=Oe.number(p.x,f.x,m),d=Oe.number(p.y,f.y,m),g=new rt(h,d,f.angleTo(p),c);return g._round(),!a||rl(t,g,s,a,e)?g:void 0}l+=y}}function Df(t,e,r,n,i,o,a,s,l){let u=Ef(n,o,a),c=Ff(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 Vf(t,m,e,u,r,p,f,!1,l)}function Vf(t,e,r,n,i,o,a,s,l){let u=o/2,c=Mf(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let h=t[m],d=t[m+1],g=h.dist(d),b=d.angleTo(h);for(;f+r<p+g;){f+=r;let x=(f-p)/g,v=Oe.number(h.x,d.x,x),P=Oe.number(h.y,d.y,x);if(v>=0&&v<l&&P>=0&&P<l&&f-u>=0&&f+u<=c){let w=new rt(v,P,b,m);w._round(),(!n||rl(t,w,o,n,i))&&y.push(w)}}p+=g}return!s&&!y.length&&!a&&(y=Vf(t,p/2,r,n,i,o,a,!0,l)),y}var pt=Z(he(),1);function Bf(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 pt.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new pt.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 pt.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new pt.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 pt.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new pt.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 pt.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new pt.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 we=Z(he(),1);var zr=ge;function nl(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*zr,l=o.paddedRect.h-2*zr,u=t.right-t.left,c=t.bottom-t.top,p=o.stretchX||[[0,s]],f=o.stretchY||[[0,l]],y=(I,k)=>I+k[1]-k[0],m=p.reduce(y,0),h=f.reduce(y,0),d=s-m,g=l-h,b=0,x=m,v=0,P=h,w=0,T=d,F=0,E=g;if(o.content&&n){let I=o.content;b=ha(p,0,I[0]),v=ha(f,0,I[1]),x=ha(p,I[0],I[2]),P=ha(f,I[1],I[3]),w=I[0]-b,F=I[1]-v,T=I[2]-I[0]-x,E=I[3]-I[1]-P}let _=(I,k,V,A)=>{let z=da(I.stretch-b,x,u,t.left),O=ga(I.fixed-w,T,I.stretch,m),N=da(k.stretch-v,P,c,t.top),K=ga(k.fixed-F,E,k.stretch,h),xe=da(V.stretch-b,x,u,t.left),X=ga(V.fixed-w,T,V.stretch,m),le=da(A.stretch-v,P,c,t.top),ce=ga(A.fixed-F,E,A.stretch,h),pe=new we.default(z,N),_e=new we.default(xe,N),be=new we.default(xe,le),Ai=new we.default(z,le),Da=new we.default(O/a,K/a),Va=new we.default(X/a,ce/a),Ur=e*Math.PI/180;if(Ur){let Ie=Math.sin(Ur),ve=Math.cos(Ur),Ve=[ve,-Ie,Ie,ve];pe._matMult(Ve),_e._matMult(Ve),Ai._matMult(Ve),be._matMult(Ve)}let _i=I.stretch+I.fixed,Me=V.stretch+V.fixed,Ft=k.stretch+k.fixed,Ii=A.stretch+A.fixed,Ba={x:o.paddedRect.x+zr+_i,y:o.paddedRect.y+zr+Ft,w:Me-_i,h:Ii-Ft},za=T/a/u,Ra=E/a/c;return{tl:pe,tr:_e,bl:Ai,br:be,tex:Ba,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Da,pixelOffsetBR:Va,minFontScaleX:za,minFontScaleY:Ra,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(_({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let I=zf(p,d,m),k=zf(f,g,h);for(let V=0;V<I.length-1;V++){let A=I[V],z=I[V+1];for(let O=0;O<k.length-1;O++){let N=k[O],K=k[O+1];i.push(_(A,N,z,K))}}}return i}function ha(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 zf(t,e,r){let n=[{fixed:-zr,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+zr,stretch:r}),n}function da(t,e,r,n){return t/e*r+n}function ga(t,e,r,n){return t-e*r/n}function Rf(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=ra+1,h=!0,d=1,g=0,b=(i||s)&&p.vertical,x=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let X=(p.scale-1)*ne,le=(ne-p.metrics.width*p.scale)/2;g=c.lineOffset/2-(p.imageName?-le:X)}if(p.imageName){let X=a[p.imageName];h=X.sdf,d=X.pixelRatio,m=ge/d}let v=i?[p.x+x,p.y]:[0,0],P=i?[0,0]:[p.x+x+r[0],p.y+r[1]-g],w=[0,0];b&&(w=P,P=[0,0]);let T=p.metrics.isDoubleResolution?2:1,F=(p.metrics.left-m)*p.scale-x+P[0],E=(-p.metrics.top-m)*p.scale+P[1],_=F+f.w/T*p.scale/d,I=E+f.h/T*p.scale/d,k=new we.default(F,E),V=new we.default(_,E),A=new we.default(F,I),z=new we.default(_,I);if(b){let X=new we.default(-x,x-Dr),le=-Math.PI/2,ce=ne/2-x,pe=p.imageName?ce:0,_e=new we.default(5-Dr-ce,-pe),be=new we.default(...w);k._rotateAround(le,X)._add(_e)._add(be),V._rotateAround(le,X)._add(_e)._add(be),A._rotateAround(le,X)._add(_e)._add(be),z._rotateAround(le,X)._add(_e)._add(be)}if(l){let X=Math.sin(l),le=Math.cos(l),ce=[le,-X,X,le];k._matMult(ce),V._matMult(ce),A._matMult(ce),z._matMult(ce)}let O=new we.default(0,0),N=new we.default(0,0);u.push({tl:k,tr:V,bl:A,br:z,tex:f,writingMode:e.writingMode,glyphOffset:v,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:O,pixelOffsetBR:N,minFontScaleX:0,minFontScaleY:0})}return u}var ci=Z(he(),1),or=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.top*s-l[0],f=a.bottom*s+l[2],y=a.left*s-l[3],m=a.right*s+l[1],h=a.collisionPadding;if(h&&(y-=h[0]*s,p-=h[1]*s,m+=h[2]*s,f+=h[3]*s),c){let d=new ci.default(y,p),g=new ci.default(m,p),b=new ci.default(y,f),x=new ci.default(m,f),v=c*Math.PI/180;d._rotate(v),g._rotate(v),b._rotate(v),x._rotate(v),y=Math.min(d.x,g.x,b.x,x.x),m=Math.max(d.x,g.x,b.x,x.x),p=Math.min(d.y,g.y,b.y,x.y),f=Math.max(d.y,g.y,b.y,x.y)}e.emplaceBack(r.x,r.y,y,p,m,f,n,i,o)}this.boxEndIndex=e.length}};var pi=class{constructor(e=[],r=Mb){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.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return this.length--,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=r[a],l=a+1;if(l<this.length&&n(r[l],s)<0&&(a=l,s=r[l]),n(s,o)>=0)break;r[e]=s,e=a}r[e]=o}};function Mb(t,e){return t<e?-1:t>e?1:0}var il=Z(he(),1);function Of(t,e=1,r=!1){let n=1/0,i=1/0,o=-1/0,a=-1/0,s=t[0];for(let h=0;h<s.length;h++){let d=s[h];(!h||d.x<n)&&(n=d.x),(!h||d.y<i)&&(i=d.y),(!h||d.x>o)&&(o=d.x),(!h||d.y>a)&&(a=d.y)}let l=o-n,u=a-i,c=Math.min(l,u),p=c/2,f=new pi([],Eb);if(c===0)return new il.default(n,i);for(let h=n;h<o;h+=c)for(let d=i;d<a;d+=c)f.push(new Rr(h+p,d+p,p,t));let y=Lb(t),m=f.length;for(;f.length;){let h=f.pop();(h.d>y.d||!y.d)&&(y=h,r&&console.log("found best %d after %d probes",Math.round(1e4*h.d)/1e4,m)),!(h.max-y.d<=e)&&(p=h.h/2,f.push(new Rr(h.p.x-p,h.p.y-p,p,t)),f.push(new Rr(h.p.x+p,h.p.y-p,p,t)),f.push(new Rr(h.p.x-p,h.p.y+p,p,t)),f.push(new Rr(h.p.x+p,h.p.y+p,p,t)),m+=4)}return r&&(console.log("num probes: ".concat(m)),console.log("best distance: ".concat(y.d))),y.p}function Eb(t,e){return e.max-t.max}function Rr(t,e,r,n){this.p=new il.default(t,e),this.h=r,this.d=Fb(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Fb(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,Vs(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Lb(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 Rr(r/e,n/e,0,t)}var ll=Z(ks(),1);var ol=(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))(ol||{}),kt=7,xa=Number.POSITIVE_INFINITY;function al(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-kt;break;case"bottom-right":case"bottom-left":s=-l+kt;break;case"bottom":s=-o+kt;break;case"top":s=o-kt;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-kt;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+kt;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]!==xa?n(t,e[0],e[1]):r(t,e[0])}function sl(t,e,r){var a;let n=t.layout,i=(a=n.get("text-variable-anchor-offset"))==null?void 0:a.evaluate(e,{},r);if(i){let s=i.values,l=[];for(let u=0;u<s.length;u+=2){let c=l[u]=s[u],p=s[u+1].map(f=>f*ne);c.startsWith("top")?p[1]-=kt:c.startsWith("bottom")&&(p[1]+=kt),l[u+1]=p}return new Ne(l)}let o=n.get("text-variable-anchor");if(o){let s;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?s=[n.get("text-radial-offset").evaluate(e,{},r)*ne,xa]:s=n.get("text-offset").evaluate(e,{},r).map(c=>c*ne);let u=[];for(let c of o)u.push(c,al(c,s));return new Ne(u)}return null}function $f(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 q(t.bucket.zoom+1),t.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new q(t.bucket.zoom+1),t.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new q(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new q(c),t.canonical),i["text-size"].possiblyEvaluate(new q(p),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new q(c),t.canonical),i["icon-size"].possiblyEvaluate(new q(p),t.canonical)]}let a=n.get("text-line-height")*ne,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},d=c.text,g=[0,0];if(d){let P=d.toString(),w=n.get("text-letter-spacing").evaluate(c,{},t.canonical)*ne,T=Pc(P)?w:0,F=n.get("text-anchor").evaluate(c,{},t.canonical),E=sl(r,c,t.canonical);if(!E){let A=n.get("text-radial-offset").evaluate(c,{},t.canonical);A?g=al(F,[A*ne,xa]):g=n.get("text-offset").evaluate(c,{},t.canonical).map(z=>z*ne)}let _=s?"center":n.get("text-justify").evaluate(c,{},t.canonical),I=n.get("symbol-placement"),k=I==="point"?n.get("text-max-width").evaluate(c,{},t.canonical)*ne:0,V=()=>{t.bucket.allowVerticalPlacement&&hn(P)&&(h.vertical=ii(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,"left",T,g,2,!0,I,y,f))};if(!s&&E){let A=new Set;if(_==="auto")for(let O=0;O<E.values.length;O+=2)A.add(Nf(E.values[O]));else A.add(_);let z=!1;for(let O of A)if(!h.horizontal[O])if(z)h.horizontal[O]=h.horizontal[0];else{let N=ii(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,"center",O,T,g,1,!1,I,y,f);N&&(h.horizontal[O]=N,z=N.positionedLines.length===1)}V()}else{_==="auto"&&(_=Nf(F));let A=ii(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,_,T,g,1,!1,I,y,f);A&&(h.horizontal[_]=A),V(),hn(P)&&s&&l&&(h.vertical=ii(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,_,T,g,2,!1,I,y,f))}}let b,x=!1;if(c.icon&&c.icon.name){let P=t.imageMap[c.icon.name];P&&(b=yf(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),x=!!P.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=x:t.bucket.sdfIcons!==x&&fe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(P.pixelRatio!==t.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let v=Gf(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||b)&&Db(t.bucket,c,h,b,t.imageMap,o,y,m,g,x,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Nf(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 Db(t,e,r,n,i,o,a,s,l,u,c){let p=o.textMaxSize.evaluate(e,{});p===void 0&&(p=a);let f=t.layers[0].layout,y=f.get("icon-offset").evaluate(e,{},c),m=Gf(r.horizontal),h=24,d=a/h,g=t.tilePixelRatio*d,b=t.tilePixelRatio*p/h,x=t.tilePixelRatio*s,v=t.tilePixelRatio*f.get("symbol-spacing"),P=f.get("text-padding")*t.tilePixelRatio,w=bf(f,e,c,t.tilePixelRatio),T=f.get("text-max-angle")/180*Math.PI,F=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",E=f.get("icon-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point",_=f.get("symbol-placement"),I=v/2,k=f.get("icon-text-fit"),V;n&&k!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(V=Qs(n,r.vertical,k,f.get("icon-text-fit-padding"),y,d)),m&&(n=Qs(n,m,k,f.get("icon-text-fit-padding"),y,d)));let A=(z,O)=>{O.x<0||O.x>=8192||O.y<0||O.y>=8192||Bb(t,O,z,r,n,i,V,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[P,P,P,P],F,l,x,w,E,y,e,o,u,c,a)};if(_==="line")for(let z of Bf(e.geometry,0,0,8192,8192)){let O=Df(z,v,T,r.vertical||m,n,h,b,t.overscaling,8192);for(let N of O){let K=m;(!K||!zb(t,K.text,I,N))&&A(z,N)}}else if(_==="line-center"){for(let z of e.geometry)if(z.length>1){let O=Lf(z,T,r.vertical||m,n,h,b);O&&A(z,O)}}else if(e.type==="Polygon")for(let z of Tr(e.geometry,0)){let O=Of(z,16);A(z[0],new rt(O.x,O.y,0))}else if(e.type==="LineString")for(let z of e.geometry)A(z,new rt(z[0].x,z[0].y,0));else if(e.type==="Point")for(let z of e.geometry)for(let O of z)A([O],new rt(O.x,O.y,0))}function Vb(t,e){let r=t.length,n=e==null?void 0:e.values;if((n==null?void 0:n.length)>0)for(let i=0;i<n.length;i+=2){let o=ol[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function Uf(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=Rf(e,r,s,i,o,a,n,t.allowVerticalPlacement),d=t.textSizeData,g=null;d.kind==="source"?(g=[Ct*i.layout.get("text-size").evaluate(a,{})],g[0]>tt&&fe("".concat(t.layerIds[0],\': Value for "text-size" is >= \').concat(Vr,\'. Reduce your "text-size".\'))):d.kind==="composite"&&(g=[Ct*y.compositeTextSizes[0].evaluate(a,{},m),Ct*y.compositeTextSizes[1].evaluate(a,{},m)],(g[0]>tt||g[1]>tt)&&fe("".concat(t.layerIds[0],\': Value for "text-size" is >= \').concat(Vr,\'. Reduce your "text-size".\'))),t.addSymbols(t.text,h,g,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let b of c)p[b]=t.text.placedSymbolArray.length-1;return h.length*4}function Gf(t){for(let e in t)return t[e];return null}function Bb(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F){let E=t.addToLineVertexArray(e,r),_,I,k,V,A=0,z=0,O=0,N=0,K=-1,xe=-1,X={},le=(0,ll.default)("");if(t.allowVerticalPlacement&&n.vertical){let ve=s.layout.get("text-rotate").evaluate(v,{},T)+90,Ve=n.vertical;k=new or(l,e,u,c,p,Ve,f,y,m,ve),a&&(V=new or(l,e,u,c,p,a,d,g,m,ve))}if(i){let Ie=s.layout.get("icon-rotate").evaluate(v,{}),ve=s.layout.get("icon-text-fit")!=="none",Ve=nl(i,Ie,w,ve),$r=a?nl(a,Ie,w,ve):void 0;I=new or(l,e,u,c,p,i,d,g,!1,Ie),A=Ve.length*4;let Vl=t.iconSizeData,Lt=null;Vl.kind==="source"?(Lt=[Ct*s.layout.get("icon-size").evaluate(v,{})],Lt[0]>tt&&fe("".concat(t.layerIds[0],\': Value for "icon-size" is >= \').concat(Vr,\'. Reduce your "icon-size".\'))):Vl.kind==="composite"&&(Lt=[Ct*P.compositeIconSizes[0].evaluate(v,{},T),Ct*P.compositeIconSizes[1].evaluate(v,{},T)],(Lt[0]>tt||Lt[1]>tt)&&fe("".concat(t.layerIds[0],\': Value for "icon-size" is >= \').concat(Vr,\'. Reduce your "icon-size".\'))),t.addSymbols(t.icon,Ve,Lt,x,b,v,0,e,E.lineStartIndex,E.lineLength,-1,T),K=t.icon.placedSymbolArray.length-1,$r&&(z=$r.length*4,t.addSymbols(t.icon,$r,Lt,x,b,v,2,e,E.lineStartIndex,E.lineLength,-1,T),xe=t.icon.placedSymbolArray.length-1)}let ce=Object.keys(n.horizontal);for(let Ie of ce){let ve=n.horizontal[Ie];if(!_){le=(0,ll.default)(ve.text);let $r=s.layout.get("text-rotate").evaluate(v,{},T);_=new or(l,e,u,c,p,ve,f,y,m,$r)}let Ve=ve.positionedLines.length===1;if(O+=Uf(t,e,ve,o,s,m,v,h,E,n.vertical?1:3,Ve?ce:[Ie],X,K,P,T),Ve)break}n.vertical&&(N+=Uf(t,e,n.vertical,o,s,m,v,h,E,2,["vertical"],X,xe,P,T));let pe=_?_.boxStartIndex:t.collisionBoxArray.length,_e=_?_.boxEndIndex:t.collisionBoxArray.length,be=k?k.boxStartIndex:t.collisionBoxArray.length,Ai=k?k.boxEndIndex:t.collisionBoxArray.length,Da=I?I.boxStartIndex:t.collisionBoxArray.length,Va=I?I.boxEndIndex:t.collisionBoxArray.length,Ur=V?V.boxStartIndex:t.collisionBoxArray.length,_i=V?V.boxEndIndex:t.collisionBoxArray.length,Me=-1,Ft=(Ie,ve)=>Ie&&Ie.circleDiameter?Math.max(Ie.circleDiameter,ve):ve;Me=Ft(_,Me),Me=Ft(k,Me),Me=Ft(I,Me),Me=Ft(V,Me);let Ii=Me>-1?1:0;Ii&&(Me*=F/ne),t.glyphOffsetArray.length>=He.MAX_GLYPHS&&fe("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 Ba=sl(s,v,T),[za,Ra]=Vb(t.textAnchorOffsets,Ba);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,K,xe,le,pe,_e,be,Ai,Da,Va,Ur,_i,u,O,N,A,z,Ii,0,f,Me,za,Ra)}function zb(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 ba=1,fi=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*ba,h:p.bitmap.height+2*ba};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=ti(n),a=new er({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;er.copy(c.bitmap,a,{x:0,y:0},{x:p.x+ba,y:p.y+ba},c.bitmap)}}this.image=a,this.positions=r}};C("GlyphAtlas",fi);function jf(t,e,r){e=Math.pow(2,r)-e-1;var n=qf(t*256,e*256,r),i=qf((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function qf(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 Wf=Z(he(),1);var ul=63710088e-1,yi=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(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(Hl(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(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 ul*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 Jf=2*Math.PI*ul;function Zf(t){return Jf*Math.cos(t*Math.PI/180)}function Rb(t){return(180+t)/360}function Ob(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Nb(t,e){return t/Zf(e)}function Ub(t){return t*360-180}function cl(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function $b(t,e){return t*Zf(cl(e))}function Gb(t){return 1/Math.cos(t*Math.PI/180)}var va=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=yi.convert(e);return new t(Rb(n.lng),Ob(n.lat),Nb(r,n.lat))}toLngLat(){return new yi(Ub(this.x),cl(this.y))}toAltitude(){return $b(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Jf*Gb(cl(this.y))}};var Pa=class{constructor(e,r,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error("x=".concat(r,", y=").concat(n,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," 0<=z<=25 "));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=jf(this.x,this.y,this.z),o=qb(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 Wf.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},pl=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=mi(e,r.z,r.z,r.x,r.y)}},hi=class t{constructor(e,r,n,i,o){if(e<n)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(e,"; z = ").concat(n));this.overscaledZ=e,this.wrap=r,this.canonical=new Pa(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 = ".concat(e,"; overscaledZ = ").concat(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 = ".concat(e,"; overscaledZ = ").concat(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 pl(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new va(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 qb(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}C("CanonicalTileID",Pa);C("OverscaledTileID",hi,{omit:["posMatrix"]});var Sa=class{constructor(e){this.tileID=new hi(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=[]}async parse(e,r,n,i){this.status="parsing",this.data=e,this.collisionBoxArray=new Ln;let o=new Br(Object.keys(e.layers).sort()),a=new ui(this.tileID,this.promoteId);a.bucketLayerIDs=[];let s={},l={featureIndex:a,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},u=r.familiesBySource[this.source];for(let P in u){let w=e.layers[P];if(!w)continue;w.version===1&&fe(\'Vector tile source "\'.concat(this.source,\'" layer "\').concat(P,\'" \')+"does not use vector tile spec v2 and therefore may have some rendering errors.");let T=o.encode(P),F=[];for(let E=0;E<w.length;E++){let _=w.feature(E),I=a.getId(_,P);F.push({feature:_,id:I,index:E,sourceLayerIndex:T})}for(let E of u[P]){let _=E[0];if(_.source!==this.source&&fe("layer.source = ".concat(_.source," does not equal this.source = ").concat(this.source)),_.minzoom&&this.zoom<Math.floor(_.minzoom)||_.maxzoom&&this.zoom>=_.maxzoom||_.visibility==="none")continue;fl(E,this.zoom,n),(s[_.id]=_.createBucket({index:a.bucketLayerIDs.length,layers:E,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source})).populate(F,l,this.tileID.canonical),a.bucketLayerIDs.push(E.map(k=>k.id))}}let c=jr(l.glyphDependencies,P=>Object.keys(P).map(Number));this.inFlightDependencies.forEach(P=>P==null?void 0:P.abort()),this.inFlightDependencies=[];let p=Promise.resolve({});if(Object.keys(c).length){let P=new AbortController;this.inFlightDependencies.push(P),p=i.sendAsync({type:"GG",data:{stacks:c,source:this.source,tileID:this.tileID,type:"glyphs"}},P)}let f=Object.keys(l.iconDependencies),y=Promise.resolve({});if(f.length){let P=new AbortController;this.inFlightDependencies.push(P),y=i.sendAsync({type:"GI",data:{icons:f,source:this.source,tileID:this.tileID,type:"icons"}},P)}let m=Object.keys(l.patternDependencies),h=Promise.resolve({});if(m.length){let P=new AbortController;this.inFlightDependencies.push(P),h=i.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"patterns"}},P)}let[d,g,b]=await Promise.all([p,y,h]),x=new fi(d),v=new ri(g,b);for(let P in s){let w=s[P];w instanceof He?(fl(w.layers,this.zoom,n),$f({bucket:w,glyphMap:d,glyphPositions:x.positions,imageMap:g,imagePositions:v.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):w.hasPattern&&(w instanceof ir||w instanceof rr||w instanceof nr)&&(fl(w.layers,this.zoom,n),w.addFeatures(l,this.tileID.canonical,v.patternPositions))}return this.status="done",{buckets:Object.values(s).filter(P=>!P.isEmpty()),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:v,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?g:null,glyphPositions:this.returnDependencies?x.positions:null}}};function fl(t,e,r){let n=new q(e);for(let i of t)i.recalculate(n,r)}var jb=60,HI=1e3/jb;var Or=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 Nr=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 hc(e.request,r);try{return{vectorTile:new Hf.default.VectorTile(new Xf.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 ".concat(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: ".concat(i.messge),new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new Or(e.request):!1,i=new Sa(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);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return Pe({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.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=Pe({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)}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 di=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)){fe(\'"\'.concat(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;case"mapbox":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}getPixels(){return new de({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)]}};C("DEMData",di);var wa=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=Jr(i)?new de({width:u,height:c},await eu(i,-1,-1,u,c)):i,f=new di(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 wy=Z(ey(),1);var yl=Z(he(),1),ty=Z(Tt(),1);var Jb=ty.default.VectorTileFeature.prototype.toGeoJSON,ml=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 yl.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 yl.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Jb.call(this,e,r,n)}},_a=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new ml(this._features[e])}};var Ay=Z(sy(),1);var ly=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],gl=1,xi=8,vi=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!==gl)throw new Error("Got v".concat(i," data when expected v").concat(gl,"."));let o=ly[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: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=ly.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: ".concat(n,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,xi,e),this.coords=new this.ArrayType(this.data,xi+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(xi+a+s+l),this.ids=new this.IndexArrayType(this.data,xi,e),this.coords=new this.ArrayType(this.data,xi+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(gl<<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 ".concat(e," items when expected ").concat(this.numItems,"."));return bl(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 d=f;d<=p;d++){let g=a[2*d],b=a[2*d+1];g>=e&&g<=n&&b>=r&&b<=i&&u.push(o[d])}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 d=f;d<=p;d++)uy(o[2*d],o[2*d+1],e,r)<=u&&l.push(i[d]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];uy(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 bl(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;cy(t,e,a,n,i,o),bl(t,e,r,n,a-1,1-o),bl(t,e,r,a+1,i,1-o)}function cy(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));cy(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(bi(t,e,n,r),e[2*i+o]>a&&bi(t,e,n,i);s<l;){for(bi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?bi(t,e,n,l):(l++,bi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function bi(t,e,r,n){xl(t,r,n),xl(e,2*r,2*n),xl(e,2*r+1,2*n+1)}function xl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function uy(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var n0={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},py=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),ar=2,Et=3,vl=4,Mt=5,yy=6,Pi=class{constructor(e){this.options=Object.assign(Object.create(n0),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 ".concat(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=py(Ta(c)),y=py(Ca(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(Ta(n),Ca(a),Ta(o),Ca(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Mt]>1?fy(u,f,this.clusterProps):this.points[u[f+Et]])}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+vl]===e&&p.push(a[y+Mt]>1?fy(a,y,this.clusterProps):this.points[a[y+Et]])}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 vi(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+Mt]>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+Et]];c=h.properties;let[d,g]=h.geometry.coordinates;p=Ta(d),f=Ca(g)}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+Et]:m=this.points[r[l+Et]].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+ar]<=r)continue;l[p+ar]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),h=l[p+Mt],d=h;for(let g of m){let b=g*c;l[b+ar]>r&&(d+=l[b+Mt])}if(d>h&&d>=a){let g=f*h,b=y*h,x,v=-1,P=((p/c|0)<<5)+(r+1)+this.points.length;for(let w of m){let T=w*c;if(l[T+ar]<=r)continue;l[T+ar]=r;let F=l[T+Mt];g+=l[T]*F,b+=l[T+1]*F,l[T+vl]=P,o&&(x||(x=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(x)),o(x,this._map(l,T)))}l[p+vl]=P,u.push(g/d,b/d,1/0,P,-1,d),o&&u.push(v)}else{for(let g=0;g<c;g++)u.push(l[p+g]);if(d>1)for(let g of m){let b=g*c;if(!(l[b+ar]<=r)){l[b+ar]=r;for(let x=0;x<c;x++)u.push(l[b+x])}}}}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+Mt]>1){let a=this.clusterProps[e[r+yy]];return n?Object.assign({},a):a}let i=this.points[e[r+Et]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function fy(t,e,r){return{type:"Feature",id:t[e+Et],properties:my(t,e,r),geometry:{type:"Point",coordinates:[i0(t[e]),o0(t[e+1])]}}}function my(t,e,r){let n=t[e+Mt],i=n>=1e4?"".concat(Math.round(n/1e3),"k"):n>=1e3?"".concat(Math.round(n/100)/10,"k"):n,o=t[e+yy],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Et],point_count:n,point_count_abbreviated:i})}function Ta(t){return t/360+.5}function Ca(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 i0(t){return(t-.5)*360}function o0(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Si(t,e,r,n){for(var i=n,o=r-e>>1,a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1],f=e+3;f<r;f+=3){var y=a0(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){var m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&Si(t,e,s,n),t[s+2]=i,r-s>3&&Si(t,s,r,n))}function a0(t,e,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var 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 ft(t,e,r,n){var i={id:typeof t>"u"?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return s0(i),i}function s0(t){var e=t.geometry,r=t.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")Pl(t,e);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<e.length;n++)Pl(t,e[n]);else if(r==="MultiPolygon")for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)Pl(t,e[n][i])}function Pl(t,e){for(var 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 Al(t,e){var r=[];if(t.type==="FeatureCollection")for(var n=0;n<t.features.length;n++)ka(r,t.features[n],e,n);else t.type==="Feature"?ka(r,t,e):ka(r,{geometry:t},e);return r}function ka(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,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")hy(i,s);else if(o==="MultiPoint")for(var u=0;u<i.length;u++)hy(i[u],s);else if(o==="LineString")wl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(u=0;u<i.length;u++)s=[],wl(i[u],s,a,!1),t.push(ft(l,"LineString",s,e.properties));return}else Sl(i,s,a,!1);else if(o==="Polygon")Sl(i,s,a,!0);else if(o==="MultiPolygon")for(u=0;u<i.length;u++){var c=[];Sl(i[u],c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(u=0;u<e.geometry.geometries.length;u++)ka(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(ft(l,o,s,e.properties))}}function hy(t,e){e.push(dy(t[0])),e.push(gy(t[1])),e.push(0)}function wl(t,e,r,n){for(var i,o,a=0,s=0;s<t.length;s++){var l=dy(t[s][0]),u=gy(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(n?a+=(i*u-l*o)/2:a+=Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=e.length-3;e[2]=1,Si(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Sl(t,e,r,n){for(var i=0;i<t.length;i++){var o=[];wl(t[i],o,r,n),e.push(o)}}function dy(t){return t/360+.5}function gy(t){var 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 qe(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;for(var l=[],u=0;u<t.length;u++){var c=t[u],p=c.geometry,f=c.type,y=i===0?c.minX:c.minY,m=i===0?c.maxX:c.maxY;if(y>=r&&m<n){l.push(c);continue}else if(m<r||y>=n)continue;var h=[];if(f==="Point"||f==="MultiPoint")l0(p,h,r,n,i);else if(f==="LineString")by(p,h,r,n,i,!1,s.lineMetrics);else if(f==="MultiLineString")_l(p,h,r,n,i,!1);else if(f==="Polygon")_l(p,h,r,n,i,!0);else if(f==="MultiPolygon")for(var d=0;d<p.length;d++){var g=[];_l(p[d],g,r,n,i,!0),g.length&&h.push(g)}if(h.length){if(s.lineMetrics&&f==="LineString"){for(d=0;d<h.length;d++)l.push(ft(c.id,f,h[d],c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(h.length===1?(f="LineString",h=h[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=h.length===3?"Point":"MultiPoint"),l.push(ft(c.id,f,h,c.tags))}}return l.length?l:null}function l0(t,e,r,n,i){for(var o=0;o<t.length;o+=3){var a=t[o+i];a>=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function by(t,e,r,n,i,o,a){for(var s=xy(t),l=i===0?u0:c0,u=t.start,c,p,f=0;f<t.length-3;f+=3){var y=t[f],m=t[f+1],h=t[f+2],d=t[f+3],g=t[f+4],b=i===0?y:m,x=i===0?d:g,v=!1;a&&(c=Math.sqrt(Math.pow(y-d,2)+Math.pow(m-g,2))),b<r?x>r&&(p=l(s,y,m,d,g,r),a&&(s.start=u+c*p)):b>n?x<n&&(p=l(s,y,m,d,g,n),a&&(s.start=u+c*p)):Il(s,y,m,h),x<r&&b>=r&&(p=l(s,y,m,d,g,r),v=!0),x>n&&b<=n&&(p=l(s,y,m,d,g,n),v=!0),!o&&v&&(a&&(s.end=u+c*p),e.push(s),s=xy(t)),a&&(u+=c)}var P=t.length-3;y=t[P],m=t[P+1],h=t[P+2],b=i===0?y:m,b>=r&&b<=n&&Il(s,y,m,h),P=s.length-3,o&&P>=3&&(s[P]!==s[0]||s[P+1]!==s[1])&&Il(s,s[0],s[1],s[2]),s.length&&e.push(s)}function xy(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function _l(t,e,r,n,i,o){for(var a=0;a<t.length;a++)by(t[a],e,r,n,i,o,!1)}function Il(t,e,r,n){t.push(e),t.push(r),t.push(n)}function u0(t,e,r,n,i,o){var a=(o-e)/(n-e);return t.push(o),t.push(r+(i-r)*a),t.push(1),a}function c0(t,e,r,n,i,o){var a=(o-r)/(i-r);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function Cl(t,e){var r=e.buffer/e.extent,n=t,i=qe(t,1,-1-r,r,0,-1,2,e),o=qe(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=qe(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=vy(i,1).concat(n)),o&&(n=n.concat(vy(o,-1)))),n}function vy(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Tl(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(Tl(i.geometry[s],e))}else if(o==="MultiPolygon")for(a=[],s=0;s<i.geometry.length;s++){for(var l=[],u=0;u<i.geometry[s].length;u++)l.push(Tl(i.geometry[s][u],e));a.push(l)}r.push(ft(i.id,o,a,i.tags))}return r}function Tl(t,e){var r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function Ma(t,e){if(t.transformed)return t;var r=1<<t.z,n=t.x,i=t.y,o,a,s;for(o=0;o<t.features.length;o++){var l=t.features[o],u=l.geometry,c=l.type;if(l.geometry=[],c===1)for(a=0;a<u.length;a+=2)l.geometry.push(Py(u[a],u[a+1],e,r,n,i));else for(a=0;a<u.length;a++){var p=[];for(s=0;s<u[a].length;s+=2)p.push(Py(u[a][s],u[a][s+1],e,r,n,i));l.geometry.push(p)}}return t.transformed=!0,t}function Py(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function Ml(t,e,r,n,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,p0(a,t[s],o,i);var l=t[s].minX,u=t[s].minY,c=t[s].maxX,p=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function p0(t,e,r,n){var i=e.geometry,o=e.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")kl(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)kl(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(var l=0;l<i.length;l++){var u=i[l];for(s=0;s<u.length;s++)kl(a,u[s],t,r,!0,s===0)}if(a.length){var c=e.tags||null;if(o==="LineString"&&n.lineMetrics){c={};for(var p in e.tags)c[p]=e.tags[p];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var f={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:c};e.id!==null&&(f.id=e.id),t.features.push(f)}}function kl(t,e,r,n,i,o){var a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}for(var s=[],l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&f0(s,o),t.push(s)}function f0(t,e){for(var r=0,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(n=0,i=t.length;n<i/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=s}}function Fl(t,e){return new Ea(t,e)}function Ea(t,e){e=this.options=y0(Object.create(this.options),e);var r=e.debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=Al(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=Cl(n,e),n.length&&this.splitTile(n,0,0,0),r&&(n.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)))}Ea.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};Ea.prototype.splitTile=function(t,e,r,n,i,o,a){for(var s=[t,e,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,p=El(e,r,n),f=this.tiles[p];if(!f&&(u>1&&console.time("creation"),f=this.tiles[p]=Ml(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var y="z"+e;this.stats[y]=(this.stats[y]||0)+1,this.total++}if(f.source=t,i){if(e===l.maxZoom||e===i)continue;var m=1<<i-e;if(r!==Math.floor(o/m)||n!==Math.floor(a/m))continue}else if(e===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,t.length!==0){u>1&&console.time("clipping");var h=.5*l.buffer/l.extent,d=.5-h,g=.5+h,b=1+h,x,v,P,w,T,F;x=v=P=w=null,T=qe(t,c,r-h,r+g,0,f.minX,f.maxX,l),F=qe(t,c,r+d,r+b,0,f.minX,f.maxX,l),t=null,T&&(x=qe(T,c,n-h,n+g,1,f.minY,f.maxY,l),v=qe(T,c,n+d,n+b,1,f.minY,f.maxY,l),T=null),F&&(P=qe(F,c,n-h,n+g,1,f.minY,f.maxY,l),w=qe(F,c,n+d,n+b,1,f.minY,f.maxY,l),F=null),u>1&&console.timeEnd("clipping"),s.push(x||[],e+1,r*2,n*2),s.push(v||[],e+1,r*2,n*2+1),s.push(P||[],e+1,r*2+1,n*2),s.push(w||[],e+1,r*2+1,n*2+1)}}};Ea.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t;e=(e%a+a)%a;var s=El(t,e,r);if(this.tiles[s])return Ma(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l=t,u=e,c=r,p;!p&&l>0;)l--,u=Math.floor(u/2),c=Math.floor(c/2),p=this.tiles[El(l,u,c)];return!p||!p.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",l,u,c),o>1&&console.time("drilling down"),this.splitTile(p.source,l,u,c,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Ma(this.tiles[s],i):null)};function El(t,e,r){return((1<<t)*r+e)*32+t}function y0(t,e){for(var r in e)t[r]=e[r];return t}function wi(t,e){return e?t.properties[e]:t.id}function Ll(t,e){if(t==null)return!0;if(t.type==="Feature")return wi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=wi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function Dl(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(wi(t,e),t);else for(let n of t.features)r.set(wi(n,e),n);return r}function Sy(t,e,r){var n,i,o,a;if(e.removeAll&&t.clear(),e.remove)for(let s of e.remove)t.delete(s);if(e.add)for(let s of e.add){let l=wi(s,r);l!=null&&t.set(l,s)}if(e.update)for(let s of e.update){let l=t.get(s.id);if(l==null)continue;let u=s.newGeometry||s.removeAllProperties,c=!s.removeAllProperties&&(((n=s.removeProperties)==null?void 0:n.length)>0||((i=s.addOrUpdateProperties)==null?void 0:i.length)>0);if((u||c)&&(l=Dt({},l),t.set(s.id,l),c&&(l.properties=Dt({},l.properties))),s.newGeometry&&(l.geometry=s.newGeometry),s.removeAllProperties)l.properties={};else if(((o=s.removeProperties)==null?void 0:o.length)>0)for(let p of s.removeProperties)Object.prototype.hasOwnProperty.call(l.properties,p)&&delete l.properties[p];if(((a=s.addOrUpdateProperties)==null?void 0:a.length)>0)for(let{key:p,value:f}of s.addOrUpdateProperties)l.properties[p]=f}}var Fa=class extends Nr{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 _a(o.features),s=(0,Ay.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){var i;(i=this._pendingRequest)==null||i.abort();let n=r&&r.request&&r.request.collectResourceTiming?new Or(r.request):!1;this._pendingRequest=new AbortController;try{let o=await this.loadGeoJSON(r,this._pendingRequest);if(delete this._pendingRequest,typeof o!="object")throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."));if((0,wy.default)(o,!0),r.filter){let s=jt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(s.result==="error")throw new Error(s.value.map(u=>"".concat(u.key,": ").concat(u.message)).join(", "));o={type:"FeatureCollection",features:o.features.filter(u=>s.value.evaluate({zoom:0},u))}}this._geoJSONIndex=r.cluster?new Pi(m0(r)).load(o.features):Fl(o,r.geojsonVtOptions),this.loaded={};let a={};if(n){let s=n.finish();s&&(a.resourceTiming={},a.resourceTiming[r.source]=JSON.parse(JSON.stringify(s)))}return a}catch(o){if(delete this._pendingRequest,ac(o))return{abandoned:!0};throw o}}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await mc(r.request,n);return this._dataUpdateable=Ll(o.data,i)?Dl(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=Ll(o,i)?Dl(o,i):void 0,o}catch(o){throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."))}if(!r.dataDiff)throw new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object."));if(!this._dataUpdateable)throw new Error("Cannot update existing geojson data in ".concat(r.source));return Sy(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 m0({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=jt(u),p=jt(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 La=class{constructor(e){this.self=e,this.actor=new io(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 "\'.concat(r,\'" already registered.\'));this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=lc,this.self.removeProtocol=uc,this.self.registerRTLTextPlugin=r=>{if(ye.isParsed())throw new Error("RTL text plugin already registered.");ye.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("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){if(ye.isParsed())return ye.getState();if(r.pluginStatus!=="loading")return ye.setState(r),r;let n=r.pluginURL;if(this.self.importScripts(n),ye.isParsed()){let o={pluginStatus:"loaded",pluginURL:n};return ye.setState(o),o}throw ye.setState({pluginStatus:"error",pluginURL:""}),new Error("RTL Text Plugin failed to import scripts from ".concat(n))}_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 ya),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 Nr(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new Fa(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 wa),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new La(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var jk=l(()=>Ke.WORKER_URL?Ke.WORKER_URL:URL.createObjectURL(new Blob([X0],{type:"text/javascript"})),"getWorkerURL");function K0(){return new Worker(jk())}l(K0,"workerFactory");var mu="maplibre_preloaded_worker_pool",fu=class fu{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<fu.workerCount;)this.workers.push(K0());return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[mu]}numActive(){return Object.keys(this.active).length}};l(fu,"WorkerPool");var zr=fu,Zk=Math.floor(Y.hardwareConcurrency/2);zr.workerCount=ob(globalThis)?Math.max(Math.min(Zk,3),1):1;var sa;function la(){return sa||(sa=new zr),sa}l(la,"getGlobalWorkerPool");function Hk(){la().acquire(mu)}l(Hk,"prewarm");function $k(){let r=sa;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(mu),sa=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))}l($k,"clearPrewarmedResources");var dd=class dd{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t;let i=this.workerPool.acquire(t);for(let n=0;n<i.length;n++){let o=i[n],a=new hu(o,t);a.name="Worker ".concat(n),this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){let i=[];for(let n of this.actors)i.push(n.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)}};l(dd,"Dispatcher");var ua=dd,du;function yu(){return du||(du=new ua(la(),ls),du.registerMessageHandler("GR",(r,e,t)=>ki(e,t))),du}l(yu,"getGlobalDispatcher");d();function Wk(r,e){let t=q.create();return q.translate(t,t,[1,1,0]),q.scale(t,t,[r.width*.5,r.height*.5,1]),q.multiply(t,t,r.calculatePosMatrix(e.toUnwrapped()))}l(Wk,"getPixelPosMatrix");function Xk(r,e,t){if(r)for(let i of r){let n=e[i];if(n&&n.source===t&&n.type==="fill-extrusion")return!0}else for(let i in e){let n=e[i];if(n.source===t&&n.type==="fill-extrusion")return!0}return!1}l(Xk,"queryIncludes3DLayer");function J0(r,e,t,i,n,o){let a=Xk(n&&n.layers,e,r.id),s=o.maxPitchScaleFactor(),u=r.tilesIn(i,s,a);u.sort(e1);let c=[];for(let h of u)c.push({wrappedTileID:h.tileID.wrapped().key,queryResults:h.tile.queryRenderedFeatures(e,t,r._state,h.queryGeometry,h.cameraQueryGeometry,h.scale,n,o,s,Wk(r.transform,h.tileID))});let p=Kk(c);for(let h in p)p[h].forEach(f=>{let m=f.feature,y=r.getFeatureState(m.layer["source-layer"],m.id);m.source=m.layer.source,m.layer["source-layer"]&&(m.sourceLayer=m.layer["source-layer"]),m.state=y});return p}l(J0,"queryRenderedFeatures");function Y0(r,e,t,i,n,o,a){let s={},u=o.queryRenderedSymbols(i),c=[];for(let p of Object.keys(u).map(Number))c.push(a[p]);c.sort(e1);for(let p of c){let h=p.featureIndex.lookupSymbolFeatures(u[p.bucketInstanceId],e,p.bucketIndex,p.sourceLayerIndex,n.filter,n.layers,n.availableImages,r);for(let f in h){let m=s[f]=s[f]||[],y=h[f];y.sort((g,x)=>{let b=p.featureSortOrder;if(b){let w=b.indexOf(g.featureIndex);return b.indexOf(x.featureIndex)-w}else return x.featureIndex-g.featureIndex});for(let g of y)m.push(g)}}for(let p in s)s[p].forEach(h=>{let f=h.feature,m=r[p],g=t[m.source].getFeatureState(f.layer["source-layer"],f.id);f.source=f.layer.source,f.layer["source-layer"]&&(f.sourceLayer=f.layer["source-layer"]),f.state=g});return s}l(Y0,"queryRenderedSymbols");function Q0(r,e){let t=r.getRenderableIds().map(o=>r.getTileByID(o)),i=[],n={};for(let o=0;o<t.length;o++){let a=t[o],s=a.tileID.canonical.key;n[s]||(n[s]=!0,a.querySourceFeatures(i,e))}return i}l(Q0,"querySourceFeatures");function e1(r,e){let t=r.tileID,i=e.tileID;return t.overscaledZ-i.overscaledZ||t.canonical.y-i.canonical.y||t.wrap-i.wrap||t.canonical.x-i.canonical.x}l(e1,"sortTilesIn");function Kk(r){let e={},t={};for(let i of r){let n=i.queryResults,o=i.wrappedTileID,a=t[o]=t[o]||{};for(let s in n){let u=n[s],c=a[s]=a[s]||{},p=e[s]=e[s]||[];for(let h of u)c[h.featureIndex]||(c[h.featureIndex]=!0,p.push(h))}}return e}l(Kk,"mergeRenderedFeatureLayers");d();d();d();d();async function gu(r,e,t){let i=r;if(r.url?i=(await gr(e.transformRequest(r.url,"Source"),t)).data:await Y.frameAsync(t),!i)return null;let n=yr(V(i,r),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in i&&i.vector_layers&&(n.vectorLayerIds=i.vector_layers.map(o=>o.id)),n}l(gu,"loadTileJson");d();d();d();var ca=63710088e-1,_i=class _i{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(t,")"));if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new _i(er(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(e){let t=Math.PI/180,i=this.lat*t,n=e.lat*t,o=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return ca*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof _i)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new _i(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new _i(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>]")}};l(_i,"LngLat");var ie=_i;var Fr=class Fr{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof ie?new ie(e.lng,e.lat):ie.convert(e),this}setSouthWest(e){return this._sw=e instanceof ie?new ie(e.lng,e.lat):ie.convert(e),this}extend(e){let t=this._sw,i=this._ne,n,o;if(e instanceof ie)n=e,o=e;else if(e instanceof Fr){if(n=e._sw,o=e._ne,!n||!o)return this}else{if(Array.isArray(e))if(e.length===4||e.every(Array.isArray)){let a=e;return this.extend(Fr.convert(a))}else{let a=e;return this.extend(ie.convert(a))}else if(e&&("lng"in e||"lon"in e)&&"lat"in e)return this.extend(ie.convert(e));return this}return!t&&!i?(this._sw=new ie(n.lng,n.lat),this._ne=new ie(o.lng,o.lat)):(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),i.lng=Math.max(o.lng,i.lng),i.lat=Math.max(o.lat,i.lat)),this}getCenter(){return new ie((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 ie(this.getWest(),this.getNorth())}getSouthEast(){return new ie(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(e){let{lng:t,lat:i}=ie.convert(e),n=this._sw.lat<=i&&i<=this._ne.lat,o=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=t&&t>=this._ne.lng),n&&o}static convert(e){return e instanceof Fr||!e?e:new Fr(e)}static fromLngLat(e,t=0){let n=360*t/40075017,o=n/Math.cos(Math.PI/180*e.lat);return new Fr(new ie(e.lng-o,e.lat-n),new ie(e.lng+o,e.lat+n))}};l(Fr,"LngLatBounds");var ut=Fr;d();var t1=2*Math.PI*ca;function r1(r){return t1*Math.cos(r*Math.PI/180)}l(r1,"circumferenceAtLatitude");function Rr(r){return(180+r)/360}l(Rr,"mercatorXfromLng");function Br(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}l(Br,"mercatorYfromLat");function bu(r,e){return r/r1(e)}l(bu,"mercatorZfromAltitude");function Jk(r){return r*360-180}l(Jk,"lngFromMercatorX");function yd(r){let e=180-r*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}l(yd,"latFromMercatorY");function Yk(r,e){return r*r1(yd(e))}l(Yk,"altitudeFromMercatorZ");function Qk(r){return 1/Math.cos(r*Math.PI/180)}l(Qk,"mercatorScale");var xu=class xu{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){let i=ie.convert(e);return new xu(Rr(i.lng),Br(i.lat),bu(t,i.lat))}toLngLat(){return new ie(Jk(this.x),yd(this.y))}toAltitude(){return Yk(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/t1*Qk(yd(this.y))}};l(xu,"MercatorCoordinate");var Fe=xu;var gd=class gd{constructor(e,t,i){this.bounds=ut.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(Rr(this.bounds.getWest())*t),minY:Math.floor(Br(this.bounds.getNorth())*t),maxX:Math.ceil(Rr(this.bounds.getEast())*t),maxY:Math.ceil(Br(this.bounds.getSouth())*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}};l(gd,"TileBounds");var xn=gd;var xd=class xd extends de{constructor(e,t,i,n){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,V(this,yr(t,["url","scheme","tileSize","promoteId"])),this._options=V({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}async load(){this._loaded=!1,this.fire(new F("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await gu(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(V(this,e),e.bounds&&(this.tileBounds=new xn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new F("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new F("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new H(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 V({},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};i.request.collectResourceTiming=this._collectResourceTiming;let n="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),n="LT";else if(e.state==="loading")return new Promise((o,a)=>{e.reloadPromise={resolve:o,reject:a}});e.abortController=new AbortController;try{let o=await e.actor.sendAsync({type:n,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,o)}catch(o){if(delete e.abortController,e.aborted)return;if(o&&o.status!==404)throw o;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}};l(xd,"VectorTileSource");var pa=xd;d();var bd=class bd extends de{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=V({type:"raster"},t),V(this,yr(t,["url","scheme","tileSize"]))}async load(){this._loaded=!1,this.fire(new F("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await gu(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(V(this,e),e.bounds&&(this.tileBounds=new xn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new F("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new F("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new H(e))}}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()}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 V({},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 st.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 n=this.map.painter.context,o=n.gl,a=i.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new ve(n,a,o.RGBA,{useMipmap:!0}),e.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax)),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}};l(bd,"RasterTileSource");var vi=bd;d();d();d();function n1(r,e,t){e=Math.pow(2,t)-e-1;var i=i1(r*256,e*256,t),n=i1((r+1)*256,(e+1)*256,t);return i[0]+","+i[1]+","+n[0]+","+n[1]}l(n1,"getTileBBox");function i1(r,e,t){var i=2*Math.PI*6378137/256/Math.pow(2,t),n=r*i-2*Math.PI*6378137/2,o=e*i-2*Math.PI*6378137/2;return[n,o]}l(i1,"getMercCoords");var o1=ae(ge(),1);var _d=class _d{constructor(e,t,i){if(e<0||e>25||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))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)," 0<=z<=25 "));this.z=e,this.x=t,this.y=i,this.key=ha(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 n=n1(this.x,this.y,this.z),o=eL(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,o).replace(/{bbox-epsg-3857}/g,n)}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 o1.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}};l(_d,"CanonicalTileID");var bn=_d,vd=class vd{constructor(e,t){this.wrap=e,this.canonical=t,this.key=ha(e,t.z,t.z,t.x,t.y)}};l(vd,"UnwrappedTileID");var _n=vd,Pt=class Pt{constructor(e,t,i,n,o){if(e<i)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(e,"; z = ").concat(i));this.overscaledZ=e,this.wrap=t,this.canonical=new bn(i,+n,+o),this.key=ha(t,e,i,n,o)}clone(){return new Pt(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 = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let t=this.canonical.z-e;return e>this.canonical.z?new Pt(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Pt(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let i=this.canonical.z-e;return e>this.canonical.z?ha(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):ha(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Pt(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new Pt(t,this.wrap,t,i,n),new Pt(t,this.wrap,t,i+1,n),new Pt(t,this.wrap,t,i,n+1),new Pt(t,this.wrap,t,i+1,n+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 Pt(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Pt(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 _n(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new Fe(e.x-this.wrap,e.y))}};l(Pt,"OverscaledTileID");var Je=Pt;function ha(r,e,t,i,n){r*=2,r<0&&(r=r*-1-1);let o=1<<t;return(o*o*r+o*n+i).toString(36)+t.toString(36)+e.toString(36)}l(ha,"calculateKey");function eL(r,e,t){let i="",n;for(let o=r;o>0;o--)n=1<<o-1,i+=(e&n?1:0)+(t&n?2:0);return i}l(eL,"getQuadkey");N("CanonicalTileID",bn);N("OverscaledTileID",Je,{omit:["posMatrix"]});d();var Sd=class Sd{constructor(e,t,i,n=1,o=1,a=1,s=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){Le('"'.concat(i,'" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".'));return}this.stride=t.height;let u=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=n,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let c=0;c<u;c++)this.data[this._idx(-1,c)]=this.data[this._idx(0,c)],this.data[this._idx(u,c)]=this.data[this._idx(u-1,c)],this.data[this._idx(c,-1)]=this.data[this._idx(c,0)],this.data[this._idx(c,u)]=this.data[this._idx(c,u-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(u,-1)]=this.data[this._idx(u-1,0)],this.data[this._idx(-1,u)]=this.data[this._idx(0,u-1)],this.data[this._idx(u,u)]=this.data[this._idx(u-1,u-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let c=0;c<u;c++)for(let p=0;p<u;p++){let h=this.get(c,p);h>this.max&&(this.max=h),h<this.min&&(this.min=h)}}get(e,t){let i=new Uint8Array(this.data.buffer),n=this._idx(e,t)*4;return this.unpack(i[n],i[n+1],i[n+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}getPixels(){return new Se({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 n=t*this.dim,o=t*this.dim+this.dim,a=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:n=o-1;break;case 1:o=n+1;break}switch(i){case-1:a=s-1;break;case 1:s=a+1;break}let u=-t*this.dim,c=-i*this.dim;for(let p=a;p<s;p++)for(let h=n;h<o;h++)this.data[this._idx(h,p)]=e.data[this._idx(h+u,p+c)]}};l(Sd,"DEMData");var wd=Sd;N("DEMData",wd);var Pd=class Pd extends vi{constructor(e,t,i,n){super(e,t,i,n),this.type="raster-dem",this.maxzoom=22,this._options=V({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 n=await st.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(n&&n.data){let o=n.data;this.map._refreshExpiredTiles&&n.cacheControl&&n.expires&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let s=ht(o)&&rs()?o:await this.readImageNow(o),u={type:this.type,uid:e.uid,source:this.id,rawImageData:s,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 c=await e.actor.sendAsync({type:"LDT",data:u});e.dem=c,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(n){if(delete e.abortController,e.aborted)e.state="unloaded";else if(n)throw e.state="errored",n}}async readImageNow(e){if(typeof VideoFrame<"u"&&_p()){let t=e.width+2,i=e.height+2;try{return new Se({width:t,height:i},await lb(e,-1,-1,t,i))}catch(n){}}return Y.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,i=Math.pow(2,t.z),n=(t.x-1+i)%i,o=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+i)%i,s=t.x+1===i?e.wrap+1:e.wrap,u={};return u[new Je(e.overscaledZ,o,t.z,n,t.y).key]={backfilled:!1},u[new Je(e.overscaledZ,s,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(u[new Je(e.overscaledZ,o,t.z,n,t.y-1).key]={backfilled:!1},u[new Je(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},u[new Je(e.overscaledZ,s,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<i&&(u[new Je(e.overscaledZ,o,t.z,n,t.y+1).key]={backfilled:!1},u[new Je(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},u[new Je(e.overscaledZ,s,t.z,a,t.y+1).key]={backfilled:!1}),u}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}})}};l(Pd,"RasterDEMTileSource");var fa=Pd;d();var Td=class Td extends de{constructor(e,t,i,n){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(n),this._data=t.data,this._options=V({},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;let o=8192/this.tileSize;this.workerOptions=V({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*o,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*o,extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:(t.clusterRadius||50)*o,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}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}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=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=V({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(Y.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new F("dataloading",{dataType:"source"}));try{let i=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||i.abandoned){this.fire(new F("dataabort",{dataType:"source"}));return}let n=null;i.resourceTiming&&i.resourceTiming[this.id]&&(n=i.resourceTiming[this.id].slice(0));let o={dataType:"source"};this._collectResourceTiming&&n&&n.length>0&&V(o,{resourceTiming:n}),this.fire(new F("data",Zr(Vt({},o),{sourceDataType:"metadata"}))),this.fire(new F("data",Zr(Vt({},o),{sourceDataType:"content"})))}catch(i){if(this._pendingLoads--,this._removed){this.fire(new F("dataabort",{dataType:"source"}));return}this.fire(new H(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};e.abortController=new AbortController;let n=await this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(n,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 V({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}};l(Td,"GeoJSONSource");var ma=Td;d();d();d();var Or=_e([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var Md=class Md extends de{constructor(e,t,i,n){super(),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(n),this.options=t}async load(e){this._loaded=!1,this.fire(new F("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=await st.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 H(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 F("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(Fe.fromLngLat);this.tileID=tL(t),this.minzoom=this.maxzoom=this.tileID.z;let i=t.map(n=>this.tileID.getTilePoint(n)._round());return this._boundsArray=new nn,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,8192,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,8192),this._boundsArray.emplaceBack(i[2].x,i[2].y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new F("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.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Or.members)),this.boundsSegments||(this.boundsSegments=me.simpleSegment(0,0,4,2)),this.texture||(this.texture=new ve(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let n in this.tiles){let o=this.tiles[n];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,i=!0)}i&&this.fire(new F("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}};l(Md,"ImageSource");var Lt=Md;function tL(r){let e=1/0,t=1/0,i=-1/0,n=-1/0;for(let p of r)e=Math.min(e,p.x),t=Math.min(t,p.y),i=Math.max(i,p.x),n=Math.max(n,p.y);let o=i-e,a=n-t,s=Math.max(o,a),u=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),c=Math.pow(2,u);return new bn(u,Math.floor((e+i)/2*c),Math.floor((t+n)/2*c))}l(tL,"getCoordinatesCenterTileID");var Ad=class Ad extends Lt{constructor(e,t,i,n){super(e,t,i,n),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 hb(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 H(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 H(new B("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.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Or.members)),this.boundsSegments||(this.boundsSegments=me.simpleSegment(0,0,4,2)),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 ve(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let n in this.tiles){let o=this.tiles[n];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,i=!0)}i&&this.fire(new F("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}};l(Ad,"VideoSource");var da=Ad;d();var Id=class Id extends Lt{constructor(e,t,i,n){super(e,t,i,n),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(o=>!Array.isArray(o)||o.length!==2||o.some(a=>typeof a!="number")))&&this.fire(new H(new B("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new H(new B("sources.".concat(e),null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new H(new B("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 H(new B("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 H(new B("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 H(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.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Or.members)),this.boundsSegments||(this.boundsSegments=me.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new ve(t,this.canvas,i.RGBA,{premultiply:!0});let n=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,n=!0)}n&&this.fire(new F("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}};l(Id,"CanvasSource");var ya=Id;var a1={},s1=l((r,e,t,i)=>{let n=l1(e.type),o=new n(r,e,t,i);if(o.id!==r)throw new Error("Expected Source id to be ".concat(r," instead of ").concat(o.id));return o},"create"),l1=l(r=>{switch(r){case"geojson":return ma;case"image":return Lt;case"raster":return vi;case"raster-dem":return fa;case"vector":return pa;case"video":return da;case"canvas":return ya}return a1[r]},"getSourceType"),rL=l((r,e)=>{a1[r]=e},"setSourceType"),iL=l(async(r,e)=>{if(l1(r))throw new Error('A source type called "'.concat(r,'" already exists.'));rL(r,e)},"addSourceType");d();d();function u1(r,e){let t={};if(!e)return t;for(let i of r){let n=i.layerIds.map(o=>e.getLayer(o)).filter(Boolean);if(n.length!==0){i.layers=n,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(o=>n.filter(a=>a.id===o)[0]));for(let o of n)t[o.id]=i}}return t}l(u1,"deserialize");d();d();var Cd=class Cd{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]}};l(Cd,"DictionaryCoder");var _u=Cd;var h1=ae(Wo(),1),f1=ae($m(),1);d();var Ed=class Ed{constructor(e,t,i,n,o){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=n,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 t in this)t==="_geometry"||t==="_vectorTileFeature"||(e[t]=this[t]);return e}};l(Ed,"GeoJSONFeature");var vn=Ed;var Ld=class Ld{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new oi(8192,16,0),this.grid3D=new oi(8192,16,0),this.featureIndexArray=new Do,this.promoteId=t}insert(e,t,i,n,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,o);let u=a?this.grid3D:this.grid;for(let c=0;c<t.length;c++){let p=t[c],h=[1/0,1/0,-1/0,-1/0];for(let f=0;f<p.length;f++){let m=p[f];h[0]=Math.min(h[0],m.x),h[1]=Math.min(h[1],m.y),h[2]=Math.max(h[2],m.x),h[3]=Math.max(h[3],m.y)}h[0]<8192&&h[1]<8192&&h[2]>=0&&h[3]>=0&&u.insert(s,h[0],h[1],h[2],h[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new h1.default.VectorTile(new f1.default(this.rawTileData)).layers,this.sourceLayerCoder=new _u(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,n){this.loadVTLayers();let o=e.params||{},a=8192/e.tileSize/e.scale,s=so(o.filter),u=e.queryGeometry,c=e.queryPadding*a,p=p1(u),h=this.grid.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c),f=p1(e.cameraQueryGeometry),m=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(x,b,w,_)=>Z_(e.cameraQueryGeometry,x-c,b-c,w+c,_+c));for(let x of m)h.push(x);h.sort(nL);let y={},g;for(let x=0;x<h.length;x++){let b=h[x];if(b===g)continue;g=b;let w=this.featureIndexArray.get(b),_=null;this.loadMatchingFeature(y,w.bucketIndex,w.sourceLayerIndex,w.featureIndex,s,o.layers,o.availableImages,t,i,n,(S,P,T)=>(_||(_=dt(S)),P.queryIntersectsFeature(u,S,T,_,this.z,e.transform,a,e.pixelPosMatrix)))}return y}loadMatchingFeature(e,t,i,n,o,a,s,u,c,p,h){let f=this.bucketLayerIDs[t];if(a&&!eb(a,f))return;let m=this.sourceLayerCoder.decode(i),g=this.vtLayers[m].feature(n);if(o.needGeometry){let b=yt(g,!0);if(!o.filter(new ye(this.tileID.overscaledZ),b,this.tileID.canonical))return}else if(!o.filter(new ye(this.tileID.overscaledZ),g))return;let x=this.getId(g,m);for(let b=0;b<f.length;b++){let w=f[b];if(a&&a.indexOf(w)<0)continue;let _=u[w];if(!_)continue;let S={};x&&p&&(S=p.getState(_.sourceLayer||"_geojsonTileLayer",x));let P=V({},c[w]);P.paint=c1(P.paint,_.paint,g,S,s),P.layout=c1(P.layout,_.layout,g,S,s);let T=!h||h(g,_,S);if(!T)continue;let L=new vn(g,this.z,this.x,this.y,x);L.layer=P;let C=e[w];C===void 0&&(C=e[w]=[]),C.push({featureIndex:n,feature:L,intersectionZ:T})}}lookupSymbolFeatures(e,t,i,n,o,a,s,u){let c={};this.loadVTLayers();let p=so(o);for(let h of e)this.loadMatchingFeature(c,i,n,h,p,a,s,u,t);return c}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){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))}return i}};l(Ld,"FeatureIndex");var kd=Ld;N("FeatureIndex",kd,{omit:["rawTileData","sourceLayerCoder"]});function c1(r,e,t,i,n){return Dn(r,(o,a)=>{let s=e instanceof Pr?e.get(a):null;return s&&s.evaluate?s.evaluate(t,i,n):s})}l(c1,"evaluateProperties");function p1(r){let e=1/0,t=1/0,i=-1/0,n=-1/0;for(let o of r)e=Math.min(e,o.x),t=Math.min(t,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return{minX:e,minY:t,maxX:i,maxY:n}}l(p1,"getBounds");function nL(r,e){return e-r}l(nL,"topDownFeatureComparator");d();d();var ga="RTLPluginLoaded";var Fd=class Fd extends de{constructor(){super(...arguments);this.status="unavailable";this.url=null;this.dispatcher=yu()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,i=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Y.resolveURL(t),!this.url)throw new Error("requested url ".concat(t," is invalid"));if(this.status==="unavailable")if(i)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 F(ga))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}};l(Fd,"RTLMainThreadPlugin");var zd=Fd,Dd=null;function Vr(){return Dd||(Dd=new zd),Dd}l(Vr,"rtlMainThreadPluginFactory");var oL=3e4,Rd=class Rd{constructor(e,t){this.timeAdded=0;this.fadeEndTime=0;this.tileID=e,this.uid=ns(),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 Ao;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=u1(e.buckets,t.style),this.hasSymbolBuckets=!1;for(let n in this.buckets){let o=this.buckets[n];if(o instanceof Ot)if(this.hasSymbolBuckets=!0,i)o.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let n in this.buckets){let o=this.buckets[n];if(o instanceof Ot&&o.hasRTLText){this.hasRTLText=!0,Vr().lazyLoad();break}}this.queryPadding=0;for(let n in this.buckets){let o=this.buckets[n];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(n).queryRadius(o))}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 n=this.buckets[i];n.uploadPending()&&n.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ve(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ve(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,o,a,s,u,c,p){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:o,scale:a,tileSize:this.tileSize,pixelPosMatrix:p,transform:u,params:s,queryPadding:this.queryPadding*c},e,t,i)}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;let n=i.loadVTLayers(),o=t&&t.sourceLayer?t.sourceLayer:"",a=n._geojsonTileLayer||n[o];if(!a)return;let s=so(t&&t.filter),{z:u,x:c,y:p}=this.tileID.canonical,h={z:u,x:c,y:p};for(let f=0;f<a.length;f++){let m=a.feature(f);if(s.needGeometry){let x=yt(m,!0);if(!s.filter(new ye(this.tileID.overscaledZ),x,this.tileID.canonical))continue}else if(!s.filter(new ye(this.tileID.overscaledZ),m))continue;let y=i.getId(m,o),g=new vn(m,u,c,p,y);g.tile=h,e.push(g)}}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=nb(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(),n=!1;if(this.expirationTime>i)n=!1;else if(!t)n=!0;else if(this.expirationTime<t)n=!0;else{let o=this.expirationTime-t;o?this.expirationTime=i+Math.max(o,oL):n=!0}n?(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 n in this.buckets){if(!t.style.hasLayer(n))continue;let o=this.buckets[n],a=o.layers[0].sourceLayer||"_geojsonTileLayer",s=i[a],u=e[a];if(!s||!u||Object.keys(u).length===0)continue;o.update(u,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let c=t&&t.style&&t.style.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Y.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Y.now()+e}setDependencies(e,t){let i={};for(let n of t)i[n]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let n=this.dependencies[i];if(n){for(let o of t)if(n[o])return!0}}return!1}};l(Rd,"Tile");var wn=Rd;d();var Bd=class Bd{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 n=e.wrapped().key;this.data[n]===void 0&&(this.data[n]=[]);let o={value:t,timeout:void 0};if(i!==void 0&&(o.timeout=setTimeout(()=>{this.remove(e,o)},i)),this.data[n].push(o),this.order.push(n),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,n=t===void 0?0:this.data[i].indexOf(t),o=this.data[i][n];return this.data[i].splice(n,1),o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(o.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 n of this.data[i])e(n.value)||t.push(n);for(let i of t)this.remove(i.value.tileID,i)}};l(Bd,"TileCache");var vu=Bd;var Vd=ae(ge(),1);d();var Od=class Od{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,i){let n=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},V(this.stateChanges[e][n],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let o in this.state[e])o!==n&&(this.deletedStates[e][o]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][n]===null){this.deletedStates[e][n]={};for(let a in this.state[e][n])i[a]||(this.deletedStates[e][n][a]=null)}else for(let a in i)this.deletedStates[e]&&this.deletedStates[e][n]&&this.deletedStates[e][n][a]===null&&delete this.deletedStates[e][n][a]}removeFeatureState(e,t,i){if(this.deletedStates[e]===null)return;let o=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&t!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][i]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o]){this.deletedStates[e][o]={};for(i in this.stateChanges[e][o])this.deletedStates[e][o][i]=null}else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),n=this.state[e]||{},o=this.stateChanges[e]||{},a=V({},n[i],o[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let s=this.deletedStates[e][t];if(s===null)return{};for(let u in s)delete a[u]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let i={};for(let n in this.stateChanges){this.state[n]=this.state[n]||{};let o={};for(let a in this.stateChanges[n])this.state[n][a]||(this.state[n][a]={}),V(this.state[n][a],this.stateChanges[n][a]),o[a]=this.state[n][a];i[n]=o}for(let n in this.deletedStates){this.state[n]=this.state[n]||{};let o={};if(this.deletedStates[n]===null)for(let a in this.state[n])o[a]={},this.state[n][a]={};else for(let a in this.deletedStates[n]){if(this.deletedStates[n][a]===null)this.state[n][a]={};else for(let u of Object.keys(this.deletedStates[n][a]))delete this.state[n][a][u];o[a]=this.state[n][a]}i[n]=i[n]||{},V(i[n],o)}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length!==0)for(let n in e)e[n].setFeatureState(i,t)}};l(Od,"SourceFeatureState");var wu=Od;var wi=class wi extends de{constructor(e,t,i){super(),this.id=e,this.dispatcher=i,this.on("data",n=>this._dataHandler(n)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=s1(e,t,i,this),this._tiles={},this._cache=new vu(0,n=>this._unloadTile(n)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new wu,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}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 e in this._tiles){let t=this._tiles[e];if(t.state!=="loaded"&&t.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,t,i){try{await this._source.loadTile(e),this._tileLoaded(e,t,i)}catch(n){e.state="errored",n.status!==404?this._source.fire(new H(n,{tile:e})):this.update(this.transform,this.terrain)}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new F("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let t in this._tiles){let i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(m1).map(e=>e.key)}getRenderableIds(e){let t=[];for(let i in this._tiles)this._isIdRenderable(i,e)&&t.push(this._tiles[i]);return e?t.sort((i,n)=>{let o=i.tileID,a=n.tileID,s=new Vd.default(o.canonical.x,o.canonical.y)._rotate(this.transform.angle),u=new Vd.default(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return o.overscaledZ-a.overscaledZ||u.y-s.y||u.x-s.x}).map(i=>i.tileID.key):t.map(i=>i.tileID).sort(m1).map(i=>i.key)}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return t?this._isIdRenderable(t.tileID.key):!1}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}async _reloadTile(e,t){let i=this._tiles[e];i&&(i.state!=="loading"&&(i.state=t),await this._loadTile(i,e,t))}_tileLoaded(e,t,i){e.timeAdded=Y.now(),i==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new F("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let n=0;n<t.length;n++){let o=t[n];if(e.neighboringTiles&&e.neighboringTiles[o]){let a=this.getTileByID(o);i(e,a),i(a,e)}}function i(n,o){n.needsHillshadePrepare=!0,n.needsTerrainPrepare=!0;let a=o.tileID.canonical.x-n.tileID.canonical.x,s=o.tileID.canonical.y-n.tileID.canonical.y,u=Math.pow(2,n.tileID.canonical.z),c=o.tileID.key;a===0&&s===0||Math.abs(s)>1||(Math.abs(a)>1&&(Math.abs(a+u)===1?a+=u:Math.abs(a-u)===1&&(a-=u)),!(!o.dem||!n.dem)&&(n.dem.backfillBorder(o.dem,a,s),n.neighboringTiles&&n.neighboringTiles[c]&&(n.neighboringTiles[c].backfilled=!0)))}l(i,"fillBorder")}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,n){for(let o in this._tiles){let a=this._tiles[o];if(n[o]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>i)continue;let s=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){let c=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[c.key],a&&a.hasData()&&(s=c)}let u=s;for(;u.overscaledZ>t;)if(u=u.scaledTo(u.overscaledZ-1),e[u.key]){n[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){let n=e.scaledTo(i),o=this._getLoadedTile(n);if(o)return o}}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let t=Math.ceil(e.width/this._source.tileSize)+1,i=Math.ceil(e.height/this._source.tileSize)+1,n=t*i,o=this._maxTileCacheZoomLevels===null?Ke.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(n*o),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(s)}handleWrapJump(e){let t=this._prevLng===void 0?e:this._prevLng,n=(e-t)/360,o=Math.round(n);if(this._prevLng=e,o){let a={};for(let s in this._tiles){let u=this._tiles[s];u.tileID=u.tileID.unwrapTo(u.tileID.wrap+o),a[u.tileID.key]=u}this._tiles=a;for(let s in this._timers)clearTimeout(this._timers[s]),delete this._timers[s];for(let s in this._tiles){let u=this._tiles[s];this._setTileReloadTimer(s,u)}}}update(e,t){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let i;!this.used&&!this.usedForTerrain?i=[]:this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(p=>new Je(p.canonical.z,p.wrap,p.canonical.z,p.canonical.x,p.canonical.y)):(i=e.coveringTiles({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:t}),this._source.hasTile&&(i=i.filter(p=>this._source.hasTile(p))));let n=e.coveringZoomLevel(this._source),o=Math.max(n-wi.maxOverzooming,this._source.minzoom),a=Math.max(n+wi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let p={};for(let h of i)if(h.canonical.z>this._source.minzoom){let f=h.scaledTo(h.canonical.z-1);p[f.key]=f;let m=h.scaledTo(Math.max(this._source.minzoom,Math.min(h.canonical.z,5)));p[m.key]=m}i=i.concat(Object.values(p))}let s=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new F("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let u=this._updateRetainedTiles(i,n);if(d1(this._source.type)){let p={},h={},f=Object.keys(u),m=Y.now();for(let y of f){let g=u[y],x=this._tiles[y];if(!x||x.fadeEndTime!==0&&x.fadeEndTime<=m)continue;let b=this.findLoadedParent(g,o);b&&(this._addTile(b.tileID),p[b.tileID.key]=b.tileID),h[y]=g}this._retainLoadedChildren(h,n,a,u);for(let y in p)u[y]||(this._coveredTiles[y]=!0,u[y]=p[y]);if(t){let y={},g={};for(let x of i)this._tiles[x.key].hasData()?y[x.key]=x:g[x.key]=x;for(let x in g){let b=g[x].children(this._source.maxzoom);this._tiles[b[0].key]&&this._tiles[b[1].key]&&this._tiles[b[2].key]&&this._tiles[b[3].key]&&(y[b[0].key]=u[b[0].key]=b[0],y[b[1].key]=u[b[1].key]=b[1],y[b[2].key]=u[b[2].key]=b[2],y[b[3].key]=u[b[3].key]=b[3],delete g[x])}for(let x in g){let b=this.findLoadedParent(g[x],this._source.minzoom);if(b){y[b.tileID.key]=u[b.tileID.key]=b.tileID;for(let w in y)y[w].isChildOf(b.tileID)&&delete y[w]}}for(let x in this._tiles)y[x]||(this._coveredTiles[x]=!0)}}for(let p in u)this._tiles[p].clearFadeHold();let c=Jx(this._tiles,u);for(let p of c){let h=this._tiles[p];h.hasSymbolBuckets&&!h.holdingForFade()?h.setHoldDuration(this.map._fadeDuration):(!h.hasSymbolBuckets||h.symbolFadeFinished())&&this._removeTile(p)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let i={},n={},o=Math.max(t-wi.maxOverzooming,this._source.minzoom),a=Math.max(t+wi.maxUnderzooming,this._source.minzoom),s={};for(let u of e){let c=this._addTile(u);i[u.key]=u,!c.hasData()&&t<this._source.maxzoom&&(s[u.key]=u)}this._retainLoadedChildren(s,t,a,i);for(let u of e){let c=this._tiles[u.key];if(c.hasData())continue;if(t+1>this._source.maxzoom){let h=u.children(this._source.maxzoom)[0],f=this.getTile(h);if(f&&f.hasData()){i[h.key]=h;continue}}else{let h=u.children(this._source.maxzoom);if(i[h[0].key]&&i[h[1].key]&&i[h[2].key]&&i[h[3].key])continue}let p=c.wasRequested();for(let h=u.overscaledZ-1;h>=o;--h){let f=u.scaledTo(h);if(n[f.key])break;if(n[f.key]=!0,c=this.getTile(f),!c&&p&&(c=this._addTile(f)),c){let m=c.hasData();if((p||m)&&(i[f.key]=f),p=c.wasRequested(),m)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t=[],i,n=this._tiles[e].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}t.push(n.key);let o=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(o),i)break;n=o}for(let o of t)this._loadedParentTiles[o]=i}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));let i=t;return t||(t=new wn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state)),t.uses++,this._tiles[e.key]=t,i||this._source.fire(new F("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(t.uses>0)&&(t.hasData()&&t.state!=="reloading"?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){let t=e.sourceDataType;e.dataType==="source"&&t==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&t==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,t,i){let n=[],o=this.transform;if(!o)return n;let a=i?o.getCameraQueryGeometry(e):e,s=e.map(y=>o.pointCoordinate(y,this.terrain)),u=a.map(y=>o.pointCoordinate(y,this.terrain)),c=this.getIds(),p=1/0,h=1/0,f=-1/0,m=-1/0;for(let y of u)p=Math.min(p,y.x),h=Math.min(h,y.y),f=Math.max(f,y.x),m=Math.max(m,y.y);for(let y=0;y<c.length;y++){let g=this._tiles[c[y]];if(g.holdingForFade())continue;let x=g.tileID,b=Math.pow(2,o.zoom-g.tileID.overscaledZ),w=t*g.queryPadding*8192/g.tileSize/b,_=[x.getTilePoint(new Fe(p,h)),x.getTilePoint(new Fe(f,m))];if(_[0].x-w<8192&&_[0].y-w<8192&&_[1].x+w>=0&&_[1].y+w>=0){let S=s.map(T=>x.getTilePoint(T)),P=u.map(T=>x.getTilePoint(T));n.push({tile:g,tileID:x,queryGeometry:S,cameraQueryGeometry:P,scale:b})}}return n}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(i=>this._tiles[i].tileID);for(let i of t)i.posMatrix=this.transform.calculatePosMatrix(i.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(d1(this._source.type)){let e=Y.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,i){e=e||"_geojsonTileLayer",this._state.updateState(e,t,i)}removeFeatureState(e,t,i){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,t,i)}getFeatureState(e,t){return e=e||"_geojsonTileLayer",this._state.getState(e,t)}setDependencies(e,t,i){let n=this._tiles[e];n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(let i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(e,t))}};l(wi,"SourceCache");var cr=wi;cr.maxOverzooming=10;cr.maxUnderzooming=3;function m1(r,e){let t=Math.abs(r.wrap*2)-+(r.wrap<0),i=Math.abs(e.wrap*2)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||i-t||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x}l(m1,"compareTileId");function d1(r){return r==="raster"||r==="image"||r==="video"}l(d1,"isRasterType");d();d();d();var $t=ae(ge(),1);d();var pr=ae(ge(),1);function Ud(r,e,t,i,n){let o=[];for(let a=0;a<r.length;a++){let s=r[a],u;for(let c=0;c<s.length-1;c++){let p=s[c],h=s[c+1];p.x<e&&h.x<e||(p.x<e?p=new pr.default(e,p.y+(h.y-p.y)*((e-p.x)/(h.x-p.x)))._round():h.x<e&&(h=new pr.default(e,p.y+(h.y-p.y)*((e-p.x)/(h.x-p.x)))._round()),!(p.y<t&&h.y<t)&&(p.y<t?p=new pr.default(p.x+(h.x-p.x)*((t-p.y)/(h.y-p.y)),t)._round():h.y<t&&(h=new pr.default(p.x+(h.x-p.x)*((t-p.y)/(h.y-p.y)),t)._round()),!(p.x>=i&&h.x>=i)&&(p.x>=i?p=new pr.default(i,p.y+(h.y-p.y)*((i-p.x)/(h.x-p.x)))._round():h.x>=i&&(h=new pr.default(i,p.y+(h.y-p.y)*((i-p.x)/(h.x-p.x)))._round()),!(p.y>=n&&h.y>=n)&&(p.y>=n?p=new pr.default(p.x+(h.x-p.x)*((n-p.y)/(h.y-p.y)),n)._round():h.y>=n&&(h=new pr.default(p.x+(h.x-p.x)*((n-p.y)/(h.y-p.y)),n)._round()),(!u||!p.equals(u[u.length-1]))&&(u=[p],o.push(u)),u.push(h)))))}}return o}l(Ud,"clipLine");d();var Nd=class Nd{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=Ae(e,0,1);let t=1,i=this._distances[t],n=e*this.paddedLength+this.padding;for(;i<n&&t<this._distances.length;)i=this._distances[++t];let o=t-1,a=this._distances[o],s=i-a,u=s>0?(n-a)/s:0;return this.points[o].mult(1-u).add(this.points[t].mult(u))}};l(Nd,"PathInterpolator");var Su=Nd;d();function Pu(r,e){let t=!0;return r==="always"||(r==="never"||e==="never")&&(t=!1),t}l(Pu,"overlapAllowed");var Gd=class Gd{constructor(e,t,i){let n=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let a=0;a<this.xCellCount*this.yCellCount;a++)n.push([]),o.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,n,o){this._forEachCell(t,i,n,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)}insertCircle(e,t,i,n){this._forEachCell(t-n,i-n,t+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(n)}_insertBoxCell(e,t,i,n,o,a){this.boxCells[o].push(a)}_insertCircleCell(e,t,i,n,o,a){this.circleCells[o].push(a)}_query(e,t,i,n,o,a,s){if(i<0||e>this.width||n<0||t>this.height)return[];let u=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(o)return[{key:null,x1:e,y1:t,x2:i,y2:n}];for(let c=0;c<this.boxKeys.length;c++)u.push({key:this.boxKeys[c],x1:this.bboxes[c*4],y1:this.bboxes[c*4+1],x2:this.bboxes[c*4+2],y2:this.bboxes[c*4+3]});for(let c=0;c<this.circleKeys.length;c++){let p=this.circles[c*3],h=this.circles[c*3+1],f=this.circles[c*3+2];u.push({key:this.circleKeys[c],x1:p-f,y1:h-f,x2:p+f,y2:h+f})}}else{let c={hitTest:o,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,n,this._queryCell,u,c,s)}return u}query(e,t,i,n){return this._query(e,t,i,n,!1,null)}hitTest(e,t,i,n,o,a){return this._query(e,t,i,n,!0,o,a).length>0}hitTestCircle(e,t,i,n,o){let a=e-i,s=e+i,u=t-i,c=t+i;if(s<0||a>this.width||c<0||u>this.height)return!1;let p=[],h={hitTest:!0,overlapMode:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(a,u,s,c,this._queryCellCircle,p,h,o),p.length>0}_queryCell(e,t,i,n,o,a,s,u){let{seenUids:c,hitTest:p,overlapMode:h}=s,f=this.boxCells[o];if(f!==null){let y=this.bboxes;for(let g of f)if(!c.box[g]){c.box[g]=!0;let x=g*4,b=this.boxKeys[g];if(e<=y[x+2]&&t<=y[x+3]&&i>=y[x+0]&&n>=y[x+1]&&(!u||u(b))&&(!p||!Pu(h,b.overlapMode))&&(a.push({key:b,x1:y[x],y1:y[x+1],x2:y[x+2],y2:y[x+3]}),p))return!0}}let m=this.circleCells[o];if(m!==null){let y=this.circles;for(let g of m)if(!c.circle[g]){c.circle[g]=!0;let x=g*3,b=this.circleKeys[g];if(this._circleAndRectCollide(y[x],y[x+1],y[x+2],e,t,i,n)&&(!u||u(b))&&(!p||!Pu(h,b.overlapMode))){let w=y[x],_=y[x+1],S=y[x+2];if(a.push({key:b,x1:w-S,y1:_-S,x2:w+S,y2:_+S}),p)return!0}}}return!1}_queryCellCircle(e,t,i,n,o,a,s,u){let{circle:c,seenUids:p,overlapMode:h}=s,f=this.boxCells[o];if(f!==null){let y=this.bboxes;for(let g of f)if(!p.box[g]){p.box[g]=!0;let x=g*4,b=this.boxKeys[g];if(this._circleAndRectCollide(c.x,c.y,c.radius,y[x+0],y[x+1],y[x+2],y[x+3])&&(!u||u(b))&&!Pu(h,b.overlapMode))return a.push(!0),!0}}let m=this.circleCells[o];if(m!==null){let y=this.circles;for(let g of m)if(!p.circle[g]){p.circle[g]=!0;let x=g*3,b=this.circleKeys[g];if(this._circlesCollide(y[x],y[x+1],y[x+2],c.x,c.y,c.radius)&&(!u||u(b))&&!Pu(h,b.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,i,n,o,a,s,u){let c=this._convertToXCellCoord(e),p=this._convertToYCellCoord(t),h=this._convertToXCellCoord(i),f=this._convertToYCellCoord(n);for(let m=c;m<=h;m++)for(let y=p;y<=f;y++){let g=this.xCellCount*y+m;if(o.call(this,e,t,i,n,g,a,s,u))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,n,o,a){let s=n-e,u=o-t,c=i+a;return c*c>s*s+u*u}_circleAndRectCollide(e,t,i,n,o,a,s){let u=(a-n)/2,c=Math.abs(e-(n+u));if(c>u+i)return!1;let p=(s-o)/2,h=Math.abs(t-(o+p));if(h>p+i)return!1;if(c<=u||h<=p)return!0;let f=c-u,m=h-p;return f*f+m*m<=i*i}};l(Gd,"GridIndex");var xa=Gd;d();var Sn=ae(ge(),1);function ba(r,e,t,i,n){let o=q.create();return e?(q.scale(o,o,[1/n,1/n,1]),t||q.rotateZ(o,o,i.angle)):q.multiply(o,i.labelPlaneMatrix,r),o}l(ba,"getLabelPlaneMatrix");function Mu(r,e,t,i,n){if(e){let o=q.clone(r);return q.scale(o,o,[n,n,1]),t||q.rotateZ(o,o,-i.angle),o}else return i.glCoordMatrix}l(Mu,"getGlCoordMatrix");function bt(r,e,t){let i;t?(i=[r.x,r.y,t(r.x,r.y),1],qe.transformMat4(i,i,e)):(i=[r.x,r.y,0,1],Au(i,i,e));let n=i[3];return{point:new Sn.default(i[0]/n,i[1]/n),signedDistanceFromCamera:n}}l(bt,"project");function _a(r,e){return .5+.5*(r/e)}l(_a,"getPerspectiveRatio");function aL(r,e){let t=r[0]/r[3],i=r[1]/r[3];return t>=-e[0]&&t<=e[0]&&i>=-e[1]&&i<=e[1]}l(aL,"isVisible");function x1(r,e,t,i,n,o,a,s,u,c){let p=i?r.textSizeData:r.iconSizeData,h=gi(p,t.transform.zoom),f=[256/t.width*2+1,256/t.height*2+1],m=i?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;m.clear();let y=r.lineVertexArray,g=i?r.text.placedSymbolArray:r.icon.placedSymbolArray,x=t.transform.width/t.transform.height,b=!1;for(let w=0;w<g.length;w++){let _=g.get(w);if(_.hidden||_.writingMode===2&&!b){Si(_.numGlyphs,m);continue}b=!1;let S;if(c?(S=[_.anchorX,_.anchorY,c(_.anchorX,_.anchorY),1],qe.transformMat4(S,S,e)):(S=[_.anchorX,_.anchorY,0,1],Au(S,S,e)),!aL(S,f)){Si(_.numGlyphs,m);continue}let P=S[3],T=_a(t.transform.cameraToCenterDistance,P),L=dn(p,h,_),C=a?L/T:L*T,E=new Sn.default(_.anchorX,_.anchorY),I=bt(E,n,c).point,R={projections:{},offsets:{}},z=g1(_,C,!1,s,e,n,o,r.glyphOffsetArray,y,m,I,E,R,x,u,c);b=z.useVertical,(z.notEnoughRoom||b||z.needsFlipping&&g1(_,C,!0,s,e,n,o,r.glyphOffsetArray,y,m,I,E,R,x,u,c).notEnoughRoom)&&Si(_.numGlyphs,m)}i?r.text.dynamicLayoutVertexBuffer.updateData(m):r.icon.dynamicLayoutVertexBuffer.updateData(m)}l(x1,"updateLineLabels");function Zd(r,e,t,i,n,o,a,s,u,c,p,h,f){let m=s.glyphStartIndex+s.numGlyphs,y=s.lineStartIndex,g=s.lineStartIndex+s.lineLength,x=e.getoffsetX(s.glyphStartIndex),b=e.getoffsetX(m-1),w=Tu(r*x,t,i,n,o,a,s.segment,y,g,u,c,p,h,f);if(!w)return null;let _=Tu(r*b,t,i,n,o,a,s.segment,y,g,u,c,p,h,f);return _?{first:w,last:_}:null}l(Zd,"placeFirstAndLastGlyph");function y1(r,e,t,i){if(r===1){let n=Math.abs(t.y-e.y),o=Math.abs(t.x-e.x)*i;if(n>o)return{useVertical:!0}}return(r===2?e.y<t.y:e.x>t.x)?{needsFlipping:!0}:null}l(y1,"requiresOrientationChange");function g1(r,e,t,i,n,o,a,s,u,c,p,h,f,m,y,g){let x=e/24,b=r.lineOffsetX*x,w=r.lineOffsetY*x,_;if(r.numGlyphs>1){let S=r.glyphStartIndex+r.numGlyphs,P=r.lineStartIndex,T=r.lineStartIndex+r.lineLength,L=Zd(x,s,b,w,t,p,h,r,u,o,f,y,g);if(!L)return{notEnoughRoom:!0};let C=bt(L.first.point,a,g).point,E=bt(L.last.point,a,g).point;if(i&&!t){let I=y1(r.writingMode,C,E,m);if(I)return I}_=[L.first];for(let I=r.glyphStartIndex+1;I<S-1;I++){let R=Tu(x*s.getoffsetX(I),b,w,t,p,h,r.segment,P,T,u,o,f,y,g);if(R==null)return{notEnoughRoom:!0};_.push(R)}_.push(L.last)}else{if(i&&!t){let P=bt(h,n,g).point,T=r.lineStartIndex+r.segment+1,L=new Sn.default(u.getx(T),u.gety(T)),C=bt(L,n,g),E=C.signedDistanceFromCamera>0?C.point:b1(h,L,P,1,n,g),I=y1(r.writingMode,P,E,m);if(I)return I}let S=Tu(x*s.getoffsetX(r.glyphStartIndex),b,w,t,p,h,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,u,o,f,y,g);if(!S)return{notEnoughRoom:!0};_=[S]}for(let S of _)xi(c,S.point,S.angle);return{}}l(g1,"placeGlyphsAlongLine");function b1(r,e,t,i,n,o){let a=bt(r.add(r.sub(e)._unit()),n,o).point,s=t.sub(a);return t.add(s._mult(i/s.mag()))}l(b1,"projectTruncatedLineSegment");function qd(r,e){let{projectionCache:t,lineVertexArray:i,labelPlaneMatrix:n,tileAnchorPoint:o,distanceFromAnchor:a,getElevation:s,previousVertex:u,direction:c,absOffsetX:p}=e;if(t.projections[r])return t.projections[r];let h=new Sn.default(i.getx(r),i.gety(r)),f=bt(h,n,s);if(f.signedDistanceFromCamera>0)return t.projections[r]=f.point,f.point;let m=r-c,y=a===0?o:new Sn.default(i.getx(m),i.gety(m));return b1(y,h,u,p-a+1,n,s)}l(qd,"projectVertexToViewport");function jd(r,e,t){return r._unit()._perp()._mult(e*t)}l(jd,"transformToOffsetNormal");function sL(r,e,t,i,n,o,a,s){let{projectionCache:u,direction:c}=s;if(u.offsets[r])return u.offsets[r];let p=t.add(e);if(r+c<i||r+c>=n)return u.offsets[r]=p,p;let h=qd(r+c,s),f=jd(h.sub(t),a,c),m=t.add(f),y=h.add(f);return u.offsets[r]=tb(o,p,m,y)||p,u.offsets[r]}l(sL,"findOffsetIntersectionPoint");function Tu(r,e,t,i,n,o,a,s,u,c,p,h,f,m){let y=i?r-e:r+e,g=y>0?1:-1,x=0;i&&(g*=-1,x=Math.PI),g<0&&(x+=Math.PI);let b=g>0?s+a:s+a+1,w=n,_=n,S,P,T=0,L=0,C=Math.abs(y),E=[],I;for(;T+L<=C;){if(b+=g,b<s||b>=u)return null;T+=L,_=w,P=S;let M={projectionCache:h,lineVertexArray:c,labelPlaneMatrix:p,tileAnchorPoint:o,distanceFromAnchor:T,getElevation:m,previousVertex:_,direction:g,absOffsetX:C};if(w=qd(b,M),t===0)E.push(_),I=w.sub(_);else{let G,K=w.sub(_);if(K.mag()===0){let ne=qd(b+g,M);G=jd(ne.sub(w),t,g)}else G=jd(K,t,g);P||(P=_.add(G)),S=sL(b,G,w,s,u,P,t,M),E.push(P),I=S.sub(P)}L=I.mag()}let R=(C-T)/L,z=I._mult(R)._add(P||_),k=x+Math.atan2(w.y-_.y,w.x-_.x);return E.push(z),{point:z,angle:f?k:0,path:E}}l(Tu,"placeGlyphAlongLine");var lL=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Si(r,e){for(let t=0;t<r;t++){let i=e.length;e.resize(i+4),e.float32.set(lL,i*3)}}l(Si,"hideGlyphs");function Au(r,e,t){let i=e[0],n=e[1];return r[0]=t[0]*i+t[4]*n+t[12],r[1]=t[1]*i+t[5]*n+t[13],r[3]=t[3]*i+t[7]*n+t[15],r}l(Au,"xyTransformMat4");var Xe=100,$d=class $d{constructor(e,t=new xa(e.width+2*Xe,e.height+2*Xe,25),i=new xa(e.width+2*Xe,e.height+2*Xe,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Xe,this.screenBottomBoundary=e.height+Xe,this.gridRightBoundary=e.width+2*Xe,this.gridBottomBoundary=e.height+2*Xe,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,n,o,a){let s=this.projectAndGetPerspectiveRatio(n,e.anchorPointX,e.anchorPointY,a),u=i*s.perspectiveRatio,c=e.x1*u+s.point.x,p=e.y1*u+s.point.y,h=e.x2*u+s.point.x,f=e.y2*u+s.point.y;return!this.isInsideGrid(c,p,h,f)||t!=="always"&&this.grid.hitTest(c,p,h,f,t,o)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[c,p,h,f],offscreen:this.isOffscreen(c,p,h,f)}}placeCollisionCircles(e,t,i,n,o,a,s,u,c,p,h,f,m,y){let g=[],x=new $t.default(t.anchorX,t.anchorY),b=bt(x,a,y),w=_a(this.transform.cameraToCenterDistance,b.signedDistanceFromCamera),S=(p?o/w:o*w)/Dr,P=bt(x,s,y).point,T={projections:{},offsets:{}},L=t.lineOffsetX*S,C=t.lineOffsetY*S,E=Zd(S,n,L,C,!1,P,x,t,i,s,T,!1,y),I=!1,R=!1,z=!0;if(E){let k=f*.5*w+m,M=new $t.default(-Xe,-Xe),G=new $t.default(this.screenRightBoundary,this.screenBottomBoundary),K=new Su,ne=E.first,J=E.last,W=[];for(let ce=ne.path.length-1;ce>=1;ce--)W.push(ne.path[ce]);for(let ce=1;ce<J.path.length;ce++)W.push(J.path[ce]);let Ye=k*2.5;if(u){let ce=W.map(Me=>bt(Me,u,y));ce.some(Me=>Me.signedDistanceFromCamera<=0)?W=[]:W=ce.map(Me=>Me.point)}let Ve=[];if(W.length>0){let ce=W[0].clone(),Me=W[0].clone();for(let Qe=1;Qe<W.length;Qe++)ce.x=Math.min(ce.x,W[Qe].x),ce.y=Math.min(ce.y,W[Qe].y),Me.x=Math.max(Me.x,W[Qe].x),Me.y=Math.max(Me.y,W[Qe].y);ce.x>=M.x&&Me.x<=G.x&&ce.y>=M.y&&Me.y<=G.y?Ve=[W]:Me.x<M.x||ce.x>G.x||Me.y<M.y||ce.y>G.y?Ve=[]:Ve=Ud([W],M.x,M.y,G.x,G.y)}for(let ce of Ve){K.reset(ce,k*.25);let Me=0;K.length<=.5*k?Me=1:Me=Math.ceil(K.paddedLength/Ye)+1;for(let Qe=0;Qe<Me;Qe++){let mr=Qe/Math.max(Me-1,1),dr=K.lerp(mr),zt=dr.x+Xe,Xt=dr.y+Xe;g.push(zt,Xt,k,0);let Gr=zt-k,Kt=Xt-k,Jt=zt+k,et=Xt+k;if(z=z&&this.isOffscreen(Gr,Kt,Jt,et),R=R||this.isInsideGrid(Gr,Kt,Jt,et),e!=="always"&&this.grid.hitTestCircle(zt,Xt,k,e,h)&&(I=!0,!c))return{circles:[],offscreen:!1,collisionDetected:I}}}}return{circles:!c&&I||!R||w<this.perspectiveRatioCutoff?[]:g,offscreen:z,collisionDetected:I}}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=1/0,n=1/0,o=-1/0,a=-1/0;for(let p of e){let h=new $t.default(p.x+Xe,p.y+Xe);i=Math.min(i,h.x),n=Math.min(n,h.y),o=Math.max(o,h.x),a=Math.max(a,h.y),t.push(h)}let s=this.grid.query(i,n,o,a).concat(this.ignoredGrid.query(i,n,o,a)),u={},c={};for(let p of s){let h=p.key;if(u[h.bucketInstanceId]===void 0&&(u[h.bucketInstanceId]={}),u[h.bucketInstanceId][h.featureIndex])continue;let f=[new $t.default(p.x1,p.y1),new $t.default(p.x2,p.y1),new $t.default(p.x2,p.y2),new $t.default(p.x1,p.y2)];El(t,f)&&(u[h.bucketInstanceId][h.featureIndex]=!0,c[h.bucketInstanceId]===void 0&&(c[h.bucketInstanceId]=[]),c[h.bucketInstanceId].push(h.featureIndex))}return c}insertCollisionBox(e,t,i,n,o,a){let s=i?this.ignoredGrid:this.grid,u={bucketInstanceId:n,featureIndex:o,collisionGroupID:a,overlapMode:t};s.insert(u,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,n,o,a){let s=i?this.ignoredGrid:this.grid,u={bucketInstanceId:n,featureIndex:o,collisionGroupID:a,overlapMode:t};for(let c=0;c<e.length;c+=4)s.insertCircle(u,e[c],e[c+1],e[c+2])}projectAndGetPerspectiveRatio(e,t,i,n){let o;return n?(o=[t,i,n(t,i),1],qe.transformMat4(o,o,e)):(o=[t,i,0,1],Au(o,o,e)),{point:new $t.default((o[0]/o[3]+1)/2*this.transform.width+Xe,(-o[1]/o[3]+1)/2*this.transform.height+Xe),perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o[3])}}isOffscreen(e,t,i,n){return i<Xe||e>=this.screenRightBoundary||n<Xe||t>this.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e<this.gridRightBoundary&&n>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=q.identity([]);return q.translate(e,e,[-Xe,-Xe,0]),e}};l($d,"CollisionIndex");var Iu=$d;d();d();var _1=ae(ge(),1);var Cu=class Cu extends _1.default{constructor(e,t,i,n){super(e,t),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new Cu(this.x,this.y,this.angle,this.segment)}};l(Cu,"Anchor");var va=Cu;N("Anchor",va);d();d();d();var uL=ae(ge(),1);d();var cL=ae(ge(),1);d();var pL=ae(_2(),1),hL=ae(ge(),1);var mL=ae(Yf(),1);d();var wa=(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))(wa||{});var fL=Number.POSITIVE_INFINITY;function v1(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}l(v1,"getAnchorJustification");d();function $e(r,e,t){return e*(8192/(r.tileSize*Math.pow(2,t-r.tileID.overscaledZ)))}l($e,"pixelsToTileUnits");var zu=ae(ge(),1);var Yd=class Yd{constructor(e,t,i,n){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):this.opacity=n&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}};l(Yd,"OpacityState");var ku=Yd,Qd=class Qd{constructor(e,t,i,n,o){this.text=new ku(e?e.text:null,t,i,o),this.icon=new ku(e?e.icon:null,t,n,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}};l(Qd,"JointOpacityState");var Pi=Qd,ey=class ey{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}};l(ey,"JointPlacement");var Lu=ey,ty=class ty{constructor(){this.invProjMatrix=q.create(),this.viewportMatrix=q.create(),this.circles=[]}};l(ty,"CollisionCircleArray");var Xd=ty,ry=class ry{constructor(e,t,i,n,o){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=o}};l(ry,"RetainedQueryData");var Kd=ry,iy=class iy{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:l(i=>i.collisionGroupID===t,"predicate")}}return this.collisionGroups[e]}};l(iy,"CollisionGroups");var Jd=iy;function w1(r,e,t,i,n){let{horizontalAlign:o,verticalAlign:a}=Jl(r),s=-(o-.5)*e,u=-(a-.5)*t;return new zu.default(s+i[0]*n,u+i[1]*n)}l(w1,"calculateVariableLayoutShift");function Wd(r,e,t,i,n,o){let{x1:a,x2:s,y1:u,y2:c,anchorPointX:p,anchorPointY:h}=r,f=new zu.default(e,t);return i&&f._rotate(n?o:-o),{x1:a+f.x,y1:u+f.y,x2:s+f.x,y2:c+f.y,anchorPointX:p,anchorPointY:h}}l(Wd,"shiftVariableCollisionBox");var ny=class ny{constructor(e,t,i,n,o){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Iu(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Jd(n),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,t,i,n){let o=i.getBucket(t),a=i.latestFeatureIndex;if(!o||!a||t.id!==o.layerIds[0])return;let s=i.collisionBoxArray,u=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),p=i.tileSize/8192,h=this.transform.calculatePosMatrix(i.tileID.toUnwrapped()),f=u.get("text-pitch-alignment")==="map",m=u.get("text-rotation-alignment")==="map",y=$e(i,1,this.transform.zoom),g=ba(h,f,m,this.transform,y),x=null;if(f){let w=Mu(h,f,m,this.transform,y);x=q.multiply([],this.transform.labelPlaneMatrix,w)}this.retainedQueryData[o.bucketInstanceId]=new Kd(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);let b={bucket:o,layout:u,posMatrix:h,textLabelPlaneMatrix:g,labelToScreenMatrix:x,scale:c,textPixelRatio:p,holdingForFade:i.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:gi(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(let w of o.sortKeyRanges){let{sortKey:_,symbolInstanceStart:S,symbolInstanceEnd:P}=w;e.push({sortKey:_,symbolInstanceStart:S,symbolInstanceEnd:P,parameters:b})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:b})}attemptAnchorPlacement(e,t,i,n,o,a,s,u,c,p,h,f,m,y,g,x){let b=wa[e.textAnchor],w=[e.textOffset0,e.textOffset1],_=w1(b,i,n,w,o),S=this.collisionIndex.placeCollisionBox(Wd(t,_.x,_.y,a,s,this.transform.angle),h,u,c,p.predicate,x);if(!(g&&this.collisionIndex.placeCollisionBox(Wd(g,_.x,_.y,a,s,this.transform.angle),h,u,c,p.predicate,x).box.length===0)&&S.box.length>0){let P;if(this.prevPlacement&&this.prevPlacement.variableOffsets[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID].text&&(P=this.prevPlacement.variableOffsets[f.crossTileID].anchor),f.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[f.crossTileID]={textOffset:w,width:i,height:n,anchor:b,textBoxScale:o,prevAnchor:P},this.markUsedJustification(m,b,f,y),m.allowVerticalPlacement&&(this.markUsedOrientation(m,y,f),this.placedOrientations[f.crossTileID]=y),{shift:_,placedGlyphBoxes:S}}}placeLayerBucketPart(e,t,i){let{bucket:n,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:u,textPixelRatio:c,holdingForFade:p,collisionBoxArray:h,partiallyEvaluatedTextSize:f,collisionGroup:m}=e.parameters,y=o.get("text-optional"),g=o.get("icon-optional"),x=yn(o,"text-overlap","text-allow-overlap"),b=x==="always",w=yn(o,"icon-overlap","icon-allow-overlap"),_=w==="always",S=o.get("text-rotation-alignment")==="map",P=o.get("text-pitch-alignment")==="map",T=o.get("icon-text-fit")!=="none",L=o.get("symbol-z-order")==="viewport-y",C=b&&(_||!n.hasIconData()||g),E=_&&(b||!n.hasTextData()||y);!n.collisionArrays&&h&&n.deserializeCollisionBoxes(h);let I=this.retainedQueryData[n.bucketInstanceId].tileID,R=this.terrain?(k,M)=>this.terrain.getElevation(I,k,M):null,z=l((k,M)=>{var Kt,Jt;if(t[k.crossTileID])return;if(p){this.placements[k.crossTileID]=new Lu(!1,!1,!1);return}let G=!1,K=!1,ne=!0,J=null,W={box:null,offscreen:null},Ye={box:null,offscreen:null},Ve=null,ce=null,Me=null,Qe=0,mr=0,dr=0;M.textFeatureIndex?Qe=M.textFeatureIndex:k.useRuntimeCollisionCircles&&(Qe=k.featureIndex),M.verticalTextFeatureIndex&&(mr=M.verticalTextFeatureIndex);let zt=M.textBox;if(zt){let et=l(Ze=>{let ct=1;if(n.allowVerticalPlacement&&!Ze&&this.prevPlacement){let Yt=this.prevPlacement.placedOrientations[k.crossTileID];Yt&&(this.placedOrientations[k.crossTileID]=Yt,ct=Yt,this.markUsedOrientation(n,ct,k))}return ct},"updatePreviousOrientationIfNotPlaced"),ot=l((Ze,ct)=>{if(n.allowVerticalPlacement&&k.numVerticalGlyphVertices>0&&M.verticalTextBox){for(let Yt of n.writingModes)if(Yt===2?(W=ct(),Ye=W):W=Ze(),W&&W.box&&W.box.length)break}else W=Ze()},"placeTextForPlacementModes"),tt=k.textAnchorOffsetStartIndex,qr=k.textAnchorOffsetEndIndex;if(qr===tt){let Ze=l((jr,es)=>{let rt=this.collisionIndex.placeCollisionBox(jr,x,c,a,m.predicate,R);return rt&&rt.box&&rt.box.length&&(this.markUsedOrientation(n,es,k),this.placedOrientations[k.crossTileID]=es),rt},"placeBox");ot(l(()=>Ze(zt,1),"placeHorizontal"),l(()=>{let jr=M.verticalTextBox;return n.allowVerticalPlacement&&k.numVerticalGlyphVertices>0&&jr?Ze(jr,2):{box:null,offscreen:null}},"placeVertical")),et(W&&W.box&&W.box.length)}else{let Ze=wa[(Jt=(Kt=this.prevPlacement)==null?void 0:Kt.variableOffsets[k.crossTileID])==null?void 0:Jt.anchor],ct=l((rt,yp,d2)=>{let y2=rt.x2-rt.x1,g2=rt.y2-rt.y1,x2=k.textBoxScale,b2=T&&w==="never"?yp:null,Ii={box:[],offscreen:!1},Ox=x==="never"?1:2,Vx="never";Ze&&Ox++;for(let Ux=0;Ux<Ox;Ux++){for(let gp=tt;gp<qr;gp++){let Nx=n.textAnchorOffsets.get(gp);if(Ze&&Nx.textAnchor!==Ze)continue;let xp=this.attemptAnchorPlacement(Nx,rt,y2,g2,x2,S,P,c,a,m,Vx,k,n,d2,b2,R);if(xp&&(Ii=xp.placedGlyphBoxes,Ii&&Ii.box&&Ii.box.length))return G=!0,J=xp.shift,Ii}Ze?Ze=null:Vx=x}return Ii},"placeBoxForVariableAnchors");ot(l(()=>ct(zt,M.iconBox,1),"placeHorizontal"),l(()=>{let rt=M.verticalTextBox,yp=W&&W.box&&W.box.length;return n.allowVerticalPlacement&&!yp&&k.numVerticalGlyphVertices>0&&rt?ct(rt,M.verticalIconBox,2):{box:null,offscreen:null}},"placeVertical")),W&&(G=W.box,ne=W.offscreen);let es=et(W&&W.box);if(!G&&this.prevPlacement){let rt=this.prevPlacement.variableOffsets[k.crossTileID];rt&&(this.variableOffsets[k.crossTileID]=rt,this.markUsedJustification(n,rt.anchor,k,es))}}}if(Ve=W,G=Ve&&Ve.box&&Ve.box.length>0,ne=Ve&&Ve.offscreen,k.useRuntimeCollisionCircles){let et=n.text.placedSymbolArray.get(k.centerJustifiedTextSymbolIndex),ot=dn(n.textSizeData,f,et),tt=o.get("text-padding"),qr=k.collisionCircleDiameter;ce=this.collisionIndex.placeCollisionCircles(x,et,n.lineVertexArray,n.glyphOffsetArray,ot,a,s,u,i,P,m.predicate,qr,tt,R),ce.circles.length&&ce.collisionDetected&&!i&&Le("Collisions detected, but collision boxes are not shown"),G=b||ce.circles.length>0&&!ce.collisionDetected,ne=ne&&ce.offscreen}if(M.iconFeatureIndex&&(dr=M.iconFeatureIndex),M.iconBox){let et=l(ot=>{let tt=T&&J?Wd(ot,J.x,J.y,S,P,this.transform.angle):ot;return this.collisionIndex.placeCollisionBox(tt,w,c,a,m.predicate,R)},"placeIconFeature");Ye&&Ye.box&&Ye.box.length&&M.verticalIconBox?(Me=et(M.verticalIconBox),K=Me.box.length>0):(Me=et(M.iconBox),K=Me.box.length>0),ne=ne&&Me.offscreen}let Xt=y||k.numHorizontalGlyphVertices===0&&k.numVerticalGlyphVertices===0,Gr=g||k.numIconVertices===0;if(!Xt&&!Gr?K=G=K&&G:Gr?Xt||(K=K&&G):G=K&&G,G&&Ve&&Ve.box&&(Ye&&Ye.box&&mr?this.collisionIndex.insertCollisionBox(Ve.box,x,o.get("text-ignore-placement"),n.bucketInstanceId,mr,m.ID):this.collisionIndex.insertCollisionBox(Ve.box,x,o.get("text-ignore-placement"),n.bucketInstanceId,Qe,m.ID)),K&&Me&&this.collisionIndex.insertCollisionBox(Me.box,w,o.get("icon-ignore-placement"),n.bucketInstanceId,dr,m.ID),ce&&(G&&this.collisionIndex.insertCollisionCircles(ce.circles,x,o.get("text-ignore-placement"),n.bucketInstanceId,Qe,m.ID),i)){let et=n.bucketInstanceId,ot=this.collisionCircleArrays[et];ot===void 0&&(ot=this.collisionCircleArrays[et]=new Xd);for(let tt=0;tt<ce.circles.length;tt+=4)ot.circles.push(ce.circles[tt+0]),ot.circles.push(ce.circles[tt+1]),ot.circles.push(ce.circles[tt+2]),ot.circles.push(ce.collisionDetected?1:0)}if(k.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(n.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[k.crossTileID]=new Lu(G||C,K||E,ne||n.justReloaded),t[k.crossTileID]=!0},"placeSymbol");if(L){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let k=n.getSortedSymbolIndexes(this.transform.angle);for(let M=k.length-1;M>=0;--M){let G=k[M];z(n.symbolInstances.get(G),n.collisionArrays[G])}}else for(let k=e.symbolInstanceStart;k<e.symbolInstanceEnd;k++)z(n.symbolInstances.get(k),n.collisionArrays[k]);if(i&&n.bucketInstanceId in this.collisionCircleArrays){let k=this.collisionCircleArrays[n.bucketInstanceId];q.invert(k.invProjMatrix,a),k.viewportMatrix=this.collisionIndex.getViewportMatrix()}n.justReloaded=!1}markUsedJustification(e,t,i,n){let o={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},a;n===2?a=i.verticalPlacedTextSymbolIndex:a=o[v1(t)];let s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let u of s)u>=0&&(a>=0&&u!==a?e.text.placedSymbolArray.get(u).crossTileID=0:e.text.placedSymbolArray.get(u).crossTileID=i.crossTileID)}markUsedOrientation(e,t,i){let n=t===1||t===3?t:0,o=t===2?t:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let s of a)e.text.placedSymbolArray.get(s).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}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 n=t?t.symbolFadeChange(e):1,o=t?t.opacities:{},a=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let u in this.placements){let c=this.placements[u],p=o[u];p?(this.opacities[u]=new Pi(p,n,c.text,c.icon),i=i||c.text!==p.text.placed||c.icon!==p.icon.placed):(this.opacities[u]=new Pi(null,n,c.text,c.icon,c.skipFade),i=i||c.text||c.icon)}for(let u in o){let c=o[u];if(!this.opacities[u]){let p=new Pi(c,n,!1,!1);p.isHidden()||(this.opacities[u]=p,i=i||c.text.placed||c.icon.placed)}}for(let u in a)!this.variableOffsets[u]&&this.opacities[u]&&!this.opacities[u].isHidden()&&(this.variableOffsets[u]=a[u]);for(let u in s)!this.placedOrientations[u]&&this.opacities[u]&&!this.opacities[u].isHidden()&&(this.placedOrientations[u]=s[u]);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 n of t){let o=n.getBucket(e);o&&n.latestFeatureIndex&&e.id===o.layerIds[0]&&this.updateBucketOpacities(o,i,n.collisionBoxArray)}}updateBucketOpacities(e,t,i){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],o=n.layout,a=new Pi(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),c=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),p=o.get("text-rotation-alignment")==="map",h=o.get("text-pitch-alignment")==="map",f=o.get("icon-text-fit")!=="none",m=new Pi(null,0,s&&(u||!e.hasIconData()||o.get("icon-optional")),u&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let y=l((g,x,b)=>{for(let w=0;w<x/4;w++)g.opacityVertexArray.emplaceBack(b);g.hasVisibleVertices=g.hasVisibleVertices||b!==Sa},"addOpacities");for(let g=0;g<e.symbolInstances.length;g++){let x=e.symbolInstances.get(g),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,crossTileID:_}=x,S=t[_],P=this.opacities[_];S?P=a:P||(P=m,this.opacities[_]=P),t[_]=!0;let T=b>0||w>0,L=x.numIconVertices>0,C=this.placedOrientations[x.crossTileID],E=C===2,I=C===1||C===3;if(T){let R=S1(P.text),z=E?Sa:R;y(e.text,b,z);let k=I?Sa:R;y(e.text,w,k);let M=P.text.isHidden();[x.rightJustifiedTextSymbolIndex,x.centerJustifiedTextSymbolIndex,x.leftJustifiedTextSymbolIndex].forEach(ne=>{ne>=0&&(e.text.placedSymbolArray.get(ne).hidden=M||E?1:0)}),x.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(x.verticalPlacedTextSymbolIndex).hidden=M||I?1:0);let G=this.variableOffsets[x.crossTileID];G&&this.markUsedJustification(e,G.anchor,x,C);let K=this.placedOrientations[x.crossTileID];K&&(this.markUsedJustification(e,"left",x,K),this.markUsedOrientation(e,K,x))}if(L){let R=S1(P.icon),z=!(f&&x.verticalPlacedIconSymbolIndex&&E);if(x.placedIconSymbolIndex>=0){let k=z?R:Sa;y(e.icon,x.numIconVertices,k),e.icon.placedSymbolArray.get(x.placedIconSymbolIndex).hidden=P.icon.isHidden()}if(x.verticalPlacedIconSymbolIndex>=0){let k=z?Sa:R;y(e.icon,x.numVerticalIconVertices,k),e.icon.placedSymbolArray.get(x.verticalPlacedIconSymbolIndex).hidden=P.icon.isHidden()}}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let R=e.collisionArrays[g];if(R){let z=new zu.default(0,0);if(R.textBox||R.verticalTextBox){let M=!0;if(c){let G=this.variableOffsets[_];G?(z=w1(G.anchor,G.width,G.height,G.textOffset,G.textBoxScale),p&&z._rotate(h?this.transform.angle:-this.transform.angle)):M=!1}R.textBox&&Eu(e.textCollisionBox.collisionVertexArray,P.text.placed,!M||E,z.x,z.y),R.verticalTextBox&&Eu(e.textCollisionBox.collisionVertexArray,P.text.placed,!M||I,z.x,z.y)}let k=!!(!I&&R.verticalIconBox);R.iconBox&&Eu(e.iconCollisionBox.collisionVertexArray,P.icon.placed,k,f?z.x:0,f?z.y:0),R.verticalIconBox&&Eu(e.iconCollisionBox.collisionVertexArray,P.icon.placed,!k,f?z.x:0,f?z.y:0)}}}if(e.sortFeatures(this.transform.angle),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"));if(e.bucketInstanceId in this.collisionCircleArrays){let g=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=g.invProjMatrix,e.placementViewportMatrix=g.viewportMatrix,e.collisionCircleArray=g.circles,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}};l(ny,"Placement");var Du=ny;function Eu(r,e,t,i,n){r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0)}l(Eu,"updateCollisionVertices");var dL=Math.pow(2,25),yL=Math.pow(2,24),gL=Math.pow(2,17),xL=Math.pow(2,16),bL=Math.pow(2,9),_L=Math.pow(2,8),vL=Math.pow(2,1);function S1(r){if(r.opacity===0&&!r.placed)return 0;if(r.opacity===1&&r.placed)return 4294967295;let e=r.placed?1:0,t=Math.floor(r.opacity*127);return t*dL+e*yL+t*gL+e*xL+t*bL+e*_L+t*vL+e}l(S1,"packOpacity");var Sa=0;var ay=class ay{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,n,o){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let s=e[this._currentTileIndex];if(t.getBucketParts(a,n,s,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,u)=>s.sortKey-u.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(t.placeLayerBucketPart(s,this._seenCrossTileIDs,i),this._currentPartIndex++,o())return!0}return!1}};l(ay,"LayerPlacement");var oy=ay,sy=class sy{constructor(e,t,i,n,o,a,s,u){this.placement=new Du(e,t,a,s,u),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let n=Y.now(),o=l(()=>this._forceFullPlacement?!1:Y.now()-n>2,"shouldPausePlacement");for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],s=t[a],u=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=u)&&(!s.maxzoom||s.maxzoom>u)){if(this._inProgressLayer||(this._inProgressLayer=new oy(s)),this._inProgressLayer.continuePlacement(i[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};l(sy,"PauseablePlacement");var Fu=sy;d();d();var P1=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ly=1,Pa=8,Ru=class Ru{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[t,i]=new Uint8Array(e,0,2);if(t!==219)throw new Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==ly)throw new Error("Got v".concat(n," data when expected v").concat(ly,"."));let o=P1[i&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new Ru(s,a,o,e)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=P1.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(i,"."));n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,Pa,e),this.coords=new this.ArrayType(this.data,Pa+s+u,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Pa+a+s+u),this.ids=new this.IndexArrayType(this.data,Pa,e),this.coords=new this.ArrayType(this.data,Pa+s+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(ly<<4)+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return cy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,u=[0,o.length-1,0],c=[];for(;u.length;){let p=u.pop()||0,h=u.pop()||0,f=u.pop()||0;if(h-f<=s){for(let x=f;x<=h;x++){let b=a[2*x],w=a[2*x+1];b>=e&&b<=i&&w>=t&&w<=n&&c.push(o[x])}continue}let m=f+h>>1,y=a[2*m],g=a[2*m+1];y>=e&&y<=i&&g>=t&&g<=n&&c.push(o[m]),(p===0?e<=y:t<=g)&&(u.push(f),u.push(m-1),u.push(1-p)),(p===0?i>=y:n>=g)&&(u.push(m+1),u.push(h),u.push(1-p))}return c}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],u=[],c=i*i;for(;s.length;){let p=s.pop()||0,h=s.pop()||0,f=s.pop()||0;if(h-f<=a){for(let x=f;x<=h;x++)T1(o[2*x],o[2*x+1],e,t)<=c&&u.push(n[x]);continue}let m=f+h>>1,y=o[2*m],g=o[2*m+1];T1(y,g,e,t)<=c&&u.push(n[m]),(p===0?e-i<=y:t-i<=g)&&(s.push(f),s.push(m-1),s.push(1-p)),(p===0?e+i>=y:t+i>=g)&&(s.push(m+1),s.push(h),s.push(1-p))}return u}};l(Ru,"KDBush");var Ma=Ru;function cy(r,e,t,i,n,o){if(n-i<=t)return;let a=i+n>>1;M1(r,e,a,i,n,o),cy(r,e,t,i,a-1,1-o),cy(r,e,t,a+1,n,1-o)}l(cy,"sort");function M1(r,e,t,i,n,o){for(;n>i;){if(n-i>600){let c=n-i+1,p=t-i+1,h=Math.log(c),f=.5*Math.exp(2*h/3),m=.5*Math.sqrt(h*f*(c-f)/c)*(p-c/2<0?-1:1),y=Math.max(i,Math.floor(t-p*f/c+m)),g=Math.min(n,Math.floor(t+(c-p)*f/c+m));M1(r,e,t,y,g,o)}let a=e[2*t+o],s=i,u=n;for(Ta(r,e,i,t),e[2*n+o]>a&&Ta(r,e,i,n);s<u;){for(Ta(r,e,s,u),s++,u--;e[2*s+o]<a;)s++;for(;e[2*u+o]>a;)u--}e[2*i+o]===a?Ta(r,e,i,u):(u++,Ta(r,e,u,n)),u<=t&&(i=u+1),t<=u&&(n=u-1)}}l(M1,"select");function Ta(r,e,t,i){uy(r,t,i),uy(e,2*t,2*i),uy(e,2*t+1,2*i+1)}l(Ta,"swapItem");function uy(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}l(uy,"swap");function T1(r,e,t,i){let n=r-t,o=e-i;return n*n+o*o}l(T1,"sqDist");var Aa=512/8192/2,wL=128,my=class my{constructor(e,t,i){this.tileID=e;this.bucketInstanceId=i;this._symbolsByKey={};let n=new Map;for(let o=0;o<t.length;o++){let a=t.get(o),s=a.key,u=n.get(s);u?u.push(a):n.set(s,[a])}for(let[o,a]of n){let s=a.map(p=>({x:Math.floor(p.anchorX*Aa),y:Math.floor(p.anchorY*Aa)})),u=a.map(p=>p.crossTileID),c={positions:s,crossTileIDs:u};if(c.positions.length>wL){let p=new Ma(c.positions.length,16,Uint16Array);for(let{x:h,y:f}of c.positions)p.add(h,f);p.finish(),delete c.positions,c.index=p}this._symbolsByKey[o]=c}}getScaledCoordinates(e,t){let{x:i,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:u}=t.canonical,c=u-o,p=Aa/Math.pow(2,c),h=(a*8192+e.anchorX)*p,f=(s*8192+e.anchorY)*p,m=i*8192*Aa,y=n*8192*Aa;return{x:Math.floor(h-m),y:Math.floor(f-y)}}findMatches(e,t,i){let n=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let o=0;o<e.length;o++){let a=e.get(o);if(a.crossTileID)continue;let s=this._symbolsByKey[a.key];if(!s)continue;let u=this.getScaledCoordinates(a,t);if(s.index){let c=s.index.range(u.x-n,u.y-n,u.x+n,u.y+n).sort();for(let p of c){let h=s.crossTileIDs[p];if(!i[h]){i[h]=!0,a.crossTileID=h;break}}}else if(s.positions)for(let c=0;c<s.positions.length;c++){let p=s.positions[c],h=s.crossTileIDs[c];if(Math.abs(p.x-u.x)<=n&&Math.abs(p.y-u.y)<=n&&!i[h]){i[h]=!0,a.crossTileID=h;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}};l(my,"TileLayerIndex");var py=my,dy=class dy{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}};l(dy,"CrossTileIDs");var hy=dy,yy=class yy{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 n=this.indexes[i],o={};for(let a in n){let s=n[a];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+t),o[s.tileID.key]=s}this.indexes[i]=o}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 o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let n=this.usedCrossTileIDs[e.overscaledZ];for(let o in this.indexes){let a=this.indexes[o];if(Number(o)>e.overscaledZ)for(let s in a){let u=a[s];u.tileID.isChildOf(e)&&u.findMatches(t.symbolInstances,e,n)}else{let s=e.scaledTo(Number(o)),u=a[s.key];u&&u.findMatches(t.symbolInstances,e,n)}}for(let o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID||(a.crossTileID=i.generate(),n[a.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new py(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let n of i)delete this.usedCrossTileIDs[e][n]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let n=this.indexes[i];for(let o in n)e[n[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[o]),delete n[o],t=!0)}return t}};l(yy,"CrossTileSymbolLayerIndex");var fy=yy,gy=class gy{constructor(){this.layerIndexes={},this.crossTileIDs=new hy,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let n=this.layerIndexes[e.id];n===void 0&&(n=this.layerIndexes[e.id]=new fy);let o=!1,a={};n.handleWrapJump(i);for(let s of t){let u=s.getBucket(e);!u||e.id!==u.layerIds[0]||(u.bucketInstanceId||(u.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(s.tileID,u,this.crossTileIDs)&&(o=!0),a[u.bucketInstanceId]=!0)}return n.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(e){let t={};e.forEach(i=>{t[i]=!0});for(let i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}};l(gy,"CrossTileSymbolIndex");var Pn=gy;var Bu=l((r,e)=>Wi(r,e&&e.filter(t=>t.identifier!=="source.canvas")),"emitValidationErrors"),SL=l_(),xy=class xy extends de{constructor(t,i={}){super();this._rtlPluginLoaded=l(()=>{for(let t in this.sourceCaches){let i=this.sourceCaches[t].getSource().type;(i==="vector"||i==="geojson")&&this.sourceCaches[t].reload()}},"_rtlPluginLoaded");this.map=t,this.dispatcher=new ua(la(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(n,o)=>this.getGlyphs(n,o)),this.dispatcher.registerMessageHandler("GI",(n,o)=>this.getImages(n,o)),this.imageManager=new su,this.imageManager.setEventedParent(this),this.glyphManager=new lu(t._requestManager,i.localIdeographFontFamily),this.lineAtlas=new cu(256,512),this.crossTileSymbolIndex=new Pn,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new Ji,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",us()),Vr().on(ga,this._rtlPluginLoaded),this.on("data",n=>{if(n.dataType!=="source"||n.sourceDataType!=="metadata")return;let o=this.sourceCaches[n.sourceId];if(!o)return;let a=o.getSource();if(!(!a||!a.vectorLayerIds))for(let s in this._layers){let u=this._layers[s];u.source===a.id&&this._validateLayer(u)}})}loadURL(t,i={},n){this.fire(new F("dataloading",{dataType:"style"})),i.validate=typeof i.validate=="boolean"?i.validate:!0;let o=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController,gr(o,this._loadStyleRequest).then(a=>{this._loadStyleRequest=null,this._load(a.data,i,n)}).catch(a=>{this._loadStyleRequest=null,a&&this.fire(new H(a))})}loadJSON(t,i={},n){this.fire(new F("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Y.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(t,i,n)}).catch(()=>{})}loadEmpty(){this.fire(new F("dataloading",{dataType:"style"})),this._load(SL,{validate:!1})}_load(t,i,n){var a;let o=i.transformStyle?i.transformStyle(n,t):t;if(!(i.validate&&Bu(this,Ne(o)))){this._loaded=!0,this.stylesheet=o;for(let s in o.sources)this.addSource(s,o.sources[s],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new uu(this.stylesheet.light),this.map.setTerrain((a=this.stylesheet.terrain)!=null?a:null),this.fire(new F("data",{dataType:"style"})),this.fire(new F("style.load"))}}_createLayers(){let t=ih(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(i=>i.id),this._layers={},this._serializedLayers=null;for(let i of t){let n=ou(i);n.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=n}}_loadSprite(t,i=!1,n=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let o;q0(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(a=>{if(this._spriteRequest=null,a)for(let s in a){this._spritesImagesIds[s]=[];let u=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(c=>!(c in a)):[];for(let c of u)this.imageManager.removeImage(c),this._changedImages[c]=!0;for(let c in a[s]){let p=s==="default"?c:"".concat(s,":").concat(c);this._spritesImagesIds[s].push(p),p in this.imageManager.images?this.imageManager.updateImage(p,a[s][c],!1):this.imageManager.addImage(p,a[s][c]),i&&(this._changedImages[p]=!0)}}}).catch(a=>{this._spriteRequest=null,o=a,this.fire(new H(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new F("data",{dataType:"style"})),n&&n(o)})}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new F("data",{dataType:"style"}))}_validateLayer(t){let i=this.sourceCaches[t.source];if(!i)return;let n=t.sourceLayer;if(!n)return;let o=i.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(n)===-1)&&this.fire(new H(new Error('Source layer "'.concat(n,'" ')+'does not exist on source "'.concat(o.id,'" ')+'as specified by style layer "'.concat(t.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){let i=this._serializedAllLayers();if(!t||t.length===0)return Object.values(i);let n=[];for(let o of t)i[o]&&n.push(i[o]);return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let i=Object.keys(this._layers);for(let n of i){let o=this._layers[n];o.type!=="custom"&&(t[n]=o.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;let i=this._changed;if(i){let o=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(o.length||a.length)&&this._updateWorkerLayers(o,a);for(let s in this._updatedSources){let u=this._updatedSources[s];if(u==="reload")this._reloadSource(s);else if(u==="clear")this._clearSource(s);else throw new Error("Invalid action ".concat(u))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}let n={};for(let o in this.sourceCaches){let a=this.sourceCaches[o];n[o]=a.used,a.used=!1}for(let o of this._order){let a=this._layers[o];a.recalculate(t,this._availableImages),!a.isHidden(t.zoom)&&a.source&&(this.sourceCaches[a.source].used=!0)}for(let o in n){let a=this.sourceCaches[o];!!n[o]!=!!a.used&&a.fire(new F("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(t),this.z=t.zoom,i&&this.fire(new F("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){var u;this._checkLoaded();let n=this.serialize();if(t=i.transformStyle?i.transformStyle(n,t):t,((u=i.validate)!=null?u:!0)&&Bu(this,Ne(t)))return!1;t=pt(t),t.layers=ih(t.layers);let a=Nb(n,t),s=this._getOperationsToPerform(a);if(s.unimplemented.length>0)throw new Error("Unimplemented: ".concat(s.unimplemented.join(", "),"."));if(s.operations.length===0)return!1;for(let c of s.operations)c();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){let i=[],n=[];for(let o of t)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":i.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":i.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":i.push(()=>{});break;default:n.push(o.command);break}return{operations:i,unimplemented:n}}addImage(t,i){if(this.getImage(t))return this.fire(new H(new Error('An image named "'.concat(t,'" already exists.'))));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,i){this.imageManager.updateImage(t,i)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new H(new Error('An image named "'.concat(t,'" does not exist.'))));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new F("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,n={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error('Source "'.concat(t,'" already exists.'));if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(i).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(Ne.source,"sources.".concat(t),i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);let s=this.sourceCaches[t]=new cr(t,i,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t})),s.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(let n in this._layers)if(this._layers[n].source===t)return this.fire(new H(new Error('Source "'.concat(t,'" cannot be removed while layer "').concat(n,'" is using it.'))));let i=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],i.fire(new F("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,i){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID=".concat(t));let n=this.sourceCaches[t].getSource();if(n.type!=="geojson")throw new Error("geojsonSource.type is ".concat(n.type,", which is !== 'geojson"));n.setData(i),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,i,n={}){this._checkLoaded();let o=t.id;if(this.getLayer(o)){this.fire(new H(new Error('Layer "'.concat(o,'" already exists on this map.'))));return}let a;if(t.type==="custom"){if(Bu(this,G0(t)))return;a=ou(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(o,t.source),t=pt(t),t=V(t,{source:o})),this._validate(Ne.layer,"layers.".concat(o),t,{arrayIndex:-1},n))return;a=ou(t),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=i?this._order.indexOf(i):this._order.length;if(i&&s===-1){this.fire(new H(new Error('Cannot add layer "'.concat(o,'" before non-existing layer "').concat(i,'".'))));return}if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&a.type!=="custom"){let u=this._removedLayers[o];delete this._removedLayers[o],u.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t]){this.fire(new H(new Error("The layer '".concat(t,"' does not exist in the map's style and cannot be moved."))));return}if(t===i)return;let o=this._order.indexOf(t);this._order.splice(o,1);let a=i?this._order.indexOf(i):this._order.length;if(i&&a===-1){this.fire(new H(new Error('Cannot move layer "'.concat(t,'" before non-existing layer "').concat(i,'".'))));return}this._order.splice(a,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let i=this._layers[t];if(!i){this.fire(new H(new Error('Cannot remove non-existing layer "'.concat(t,'".'))));return}i.setEventedParent(null);let n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,n){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new H(new Error('Cannot set the zoom range of non-existing layer "'.concat(t,'".'))));return}o.minzoom===i&&o.maxzoom===n||(i!=null&&(o.minzoom=i),n!=null&&(o.maxzoom=n),this._updateLayer(o))}setFilter(t,i,n={}){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new H(new Error('Cannot filter non-existing layer "'.concat(t,'".'))));return}if(!Qt(o.filter,i)){if(i==null){o.filter=void 0,this._updateLayer(o);return}this._validate(Ne.filter,"layers.".concat(o.id,".filter"),i,null,n)||(o.filter=pt(i),this._updateLayer(o))}}getFilter(t){return pt(this.getLayer(t).filter)}setLayoutProperty(t,i,n,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new H(new Error('Cannot style non-existing layer "'.concat(t,'".'))));return}Qt(a.getLayoutProperty(i),n)||(a.setLayoutProperty(i,n,o),this._updateLayer(a))}getLayoutProperty(t,i){let n=this.getLayer(t);if(!n){this.fire(new H(new Error('Cannot get style of non-existing layer "'.concat(t,'".'))));return}return n.getLayoutProperty(i)}setPaintProperty(t,i,n,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new H(new Error('Cannot style non-existing layer "'.concat(t,'".'))));return}if(Qt(a.getPaintProperty(i),n))return;a.setPaintProperty(i,n,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null}getPaintProperty(t,i){return this.getLayer(t).getPaintProperty(i)}setFeatureState(t,i){this._checkLoaded();let n=t.source,o=t.sourceLayer,a=this.sourceCaches[n];if(a===void 0){this.fire(new H(new Error("The source '".concat(n,"' does not exist in the map's style."))));return}let s=a.getSource().type;if(s==="geojson"&&o){this.fire(new H(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!o){this.fire(new H(new Error("The sourceLayer parameter must be provided for vector source types.")));return}t.id===void 0&&this.fire(new H(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,t.id,i)}removeFeatureState(t,i){this._checkLoaded();let n=t.source,o=this.sourceCaches[n];if(o===void 0){this.fire(new H(new Error("The source '".concat(n,"' does not exist in the map's style."))));return}let a=o.getSource().type,s=a==="vector"?t.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new H(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(i&&typeof t.id!="string"&&typeof t.id!="number"){this.fire(new H(new Error("A feature id is required to remove its specific state property.")));return}o.removeFeatureState(s,t.id,i)}getFeatureState(t){this._checkLoaded();let i=t.source,n=t.sourceLayer,o=this.sourceCaches[i];if(o===void 0){this.fire(new H(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}if(o.getSource().type==="vector"&&!n){this.fire(new H(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return t.id===void 0&&this.fire(new H(new Error("The feature id parameter must be provided."))),o.getFeatureState(n,t.id)}getTransition(){return V({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let t=Dn(this.sourceCaches,a=>a.serialize()),i=this._serializeByIds(this._order),n=this.map.getTerrain()||void 0,o=this.stylesheet;return os({version:o.version,name:o.name,metadata:o.metadata,light:o.light,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:t,layers:i,terrain:n},a=>a!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let i=l(s=>this._layers[s].type==="fill-extrusion","isLayer3D"),n={},o=[];for(let s=this._order.length-1;s>=0;s--){let u=this._order[s];if(i(u)){n[u]=s;for(let c of t){let p=c[u];if(p)for(let h of p)o.push(h)}}}o.sort((s,u)=>u.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let u=this._order[s];if(i(u))for(let c=o.length-1;c>=0;c--){let p=o[c].feature;if(n[p.layer.id]<s)break;a.push(p),o.pop()}else for(let c of t){let p=c[u];if(p)for(let h of p)a.push(h.feature)}}return a}queryRenderedFeatures(t,i,n){i&&i.filter&&this._validate(Ne.filter,"queryRenderedFeatures.filter",i.filter,null,i);let o={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new H(new Error("parameters.layers must be an Array."))),[];for(let u of i.layers){let c=this._layers[u];if(!c)return this.fire(new H(new Error("The layer '".concat(u,"' does not exist in the map's style and cannot be queried for features.")))),[];o[c.source]=!0}}let a=[];i.availableImages=this._availableImages;let s=this._serializedAllLayers();for(let u in this.sourceCaches)i.layers&&!o[u]||a.push(J0(this.sourceCaches[u],this._layers,s,t,i,n));return this.placement&&a.push(Y0(this._layers,s,this.sourceCaches,t,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(t,i){i&&i.filter&&this._validate(Ne.filter,"querySourceFeatures.filter",i.filter,null,i);let n=this.sourceCaches[t];return n?Q0(n,i):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();let n=this.light.getLight(),o=!1;for(let s in t)if(!Qt(t[s],n[s])){o=!0;break}if(!o)return;let a={now:Y.now(),transition:V({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(a)}_validate(t,i,n,o,a={}){return a&&a.validate===!1?!1:Bu(this,t.call(Ne,V({key:i,style:this.serialize(),value:n,styleSpec:A},o)))}_remove(t=!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),Vr().off(ga,this._rtlPluginLoaded);for(let i in this._layers)this._layers[i].setEventedParent(null);for(let i in this.sourceCaches){let n=this.sourceCaches[i];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(let i in this.sourceCaches)this.sourceCaches[i].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,i,n,o,a=!1){let s=!1,u=!1,c={};for(let h of this._order){let f=this._layers[h];if(f.type!=="symbol")continue;if(!c[f.source]){let y=this.sourceCaches[f.source];c[f.source]=y.getRenderableIds(!0).map(g=>y.getTileByID(g)).sort((g,x)=>x.tileID.overscaledZ-g.tileID.overscaledZ||(g.tileID.isLessThan(x.tileID)?-1:1))}let m=this.crossTileSymbolIndex.addLayer(f,c[f.source],t.center.lng);s=s||m}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||n===0,(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Y.now(),t.zoom))&&(this.pauseablePlacement=new Fu(t,this.map.terrain,this._order,a,i,n,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Y.now()),u=!0),s&&this.pauseablePlacement.placement.setStale()),u||s)for(let h of this._order){let f=this._layers[h];f.type==="symbol"&&this.placement.updateLayerOpacities(f,c[f.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Y.now())}_releaseSymbolFadeTiles(){for(let t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}async getImages(t,i){let n=await this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,i.icons),n}async getGlyphs(t,i){let n=await this.glyphManager.getGlyphs(i.stacks),o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,[""]),n}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),!(t&&this._validate(Ne.glyphs,"glyphs",t,null,i))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,i,n={},o){this._checkLoaded();let a=[{id:t,url:i}],s=[...gn(this.stylesheet.sprite),...a];this._validate(Ne.sprite,"sprite",s,null,n)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(t){this._checkLoaded();let i=gn(this.stylesheet.sprite);if(!i.find(n=>n.id===t)){this.fire(new H(new Error('Sprite "'.concat(t,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[t])for(let n of this._spritesImagesIds[t])this.imageManager.removeImage(n),this._changedImages[n]=!0;i.splice(i.findIndex(n=>n.id===t),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new F("data",{dataType:"style"}))}getSprite(){return gn(this.stylesheet.sprite)}setSprite(t,i={},n){this._checkLoaded(),!(t&&this._validate(Ne.sprite,"sprite",t,null,i))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,n):(this._unloadSprite(),n&&n(null)))}};l(xy,"Style");var Tn=xy;d();d();var Ou=_e([{name:"a_pos",type:"Int16",components:2}]);d();d();var A1="#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\n";d();var I1="#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;}\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(texture2D(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=(texture2D(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\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}";d();var C1="uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var E1="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";d();var k1="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;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var L1="uniform mat4 u_matrix;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;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);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);}";d();var D1="varying vec3 v_data;varying 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);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);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));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var z1="uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying 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 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}";d();var F1="void main() {gl_FragColor=vec4(1.0);}";d();var R1="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";d();var B1="uniform highp float u_intensity;varying 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);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var O1="uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying 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 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}";d();var V1="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}";d();var U1="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying 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;}";d();var N1="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}";d();var G1="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}";d();var q1="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);gl_FragColor=color*alpha*opacity_t;}";d();var j1="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}";d();var Z1="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}";d();var H1="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}";d();var $1="#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_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var W1="attribute vec2 a_pos;uniform mat4 u_matrix;\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=u_matrix*vec4(a_pos,0,1);}";d();var X1="varying vec2 v_pos;\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);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var K1="attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\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=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";d();var J1="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\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=texture2D(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=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Y1="uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\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=u_matrix*vec4(a_pos,0,1);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;}";d();var Q1="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var ew="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying 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=u_matrix*vec4(a_pos,0,1);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);}";d();var tw="varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var rw="uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying 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);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float 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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=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;}";d();var iw="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying 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=texture2D(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=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var nw="uniform mat4 u_matrix;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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying 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 z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*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;}";d();var ow="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;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))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var aw="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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;}";d();var sw="uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var lw="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}";d();var uw="uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\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);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var cw="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";d();var pw="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\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=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var hw="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";d();var fw="#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;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\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(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var mw="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.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;}";d();var dw="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\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=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(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);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var yw="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;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;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.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);}";d();var gw="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var xw="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}";d();var bw="uniform sampler2D u_texture;varying vec2 v_tex;varying 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;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var _w="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_tex;varying 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);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));}";d();var vw="#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;varying vec2 v_data0;varying 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=texture2D(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);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var ww="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_data0;varying 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;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);}";d();var Sw="#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;varying vec4 v_data0;varying 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;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Pw="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec4 v_data0;varying 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;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);}";d();var Tw="varying 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() {gl_FragColor=pack(v_depth);}";d();var Mw="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";d();var Aw="uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}";d();var Vu="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";var Ti={prelude:Ee(A1,I1),background:Ee(C1,E1),backgroundPattern:Ee(k1,L1),circle:Ee(D1,z1),clippingMask:Ee(F1,R1),heatmap:Ee(B1,O1),heatmapTexture:Ee(V1,U1),collisionBox:Ee(N1,G1),collisionCircle:Ee(q1,j1),debug:Ee(Z1,H1),fill:Ee($1,W1),fillOutline:Ee(X1,K1),fillOutlinePattern:Ee(J1,Y1),fillPattern:Ee(Q1,ew),fillExtrusion:Ee(tw,rw),fillExtrusionPattern:Ee(iw,nw),hillshadePrepare:Ee(ow,aw),hillshade:Ee(sw,lw),line:Ee(uw,cw),lineGradient:Ee(pw,hw),linePattern:Ee(fw,mw),lineSDF:Ee(dw,yw),raster:Ee(gw,xw),symbolIcon:Ee(bw,_w),symbolSDF:Ee(vw,ww),symbolTextAndIcon:Ee(Sw,Pw),terrain:Ee(Aw,Vu),terrainDepth:Ee(Tw,Vu),terrainCoords:Ee(Mw,Vu)};function Ee(r,e){let t=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=e.match(/attribute ([\w]+) ([\w]+)/g),n=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return r=r.replace(t,(u,c,p,h,f)=>(s[f]=!0,c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\nvarying ").concat(p," ").concat(h," ").concat(f,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(f,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(f,"\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n"))),e=e.replace(t,(u,c,p,h,f)=>{let m=h==="float"?"vec2":"vec4",y=f.match(/color/)?"color":m;return s[f]?c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\nuniform lowp float u_").concat(f,"_t;\nattribute ").concat(p," ").concat(m," a_").concat(f,";\nvarying ").concat(p," ").concat(h," ").concat(f,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(f,";\n#endif\n"):y==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\n ").concat(f," = a_").concat(f,";\n#else\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(f,"\n ").concat(f," = unpack_mix_").concat(y,"(a_").concat(f,", u_").concat(f,"_t);\n#else\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n"):c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\nuniform lowp float u_").concat(f,"_t;\nattribute ").concat(p," ").concat(m," a_").concat(f,";\n#else\nuniform ").concat(p," ").concat(h," u_").concat(f,";\n#endif\n"):y==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(f,"\n ").concat(p," ").concat(h," ").concat(f," = a_").concat(f,";\n#else\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(f,"\n ").concat(p," ").concat(h," ").concat(f," = unpack_mix_").concat(y,"(a_").concat(f,", u_").concat(f,"_t);\n#else\n ").concat(p," ").concat(h," ").concat(f," = u_").concat(f,";\n#endif\n")}),{fragmentSource:r,vertexSource:e,staticAttributes:i,staticUniforms:a}}l(Ee,"compile");d();d();var by=class by{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,n,o,a,s,u,c){this.context=e;let p=this.boundPaintVertexBuffers.length!==n.length;for(let f=0;!p&&f<n.length;f++)this.boundPaintVertexBuffers[f]!==n[f]&&(p=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||p||this.boundIndexBuffer!==o||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==u||this.boundDynamicVertexBuffer3!==c?this.freshBind(t,i,n,o,a,s,u,c):(e.bindVertexArray.set(this.vao),s&&s.bind(),o&&o.dynamicDraw&&o.bind(),u&&u.bind(),c&&c.bind())}freshBind(e,t,i,n,o,a,s,u){let c=e.numAttributes,p=this.context,h=p.gl;this.vao&&this.destroy(),this.vao=p.createVertexArray(),p.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=u,t.enableAttributes(h,e);for(let f of i)f.enableAttributes(h,e);a&&a.enableAttributes(h,e),s&&s.enableAttributes(h,e),u&&u.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,o);for(let f of i)f.bind(),f.setVertexAttribPointers(h,e,o);a&&(a.bind(),a.setVertexAttribPointers(h,e,o)),n&&n.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,e,o)),u&&(u.bind(),u.setVertexAttribPointers(h,e,o)),p.currentNumAttributes=c}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};l(by,"VertexArrayObject");var Uu=by;d();var Iw=l((r,e)=>({u_depth:new Q(r,e.u_depth),u_terrain:new Q(r,e.u_terrain),u_terrain_dim:new U(r,e.u_terrain_dim),u_terrain_matrix:new re(r,e.u_terrain_matrix),u_terrain_unpack:new Cr(r,e.u_terrain_unpack),u_terrain_exaggeration:new U(r,e.u_terrain_exaggeration)}),"terrainPreludeUniforms"),Cw=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_texture:new Q(r,e.u_texture),u_ele_delta:new U(r,e.u_ele_delta)}),"terrainUniforms"),Ew=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_ele_delta:new U(r,e.u_ele_delta)}),"terrainDepthUniforms"),kw=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_texture:new Q(r,e.u_texture),u_terrain_coords_id:new U(r,e.u_terrain_coords_id),u_ele_delta:new U(r,e.u_ele_delta)}),"terrainCoordsUniforms"),Lw=l((r,e)=>({u_matrix:r,u_texture:0,u_ele_delta:e}),"terrainUniformValues"),Dw=l((r,e)=>({u_matrix:r,u_ele_delta:e}),"terrainDepthUniformValues"),zw=l((r,e,t)=>({u_matrix:r,u_terrain_coords_id:e/255,u_texture:0,u_ele_delta:t}),"terrainCoordsUniformValues");function _y(r){let e=[];for(let t=0;t<r.length;t++){if(r[t]===null)continue;let i=r[t].split(" ");e.push(i.pop())}return e}l(_y,"getTokenizedAttributesAndUniforms");var vy=class vy{constructor(e,t,i,n,o,a){let s=e.gl;this.program=s.createProgram();let u=_y(t.staticAttributes),c=i?i.getBinderAttributes():[],p=u.concat(c),h=Ti.prelude.staticUniforms?_y(Ti.prelude.staticUniforms):[],f=t.staticUniforms?_y(t.staticUniforms):[],m=i?i.getBinderUniforms():[],y=h.concat(f).concat(m),g=[];for(let T of y)g.indexOf(T)<0&&g.push(T);let x=i?i.defines():[];o&&x.push("#define OVERDRAW_INSPECTOR;"),a&&x.push("#define TERRAIN3D;");let b=x.concat(Ti.prelude.fragmentSource,t.fragmentSource).join("\n"),w=x.concat(Ti.prelude.vertexSource,t.vertexSource).join("\n"),_=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}if(s.shaderSource(_,b),s.compileShader(_),!s.getShaderParameter(_,s.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(s.getShaderInfoLog(_)));s.attachShader(this.program,_);let S=s.createShader(s.VERTEX_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}if(s.shaderSource(S,w),s.compileShader(S),!s.getShaderParameter(S,s.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(s.getShaderInfoLog(S)));s.attachShader(this.program,S),this.attributes={};let P={};this.numAttributes=p.length;for(let T=0;T<this.numAttributes;T++)p[T]&&(s.bindAttribLocation(this.program,T,p[T]),this.attributes[p[T]]=T);if(s.linkProgram(this.program),!s.getProgramParameter(this.program,s.LINK_STATUS))throw new Error("Program failed to link: ".concat(s.getProgramInfoLog(this.program)));s.deleteShader(S),s.deleteShader(_);for(let T=0;T<g.length;T++){let L=g[T];if(L&&!P[L]){let C=s.getUniformLocation(this.program,L);C&&(P[L]=C)}}this.fixedUniforms=n(e,P),this.terrainUniforms=Iw(e,P),this.binderUniforms=i?i.getUniforms(e,P):[]}draw(e,t,i,n,o,a,s,u,c,p,h,f,m,y,g,x,b,w){let _=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(o),e.setCullFace(a),u){e.activeTexture.set(_.TEXTURE2),_.bindTexture(_.TEXTURE_2D,u.depthTexture),e.activeTexture.set(_.TEXTURE3),_.bindTexture(_.TEXTURE_2D,u.texture);for(let P in this.terrainUniforms)this.terrainUniforms[P].set(u[P])}for(let P in this.fixedUniforms)this.fixedUniforms[P].set(s[P]);g&&g.setUniforms(e,this.binderUniforms,m,{zoom:y});let S=0;switch(t){case _.LINES:S=2;break;case _.TRIANGLES:S=3;break;case _.LINE_STRIP:S=1;break}for(let P of f.get()){let T=P.vaos||(P.vaos={});(T[c]||(T[c]=new Uu)).bind(e,this,p,g?g.getPaintVertexBuffers():[],h,P.vertexOffset,x,b,w),_.drawElements(t,P.primitiveLength*S,_.UNSIGNED_SHORT,P.primitiveOffset*S*2)}}};l(vy,"Program");var Nu=vy;d();d();d();function Gu(r,e,t){let i=1/$e(t,1,e.transform.tileZoom),n=Math.pow(2,t.tileID.overscaledZ),o=t.tileSize*Math.pow(2,e.transform.tileZoom)/n,a=o*(t.tileID.canonical.x+t.tileID.wrap*n),s=o*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_scale:[i,r.fromScale,r.toScale],u_fade:r.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}l(Gu,"patternUniformValues");function Fw(r,e,t,i){let n=t.imageManager.getPattern(r.from.toString()),o=t.imageManager.getPattern(r.to.toString()),{width:a,height:s}=t.imageManager.getPixelSize(),u=Math.pow(2,i.tileID.overscaledZ),c=i.tileSize*Math.pow(2,t.transform.tileZoom)/u,p=c*(i.tileID.canonical.x+i.tileID.wrap*u),h=c*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/$e(i,1,t.transform.tileZoom),u_pixel_coord_upper:[p>>16,h>>16],u_pixel_coord_lower:[p&65535,h&65535]}}l(Fw,"bgPatternUniformValues");var Rw=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_lightpos:new lt(r,e.u_lightpos),u_lightintensity:new U(r,e.u_lightintensity),u_lightcolor:new lt(r,e.u_lightcolor),u_vertical_gradient:new U(r,e.u_vertical_gradient),u_opacity:new U(r,e.u_opacity)}),"fillExtrusionUniforms"),Bw=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_lightpos:new lt(r,e.u_lightpos),u_lightintensity:new U(r,e.u_lightintensity),u_lightcolor:new lt(r,e.u_lightcolor),u_vertical_gradient:new U(r,e.u_vertical_gradient),u_height_factor:new U(r,e.u_height_factor),u_image:new Q(r,e.u_image),u_texsize:new te(r,e.u_texsize),u_pixel_coord_upper:new te(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new te(r,e.u_pixel_coord_lower),u_scale:new lt(r,e.u_scale),u_fade:new U(r,e.u_fade),u_opacity:new U(r,e.u_opacity)}),"fillExtrusionPatternUniforms"),wy=l((r,e,t,i)=>{let n=e.style.light,o=n.properties.get("position"),a=[o.x,o.y,o.z],s=Uo.create();n.properties.get("anchor")==="viewport"&&Uo.fromRotation(s,-e.transform.angle),gt.transformMat3(a,a,s);let u=n.properties.get("color");return{u_matrix:r,u_lightpos:a,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+t,u_opacity:i}},"fillExtrusionUniformValues"),Ow=l((r,e,t,i,n,o,a)=>V(wy(r,e,t,i),Gu(o,e,a),{u_height_factor:-Math.pow(2,n.overscaledZ)/a.tileSize/8}),"fillExtrusionPatternUniformValues");d();var Vw=l((r,e)=>({u_matrix:new re(r,e.u_matrix)}),"fillUniforms"),Uw=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_image:new Q(r,e.u_image),u_texsize:new te(r,e.u_texsize),u_pixel_coord_upper:new te(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new te(r,e.u_pixel_coord_lower),u_scale:new lt(r,e.u_scale),u_fade:new U(r,e.u_fade)}),"fillPatternUniforms"),Nw=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_world:new te(r,e.u_world)}),"fillOutlineUniforms"),Gw=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_world:new te(r,e.u_world),u_image:new Q(r,e.u_image),u_texsize:new te(r,e.u_texsize),u_pixel_coord_upper:new te(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new te(r,e.u_pixel_coord_lower),u_scale:new lt(r,e.u_scale),u_fade:new U(r,e.u_fade)}),"fillOutlinePatternUniforms"),Sy=l(r=>({u_matrix:r}),"fillUniformValues"),Py=l((r,e,t,i)=>V(Sy(r),Gu(t,e,i)),"fillPatternUniformValues"),qw=l((r,e)=>({u_matrix:r,u_world:e}),"fillOutlineUniformValues"),jw=l((r,e,t,i,n)=>V(Py(r,e,t,i),{u_world:n}),"fillOutlinePatternUniformValues");d();var Zw=l((r,e)=>({u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_scale_with_map:new Q(r,e.u_scale_with_map),u_pitch_with_map:new Q(r,e.u_pitch_with_map),u_extrude_scale:new te(r,e.u_extrude_scale),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_matrix:new re(r,e.u_matrix)}),"circleUniforms"),Hw=l((r,e,t,i)=>{let n=r.transform,o,a;if(i.paint.get("circle-pitch-alignment")==="map"){let s=$e(t,1,n.zoom);o=!0,a=[s,s]}else o=!1,a=n.pixelsToGLUnits;return{u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_matrix:r.translatePosMatrix(e.posMatrix,t,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:r.pixelRatio,u_extrude_scale:a}},"circleUniformValues");d();var $w=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_pixels_to_tile_units:new U(r,e.u_pixels_to_tile_units),u_extrude_scale:new te(r,e.u_extrude_scale),u_overscale_factor:new U(r,e.u_overscale_factor)}),"collisionUniforms"),Ww=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_inv_matrix:new re(r,e.u_inv_matrix),u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_viewport_size:new te(r,e.u_viewport_size)}),"collisionCircleUniforms"),Xw=l((r,e,t)=>{let i=$e(t,1,e.zoom),n=Math.pow(2,e.zoom-t.tileID.overscaledZ),o=t.tileID.overscaleFactor();return{u_matrix:r,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:i,u_extrude_scale:[e.pixelsToGLUnits[0]/(i*n),e.pixelsToGLUnits[1]/(i*n)],u_overscale_factor:o}},"collisionUniformValues"),Kw=l((r,e,t)=>({u_matrix:r,u_inv_matrix:e,u_camera_to_center_distance:t.cameraToCenterDistance,u_viewport_size:[t.width,t.height]}),"collisionCircleUniformValues");d();var Jw=l((r,e)=>({u_color:new kt(r,e.u_color),u_matrix:new re(r,e.u_matrix),u_overlay:new Q(r,e.u_overlay),u_overlay_scale:new U(r,e.u_overlay_scale)}),"debugUniforms"),Ty=l((r,e,t=1)=>({u_matrix:r,u_color:e,u_overlay:0,u_overlay_scale:t}),"debugUniformValues");d();var Yw=l((r,e)=>({u_matrix:new re(r,e.u_matrix)}),"clippingMaskUniforms"),My=l(r=>({u_matrix:r}),"clippingMaskUniformValues");d();var Qw=l((r,e)=>({u_extrude_scale:new U(r,e.u_extrude_scale),u_intensity:new U(r,e.u_intensity),u_matrix:new re(r,e.u_matrix)}),"heatmapUniforms"),eS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_world:new te(r,e.u_world),u_image:new Q(r,e.u_image),u_color_ramp:new Q(r,e.u_color_ramp),u_opacity:new U(r,e.u_opacity)}),"heatmapTextureUniforms"),tS=l((r,e,t,i)=>({u_matrix:r,u_extrude_scale:$e(e,1,t),u_intensity:i}),"heatmapUniformValues"),rS=l((r,e,t,i)=>{let n=q.create();q.ortho(n,0,r.width,r.height,0,0,1);let o=r.context.gl;return{u_matrix:n,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:t,u_color_ramp:i,u_opacity:e.paint.get("heatmap-opacity")}},"heatmapTextureUniformValues");d();var iS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_image:new Q(r,e.u_image),u_latrange:new te(r,e.u_latrange),u_light:new te(r,e.u_light),u_shadow:new kt(r,e.u_shadow),u_highlight:new kt(r,e.u_highlight),u_accent:new kt(r,e.u_accent)}),"hillshadeUniforms"),nS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_image:new Q(r,e.u_image),u_dimension:new te(r,e.u_dimension),u_zoom:new U(r,e.u_zoom),u_unpack:new Cr(r,e.u_unpack)}),"hillshadePrepareUniforms"),oS=l((r,e,t,i)=>{let n=t.paint.get("hillshade-shadow-color"),o=t.paint.get("hillshade-highlight-color"),a=t.paint.get("hillshade-accent-color"),s=t.paint.get("hillshade-illumination-direction")*(Math.PI/180);t.paint.get("hillshade-illumination-anchor")==="viewport"&&(s-=r.transform.angle);let u=!r.options.moving;return{u_matrix:i?i.posMatrix:r.transform.calculatePosMatrix(e.tileID.toUnwrapped(),u),u_image:0,u_latrange:PL(r,e.tileID),u_light:[t.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:o,u_accent:a}},"hillshadeUniformValues"),aS=l((r,e)=>{let t=e.stride,i=q.create();return q.ortho(i,0,8192,-8192,0,0,1),q.translate(i,i,[0,-8192,0]),{u_matrix:i,u_image:1,u_dimension:[t,t],u_zoom:r.overscaledZ,u_unpack:e.getUnpackVector()}},"hillshadeUniformPrepareValues");function PL(r,e){let t=Math.pow(2,e.canonical.z),i=e.canonical.y;return[new Fe(0,i/t).toLngLat().lat,new Fe(0,(i+1)/t).toLngLat().lat]}l(PL,"getTileLatRange");d();var sS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_ratio:new U(r,e.u_ratio),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_units_to_pixels:new te(r,e.u_units_to_pixels)}),"lineUniforms"),lS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_ratio:new U(r,e.u_ratio),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_units_to_pixels:new te(r,e.u_units_to_pixels),u_image:new Q(r,e.u_image),u_image_height:new U(r,e.u_image_height)}),"lineGradientUniforms"),uS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_texsize:new te(r,e.u_texsize),u_ratio:new U(r,e.u_ratio),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_image:new Q(r,e.u_image),u_units_to_pixels:new te(r,e.u_units_to_pixels),u_scale:new lt(r,e.u_scale),u_fade:new U(r,e.u_fade)}),"linePatternUniforms"),cS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_ratio:new U(r,e.u_ratio),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_units_to_pixels:new te(r,e.u_units_to_pixels),u_patternscale_a:new te(r,e.u_patternscale_a),u_patternscale_b:new te(r,e.u_patternscale_b),u_sdfgamma:new U(r,e.u_sdfgamma),u_image:new Q(r,e.u_image),u_tex_y_a:new U(r,e.u_tex_y_a),u_tex_y_b:new U(r,e.u_tex_y_b),u_mix:new U(r,e.u_mix)}),"lineSDFUniforms"),qu=l((r,e,t,i)=>{let n=r.transform;return{u_matrix:dS(r,e,t,i),u_ratio:1/$e(e,1,n.zoom),u_device_pixel_ratio:r.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},"lineUniformValues"),pS=l((r,e,t,i,n)=>V(qu(r,e,t,n),{u_image:0,u_image_height:i}),"lineGradientUniformValues"),hS=l((r,e,t,i,n)=>{let o=r.transform,a=mS(e,o);return{u_matrix:dS(r,e,t,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/$e(e,1,o.zoom),u_device_pixel_ratio:r.pixelRatio,u_image:0,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},"linePatternUniformValues"),fS=l((r,e,t,i,n,o)=>{let a=r.transform,s=r.lineAtlas,u=mS(e,a),c=t.layout.get("line-cap")==="round",p=s.getDash(i.from,c),h=s.getDash(i.to,c),f=p.width*n.fromScale,m=h.width*n.toScale;return V(qu(r,e,t,o),{u_patternscale_a:[u/f,-p.height/2],u_patternscale_b:[u/m,-h.height/2],u_sdfgamma:s.width/(Math.min(f,m)*256*r.pixelRatio)/2,u_image:0,u_tex_y_a:p.y,u_tex_y_b:h.y,u_mix:n.t})},"lineSDFUniformValues");function mS(r,e){return 1/$e(r,1,e.tileZoom)}l(mS,"calculateTileRatio");function dS(r,e,t,i){return r.translatePosMatrix(i?i.posMatrix:e.tileID.posMatrix,e,t.paint.get("line-translate"),t.paint.get("line-translate-anchor"))}l(dS,"calculateMatrix");d();var yS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_tl_parent:new te(r,e.u_tl_parent),u_scale_parent:new U(r,e.u_scale_parent),u_buffer_scale:new U(r,e.u_buffer_scale),u_fade_t:new U(r,e.u_fade_t),u_opacity:new U(r,e.u_opacity),u_image0:new Q(r,e.u_image0),u_image1:new Q(r,e.u_image1),u_brightness_low:new U(r,e.u_brightness_low),u_brightness_high:new U(r,e.u_brightness_high),u_saturation_factor:new U(r,e.u_saturation_factor),u_contrast_factor:new U(r,e.u_contrast_factor),u_spin_weights:new lt(r,e.u_spin_weights)}),"rasterUniforms"),gS=l((r,e,t,i,n)=>({u_matrix:r,u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:AL(n.paint.get("raster-saturation")),u_contrast_factor:ML(n.paint.get("raster-contrast")),u_spin_weights:TL(n.paint.get("raster-hue-rotate"))}),"rasterUniformValues");function TL(r){r*=Math.PI/180;let e=Math.sin(r),t=Math.cos(r);return[(2*t+1)/3,(-Math.sqrt(3)*e-t+1)/3,(Math.sqrt(3)*e-t+1)/3]}l(TL,"spinWeights");function ML(r){return r>0?1/(1-r):1+r}l(ML,"contrastFactor");function AL(r){return r>0?1-1/(1.001-r):-r}l(AL,"saturationFactor");d();var xS=l((r,e)=>({u_is_size_zoom_constant:new Q(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Q(r,e.u_is_size_feature_constant),u_size_t:new U(r,e.u_size_t),u_size:new U(r,e.u_size),u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_pitch:new U(r,e.u_pitch),u_rotate_symbol:new Q(r,e.u_rotate_symbol),u_aspect_ratio:new U(r,e.u_aspect_ratio),u_fade_change:new U(r,e.u_fade_change),u_matrix:new re(r,e.u_matrix),u_label_plane_matrix:new re(r,e.u_label_plane_matrix),u_coord_matrix:new re(r,e.u_coord_matrix),u_is_text:new Q(r,e.u_is_text),u_pitch_with_map:new Q(r,e.u_pitch_with_map),u_texsize:new te(r,e.u_texsize),u_texture:new Q(r,e.u_texture)}),"symbolIconUniforms"),bS=l((r,e)=>({u_is_size_zoom_constant:new Q(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Q(r,e.u_is_size_feature_constant),u_size_t:new U(r,e.u_size_t),u_size:new U(r,e.u_size),u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_pitch:new U(r,e.u_pitch),u_rotate_symbol:new Q(r,e.u_rotate_symbol),u_aspect_ratio:new U(r,e.u_aspect_ratio),u_fade_change:new U(r,e.u_fade_change),u_matrix:new re(r,e.u_matrix),u_label_plane_matrix:new re(r,e.u_label_plane_matrix),u_coord_matrix:new re(r,e.u_coord_matrix),u_is_text:new Q(r,e.u_is_text),u_pitch_with_map:new Q(r,e.u_pitch_with_map),u_texsize:new te(r,e.u_texsize),u_texture:new Q(r,e.u_texture),u_gamma_scale:new U(r,e.u_gamma_scale),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_is_halo:new Q(r,e.u_is_halo)}),"symbolSDFUniforms"),_S=l((r,e)=>({u_is_size_zoom_constant:new Q(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new Q(r,e.u_is_size_feature_constant),u_size_t:new U(r,e.u_size_t),u_size:new U(r,e.u_size),u_camera_to_center_distance:new U(r,e.u_camera_to_center_distance),u_pitch:new U(r,e.u_pitch),u_rotate_symbol:new Q(r,e.u_rotate_symbol),u_aspect_ratio:new U(r,e.u_aspect_ratio),u_fade_change:new U(r,e.u_fade_change),u_matrix:new re(r,e.u_matrix),u_label_plane_matrix:new re(r,e.u_label_plane_matrix),u_coord_matrix:new re(r,e.u_coord_matrix),u_is_text:new Q(r,e.u_is_text),u_pitch_with_map:new Q(r,e.u_pitch_with_map),u_texsize:new te(r,e.u_texsize),u_texsize_icon:new te(r,e.u_texsize_icon),u_texture:new Q(r,e.u_texture),u_texture_icon:new Q(r,e.u_texture_icon),u_gamma_scale:new U(r,e.u_gamma_scale),u_device_pixel_ratio:new U(r,e.u_device_pixel_ratio),u_is_halo:new Q(r,e.u_is_halo)}),"symbolTextAndIconUniforms"),Ay=l((r,e,t,i,n,o,a,s,u,c)=>{let p=n.transform;return{u_is_size_zoom_constant:+(r==="constant"||r==="source"),u_is_size_feature_constant:+(r==="constant"||r==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+t,u_aspect_ratio:p.width/p.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+u,u_pitch_with_map:+i,u_texsize:c,u_texture:0}},"symbolIconUniformValues"),Iy=l((r,e,t,i,n,o,a,s,u,c,p)=>{let h=n.transform;return V(Ay(r,e,t,i,n,o,a,s,u,c),{u_gamma_scale:i?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_device_pixel_ratio:n.pixelRatio,u_is_halo:+p})},"symbolSDFUniformValues"),vS=l((r,e,t,i,n,o,a,s,u,c)=>V(Iy(r,e,t,i,n,o,a,s,!0,u,!0),{u_texsize_icon:c,u_texture_icon:1}),"symbolTextAndIconUniformValues");d();var wS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_opacity:new U(r,e.u_opacity),u_color:new kt(r,e.u_color)}),"backgroundUniforms"),SS=l((r,e)=>({u_matrix:new re(r,e.u_matrix),u_opacity:new U(r,e.u_opacity),u_image:new Q(r,e.u_image),u_pattern_tl_a:new te(r,e.u_pattern_tl_a),u_pattern_br_a:new te(r,e.u_pattern_br_a),u_pattern_tl_b:new te(r,e.u_pattern_tl_b),u_pattern_br_b:new te(r,e.u_pattern_br_b),u_texsize:new te(r,e.u_texsize),u_mix:new U(r,e.u_mix),u_pattern_size_a:new te(r,e.u_pattern_size_a),u_pattern_size_b:new te(r,e.u_pattern_size_b),u_scale_a:new U(r,e.u_scale_a),u_scale_b:new U(r,e.u_scale_b),u_pixel_coord_upper:new te(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new te(r,e.u_pixel_coord_lower),u_tile_units_to_pixels:new U(r,e.u_tile_units_to_pixels)}),"backgroundPatternUniforms"),PS=l((r,e,t)=>({u_matrix:r,u_opacity:e,u_color:t}),"backgroundUniformValues"),TS=l((r,e,t,i,n,o)=>V(Fw(i,o,t,n),{u_matrix:r,u_opacity:e}),"backgroundPatternUniformValues");var MS={fillExtrusion:Rw,fillExtrusionPattern:Bw,fill:Vw,fillPattern:Uw,fillOutline:Nw,fillOutlinePattern:Gw,circle:Zw,collisionBox:$w,collisionCircle:Ww,debug:Jw,clippingMask:Yw,heatmap:Qw,heatmapTexture:eS,hillshade:iS,hillshadePrepare:nS,line:sS,lineGradient:lS,linePattern:uS,lineSDF:cS,raster:yS,symbolIcon:xS,symbolSDF:bS,symbolTextAndIcon:_S,background:wS,backgroundPattern:SS,terrain:Cw,terrainDepth:Ew,terrainCoords:kw};d();d();var Cy=class Cy{constructor(e,t,i){this.context=e;let n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.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)}};l(Cy,"IndexBuffer");var ju=Cy;d();var IL={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Ey=class Ey{constructor(e,t,i,n){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=n,this.context=e;let o=e.gl;this.buffer=o.createBuffer(),e.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.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 n=this.attributes[i],o=t.attributes[n.name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,t,i){for(let n=0;n<this.attributes.length;n++){let o=this.attributes[n],a=t.attributes[o.name];a!==void 0&&e.vertexAttribPointer(a,o.components,e[IL[o.type]],!1,this.itemSize,o.offset+this.itemSize*(i||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};l(Ey,"VertexBuffer");var Zu=Ey;d();d();d();var ky=new WeakMap;function Mn(r){var e;if(ky.has(r))return ky.get(r);{let t=(e=r.getParameter(r.VERSION))==null?void 0:e.startsWith("WebGL 2.0");return ky.set(r,t),t}}l(Mn,"isWebGL2");var Ly=class Ly{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)}};l(Ly,"BaseValue");var be=Ly,Dy=class Dy extends be{getDefault(){return X.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)}};l(Dy,"ClearColor");var Hu=Dy,zy=class zy extends be{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}};l(zy,"ClearDepth");var $u=zy,Fy=class Fy extends be{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}};l(Fy,"ClearStencil");var Wu=Fy,Ry=class Ry extends be{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)}};l(Ry,"ColorMask");var Xu=Ry,By=class By extends be{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}};l(By,"DepthMask");var Ku=By,Oy=class Oy extends be{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}};l(Oy,"StencilMask");var Ju=Oy,Vy=class Vy extends be{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)}};l(Vy,"StencilFunc");var Yu=Vy,Uy=class Uy extends be{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)}};l(Uy,"StencilOp");var Qu=Uy,Ny=class Ny extends be{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}};l(Ny,"StencilTest");var ec=Ny,Gy=class Gy extends be{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)}};l(Gy,"DepthRange");var tc=Gy,qy=class qy extends be{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}};l(qy,"DepthTest");var rc=qy,jy=class jy extends be{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}};l(jy,"DepthFunc");var ic=jy,Zy=class Zy extends be{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}};l(Zy,"Blend");var nc=Zy,Hy=class Hy extends be{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)}};l(Hy,"BlendFunc");var oc=Hy,$y=class $y extends be{getDefault(){return X.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)}};l($y,"BlendColor");var ac=$y,Wy=class Wy extends be{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}};l(Wy,"BlendEquation");var sc=Wy,Xy=class Xy extends be{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}};l(Xy,"CullFace");var lc=Xy,Ky=class Ky extends be{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}};l(Ky,"CullFaceSide");var uc=Ky,Jy=class Jy extends be{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}};l(Jy,"FrontFace");var cc=Jy,Yy=class Yy extends be{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};l(Yy,"ProgramValue");var pc=Yy,Qy=class Qy extends be{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}};l(Qy,"ActiveTextureUnit");var hc=Qy,eg=class eg extends be{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)}};l(eg,"Viewport");var fc=eg,tg=class tg extends be{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}};l(tg,"BindFramebuffer");var mc=tg,rg=class rg extends be{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}};l(rg,"BindRenderbuffer");var dc=rg,ig=class ig extends be{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}};l(ig,"BindTexture");var yc=ig,ng=class ng extends be{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}};l(ng,"BindVertexBuffer");var gc=ng,og=class og extends be{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}};l(og,"BindElementBuffer");var xc=og,ag=class ag extends be{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;let t=this.gl;Mn(t)?t.bindVertexArray(e):(i=t.getExtension("OES_vertex_array_object"))==null||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}};l(ag,"BindVertexArray");var bc=ag,sg=class sg extends be{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}};l(sg,"PixelStoreUnpack");var _c=sg,lg=class lg extends be{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}};l(lg,"PixelStoreUnpackPremultiplyAlpha");var vc=lg,ug=class ug extends be{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}};l(ug,"PixelStoreUnpackFlipY");var wc=ug,cg=class cg extends be{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}};l(cg,"FramebufferAttachment");var Ia=cg,pg=class pg extends Ia{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}};l(pg,"ColorAttachment");var Sc=pg,hg=class hg extends Ia{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}};l(hg,"DepthAttachment");var Pc=hg,fg=class fg extends Ia{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}};l(fg,"DepthStencilAttachment");var Tc=fg;var mg=class mg{constructor(e,t,i,n,o){this.context=e,this.width=t,this.height=i;let a=e.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new Sc(e,s),n)this.depthAttachment=o?new Tc(e,s):new Pc(e,s);else if(o)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}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)}};l(mg,"Framebuffer");var Mc=mg;d();var CL=0,AS=1,EL=771,dg=class dg{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};l(dg,"ColorMode");var ke=dg;ke.Replace=[AS,CL];ke.disabled=new ke(ke.Replace,X.transparent,[!1,!1,!1,!1]);ke.unblended=new ke(ke.Replace,X.transparent,[!0,!0,!0,!0]);ke.alphaBlended=new ke([AS,EL],X.transparent,[!0,!0,!0,!0]);var yg=class yg{constructor(e){var t,i;if(this.gl=e,this.clearColor=new Hu(this),this.clearDepth=new $u(this),this.clearStencil=new Wu(this),this.colorMask=new Xu(this),this.depthMask=new Ku(this),this.stencilMask=new Ju(this),this.stencilFunc=new Yu(this),this.stencilOp=new Qu(this),this.stencilTest=new ec(this),this.depthRange=new tc(this),this.depthTest=new rc(this),this.depthFunc=new ic(this),this.blend=new nc(this),this.blendFunc=new oc(this),this.blendColor=new ac(this),this.blendEquation=new sc(this),this.cullFace=new lc(this),this.cullFaceSide=new uc(this),this.frontFace=new cc(this),this.program=new pc(this),this.activeTexture=new hc(this),this.viewport=new fc(this),this.bindFramebuffer=new mc(this),this.bindRenderbuffer=new dc(this),this.bindTexture=new yc(this),this.bindVertexBuffer=new gc(this),this.bindElementBuffer=new xc(this),this.bindVertexArray=new bc(this),this.pixelStoreUnpack=new _c(this),this.pixelStoreUnpackPremultiplyAlpha=new vc(this),this.pixelStoreUnpackFlipY=new wc(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),Mn(e)){this.HALF_FLOAT=e.HALF_FLOAT;let n=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(t=e.RGBA16F)!=null?t:n==null?void 0:n.RGBA16F_EXT,this.RGB16F=(i=e.RGB16F)!=null?i:n==null?void 0:n.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let n=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=n==null?void 0:n.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 ju(this,e,t)}createVertexBuffer(e,t,i){return new Zu(this,e,t,i)}createRenderbuffer(e,t,i){let n=this.gl,o=n.createRenderbuffer();return this.bindRenderbuffer.set(o),n.renderbufferStorage(n.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),o}createFramebuffer(e,t,i,n){return new Mc(this,e,t,i,n)}clear({color:e,depth:t,stencil:i}){let n=this.gl,o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof i<"u"&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}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){Qt(e.blendFunction,ke.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 Mn(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return Mn(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)}};l(yg,"Context");var Ac=yg;d();var gg=class gg{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};l(gg,"DepthMode");var ee=gg;ee.ReadOnly=!1;ee.ReadWrite=!0;ee.disabled=new ee(519,ee.ReadOnly,[0,1]);d();var xg=class xg{constructor(e,t,i,n,o,a){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=o,this.pass=a}};l(xg,"StencilMode");var fe=xg;fe.disabled=new fe({func:519,mask:0},0,0,7680,7680,7680);d();var bg=class bg{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};l(bg,"CullFaceMode");var ue=bg;ue.disabled=new ue(!1,1029,2305);ue.backCCW=new ue(!0,1029,2305);d();var vg=ae(ge(),1);d();var Ic;function _g(r,e,t,i,n,o,a){let s=r.context,u=s.gl,c=r.useProgram("collisionBox"),p=[],h=0,f=0;for(let w=0;w<i.length;w++){let _=i[w],S=e.getTile(_),P=S.getBucket(t);if(!P)continue;let T=_.posMatrix;(n[0]!==0||n[1]!==0)&&(T=r.translatePosMatrix(_.posMatrix,S,n,o));let L=a?P.textCollisionBox:P.iconCollisionBox,C=P.collisionCircleArray;if(C.length>0){let E=q.create(),I=T;q.mul(E,P.placementInvProjMatrix,r.transform.glCoordMatrix),q.mul(E,E,P.placementViewportMatrix),p.push({circleArray:C,circleOffset:f,transform:I,invTransform:E,coord:_}),h+=C.length/4,f=h}L&&c.draw(s,u.LINES,ee.disabled,fe.disabled,r.colorModeForRenderPass(),ue.disabled,Xw(T,r.transform,S),r.style.map.terrain&&r.style.map.terrain.getTerrainData(_),t.id,L.layoutVertexBuffer,L.indexBuffer,L.segments,null,r.transform.zoom,null,null,L.collisionVertexBuffer)}if(!a||!p.length)return;let m=r.useProgram("collisionCircle"),y=new wl;y.resize(h*4),y._trim();let g=0;for(let w of p)for(let _=0;_<w.circleArray.length/4;_++){let S=_*4,P=w.circleArray[S+0],T=w.circleArray[S+1],L=w.circleArray[S+2],C=w.circleArray[S+3];y.emplace(g++,P,T,L,C,0),y.emplace(g++,P,T,L,C,1),y.emplace(g++,P,T,L,C,2),y.emplace(g++,P,T,L,C,3)}(!Ic||Ic.length<h*2)&&(Ic=kL(h));let x=s.createIndexBuffer(Ic,!0),b=s.createVertexBuffer(y,b0.members,!0);for(let w of p){let _=Kw(w.transform,w.invTransform,r.transform);m.draw(s,u.TRIANGLES,ee.disabled,fe.disabled,r.colorModeForRenderPass(),ue.disabled,_,r.style.map.terrain&&r.style.map.terrain.getTerrainData(w.coord),t.id,b,x,me.simpleSegment(0,w.circleOffset*2,w.circleArray.length,w.circleArray.length/2),null,r.transform.zoom,null,null,null)}b.destroy(),x.destroy()}l(_g,"drawCollisionDebug");function kL(r){let e=r*2,t=new Pl;t.resize(e),t._trim();for(let i=0;i<e;i++){let n=i*6;t.uint16[n+0]=i*4+0,t.uint16[n+1]=i*4+1,t.uint16[n+2]=i*4+2,t.uint16[n+3]=i*4+2,t.uint16[n+4]=i*4+3,t.uint16[n+5]=i*4+0}return t}l(kL,"createQuadTriangles");var LL=q.identity(new Float32Array(16));function ES(r,e,t,i,n){if(r.renderPass!=="translucent")return;let o=fe.disabled,a=r.colorModeForRenderPass();(t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&zL(i,r,t,e,t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),n),t.paint.get("icon-opacity").constantOr(1)!==0&&IS(r,e,t,i,!1,t.paint.get("icon-translate"),t.paint.get("icon-translate-anchor"),t.layout.get("icon-rotation-alignment"),t.layout.get("icon-pitch-alignment"),t.layout.get("icon-keep-upright"),o,a),t.paint.get("text-opacity").constantOr(1)!==0&&IS(r,e,t,i,!0,t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),t.layout.get("text-keep-upright"),o,a),e.map.showCollisionBoxes&&(_g(r,e,t,i,t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),!0),_g(r,e,t,i,t.paint.get("icon-translate"),t.paint.get("icon-translate-anchor"),!1))}l(ES,"drawSymbols");function DL(r,e,t,i,n,o){let{horizontalAlign:a,verticalAlign:s}=Jl(r),u=-(a-.5)*e,c=-(s-.5)*t;return new vg.default((u/n+i[0])*o,(c/n+i[1])*o)}l(DL,"calculateVariableRenderShift");function zL(r,e,t,i,n,o,a){let s=e.transform,u=n==="map",c=o==="map";for(let p of r){let h=i.getTile(p),f=h.getBucket(t);if(!f||!f.text||!f.text.segments.get().length)continue;let m=f.textSizeData,y=gi(m,s.zoom),g=$e(h,1,e.transform.zoom),x=ba(p.posMatrix,c,u,e.transform,g),b=t.layout.get("icon-text-fit")!=="none"&&f.hasIconData();if(y){let w=Math.pow(2,s.zoom-h.tileID.overscaledZ),_=e.style.map.terrain?(S,P)=>e.style.map.terrain.getElevation(p,S,P):null;FL(f,u,c,a,s,x,p.posMatrix,w,y,b,_)}}}l(zL,"updateVariableAnchors");function FL(r,e,t,i,n,o,a,s,u,c,p){let h=r.text.placedSymbolArray,f=r.text.dynamicLayoutVertexArray,m=r.icon.dynamicLayoutVertexArray,y={};f.clear();for(let g=0;g<h.length;g++){let x=h.get(g),b=r.allowVerticalPlacement&&!x.placedOrientation,w=!x.hidden&&x.crossTileID&&!b?i[x.crossTileID]:null;if(!w)Si(x.numGlyphs,f);else{let _=new vg.default(x.anchorX,x.anchorY),S=bt(_,t?a:o,p),P=_a(n.cameraToCenterDistance,S.signedDistanceFromCamera),T=dn(r.textSizeData,u,x)*P/Dr;t&&(T*=r.tilePixelRatio/s);let{width:L,height:C,anchor:E,textOffset:I,textBoxScale:R}=w,z=DL(E,L,C,I,R,T),k=t?bt(_.add(z),o,p).point:S.point.add(e?z.rotate(-n.angle):z),M=r.allowVerticalPlacement&&x.placedOrientation===2?Math.PI/2:0;for(let G=0;G<x.numGlyphs;G++)xi(f,k,M);c&&x.associatedIconIndex>=0&&(y[x.associatedIconIndex]={shiftedAnchor:k,angle:M})}}if(c){m.clear();let g=r.icon.placedSymbolArray;for(let x=0;x<g.length;x++){let b=g.get(x);if(b.hidden)Si(b.numGlyphs,m);else{let w=y[x];if(!w)Si(b.numGlyphs,m);else for(let _=0;_<b.numGlyphs;_++)xi(m,w.shiftedAnchor,w.angle)}}r.icon.dynamicLayoutVertexBuffer.updateData(m)}r.text.dynamicLayoutVertexBuffer.updateData(f)}l(FL,"updateVariableAnchorsForBucket");function RL(r,e,t){return t.iconsInText&&e?"symbolTextAndIcon":r?"symbolSDF":"symbolIcon"}l(RL,"getSymbolProgramName");function IS(r,e,t,i,n,o,a,s,u,c,p,h){let f=r.context,m=f.gl,y=r.transform,g=s==="map",x=u==="map",b=s!=="viewport"&&t.layout.get("symbol-placement")!=="point",w=g&&!x&&!b,_=!t.layout.get("symbol-sort-key").isConstant(),S=!1,P=r.depthModeForSublayer(0,ee.ReadOnly),T=t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"),L=[];for(let C of i){let E=e.getTile(C),I=E.getBucket(t);if(!I)continue;let R=n?I.text:I.icon;if(!R||!R.segments.get().length||!R.hasVisibleVertices)continue;let z=R.programConfigurations.get(t.id),k=n||I.sdfIcons,M=n?I.textSizeData:I.iconSizeData,G=x||y.pitch!==0,K=r.useProgram(RL(k,n,I),z),ne=gi(M,y.zoom),J=r.style.map.terrain&&r.style.map.terrain.getTerrainData(C),W,Ye=[0,0],Ve,ce,Me=null,Qe;if(n){if(Ve=E.glyphAtlasTexture,ce=m.LINEAR,W=E.glyphAtlasTexture.size,I.iconsInText){Ye=E.imageAtlasTexture.size,Me=E.imageAtlasTexture;let Ze=M.kind==="composite"||M.kind==="camera";Qe=G||r.options.rotating||r.options.zooming||Ze?m.LINEAR:m.NEAREST}}else{let Ze=t.layout.get("icon-size").constantOr(0)!==1||I.iconsNeedLinear;Ve=E.imageAtlasTexture,ce=k||r.options.rotating||r.options.zooming||Ze||G?m.LINEAR:m.NEAREST,W=E.imageAtlasTexture.size}let mr=$e(E,1,r.transform.zoom),dr=ba(C.posMatrix,x,g,r.transform,mr),zt=Mu(C.posMatrix,x,g,r.transform,mr),Xt=T&&I.hasTextData(),Gr=t.layout.get("icon-text-fit")!=="none"&&Xt&&I.hasIconData();if(b){let Ze=r.style.map.terrain?(Yt,jr)=>r.style.map.terrain.getElevation(C,Yt,jr):null,ct=t.layout.get("text-rotation-alignment")==="map";x1(I,C.posMatrix,r,n,dr,zt,x,c,ct,Ze)}let Kt=r.translatePosMatrix(C.posMatrix,E,o,a),Jt=b||n&&T||Gr?LL:dr,et=r.translatePosMatrix(zt,E,o,a,!0),ot=k&&t.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1)!==0,tt;k?I.iconsInText?tt=vS(M.kind,ne,w,x,r,Kt,Jt,et,W,Ye):tt=Iy(M.kind,ne,w,x,r,Kt,Jt,et,n,W,!0):tt=Ay(M.kind,ne,w,x,r,Kt,Jt,et,n,W);let qr={program:K,buffers:R,uniformValues:tt,atlasTexture:Ve,atlasTextureIcon:Me,atlasInterpolation:ce,atlasInterpolationIcon:Qe,isSDF:k,hasHalo:ot};if(_&&I.canOverlap){S=!0;let Ze=R.segments.get();for(let ct of Ze)L.push({segments:new me([ct]),sortKey:ct.sortKey,state:qr,terrainData:J})}else L.push({segments:R.segments,sortKey:0,state:qr,terrainData:J})}S&&L.sort((C,E)=>C.sortKey-E.sortKey);for(let C of L){let E=C.state;if(f.activeTexture.set(m.TEXTURE0),E.atlasTexture.bind(E.atlasInterpolation,m.CLAMP_TO_EDGE),E.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),E.atlasTextureIcon&&E.atlasTextureIcon.bind(E.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),E.isSDF){let I=E.uniformValues;E.hasHalo&&(I.u_is_halo=1,CS(E.buffers,C.segments,t,r,E.program,P,p,h,I,C.terrainData)),I.u_is_halo=0}CS(E.buffers,C.segments,t,r,E.program,P,p,h,E.uniformValues,C.terrainData)}}l(IS,"drawLayerSymbols");function CS(r,e,t,i,n,o,a,s,u,c){let p=i.context,h=p.gl;n.draw(p,h.TRIANGLES,o,a,s,ue.disabled,u,c,t.id,r.layoutVertexBuffer,r.indexBuffer,e,t.paint,i.transform.zoom,r.programConfigurations.get(t.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}l(CS,"drawSymbolElements");d();function kS(r,e,t,i){if(r.renderPass!=="translucent")return;let n=t.paint.get("circle-opacity"),o=t.paint.get("circle-stroke-width"),a=t.paint.get("circle-stroke-opacity"),s=!t.layout.get("circle-sort-key").isConstant();if(n.constantOr(1)===0&&(o.constantOr(1)===0||a.constantOr(1)===0))return;let u=r.context,c=u.gl,p=r.depthModeForSublayer(0,ee.ReadOnly),h=fe.disabled,f=r.colorModeForRenderPass(),m=[];for(let y=0;y<i.length;y++){let g=i[y],x=e.getTile(g),b=x.getBucket(t);if(!b)continue;let w=b.programConfigurations.get(t.id),_=r.useProgram("circle",w),S=b.layoutVertexBuffer,P=b.indexBuffer,T=r.style.map.terrain&&r.style.map.terrain.getTerrainData(g),L=Hw(r,g,x,t),C={programConfiguration:w,program:_,layoutVertexBuffer:S,indexBuffer:P,uniformValues:L,terrainData:T};if(s){let E=b.segments.get();for(let I of E)m.push({segments:new me([I]),sortKey:I.sortKey,state:C})}else m.push({segments:b.segments,sortKey:0,state:C})}s&&m.sort((y,g)=>y.sortKey-g.sortKey);for(let y of m){let{programConfiguration:g,program:x,layoutVertexBuffer:b,indexBuffer:w,uniformValues:_,terrainData:S}=y.state,P=y.segments;x.draw(u,c.TRIANGLES,p,h,f,ue.disabled,_,S,t.id,b,w,P,t.paint,r.transform.zoom,g)}}l(kS,"drawCircles");d();function LS(r,e,t,i){if(t.paint.get("heatmap-opacity")!==0)if(r.renderPass==="offscreen"){let n=r.context,o=n.gl,a=fe.disabled,s=new ke([o.ONE,o.ONE],X.transparent,[!0,!0,!0,!0]);BL(n,r,t),n.clear({color:X.transparent});for(let u=0;u<i.length;u++){let c=i[u];if(e.hasRenderableParent(c))continue;let p=e.getTile(c),h=p.getBucket(t);if(!h)continue;let f=h.programConfigurations.get(t.id),m=r.useProgram("heatmap",f),{zoom:y}=r.transform;m.draw(n,o.TRIANGLES,ee.disabled,a,s,ue.disabled,tS(c.posMatrix,p,y,t.paint.get("heatmap-intensity")),null,t.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,t.paint,r.transform.zoom,f)}n.viewport.set([0,0,r.width,r.height])}else r.renderPass==="translucent"&&(r.context.setColorMode(r.colorModeForRenderPass()),VL(r,t))}l(LS,"drawHeatmap");function BL(r,e,t){let i=r.gl;r.activeTexture.set(i.TEXTURE1),r.viewport.set([0,0,e.width/4,e.height/4]);let n=t.heatmapFbo;if(n)i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),r.bindFramebuffer.set(n.framebuffer);else{let o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),n=t.heatmapFbo=r.createFramebuffer(e.width/4,e.height/4,!1,!1),OL(r,e,o,n)}}l(BL,"bindFramebuffer");function OL(r,e,t,i){var s,u;let n=r.gl,o=(s=r.HALF_FLOAT)!=null?s:n.UNSIGNED_BYTE,a=(u=r.RGBA16F)!=null?u:n.RGBA;n.texImage2D(n.TEXTURE_2D,0,a,e.width/4,e.height/4,0,n.RGBA,o,null),i.colorAttachment.set(t)}l(OL,"bindTextureToFramebuffer");function VL(r,e){let t=r.context,i=t.gl,n=e.heatmapFbo;if(!n)return;t.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),t.activeTexture.set(i.TEXTURE1);let o=e.colorRampTexture;o||(o=e.colorRampTexture=new ve(t,e.colorRamp,i.RGBA)),o.bind(i.LINEAR,i.CLAMP_TO_EDGE),r.useProgram("heatmapTexture").draw(t,i.TRIANGLES,ee.disabled,fe.disabled,r.colorModeForRenderPass(),ue.disabled,rS(r,e,0,1),null,e.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,e.paint,r.transform.zoom)}l(VL,"renderTextureToMap");d();function DS(r,e,t,i){if(r.renderPass!=="translucent")return;let n=t.paint.get("line-opacity"),o=t.paint.get("line-width");if(n.constantOr(1)===0||o.constantOr(1)===0)return;let a=r.depthModeForSublayer(0,ee.ReadOnly),s=r.colorModeForRenderPass(),u=t.paint.get("line-dasharray"),c=t.paint.get("line-pattern"),p=c.constantOr(1),h=t.paint.get("line-gradient"),f=t.getCrossfadeParameters(),m=p?"linePattern":u?"lineSDF":h?"lineGradient":"line",y=r.context,g=y.gl,x=!0;for(let b of i){let w=e.getTile(b);if(p&&!w.patternsLoaded())continue;let _=w.getBucket(t);if(!_)continue;let S=_.programConfigurations.get(t.id),P=r.context.program.get(),T=r.useProgram(m,S),L=x||T.program!==P,C=r.style.map.terrain&&r.style.map.terrain.getTerrainData(b),E=c.constantOr(null);if(E&&w.imageAtlas){let z=w.imageAtlas,k=z.patternPositions[E.to.toString()],M=z.patternPositions[E.from.toString()];k&&M&&S.setConstantPatternPositions(k,M)}let I=C?b:null,R=p?hS(r,w,t,f,I):u?fS(r,w,t,u,f,I):h?pS(r,w,t,_.lineClipsArray.length,I):qu(r,w,t,I);if(p)y.activeTexture.set(g.TEXTURE0),w.imageAtlasTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),S.updatePaintBuffers(f);else if(u&&(L||r.lineAtlas.dirty))y.activeTexture.set(g.TEXTURE0),r.lineAtlas.bind(y);else if(h){let z=_.gradients[t.id],k=z.texture;if(t.gradientVersion!==z.version){let M=256;if(t.stepInterpolant){let G=e.getSource().maxzoom,K=b.canonical.z===G?Math.ceil(1<<r.transform.maxZoom-b.canonical.z):1,W=_.maxLineLength/8192*1024*K;M=Ae(Qx(W),256,y.maxTextureSize)}z.gradient=Rl({expression:t.gradientExpression(),evaluationKey:"lineProgress",resolution:M,image:z.gradient||void 0,clips:_.lineClipsArray}),z.texture?z.texture.update(z.gradient):z.texture=new ve(y,z.gradient,g.RGBA),z.version=t.gradientVersion,k=z.texture}y.activeTexture.set(g.TEXTURE0),k.bind(t.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}T.draw(y,g.TRIANGLES,a,r.stencilModeForClipping(b),s,ue.disabled,R,C,t.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,t.paint,r.transform.zoom,S,_.layoutVertexBuffer2),x=!1}}l(DS,"drawLine");d();d();function Cc(r,e,t,i,n){if(!t||!i||!i.imageAtlas)return;let o=i.imageAtlas.patternPositions,a=o[t.to.toString()],s=o[t.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){let u=n.getPaintProperty(e);a=o[u],s=o[u]}a&&s&&r.setConstantPatternPositions(a,s)}l(Cc,"updatePatternPositionsInProgram");function FS(r,e,t,i){let n=t.paint.get("fill-color"),o=t.paint.get("fill-opacity");if(o.constantOr(1)===0)return;let a=r.colorModeForRenderPass(),s=t.paint.get("fill-pattern"),u=r.opaquePassEnabledForLayer()&&!s.constantOr(1)&&n.constantOr(X.transparent).a===1&&o.constantOr(0)===1?"opaque":"translucent";if(r.renderPass===u){let c=r.depthModeForSublayer(1,r.renderPass==="opaque"?ee.ReadWrite:ee.ReadOnly);zS(r,e,t,i,c,a,!1)}if(r.renderPass==="translucent"&&t.paint.get("fill-antialias")){let c=r.depthModeForSublayer(t.getPaintProperty("fill-outline-color")?2:0,ee.ReadOnly);zS(r,e,t,i,c,a,!0)}}l(FS,"drawFill");function zS(r,e,t,i,n,o,a){let s=r.context.gl,u="fill-pattern",c=t.paint.get(u),p=c&&c.constantOr(1),h=t.getCrossfadeParameters(),f,m,y,g,x;a?(m=p&&!t.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=s.LINES):(m=p?"fillPattern":"fill",f=s.TRIANGLES);let b=c.constantOr(null);for(let w of i){let _=e.getTile(w);if(p&&!_.patternsLoaded())continue;let S=_.getBucket(t);if(!S)continue;let P=S.programConfigurations.get(t.id),T=r.useProgram(m,P),L=r.style.map.terrain&&r.style.map.terrain.getTerrainData(w);p&&(r.context.activeTexture.set(s.TEXTURE0),_.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),P.updatePaintBuffers(h)),Cc(P,u,b,_,t);let C=L?w:null,E=C?C.posMatrix:w.posMatrix,I=r.translatePosMatrix(E,_,t.paint.get("fill-translate"),t.paint.get("fill-translate-anchor"));if(!a)g=S.indexBuffer,x=S.segments,y=p?Py(I,r,h,_):Sy(I);else{g=S.indexBuffer2,x=S.segments2;let R=[s.drawingBufferWidth,s.drawingBufferHeight];y=m==="fillOutlinePattern"&&p?jw(I,r,h,_,R):qw(I,R)}T.draw(r.context,f,n,r.stencilModeForClipping(w),o,ue.disabled,y,L,t.id,S.layoutVertexBuffer,g,x,t.paint,r.transform.zoom,P)}}l(zS,"drawFillTiles");d();function RS(r,e,t,i){let n=t.paint.get("fill-extrusion-opacity");if(n!==0&&r.renderPass==="translucent"){let o=new ee(r.context.gl.LEQUAL,ee.ReadWrite,r.depthRangeFor3D);if(n===1&&!t.paint.get("fill-extrusion-pattern").constantOr(1)){let a=r.colorModeForRenderPass();wg(r,e,t,i,o,fe.disabled,a)}else wg(r,e,t,i,o,fe.disabled,ke.disabled),wg(r,e,t,i,o,r.stencilModeFor3D(),r.colorModeForRenderPass())}}l(RS,"drawFillExtrusion");function wg(r,e,t,i,n,o,a){let s=r.context,u=s.gl,c="fill-extrusion-pattern",p=t.paint.get(c),h=p.constantOr(1),f=t.getCrossfadeParameters(),m=t.paint.get("fill-extrusion-opacity"),y=p.constantOr(null);for(let g of i){let x=e.getTile(g),b=x.getBucket(t);if(!b)continue;let w=r.style.map.terrain&&r.style.map.terrain.getTerrainData(g),_=b.programConfigurations.get(t.id),S=r.useProgram(h?"fillExtrusionPattern":"fillExtrusion",_);h&&(r.context.activeTexture.set(u.TEXTURE0),x.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),_.updatePaintBuffers(f)),Cc(_,c,y,x,t);let P=r.translatePosMatrix(g.posMatrix,x,t.paint.get("fill-extrusion-translate"),t.paint.get("fill-extrusion-translate-anchor")),T=t.paint.get("fill-extrusion-vertical-gradient"),L=h?Ow(P,r,T,m,g,f,x):wy(P,r,T,m);S.draw(s,s.gl.TRIANGLES,n,o,a,ue.backCCW,L,w,t.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,t.paint,r.transform.zoom,_,r.style.map.terrain&&b.centroidVertexBuffer)}}l(wg,"drawExtrusionTiles");d();function BS(r,e,t,i){if(r.renderPass!=="offscreen"&&r.renderPass!=="translucent")return;let n=r.context,o=r.depthModeForSublayer(0,ee.ReadOnly),a=r.colorModeForRenderPass(),[s,u]=r.renderPass==="translucent"?r.stencilConfigForOverlap(i):[{},i];for(let c of u){let p=e.getTile(c);typeof p.needsHillshadePrepare<"u"&&p.needsHillshadePrepare&&r.renderPass==="offscreen"?NL(r,p,t,o,fe.disabled,a):r.renderPass==="translucent"&&UL(r,c,p,t,o,s[c.overscaledZ],a)}n.viewport.set([0,0,r.width,r.height])}l(BS,"drawHillshade");function UL(r,e,t,i,n,o,a){let s=r.context,u=s.gl,c=t.fbo;if(!c)return;let p=r.useProgram("hillshade"),h=r.style.map.terrain&&r.style.map.terrain.getTerrainData(e);s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,c.colorAttachment.get());let f=h?e:null;p.draw(s,u.TRIANGLES,n,o,a,ue.disabled,oS(r,t,i,f),h,i.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments)}l(UL,"renderHillshade");function NL(r,e,t,i,n,o){let a=r.context,s=a.gl,u=e.dem;if(u&&u.data){let c=u.dim,p=u.stride,h=u.getPixels();if(a.activeTexture.set(s.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||r.getTileTexture(p),e.demTexture){let m=e.demTexture;m.update(h,{premultiply:!1}),m.bind(s.NEAREST,s.CLAMP_TO_EDGE)}else e.demTexture=new ve(a,h,s.RGBA,{premultiply:!1}),e.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);a.activeTexture.set(s.TEXTURE0);let f=e.fbo;if(!f){let m=new ve(a,{width:c,height:c,data:null},s.RGBA);m.bind(s.LINEAR,s.CLAMP_TO_EDGE),f=e.fbo=a.createFramebuffer(c,c,!0,!1),f.colorAttachment.set(m.texture)}a.bindFramebuffer.set(f.framebuffer),a.viewport.set([0,0,c,c]),r.useProgram("hillshadePrepare").draw(a,s.TRIANGLES,i,n,o,ue.disabled,aS(e.tileID,u),null,t.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments),e.needsHillshadePrepare=!1}}l(NL,"prepareHillshade");d();function OS(r,e,t,i){if(r.renderPass!=="translucent"||t.paint.get("raster-opacity")===0||!i.length)return;let n=r.context,o=n.gl,a=e.getSource(),s=r.useProgram("raster"),u=r.colorModeForRenderPass(),[c,p]=a instanceof Lt?[{},i]:r.stencilConfigForOverlap(i),h=p[p.length-1].overscaledZ,f=!r.options.moving;for(let m of p){let y=r.depthModeForSublayer(m.overscaledZ-h,t.paint.get("raster-opacity")===1?ee.ReadWrite:ee.ReadOnly,o.LESS),g=e.getTile(m);g.registerFadeDuration(t.paint.get("raster-fade-duration"));let x=e.findLoadedParent(m,0),b=GL(g,x,e,t,r.transform,r.style.map.terrain),w,_,S=t.paint.get("raster-resampling")==="nearest"?o.NEAREST:o.LINEAR;n.activeTexture.set(o.TEXTURE0),g.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.activeTexture.set(o.TEXTURE1),x?(x.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),w=Math.pow(2,x.tileID.overscaledZ-g.tileID.overscaledZ),_=[g.tileID.canonical.x*w%1,g.tileID.canonical.y*w%1]):g.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);let P=r.style.map.terrain&&r.style.map.terrain.getTerrainData(m),T=P?m:null,L=T?T.posMatrix:r.transform.calculatePosMatrix(m.toUnwrapped(),f),C=gS(L,_||[0,0],w||1,b,t);a instanceof Lt?s.draw(n,o.TRIANGLES,y,fe.disabled,u,ue.disabled,C,P,t.id,a.boundsBuffer,r.quadTriangleIndexBuffer,a.boundsSegments):s.draw(n,o.TRIANGLES,y,c[m.overscaledZ],u,ue.disabled,C,P,t.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments)}}l(OS,"drawRaster");function GL(r,e,t,i,n,o){let a=i.paint.get("raster-fade-duration");if(!o&&a>0){let s=Y.now(),u=(s-r.timeAdded)/a,c=e?(s-e.timeAdded)/a:-1,p=t.getSource(),h=n.coveringZoomLevel({tileSize:p.tileSize,roundZoom:p.roundZoom}),f=!e||Math.abs(e.tileID.overscaledZ-h)>Math.abs(r.tileID.overscaledZ-h),m=f&&r.refreshedUponExpiration?1:Ae(f?u:1-c,0,1);return r.refreshedUponExpiration&&u>=1&&(r.refreshedUponExpiration=!1),e?{opacity:1,mix:1-m}:{opacity:m,mix:0}}else return{opacity:1,mix:0}}l(GL,"getFadeValues");d();function VS(r,e,t,i){let n=t.paint.get("background-color"),o=t.paint.get("background-opacity");if(o===0)return;let a=r.context,s=a.gl,u=r.transform,c=u.tileSize,p=t.paint.get("background-pattern");if(r.isPatternMissing(p))return;let h=!p&&n.a===1&&o===1&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==h)return;let f=fe.disabled,m=r.depthModeForSublayer(0,h==="opaque"?ee.ReadWrite:ee.ReadOnly),y=r.colorModeForRenderPass(),g=r.useProgram(p?"backgroundPattern":"background"),x=i||u.coveringTiles({tileSize:c,terrain:r.style.map.terrain});p&&(a.activeTexture.set(s.TEXTURE0),r.imageManager.bind(r.context));let b=t.getCrossfadeParameters();for(let w of x){let _=i?w.posMatrix:r.transform.calculatePosMatrix(w.toUnwrapped()),S=p?TS(_,o,r,p,{tileID:w,tileSize:c},b):PS(_,o,n),P=r.style.map.terrain&&r.style.map.terrain.getTerrainData(w);g.draw(a,s.TRIANGLES,m,f,y,ue.disabled,S,P,t.id,r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}l(VS,"drawBackground");d();var qL=new X(1,0,0,1),jL=new X(0,1,0,1),ZL=new X(0,0,1,1),HL=new X(1,0,1,1),$L=new X(0,1,1,1);function GS(r){let e=r.transform.padding,t=3;US(r,r.transform.height-(e.top||0),t,qL),US(r,e.bottom||0,t,jL),NS(r,e.left||0,t,ZL),NS(r,r.transform.width-(e.right||0),t,HL);let i=r.transform.centerPoint;WL(r,i.x,r.transform.height-i.y,$L)}l(GS,"drawDebugPadding");function WL(r,e,t,i){Ec(r,e-2/2,t-20/2,2,20,i),Ec(r,e-20/2,t-2/2,20,2,i)}l(WL,"drawCrosshair");function US(r,e,t,i){Ec(r,0,e+t/2,r.transform.width,t,i)}l(US,"drawHorizontalLine");function NS(r,e,t,i){Ec(r,e-t/2,0,t,r.transform.height,i)}l(NS,"drawVerticalLine");function Ec(r,e,t,i,n,o){let a=r.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*r.pixelRatio,t*r.pixelRatio,i*r.pixelRatio,n*r.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}l(Ec,"drawDebugSSRect");function qS(r,e,t){for(let i=0;i<t.length;i++)XL(r,e,t[i])}l(qS,"drawDebug");function XL(r,e,t){let i=r.context,n=i.gl,o=t.posMatrix,a=r.useProgram("debug"),s=ee.disabled,u=fe.disabled,c=r.colorModeForRenderPass(),p="$debug",h=r.style.map.terrain&&r.style.map.terrain.getTerrainData(t);i.activeTexture.set(n.TEXTURE0);let f=e.getTileByID(t.key).latestRawTileData,m=f&&f.byteLength||0,y=Math.floor(m/1024),g=e.getTile(t).tileSize,x=512/Math.min(g,512)*(t.overscaledZ/r.transform.zoom)*.5,b=t.canonical.toString();t.overscaledZ!==t.canonical.z&&(b+=" => ".concat(t.overscaledZ));let w="".concat(b," ").concat(y,"kB");KL(r,w),a.draw(i,n.TRIANGLES,s,u,ke.alphaBlended,ue.disabled,Ty(o,X.transparent,x),null,p,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments),a.draw(i,n.LINE_STRIP,s,u,c,ue.disabled,Ty(o,X.red),h,p,r.debugBuffer,r.tileBorderIndexBuffer,r.debugSegments)}l(XL,"drawDebugTile");function KL(r,e){r.initDebugOverlayCanvas();let t=r.debugOverlayCanvas,i=r.context.gl,n=r.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,t.width,t.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(e,5,5),n.strokeText(e,5,5),r.debugOverlayTexture.update(t),r.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}l(KL,"drawTextToOverlay");function jS(r,e){let t=null,n=Object.values(r._layers).flatMap(u=>u.source&&!u.isHidden(e)?[r.sourceCaches[u.source]]:[]),o=n.filter(u=>u.getSource().type==="vector"),a=n.filter(u=>u.getSource().type!=="vector"),s=l(u=>{(!t||t.getSource().maxzoom<u.getSource().maxzoom)&&(t=u)},"considerSource");return o.forEach(u=>s(u)),t||a.forEach(u=>s(u)),t}l(jS,"selectDebugSource");d();function ZS(r,e,t){let i=r.context,n=t.implementation;if(r.renderPass==="offscreen"){let o=n.prerender;o&&(r.setCustomLayerDefaults(),i.setColorMode(r.colorModeForRenderPass()),o.call(n,i.gl,r.transform.customLayerMatrix()),i.setDirty(),r.setBaseState())}else if(r.renderPass==="translucent"){r.setCustomLayerDefaults(),i.setColorMode(r.colorModeForRenderPass()),i.setStencilMode(fe.disabled);let o=n.renderingMode==="3d"?new ee(r.context.gl.LEQUAL,ee.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,ee.ReadOnly);i.setDepthMode(o),n.render(i.gl,r.transform.customLayerMatrix()),i.setDirty(),r.setBaseState(),i.bindFramebuffer.set(null)}}l(ZS,"drawCustom");d();function HS(r,e){let t=r.context,i=t.gl,n=ke.unblended,o=new ee(i.LEQUAL,ee.ReadWrite,[0,1]),a=e.getTerrainMesh(),s=e.sourceCache.getRenderableTiles(),u=r.useProgram("terrainDepth");t.bindFramebuffer.set(e.getFramebuffer("depth").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:X.transparent,depth:1});for(let c of s){let p=e.getTerrainData(c.tileID),h=r.transform.calculatePosMatrix(c.tileID.toUnwrapped()),f=Dw(h,e.getMeshFrameDelta(r.transform.zoom));u.draw(t,i.TRIANGLES,o,fe.disabled,n,ue.backCCW,f,p,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}l(HS,"drawDepth");function $S(r,e){let t=r.context,i=t.gl,n=ke.unblended,o=new ee(i.LEQUAL,ee.ReadWrite,[0,1]),a=e.getTerrainMesh(),s=e.getCoordsTexture(),u=e.sourceCache.getRenderableTiles(),c=r.useProgram("terrainCoords");t.bindFramebuffer.set(e.getFramebuffer("coords").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:X.transparent,depth:1}),e.coordsIndex=[];for(let p of u){let h=e.getTerrainData(p.tileID);t.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,s.texture);let f=r.transform.calculatePosMatrix(p.tileID.toUnwrapped()),m=zw(f,255-e.coordsIndex.length,e.getMeshFrameDelta(r.transform.zoom));c.draw(t,i.TRIANGLES,o,fe.disabled,n,ue.backCCW,m,h,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),e.coordsIndex.push(p.tileID.key)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}l($S,"drawCoords");function Sg(r,e,t){let i=r.context,n=i.gl,o=r.colorModeForRenderPass(),a=new ee(n.LEQUAL,ee.ReadWrite,r.depthRangeFor3D),s=r.useProgram("terrain"),u=e.getTerrainMesh();i.bindFramebuffer.set(null),i.viewport.set([0,0,r.width,r.height]);for(let c of t){let p=r.renderToTexture.getTexture(c),h=e.getTerrainData(c.tileID);i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,p.texture);let f=r.transform.calculatePosMatrix(c.tileID.toUnwrapped()),m=Lw(f,e.getMeshFrameDelta(r.transform.zoom));s.draw(i,n.TRIANGLES,a,fe.disabled,o,ue.backCCW,m,h,"terrain",u.vertexBuffer,u.indexBuffer,u.segments)}}l(Sg,"drawTerrain");var Pg=class Pg{constructor(e,t){this.context=new Ac(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:q.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=cr.maxUnderzooming+cr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Pn}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 n of this.style._order)this.style._layers[n].resize()}setup(){let e=this.context,t=new Ar;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,Ou.members),this.tileExtentSegments=me.simpleSegment(0,0,4,2);let i=new Ar;i.emplaceBack(0,0),i.emplaceBack(8192,0),i.emplaceBack(0,8192),i.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(i,Ou.members),this.debugSegments=me.simpleSegment(0,0,4,5);let n=new nn;n.emplaceBack(0,0,0,0),n.emplaceBack(8192,0,8192,0),n.emplaceBack(0,8192,0,8192),n.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(n,Or.members),this.rasterBoundsSegments=me.simpleSegment(0,0,4,2);let o=new Ar;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,Ou.members),this.viewportSegments=me.simpleSegment(0,0,4,2);let a=new Fo;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);let s=new it;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let u=this.context.gl;this.stencilClearMode=new fe({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO)}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]),this.useProgram("clippingMask").draw(e,t.TRIANGLES,ee.disabled,this.stencilClearMode,ke.disabled,ue.disabled,My(i),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source;let i=this.context,n=i.gl;this.nextStencilID+t.length>256&&this.clearStencil(),i.setColorMode(ke.disabled),i.setDepthMode(ee.disabled);let o=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let a of t){let s=this._tileClippingMaskIDs[a.key]=this.nextStencilID++,u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a);o.draw(i,n.TRIANGLES,ee.disabled,new fe({func:n.ALWAYS,mask:0},s,255,n.KEEP,n.KEEP,n.REPLACE),ke.disabled,ue.disabled,My(a.posMatrix),u,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}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)}stencilConfigForOverlap(e){let t=this.context.gl,i=e.sort((a,s)=>s.overscaledZ-a.overscaledZ),n=i[i.length-1].overscaledZ,o=i[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let a={};for(let s=0;s<o;s++)a[s+n]=new fe({func:t.GEQUAL,mask:255},s+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=o,[a,i]}return[{[n]:fe.disabled},i]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new ke([e.CONSTANT_COLOR,e.ONE],new X(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ke.unblended:ke.alphaBlended}depthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return ee.disabled;let n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ee(i||this.context.gl.LEQUAL,t,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(Y.now()),this.imageManager.beginFrame();let i=this.style._order,n=this.style.sourceCaches,o={},a={},s={};for(let u in n){let c=n[u];c.used&&c.prepare(this.context),o[u]=c.getVisibleCoordinates(),a[u]=o[u].slice().reverse(),s[u]=c.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let u=0;u<i.length;u++){let c=i[u];if(this.style._layers[c].is3D()){this.opaquePassCutoff=u;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let u of i){let c=this.style._layers[u];if(!c.hasOffscreenPass()||c.isHidden(this.transform.zoom))continue;let p=a[c.source];c.type!=="custom"&&!p.length||this.renderLayer(this,n[c.source],c,p)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?X.black:X.transparent,depth:1}),this.clearStencil(),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 u=this.style._layers[i[this.currentLayer]],c=n[u.source],p=o[u.source];this._renderTileClippingMasks(u,p),this.renderLayer(this,c,u,p)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let u=this.style._layers[i[this.currentLayer]],c=n[u.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(u))continue;let p=(u.type==="symbol"?s:a)[u.source];this._renderTileClippingMasks(u,o[u.source]),this.renderLayer(this,c,u,p)}if(this.options.showTileBoundaries){let u=jS(this.style,this.transform.zoom);u&&qS(this,u,u.getVisibleCoordinates())}this.options.showPadding&&GS(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.projMatrix,n=this.terrainFacilitator.dirty;n||(n=e?!q.exactEquals(t,i):!q.equals(t,i)),n||(n=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),n&&(q.copy(t,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,HS(this,this.style.map.terrain),$S(this,this.style.map.terrain))}renderLayer(e,t,i,n){if(!i.isHidden(this.transform.zoom)&&!(i.type!=="background"&&i.type!=="custom"&&!(n||[]).length))switch(this.id=i.id,i.type){case"symbol":ES(e,t,i,n,this.style.placement.variableOffsets);break;case"circle":kS(e,t,i,n);break;case"heatmap":LS(e,t,i,n);break;case"line":DS(e,t,i,n);break;case"fill":FS(e,t,i,n);break;case"fill-extrusion":RS(e,t,i,n);break;case"hillshade":BS(e,t,i,n);break;case"raster":OS(e,t,i,n);break;case"background":VS(e,t,i,n);break;case"custom":ZS(e,t,i);break}}translatePosMatrix(e,t,i,n,o){if(!i[0]&&!i[1])return e;let a=o?n==="map"?this.transform.angle:0:n==="viewport"?-this.transform.angle:0;if(a){let c=Math.sin(a),p=Math.cos(a);i=[i[0]*p-i[1]*c,i[0]*c+i[1]*p]}let s=[o?i[0]:$e(t,i[0],this.transform.zoom),o?i[1]:$e(t,i[1],this.transform.zoom),0],u=new Float32Array(16);return q.translate(u,e,s),u}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){this.cache=this.cache||{};let i=e+(t?t.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new Nu(this.context,Ti[e],t,MS[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}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 ve(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}};l(Pg,"Painter");var kc=Pg;d();var We=ae(ge(),1);d();var Dc=class Dc{constructor(e,t){this.points=e;this.planes=t}static fromInvProjectionMatrix(e,t,i){let n=[[-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]],o=Math.pow(2,i),a=n.map(c=>{c=qe.transformMat4([],c,e);let p=1/c[3]/t*o;return qe.mul(c,c,[p,p,1/c[3],p])}),u=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(c=>{let p=gt.sub([],a[c[0]],a[c[1]]),h=gt.sub([],a[c[2]],a[c[1]]),f=gt.normalize([],gt.cross([],p,h)),m=-gt.dot(f,a[c[1]]);return f.concat(m)});return new Dc(a,u)}};l(Dc,"Frustum");var Lc=Dc,zc=class zc{constructor(e,t){this.min=e,this.max=t,this.center=gt.scale([],gt.add([],this.min,this.max),.5)}quadrant(e){let t=[e%2===0,e<2],i=gt.clone(this.min),n=gt.clone(this.max);for(let o=0;o<t.length;o++)i[o]=t[o]?this.min[o]:this.center[o],n[o]=t[o]?this.center[o]:this.max[o];return n[2]=this.max[2],new zc(i,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){let t=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],i=!0;for(let n=0;n<e.planes.length;n++){let o=e.planes[n],a=0;for(let s=0;s<t.length;s++)qe.dot(o,t[s])>=0&&a++;if(a===0)return 0;a!==t.length&&(i=!1)}if(i)return 2;for(let n=0;n<3;n++){let o=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let s=0;s<e.points.length;s++){let u=e.points[s][n]-this.min[n];o=Math.min(o,u),a=Math.max(a,u)}if(a<0||o>this.max[n]-this.min[n])return 0}return 1}};l(zc,"Aabb");var Ca=zc;d();var WS=ae(ge(),1);var Fc=class Fc{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(e,t,i){return t.top!=null&&e.top!=null&&(this.top=Pe.number(e.top,t.top,i)),t.bottom!=null&&e.bottom!=null&&(this.bottom=Pe.number(e.bottom,t.bottom,i)),t.left!=null&&e.left!=null&&(this.left=Pe.number(e.left,t.left,i)),t.right!=null&&e.right!=null&&(this.right=Pe.number(e.right,t.right,i)),this}getCenter(e,t){let i=Ae((this.left+e-this.right)/2,0,e),n=Ae((this.top+t-this.bottom)/2,0,t);return new WS.default(i,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Fc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};l(Fc,"EdgeInsets");var Ea=Fc;var Rc=85.051129,Oc=class Oc{constructor(e,t,i,n,o){this.tileSize=512,this._renderWorldCopies=o===void 0?!0:!!o,this._minZoom=e||0,this._maxZoom=t||22,this._minPitch=i==null?0:i,this._maxPitch=n==null?60:n,this.setMaxBounds(),this.width=0,this.height=0,this._center=new ie(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ea,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){let e=new Oc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,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.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(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 We.default(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let t=-er(e,-180,180)*Math.PI/180;this.angle!==t&&(this._unmodified=!1,this.angle=t,this._calcMatrices(),this.rotationMatrix=Vo.create(),Vo.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let t=Ae(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==t&&(this._unmodified=!1,this._pitch=t,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this.tileZoom=Math.max(0,Math.floor(t)),this.scale=this.zoomScale(t),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(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}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(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)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(e){let t=[new _n(0,e)];if(this._renderWorldCopies){let i=this.pointCoordinate(new We.default(0,0)),n=this.pointCoordinate(new We.default(this.width,0)),o=this.pointCoordinate(new We.default(this.width,this.height)),a=this.pointCoordinate(new We.default(0,this.height)),s=Math.floor(Math.min(i.x,n.x,o.x,a.x)),u=Math.floor(Math.max(i.x,n.x,o.x,a.x)),c=1;for(let p=s-c;p<=u+c;p++)p!==0&&t.push(new _n(p,e))}return t}coveringTiles(e){var b,w;let t=this.coveringZoomLevel(e),i=t;if(e.minzoom!==void 0&&t<e.minzoom)return[];e.maxzoom!==void 0&&t>e.maxzoom&&(t=e.maxzoom);let n=this.pointCoordinate(this.getCameraPoint()),o=Fe.fromLngLat(this.center),a=Math.pow(2,t),s=[a*n.x,a*n.y,0],u=[a*o.x,a*o.y,0],c=Lc.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t),p=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=t);let h=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,f=l(_=>({aabb:new Ca([_*a,0,0],[(_+1)*a,a,0]),zoom:0,x:0,y:0,wrap:_,fullyVisible:!1}),"newRootTile"),m=[],y=[],g=t,x=e.reparseOverscaled?i:t;if(this._renderWorldCopies)for(let _=1;_<=3;_++)m.push(f(-_)),m.push(f(_));for(m.push(f(0));m.length>0;){let _=m.pop(),S=_.x,P=_.y,T=_.fullyVisible;if(!T){let z=_.aabb.intersects(c);if(z===0)continue;T=z===2}let L=e.terrain?s:u,C=_.aabb.distanceX(L),E=_.aabb.distanceY(L),I=Math.max(Math.abs(C),Math.abs(E)),R=h+(1<<g-_.zoom)-2;if(_.zoom===g||I>R&&_.zoom>=p){let z=g-_.zoom,k=s[0]-.5-(S<<z),M=s[1]-.5-(P<<z);y.push({tileID:new Je(_.zoom===g?x:_.zoom,_.wrap,_.zoom,S,P),distanceSq:sn.sqrLen([u[0]-.5-S,u[1]-.5-P]),tileDistanceToCamera:Math.sqrt(k*k+M*M)});continue}for(let z=0;z<4;z++){let k=(S<<1)+z%2,M=(P<<1)+(z>>1),G=_.zoom+1,K=_.aabb.quadrant(z);if(e.terrain){let ne=new Je(G,_.wrap,G,k,M),J=e.terrain.getMinMaxElevation(ne),W=(b=J.minElevation)!=null?b:this.elevation,Ye=(w=J.maxElevation)!=null?w:this.elevation;K=new Ca([K.min[0],K.min[1],W],[K.max[0],K.max[1],Ye])}m.push({aabb:K,zoom:G,x:k,y:M,wrap:_.wrap,fullyVisible:T})}}return y.sort((_,S)=>_.distanceSq-S.distanceSq).map(_=>_.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let t=Ae(e.lat,-Rc,Rc);return new We.default(Rr(e.lng)*this.worldSize,Br(t)*this.worldSize)}unproject(e){return new Fe(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){let e=this.pointLocation(this.getCameraPoint()),t=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter;return{lngLat:e,altitude:t+this.elevation}}recalculateZoom(e){let t=this.elevation,i=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,n=this.pointLocation(this.centerPoint,e),o=e.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-o))return;let s=i+t-o,p=Math.cos(this._pitch)*this.cameraToCenterDistance/s/bu(1,n.lat)/this.tileSize,h=this.scaleZoom(p);this._elevation=o,this._center=n,this.zoom=h}setLocationAtPoint(e,t){let i=this.pointCoordinate(t),n=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new Fe(o.x-(i.x-n.x),o.y-(i.y-n.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,t){return t?this.coordinatePoint(this.locationCoordinate(e),t.getElevationForLngLatZoom(e,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,t){return this.coordinateLocation(this.pointCoordinate(e,t))}locationCoordinate(e){return Fe.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,t){if(t){let g=t.pointCoordinate(e);if(g!=null)return g}let i=0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];qe.transformMat4(n,n,this.pixelMatrixInverse),qe.transformMat4(o,o,this.pixelMatrixInverse);let a=n[3],s=o[3],u=n[0]/a,c=o[0]/s,p=n[1]/a,h=o[1]/s,f=n[2]/a,m=o[2]/s,y=f===m?0:(i-f)/(m-f);return new Fe(Pe.number(u,c,y)/this.worldSize,Pe.number(p,h,y)/this.worldSize)}coordinatePoint(e,t=0,i=this.pixelMatrix){let n=[e.x*this.worldSize,e.y*this.worldSize,t,1];return qe.transformMat4(n,n,i),new We.default(n[0]/n[3],n[1]/n[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return new ut().extend(this.pointLocation(new We.default(0,e))).extend(this.pointLocation(new We.default(this.width,e))).extend(this.pointLocation(new We.default(this.width,this.height))).extend(this.pointLocation(new We.default(0,this.height)))}getMaxBounds(){return!this.latRange||this.latRange.length!==2||!this.lngRange||this.lngRange.length!==2?null:new ut([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]])}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-Rc,Rc])}calculatePosMatrix(e,t=!1){let i=e.key,n=t?this._alignedPosMatrixCache:this._posMatrixCache;if(n[i])return n[i];let o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,u=q.identity(new Float64Array(16));return q.translate(u,u,[s*a,o.y*a,0]),q.scale(u,u,[a/8192,a/8192,1]),q.multiply(u,t?this.alignedProjMatrix:this.projMatrix,u),n[i]=new Float32Array(u),n[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,t){t=Ae(+t,this.minZoom,this.maxZoom);let i={center:new ie(e.lng,e.lat),zoom:t},n=this.lngRange;if(!this._renderWorldCopies&&n===null){let _=179.9999999999;n=[-_,_]}let o=this.tileSize*this.zoomScale(i.zoom),a=0,s=o,u=0,c=o,p=0,h=0,{x:f,y:m}=this.size;if(this.latRange){let _=this.latRange;a=Br(_[1])*o,s=Br(_[0])*o,s-a<m&&(p=m/(s-a))}n&&(u=er(Rr(n[0])*o,0,o),c=er(Rr(n[1])*o,0,o),c<u&&(c+=o),c-u<f&&(h=f/(c-u)));let{x:y,y:g}=this.project.call({worldSize:o},e),x,b,w=Math.max(h||0,p||0);if(w){let _=new We.default(h?(c+u)/2:y,p?(s+a)/2:g);return i.center=this.unproject.call({worldSize:o},_).wrap(),i.zoom+=this.scaleZoom(w),i}if(this.latRange){let _=m/2;g-_<a&&(b=a+_),g+_>s&&(b=s-_)}if(n){let _=(u+c)/2,S=y;this._renderWorldCopies&&(S=er(y,_-o/2,_+o/2));let P=f/2;S-P<u&&(x=u+P),S+P>c&&(x=c-P)}if(x!==void 0||b!==void 0){let _=new We.default(x!=null?x:y,b!=null?b:g);i.center=this.unproject.call({worldSize:o},_).wrap()}return i}_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.center=t,this.zoom=i,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this._fov/2,t=this.centerOffset,i=this.point.x,n=this.point.y;this.cameraToCenterDistance=.5/Math.tan(e)*this.height,this._pixelPerMeter=bu(1,this.center.lat)*this.worldSize;let o=q.identity(new Float64Array(16));q.scale(o,o,[this.width/2,-this.height/2,1]),q.translate(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=q.identity(new Float64Array(16)),q.scale(o,o,[1,-1,1]),q.translate(o,o,[-1,-1,0]),q.scale(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;let a=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),s=Math.min(this.elevation,this.minElevationForCurrentTile),u=a-s*this._pixelPerMeter/Math.cos(this._pitch),c=s<0?u:a,p=Math.PI/2+this._pitch,h=this._fov*(.5+t.y/this.height),f=Math.sin(h)*c/Math.sin(Ae(Math.PI-p-h,.01,Math.PI-.01)),m=this.getHorizon(),g=2*Math.atan(m/this.cameraToCenterDistance)*(.5+t.y/(m*2)),x=Math.sin(g)*c/Math.sin(Ae(Math.PI-p-g,.01,Math.PI-.01)),b=Math.min(f,x),w=(Math.cos(Math.PI/2-this._pitch)*b+c)*1.01,_=this.height/50;o=new Float64Array(16),q.perspective(o,this._fov,this.width/this.height,_,w),o[8]=-t.x*2/this.width,o[9]=t.y*2/this.height,q.scale(o,o,[1,-1,1]),q.translate(o,o,[0,0,-this.cameraToCenterDistance]),q.rotateX(o,o,this._pitch),q.rotateZ(o,o,this.angle),q.translate(o,o,[-i,-n,0]),this.mercatorMatrix=q.scale([],o,[this.worldSize,this.worldSize,this.worldSize]),q.scale(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=q.multiply(new Float64Array(16),this.labelPlaneMatrix,o),q.translate(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=q.invert([],o),this.pixelMatrix3D=q.multiply(new Float64Array(16),this.labelPlaneMatrix,o);let S=this.width%2/2,P=this.height%2/2,T=Math.cos(this.angle),L=Math.sin(this.angle),C=i-Math.round(i)+T*S+L*P,E=n-Math.round(n)+T*P+L*S,I=new Float64Array(o);if(q.translate(I,I,[C>.5?C-1:C,E>.5?E-1:E,0]),this.alignedProjMatrix=I,o=q.invert(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new We.default(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return qe.transformMat4(t,t,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=this._pitch,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new We.default(0,t))}getCameraQueryGeometry(e){let t=this.getCameraPoint();if(e.length===1)return[e[0],t];{let i=t.x,n=t.y,o=t.x,a=t.y;for(let s of e)i=Math.min(i,s.x),n=Math.min(n,s.y),o=Math.max(o,s.x),a=Math.max(a,s.y);return[new We.default(i,n),new We.default(o,n),new We.default(o,a),new We.default(i,a),new We.default(i,n)]}}lngLatToCameraDepth(e,t){let i=this.locationCoordinate(e),n=[i.x*this.worldSize,i.y*this.worldSize,t,1];return qe.transformMat4(n,n,this.projMatrix),n[2]/n[3]}};l(Oc,"Transform");var Bc=Oc;d();d();function Vc(r,e){let t=!1,i=null,n=null,o,a=l(()=>{i=null,t&&(r.apply(n,o),i=setTimeout(a,e),t=!1)},"later");return(...s)=>(t=!0,n=this,o=s,i||a(),i)}l(Vc,"throttle");var Tg=class Tg{constructor(e){this._getCurrentHash=l(()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(t=i)}),(t&&t[1]||"").split("/")}return e.split("/")},"_getCurrentHash");this._onHashChange=l(()=>{let e=this._getCurrentHash();if(e.length>=3&&!e.some(t=>isNaN(t))){let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0}return!1},"_onHashChange");this._updateHashUnthrottled=l(()=>{let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch(t){}},"_updateHashUnthrottled");this._updateHash=Vc(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()),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(this._map.getZoom()*100)/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),a=Math.round(t.lng*o)/o,s=Math.round(t.lat*o)/o,u=this._map.getBearing(),c=this._map.getPitch(),p="";if(e?p+="/".concat(a,"/").concat(s,"/").concat(i):p+="".concat(i,"/").concat(s,"/").concat(a),(u||c)&&(p+="/".concat(Math.round(u*10)/10)),c&&(p+="/".concat(Math.round(c))),this._hashName){let h=this._hashName,f=!1,m=window.location.hash.slice(1).split("&").map(y=>{let g=y.split("=")[0];return g===h?(f=!0,"".concat(g,"=").concat(p)):y}).filter(y=>y);return f||m.push("".concat(h,"=").concat(p)),"#".concat(m.join("&"))}return"#".concat(p)}};l(Tg,"Hash");var ka=Tg;d();d();var XS=ae(ge(),1);var qc={linearity:.3,easing:kn(0,0,.3,1)},JL=V({deceleration:2500,maxSpeed:1400},qc),YL=V({deceleration:20,maxSpeed:1400},qc),QL=V({deceleration:1e3,maxSpeed:360},qc),eD=V({deceleration:1e3,maxSpeed:90},qc),Mg=class Mg{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Y.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=Y.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,pan:new XS.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)t.zoom+=a.zoomDelta||0,t.bearing+=a.bearingDelta||0,t.pitch+=a.pitchDelta||0,a.panDelta&&t.pan._add(a.panDelta),a.around&&(t.around=a.around),a.pinchAround&&(t.pinchAround=a.pinchAround);let n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(t.pan.mag()){let a=Nc(t.pan.mag(),n,V({},JL,e||{}));o.offset=t.pan.mult(a.amount/t.pan.mag()),o.center=this._map.transform.center,Uc(o,a)}if(t.zoom){let a=Nc(t.zoom,n,YL);o.zoom=this._map.transform.zoom+a.amount,Uc(o,a)}if(t.bearing){let a=Nc(t.bearing,n,QL);o.bearing=this._map.transform.bearing+Ae(a.amount,-179,179),Uc(o,a)}if(t.pitch){let a=Nc(t.pitch,n,eD);o.pitch=this._map.transform.pitch+a.amount,Uc(o,a)}if(o.zoom||o.bearing){let a=t.pinchAround===void 0?t.around:t.pinchAround;o.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),V(o,{noMoveStart:!0})}};l(Mg,"HandlerInertia");var Gc=Mg;function Uc(r,e){(!r.duration||r.duration<e.duration)&&(r.duration=e.duration,r.easing=e.easing)}l(Uc,"extendDuration");function Nc(r,e,t){let{maxSpeed:i,linearity:n,deceleration:o}=t,a=Ae(r*n/(e/1e3),-i,i),s=Math.abs(a)/(o*n);return{easing:t.easing,duration:s*1e3,amount:a*(s/2)}}l(Nc,"calculateEasing");d();d();var KS=ae(ge(),1);var Ag=class Ag extends F{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,n={}){let o=D.mousePos(t.getCanvas(),i),a=t.unproject(o);super(e,V({point:o,lngLat:a,originalEvent:i},n)),this._defaultPrevented=!1,this.target=t}};l(Ag,"MapMouseEvent");var nt=Ag,Ig=class Ig extends F{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let n=e==="touchend"?i.changedTouches:i.touches,o=D.touchPos(t.getCanvasContainer(),n),a=o.map(c=>t.unproject(c)),s=o.reduce((c,p,h,f)=>c.add(p.div(f.length)),new KS.default(0,0)),u=t.unproject(s);super(e,{points:o,point:s,lngLats:a,lngLat:u,originalEvent:i}),this._defaultPrevented=!1}};l(Ig,"MapTouchEvent");var Ur=Ig,Cg=class Cg extends F{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}};l(Cg,"MapWheelEvent");var La=Cg;var Eg=class Eg{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new La(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new nt(e.type,this._map,e))}mouseup(e){this._map.fire(new nt(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new nt(e.type,this._map,e))}dblclick(e){return this._firePreventable(new nt(e.type,this._map,e))}mouseover(e){this._map.fire(new nt(e.type,this._map,e))}mouseout(e){this._map.fire(new nt(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ur(e.type,this._map,e))}touchmove(e){this._map.fire(new Ur(e.type,this._map,e))}touchend(e){this._map.fire(new Ur(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ur(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};l(Eg,"MapEventHandler");var jc=Eg,kg=class kg{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new nt(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new nt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new nt(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};l(kg,"BlockableMapEventHandler");var Zc=kg;d();d();var JS=ae(ge(),1);var Lg=class Lg{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.pointLocation(JS.default.convert(e),this._map.terrain)}};l(Lg,"TransformProvider");var Dt=Lg;var Dg=class Dg{constructor(e,t){this._map=e,this._tr=new Dt(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){console.warn("boxZoom will not work. Use SDK interaction events instead.")}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(D.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 n=this._startPos;this._lastPos=i,this._box||(this._box=D.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let o=Math.min(n.x,i.x),a=Math.max(n.x,i.x),s=Math.min(n.y,i.y),u=Math.max(n.y,i.y);D.setTransform(this._box,"translate(".concat(o,"px,").concat(s,"px)")),this._box.style.width="".concat(a-o,"px"),this._box.style.height="".concat(u-s,"px")}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let i=this._startPos,n=t;if(this.reset(),D.suppressClick(),i.x===n.x&&i.y===n.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new F("boxzoomend",{originalEvent:e})),{cameraAnimation:l(o=>o.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0}),"cameraAnimation")}}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&&(D.remove(this._box),this._box=null),D.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new F(e,{originalEvent:t}))}};l(Dg,"BoxZoomHandler");var Da=Dg;d();d();var YS=ae(ge(),1);d();function za(r,e){if(r.length!==e.length)throw new Error("The number of touches and points are not equal - touches ".concat(r.length,", points ").concat(e.length));let t={};for(let i=0;i<r.length;i++)t[r[i].identifier]=e[i];return t}l(za,"indexTouches");function tD(r){let e=new YS.default(0,0);for(let t of r)e._add(t);return e.div(r.length)}l(tD,"getCentroid");var Fg=500,rD=500,Hc=30,Rg=class Rg{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=tD(t),this.touches=za(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let n=za(i,t);for(let o in this.touches){let a=this.touches[o],s=n[o];(!s||s.dist(a)>Hc)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>rD)&&(this.aborted=!0),i.length===0){let n=!this.aborted&&this.centroid;if(this.reset(),n)return n}}};l(Rg,"SingleTapRecognizer");var zg=Rg,Bg=class Bg{constructor(e){this.singleTap=new zg(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 n=this.singleTap.touchend(e,t,i);if(n){let o=e.timeStamp-this.lastTime<Fg,a=!this.lastTap||this.lastTap.dist(n)<Hc;if((!o||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}};l(Bg,"TapRecognizer");var Mi=Bg;var Og=class Og{constructor(e){this._tr=new Dt(e),this._zoomIn=new Mi({numTouches:1,numTaps:2}),this._zoomOut=new Mi({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 n=this._zoomIn.touchend(e,t,i),o=this._zoomOut.touchend(e,t,i),a=this._tr;if(n)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:l(s=>s.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(n)},{originalEvent:e}),"cameraAnimation")};if(o)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:l(s=>s.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(o)},{originalEvent:e}),"cameraAnimation")}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};l(Og,"TapZoomHandler");var $c=Og;d();d();var Vg=class Vg{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.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=t.length?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 n=t.length?t[0]:t;if(!(!this._moved&&n.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(i,n)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&D.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}};l(Vg,"DragHandler");var hr=Vg;d();var iD=0,nD=2,oD={[iD]:1,[nD]:2};function aD(r,e){let t=oD[e];return r.buttons===void 0||(r.buttons&t)!==t}l(aD,"buttonNoLongerPressed");var Ug=class Ug{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=D.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!aD(e,this._eventButton)}isValidEndEvent(e){return D.mouseButton(e)===this._eventButton}};l(Ug,"MouseMoveStateManager");var An=Ug,Ng=class Ng{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){let t=e.targetTouches[0].identifier;this._firstTouch=t}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}};l(Ng,"OneFingerTouchMoveStateManager");var Fa=Ng;var Gg=0,QS=2,qg=l(r=>{r.mousedown=r.dragStart,r.mousemoveWindow=r.dragMove,r.mouseup=r.dragEnd,r.contextmenu=function(e){e.preventDefault()}},"assignEvents"),e2=l(({enable:r,clickTolerance:e})=>{let t=new An({checkCorrectEvent:l(i=>D.mouseButton(i)===Gg&&!i.ctrlKey,"checkCorrectEvent")});return new hr({clickTolerance:e,move:l((i,n)=>({around:n,panDelta:n.sub(i)}),"move"),activateOnStart:!0,moveStateManager:t,enable:r,assignEvents:qg})},"generateMousePanHandler"),Wc=l(({enable:r,clickTolerance:e,bearingDegreesPerPixelMoved:t=.8})=>{let i=new An({checkCorrectEvent:l(n=>D.mouseButton(n)===Gg&&n.ctrlKey||D.mouseButton(n)===QS,"checkCorrectEvent")});return new hr({clickTolerance:e,move:l((n,o)=>({bearingDelta:(o.x-n.x)*t}),"move"),moveStateManager:i,enable:r,assignEvents:qg})},"generateMouseRotationHandler"),Xc=l(({enable:r,clickTolerance:e,pitchDegreesPerPixelMoved:t=-.5})=>{let i=new An({checkCorrectEvent:l(n=>D.mouseButton(n)===Gg&&n.ctrlKey||D.mouseButton(n)===QS,"checkCorrectEvent")});return new hr({clickTolerance:e,move:l((n,o)=>({pitchDelta:(o.y-n.y)*t}),"move"),moveStateManager:i,enable:r,assignEvents:qg})},"generateMousePitchHandler");d();var Kc=ae(ge(),1);var jg=class jg{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Kc.default(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(!(!this._active||i.length<this.minTouchs()))return e.preventDefault(),this._calculateTransform(e,t,i)}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this.minTouchs()&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let n=za(i,t),o=new Kc.default(0,0),a=new Kc.default(0,0),s=0;for(let p in n){let h=n[p],f=this._touches[p];f&&(o._add(h),a._add(h.sub(f)),s++,n[p]=h)}if(this._touches=n,s<this.minTouchs()||!a.mag())return;let u=a.div(s);return this._sum._add(u),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:u}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};l(jg,"TouchPanHandler");var Jc=jg;d();var Hg=class Hg{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[n,o]=this._firstTwoTouches,a=Yc(i,t,n),s=Yc(i,t,o);if(!a||!s)return;let u=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],u,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[n,o]=this._firstTwoTouches,a=Yc(i,t,n),s=Yc(i,t,o);a&&s||(this._active&&D.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}};l(Hg,"TwoFingersTouchHandler");var Ra=Hg;function Yc(r,e,t){for(let i=0;i<r.length;i++)if(r[i].identifier===t)return e[i]}l(Yc,"getTouchById");var sD=.1;function t2(r,e){return Math.log(r/e)/Math.LN2}l(t2,"getZoomDelta");var $g=class $g extends Ra{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(t2(this._distance,this._startDistance))<sD))return this._active=!0,{zoomDelta:t2(this._distance,i),pinchAround:t}}};l($g,"TwoFingersTouchZoomHandler");var Ba=$g,lD=25;function r2(r,e){return r.angleWith(e)*180/Math.PI}l(r2,"getBearingDelta");var Wg=class Wg extends Ra{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 n=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:r2(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,i=lD/t*360,n=r2(e,this._startVector);return Math.abs(n)<i}};l(Wg,"TwoFingersTouchRotateHandler");var Oa=Wg;function Zg(r){return Math.abs(r.y)>Math.abs(r.x)}l(Zg,"isVertical");var uD=100,Xg=class Xg extends Ra{constructor(t){super();this._currentTouchCount=0;this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,i,n){super.touchstart(t,i,n),this._currentTouchCount=n.length}_start(t){this._lastPoints=t,Zg(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,i,n){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,a,n.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(t,i,n){if(this._valid!==void 0)return this._valid;let o=2,a=t.mag()>=o,s=i.mag()>=o;if(!a&&!s)return;if(!a||!s)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<uD?void 0:!1;let u=t.y>0==i.y>0;return Zg(t)&&Zg(i)&&u}};l(Xg,"TwoFingersTouchPitchHandler");var Va=Xg;d();var cD={panStep:100,bearingStep:15,pitchStep:10},Kg=class Kg{constructor(e){this._tr=new Dt(e);let t=cD;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,n=0,o=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(),o=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),o=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:l(s=>{let u=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:pD,zoom:t?Math.round(u.zoom)+t*(e.shiftKey?2:1):u.zoom,bearing:u.bearing+i*this._bearingStep,pitch:u.pitch+n*this._pitchStep,offset:[-o*this._panStep,-a*this._panStep],center:u.center},{originalEvent:e})},"cameraAnimation")}}enable(){console.warn("maplibre keyboard events are not supported, use SDK keyboard events instead.")}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};l(Kg,"KeyboardHandler");var Ua=Kg;function pD(r){return r*(2-r)}l(pD,"easeOut");d();var i2=4.000244140625,hD=1/100,fD=1/450,mD=2,Jg=class Jg{constructor(e,t){this._onTimeout=l(e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},"_onTimeout");this._map=e,this._tr=new Dt(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=hD,this._wheelZoomRate=fD}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){console.log("Enable maplibre scrollZoom events will not work. Use Mappedin SDK interactions events instead.")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!e[this._map.cooperativeGestures._bypassKey])return;let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,i=Y.now(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,t!==0&&t%i2===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*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=D.mousePos(this._map.getCanvas(),e),i=this._tr;t.y>i.transform.height/2-i.transform.getHorizon()?this._around=ie.convert(this._aroundCenter?i.center:i.unproject(t)):this._around=ie.convert(i.center),this._aroundPoint=i.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>i2?this._wheelZoomRate:this._defaultZoomRate,u=mD/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&u!==0&&(u=1/u);let c=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(c*u))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,i=this._startZoom,n=this._easing,o=!1,a;if(this._type==="wheel"&&i&&n){let s=Math.min((Y.now()-this._lastWheelEventTime)/200,1),u=n(s);a=Pe.number(i,t,u),s<1?this._frameId||(this._frameId=!0):o=!0}else a=t,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=Ln;if(this._prevEase){let i=this._prevEase,n=(Y.now()-i.start)/i.duration,o=i.easing(n+.01)-i.easing(n),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.27*.27-a*a);t=kn(a,s,.25,1)}return this._prevEase={start:Y.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}};l(Jg,"ScrollZoomHandler");var Na=Jg;d();var Yg=class Yg{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()}};l(Yg,"DoubleClickZoomHandler");var Ga=Yg;d();var Qg=class Qg{constructor(e){this._tr=new Dt(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:l(i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})},"cameraAnimation")}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};l(Qg,"ClickZoomHandler");var Qc=Qg;d();var ex=class ex{constructor(){this._tap=new Mi({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 n=t[0],o=e.timeStamp-this._tapTime<Fg,a=this._tapPoint.dist(n)<Hc;!o||!a?this.reset():i.length>0&&(this._swipePoint=n,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 n=t[0],o=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:o/128}}}touchend(e,t,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let n=this._tap.touchend(e,t,i);n&&(this._tapTime=e.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};l(ex,"TapDragZoomHandler");var ep=ex;d();var tx=class tx{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){console.log("Maplibre interaction is not supported. Use Mappedin SDK interaction instead")}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()}};l(tx,"DragPanHandler");var qa=tx;d();var rx=class rx{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i}enable(){console.warn("dragRotate does not work. Use SDK interaction events instead.")}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}};l(rx,"DragRotateHandler");var ja=rx;d();var ix=class ix{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,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()}};l(ix,"TwoFingersTouchZoomRotateHandler");var Za=ix;d();var nx=class nx{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=D.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"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=t,this._container.appendChild(n);let o=document.createElement("div");o.className="maplibregl-mobile-message",o.textContent=i,this._container.appendChild(o),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(D.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._destoryUI()}isEnabled(){return this._enabled}touchmove(e){this._onCooperativeGesture(e.touches.length===1)}wheel(e){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!e[this._bypassKey])}_onCooperativeGesture(e){!this._enabled||!e||(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};l(nx,"CooperativeGesturesHandler");var Ha=nx;var n2=ae(ge(),1);var tp=l(r=>r.zoom||r.drag||r.pitch||r.rotate,"isMoving"),sx=class sx extends F{};l(sx,"RenderFrameEvent");var ax=sx;function ox(r){return r.panDelta&&r.panDelta.mag()||r.zoomDelta||r.bearingDelta||r.pitchDelta}l(ox,"hasChange");var lx=class lx{constructor(e,t){this.handleWindowEvent=l(e=>{this.handleEvent(e,"".concat(e.type,"Window"))},"handleWindowEvent");this.handleEvent=l((e,t)=>{if(e.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let i=e.type==="renderFrame"?void 0:e,n={needsRenderFrame:!1},o={},a={},s=e.touches,u=s?this._getMapTouches(s):void 0,c=u?D.touchPos(this._map.getCanvas(),u):D.mousePos(this._map.getCanvas(),e);for(let{handlerName:f,handler:m,allowed:y}of this._handlers){if(!m.isEnabled())continue;let g;this._blockedByActive(a,y,f)?m.reset():m[t||e.type]&&(g=m[t||e.type](e,c,u),this.mergeHandlerResult(n,o,g,f,i),g&&g.needsRenderFrame&&this._triggerRenderFrame()),(g||m.isActive())&&(a[f]=m)}let p={};for(let f in this._previousActiveHandlers)a[f]||(p[f]=i);this._previousActiveHandlers=a,(Object.keys(p).length||ox(n))&&(this._changes.push([n,o,p]),this._triggerRenderFrame()),(Object.keys(a).length||ox(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},"handleEvent");this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Gc(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[n,o,a]of this._listeners);}destroy(){for(let[e,t,i]of this._listeners)D.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new jc(t,e));let n=t.boxZoom=new Da(t,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();let o=t.cooperativeGestures=new Ha(t,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();let a=new $c(t),s=new Qc(t);t.doubleClickZoom=new Ga(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let u=new ep;this._add("tapDragZoom",u);let c=t.touchPitch=new Va(t);this._add("touchPitch",c),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let p=Wc(e),h=Xc(e);t.dragRotate=new ja(e,p,h),this._add("mouseRotate",p,["mousePitch"]),this._add("mousePitch",h,["mouseRotate"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let f=e2(e),m=new Jc(e,t);t.dragPan=new qa(i,f,m),this._add("mousePan",f),this._add("touchPan",m,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let y=new Oa,g=new Ba;t.touchZoomRotate=new Za(i,g,y,u),this._add("touchRotate",y,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let x=t.scrollZoom=new Na(t,()=>this._triggerRenderFrame());this._add("scrollZoom",x,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let b=t.keyboard=new Ua(t);this._add("keyboard",b),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new Zc(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!!tp(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let n in e)if(n!==i&&(!t||t.indexOf(n)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let n=i.target;this._el.contains(n)&&t.push(i)}return t}mergeHandlerResult(e,t,i,n,o){if(!i)return;V(e,i);let a={handlerName:n,originalEvent:i.originalEvent||o};i.zoomDelta!==void 0&&(t.zoom=a),i.panDelta!==void 0&&(t.drag=a),i.pitchDelta!==void 0&&(t.pitch=a),i.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},i={};for(let[n,o,a]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new n2.default(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.around!==void 0&&(e.around=n.around),n.pinchAround!==void 0&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),V(t,o),V(i,a);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let n=this._map,o=n._getTransformForUpdate(),a=n.terrain;if(!ox(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,i,!0);let{panDelta:s,zoomDelta:u,bearingDelta:c,pitchDelta:p,around:h,pinchAround:f}=e;f!==void 0&&(h=f),n._stop(!0),h=h||n.transform.centerPoint;let m=o.pointLocation(s?h.sub(s):h);c&&(o.bearing+=c),p&&(o.pitch+=p),u&&(o.zoom+=u),a?!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,o.setLocationAtPoint(m,h),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,o.recalculateZoom(n.terrain)})):t.drag&&this._terrainMovement?o.center=o.pointLocation(o.centerPoint.sub(s)):o.setLocationAtPoint(m,h):o.setLocationAtPoint(m,h),n._applyUpdatedTransform(o),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,t,i){let n=tp(this._eventsInProgress),o=tp(e),a={};for(let p in e){let{originalEvent:h}=e[p];this._eventsInProgress[p]||(a["".concat(p,"start")]=h),this._eventsInProgress[p]=e[p]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(let p in a)this._fireEvent(p,a[p]);o&&this._fireEvent("move",o.originalEvent);for(let p in e){let{originalEvent:h}=e[p];this._fireEvent(p,h)}let s={},u;for(let p in this._eventsInProgress){let{handlerName:h,originalEvent:f}=this._eventsInProgress[p];this._handlersById[h].isActive()||(delete this._eventsInProgress[p],u=t[h]||f,s["".concat(p,"end")]=u)}for(let p in s)this._fireEvent(p,s[p]);let c=tp(this._eventsInProgress);if(i&&(n||o)&&!c){this._updatingCamera=!0;let p=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),h=l(f=>f!==0&&-this._bearingSnap<f&&f<this._bearingSnap,"shouldSnapToNorth");p&&(p.essential||!Y.prefersReducedMotion)?(h(p.bearing||this._map.getBearing())&&(p.bearing=0),p.freezeElevation=!0,this._map.easeTo(p,{originalEvent:u})):(this._map.fire(new F("moveend",{originalEvent:u})),h(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new F(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new ax("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};l(lx,"HandlerManager");var rp=lx;d();var Wt=ae(ge(),1);var ux=class ux extends de{constructor(t,i){super();this._renderFrameCallback=l(()=>{let t=Math.min((Y.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},"_renderFrameCallback");this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new ie(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}panBy(t,i,n){return t=Wt.default.convert(t).mult(-1),this.panTo(this.transform.center,V({offset:t},i),n)}panTo(t,i,n){return this.easeTo(V({center:t},i),n)}getZoom(){return this.transform.zoom}setZoom(t,i){return this.jumpTo({zoom:t},i),this}zoomTo(t,i,n){return this.easeTo(V({zoom:t},i),n)}zoomIn(t,i){return this.zoomTo(this.getZoom()+1,t,i),this}zoomOut(t,i){return this.zoomTo(this.getZoom()-1,t,i),this}getBearing(){return this.transform.bearing}setBearing(t,i){return this.jumpTo({bearing:t},i),this}getPadding(){return this.transform.padding}setPadding(t,i){return this.jumpTo({padding:t},i),this}rotateTo(t,i,n){return this.easeTo(V({bearing:t},i),n)}resetNorth(t,i){return this.rotateTo(0,V({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(V({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(t,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}cameraForBounds(t,i){t=ut.convert(t);let n=i&&i.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),n,i)}_cameraForBoxAndBearing(t,i,n,o){let a={top:0,bottom:0,right:0,left:0};if(o=V({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},o),typeof o.padding=="number"){let ne=o.padding;o.padding={top:ne,bottom:ne,right:ne,left:ne}}o.padding=V(a,o.padding);let s=this.transform,u=s.padding,c=new ut(t,i),p=s.project(c.getNorthWest()),h=s.project(c.getNorthEast()),f=s.project(c.getSouthEast()),m=s.project(c.getSouthWest()),y=wp(-n),g=p.rotate(y),x=h.rotate(y),b=f.rotate(y),w=m.rotate(y),_=new Wt.default(Math.max(g.x,x.x,w.x,b.x),Math.max(g.y,x.y,w.y,b.y)),S=new Wt.default(Math.min(g.x,x.x,w.x,b.x),Math.min(g.y,x.y,w.y,b.y)),P=_.sub(S),T=(s.width-(u.left+u.right+o.padding.left+o.padding.right))/P.x,L=(s.height-(u.top+u.bottom+o.padding.top+o.padding.bottom))/P.y;if(L<0||T<0){Le("Map cannot fit within canvas with the given bounds, padding, and/or offset.");return}let C=Math.min(s.scaleZoom(s.scale*Math.min(T,L)),o.maxZoom),E=Wt.default.convert(o.offset),I=(o.padding.left-o.padding.right)/2,R=(o.padding.top-o.padding.bottom)/2,k=new Wt.default(I,R).rotate(wp(n)),G=E.add(k).mult(s.scale/s.zoomScale(C));return{center:s.unproject(p.add(f).div(2).sub(G)),zoom:C,bearing:n}}fitBounds(t,i,n){return this._fitInternal(this.cameraForBounds(t,i),i,n)}fitScreenCoordinates(t,i,n,o,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(Wt.default.convert(t)),this.transform.pointLocation(Wt.default.convert(i)),n,o),o,a)}_fitInternal(t,i,n){return t?(i=V(t,i),delete i.padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(t,i){this.stop();let n=this._getTransformForUpdate(),o=!1,a=!1,s=!1;return"zoom"in t&&n.zoom!==+t.zoom&&(o=!0,n.zoom=+t.zoom),t.center!==void 0&&(n.center=ie.convert(t.center)),"bearing"in t&&n.bearing!==+t.bearing&&(a=!0,n.bearing=+t.bearing),"pitch"in t&&n.pitch!==+t.pitch&&(s=!0,n.pitch=+t.pitch),t.padding!=null&&!n.isPaddingEqual(t.padding)&&(n.padding=t.padding),this._applyUpdatedTransform(n),this.fire(new F("movestart",i)).fire(new F("move",i)),o&&this.fire(new F("zoomstart",i)).fire(new F("zoom",i)).fire(new F("zoomend",i)),a&&this.fire(new F("rotatestart",i)).fire(new F("rotate",i)).fire(new F("rotateend",i)),s&&this.fire(new F("pitchstart",i)).fire(new F("pitch",i)).fire(new F("pitchend",i)),this.fire(new F("moveend",i))}calculateCameraOptionsFromTo(t,i,n,o=0){let a=Fe.fromLngLat(t,i),s=Fe.fromLngLat(n,o),u=s.x-a.x,c=s.y-a.y,p=s.z-a.z,h=Math.hypot(u,c,p);if(h===0)throw new Error("Can't calculate camera options with same From and To");let f=Math.hypot(u,c),m=this.transform.scaleZoom(this.transform.cameraToCenterDistance/h/this.transform.tileSize),y=Math.atan2(u,-c)*180/Math.PI,g=Math.acos(f/h)*180/Math.PI;return g=p<0?90-g:90+g,{center:s.toLngLat(),zoom:m,pitch:g,bearing:y}}easeTo(t,i){var L;this._stop(!1,t.easeId),t=V({offset:[0,0],duration:500,easing:Ln},t),(t.animate===!1||!t.essential&&Y.prefersReducedMotion)&&(t.duration=0);let n=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),u=this.getPadding(),c="bearing"in t?this._normalizeBearing(t.bearing,a):a,p="pitch"in t?+t.pitch:s,h="padding"in t?t.padding:n.padding,f=Wt.default.convert(t.offset),m=n.centerPoint.add(f),y=n.pointLocation(m),{center:g,zoom:x}=n.getConstrained(ie.convert(t.center||y),(L=t.zoom)!=null?L:o);this._normalizeCenter(g);let b=n.project(y),w=n.project(g).sub(b),_=n.zoomScale(x-o),S,P;t.around&&(S=ie.convert(t.around),P=n.locationPoint(S));let T={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||x!==o,this._rotating=this._rotating||a!==c,this._pitching=this._pitching||p!==s,this._padding=!n.isPaddingEqual(h),this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,T),this.terrain&&this._prepareElevation(g),this._ease(C=>{if(this._zooming&&(n.zoom=Pe.number(o,x,C)),this._rotating&&(n.bearing=Pe.number(a,c,C)),this._pitching&&(n.pitch=Pe.number(s,p,C)),this._padding&&(n.interpolatePadding(u,h,C),m=n.centerPoint.add(f)),this.terrain&&!t.freezeElevation&&this._updateElevation(C),S)n.setLocationAtPoint(S,P);else{let E=n.zoomScale(n.zoom-o),I=x>o?Math.min(2,_):Math.max(.5,_),R=Math.pow(I,1-C),z=n.unproject(b.add(w.mult(C*R)).mult(E));n.setLocationAtPoint(n.renderWorldCopies?z.wrap():z,m)}this._applyUpdatedTransform(n),this._fireMoveEvents(i)},C=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,C)},t),this}_prepareEase(t,i,n={}){this._moving=!0,!i&&!n.moving&&this.fire(new F("movestart",t)),this._zooming&&!n.zooming&&this.fire(new F("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new F("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new F("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){let n=this._elevationTarget-this._elevationStart,o=(i-(n*t+this._elevationStart))/(1-t);this._elevationStart+=t*(n-o),this._elevationTarget=i}this.transform.elevation=Pe.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;let i=t.clone(),{center:n,zoom:o,pitch:a,bearing:s,elevation:u}=this.transformCameraUpdate(i);n&&(i.center=n),o!==void 0&&(i.zoom=o),a!==void 0&&(i.pitch=a),s!==void 0&&(i.bearing=s),u!==void 0&&(i.elevation=u),this.transform.apply(i)}_fireMoveEvents(t){this.fire(new F("move",t)),this._zooming&&this.fire(new F("zoom",t)),this._rotating&&this.fire(new F("rotate",t)),this._pitching&&this.fire(new F("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;let n=this._zooming,o=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new F("zoomend",t)),o&&this.fire(new F("rotateend",t)),a&&this.fire(new F("pitchend",t)),this.fire(new F("moveend",t))}flyTo(t,i){var ne;if(!t.essential&&Y.prefersReducedMotion){let J=yr(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(J,i)}this.stop(),t=V({offset:[0,0],speed:1.2,curve:1.42,easing:Ln},t);let n=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),u=this.getPadding(),c="bearing"in t?this._normalizeBearing(t.bearing,a):a,p="pitch"in t?+t.pitch:s,h="padding"in t?t.padding:n.padding,f=Wt.default.convert(t.offset),m=n.centerPoint.add(f),y=n.pointLocation(m),{center:g,zoom:x}=n.getConstrained(ie.convert(t.center||y),(ne=t.zoom)!=null?ne:o);this._normalizeCenter(g);let b=n.zoomScale(x-o),w=n.project(y),_=n.project(g).sub(w),S=t.curve,P=Math.max(n.width,n.height),T=P/b,L=_.mag();if("minZoom"in t){let J=Ae(Math.min(t.minZoom,o,x),n.minZoom,n.maxZoom),W=P/n.zoomScale(J-o);S=Math.sqrt(W/L*2)}let C=S*S;function E(J){let W=(T*T-P*P+(J?-1:1)*C*C*L*L)/(2*(J?T:P)*C*L);return Math.log(Math.sqrt(W*W+1)-W)}l(E,"zoomOutFactor");function I(J){return(Math.exp(J)-Math.exp(-J))/2}l(I,"sinh");function R(J){return(Math.exp(J)+Math.exp(-J))/2}l(R,"cosh");function z(J){return I(J)/R(J)}l(z,"tanh");let k=E(!1),M=l(function(J){return R(k)/R(k+S*J)},"w"),G=l(function(J){return P*((R(k)*z(k+S*J)-I(k))/C)/L},"u"),K=(E(!0)-k)/S;if(Math.abs(L)<1e-6||!isFinite(K)){if(Math.abs(P-T)<1e-6)return this.easeTo(t,i);let J=T<P?-1:1;K=Math.abs(Math.log(T/P))/S,G=l(function(){return 0},"u"),M=l(function(W){return Math.exp(J*S*W)},"w")}if("duration"in t)t.duration=+t.duration;else{let J="screenSpeed"in t?+t.screenSpeed/S:+t.speed;t.duration=1e3*K/J}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=a!==c,this._pitching=p!==s,this._padding=!n.isPaddingEqual(h),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g),this._ease(J=>{let W=J*K,Ye=1/M(W);n.zoom=J===1?x:o+n.scaleZoom(Ye),this._rotating&&(n.bearing=Pe.number(a,c,J)),this._pitching&&(n.pitch=Pe.number(s,p,J)),this._padding&&(n.interpolatePadding(u,h,J),m=n.centerPoint.add(f)),this.terrain&&!t.freezeElevation&&this._updateElevation(J);let Ve=J===1?g:n.unproject(w.add(_.mult(G(W))).mult(Ye));n.setLocationAtPoint(n.renderWorldCopies?Ve.wrap():Ve,m),this._applyUpdatedTransform(n),this._fireMoveEvents(i)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(i)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,i)}if(!t){let n=this.handlers;n&&n.stop(!1)}return this}_ease(t,i,n){n.animate===!1||n.duration===0?(t(1),i()):(this._easeStart=Y.now(),this._easeOptions=n,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){t=er(t,-180,180);let n=Math.abs(t-i);return Math.abs(t-360-i)<n&&(t-=360),Math.abs(t+360-i)<n&&(t+=360),t}_normalizeCenter(t){let i=this.transform;if(!i.renderWorldCopies||i.lngRange)return;let n=t.lng-i.center.lng;t.lng+=n>180?-360:n<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(ie.convert(t),this.transform.tileZoom)-this.transform.elevation:null}};l(ux,"Camera");var ip=ux;var fr=ae(ge(),1);d();var cx={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},px=class px{constructor(e=cx){this._toggleAttribution=l(()=>{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")))},"_toggleAttribution");this._updateData=l(e=>{e&&(e.sourceDataType==="metadata"||e.sourceDataType==="visibility"||e.dataType==="style"||e.type==="terrain")&&this._updateAttributions()},"_updateData");this._updateCompact=l(()=>{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"))},"_updateCompact");this._updateCompactMinimize=l(()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},"_updateCompactMinimize");this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=D.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=D.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=D.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(){D.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(n=>typeof n!="string"?"":n)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let n=this._map.style.stylesheet;this.styleOwner=n.owner,this.styleId=n.id}let t=this._map.style.sourceCaches;for(let n in t){let o=t[n];if(o.used||o.usedForTerrain){let a=o.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(n=>String(n).trim()),e.sort((n,o)=>n.length-o.length),e=e.filter((n,o)=>{for(let a=o+1;a<e.length;a++)if(e[a].indexOf(n)>=0)return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}};l(px,"AttributionControl");var $a=px;d();var hx=class hx{constructor(e={}){this._updateCompact=l(()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},"_updateCompact");this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=D.create("div","maplibregl-ctrl");let t=D.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(){D.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};l(hx,"LogoControl");var Wa=hx;d();var fx=class fx{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 n of i)if(n.id===e){n.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=[]}};l(fx,"TaskQueue");var np=fx;d();var ap=(i=>(i.create="create",i.load="load",i.fullLoad="fullLoad",i))(ap||{}),op=null,Xa=[],dD=60,mx=1e3/dD,dx="loadTime",yx="fullLoadTime",In={mark(r){performance.mark(r)},frame(r){let e=r;if(op!=null){let t=e-op;Xa.push(t)}op=e},clearMetrics(){op=null,Xa=[],performance.clearMeasures(dx),performance.clearMeasures(yx);for(let r in ap)performance.clearMarks(ap[r])},getPerformanceMetrics(){performance.measure(dx,"create","load"),performance.measure(yx,"create","fullLoad");let r=performance.getEntriesByName(dx)[0].duration,e=performance.getEntriesByName(yx)[0].duration,t=Xa.length,n=1/(Xa.reduce((s,u)=>s+u,0)/t/1e3),o=Xa.filter(s=>s>mx).reduce((s,u)=>s+(u-mx)/mx,0),a=o/(t+o)*100;return{loadTime:r,fullLoadTime:e,fps:n,percentDroppedFrames:a,totalFrames:t}}};d();d();var o2=_e([{name:"a_pos3d",type:"Int16",components:3}]);d();var gx=class gx extends de{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,t){this.sourceCache.update(e,t),this._renderableTilesKeys=[];let i={};for(let n of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.posMatrix=new Float64Array(16),q.ortho(n.posMatrix,0,8192,0,8192,0,1),this._tiles[n.key]=new wn(n,this.tileSize));for(let n in this._tiles)i[n]||delete this._tiles[n]}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){let t={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID;if(n.canonical.equals(e.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16),q.ortho(o.posMatrix,0,8192,0,8192,0,1),t[i]=o}else if(n.canonical.isChildOf(e.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16);let a=n.canonical.z-e.canonical.z,s=n.canonical.x-(n.canonical.x>>a<<a),u=n.canonical.y-(n.canonical.y>>a<<a),c=8192>>a;q.ortho(o.posMatrix,0,c,0,c,0,1),q.translate(o.posMatrix,o.posMatrix,[-s*c,-u*c,0]),t[i]=o}else if(e.canonical.isChildOf(n.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16);let a=e.canonical.z-n.canonical.z,s=e.canonical.x-(e.canonical.x>>a<<a),u=e.canonical.y-(e.canonical.y>>a<<a),c=8192>>a;q.ortho(o.posMatrix,0,8192,0,8192,0,1),q.translate(o.posMatrix,o.posMatrix,[s*c,u*c,0]),q.scale(o.posMatrix,o.posMatrix,[1/2**a,1/2**a,0]),t[i]=o}}return t}getSourceTile(e,t){let i=this.sourceCache._source,n=e.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(n).key);let o=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(o&&o.dem)&&t)for(;n>=i.minzoom&&!(o&&o.dem);)o=this.sourceCache.getTileByID(e.scaledTo(n--).key);return o}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(t=>t.timeAdded>=e)}};l(gx,"TerrainSourceCache");var sp=gx;var xx=class xx{constructor(e,t,i){this.painter=e,this.sourceCache=new sp(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,n=8192){var m;if(!(t>=0&&t<n&&i>=0&&i<n))return 0;let o=this.getTerrainData(e),a=(m=o.tile)==null?void 0:m.dem;if(!a)return 0;let s=sn.transformMat4([],[t/n*8192,i/n*8192],o.u_terrain_matrix),u=[s[0]*a.dim,s[1]*a.dim],c=Math.floor(u[0]),p=Math.floor(u[1]),h=u[0]-c,f=u[1]-p;return a.get(c,p)*(1-h)*(1-f)+a.get(c+1,p)*h*(1-f)+a.get(c,p+1)*(1-h)*f+a.get(c+1,p+1)*h*f}getElevationForLngLatZoom(e,t){let{tileID:i,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,n%8192,o%8192,8192)}getElevation(e,t,i,n=8192){return this.getDEMElevation(e,t,i,n)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let n=this.painter.context,o=new Se({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new ve(n,o,n.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new ve(n,new Se({width:1,height:1}),n.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(n.gl.NEAREST,n.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=q.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let n=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new ve(n,t.dem.getPixels(),n.gl.RGBA,{premultiply:!1}),t.demTexture.bind(n.gl.NEAREST,n.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t&&t+t.tileID.key+e.key;if(i&&!this._demMatrixCache[i]){let n=this.sourceCache.sourceCache._source.maxzoom,o=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=n?o=e.canonical.z-n:Le("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>o<<o),s=e.canonical.y-(e.canonical.y>>o<<o),u=q.fromScaling(new Float64Array(16),[1/(8192<<o),1/(8192<<o),0]);q.translate(u,u,[a*8192,s*8192,0]),this._demMatrixCache[e.key]={matrix:u,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,n=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==i||this._fbo.height!==n)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new ve(t.context,{width:i,height:n,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 ve(t.context,{width:i,height:n,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,n,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,i,n))),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 o=0,a=0;o<this._coordsTextureSize;o++)for(let s=0;s<this._coordsTextureSize;s++,a+=4)t[a+0]=s&255,t[a+1]=o&255,t[a+2]=s>>8<<4|o>>8,t[a+3]=0;let i=new Se({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),n=new ve(e,i,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),i=this.painter.context,n=i.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null);let u=t[0]+(t[2]>>4<<8),c=t[1]+((t[2]&15)<<8),p=this.coordsIndex[255-t[3]],h=p&&this.sourceCache.getTileByID(p);if(!h)return null;let f=this._coordsTextureSize,m=(1<<h.tileID.canonical.z)*f;return new Fe((h.tileID.canonical.x*f+u)/m+h.tileID.wrap,(h.tileID.canonical.y*f+c)/m,this.getElevation(h.tileID,u,c,f))}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,n=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;let e=this.painter.context,t=new fl,i=new it,n=this.meshSize,o=8192/n,a=n*n;for(let h=0;h<=n;h++)for(let f=0;f<=n;f++)t.emplaceBack(f*o,h*o,0);for(let h=0;h<a;h+=n+1)for(let f=0;f<n;f++)i.emplaceBack(f+h,n+f+h+1,n+f+h+2),i.emplaceBack(f+h,n+f+h+2,f+h+1);let s=t.length,u=s+(n+1)*2;for(let h of[0,1])for(let f=0;f<=n;f++)for(let m of[0,1])t.emplaceBack(f*o,h*8192,m);for(let h=0;h<n*2;h+=2)i.emplaceBack(u+h,u+h+1,u+h+3),i.emplaceBack(u+h,u+h+3,u+h+2),i.emplaceBack(s+h,s+h+3,s+h+1),i.emplaceBack(s+h,s+h+2,s+h+3);let c=t.length,p=c+(n+1)*2;for(let h of[0,1])for(let f=0;f<=n;f++)for(let m of[0,1])t.emplaceBack(h*8192,f*o,m);for(let h=0;h<n*2;h+=2)i.emplaceBack(c+h,c+h+1,c+h+3),i.emplaceBack(c+h,c+h+3,c+h+2),i.emplaceBack(p+h,p+h+3,p+h+1),i.emplaceBack(p+h,p+h+2,p+h+3);return this._mesh={indexBuffer:e.createIndexBuffer(i),vertexBuffer:e.createVertexBuffer(t,o2.members),segments:me.simpleSegment(0,0,t.length,i.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*ca/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,t){var n;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return(n=this.getMinMaxElevation(i).minElevation)!=null?n: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=Fe.fromLngLat(e.wrap()),n=(1<<t)*8192,o=i.x*n,a=i.y*n,s=Math.floor(o/8192),u=Math.floor(a/8192);return{tileID:new Je(t,0,t,s,u),mercatorX:o,mercatorY:a}}};l(xx,"Terrain");var lp=xx;d();d();var bx=class bx{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 ve(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),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}};l(bx,"RenderPool");var up=bx;var Cn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0},_x=class _x{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new up(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._coordsDescendingInv={};for(let i in e.sourceCaches){this._coordsDescendingInv[i]={};let n=e.sourceCaches[i].getVisibleCoordinates();for(let o of n){let a=this.terrain.sourceCache.getTerrainCoords(o);for(let s in a)this._coordsDescendingInv[i][s]||(this._coordsDescendingInv[i][s]=[]),this._coordsDescendingInv[i][s].push(a[s])}}this._coordsDescendingInvStr={};for(let i of e._order){let n=e._layers[i],o=n.source;if(Cn[n.type]&&!this._coordsDescendingInvStr[o]){this._coordsDescendingInvStr[o]={};for(let a in this._coordsDescendingInv[o])this._coordsDescendingInvStr[o][a]=this._coordsDescendingInv[o][a].map(s=>s.key).sort().join()}}for(let i of this._renderableTiles)for(let n in this._coordsDescendingInvStr){let o=this._coordsDescendingInvStr[n][i.tileID.key];o&&o!==i.rttCoords[n]&&(i.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let t=e.type,i=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Cn[t]&&((!this._prevType||!Cn[this._prevType])&&this._stacks.push([]),this._prevType=t,this._stacks[this._stacks.length-1].push(e.id),!n))return!0;if(Cn[this._prevType]||Cn[t]&&n){this._prevType=t;let o=this._stacks.length-1,a=this._stacks[o]||[];for(let s of this._renderableTiles){if(this.pool.isFull()&&(Sg(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(s),s.rtt[o]){let c=this.pool.getObjectForId(s.rtt[o].id);if(c.stamp===s.rtt[o].stamp){this.pool.useObject(c);continue}}let u=this.pool.getOrCreateFreeObject();this.pool.useObject(u),this.pool.stampObject(u),s.rtt[o]={id:u.id,stamp:u.stamp},i.context.bindFramebuffer.set(u.fbo.framebuffer),i.context.clear({color:X.transparent,stencil:0}),i.currentStencilSource=void 0;for(let c=0;c<a.length;c++){let p=i.style._layers[a[c]],h=p.source?this._coordsDescendingInv[p.source][s.tileID.key]:[s.tileID];i.context.viewport.set([0,0,u.fbo.width,u.fbo.height]),i._renderTileClippingMasks(p,h),i.renderLayer(i,i.style.sourceCaches[p.source],p,h),p.source&&(s.rttCoords[p.source]=this._coordsDescendingInvStr[p.source][s.tileID.key])}}return Sg(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Cn[t]}return!1}};l(_x,"RenderToTexture");var cp=_x;d();var a2={"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","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","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"};var yD=ts.version,hp=-2,s2=22,Nr=0,l2=80,pp=85,gD={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:hp,maxZoom:s2,minPitch:Nr,maxPitch:l2,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:cx,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Ke.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},wx=class wx extends ip{constructor(t){if(In.mark("create"),t=V({},gD,t),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<Nr)throw new Error("minPitch must be greater than or equal to ".concat(Nr));if(t.maxPitch!=null&&t.maxPitch>pp)throw new Error("maxPitch must be less than or equal to ".concat(pp));let i=new Bc(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies);super(i,{bearingSnap:t.bearingSnap});this._contextLost=l(t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new F("webglcontextlost",{originalEvent:t}))},"_contextLost");this._contextRestored=l(t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new F("webglcontextrestored",{originalEvent:t}))},"_contextRestored");this._onMapScroll=l(t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},"_onMapScroll");this._onWindowOnline=l(()=>{this._update()},"_onWindowOnline");if(this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=t.collectResourceTiming,this._renderTaskQueue=new np,this._controls=[],this._mapId=ns(),this._locale=V({},a2,t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this._imageQueueHandle=st.addThrottleControl(()=>this.isMoving()),this._requestManager=new cs(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 o=!1,a=Vc(s=>{this._trackResize&&!this._removed&&this.resize(s)._update()},50);this._resizeObserver=new ResizeObserver(s=>{if(!o){o=!0;return}a(s)}),this._resizeObserver.observe(this._container)}this.handlers=new rp(this,t);let n=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash&&new ka(n).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,V({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new $a(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new Wa,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new F("".concat(o.dataType,"data"),o))}),this.on("dataloading",o=>{this.fire(new F("".concat(o.dataType,"dataloading"),o))}),this.on("dataabort",o=>{this.fire(new F("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(t,i){if(i===void 0&&(t.getDefaultPosition?i=t.getDefaultPosition():i="top-right"),!t||!t.onAdd)return this.fire(new H(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=t.onAdd(this);this._controls.push(t);let o=this._controlPositions[i];return i.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new H(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,i,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,i,n,o)}resize(t){var u;let i=this._containerDimensions(),n=i[0],o=i[1],a=this._getClampedPixelRatio(n,o);if(this._resizeCanvas(n,o,a),this.painter.resize(n,o,a),this.painter.overLimit()){let c=this.painter.context.gl;this._maxCanvasSize=[c.drawingBufferWidth,c.drawingBufferHeight];let p=this._getClampedPixelRatio(n,o);this._resizeCanvas(n,o,p),this.painter.resize(n,o,p)}this.transform.resize(n,o),(u=this._requestedCameraState)==null||u.resize(n,o);let s=!this._moving;return s&&(this.stop(),this.fire(new F("movestart",t)).fire(new F("move",t))),this.fire(new F("resize",t)),s&&this.fire(new F("moveend",t)),this}_getClampedPixelRatio(t,i){let{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),s=t*a,u=i*a,c=s>n?n/s:1,p=u>o?o/u:1;return Math.min(c,p)*a}getPixelRatio(){var t;return(t=this._overridePixelRatio)!=null?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(ut.convert(t)),this._update()}setMinZoom(t){if(t=t==null?hp:t,t>=hp&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between ".concat(hp," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if(t=t==null?s2:t,t>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if(t=t==null?Nr:t,t<Nr)throw new Error("minPitch must be greater than or equal to ".concat(Nr));if(t>=Nr&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between ".concat(Nr," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if(t=t==null?l2:t,t>pp)throw new Error("maxPitch must be less than or equal to ".concat(pp));if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(t){return this.transform.locationPoint(ie.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.pointLocation(fr.default.convert(t),this.terrain)}isMoving(){var t;return this._moving||((t=this.handlers)==null?void 0:t.isMoving())}isZooming(){var t;return this._zooming||((t=this.handlers)==null?void 0:t.isZooming())}isRotating(){var t;return this._rotating||((t=this.handlers)==null?void 0:t.isRotating())}_createDelegatedListener(t,i,n){if(t==="mouseenter"||t==="mouseover"){let o=!1;return{layer:i,listener:n,delegates:{mousemove:l(u=>{let c=this.getLayer(i)?this.queryRenderedFeatures(u.point,{layers:[i]}):[];c.length?o||(o=!0,n.call(this,new nt(t,this,u.originalEvent,{features:c}))):o=!1},"mousemove"),mouseout:l(()=>{o=!1},"mouseout")}}}else if(t==="mouseleave"||t==="mouseout"){let o=!1;return{layer:i,listener:n,delegates:{mousemove:l(u=>{(this.getLayer(i)?this.queryRenderedFeatures(u.point,{layers:[i]}):[]).length?o=!0:o&&(o=!1,n.call(this,new nt(t,this,u.originalEvent)))},"mousemove"),mouseout:l(u=>{o&&(o=!1,n.call(this,new nt(t,this,u.originalEvent)))},"mouseout")}}}else{let o=l(a=>{let s=this.getLayer(i)?this.queryRenderedFeatures(a.point,{layers:[i]}):[];s.length&&(a.features=s,n.call(this,a),delete a.features)},"delegate");return{layer:i,listener:n,delegates:{[t]:o}}}}on(t,i,n){if(n===void 0)return super.on(t,i);let o=this._createDelegatedListener(t,i,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o);for(let a in o.delegates)this.on(a,o.delegates[a]);return this}once(t,i,n){if(n===void 0)return super.once(t,i);let o=this._createDelegatedListener(t,i,n);for(let a in o.delegates)this.once(a,o.delegates[a]);return this}off(t,i,n){if(n===void 0)return super.off(t,i);let o=l(a=>{let s=a[t];for(let u=0;u<s.length;u++){let c=s[u];if(c.layer===i&&c.listener===n){for(let p in c.delegates)this.off(p,c.delegates[p]);return s.splice(u,1),this}}},"removeDelegatedListener");return this._delegatedListeners&&this._delegatedListeners[t]&&o(this._delegatedListeners),this}queryRenderedFeatures(t,i){if(!this.style)return[];let n,o=t instanceof fr.default||Array.isArray(t),a=o?t:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(o?{}:t)||{},a instanceof fr.default||typeof a[0]=="number")n=[fr.default.convert(a)];else{let s=fr.default.convert(a[0]),u=fr.default.convert(a[1]);n=[s,new fr.default(u.x,s.y),u,new fr.default(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(t,i){return this.style.querySourceFeatures(t,i)}setStyle(t,i){return i=V({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i),i.diff!==!1&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let i=this._locale[t];if(i==null)throw new Error("Missing UI string '".concat(t,"'"));return i}_updateStyle(t,i){if(i.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(t,i));return}let n=this.style&&i.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)this.style=new Tn(this,i||{});else return delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof t=="string"?this.style.loadURL(t,i,n):this.style.loadJSON(t,i,n),this}_lazyInitEmptyStyle(){this.style||(this.style=new Tn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,i){if(typeof t=="string"){let n=t,o=this._requestManager.transformRequest(n,"Style");gr(o,new AbortController).then(a=>{this._updateDiff(a.data,i)}).catch(a=>{a&&this.fire(new H(a))})}else typeof t=="object"&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(n){Le("Unable to perform style diff: ".concat(n.message||n.error||n,". Rebuilding the style from scratch.")),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():Le("There is no style added to the map.")}addSource(t,i){return this._lazyInitEmptyStyle(),this.style.addSource(t,i),this._update(!0)}isSourceLoaded(t){let i=this.style&&this.style.sourceCaches[t];if(i===void 0){this.fire(new H(new Error("There is no source with ID '".concat(t,"'"))));return}return i.loaded()}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!t)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;else{let i=this.style.sourceCaches[t.source];if(!i)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(t.source));this.terrain===null&&i.reload();for(let n in this.style._layers){let o=this.style._layers[n];o.type==="hillshade"&&o.source===t.source&&Le("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new lp(this.painter,i,t),this.painter.renderToTexture=new cp(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===t.source&&!this._elevationFreeze&&(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new F("terrain",{terrain:t})),this}getTerrain(){var t,i;return(i=(t=this.terrain)==null?void 0:t.options)!=null?i:null}areTilesLoaded(){let t=this.style&&this.style.sourceCaches;for(let i in t){let o=t[i]._tiles;for(let a in o){let s=o[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,i,n={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:u,content:c}=n;this._lazyInitEmptyStyle();let p=0;if(i instanceof HTMLImageElement||ht(i)){let{width:h,height:f,data:m}=Y.getImageData(i);this.style.addImage(t,{data:new Se({width:h,height:f},m),pixelRatio:o,stretchX:s,stretchY:u,content:c,sdf:a,version:p})}else{if(i.width===void 0||i.height===void 0)return this.fire(new H(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:h,height:f,data:m}=i,y=i;return this.style.addImage(t,{data:new Se({width:h,height:f},new Uint8Array(m)),pixelRatio:o,stretchX:s,stretchY:u,content:c,sdf:a,version:p,userImage:y}),y.onAdd&&y.onAdd(this,t),this}}}updateImage(t,i){let n=this.style.getImage(t);if(!n)return this.fire(new H(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=i instanceof HTMLImageElement||ht(i)?Y.getImageData(i):i,{width:a,height:s,data:u}=o;if(a===void 0||s===void 0)return this.fire(new H(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(a!==n.data.width||s!==n.data.height)return this.fire(new H(new Error("The width and height of the updated image must be that same as the previous version of the image")));let c=!(i instanceof HTMLImageElement||ht(i));return n.data.replace(u,c),this.style.updateImage(t,n),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new H(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return st.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,i){return this._lazyInitEmptyStyle(),this.style.addLayer(t,i),this._update(!0)}moveLayer(t,i){return this.style.moveLayer(t,i),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,i,n){return this.style.setLayerZoomRange(t,i,n),this._update(!0)}setFilter(t,i,n={}){return this.style.setFilter(t,i,n),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,i,n,o={}){return this.style.setPaintProperty(t,i,n,o),this._update(!0)}getPaintProperty(t,i){return this.style.getPaintProperty(t,i)}setLayoutProperty(t,i,n,o={}){return this.style.setLayoutProperty(t,i,n,o),this._update(!0)}getLayoutProperty(t,i){return this.style.getLayoutProperty(t,i)}setGlyphs(t,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,i,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,i,n,o=>{o||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,i,n=>{n||this._update(!0)}),this}setLight(t,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,i){return this.style.setFeatureState(t,i),this._update()}removeFeatureState(t,i){return this.style.removeFeatureState(t,i),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,i=0;return this._container&&(t=this._container.clientWidth||400,i=this._container.clientHeight||300),[t,i]}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let i=this._canvasContainer=D.create("div","maplibregl-canvas-container",t);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=D.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");let n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);let a=this._controlContainer=D.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(u=>{s[u]=D.create("div","maplibregl-ctrl-".concat(u," "),a)})}_resizeCanvas(t,i,n){this._canvas.width=Math.floor(n*t),this._canvas.height=Math.floor(n*i),this._canvas.style.width="".concat(t,"px"),this._canvas.style.height="".concat(i,"px")}_setupPainter(){let t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},i=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{i={requestedAttributes:t},o&&(i.statusMessage=o.statusMessage,i.type=o.type)},{once:!0});let n=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!n){let o="Failed to initialize WebGL";throw i?(i.message=o,new Error(JSON.stringify(i))):new Error(o)}this.painter=new kc(n,this.transform),Fn.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){let i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let a=this.transform.zoom,s=Y.now();this.style.zoomHistory.update(a,s);let u=new ye(a,{now:s,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),c=u.crossFadingFactor();(c!==1||c!==this._crossFadingFactor)&&(n=!0,this._crossFadingFactor=c),this.style.update(u)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new F("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,In.mark("load"),this.fire(new F("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new F("idle")),this._loaded&&!this._fullyLoaded&&!o&&(this._fullyLoaded=!0,In.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var i;this._hash&&this._hash.remove();for(let n of this._controls)n.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),st.removeThrottleControl(this._imageQueueHandle),(i=this._resizeObserver)==null||i.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),D.remove(this._canvasContainer),D.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),In.clearMetrics(),this._removed=!0,this.fire(new F("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Y.frameAsync(this._frameRequest).then(t=>{In.frame(t),this._frameRequest=null,this._render(t)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return yD}getCameraTargetElevation(){return this.transform.elevation}};l(wx,"Map");var vx=wx;d();d();var u2=l(r=>{r.touchstart=r.dragStart,r.touchmoveWindow=r.dragMove,r.touchend=r.dragEnd},"assignEvents"),c2=l(({enable:r,clickTolerance:e,bearingDegreesPerPixelMoved:t=.8})=>{let i=new Fa;return new hr({clickTolerance:e,move:l((n,o)=>({bearingDelta:(o.x-n.x)*t}),"move"),moveStateManager:i,enable:r,assignEvents:u2})},"generateOneFingerTouchRotationHandler"),p2=l(({enable:r,clickTolerance:e,pitchDegreesPerPixelMoved:t=-.5})=>{let i=new Fa;return new hr({clickTolerance:e,move:l((n,o)=>({pitchDelta:(o.y-n.y)*t}),"move"),moveStateManager:i,enable:r,assignEvents:u2})},"generateOneFingerTouchPitchHandler");var xD={showCompass:!0,showZoom:!0,visualizePitch:!1},Tx=class Tx{constructor(e){this._updateZoomButtons=l(()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},"_updateZoomButtons");this._rotateCompassArrow=l(()=>{let e=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(this._map.transform.pitch,"deg) rotateZ(").concat(this._map.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(this._map.transform.angle*(180/Math.PI),"deg)");this._compassIcon.style.transform=e},"_rotateCompassArrow");this._setButtonTitle=l((e,t)=>{let i=this._map._getUIString("NavigationControl.".concat(t));e.title=i,e.setAttribute("aria-label",i)},"_setButtonTitle");this.options=V({},xD,e),this._container=D.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),D.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),D.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=D.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Px(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){D.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let i=D.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}};l(Tx,"NavigationControl");var Sx=Tx,Mx=class Mx{constructor(e,t,i=!1){this.mousedown=l(e=>{this.startMouse(V({},e,{ctrlKey:!0,preventDefault:l(()=>e.preventDefault(),"preventDefault")}),D.mousePos(this.element,e)),D.addEventListener(window,"mousemove",this.mousemove),D.addEventListener(window,"mouseup",this.mouseup)},"mousedown");this.mousemove=l(e=>{this.moveMouse(e,D.mousePos(this.element,e))},"mousemove");this.mouseup=l(e=>{this.mouseRotate.dragEnd(e),this.mousePitch&&this.mousePitch.dragEnd(e),this.offTemp()},"mouseup");this.touchstart=l(e=>{e.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=D.touchPos(this.element,e.targetTouches)[0],this.startTouch(e,this._startPos),D.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),D.addEventListener(window,"touchend",this.touchend))},"touchstart");this.touchmove=l(e=>{e.targetTouches.length!==1?this.reset():(this._lastPos=D.touchPos(this.element,e.targetTouches)[0],this.moveTouch(e,this._lastPos))},"touchmove");this.touchend=l(e=>{e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},"touchend");this.reset=l(()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},"reset");this._clickTolerance=10;let n=e.dragRotate._mouseRotate.getClickTolerance(),o=e.dragRotate._mousePitch.getClickTolerance();this.element=t,this.mouseRotate=Wc({clickTolerance:n,enable:!0}),this.touchRotate=c2({clickTolerance:n,enable:!0}),this.map=e,i&&(this.mousePitch=Xc({clickTolerance:o,enable:!0}),this.touchPitch=p2({clickTolerance:o,enable:!0})),D.addEventListener(t,"mousedown",this.mousedown),D.addEventListener(t,"touchstart",this.touchstart,{passive:!1}),D.addEventListener(t,"touchcancel",this.reset)}startMouse(e,t){this.mouseRotate.dragStart(e,t),this.mousePitch&&this.mousePitch.dragStart(e,t),D.disableDrag()}startTouch(e,t){this.touchRotate.dragStart(e,t),this.touchPitch&&this.touchPitch.dragStart(e,t),D.disableDrag()}moveMouse(e,t){let i=this.map,{bearingDelta:n}=this.mouseRotate.dragMove(e,t)||{};if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){let{pitchDelta:o}=this.mousePitch.dragMove(e,t)||{};o&&i.setPitch(i.getPitch()+o)}}moveTouch(e,t){let i=this.map,{bearingDelta:n}=this.touchRotate.dragMove(e,t)||{};if(n&&i.setBearing(i.getBearing()+n),this.touchPitch){let{pitchDelta:o}=this.touchPitch.dragMove(e,t)||{};o&&i.setPitch(i.getPitch()+o)}}off(){let e=this.element;D.removeEventListener(e,"mousedown",this.mousedown),D.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),D.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),D.removeEventListener(window,"touchend",this.touchend),D.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){D.enableDrag(),D.removeEventListener(window,"mousemove",this.mousemove),D.removeEventListener(window,"mouseup",this.mouseup),D.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),D.removeEventListener(window,"touchend",this.touchend)}};l(Mx,"MouseRotateWrapper");var Px=Mx;d();d();var Ai;async function h2(r=!1){if(Ai!==void 0&&!r)return Ai;if(window.navigator.permissions===void 0)return Ai=!!window.navigator.geolocation,Ai;try{Ai=(await window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch(e){Ai=!!window.navigator.geolocation}return Ai}l(h2,"checkGeolocationSupport");d();var Ja=ae(ge(),1);d();function fp(r,e,t){let i=new ie(r.lng,r.lat);if(r=new ie(r.lng,r.lat),e){let n=new ie(r.lng-360,r.lat),o=new ie(r.lng+360,r.lat),a=t.locationPoint(r).distSqr(e);t.locationPoint(n).distSqr(e)<a?r=n:t.locationPoint(o).distSqr(e)<a&&(r=o)}for(;Math.abs(r.lng-t.center.lng)>180;){let n=t.locationPoint(r);if(n.x>=0&&n.y>=0&&n.x<=t.width&&n.y<=t.height)break;r.lng>t.center.lng?r.lng-=360:r.lng+=360}return r.lng!==i.lng&&t.locationPoint(r).y>t.height/2-t.getHorizon()?r:i}l(fp,"smartWrap");d();var Ka={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function mp(r,e,t){let i=r.classList;for(let n in Ka)i.remove("maplibregl-".concat(t,"-anchor-").concat(n));i.add("maplibregl-".concat(t,"-anchor-").concat(e))}l(mp,"applyAnchorClass");var Ax=class Ax extends de{constructor(t){super();this._onKeyPress=l(t=>{let i=t.code,n=t.charCode||t.keyCode;(i==="Space"||i==="Enter"||n===32||n===13)&&this.togglePopup()},"_onKeyPress");this._onMapClick=l(t=>{let i=t.originalEvent.target,n=this._element;this._popup&&(i===n||n.contains(i))&&this.togglePopup()},"_onMapClick");this._update=l(t=>{var a;if(!this._map)return;let i=this._map.loaded()&&!this._map.isMoving();((t==null?void 0:t.type)==="terrain"||(t==null?void 0:t.type)==="render"&&!i)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies?this._lngLat=fp(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(a=this._lngLat)==null?void 0:a.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n="rotateZ(".concat(this._rotation,"deg)"):this._rotationAlignment==="map"&&(n="rotateZ(".concat(this._rotation-this._map.getBearing(),"deg)"));let o="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?o="rotateX(0deg)":this._pitchAlignment==="map"&&(o="rotateX(".concat(this._map.getPitch(),"deg)")),(!t||t.type==="moveend")&&(this._pos=this._pos.round()),D.setTransform(this._element,"".concat(Ka[this._anchor]," translate(").concat(this._pos.x,"px, ").concat(this._pos.y,"px) ").concat(o," ").concat(n)),Y.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&t.type==="moveend")}).catch(()=>{})},"_update");this._onMove=l(t=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new F("dragstart"))),this.fire(new F("drag")))},"_onMove");this._onUp=l(()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new F("dragend")),this._state="inactive"},"_onUp");this._addDragHandler=l(t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},"_addDragHandler");if(this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),!t||!t.element){this._defaultMarker=!0,this._element=D.create("div"),this._element.setAttribute("aria-label","Map marker");let i=D.createNS("http://www.w3.org/2000/svg","svg"),n=41,o=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height","".concat(n,"px")),i.setAttributeNS(null,"width","".concat(o,"px")),i.setAttributeNS(null,"viewBox","0 0 ".concat(o," ").concat(n));let a=D.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let s=D.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let u=D.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"transform","translate(3.0, 29.0)"),u.setAttributeNS(null,"fill","#000000");let c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let w of c){let _=D.createNS("http://www.w3.org/2000/svg","ellipse");_.setAttributeNS(null,"opacity","0.04"),_.setAttributeNS(null,"cx","10.5"),_.setAttributeNS(null,"cy","5.80029008"),_.setAttributeNS(null,"rx",w.rx),_.setAttributeNS(null,"ry",w.ry),u.appendChild(_)}let p=D.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"fill",this._color);let h=D.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),p.appendChild(h);let f=D.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"fill","#000000");let m=D.createNS("http://www.w3.org/2000/svg","path");m.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),f.appendChild(m);let y=D.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(6.0, 7.0)"),y.setAttributeNS(null,"fill","#FFFFFF");let g=D.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(8.0, 8.0)");let x=D.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#000000"),x.setAttributeNS(null,"opacity","0.25"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962");let b=D.createNS("http://www.w3.org/2000/svg","circle");b.setAttributeNS(null,"fill","#FFFFFF"),b.setAttributeNS(null,"cx","5.5"),b.setAttributeNS(null,"cy","5.5"),b.setAttributeNS(null,"r","5.4999962"),g.appendChild(x),g.appendChild(b),s.appendChild(u),s.appendChild(p),s.appendChild(f),s.appendChild(y),s.appendChild(g),i.appendChild(s),i.setAttributeNS(null,"height","".concat(n*this._scale,"px")),i.setAttributeNS(null,"width","".concat(o*this._scale,"px")),this._element.appendChild(i),this._offset=Ja.default.convert(t&&t.offset||[0,-14])}else this._element=t.element,this._offset=Ja.default.convert(t&&t.offset||[0,0]);if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),mp(this._element,this._anchor,"marker"),t&&t.className)for(let i of t.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),D.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=ie.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let o=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,(38.1-13.5+o)*-1],"bottom-right":[-o,(38.1-13.5+o)*-1],left:[13.5,(38.1-13.5)*-1],right:[-13.5,(38.1-13.5)*-1]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let t=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(t)t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map));else return this;return this}_updateOpacity(t=!1){var y,g;if(!((y=this._map)==null?void 0:y.terrain)){this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity);return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let n=this._map,o=n.terrain.depthAtPoint(this._pos),a=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom),s=n.transform.lngLatToCameraDepth(this._lngLat,a),u=.006;if(s-o<u){this._element.style.opacity=this._opacity;return}let c=-this._offset.y/n.transform._pixelPerMeter,p=Math.sin(n.getPitch()*Math.PI/180)*c,h=n.terrain.depthAtPoint(new Ja.default(this._pos.x,this._pos.y-this._offset.y)),m=n.transform.lngLatToCameraDepth(this._lngLat,a+p)-h>u;(g=this._popup)!=null&&g.isOpen()&&m&&this._popup.remove(),this._element.style.opacity=m?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=Ja.default.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,i){return t===void 0&&i===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}};l(Ax,"Marker");var En=Ax;var bD={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},dp=0,Ya=!1,Cx=class Cx extends de{constructor(t){super();this._onSuccess=l(t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new F("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new F("geolocate",t)),this._finish()}},"_onSuccess");this._updateCamera=l(t=>{let i=new ie(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,o=this._map.getBearing(),a=V({bearing:o},this.options.fitBoundsOptions),s=ut.fromLngLat(i,n);this._map.fitBounds(s,a,{geolocateSource:!0})},"_updateCamera");this._updateMarker=l(t=>{if(t){let i=new ie(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},"_updateMarker");this._onZoom=l(()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},"_onZoom");this._onError=l(t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Ya)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new F("error",t)),this._finish()}},"_onError");this._finish=l(()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},"_finish");this._setupUI=l(t=>{if(this._map){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=D.create("button","maplibregl-ctrl-geolocate",this._container),D.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){Le("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=D.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new En({element:this._dotElement}),this._circleElement=D.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new En({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{let n=i.originalEvent&&i.originalEvent.type==="resize";!i.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!n&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new F("trackuserlocationend")))})}},"_setupUI");this.options=V({},bD,t)}onAdd(t){return this._map=t,this._container=D.create("div","maplibregl-ctrl maplibregl-ctrl-group"),h2().then(i=>this._setupUI(i)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),D.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,dp=0,Ya=!1}_isOutOfMapMaxBounds(t){let i=this._map.getMaxBounds(),n=t.coords;return i&&(n.longitude<i.getWest()||n.longitude>i.getEast()||n.latitude<i.getSouth()||n.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}}_updateCircleRadius(){let t=this._map.getBounds(),i=t.getSouthEast(),n=t.getNorthEast(),o=i.distanceTo(n),a=this._map._container.clientHeight,s=Math.ceil(2*(this._accuracy/(o/a)));this._circleElement.style.width="".concat(s,"px"),this._circleElement.style.height="".concat(s,"px")}trigger(){if(!this._setup)return Le("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new F("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":dp--,Ya=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new F("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new F("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),dp++;let t;dp>1?(t={maximumAge:6e5,timeout:0},Ya=!0):(t=this.options.positionOptions,Ya=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};l(Cx,"GeolocateControl");var Ix=Cx;d();var _D={maxWidth:100,unit:"metric"},kx=class kx{constructor(e){this._onMove=l(()=>{f2(this._map,this._container,this.options)},"_onMove");this.setUnit=l(e=>{this.options.unit=e,f2(this._map,this._container,this.options)},"setUnit");this.options=Vt(Vt({},_D),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=D.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){D.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};l(kx,"ScaleControl");var Ex=kx;function f2(r,e,t){let i=t&&t.maxWidth||100,n=r._container.clientHeight/2,o=r.unproject([0,n]),a=r.unproject([i,n]),s=o.distanceTo(a);if(t&&t.unit==="imperial"){let u=3.2808*s;if(u>5280){let c=u/5280;Qa(e,i,c,r._getUIString("ScaleControl.Miles"))}else Qa(e,i,u,r._getUIString("ScaleControl.Feet"))}else if(t&&t.unit==="nautical"){let u=s/1852;Qa(e,i,u,r._getUIString("ScaleControl.NauticalMiles"))}else s>=1e3?Qa(e,i,s/1e3,r._getUIString("ScaleControl.Kilometers")):Qa(e,i,s,r._getUIString("ScaleControl.Meters"))}l(f2,"updateScale");function Qa(r,e,t,i){let n=wD(t),o=n/t;r.style.width="".concat(e*o,"px"),r.innerHTML="".concat(n,"&nbsp;").concat(i)}l(Qa,"setScale");function vD(r){let e=Math.pow(10,Math.ceil(-Math.log(r)/Math.LN10));return Math.round(r*e)/e}l(vD,"getDecimalRoundNum");function wD(r){let e=Math.pow(10,"".concat(Math.floor(r)).length-1),t=r/e;return t=t>=10?10:t>=5?5:t>=3?3:t>=2?2:t>=1?1:vD(t),e*t}l(wD,"getRoundNum");d();var Dx=class Dx extends de{constructor(t={}){super();this._onFullscreenChange=l(()=>{var i;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;(i=t==null?void 0:t.shadowRoot)!=null&&i.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},"_onFullscreenChange");this._onClickFullscreen=l(()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},"_onClickFullscreen");this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:Le("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=D.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){D.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=D.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);D.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new F("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new F("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};l(Dx,"FullscreenControl");var Lx=Dx;d();var Fx=class Fx{constructor(e){this._toggleTerrain=l(()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},"_toggleTerrain");this._updateTerrainIcon=l(()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},"_updateTerrainIcon");this.options=e}onAdd(e){return this._map=e,this._container=D.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=D.create("button","maplibregl-ctrl-terrain",this._container),D.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){D.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};l(Fx,"TerrainControl");var zx=Fx;d();var je=ae(ge(),1);var SD={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},PD=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Bx=class Bx extends de{constructor(t){super();this.remove=l(()=>(this._content&&D.remove(this._content),this._container&&(D.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new F("close"))),this),"remove");this._onMouseUp=l(t=>{this._update(t.point)},"_onMouseUp");this._onMouseMove=l(t=>{this._update(t.point)},"_onMouseMove");this._onDrag=l(t=>{this._update(t.point)},"_onDrag");this._update=l(t=>{var u;let i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=D.create("div","maplibregl-popup",this._map.getContainer()),this._tip=D.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let c of this.options.className.split(" "))this._container.classList.add(c);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer?this._lngLat=fp(this._lngLat,this._flatPos,this._map.transform):this._lngLat=(u=this._lngLat)==null?void 0:u.wrap(),this._trackPointer&&!t)return;let n=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor,a=m2(this.options.offset);if(!o){let c=this._container.offsetWidth,p=this._container.offsetHeight,h;n.y+a.bottom.y<p?h=["top"]:n.y>this._map.transform.height-p?h=["bottom"]:h=[],n.x<c/2?h.push("left"):n.x>this._map.transform.width-c/2&&h.push("right"),h.length===0?o="bottom":o=h.join("-")}let s=n.add(a[o]);this.options.subpixelPositioning||(s=s.round()),D.setTransform(this._container,"".concat(Ka[o]," translate(").concat(s.x,"px,").concat(s.y,"px)")),mp(this._container,o,"popup")},"_update");this._onClose=l(()=>{this.remove()},"_onClose");this.options=V(Object.create(SD),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new F("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=ie.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let i=document.createDocumentFragment(),n=document.createElement("body"),o;for(n.innerHTML=t;o=n.firstChild,!!o;)i.appendChild(o);return this.setDOMContent(i)}getMaxWidth(){var t;return(t=this._container)==null?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=D.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=D.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let t=this._container.querySelector(PD);t&&t.focus()}};l(Bx,"Popup");var Rx=Bx;function m2(r){if(r)if(typeof r=="number"){let e=Math.round(Math.abs(r)/Math.SQRT2);return{center:new je.default(0,0),top:new je.default(0,r),"top-left":new je.default(e,e),"top-right":new je.default(-e,e),bottom:new je.default(0,-r),"bottom-left":new je.default(e,-e),"bottom-right":new je.default(-e,-e),left:new je.default(r,0),right:new je.default(-r,0)}}else if(r instanceof je.default||Array.isArray(r)){let e=je.default.convert(r);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}else return{center:je.default.convert(r.center||[0,0]),top:je.default.convert(r.top||[0,0]),"top-left":je.default.convert(r["top-left"]||[0,0]),"top-right":je.default.convert(r["top-right"]||[0,0]),bottom:je.default.convert(r.bottom||[0,0]),"bottom-left":je.default.convert(r["bottom-left"]||[0,0]),"bottom-right":je.default.convert(r["bottom-right"]||[0,0]),left:je.default.convert(r.left||[0,0]),right:je.default.convert(r.right||[0,0])};else return m2(new je.default(0,0))}l(m2,"normalizeOffset");var TD=ae(ge(),1);var MD=ts.version;function Ole(r,e){return Vr().setRTLTextPlugin(r,e)}l(Ole,"setRTLTextPlugin");function Vle(){return Vr().getRTLTextPluginStatus()}l(Vle,"getRTLTextPluginStatus");function Ule(){return MD}l(Ule,"getVersion");function Nle(){return zr.workerCount}l(Nle,"getWorkerCount");function Gle(r){zr.workerCount=r}l(Gle,"setWorkerCount");function qle(){return Ke.MAX_PARALLEL_IMAGE_REQUESTS}l(qle,"getMaxParallelImageRequests");function jle(r){Ke.MAX_PARALLEL_IMAGE_REQUESTS=r}l(jle,"setMaxParallelImageRequests");function Zle(){return Ke.WORKER_URL}l(Zle,"getWorkerUrl");function Hle(r){Ke.WORKER_URL=r}l(Hle,"setWorkerUrl");function $le(r){return yu().broadcast("IS",r)}l($le,"importScriptInWorkers");export{Em as a,Ke as b,M2 as c,A2 as d,$r as e,de as f,Hk as g,$k as h,ie as i,ut as j,Fe as k,pa as l,vi as m,fa as n,ma as o,Lt as p,da as q,ya as r,iL as s,Tn as t,Ea as u,Vc as v,ka as w,nt as x,Ur as y,La as z,Da as A,Ba as B,Oa as C,Va as D,Ua as E,Na as F,Ga as G,qa as H,ja as I,Za as J,Ha as K,$a as L,Wa as M,vx as N,Sx as O,En as P,Ix as Q,Ex as R,Lx as S,zx as T,Rx as U,TD as V,Ole as W,Vle as X,Ule as Y,Nle as Z,Gle as _,qle as $,jle as aa,Zle as ba,Hle as ca,$le as da};