lecodes-cli 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +8 -8
- package/runtime/sdk-types.json +1 -1
- package/runtime/web/VERSION.json +3 -3
- package/runtime/web/assets/{inspect-DdJ50Kun.js → inspect-CE4HRex9.js} +1 -1
- package/runtime/web/assets/keyboardMotion-C2Bk5H0n.js +1 -0
- package/runtime/web/assets/{map-XzoOFt0E.js → map-8PhtP3jn.js} +2 -2
- package/runtime/web/assets/{mapImpl-bxvQ2h1Z.js → mapImpl-DS04r04e.js} +2 -2
- package/runtime/web/index.html +1 -0
- package/runtime/web/keyboard.js +18 -0
- package/runtime/web/player.js +16 -16
- package/runtime/web-lite/lite.js +1 -1
- package/runtime/web-page/page.js +23 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{M as Fp}from"./map-
|
|
1
|
+
import{M as Fp}from"./map-8PhtP3jn.js";import"../player.js";import"./keyboardMotion-C2Bk5H0n.js";/**
|
|
2
2
|
* MapLibre GL JS
|
|
3
3
|
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.11.2/LICENSE.txt
|
|
4
4
|
*/var Ix=Object.create,Bg=Object.defineProperty,Mx=Object.getOwnPropertyDescriptor,zx=Object.getOwnPropertyNames,Fx=Object.getPrototypeOf,Rx=Object.prototype.hasOwnProperty,Vc=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),kx=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=zx(t),n=0,s=a.length,o;n<s;n++)o=a[n],!Rx.call(e,o)&&o!==r&&Bg(e,o,{get:(l=>t[l]).bind(null,o),enumerable:!(i=Mx(t,o))||i.enumerable});return e},Lx=(e,t,r)=>(r=e==null?{}:Ix(Fx(e)),kx(Bg(r,"default",{value:e,enumerable:!0}),e));function M(e,t){this.x=e,this.y=t}M.prototype={clone(){return new M(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),r=Math.sin(e),i=t*this.x-r*this.y,a=r*this.x+t*this.y;return this.x=i,this.y=a,this},_rotateAround(e,t){let r=Math.cos(e),i=Math.sin(e),a=t.x+r*(this.x-t.x)-i*(this.y-t.y),n=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=a,this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:M},M.convert=function(e){if(e instanceof M)return e;if(Array.isArray(e))return new M(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new M(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};function Bx(e,t,r,i){let a=3*e,n=3*(r-e)-a,s=1-a-n,o=3*t,l=3*(i-t)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let d=h;for(let m=0;m<8;m++){let g=((s*d+n)*d+a)*d-h;if(Math.abs(g)<c)return((u*d+l)*d+o)*d;let _=(3*s*d+2*n)*d+a;if(Math.abs(_)<1e-6)break;d-=g/_}let p=0,f=1;d=h;for(let m=0;m<20;m++){let g=((s*d+n)*d+a)*d;if(Math.abs(g-h)<c)break;h>g?p=d:f=d,d=(p+f)*.5}return((u*d+l)*d+o)*d}}let Rp;function Nc(){return Rp??(Rp=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Rp}let js;function Og(){if(js==null&&(js=!1,Nc())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<25;r++){let i=r*4;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(r%5,Math.floor(r/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&t[r]!==r){js=!0;break}}}return js||!1}var _t=typeof Float32Array<"u"?Float32Array:Array;function $g(){var e=new _t(9);return _t!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Ox(e){var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*(u*n-s*l)+r*(-u*a+s*o)+i*(l*a-n*o)}function $x(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function jx(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r+r,o=i+i,l=a+a,u=r*s,h=i*s,c=i*o,d=a*s,p=a*o,f=a*l,m=n*s,g=n*o,_=n*l;return e[0]=1-c-f,e[3]=h-_,e[6]=d+g,e[1]=h+_,e[4]=1-u-f,e[7]=p-m,e[2]=d-g,e[5]=p+m,e[8]=1-u-c,e}function Pi(){var e=new _t(16);return _t!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function ch(e){var t=new _t(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Vx(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Pr(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Bo(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],_=t[15],y=r*o-i*s,v=r*l-a*s,x=r*u-n*s,w=i*l-a*o,b=i*u-n*o,S=a*u-n*l,A=h*m-c*f,P=h*g-d*f,I=h*_-p*f,R=c*g-d*m,F=c*_-p*m,T=d*_-p*g,E=y*T-v*F+x*R+w*I-b*P+S*A;return E?(E=1/E,e[0]=(o*T-l*F+u*R)*E,e[1]=(a*F-i*T-n*R)*E,e[2]=(m*S-g*b+_*w)*E,e[3]=(d*b-c*S-p*w)*E,e[4]=(l*I-s*T-u*P)*E,e[5]=(r*T-a*I+n*P)*E,e[6]=(g*x-f*S-_*v)*E,e[7]=(h*S-d*x+p*v)*E,e[8]=(s*F-o*I+u*A)*E,e[9]=(i*I-r*F-n*A)*E,e[10]=(f*b-m*x+_*y)*E,e[11]=(c*x-h*b-p*y)*E,e[12]=(o*P-s*R-l*A)*E,e[13]=(r*R-i*P+a*A)*E,e[14]=(m*v-f*w-g*y)*E,e[15]=(h*w-c*v+d*y)*E,e):null}function ba(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],v=r[0],x=r[1],w=r[2],b=r[3];return e[0]=v*i+x*o+w*c+b*m,e[1]=v*a+x*l+w*d+b*g,e[2]=v*n+x*u+w*p+b*_,e[3]=v*s+x*h+w*f+b*y,v=r[4],x=r[5],w=r[6],b=r[7],e[4]=v*i+x*o+w*c+b*m,e[5]=v*a+x*l+w*d+b*g,e[6]=v*n+x*u+w*p+b*_,e[7]=v*s+x*h+w*f+b*y,v=r[8],x=r[9],w=r[10],b=r[11],e[8]=v*i+x*o+w*c+b*m,e[9]=v*a+x*l+w*d+b*g,e[10]=v*n+x*u+w*p+b*_,e[11]=v*s+x*h+w*f+b*y,v=r[12],x=r[13],w=r[14],b=r[15],e[12]=v*i+x*o+w*c+b*m,e[13]=v*a+x*l+w*d+b*g,e[14]=v*n+x*u+w*p+b*_,e[15]=v*s+x*h+w*f+b*y,e}function ot(e,t,r){var i=r[0],a=r[1],n=r[2],s,o,l,u,h,c,d,p,f,m,g,_;return t===e?(e[12]=t[0]*i+t[4]*a+t[8]*n+t[12],e[13]=t[1]*i+t[5]*a+t[9]*n+t[13],e[14]=t[2]*i+t[6]*a+t[10]*n+t[14],e[15]=t[3]*i+t[7]*a+t[11]*n+t[15]):(s=t[0],o=t[1],l=t[2],u=t[3],h=t[4],c=t[5],d=t[6],p=t[7],f=t[8],m=t[9],g=t[10],_=t[11],e[0]=s,e[1]=o,e[2]=l,e[3]=u,e[4]=h,e[5]=c,e[6]=d,e[7]=p,e[8]=f,e[9]=m,e[10]=g,e[11]=_,e[12]=s*i+h*a+f*n+t[12],e[13]=o*i+c*a+m*n+t[13],e[14]=l*i+d*a+g*n+t[14],e[15]=u*i+p*a+_*n+t[15]),e}function Et(e,t,r){var i=r[0],a=r[1],n=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Oa(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[4],s=t[5],o=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=n*a+u*i,e[5]=s*a+h*i,e[6]=o*a+c*i,e[7]=l*a+d*i,e[8]=u*a-n*i,e[9]=h*a-s*i,e[10]=c*a-o*i,e[11]=d*a-l*i,e}function jg(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[0],s=t[1],o=t[2],l=t[3],u=t[8],h=t[9],c=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a-u*i,e[1]=s*a-h*i,e[2]=o*a-c*i,e[3]=l*a-d*i,e[8]=n*i+u*a,e[9]=s*i+h*a,e[10]=o*i+c*a,e[11]=l*i+d*a,e}function yi(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[0],s=t[1],o=t[2],l=t[3],u=t[4],h=t[5],c=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a+u*i,e[1]=s*a+h*i,e[2]=o*a+c*i,e[3]=l*a+d*i,e[4]=u*a-n*i,e[5]=h*a-s*i,e[6]=c*a-o*i,e[7]=d*a-l*i,e}function Nx(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ux(e,t,r,i,a){var n=1/Math.tan(t/2);if(e[0]=n/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){var s=1/(i-a);e[10]=(a+i)*s,e[14]=2*a*i*s}else e[10]=-1,e[14]=-2*i;return e}var dh=Ux;function Gx(e,t,r,i,a,n,s){var o=1/(t-r),l=1/(i-a),u=1/(n-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*o,e[13]=(a+i)*l,e[14]=(s+n)*u,e[15]=1,e}var Lr=Gx;function qx(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function Zx(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=t[0],v=t[1],x=t[2],w=t[3],b=t[4],S=t[5],A=t[6],P=t[7],I=t[8],R=t[9],F=t[10],T=t[11],E=t[12],D=t[13],C=t[14],k=t[15];return Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-v)<=1e-6*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(a-x)<=1e-6*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(n-w)<=1e-6*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(o-S)<=1e-6*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(l-A)<=1e-6*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(u-P)<=1e-6*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(h-I)<=1e-6*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(c-R)<=1e-6*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(d-F)<=1e-6*Math.max(1,Math.abs(d),Math.abs(F))&&Math.abs(p-T)<=1e-6*Math.max(1,Math.abs(p),Math.abs(T))&&Math.abs(f-E)<=1e-6*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(m-D)<=1e-6*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(g-C)<=1e-6*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(_-k)<=1e-6*Math.max(1,Math.abs(_),Math.abs(k))}function Vg(){var e=new _t(3);return _t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function ph(e){var t=new _t(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Sr(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function kp(e,t,r){var i=new _t(3);return i[0]=e,i[1]=t,i[2]=r,i}function pr(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Uc(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Ve(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Oo(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e}function Wx(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2];return Math.sqrt(r*r+i*i+a*a)}function Hx(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Bt(e,t){var r=t[0],i=t[1],a=t[2],n=r*r+i*i+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function lt(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ht(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[0],o=r[1],l=r[2];return e[0]=a*l-n*o,e[1]=n*s-i*l,e[2]=i*o-a*s,e}function Xx(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[3]*i+r[7]*a+r[11]*n+r[15];return s||(s=1),e[0]=(r[0]*i+r[4]*a+r[8]*n+r[12])/s,e[1]=(r[1]*i+r[5]*a+r[9]*n+r[13])/s,e[2]=(r[2]*i+r[6]*a+r[10]*n+r[14])/s,e}function Yx(e,t,r){var i=t[0],a=t[1],n=t[2];return e[0]=i*r[0]+a*r[3]+n*r[6],e[1]=i*r[1]+a*r[4]+n*r[7],e[2]=i*r[2]+a*r[5]+n*r[8],e}function wu(e,t,r){var i=r[0],a=r[1],n=r[2],s=r[3],o=t[0],l=t[1],u=t[2],h=a*u-n*l,c=n*o-i*u,d=i*l-a*o;return h+=h,c+=c,d+=d,e[0]=o+s*h+a*d-n*c,e[1]=l+s*c+n*h-i*d,e[2]=u+s*d+i*c-a*h,e}function dn(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[0],n[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),n[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function ga(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),n[1]=a[1],n[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Tu(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),n[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),n[2]=a[2],e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Kx(e){return e[0]=0,e[1]=0,e[2]=0,e}var li=Uc,$o=Sr;(function(){var e=Vg();return function(t,r,i,a,n,s){var o,l;for(r||(r=3),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2];return t}})();function Jx(){var e=new _t(4);return _t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Qx(e,t,r,i){var a=new _t(4);return a[0]=e,a[1]=t,a[2]=r,a[3]=i,a}function ev(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function tv(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function rv(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r*r+i*i+a*a+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=i*s,e[2]=a*s,e[3]=n*s,e}function Pt(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3];return e[0]=r[0]*i+r[4]*a+r[8]*n+r[12]*s,e[1]=r[1]*i+r[5]*a+r[9]*n+r[13]*s,e[2]=r[2]*i+r[6]*a+r[10]*n+r[14]*s,e[3]=r[3]*i+r[7]*a+r[11]*n+r[15]*s,e}var iv=ev;(function(){var e=Jx();return function(t,r,i,a,n,s){var o,l;for(r||(r=4),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],e[3]=t[o+3],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2],t[o+3]=e[3];return t}})();function Lp(){var e=new _t(4);return _t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function av(e,t,r){r*=.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function nv(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=r[0],l=r[1],u=r[2],h=r[3];return e[0]=i*h+s*o+a*u-n*l,e[1]=a*h+s*l+n*o-i*u,e[2]=n*h+s*u+i*l-a*o,e[3]=s*h-i*o-a*l-n*u,e}function To(e,t,r,i){var a=t[0],n=t[1],s=t[2],o=t[3],l=r[0],u=r[1],h=r[2],c=r[3],d,p=a*l+n*u+s*h+o*c,f,m,g;return p<0&&(p=-p,l=-l,u=-u,h=-h,c=-c),1-p>1e-6?(d=Math.acos(p),f=Math.sin(d),m=Math.sin((1-i)*d)/f,g=Math.sin(i*d)/f):(m=1-i,g=i),e[0]=m*a+g*l,e[1]=m*n+g*u,e[2]=m*s+g*h,e[3]=m*o+g*c,e}function sv(e,t){var r=t[0]+t[4]+t[8],i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var a=0;t[4]>t[0]&&(a=1),t[8]>t[a*3+a]&&(a=2);var n=(a+1)%3,s=(a+2)%3;i=Math.sqrt(t[a*3+a]-t[n*3+n]-t[s*3+s]+1),e[a]=.5*i,i=.5/i,e[3]=(t[n*3+s]-t[s*3+n])*i,e[n]=(t[n*3+a]+t[a*3+n])*i,e[s]=(t[s*3+a]+t[a*3+s])*i}return e}function Gc(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",n=Math.PI/360;t*=n,i*=n,r*=n;var s=Math.sin(t),o=Math.cos(t),l=Math.sin(r),u=Math.cos(r),h=Math.sin(i),c=Math.cos(i);switch(a){case"xyz":e[0]=s*u*c+o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c-s*l*h;break;case"xzy":e[0]=s*u*c-o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c+s*l*h;break;case"yxz":e[0]=s*u*c+o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c+s*l*h;break;case"yzx":e[0]=s*u*c+o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c-s*l*h;break;case"zxy":e[0]=s*u*c-o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c-s*l*h;break;case"zyx":e[0]=s*u*c-o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c+s*l*h;break;default:throw Error("Unknown angle order "+a)}return e}var Bp=Qx,Op=rv;(function(){var e=Vg(),t=kp(1,0,0),r=kp(0,1,0);return function(i,a,n){var s=lt(a,n);return s<-.999999?(Ht(e,t,a),$o(e)<1e-6&&Ht(e,r,a),Bt(e,e),av(i,e,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Ht(e,a,n),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+s,Op(i,i))}})(),(function(){var e=Lp(),t=Lp();return function(r,i,a,n,s,o){return To(e,i,s,o),To(t,a,n,o),To(r,e,t,2*o*(1-o)),r}})(),(function(){var e=$g();return function(t,r,i,a){return e[0]=i[0],e[3]=i[1],e[6]=i[2],e[1]=a[0],e[4]=a[1],e[7]=a[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],Op(t,sv(t,e))}})();function fh(){var e=new _t(2);return _t!=Float32Array&&(e[0]=0,e[1]=0),e}function $p(e,t){var r=new _t(2);return r[0]=e,r[1]=t,r}function jp(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function Vp(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function ov(e){var t=e[0],r=e[1];return t*t+r*r}function lv(e,t){return e[0]*t[0]+e[1]*t[1]}function Np(e){return e[0]=0,e[1]=0,e}var uv=ov;(function(){var e=fh();return function(t,r,i,a,n,s){var o,l;for(r||(r=2),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],n(e,e,s),t[o]=e[0],t[o+1]=e[1];return t}})();const L=8192;function nr(e,t,r){return t*(L/(e.tileSize*2**(r-e.tileID.overscaledZ)))}function zt(e){return e instanceof Error?e:Error(typeof e=="string"?e:String(e))}function Li(){return new Float64Array(4)}function Pe(){return new Float64Array(3)}function Bi(){return new Float64Array(16)}function Vs(){let e=new Float64Array(16);return Pr(e),e}function Ng(){let e=new Float32Array(16);return Pr(e),e}function Ti(e,t,r,i,a=!1){if(!r[0]&&!r[1])return[0,0];let n=a?i==="map"?-e.bearingInRadians:0:i==="viewport"?e.bearingInRadians:0;if(n){let s=Math.sin(n),o=Math.cos(n);r=[r[0]*o-r[1]*s,r[0]*s+r[1]*o]}return[a?r[0]:nr(t,r[0],e.zoom),a?r[1]:nr(t,r[1],e.zoom)]}function mh(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function lr(e,t,r){let i=Ox([e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2]]);if(i===0)return null;let a=Ht([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),n=Ht([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),s=Ht([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),o=Ve([],a,-e[3]);return pr(o,o,Ve([],n,-t[3])),pr(o,o,Ve([],s,-r[3])),Ve(o,o,1/i),o}function hv(e,t,r){let i=e[0]*r[0]+e[1]*r[1]+e[2]*r[2],a=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return a===0?null:(-i-r[3])/a}function Ns(e,t,r,i){let a=Math.sqrt(e*e+t*t),n=Math.sqrt(r*r+i*i);e/=a,t/=a,r/=n,i/=n;let s=e*r+t*i,o=Math.acos(s);return-t*r+e*i>0?o:-o}function er(e,t){let r=Xi(e,360),i=Xi(t,360),a=i-r,n=i>r?a-360:a+360;return Math.abs(a)<Math.abs(n)?a:n}function Us(e,t){let r=Xi(e,Math.PI*2),i=Xi(t,Math.PI*2);return Math.min(Math.abs(r-i),Math.abs(r-i+Math.PI*2),Math.abs(r-i-Math.PI*2))}function Xi(e,t){return(e%t+t)%t}function So(e,t,r,i,a){return Ia(i,a,se((e-t)/(r-t),0,1))}function Ia(e,t,r){return e*(1-r)+t*r}function cv(e){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let n of e)t=Math.min(t,n.x),r=Math.min(r,n.y),i=Math.max(i,n.x),a=Math.max(a,n.y);return[t,r,i,a]}function dv(e){if(!e.length)return new Set;let t=Math.max(...e.map(l=>l.canonical.z)),r=1/0,i=-1/0,a=1/0,n=-1/0,s=[];for(let l of e){let{x:u,y:h,z:c}=l.canonical,d=2**(t-c),p=u*d,f=h*d;s.push({id:l,x:p,y:f}),p<r&&(r=p),p>i&&(i=p),f<a&&(a=f),f>n&&(n=f)}let o=new Set;for(let l of s)(l.x===r||l.x===i||l.y===a||l.y===n)&&o.add(l.id);return o}function pv(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function qc(e,t,r,i){return Bx(e,t,r,i)}const gh=qc(.25,.1,.25,1);function se(e,t,r){return Math.min(r,Math.max(t,e))}function fr(e,t,r){let i=r-t,a=((e-t)%i+i)%i+t;return a===t?r:a}function H(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function os(e,t){let r={};for(let i of t)i in e&&(r[i]=e[i]);return r}let fv=1;function Ug(){return fv++}function mv(e){return Math.log(e)/Math.LN2%1==0}function gv(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}function $t(e){return 2**e}function It(e){return Math.log(e)/Math.LN2}function rr(e,t,r){if(t<=0)return e;let i=1/t;return r===void 0||Math.abs(r)<1e-10?Math.round(e*i)/i:(r>0?Math.ceil(e*i-1e-9):Math.floor(e*i+1e-10))/i}function Zc(e,t,r){let i={};for(let a in e)i[a]=t.call(this,e[a],a,e);return i}function Gg(e,t,r){let i={};for(let a in e)t.call(this,e[a],a,e)&&(i[a]=e[a]);return i}function Br(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Br(e[r],t[r]))return!1;return!0}if(typeof e=="object"&&e&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!Br(e[r],t[r]))return!1;return!0}return e===t}function Wt(e){return Array.isArray(e)?e.map(Wt):typeof e=="object"&&e?Zc(e,Wt):e}const Up={};function _e(e){Up[e]||(typeof console<"u"&&console.warn(e),Up[e]=!0)}function xi(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function _v(e,t,r,i){let a=t.y-e.y,n=t.x-e.x,s=i.y-r.y,o=i.x-r.x,l=s*n-o*a;if(l===0)return null;let u=e.y-r.y,h=e.x-r.x,c=(o*u-s*h)/l;return new M(e.x+c*n,e.y+c*a)}function yv([e,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,[e*Math.cos(t)*Math.sin(r),e*Math.sin(t)*Math.sin(r),e*Math.cos(r)]}function $a(e){return typeof WorkerGlobalScope<"u"&&e!==void 0&&e instanceof WorkerGlobalScope}function xv(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,r={};if(e.replace(t,(i,a,n,s)=>{let o=n||s;return r[a]=!o||o.toLowerCase(),""}),r["max-age"]){let i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}let Su=null;function vv(e){if(Su==null){let t=e.navigator?e.navigator.userAgent:null;Su=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Su}function Ni(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}const bv=async(e,t)=>{let r=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(r,t)}catch(i){throw Error(`Could not load image because of ${zt(i).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},wv=e=>new Promise((t,r)=>{let i=new Image;i.onload=()=>{t(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>i.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},i.onerror=()=>r(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 a=new Blob([new Uint8Array(e)],{type:"image/png"});i.src=URL.createObjectURL(a)});function Tv(e,t,r,i,a){let n=Math.max(-t,0)*4,s=(Math.max(0,r)-r)*i*4+n,o=i*4,l=Math.max(0,t),u=Math.max(0,r),h=Math.min(e.width,t+i),c=Math.min(e.height,r+a);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}async function Sv(e,t,r,i,a){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let n=new VideoFrame(e,{timestamp:0});try{let s=n==null?void 0:n.format;if(!s||!(s.startsWith("BGR")||s.startsWith("RGB")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(i*a*4);if(await n.copyTo(l,Tv(e,t,r,i,a)),o)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{n.close()}}function jo(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function Ge(e){return e*Math.PI/180}function $r(e){return e/Math.PI*180}function qg(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function Dv(e){let t=new Float64Array(9);jx(t,e);let r=$r(-Math.asin(se(t[2],-1,1))),i,a;return Math.hypot(t[5],t[8])<.001?(i=0,a=-$r(Math.atan2(t[3],t[4]))):(i=$r(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),a=$r(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:i,pitch:r+90,bearing:a}}function Ev(e,t,r){let i=$p(t.x-r.x,t.y-r.y),a=$p(e.x-r.x,e.y-r.y),n=i[0]*a[1]-i[1]*a[0];return $r(Math.atan2(n,lv(i,a)))}function Gp(e,t,r){let i=new Float64Array(4);return Gc(i,e,t-90,r),i}const Gr=85.051129,Zg={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Wg={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function Pv(e,t){return Zg[t]&&"touches"in e}function Av(e,t){var a,n;if(!Wg[t])return!1;let r=e,i=((n=(a=r==null?void 0:r.target)==null?void 0:a.ownerDocument)==null?void 0:n.defaultView)||window;return r instanceof i.MouseEvent||r instanceof i.WheelEvent}function Cv(e){return Zg[e]||Wg[e]}const qp="AbortError";var ls=class extends Error{constructor(e=qp){super(e instanceof Error?e.message:e),this.name=qp,e instanceof Error&&e.stack&&(this.stack=e.stack)}};function Si(e){return e instanceof Error&&e.name==="AbortError"}function Wc(e){if(e.aborted)throw new ls(e.reason)}const Yi={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Hg(e){return Yi.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const _h="global-dispatcher";var Vo=class extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}};function Hc(){var e;if($a(self))return(e=self.worker)==null?void 0:e.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch{}return window.location.href}const Iv=e=>{var t;return e.startsWith("file:")||((t=Hc())==null?void 0:t.startsWith("file:"))&&!/^\w+:/.test(e)};async function Mv(e,t){let r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Hc(),referrerPolicy:e.referrerPolicy,signal:t.signal});e.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let i;try{i=await fetch(r)}catch(s){throw Si(s)?s:new Vo(0,zt(s).message,e.url,new Blob)}if(!i.ok){let s=await i.blob();throw new Vo(i.status,i.statusText,e.url,s)}let a;a=e.type==="arrayBuffer"||e.type==="image"?i.arrayBuffer():e.type==="json"?i.json():i.text();let n=await a;return Wc(t.signal),{data:n,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}}function zv(e,t){return new Promise((r,i)=>{var n;let a=new XMLHttpRequest;a.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(a.responseType="arraybuffer");for(let s in e.headers)a.setRequestHeader(s,e.headers[s]);e.type==="json"&&(a.responseType="text",(n=e.headers)!=null&&n.Accept||a.setRequestHeader("Accept","application/json")),a.withCredentials=e.credentials==="include",a.onerror=()=>{i(Error(a.statusText))},a.onload=()=>{if(!t.signal.aborted)if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let s=a.response;if(e.type==="json")try{s=JSON.parse(a.response)}catch(o){i(o);return}r({data:s,cacheControl:a.getResponseHeader("Cache-Control"),expires:a.getResponseHeader("Expires"),etag:a.getResponseHeader("ETag")})}else{let s=new Blob([a.response],{type:a.getResponseHeader("Content-Type")});i(new Vo(a.status,a.statusText,e.url,s))}},t.signal.addEventListener("abort",()=>{a.abort(),i(new ls(t.signal.reason))}),a.send(e.body)})}const yl=async function(e,t){var r,i;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let a=Hg(e.url);if(a){let n=await a(e,t);return!n.data&&e.type==="arrayBuffer"?H(n,{data:new ArrayBuffer(0)}):n}if($a(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:_h},t)}if(!Iv(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return Mv(e,t);if($a(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:_h},t)}return zv(e,t)},xl=(e,t)=>yl(H(e,{type:"json"}),t),Xg=(e,t)=>yl(H(e,{type:"arrayBuffer"}),t);function Yg(e){if(!e||e.startsWith("data:image/"))return!0;if(e.startsWith("blob:")&&(e=e.slice(5),e.startsWith("null")))return!1;if(e.indexOf("://")<=0)return!0;let t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}const Fv=e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(let i of e){let a=window.document.createElement("source");Yg(i)||(t.crossOrigin="Anonymous"),a.src=i,t.appendChild(a)}})};function Zp(e,t,r){var i;(i=r[e])!=null&&i.includes(t)||(r[e]||(r[e]=[]),r[e].push(t))}function Du(e,t,r){if(r!=null&&r[e]){let i=r[e].indexOf(t);i!==-1&&r[e].splice(i,1)}}var us=class{constructor(e,t={}){H(this,t),this.type=e}},Y=class extends us{constructor(e,t={}){super("error",H({error:e},t))}},kt=class{on(e,t){return this._listeners||(this._listeners={}),Zp(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Du(e,t,this._listeners),Du(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||(this._oneTimeListeners={}),Zp(e,t,this._oneTimeListeners),this):new Promise(r=>this.once(e,r))}fire(e,t){var a,n,s,o;let r=typeof e=="string"?new us(e,t||{}):e,i=r.type;if(this.listens(i)){r.target=this;let l=((n=(a=this._listeners)==null?void 0:a[i])==null?void 0:n.slice())??[];for(let c of l)c.call(this,r);let u=((o=(s=this._oneTimeListeners)==null?void 0:s[i])==null?void 0:o.slice())??[];for(let c of u)Du(i,c,this._oneTimeListeners),c.call(this,r);let h=this._eventedParent;h&&(H(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(r))}else r instanceof Y&&console.error(r.error);return this}listens(e){var t,r,i,a,n;return!!((r=(t=this._listeners)==null?void 0:t[e])!=null&&r.length||(a=(i=this._oneTimeListeners)==null?void 0:i[e])!=null&&a.length||(n=this._eventedParent)!=null&&n.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},Kg={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{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:"*"}},source_raster_dem:{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:"*"}},source_geojson:{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:"filter"},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"}},source_video:{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"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"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","feature"]},"property-type":"data-driven"},"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"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{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}},sky:{"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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,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"}},"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,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default: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:{"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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"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","feature"]},"property-type":"cross-faded-data-driven"},"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"}},paint_circle:{"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"}},paint_heatmap:{"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"}},paint_symbol:{"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"}},paint_raster:{"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"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"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"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:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const z=Kg,Rv=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var O=class{constructor(e,t,r,i,a="error"){this.message=(e?`${e}: `:"")+r,i&&(this.identifier=i),this.severity=a,t!=null&&t.__line__&&(this.line=t.__line__)}};const hs={kind:"null"},V={kind:"number"},le={kind:"string"},fe={kind:"boolean"},Dr={kind:"color"},vl={kind:"projectionDefinition"},Ui={kind:"object"},ue={kind:"value"},kv={kind:"error"},bl={kind:"collator"},cs={kind:"formatted"},wl={kind:"padding"},Nn={kind:"colorArray"},Tl={kind:"numberArray"},ds={kind:"resolvedImage"},Sl={kind:"variableAnchorOffsetCollection"};function Rt(e,t){return{kind:"array",itemType:e,N:t}}function Ke(e){if(e.kind==="array"){let t=Ke(e.itemType);return typeof e.N=="number"?`array<${t}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t}>`}return e.kind}const Lv=[hs,V,le,fe,Dr,vl,cs,Ui,Rt(ue),wl,Tl,Nn,ds,Sl];function Un(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Un(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let r of Lv)if(!Un(r,t))return null}}return`Expected ${Ke(e)} but found ${Ke(t)} instead.`}function Xc(e,t){return t.some(r=>r.kind===e.kind)}function Gi(e,t){return t.some(r=>r==="null"?e===null:r==="array"?Array.isArray(e):r==="object"?e&&!Array.isArray(e)&&typeof e=="object":r===typeof e)}function fi(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}const Jg=.96422,Qg=.82521,e_=4/29,yh=6/29,t_=3*yh*yh,Bv=Math.PI/180,Ov=180/Math.PI;function r_(e){return e%=360,e<0&&(e+=360),e}function i_([e,t,r,i]){e=Eu(e),t=Eu(t),r=Eu(r);let a,n,s=Pu((.2225045*e+.7168786*t+.0606169*r)/1);e===t&&t===r?a=n=s:(a=Pu((.4360747*e+.3850649*t+.1430804*r)/Jg),n=Pu((.0139322*e+.0971045*t+.7141733*r)/Qg));let o=116*s-16;return[o<0?0:o,500*(a-s),200*(s-n),i]}function Eu(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Pu(e){return e>.008856451679035631?e**(1/3):e/t_+e_}function a_([e,t,r,i]){let a=(e+16)/116,n=isNaN(t)?a:a+t/500,s=isNaN(r)?a:a-r/200;return a=1*Cu(a),n=Jg*Cu(n),s=Qg*Cu(s),[Au(3.1338561*n-1.6168667*a-.4906146*s),Au(-.9787684*n+1.9161415*a+.033454*s),Au(.0719453*n-.2289914*a+1.4052427*s),i]}function Au(e){return e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055,e<0?0:e>1?1:e}function Cu(e){return e>yh?e*e*e:t_*(e-e_)}function $v(e){let[t,r,i,a]=i_(e),n=Math.sqrt(r*r+i*i);return[Math.round(n*1e4)?r_(Math.atan2(i,r)*Ov):NaN,n,t,a]}function jv([e,t,r,i]){return e=isNaN(e)?0:e*Bv,a_([r,Math.cos(e)*t,Math.sin(e)*t,i])}function Vv([e,t,r,i]){e=r_(e),t/=100,r/=100;function a(n){let s=(n+e/30)%12,o=t*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[a(0),a(8),a(4),i]}const Nv=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Fn(e,t){return Nv(e,t)?e[t]:void 0}function Uv(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Fn(Gv,e);if(t){let[i,a,n]=t;return[i/255,a/255,n/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let i=e.length<6?1:2,a=1;return[Gs(e.slice(a,a+=i)),Gs(e.slice(a,a+=i)),Gs(e.slice(a,a+=i)),Gs(e.slice(a,a+i)||"ff")]}if(e.startsWith("rgb")){let i=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[a,n,s,o,l,u,h,c,d,p,f,m]=i,g=[o||" ",h||" ",p].join("");if(g===" "||g===" /"||g===",,"||g===",,,"){let _=[s,u,d].join(""),y=_==="%%%"?100:_===""?255:0;if(y){let v=[wa(+n/y,0,1),wa(+l/y,0,1),wa(+c/y,0,1),f?Wp(+f,m):1];if(Hp(v))return v}}return}}let r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[i,a,n,s,o,l,u,h,c]=r,d=[n||" ",o||" ",u].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){let p=[+a,wa(+s,0,100),wa(+l,0,100),h?Wp(+h,c):1];if(Hp(p))return Vv(p)}}}function Gs(e){return parseInt(e.padEnd(2,e),16)/255}function Wp(e,t){return wa(t?e/100:e,0,1)}function wa(e,t,r){return Math.min(Math.max(t,e),r)}function Hp(e){return!e.some(Number.isNaN)}const Gv={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function bi(e,t,r){return e+r*(t-e)}function ja(e,t,r){return e.map((i,a)=>bi(i,t[a],r))}function qv(e){return e==="rgb"||e==="hcl"||e==="lab"}var vt,oe=(vt=class{constructor(t,r,i,a=1,n=!0){this.r=t,this.g=r,this.b=i,this.a=a,n||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t,r,i,a]))}static parse(t){if(t instanceof vt)return t;if(typeof t!="string")return;let r=Uv(t);if(r)return new vt(...r,!1)}get rgb(){let{r:t,g:r,b:i,a}=this,n=a||1/0;return this.overwriteGetter("rgb",[t/n,r/n,i/n,a])}get hcl(){return this.overwriteGetter("hcl",$v(this.rgb))}get lab(){return this.overwriteGetter("lab",i_(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,i,a]=this.rgb;return`rgba(${[t,r,i].map(n=>Math.round(n*255)).join(",")},${a})`}static interpolate(t,r,i,a="rgb"){switch(a){case"rgb":{let[n,s,o,l]=ja(t.rgb,r.rgb,i);return new vt(n,s,o,l,!1)}case"hcl":{let[n,s,o,l]=t.hcl,[u,h,c,d]=r.hcl,p,f;if(!isNaN(n)&&!isNaN(u)){let v=u-n;u>n&&v>180?v-=360:u<n&&n-u>180&&(v+=360),p=n+i*v}else isNaN(n)?isNaN(u)?p=NaN:(p=u,(o===1||o===0)&&(f=h)):(p=n,(c===1||c===0)&&(f=s));let[m,g,_,y]=jv([p,f??bi(s,h,i),bi(o,c,i),bi(l,d,i)]);return new vt(m,g,_,y,!1)}case"lab":{let[n,s,o,l]=a_(ja(t.lab,r.lab,i));return new vt(n,s,o,l,!1)}}}},vt.black=new vt(0,0,0,1),vt.white=new vt(1,1,1,1),vt.transparent=new vt(0,0,0,0),vt.red=new vt(1,0,0,1),vt);const Zv=["bottom","center","top"];var xh=class{constructor(t,r,i,a,n,s){this.text=t,this.image=r,this.scale=i,this.fontStack=a,this.textColor=n,this.verticalAlign=s}},ui=class Do{constructor(t){this.sections=t}static fromString(t){return new Do([new xh(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Do?t:Do.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},Hr=class En{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof En)return t;if(typeof t=="number")return new En([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new En(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new En(ja(t.values,r.values,i))}},Xr=class Pn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Pn)return t;if(typeof t=="number")return new Pn([t]);if(Array.isArray(t)){for(let r of t)if(typeof r!="number")return;return new Pn(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new Pn(ja(t.values,r.values,i))}},gr=class An{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof An)return t;if(typeof t=="string"){let i=oe.parse(t);return i?new An([i]):void 0}if(!Array.isArray(t))return;let r=[];for(let i of t){if(typeof i!="string")return;let a=oe.parse(i);if(!a)return;r.push(a)}return new An(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,a="rgb"){let n=[];if(t.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)n.push(oe.interpolate(t.values[s],r.values[s],i,a));return new An(n)}},qe=class extends Error{constructor(e,t){super(e),this.name="RuntimeError",this.path=t}toJSON(){return this.message}};const Wv=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var qr=class Eo{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Eo)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!=0)){for(let r=0;r<t.length;r+=2){let i=t[r],a=t[r+1];if(typeof i!="string"||!Wv.has(i)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new Eo(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,a){let n=t.values,s=r.values;if(n.length!==s.length)throw new qe(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`,a);let o=[];for(let l=0;l<n.length;l+=2){if(n[l]!==s[l])throw new qe(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${n[l]}, to[${l}]: ${s[l]}`,a);o.push(n[l]);let[u,h]=n[l+1],[c,d]=s[l+1];o.push([bi(u,c,i),bi(h,d,i)])}return new Eo(o)}},Zr=class n_{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new n_({name:t,available:!1}):null}},Ai=class Ta{constructor(t,r,i){this.from=t,this.to=r,this.transition=i}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(t,r,i){return new Ta(t,r,i)}static parse(t){if(t instanceof Ta)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new Ta(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new Ta(t.from,t.to,t.transition);if(typeof t=="string")return new Ta(t,t,1)}},Yc=class{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,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}};function s_(e,t,r,i){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?i===void 0||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Va(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Ai||e instanceof oe||e instanceof Yc||e instanceof ui||e instanceof Hr||e instanceof Xr||e instanceof gr||e instanceof qr||e instanceof Zr)return!0;if(Array.isArray(e)){for(let t of e)if(!Va(t))return!1;return!0}if(typeof e=="object"){for(let t in e)if(!Va(e[t]))return!1;return!0}return!1}function it(e){if(e===null)return hs;if(typeof e=="string")return le;if(typeof e=="boolean")return fe;if(typeof e=="number")return V;if(e instanceof oe)return Dr;if(e instanceof Ai)return vl;if(e instanceof Yc)return bl;if(e instanceof ui)return cs;if(e instanceof Hr)return wl;if(e instanceof Xr)return Tl;if(e instanceof gr)return Nn;if(e instanceof qr)return Sl;if(e instanceof Zr)return ds;if(Array.isArray(e)){let t=e.length,r;for(let i of e){let a=it(i);if(!r)r=a;else{if(r===a)continue;r=ue;break}}return Rt(r||ue,t)}return Ui}function Rn(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof oe||e instanceof Ai||e instanceof ui||e instanceof Hr||e instanceof Xr||e instanceof gr||e instanceof qr||e instanceof Zr?e.toString():JSON.stringify(e)}var Na=class o_{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Va(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let i=t[1],a=it(i),n=r.expectedType;return a.kind==="array"&&a.N===0&&n&&n.kind==="array"&&(typeof n.N!="number"||n.N===0)&&(a=n),new o_(a,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const Hv=["Unknown","Point","LineString","Polygon"];var l_=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Hv[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(t){let r=this._parseColorCache.get(t);return r||(r=oe.parse(t),this._parseColorCache.set(t,r)),r}};function Dl(e,t,r){let i=e.length-1,a=0,n=i,s=0,o,l;for(;a<=n;)if(s=Math.floor((a+n)/2),o=e[s],l=e[s+1],o<=t){if(s===i||t<l)return s;a=s+1}else if(o>t)n=s-1;else throw new qe("Input is not a number.",r);return 0}var Kc=class u_{constructor(t,r,i,a){this.type=t,this.input=r,this.key=a,this.labels=[],this.outputs=[];for(let[n,s]of i)this.labels.push(n),this.outputs.push(s)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let i=r.parse(t[1],1,V);if(!i)return null;let a=[],n=null;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);for(let s=1;s<t.length;s+=2){let o=s===1?-1/0:t[s],l=t[s+1],u=s,h=s+1;if(typeof o!="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(a.length&&a[a.length-1][0]>=o)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let c=r.parse(l,h,n);if(!c)return null;n||(n=c.type),a.push([o,c])}return new u_(n,i,a,r.key)}evaluate(t){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(t);let a=this.input.evaluate(t);if(a<=r[0])return i[0].evaluate(t);let n=r.length;return a>=r[n-1]?i[n-1].evaluate(t):i[Dl(r,a,this.key)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Xv(e,t,r,i){let a=3*e,n=3*(r-e)-a,s=1-a-n,o=3*t,l=3*(i-t)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let d=h;for(let m=0;m<8;m++){let g=((s*d+n)*d+a)*d-h;if(Math.abs(g)<c)return((u*d+l)*d+o)*d;let _=(3*s*d+2*n)*d+a;if(Math.abs(_)<1e-6)break;d-=g/_}let p=0,f=1;d=h;for(let m=0;m<20;m++){let g=((s*d+n)*d+a)*d;if(Math.abs(g-h)<c)break;h>g?p=d:f=d,d=(p+f)*.5}return((u*d+l)*d+o)*d}}var _r=class vh{constructor(t,r,i,a,n,s){this.type=t,this.operator=r,this.interpolation=i,this.input=a,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of n)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(t,r,i,a){let n=0;if(t.name==="exponential")n=Iu(r,t.base,i,a);else if(t.name==="linear")n=Iu(r,1,i,a);else if(t.name==="cubic-bezier"){let s=t.controlPoints;n=Xv(s[0],s[1],s[2],s[3])(Iu(r,1,i,a))}return n}static parse(t,r){let[i,a,n,...s]=t;if(!Array.isArray(a)||a.length===0)return r.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){let u=a[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:u}}else if(a[0]==="cubic-bezier"){let u=a.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(a[0])}`,1,0);if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(n=r.parse(n,2,V),!n)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Nn?l=Dr:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<s.length;u+=2){let h=s[u],c=s[u+1],d=u+3,p=u+4;if(typeof h!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(o.length&&o[o.length-1][0]>=h)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);let f=r.parse(c,p,l);if(!f)return null;l||(l=f.type),o.push([h,f])}return!fi(l,V)&&!fi(l,vl)&&!fi(l,Dr)&&!fi(l,wl)&&!fi(l,Tl)&&!fi(l,Nn)&&!fi(l,Sl)&&!fi(l,Rt(V))?r.error(`Type ${Ke(l)} is not interpolatable.`):new vh(l,i,a,n,o,r.key)}evaluate(t){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(t);let a=this.input.evaluate(t);if(a<=r[0])return i[0].evaluate(t);let n=r.length;if(a>=r[n-1])return i[n-1].evaluate(t);let s=Dl(r,a,this.key),o=r[s],l=r[s+1],u=vh.interpolationFactor(this.interpolation,a,o,l),h=i[s].evaluate(t),c=i[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return bi(h,c,u);case"color":return oe.interpolate(h,c,u);case"padding":return Hr.interpolate(h,c,u);case"colorArray":return gr.interpolate(h,c,u);case"numberArray":return Xr.interpolate(h,c,u);case"variableAnchorOffsetCollection":return qr.interpolate(h,c,u,this.key);case"array":return ja(h,c,u);case"projectionDefinition":return Ai.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return oe.interpolate(h,c,u,"hcl");case"colorArray":return gr.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return oe.interpolate(h,c,u,"lab");case"colorArray":return gr.interpolate(h,c,u,"lab")}}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Iu(e,t,r,i){let a=i-r,n=e-r;return a===0?0:t===1?n/a:(t**+n-1)/(t**+a-1)}const We={color:oe.interpolate,number:bi,padding:Hr.interpolate,numberArray:Xr.interpolate,colorArray:gr.interpolate,variableAnchorOffsetCollection:qr.interpolate,array:ja};var h_=class c_{constructor(t){this.type=cs,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=t[1];if(!Array.isArray(i)&&typeof i=="object")return r.error("First argument must be an image or text section.");let a=[],n=!1;for(let s=1;s<=t.length-1;++s){let o=t[s];if(n&&typeof o=="object"&&!Array.isArray(o)){n=!1;let l=null;if(o["font-scale"]&&(l=r.parse(o["font-scale"],1,V),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,Rt(le)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,Dr),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!Zv.includes(o["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(c=r.parse(o["vertical-align"],1,le),!c)return null}let d=a[a.length-1];d.scale=l,d.font=u,d.textColor=h,d.verticalAlign=c}else{let l=r.parse(t[s],1,ue);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'.");n=!0,a.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new c_(a)}evaluate(t){return new ui(this.sections.map(r=>{let i=r.content.evaluate(t);return it(i)===ds?new xh("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new xh(Rn(i),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}};function d_(e,t,r=0,i=e.length-1,a=Yv){for(;i>r;){if(i-r>600){let l=i-r+1,u=t-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);d_(e,t,Math.max(r,Math.floor(t-u*c/l+d)),Math.min(i,Math.floor(t+(l-u)*c/l+d)),a)}let n=e[t],s=r,o=i;for(pn(e,r,t),a(e[i],n)>0&&pn(e,r,i);s<o;){for(pn(e,s,o),s++,o--;a(e[s],n)<0;)s++;for(;a(e[o],n)>0;)o--}a(e[r],n)===0?pn(e,r,o):(o++,pn(e,o,i)),o<=t&&(r=o+1),t<=o&&(i=o-1)}}function pn(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function Yv(e,t){return e<t?-1:+(e>t)}function El(e,t){if(e.length<=1)return[e];let r=[],i,a;for(let n of e){let s=Jv(n);s!==0&&(n.area=Math.abs(s),a===void 0&&(a=s<0),a===s<0?(i&&r.push(i),i=[n]):i.push(n))}if(i&&r.push(i),t>1)for(let n=0;n<r.length;n++)r[n].length<=t||(d_(r[n],t,1,r[n].length-1,Kv),r[n]=r[n].slice(0,t));return r}function Kv(e,t){return t.area-e.area}function Jv(e){let t=0;for(let r=0,i=e.length,a=i-1,n,s;r<i;a=r++)n=e[r],s=e[a],t+=(s.x-n.x)*(n.y+s.y);return t}const qs={string:le,number:V,boolean:fe,object:Ui};var ti=class p_{constructor(t,r,i){this.type=t,this.args=r,this.key=i}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=1,a,n=t[0];if(n==="array"){let o;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in qs)||u==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=qs[u],i++}else o=ue;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);l=t[2],i++}a=Rt(o,l)}else{if(!qs[n])throw Error(`Types doesn't contain name = ${n}`);a=qs[n]}let s=[];for(;i<t.length;i++){let o=r.parse(t[i],i,ue);if(!o)return null;s.push(o)}return new p_(a,s,r.key)}evaluate(t){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(t);if(!Un(this.type,it(i)))return i;if(r===this.args.length-1)throw new qe(`Expected value to be of type ${Ke(this.type)}, but found ${Ke(it(i))} instead.`,this.key)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};const Xp={"to-boolean":fe,"to-color":Dr,"to-number":V,"to-string":le};var Pa=class f_{constructor(t,r,i){this.type=t,this.args=r,this.key=i}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=t[0];if(!Xp[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&t.length!==2)return r.error("Expected one argument.");let a=Xp[i],n=[];for(let s=1;s<t.length;s++){let o=r.parse(t[s],s,ue);if(!o)return null;n.push(o)}return new f_(a,n,r.key)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,i;for(let a of this.args){if(r=a.evaluate(t),i=null,r instanceof oe)return r;if(typeof r=="string"){let n=t.parseColor(r);if(n)return n}else if(Array.isArray(r)&&(i=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:s_(r[0],r[1],r[2],r[3]),!i))return new oe(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new qe(i||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"padding":{let r;for(let i of this.args){r=i.evaluate(t);let a=Hr.parse(r);if(a)return a}throw new qe(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"numberArray":{let r;for(let i of this.args){r=i.evaluate(t);let a=Xr.parse(r);if(a)return a}throw new qe(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"colorArray":{let r;for(let i of this.args){r=i.evaluate(t);let a=gr.parse(r);if(a)return a}throw new qe(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"variableAnchorOffsetCollection":{let r;for(let i of this.args){r=i.evaluate(t);let a=qr.parse(r);if(a)return a}throw new qe(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}case"number":{let r=null;for(let i of this.args){if(r=i.evaluate(t),r===null)return 0;let a=Number(r);if(!isNaN(a))return a}throw new qe(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return ui.fromString(Rn(this.args[0].evaluate(t)));case"resolvedImage":return Zr.fromString(Rn(this.args[0].evaluate(t)));case"projectionDefinition":{let r=this.args[0].evaluate(t);if(Ai.parse(r))return r;throw new qe(`Could not parse projectionDefinition from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}default:return Rn(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},m_=class g_{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let i=[];for(let n=1;n<t.length-1;n+=2){let s=t[n];if(typeof s!="string")return r.error(`Expected string, but found ${typeof s} instead.`,n);if(/[^a-zA-Z0-9_]/.test(s))return r.error("Variable names must contain only alphanumeric characters or '_'.",n);let o=r.parse(t[n+1],n+1);if(!o)return null;i.push([s,o])}let a=r.parse(t[t.length-1],t.length-1,r.expectedType,i);return a?new g_(i,a):null}outputDefined(){return this.result.outputDefined()}},__=class y_{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");let i=t[1];return r.scope.has(i)?new y_(i,r.scope.get(i)):r.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},Qv=class x_{constructor(t,r,i,a){this.type=t,this.index=r,this.input=i,this.key=a}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,V),a=r.parse(t[2],2,Rt(r.expectedType||ue));if(!i||!a)return null;let n=a.type;return new x_(n.itemType,i,a,r.key)}evaluate(t){let r=this.index.evaluate(t),i=this.input.evaluate(t);if(r<0)throw new qe(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new qe(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new qe(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},eb=class v_{constructor(t,r,i){this.needle=t,this.haystack=r,this.key=i,this.type=fe}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,ue),a=r.parse(t[2],2,ue);return!i||!a?null:Xc(i.type,[fe,le,V,hs,ue])?new v_(i,a,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ke(i.type)} instead`)}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Gi(r,["boolean","string","number","null"]))throw new qe(`Expected first argument to be of type boolean, string, number or null, but found ${Ke(it(r))} instead.`,this.key);if(!Gi(i,["string","array"]))throw new qe(`Expected second argument to be of type array or string, but found ${Ke(it(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},tb=class bh{constructor(t,r,i,a){this.needle=t,this.haystack=r,this.key=i,this.fromIndex=a,this.type=V}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,ue),a=r.parse(t[2],2,ue);if(!i||!a)return null;if(!Xc(i.type,[fe,le,V,hs,ue]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ke(i.type)} instead`);if(t.length===4){let n=r.parse(t[3],3,V);return n?new bh(i,a,r.key,n):null}return new bh(i,a,r.key)}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Gi(r,["boolean","string","number","null"]))throw new qe(`Expected first argument to be of type boolean, string, number or null, but found ${Ke(it(r))} instead.`,this.key);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(t)),Gi(i,["string"])){let n=i.indexOf(r,a);return n===-1?-1:[...i.slice(0,n)].length}if(Gi(i,["array"]))return i.indexOf(r,a);throw new qe(`Expected second argument to be of type array or string, but found ${Ke(it(i))} instead.`,this.key)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},rb=class b_{constructor(t,r,i,a,n,s){this.inputType=t,this.type=r,this.input=i,this.cases=a,this.outputs=n,this.otherwise=s}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let i,a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);let n={},s=[];for(let u=2;u<t.length-1;u+=2){let h=t[u],c=t[u+1];Array.isArray(h)||(h=[h]);let d=r.concat(u);if(h.length===0)return d.error("Expected at least one branch label.");for(let f of h){if(typeof f!="number"&&typeof f!="string")return d.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>2**53-1)return d.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof f=="number"&&Math.floor(f)!==f)return d.error("Numeric branch labels must be integer values.");if(!i)i=it(f);else if(d.checkSubtype(i,it(f)))return null;if(n[String(f)]!==void 0)return d.error("Branch labels must be unique.");n[String(f)]=s.length}let p=r.parse(c,u,a);if(!p)return null;a||(a=p.type),s.push(p)}let o=r.parse(t[1],1,ue);if(!o)return null;let l=r.parse(t[t.length-1],t.length-1,a);return!l||o.type.kind!=="value"&&r.concat(1).checkSubtype(i,o.type)?null:new b_(i,a,o,n,s,l)}evaluate(t){let r=this.input.evaluate(t);return(it(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},ib=class w_{constructor(t,r,i){this.type=t,this.branches=r,this.otherwise=i}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let a=[];for(let s=1;s<t.length-1;s+=2){let o=r.parse(t[s],s,fe);if(!o)return null;let l=r.parse(t[s+1],s+1,i);if(!l)return null;a.push([o,l]),i||(i=l.type)}let n=r.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw Error("Can't infer output type");return new w_(i,a,n)}evaluate(t){for(let[r,i]of this.branches)if(r.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,i]of this.branches)t(r),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},ab=class wh{constructor(t,r,i,a,n){this.type=t,this.input=r,this.beginIndex=i,this.key=a,this.endIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,ue),a=r.parse(t[2],2,V);if(!i||!a)return null;if(!Xc(i.type,[Rt(ue),le,ue]))return r.error(`Expected first argument to be of type array or string, but found ${Ke(i.type)} instead`);if(t.length===4){let n=r.parse(t[3],3,V);return n?new wh(i.type,i,a,r.key,n):null}return new wh(i.type,i,a,r.key)}evaluate(t){let r=this.input.evaluate(t),i=this.beginIndex.evaluate(t),a;if(this.endIndex&&(a=this.endIndex.evaluate(t)),Gi(r,["string"]))return[...r].slice(i,a).join("");if(Gi(r,["array"]))return r.slice(i,a);throw new qe(`Expected first argument to be of type array or string, but found ${Ke(it(r))} instead.`,this.key)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},T_=class Th{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=null,a=r.expectedType;a&&a.kind!=="value"&&(i=a);let n=[];for(let s of t.slice(1)){let o=r.parse(s,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!o)return null;i||(i=o.type),n.push(o)}if(!i)throw Error("No output type");return a&&n.some(s=>Un(a,s.type))?new Th(ue,n):new Th(i,n)}evaluate(t){let r=null,i=0,a;for(let n of this.args)if(i++,r=n.evaluate(t),r&&r instanceof Zr&&!r.available&&(a||(a=r.name),r=null,i===this.args.length&&(r=a)),r!==null)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function Yp(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function nb(e,t,r){return t===r}function sb(e,t,r){return t!==r}function ob(e,t,r){return t<r}function lb(e,t,r){return t>r}function ub(e,t,r){return t<=r}function hb(e,t,r){return t>=r}function S_(e,t,r,i){return i.compare(t,r)===0}function cb(e,t,r,i){return!S_(e,t,r,i)}function db(e,t,r,i){return i.compare(t,r)<0}function pb(e,t,r,i){return i.compare(t,r)>0}function fb(e,t,r,i){return i.compare(t,r)<=0}function mb(e,t,r,i){return i.compare(t,r)>=0}function Ya(e,t,r){let i=e!=="=="&&e!=="!=";return class D_{constructor(n,s,o,l){this.lhs=n,this.rhs=s,this.key=o,this.collator=l,this.type=fe,this.hasUntypedArgument=n.type.kind==="value"||s.type.kind==="value"}static parse(n,s){if(n.length!==3&&n.length!==4)return s.error("Expected two or three arguments.");let o=n[0],l=s.parse(n[1],1,ue);if(!l)return null;if(!Yp(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type '${Ke(l.type)}'.`);let u=s.parse(n[2],2,ue);if(!u)return null;if(!Yp(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type '${Ke(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types '${Ke(l.type)}' and '${Ke(u.type)}'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new ti(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new ti(l.type,[u],s.key)));let h=null;if(n.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(h=s.parse(n[3],3,bl),!h)return null}return new D_(l,u,s.key,h)}evaluate(n){let s=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(i&&this.hasUntypedArgument){let l=it(s),u=it(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new qe(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=it(s),u=it(o);if(l.kind!=="string"||u.kind!=="string")return t(n,s,o)}return this.collator?r(n,s,o,this.collator.evaluate(n)):t(n,s,o)}eachChild(n){n(this.lhs),n(this.rhs),this.collator&&n(this.collator)}outputDefined(){return!0}}}const gb=Ya("==",nb,S_),_b=Ya("!=",sb,cb),yb=Ya("<",ob,db),xb=Ya(">",lb,pb),vb=Ya("<=",ub,fb),bb=Ya(">=",hb,mb);var E_=class P_{constructor(t,r,i){this.type=bl,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let i=t[1];if(typeof i!="object"||Array.isArray(i))return r.error("Collator options argument must be an object.");let a=r.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,fe);if(!a)return null;let n=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,fe);if(!n)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,le),!s)?null:new P_(a,n,s)}evaluate(t){return new Yc(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},wb=class A_{constructor(t,r,i,a,n,s){this.type=le,this.number=t,this.locale=r,this.currency=i,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=s}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let i=r.parse(t[1],1,V);if(!i)return null;let a=t[2];if(typeof a!="object"||Array.isArray(a))return r.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&(n=r.parse(a.locale,1,le),!n))return null;let s=null;if(a.currency&&(s=r.parse(a.currency,1,le),!s))return null;let o=null;if(a.unit&&(o=r.parse(a.unit,1,le),!o))return null;if(s&&o)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(a["min-fraction-digits"]&&(l=r.parse(a["min-fraction-digits"],1,V),!l))return null;let u=null;return a["max-fraction-digits"]&&(u=r.parse(a["max-fraction-digits"],1,V),!u)?null:new A_(i,n,s,o,l,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},Tb=class C_{constructor(t){this.type=ds,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let i=r.parse(t[1],1,le);return i?new C_(i):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),i=Zr.fromString(r);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(r)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}},Sb=class I_{constructor(t,r){this.input=t,this.key=r,this.type=V}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=r.parse(t[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Ke(i.type)} instead.`):new I_(i,r.key):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new qe(`Expected value to be of type string or array, but found ${Ke(it(r))} instead.`,this.key)}eachChild(t){t(this.input)}outputDefined(){return!1}};const Nr=8192;function Db(e,t){let r=Eb(e[0]),i=Ab(e[1]),a=2**t.z;return[Math.round(r*a*Nr),Math.round(i*a*Nr)]}function Jc(e,t){let r=2**t.z,i=(e[0]/Nr+t.x)/r,a=(e[1]/Nr+t.y)/r;return[Pb(i),Cb(a)]}function Eb(e){return(180+e)/360}function Pb(e){return e*360-180}function Ab(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Cb(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function ps(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Gn(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Ib(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Mb(e,t,r){let i=e[0]-t[0],a=e[1]-t[1],n=e[0]-r[0],s=e[1]-r[1];return i*s-n*a===0&&i*n<=0&&a*s<=0}function Pl(e,t,r,i){let a=[t[0]-e[0],t[1]-e[1]];return kb([i[0]-r[0],i[1]-r[1]],a)!==0&&!!(Kp(e,t,r,i)&&Kp(r,i,e,t))}function zb(e,t,r){for(let i of r)for(let a=0;a<i.length-1;++a)if(Pl(e,t,i[a],i[a+1]))return!0;return!1}function Ka(e,t,r=!1){let i=!1;for(let a of t)for(let n=0;n<a.length-1;n++){if(Mb(e,a[n],a[n+1]))return r;Ib(e,a[n],a[n+1])&&(i=!i)}return i}function Fb(e,t){for(let r of t)if(Ka(e,r))return!0;return!1}function M_(e,t){for(let r of e)if(!Ka(r,t))return!1;for(let r=0;r<e.length-1;++r)if(zb(e[r],e[r+1],t))return!1;return!0}function Rb(e,t){for(let r of t)if(M_(e,r))return!0;return!1}function kb(e,t){return e[0]*t[1]-e[1]*t[0]}function Kp(e,t,r,i){let a=e[0]-r[0],n=e[1]-r[1],s=t[0]-r[0],o=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],h=a*u-l*n,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function Qc(e,t,r){let i=[];for(let a=0;a<e.length;a++){let n=[];for(let s=0;s<e[a].length;s++){let o=Db(e[a][s],r);ps(t,o),n.push(o)}i.push(n)}return i}function z_(e,t,r){let i=[];for(let a=0;a<e.length;a++){let n=Qc(e[a],t,r);i.push(n)}return i}function F_(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let a=i*.5,n=e[0]-r[0]>a?-i:r[0]-e[0]>a?i:0;n===0&&(n=e[0]-r[2]>a?-i:r[2]-e[0]>a?i:0),e[0]+=n}ps(t,e)}function Lb(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function Jp(e,t,r,i){let a=2**i.z*Nr,n=[i.x*Nr,i.y*Nr],s=[];for(let o of e)for(let l of o){let u=[l.x+n[0],l.y+n[1]];F_(u,t,r,a),s.push(u)}return s}function Qp(e,t,r,i){let a=2**i.z*Nr,n=[i.x*Nr,i.y*Nr],s=[];for(let o of e){let l=[];for(let u of o){let h=[u.x+n[0],u.y+n[1]];ps(t,h),l.push(h)}s.push(l)}if(t[2]-t[0]<=a/2){Lb(t);for(let o of s)for(let l of o)F_(l,t,r,a)}return s}function Bb(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t.type==="Polygon"){let n=Qc(t.coordinates,i,a),s=Jp(e.geometry(),r,i,a);if(!Gn(r,i))return!1;for(let o of s)if(!Ka(o,n))return!1}if(t.type==="MultiPolygon"){let n=z_(t.coordinates,i,a),s=Jp(e.geometry(),r,i,a);if(!Gn(r,i))return!1;for(let o of s)if(!Fb(o,n))return!1}return!0}function Ob(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t.type==="Polygon"){let n=Qc(t.coordinates,i,a),s=Qp(e.geometry(),r,i,a);if(!Gn(r,i))return!1;for(let o of s)if(!M_(o,n))return!1}if(t.type==="MultiPolygon"){let n=z_(t.coordinates,i,a),s=Qp(e.geometry(),r,i,a);if(!Gn(r,i))return!1;for(let o of s)if(!Rb(o,n))return!1}return!0}var ed=class Po{constructor(t,r){this.type=fe,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Va(t[1])){let i=t[1];if(i.type==="FeatureCollection"){let a=[];for(let n of i.features){let{type:s,coordinates:o}=n.geometry;s==="Polygon"&&a.push(o),s==="MultiPolygon"&&a.push(...o)}if(a.length)return new Po(i,{type:"MultiPolygon",coordinates:a})}else if(i.type==="Feature"){let a=i.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new Po(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Po(i,i)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return Bb(t,this.geometries);if(t.geometryType()==="LineString")return Ob(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},R_=class{constructor(t=[],r=(i,a)=>i<a?-1:+(i>a)){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:i}=this,a=r[t];for(;t>0;){let n=t-1>>1,s=r[n];if(i(a,s)>=0)break;r[t]=s,t=n}r[t]=a}_down(t){let{data:r,compare:i}=this,a=this.length>>1,n=r[t];for(;t<a;){let s=(t<<1)+1,o=s+1;if(o<this.length&&i(r[o],r[s])<0&&(s=o),i(r[s],n)>=0)break;r[t]=r[s],t=s}r[t]=n}};const ef=Math.PI/180;var td=class{constructor(t){let r=ef*6378.137*1e3,i=Math.cos(t*ef),a=1/(1-.0066943799901413165*(1-i*i)),n=Math.sqrt(a);this.kx=r*n*i,this.ky=r*n*a*.9933056200098587}distance(t,r){let i=this.wrap(t[0]-r[0])*this.kx,a=(t[1]-r[1])*this.ky;return Math.sqrt(i*i+a*a)}pointOnLine(t,r){let i=1/0,a,n,s,o;for(let l=0;l<t.length-1;l++){let u=t[l][0],h=t[l][1],c=this.wrap(t[l+1][0]-u)*this.kx,d=(t[l+1][1]-h)*this.ky,p=0;(c!==0||d!==0)&&(p=(this.wrap(r[0]-u)*this.kx*c+(r[1]-h)*this.ky*d)/(c*c+d*d),p>1?(u=t[l+1][0],h=t[l+1][1]):p>0&&(u+=c/this.kx*p,h+=d/this.ky*p)),c=this.wrap(r[0]-u)*this.kx,d=(r[1]-h)*this.ky;let f=c*c+d*d;f<i&&(i=f,a=u,n=h,s=l,o=p)}return{point:[a,n],index:s,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function k_(e,t){return t[0]-e[0]}function No(e){return e[1]-e[0]+1}function hi(e,t){return e[1]>=e[0]&&e[1]<t}function Sh(e,t){if(e[0]>e[1])return[null,null];let r=No(e);if(t){if(r===2)return[e,null];let a=Math.floor(r/2);return[[e[0],e[0]+a],[e[0]+a,e[1]]]}if(r===1)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}function Dh(e,t){if(!hi(t,e.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)ps(r,e[i]);return r}function Eh(e){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)for(let i of r)ps(t,i);return t}function tf(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function rd(e,t,r){if(!tf(e)||!tf(t))return NaN;let i=0,a=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(a=e[1]-t[3]),e[3]<t[1]&&(a=t[1]-e[3]),r.distance([0,0],[i,a])}function Oi(e,t,r){let i=r.pointOnLine(t,e);return r.distance(e,i.point)}function id(e,t,r,i,a){let n=Math.min(Oi(e,[r,i],a),Oi(t,[r,i],a)),s=Math.min(Oi(r,[e,t],a),Oi(i,[e,t],a));return Math.min(n,s)}function $b(e,t,r,i,a){if(!(hi(t,e.length)&&hi(i,r.length)))return 1/0;let n=1/0;for(let s=t[0];s<t[1];++s){let o=e[s],l=e[s+1];for(let u=i[0];u<i[1];++u){let h=r[u],c=r[u+1];if(Pl(o,l,h,c))return 0;n=Math.min(n,id(o,l,h,c,a))}}return n}function jb(e,t,r,i,a){if(!(hi(t,e.length)&&hi(i,r.length)))return NaN;let n=1/0;for(let s=t[0];s<=t[1];++s)for(let o=i[0];o<=i[1];++o)if(n=Math.min(n,a.distance(e[s],r[o])),n===0)return n;return n}function Vb(e,t,r){if(Ka(e,t,!0))return 0;let i=1/0;for(let a of t){let n=a[0],s=a[a.length-1];if(n!==s&&(i=Math.min(i,Oi(e,[s,n],r)),i===0))return i;let o=r.pointOnLine(a,e);if(i=Math.min(i,r.distance(e,o.point)),i===0)return i}return i}function Nb(e,t,r,i){if(!hi(t,e.length))return NaN;for(let n=t[0];n<=t[1];++n)if(Ka(e[n],r,!0))return 0;let a=1/0;for(let n=t[0];n<t[1];++n){let s=e[n],o=e[n+1];for(let l of r)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let d=l[c],p=l[u];if(Pl(s,o,d,p))return 0;a=Math.min(a,id(s,o,d,p,i))}}return a}function rf(e,t){for(let r of e)for(let i of r)if(Ka(i,t,!0))return!0;return!1}function Ub(e,t,r,i=1/0){let a=Eh(e),n=Eh(t);if(i!==1/0&&rd(a,n,r)>=i)return i;if(Gn(a,n)){if(rf(e,t))return 0}else if(rf(t,e))return 0;let s=1/0;for(let o of e)for(let l=0,u=o.length,h=u-1;l<u;h=l++){let c=o[h],d=o[l];for(let p of t)for(let f=0,m=p.length,g=m-1;f<m;g=f++){let _=p[g],y=p[f];if(Pl(c,d,_,y))return 0;s=Math.min(s,id(c,d,_,y,r))}}return s}function af(e,t,r,i,a,n){if(!n)return;let s=rd(Dh(i,n),a,r);s<t&&e.push([s,n,[0,0]])}function Zs(e,t,r,i,a,n,s){if(!n||!s)return;let o=rd(Dh(i,n),Dh(a,s),r);o<t&&e.push([o,n,s])}function Uo(e,t,r,i,a=1/0){let n=Math.min(i.distance(e[0],r[0][0]),a);if(n===0)return n;let s=new R_([[0,[0,e.length-1],[0,0]]],k_),o=Eh(r);for(;s.length>0;){let l=s.pop();if(l[0]>=n)continue;let u=l[1],h=t?50:100;if(No(u)<=h){if(!hi(u,e.length))return NaN;if(t){let c=Nb(e,u,r,i);if(isNaN(c)||c===0)return c;n=Math.min(n,c)}else for(let c=u[0];c<=u[1];++c){let d=Vb(e[c],r,i);if(n=Math.min(n,d),n===0)return 0}}else{let c=Sh(u,t);af(s,n,i,e,o,c[0]),af(s,n,i,e,o,c[1])}}return n}function Go(e,t,r,i,a,n=1/0){let s=Math.min(n,a.distance(e[0],r[0]));if(s===0)return s;let o=new R_([[0,[0,e.length-1],[0,r.length-1]]],k_);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=t?50:100,d=i?50:100;if(No(u)<=c&&No(h)<=d){if(!hi(u,e.length)&&hi(h,r.length))return NaN;let p;if(t&&i)p=$b(e,u,r,h,a),s=Math.min(s,p);else if(t&&!i){let f=e.slice(u[0],u[1]+1);for(let m=h[0];m<=h[1];++m)if(p=Oi(r[m],f,a),s=Math.min(s,p),s===0)return s}else if(!t&&i){let f=r.slice(h[0],h[1]+1);for(let m=u[0];m<=u[1];++m)if(p=Oi(e[m],f,a),s=Math.min(s,p),s===0)return s}else p=jb(e,u,r,h,a),s=Math.min(s,p)}else{let p=Sh(u,t),f=Sh(h,i);Zs(o,s,a,e,r,p[0],f[0]),Zs(o,s,a,e,r,p[0],f[1]),Zs(o,s,a,e,r,p[1],f[0]),Zs(o,s,a,e,r,p[1],f[1])}}return s}function Gb(e,t){let r=e.geometry(),i=r.flat().map(s=>Jc([s.x,s.y],e.canonical));if(r.length===0)return NaN;let a=new td(i[0][1]),n=1/0;for(let s of t){switch(s.type){case"Point":n=Math.min(n,Go(i,!1,[s.coordinates],!1,a,n));break;case"LineString":n=Math.min(n,Go(i,!1,s.coordinates,!0,a,n));break;case"Polygon":n=Math.min(n,Uo(i,!1,s.coordinates,a,n))}if(n===0)return n}return n}function qb(e,t){let r=e.geometry(),i=r.flat().map(s=>Jc([s.x,s.y],e.canonical));if(r.length===0)return NaN;let a=new td(i[0][1]),n=1/0;for(let s of t){switch(s.type){case"Point":n=Math.min(n,Go(i,!0,[s.coordinates],!1,a,n));break;case"LineString":n=Math.min(n,Go(i,!0,s.coordinates,!0,a,n));break;case"Polygon":n=Math.min(n,Uo(i,!0,s.coordinates,a,n))}if(n===0)return n}return n}function Zb(e,t){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let i=El(r,0).map(s=>s.map(o=>o.map(l=>Jc([l.x,l.y],e.canonical)))),a=new td(i[0][0][0][1]),n=1/0;for(let s of t)for(let o of i){switch(s.type){case"Point":n=Math.min(n,Uo([s.coordinates],!1,o,a,n));break;case"LineString":n=Math.min(n,Uo(s.coordinates,!0,o,a,n));break;case"Polygon":n=Math.min(n,Ub(o,s.coordinates,a,n))}if(n===0)return n}return n}function Mu(e){return e.type==="MultiPolygon"?e.coordinates.map(t=>({type:"Polygon",coordinates:t})):e.type==="MultiLineString"?e.coordinates.map(t=>({type:"LineString",coordinates:t})):e.type==="MultiPoint"?e.coordinates.map(t=>({type:"Point",coordinates:t})):[e]}var ad=class Ao{constructor(t,r){this.type=V,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Va(t[1])){let i=t[1];if(i.type==="FeatureCollection")return new Ao(i,i.features.map(a=>Mu(a.geometry)).flat());if(i.type==="Feature")return new Ao(i,Mu(i.geometry));if("type"in i&&"coordinates"in i)return new Ao(i,Mu(i))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return Gb(t,this.geometries);if(t.geometryType()==="LineString")return qb(t,this.geometries);if(t.geometryType()==="Polygon")return Zb(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Wb=class L_{constructor(t){let r=null;for(let i of t)if(!r)r=i.type;else{if(r===i.type)continue;r=ue;break}this.type=Rt(r??ue,t.length),this.arr=t}static parse(t,r){if(t.length!==2)return r.error(`'semiliteral' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Va(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let i=t[1],a=it(i);if(a.kind==="array"){let n=i,s=r.concat(1),o=[];for(let l=0;l<n.length;l++){let u=s.parse(n[l],l,ue);if(!u)return null;o.push(u)}return new L_(o)}return new Na(a,i)}evaluate(t){return this.arr.map(r=>r.evaluate(t))}eachChild(t){this.arr.forEach(t)}outputDefined(){return this.arr.every(t=>t.outputDefined())}},nd=class B_{constructor(t){this.key=t,this.type=ue}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=t[1];return i==null?r.error("Global state property must be defined."):typeof i=="string"?new B_(i):r.error(`Global state property must be string, but found ${typeof t[1]} instead.`)}evaluate(t){var i;let r=(i=t.globals)==null?void 0:i.globalState;return!r||Object.keys(r).length===0?null:Fn(r,this.key)??null}eachChild(){}outputDefined(){return!1}};const Ma={"==":gb,"!=":_b,">":xb,"<":yb,">=":bb,"<=":vb,array:ti,at:Qv,boolean:ti,case:ib,coalesce:T_,collator:E_,format:h_,image:Tb,in:eb,"index-of":tb,interpolate:_r,"interpolate-hcl":_r,"interpolate-lab":_r,length:Sb,let:m_,literal:Na,match:rb,number:ti,"number-format":wb,object:ti,semiliteral:Wb,slice:ab,step:Kc,string:ti,"to-boolean":Pa,"to-color":Pa,"to-number":Pa,"to-string":Pa,var:__,within:ed,distance:ad,"global-state":nd};var Or=class extends Error{constructor(t,r){super(r),this.message=r,this.key=t}},Hb=class O_{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[i,a]of r)this.bindings[i]=a}concat(t){return new O_(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},$_=class j_{constructor(t,r,i=[],a,n=new Hb,s=[]){this.registry=t,this.path=i,this.key=i.map(o=>`[${o}]`).join(""),this.scope=n,this.errors=s,this.expectedType=a,this._isConstant=r}parse(t,r,i,a,n={}){return r==null?this._parse(t,n):this.concat(r,i,a)._parse(t,n)}_parse(t,r){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);let i=this.key;function a(n,s,o){return o==="assert"?new ti(s,[n],i):o==="coerce"?new Pa(s,[n],i):n}if(Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n=t[0];if(typeof n!="string")return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let s=this.registry[n];if(s){let o=s.parse(t,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind==="string"||l.kind==="number"||l.kind==="boolean"||l.kind==="object"||l.kind==="array")&&u.kind==="value")o=a(o,l,r.typeAnnotation||"assert");else if(l.kind==="projectionDefinition"&&["string","array","value"].includes(u.kind)||["color","formatted","resolvedImage"].includes(l.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(l.kind)&&["value","number","array"].includes(u.kind)||l.kind==="colorArray"&&["value","string","array"].includes(u.kind)||l.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))o=a(o,l,r.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(o instanceof Na)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new l_;try{o=new Na(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return t===void 0?this.error("'undefined' value invalid. Use null instead."):typeof t=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,r,i){let a=typeof t=="number"?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new j_(this.registry,this._isConstant,a,r||null,n,this.errors)}error(t,...r){let i=`${this.key}${r.map(a=>`[${a}]`).join("")}`;this.errors.push(new Or(i,t))}checkSubtype(t,r){let i=Un(t,r);return i&&this.error(i),i}},ra=class Cn{constructor(t,r,i,a,n){this.name=t,this.type=r,this._evaluate=i,this.args=a,this.key=n}evaluate(t){return this._evaluate(t,this.args,this.key)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let i=t[0],a=Cn.definitions[i];if(!a)return r.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,h]of o){l=new $_(r.registry,qo,r.path,null,r.scope);let c=[],d=!1;for(let p=1;p<t.length;p++){let f=t[p],m=Array.isArray(u)?u[p-1]:u.type,g=l.parse(f,1+c.length,m);if(!g){d=!0;break}c.push(g)}if(!d){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let p=0;p<c.length;p++){let f=Array.isArray(u)?u[p]:u.type,m=c[p];l.concat(p+1).checkSubtype(f,m.type)}if(l.errors.length===0)return new Cn(i,n,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>Yb(c)).join(" | "),h=[];for(let c=1;c<t.length;c++){let d=r.parse(t[c],1+h.length);if(!d)return null;h.push(Ke(d.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(", ")}) instead.`)}return null}static register(t,r){Cn.definitions=r;for(let i in r)t[i]=Cn}};function nf(e,[t,r,i,a],n){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let s=a?a.evaluate(e):1,o=s_(t,r,i,s);if(o)throw new qe(o,n);return new oe(t/255,r/255,i/255,s,!1)}function sf(e,t){return e in t&&t[e]!==void 0}function zu(e,t){let r=t[e];return r===void 0?null:r}function Xb(e,t,r,i){for(;r<=i;){let a=r+i>>1;if(t[a]===e)return!0;t[a]>e?i=a-1:r=a+1}return!1}function Mi(e){return{type:e}}ra.register(Ma,{error:[kv,[le],(e,[t],r)=>{throw new qe(t.evaluate(e),r)}],typeof:[le,[ue],(e,[t])=>Ke(it(t.evaluate(e)))],"to-rgba":[Rt(V,4),[Dr],(e,[t])=>{let[r,i,a,n]=t.evaluate(e).rgb;return[r*255,i*255,a*255,n]}],rgb:[Dr,[V,V,V],nf],rgba:[Dr,[V,V,V,V],nf],has:{type:fe,overloads:[[[le],(e,[t])=>sf(t.evaluate(e),e.properties())],[[le,Ui],(e,[t,r])=>sf(t.evaluate(e),r.evaluate(e))]]},get:{type:ue,overloads:[[[le],(e,[t])=>zu(t.evaluate(e),e.properties())],[[le,Ui],(e,[t,r])=>zu(t.evaluate(e),r.evaluate(e))]]},"feature-state":[ue,[le],(e,[t])=>zu(t.evaluate(e),e.featureState||{})],properties:[Ui,[],e=>e.properties()],"geometry-type":[le,[],e=>e.geometryType()],id:[ue,[],e=>e.id()],zoom:[V,[],e=>e.globals.zoom],"heatmap-density":[V,[],e=>e.globals.heatmapDensity||0],elevation:[V,[],e=>e.globals.elevation||0],"line-progress":[V,[],e=>e.globals.lineProgress||0],accumulated:[ue,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[V,Mi(V),(e,t)=>{let r=0;for(let i of t)r+=i.evaluate(e);return r}],"*":[V,Mi(V),(e,t)=>{let r=1;for(let i of t)r*=i.evaluate(e);return r}],"-":{type:V,overloads:[[[V,V],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[V],(e,[t])=>-t.evaluate(e)]]},"/":[V,[V,V],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[V,[V,V],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[V,[],()=>Math.LN2],pi:[V,[],()=>Math.PI],e:[V,[],()=>Math.E],"^":[V,[V,V],(e,[t,r])=>t.evaluate(e)**+r.evaluate(e)],sqrt:[V,[V],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[V,[V],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[V,[V],(e,[t])=>Math.log(t.evaluate(e))],log2:[V,[V],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[V,[V],(e,[t])=>Math.sin(t.evaluate(e))],cos:[V,[V],(e,[t])=>Math.cos(t.evaluate(e))],tan:[V,[V],(e,[t])=>Math.tan(t.evaluate(e))],asin:[V,[V],(e,[t])=>Math.asin(t.evaluate(e))],acos:[V,[V],(e,[t])=>Math.acos(t.evaluate(e))],atan:[V,[V],(e,[t])=>Math.atan(t.evaluate(e))],min:[V,Mi(V),(e,t)=>Math.min(...t.map(r=>r.evaluate(e)))],max:[V,Mi(V),(e,t)=>Math.max(...t.map(r=>r.evaluate(e)))],abs:[V,[V],(e,[t])=>Math.abs(t.evaluate(e))],round:[V,[V],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[V,[V],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[V,[V],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[fe,[le,ue],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[fe,[ue],(e,[t])=>e.id()===t.value],"filter-type-==":[fe,[le],(e,[t])=>e.geometryType()===t.value],"filter-<":[fe,[le,ue],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<a}],"filter-id-<":[fe,[ue],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[fe,[le,ue],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>a}],"filter-id->":[fe,[ue],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[fe,[le,ue],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[fe,[ue],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[fe,[le,ue],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[fe,[ue],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[fe,[ue],(e,[t])=>{let r=t.value,i=e.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[fe,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[fe,[Rt(le)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[fe,[Rt(ue)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[fe,[le,Rt(ue)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[fe,[le,Rt(ue)],(e,[t,r])=>Xb(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:fe,overloads:[[[fe,fe],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Mi(fe),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:fe,overloads:[[[fe,fe],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Mi(fe),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[fe,[fe],(e,[t])=>!t.evaluate(e)],"is-supported-script":[fe,[le],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[le,[le],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[le,[le],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[le,Mi(ue),(e,t)=>t.map(r=>Rn(r.evaluate(e))).join("")],split:[Rt(le),[le,le],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[le,[Rt(le),le],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],"resolved-locale":[le,[bl],(e,[t])=>t.evaluate(e).resolvedLocale()]});function Yb(e){return Array.isArray(e)?`(${e.map(Ke).join(", ")})`:`(${Ke(e.type)}...)`}function qo(e){if(e instanceof __)return qo(e.boundExpression);if(e instanceof ra&&e.name==="error"||e instanceof E_||e instanceof ed||e instanceof ad||e instanceof nd)return!1;let t=e instanceof Pa||e instanceof ti,r=!0;return e.eachChild(i=>{r&&(r=t?qo(i):i instanceof Na)}),r?Al(e)&&Cl(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Al(e){if(e instanceof ra&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof ed||e instanceof ad)return!1;let t=!0;return e.eachChild(r=>{t&&!Al(r)&&(t=!1)}),t}function qn(e){if(e instanceof ra&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(r=>{t&&!qn(r)&&(t=!1)}),t}function Cl(e,t){if(e instanceof ra&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(i=>{r&&!Cl(i,t)&&(r=!1)}),r}function Ua(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function V_(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function sd(e){return!!e.expression&&e.expression.interpolated}const od=/^(.*)-transition$/;function Zn(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function pe(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function Il(e){return typeof e=="object"&&!!e&&!Array.isArray(e)&&it(e)===Ui}function Kb(e){return e}function Jb(e){switch(e.type){case"color":return oe.parse;case"padding":return Hr.parse;case"numberArray":return Xr.parse;case"colorArray":return gr.parse;default:return null}}function Qb(e){switch(e){case"exponential":return U_;case"interval":return t2;case"categorical":return e2;case"identity":return r2;default:throw Error(`Unknown function type "${e}"`)}}function N_(e,t){let r=e.stops&&typeof e.stops[0][0]=="object",i=r||e.property!==void 0,a=r||!i,n=e.type||(sd(t)?"exponential":"interval"),s=Jb(t);if(s&&(e=Zn({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],s(h[1])])),e.default?e.default=s(e.default):e.default=s(t.default)),e.colorSpace&&!qv(e.colorSpace))throw Error(`Unknown color space: "${e.colorSpace}"`);let o=Qb(n),l,u;if(n==="categorical"){l=Object.create(null);for(let h of e.stops)l[h[0]]=h[1];u=typeof e.stops[0][0]}if(r){let h={},c=[];for(let f=0;f<e.stops.length;f++){let m=e.stops[f],g=m[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},c.push(g)),h[g].stops.push([m[0].value,m[1]])}let d=[];for(let f of c)d.push([h[f].zoom,N_(h[f],t)]);let p={name:"linear"};return{kind:"composite",interpolationType:p,interpolationFactor:_r.interpolationFactor.bind(void 0,p),zoomStops:d.map(f=>f[0]),evaluate({zoom:f},m){return U_({stops:d,base:e.base},t,f).evaluate(f,m)}}}if(a){let h=n==="exponential"?{name:"exponential",base:e.base===void 0?1:e.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:_r.interpolationFactor.bind(void 0,h),zoomStops:e.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(e,t,c,l,u)}}return{kind:"source",evaluate(h,c){let d=c&&c.properties?c.properties[e.property]:void 0;return d===void 0?fs(e.default,t.default):o(e,t,d,l,u)}}}function fs(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function e2(e,t,r,i,a){return fs(typeof r===a?i[r]:void 0,e.default,t.default)}function t2(e,t,r){if(pe(r)!=="number")return fs(e.default,t.default);let i=e.stops.length;if(i===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let a=Dl(e.stops.map(n=>n[0]),r,"");return e.stops[a][1]}function U_(e,t,r){let i=e.base===void 0?1:e.base;if(pe(r)!=="number")return fs(e.default,t.default);let a=e.stops.length;if(a===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[a-1][0])return e.stops[a-1][1];let n=Dl(e.stops.map(h=>h[0]),r,""),s=i2(r,i,e.stops[n][0],e.stops[n+1][0]),o=e.stops[n][1],l=e.stops[n+1][1],u=We[t.type]||Kb;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),d=l.evaluate.apply(void 0,h);if(c!==void 0&&d!==void 0)return u(c,d,s,e.colorSpace)}}:u(o,l,s,e.colorSpace)}function r2(e,t,r){switch(t.type){case"color":r=oe.parse(r);break;case"formatted":r=ui.fromString(r.toString());break;case"resolvedImage":r=Zr.fromString(r.toString());break;case"padding":r=Hr.parse(r);break;case"colorArray":r=gr.parse(r);break;case"numberArray":r=Xr.parse(r);break;default:pe(r)!==t.type&&(t.type!=="enum"||!t.values[r])&&(r=void 0)}return fs(r,e.default,t.default)}function i2(e,t,r,i){let a=i-r,n=e-r;return a===0?0:t===1?n/a:(t**+n-1)/(t**+a-1)}function Ph(e){return{result:"success",value:e}}function Sa(e){return{result:"error",value:e}}var ld=class{constructor(t,r,i,a){this.expression=t,this._warningHistory={},this._evaluator=new l_,this._defaultValue=i?X_(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=a,this._rootKey=r}evaluateWithoutErrorHandling(t,r,i,a,n,s){return this._globalState&&(t=Ga(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=i,this._evaluator.canonical=a,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,r,i,a,n,s){this._globalState&&(t=Ga(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=i||null,this._evaluator.canonical=a,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s||null;try{let o=this.expression.evaluate(this._evaluator);if(o==null||typeof o=="number"&&o!==o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new qe(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(o)} instead.`,"");return o}catch(o){let l=o instanceof qe?o.path:"",u=`${l}|${o.message}`;return this._warningHistory[u]||(this._warningHistory[u]=!0,typeof console<"u"&&console.warn(G_(this._rootKey,l,o.message,this._defaultValue))),this._defaultValue}}};function G_(e,t,r,i){return`${e}${t}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function q_(e){if(!e)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".')}function Ml(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in Ma}function zl(e,t,r,i){q_(t);let a=new $_(Ma,qo,[],r?s2(r):void 0),n=a.parse(e,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Ph(new ld(n,t,r,i)):Sa(a.errors)}var Wn=class{constructor(t,r,i){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!qn(r.expression),this.globalStateRefs=ms(r.expression),this._globalState=i}evaluateWithoutErrorHandling(t,r,i,a,n,s){return this._globalState&&(t=Ga(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,r,i,a,n,s)}evaluate(t,r,i,a,n,s){return this._globalState&&(t=Ga(t,this._globalState)),this._styleExpression.evaluate(t,r,i,a,n,s)}},Zo=class{constructor(t,r,i,a,n){this.kind=t,this.zoomStops=i,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!qn(r.expression),this.globalStateRefs=ms(r.expression),this.interpolationType=a,this._globalState=n}evaluateWithoutErrorHandling(t,r,i,a,n,s){return this._globalState&&(t=Ga(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,r,i,a,n,s)}evaluate(t,r,i,a,n,s){return this._globalState&&(t=Ga(t,this._globalState)),this._styleExpression.evaluate(t,r,i,a,n,s)}interpolationFactor(t,r,i){return this.interpolationType?_r.interpolationFactor(this.interpolationType,t,r,i):0}};function a2(e){return e._styleExpression!==void 0}function Z_(e,t,r,i){let a=zl(e,t,r,i);if(a.result==="error")return a;let n=a.value.expression,s=Al(n);if(!s&&!Ua(r))return Sa([new Or("","data expressions not supported")]);let o=Cl(n,["zoom"]);if(!o&&!V_(r))return Sa([new Or("","zoom expressions not supported")]);let l=Co(n);if(!l&&!o)return Sa([new Or("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof Or)return Sa([l]);if(l instanceof _r&&!sd(r))return Sa([new Or("",'"interpolate" expressions cannot be used with this property')]);if(!l)return Ph(s?new Wn("constant",a.value,i):new Wn("source",a.value,i));let u=l instanceof _r?l.interpolation:void 0;return Ph(s?new Zo("camera",a.value,l.labels,u,i):new Zo("composite",a.value,l.labels,u,i))}var W_=class H_{constructor(t,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,q_(r),this._parameters=t,this._specification=i,this._rootKey=r,this._defaultValue=X_(i),this._warningHistory={};let a=N_(this._parameters,this._specification);this.kind=a.kind,this.interpolationFactor=a.interpolationFactor,this.zoomStops=a.zoomStops,this.interpolationType=a.interpolationType,this._innerEvaluate=a.evaluate}evaluate(t,r){try{return this._innerEvaluate(t,r)}catch(i){let a=i instanceof Error?i.message:String(i),n=`|${a}`;return this._warningHistory[n]||(this._warningHistory[n]=!0,typeof console<"u"&&console.warn(G_(this._rootKey,"",a,this._defaultValue))),this._defaultValue}}static deserialize(t){return new H_(t._parameters,t._rootKey,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification,_rootKey:t._rootKey}}};function n2(e,t,r,i){if(Il(e))return new W_(e,t,r);if(Ml(e)){let a=Z_(e,t,r,i);if(a.result==="error")throw Error(a.value.map(n=>`${n.key}: ${n.message}`).join(", "));return a.value}{let a=e;return r.type==="color"&&typeof e=="string"?a=oe.parse(e):r.type==="padding"&&(typeof e=="number"||Array.isArray(e))?a=Hr.parse(e):r.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?a=Xr.parse(e):r.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?a=gr.parse(e):r.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?a=qr.parse(e):r.type==="projectionDefinition"&&typeof e=="string"&&(a=Ai.parse(e)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>a}}}function Co(e){let t=null;if(e instanceof m_)t=Co(e.result);else if(e instanceof T_){for(let r of e.args)if(t=Co(r),t)break}else(e instanceof Kc||e instanceof _r)&&e.input instanceof ra&&e.input.name==="zoom"&&(t=e);return t instanceof Or||e.eachChild(r=>{let i=Co(r);i instanceof Or?t=i:!t&&i?t=new Or("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new Or("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ms(e,t=new Set){return e instanceof nd&&t.add(e.key),e.eachChild(r=>{ms(r,t)}),t}function s2(e){let t={color:Dr,string:le,number:V,enum:le,boolean:fe,formatted:cs,padding:wl,numberArray:Tl,colorArray:Nn,projectionDefinition:vl,resolvedImage:ds,variableAnchorOffsetCollection:Sl};return e.type==="array"?Rt(t[e.value]||ue,e.length):t[e.type]}function X_(e){if(e.type==="color"&&Il(e.default))return new oe(0,0,0,0);switch(e.type){case"color":return oe.parse(e.default)||null;case"padding":return Hr.parse(e.default)||null;case"numberArray":return Xr.parse(e.default)||null;case"colorArray":return gr.parse(e.default)||null;case"variableAnchorOffsetCollection":return qr.parse(e.default)||null;case"projectionDefinition":return Ai.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function Ga(e,t){let{zoom:r,heatmapDensity:i,elevation:a,lineProgress:n,isSupportedScript:s,accumulated:o}=e??{};return{zoom:r,heatmapDensity:i,elevation:a,lineProgress:n,isSupportedScript:s,accumulated:o,globalState:t}}function o2(e){let t=!1;for(let r of e){let i=Y_(r);if(i==="expression")return"expression";i==="legacy"&&(t=!0)}return t?"legacy":"neutral"}function Y_(e){if(typeof e=="boolean")return"neutral";if(!Array.isArray(e)||e.length===0)return"legacy";switch(e[0]){case"has":return e.length<2||e[1]==="$id"||e[1]==="$type"?"legacy":e.length===2?"neutral":"expression";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return o2(e.slice(1));default:return"expression"}}function ud(e){return Y_(e)!=="legacy"}function of(e){return e==="$type"?["geometry-type"]:e==="$id"?["id"]:["get",e]}function l2(e){switch(e[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return e.length!==3||typeof e[1]!="string"?null:[e[0],of(e[1]),e[2]];case"in":case"!in":{if(e.length<2||typeof e[1]!="string")return null;let t=["in",of(e[1]),["literal",e.slice(2)]];return e[0]==="!in"?["!",t]:t}case"has":case"!has":{if(e.length!==2||typeof e[1]!="string"||e[1]==="$type"||e[1]==="$id")return null;let t=["has",e[1]];return e[0]==="!has"?["!",t]:t}default:return null}}function K_(e){if((e[0]==="<"||e[0]==="<="||e[0]===">"||e[0]===">=")&&e[1]==="$type")return`"$type" cannot be use with operator "${e[0]}"`;let t=l2(e);return t?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(e)} with ${JSON.stringify(t)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(e)} to expression syntax.`}function Fu(e,t,r){let i=r[e];return Array.isArray(i)?ud(i)?hd(i,t.concat(e)):{path:t.concat(e),legacyFilter:i}:null}function hd(e,t=[]){if(!Array.isArray(e)||e.length<1)return null;switch(e[0]){case"all":case"any":case"none":for(let r=1;r<e.length;r++){let i=Fu(r,t,e);if(i)return i}break;case"!":{let r=Fu(1,t,e);if(r)return r;break}case"case":for(let r=1;r<e.length-1;r+=2){let i=Fu(r,t,e);if(i)return i}}return null}function u2(e,t){let r=hd(e);if(!r||typeof console>"u")return;let i=r.path.map(a=>`[${a}]`).join("");console.warn(`${t}${i}: ${K_(r.legacyFilter)}`)}const h2={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Hn(e,t,r){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};ud(e)?u2(e,t):e=Wo(e);let i=zl(e,t,h2,r);if(i.result==="error")throw Error(i.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,n,s)=>i.value.evaluate(a,n,{},s),needGeometry:J_(e),getGlobalStateRefs:()=>ms(i.value.expression)}}function c2(e,t){return e<t?-1:+(e>t)}function J_(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t<e.length;t++)if(J_(e[t]))return!0;return!1}function Wo(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?Ru(e[1],e[2],"=="):t==="!="?Ws(Ru(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Ru(e[1],e[2],t):t==="any"?d2(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Wo)):t==="none"?["all"].concat(e.slice(1).map(Wo).map(Ws)):t==="in"?lf(e[1],e.slice(2)):t==="!in"?Ws(lf(e[1],e.slice(2))):t==="has"?uf(e[1]):t!=="!has"||Ws(uf(e[1]))}function Ru(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function d2(e){return["any"].concat(e.map(Wo))}function lf(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",e,["literal",t.sort(c2)]]:["filter-in-small",e,["literal",t]]}}function uf(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Ws(e){return["!",e]}function Q_(e){let t=e.key,r=e.value;return r?[new O(t,r,"constants have been deprecated as of v8")]:[]}function rt(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Ki(e){if(Array.isArray(e))return e.map(Ki);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=Ki(e[r]);return t}return rt(e)}function ar(e){let t=e.key,r=e.value,i=e.valueSpec||{},a=e.objectElementValidators||{},n=e.style,s=e.styleSpec,o=e.validateSpec,l=[],u=pe(r);if(u!=="object")return[new O(t,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],d=Fn(i,c)||i["*"],p;if(Fn(a,c))p=a[c];else if(Fn(i,c)){if(r[h]===void 0)continue;p=o}else if(a["*"])p=a["*"];else if(i["*"])p=o;else{l.push(new O(t,r[h],`unknown property "${h}"`));continue}l=l.concat(p({key:(t&&`${t}.`)+h,value:r[h],valueSpec:d,style:n,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)a[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new O(t,r,`missing required property "${h}"`));return l}function cd(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,a=e.style,n=e.styleSpec,s=e.key,o=e.arrayElementValidator||i;if(pe(t)!=="array")return[new O(s,t,`array expected, ${pe(t)} found`)];if(r.length&&t.length!==r.length)return[new O(s,t,`array length ${r.length} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};n.$version<7&&(l.function=r.function),pe(r.value)==="object"&&(l=r.value);let u=[];for(let h=0;h<t.length;h++)u=u.concat(o({array:t,arrayIndex:h,value:t[h],valueSpec:l,validateSpec:e.validateSpec,style:a,styleSpec:n,key:`${s}[${h}]`}));return u}function Fl(e){let t=e.key,r=e.value,i=e.valueSpec,a=pe(r);return a==="number"&&r!==r&&(a="NaN"),a==="number"?"minimum"in i&&r<i.minimum?[new O(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new O(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new O(t,r,`number expected, ${a} found`)]}function ey(e){let t=e.valueSpec,r=rt(e.value.type),i,a={},n,s,o=r!=="categorical"&&e.value.property===void 0,l=!o,u=pe(e.value.stops)==="array"&&pe(e.value.stops[0])==="array"&&pe(e.value.stops[0][0])==="object",h=ar({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:f}});return r==="identity"&&o&&h.push(new O(e.key,e.value,'missing required property "property"')),r!=="identity"&&!e.value.stops&&h.push(new O(e.key,e.value,'missing required property "stops"')),r==="exponential"&&e.valueSpec.expression&&!sd(e.valueSpec)&&h.push(new O(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Ua(e.valueSpec)?h.push(new O(e.key,e.value,"property functions not supported")):o&&!V_(e.valueSpec)&&h.push(new O(e.key,e.value,"zoom functions not supported"))),(r==="categorical"||u)&&e.value.property===void 0&&h.push(new O(e.key,e.value,'"property" property is required')),h;function c(m){if(r==="identity")return[new O(m.key,m.value,'identity function may not have a "stops" property')];let g=[],_=m.value;return g=g.concat(cd({key:m.key,value:_,valueSpec:m.valueSpec,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,arrayElementValidator:d})),pe(_)==="array"&&_.length===0&&g.push(new O(m.key,_,"array must have at least one stop")),g}function d(m){let g=[],_=m.value,y=m.key;if(pe(_)!=="array")return[new O(y,_,`array expected, ${pe(_)} found`)];if(_.length!==2)return[new O(y,_,`array length 2 expected, length ${_.length} found`)];if(u){if(pe(_[0])!=="object")return[new O(y,_,`object expected, ${pe(_[0])} found`)];if(_[0].zoom===void 0)return[new O(y,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new O(y,_,"object stop key must have value")];if(s&&s>rt(_[0].zoom))return[new O(y,_[0].zoom,"stop zoom values must appear in ascending order")];rt(_[0].zoom)!==s&&(s=rt(_[0].zoom),n=void 0,a={}),g=g.concat(ar({key:`${y}[0]`,value:_[0],valueSpec:{zoom:{}},validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,objectElementValidators:{zoom:Fl,value:p}}))}else g=g.concat(p({key:`${y}[0]`,value:_[0],validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec},_));return Ml(Ki(_[1]))?g.concat([new O(`${y}[1]`,_[1],"expressions are not allowed in function stops.")]):g.concat(m.validateSpec({key:`${y}[1]`,value:_[1],valueSpec:t,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec}))}function p(m,g){let _=pe(m.value),y=rt(m.value),v=m.value===null?g:m.value;if(!i)i=_;else if(_!==i)return[new O(m.key,v,`${_} stop domain type must match previous stop domain type ${i}`)];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new O(m.key,v,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&r!=="categorical"){let x=`number expected, ${_} found`;return Ua(t)&&r===void 0&&(x+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new O(m.key,v,x)]}return r==="categorical"&&_==="number"&&(!isFinite(y)||Math.floor(y)!==y)?[new O(m.key,v,`integer expected, found ${y}`)]:r!=="categorical"&&_==="number"&&n!==void 0&&y<n?[new O(m.key,v,"stop domain values must appear in ascending order")]:(n=y,r==="categorical"&&y in a?[new O(m.key,v,"stop domain values must be unique")]:(a[y]=!0,[]))}function f(m){return m.validateSpec({key:m.key,value:m.value,valueSpec:t,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec})}}function qa(e){let t=(e.expressionContext==="property"?Z_:zl)(Ki(e.value),e.key,e.valueSpec);if(t.result==="error")return t.value.map(i=>new O(`${e.key}${i.key}`,e.value,i.message));let r=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!r.outputDefined())return[new O(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!qn(r))return[new O(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!qn(r))return[new O(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!Cl(r,["zoom","feature-state"]))return[new O(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!Al(r))return[new O(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function p2(e){let t=e.value,r=e.key,i=pe(t);return i==="boolean"?[]:[new O(r,t,`boolean expected, ${i} found`)]}function Ah(e){let t=e.key,r=e.value,i=pe(r);return i==="string"?oe.parse(String(r))?[]:[new O(t,r,`color expected, "${r}" found`)]:[new O(t,r,`color expected, ${i} found`)]}function Xn(e){let t=e.key,r=e.value,i=e.valueSpec,a=[];return Array.isArray(i.values)?i.values.indexOf(rt(r))===-1&&a.push(new O(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(rt(r))===-1&&a.push(new O(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),a}function f2(e,t){let r=e;for(let i of t)r=r[i];return r}function m2(e,t){let r=hd(t);return r?[new O(`${e.key}${r.path.map(i=>`[${i}]`).join("")}`,f2(e.value,r.path),K_(r.legacyFilter),null,"warning")]:[]}function dd(e){let t=Ki(e.value);return ud(t)?[...m2(e,t),...qa(Zn({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:ty(e)}function ty(e){let t=e.value,r=e.key;if(pe(t)!=="array")return[new O(r,t,`array expected, ${pe(t)} found`)];let i=e.styleSpec,a,n=[];if(t.length<1)return[new O(r,t,"filter array must have at least 1 element")];switch(n=n.concat(Xn({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),rt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&rt(t[1])==="$type"&&n.push(new O(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&n.push(new O(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(a=pe(t[1]),a!=="string"&&n.push(new O(`${r}[1]`,t[1],`string expected, ${a} found`)));for(let s=2;s<t.length;s++)a=pe(t[s]),rt(t[1])==="$type"?n=n.concat(Xn({key:`${r}[${s}]`,value:t[s],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&n.push(new O(`${r}[${s}]`,t[s],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let s=1;s<t.length;s++)n=n.concat(ty({key:`${r}[${s}]`,value:t[s],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":a=pe(t[1]),t.length===2?a!=="string"&&n.push(new O(`${r}[1]`,t[1],`string expected, ${a} found`)):n.push(new O(r,t,`filter array for "${t[0]}" operator must have 2 elements`))}return n}function ry(e,t){let r=e.key,i=e.validateSpec,a=e.style,n=e.styleSpec,s=e.value,o=e.objectKey,l=n[`${t}_${e.layerType}`];if(!l)return[];let u=o.match(od);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:s,valueSpec:n.transition,style:a,styleSpec:n});let h=e.valueSpec||l[o];if(!h)return[new O(r,s,`unknown property "${o}"`)];let c;if(pe(s)==="string"&&Ua(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new O(r,s,`"${o}" does not support interpolation syntax
|
|
@@ -820,4 +820,4 @@ uniform ${c} ${d} u_${p};
|
|
|
820
820
|
`),x=y.concat(Vr.prelude.vertexSource,s.vertexSource,t.vertexSource).join(`
|
|
821
821
|
`),w=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}u.shaderSource(w,v),u.compileShader(w),u.attachShader(this.program,w);let b=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}u.shaderSource(b,x),u.compileShader(b),u.attachShader(this.program,b),this.attributes={};let S={};if(this.numAttributes=d.length,u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS)){if(u.isContextLost()){this.failedToCreate=!0;return}throw u.getShaderParameter(w,u.COMPILE_STATUS)?u.getShaderParameter(b,u.COMPILE_STATUS)?Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${u.getShaderInfoLog(b)}`):Error(`Could not compile fragment shader: ${u.getShaderInfoLog(w)}`)}d3(u,this.program);let A=x3(u,this.program);for(let P of d){if(!P)continue;let I=u.getAttribLocation(this.program,P);I>=0&&(this.attributes[P]={location:I,isInteger:A.has(P)})}u.deleteShader(b),u.deleteShader(w);for(let P of _)if(P&&!S[P]){let I=u.getUniformLocation(this.program,P);I&&(S[P]=I)}this.fixedUniforms=i(e,S),this.terrainUniforms=o3(e,S),this.binderUniforms=r?r.getUniforms(e,S):[]}draw(e,t,r,i,a,n,s,o,l,u,h,c,d,p,f,m,g,_,y){var w;let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.terrainUniformBuffer.bind(),e.frameUniformBuffer.bind(),e.setDepthMode(r),e.setStencilMode(i),e.setColorMode(a),e.setCullFace(n),o){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,o.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,o.texture);for(let b in this.terrainUniforms)this.terrainUniforms[b].set(o[b]);y3(e.terrainUniformBuffer,o)}if(f3(e,l),s)for(let b in this.fixedUniforms)this.fixedUniforms[b].set(s[b]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let x=0;switch(t){case v.LINES:x=2;break;case v.TRIANGLES:x=3;break;case v.LINE_STRIP:x=1}for(let b of d.get())b.vaos||(b.vaos={}),(w=b.vaos)[u]||(w[u]=new s3),b.vaos[u].bind(e,this,h,m?m.getPaintVertexBuffers():[],c,b.vertexOffset,g,_,y),v.drawElements(t,b.primitiveLength*x,v.UNSIGNED_SHORT,b.primitiveOffset*x*2)}};function nx(e,t,r){let i=1/nr(r,1,t.transform.tileZoom),a=2**r.tileID.overscaledZ,n=r.tileSize*2**t.transform.tileZoom/a,s=n*(r.tileID.canonical.x+r.tileID.wrap*a),o=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[i,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,o>>16],u_pixel_coord_lower:[s&65535,o&65535]}}function b3(e,t,r,i){let a=r.patternAtlas.getPattern(e.from.toString()),n=r.patternAtlas.getPattern(e.to.toString()),{width:s,height:o}=r.patternAtlas.getPixelSize(),l=2**i.tileID.overscaledZ,u=i.tileSize*2**r.transform.tileZoom/l,h=u*(i.tileID.canonical.x+i.tileID.wrap*l),c=u*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[s,o],u_mix:t.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/nr(i,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[h&65535,c&65535]}}const w3=(e,t)=>({u_lightpos:new jt(e,t.u_lightpos),u_lightpos_globe:new jt(e,t.u_lightpos_globe),u_lightintensity:new U(e,t.u_lightintensity),u_lightcolor:new jt(e,t.u_lightcolor),u_vertical_gradient:new U(e,t.u_vertical_gradient),u_opacity:new U(e,t.u_opacity),u_fill_translate:new de(e,t.u_fill_translate)}),T3=(e,t)=>({u_lightpos:new jt(e,t.u_lightpos),u_lightpos_globe:new jt(e,t.u_lightpos_globe),u_lightintensity:new U(e,t.u_lightintensity),u_lightcolor:new jt(e,t.u_lightcolor),u_vertical_gradient:new U(e,t.u_vertical_gradient),u_height_factor:new U(e,t.u_height_factor),u_opacity:new U(e,t.u_opacity),u_fill_translate:new de(e,t.u_fill_translate),u_image:new X(e,t.u_image),u_texsize:new de(e,t.u_texsize),u_pixel_coord_upper:new de(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new de(e,t.u_pixel_coord_lower),u_scale:new jt(e,t.u_scale),u_fade:new U(e,t.u_fade)}),sx=(e,t,r,i)=>{let a=e.style.light,n=a.getCartesianPosition(),s=$g();a.properties.get("anchor")==="viewport"&&$x(s,e.transform.bearingInRadians),Yx(n,n,s);let o=e.transform.transformLightDirection(n),l=a.properties.get("color");return{u_lightpos:n,u_lightpos_globe:o,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t,u_opacity:r,u_fill_translate:i}},S3=(e,t,r,i,a,n,s)=>H(sx(e,t,r,i),nx(n,e,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),D3=(e,t)=>({u_fill_translate:new de(e,t.u_fill_translate)}),E3=(e,t)=>({u_image:new X(e,t.u_image),u_texsize:new de(e,t.u_texsize),u_pixel_coord_upper:new de(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new de(e,t.u_pixel_coord_lower),u_scale:new jt(e,t.u_scale),u_fade:new U(e,t.u_fade),u_sdf_pattern:new X(e,t.u_sdf_pattern),u_fill_translate:new de(e,t.u_fill_translate)}),P3=(e,t)=>({u_fill_translate:new de(e,t.u_fill_translate)}),A3=(e,t)=>({u_image:new X(e,t.u_image),u_texsize:new de(e,t.u_texsize),u_pixel_coord_upper:new de(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new de(e,t.u_pixel_coord_lower),u_scale:new jt(e,t.u_scale),u_fade:new U(e,t.u_fade),u_sdf_pattern:new X(e,t.u_sdf_pattern),u_fill_translate:new de(e,t.u_fill_translate)}),ox=(e,t,r,i,a)=>H(nx(t,e,r),{u_fill_translate:i,u_sdf_pattern:+!!a}),C3=e=>({u_fill_translate:e}),I3=e=>({u_fill_translate:e}),M3=(e,t,r,i,a)=>ox(e,t,r,i,a),z3=(e,t)=>({u_scale_with_map:new X(e,t.u_scale_with_map),u_pitch_with_map:new X(e,t.u_pitch_with_map),u_extrude_scale:new de(e,t.u_extrude_scale),u_globe_extrude_scale:new U(e,t.u_globe_extrude_scale),u_translate:new de(e,t.u_translate)}),F3=(e,t,r,i,a)=>{let n=e.transform,s,o,l=0;if(r.paint.get("circle-pitch-alignment")==="map"){let u=nr(t,1,n.zoom);s=!0,o=[u,u],l=u/(L*2**t.tileID.overscaledZ)*2*Math.PI*a}else s=!1,o=n.pixelsToGLUnits;return{u_scale_with_map:+(r.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+s,u_extrude_scale:o,u_globe_extrude_scale:l,u_translate:i}},R3=(e,t)=>({u_color:new Ei(e,t.u_color),u_overlay:new X(e,t.u_overlay),u_overlay_scale:new U(e,t.u_overlay_scale)}),xg=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),k3=(e,t)=>({u_extrude_scale:new U(e,t.u_extrude_scale),u_intensity:new U(e,t.u_intensity),u_globe_extrude_scale:new U(e,t.u_globe_extrude_scale)}),L3=(e,t)=>({u_matrix:new Ar(e,t.u_matrix),u_image:new X(e,t.u_image),u_color_ramp:new X(e,t.u_color_ramp),u_opacity:new U(e,t.u_opacity)}),lx=(e,t,r,i)=>{let a=nr(e,1,t)/(L*2**e.tileID.overscaledZ)*2*Math.PI*i;return{u_extrude_scale:nr(e,1,t),u_intensity:r,u_globe_extrude_scale:a}},ux=(e,t,r,i)=>{let a=Pi();return Lr(a,0,e.width,e.height,0,0,1),{u_matrix:a,u_image:r,u_color_ramp:i,u_opacity:t.paint.get("heatmap-opacity")}},B3=(e,t)=>({u_image:new X(e,t.u_image),u_latrange:new de(e,t.u_latrange),u_exaggeration:new U(e,t.u_exaggeration),u_altitudes:new Sf(e,t.u_altitudes),u_azimuths:new Sf(e,t.u_azimuths),u_accent:new Ei(e,t.u_accent),u_method:new X(e,t.u_method),u_shadows:new Tf(e,t.u_shadows),u_highlights:new Tf(e,t.u_highlights)}),O3=(e,t)=>({u_matrix:new Ar(e,t.u_matrix),u_image:new X(e,t.u_image),u_dimension:new de(e,t.u_dimension),u_zoom:new U(e,t.u_zoom),u_unpack:new es(e,t.u_unpack)}),$3=(e,t,r)=>{let i=r.paint.get("hillshade-accent-color"),a;switch(r.paint.get("hillshade-method")){case"basic":a=4;break;case"combined":a=1;break;case"igor":a=2;break;case"multidirectional":a=3;break;default:a=0}let n=r.getIlluminationProperties();for(let s=0;s<n.directionRadians.length;s++)r.paint.get("hillshade-illumination-anchor")==="viewport"&&(n.directionRadians[s]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:V3(e,t.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:n.altitudeRadians,u_azimuths:n.directionRadians,u_accent:i,u_method:a,u_highlights:n.highlightColor,u_shadows:n.shadowColor}},j3=(e,t)=>{let r=t.stride,i=Pi();return Lr(i,0,L,-L,0,0,1),ot(i,i,[0,-L,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function V3(e,t){let r=2**t.canonical.z,i=t.canonical.y;return[new Ie(0,i/r).toLngLat().lat,new Ie(0,(i+1)/r).toLngLat().lat]}const N3=(e,t)=>({u_image:new X(e,t.u_image),u_unpack:new es(e,t.u_unpack),u_dimension:new de(e,t.u_dimension),u_elevation_stops:new X(e,t.u_elevation_stops),u_color_stops:new X(e,t.u_color_stops),u_color_ramp_size:new X(e,t.u_color_ramp_size),u_opacity:new U(e,t.u_opacity)}),U3=(e,t,r=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:e.paint.get("color-relief-opacity")}),G3=(e,t)=>({u_translation:new de(e,t.u_translation),u_ratio:new U(e,t.u_ratio)}),q3=(e,t)=>({u_translation:new de(e,t.u_translation),u_ratio:new U(e,t.u_ratio),u_image:new X(e,t.u_image),u_image_height:new U(e,t.u_image_height)}),Z3=(e,t)=>({u_translation:new de(e,t.u_translation),u_texsize:new de(e,t.u_texsize),u_ratio:new U(e,t.u_ratio),u_image:new X(e,t.u_image),u_scale:new jt(e,t.u_scale),u_fade:new U(e,t.u_fade)}),W3=(e,t)=>({u_translation:new de(e,t.u_translation),u_ratio:new U(e,t.u_ratio),u_image:new X(e,t.u_image),u_mix:new U(e,t.u_mix),u_tileratio:new U(e,t.u_tileratio),u_crossfade_from:new U(e,t.u_crossfade_from),u_crossfade_to:new U(e,t.u_crossfade_to),u_lineatlas_width:new U(e,t.u_lineatlas_width),u_lineatlas_height:new U(e,t.u_lineatlas_height)}),H3=(e,t)=>({u_translation:new de(e,t.u_translation),u_ratio:new U(e,t.u_ratio),u_image:new X(e,t.u_image),u_image_height:new U(e,t.u_image_height),u_tileratio:new U(e,t.u_tileratio),u_crossfade_from:new U(e,t.u_crossfade_from),u_crossfade_to:new U(e,t.u_crossfade_to),u_image_dash:new X(e,t.u_image_dash),u_mix:new U(e,t.u_mix),u_lineatlas_width:new U(e,t.u_lineatlas_width),u_lineatlas_height:new U(e,t.u_lineatlas_height)}),Wl=(e,t,r,i)=>{let a=e.transform;return{u_translation:hx(e,t,r),u_ratio:i/nr(t,1,a.zoom)}},X3=(e,t,r,i,a)=>H(Wl(e,t,r,i),{u_image:0,u_image_height:a}),Y3=(e,t,r,i,a)=>{let n=e.transform,s=rp(t,n);return{u_translation:hx(e,t,r),u_texsize:t.imageAtlasTexture.size,u_ratio:i/nr(t,1,n.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},K3=(e,t,r,i,a)=>{let n=e.transform,s=rp(t,n);return H(Wl(e,t,r,i),{u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},J3=(e,t,r,i,a,n)=>{let s=e.transform,o=rp(t,s);return H(Wl(e,t,r,i),{u_image:0,u_image_height:n,u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function rp(e,t){return 1/nr(e,1,t.tileZoom)}function hx(e,t,r){return Ti(e.transform,t,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const Q3=(e,t)=>({u_image:new X(e,t.u_image),u_opacity:new U(e,t.u_opacity)}),ez=(e,t)=>({u_image:t,u_opacity:e}),tz=(e,t)=>({u_is_size_zoom_constant:new X(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(e,t.u_is_size_feature_constant),u_size_t:new U(e,t.u_size_t),u_size:new U(e,t.u_size),u_rotate_symbol:new X(e,t.u_rotate_symbol),u_label_plane_matrix:new Ar(e,t.u_label_plane_matrix),u_coord_matrix:new Ar(e,t.u_coord_matrix),u_is_text:new X(e,t.u_is_text),u_pitch_with_map:new X(e,t.u_pitch_with_map),u_is_along_line:new X(e,t.u_is_along_line),u_is_variable_anchor:new X(e,t.u_is_variable_anchor),u_texsize:new de(e,t.u_texsize),u_texture:new X(e,t.u_texture),u_translation:new de(e,t.u_translation),u_pitched_scale:new U(e,t.u_pitched_scale),u_is_offset:new X(e,t.u_is_offset),u_height_anchor_ground:new X(e,t.u_height_anchor_ground)}),rz=(e,t)=>({u_is_size_zoom_constant:new X(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(e,t.u_is_size_feature_constant),u_size_t:new U(e,t.u_size_t),u_size:new U(e,t.u_size),u_rotate_symbol:new X(e,t.u_rotate_symbol),u_label_plane_matrix:new Ar(e,t.u_label_plane_matrix),u_coord_matrix:new Ar(e,t.u_coord_matrix),u_is_text:new X(e,t.u_is_text),u_pitch_with_map:new X(e,t.u_pitch_with_map),u_is_along_line:new X(e,t.u_is_along_line),u_is_variable_anchor:new X(e,t.u_is_variable_anchor),u_texsize:new de(e,t.u_texsize),u_texture:new X(e,t.u_texture),u_gamma_scale:new U(e,t.u_gamma_scale),u_is_halo:new X(e,t.u_is_halo),u_is_plain:new X(e,t.u_is_plain),u_translation:new de(e,t.u_translation),u_pitched_scale:new U(e,t.u_pitched_scale),u_is_offset:new X(e,t.u_is_offset),u_height_anchor_ground:new X(e,t.u_height_anchor_ground)}),iz=(e,t)=>({u_is_size_zoom_constant:new X(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(e,t.u_is_size_feature_constant),u_size_t:new U(e,t.u_size_t),u_size:new U(e,t.u_size),u_rotate_symbol:new X(e,t.u_rotate_symbol),u_label_plane_matrix:new Ar(e,t.u_label_plane_matrix),u_coord_matrix:new Ar(e,t.u_coord_matrix),u_is_text:new X(e,t.u_is_text),u_pitch_with_map:new X(e,t.u_pitch_with_map),u_is_along_line:new X(e,t.u_is_along_line),u_is_variable_anchor:new X(e,t.u_is_variable_anchor),u_texsize:new de(e,t.u_texsize),u_texsize_icon:new de(e,t.u_texsize_icon),u_texture:new X(e,t.u_texture),u_texture_icon:new X(e,t.u_texture_icon),u_gamma_scale:new U(e,t.u_gamma_scale),u_is_halo:new X(e,t.u_is_halo),u_translation:new de(e,t.u_translation),u_pitched_scale:new U(e,t.u_pitched_scale),u_is_offset:new X(e,t.u_is_offset),u_height_anchor_ground:new X(e,t.u_height_anchor_ground)}),cx=(e,t,r,i,a,n,s,o,l,u,h,c,d,p,f)=>({u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_rotate_symbol:+r,u_label_plane_matrix:o,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+i,u_is_along_line:a,u_is_variable_anchor:n,u_texsize:c,u_texture:0,u_translation:u,u_pitched_scale:d,u_is_offset:p,u_height_anchor_ground:+f}),dx=(e,t,r,i,a,n,s,o,l,u,h,c,d,p,f,m)=>{let g=s.transform;return H(cx(e,t,r,i,a,n,s,o,l,u,h,c,p,f,m),{u_gamma_scale:i?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_is_halo:+!!d,u_is_plain:1})},az=(e,t,r,i,a,n,s,o,l,u,h,c,d,p,f)=>H(dx(e,t,r,i,a,n,s,o,l,u,!0,h,!0,d,p,f),{u_texsize_icon:c,u_texture_icon:1}),nz=(e,t)=>({u_opacity:new U(e,t.u_opacity),u_color:new Ei(e,t.u_color)}),sz=(e,t)=>({u_opacity:new U(e,t.u_opacity),u_image:new X(e,t.u_image),u_pattern_tl_a:new de(e,t.u_pattern_tl_a),u_pattern_br_a:new de(e,t.u_pattern_br_a),u_pattern_tl_b:new de(e,t.u_pattern_tl_b),u_pattern_br_b:new de(e,t.u_pattern_br_b),u_texsize:new de(e,t.u_texsize),u_mix:new U(e,t.u_mix),u_pattern_size_a:new de(e,t.u_pattern_size_a),u_pattern_size_b:new de(e,t.u_pattern_size_b),u_scale_a:new U(e,t.u_scale_a),u_scale_b:new U(e,t.u_scale_b),u_pixel_coord_upper:new de(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new de(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new U(e,t.u_tile_units_to_pixels)}),oz=(e,t)=>({u_opacity:e,u_color:t}),lz=(e,t,r,i,a)=>H(b3(r,a,t,i),{u_opacity:e}),uz=(e,t)=>({u_sun_pos:new jt(e,t.u_sun_pos),u_atmosphere_blend:new U(e,t.u_atmosphere_blend),u_globe_position:new jt(e,t.u_globe_position),u_globe_radius:new U(e,t.u_globe_radius),u_inv_proj_matrix:new Ar(e,t.u_inv_proj_matrix)}),hz=(e,t,r,i,a)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:a}),cz=(e,t)=>({u_sky_color:new Ei(e,t.u_sky_color),u_horizon_color:new Ei(e,t.u_horizon_color),u_horizon:new de(e,t.u_horizon),u_horizon_normal:new de(e,t.u_horizon_normal),u_sky_horizon_blend:new U(e,t.u_sky_horizon_blend),u_sky_blend:new U(e,t.u_sky_blend),u_inv_proj_matrix:new Ar(e,t.u_inv_proj_matrix),u_globe_position:new jt(e,t.u_globe_position),u_globe_radius:new U(e,t.u_globe_radius),u_atmosphere_blend:new U(e,t.u_atmosphere_blend)}),dz=(e,t,r)=>{let i=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),n=jn(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,o=X1(t),l=Xa(t.worldSize,t.center.lat);return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-n*a)*r,(t.height/2+n*i)*r],u_horizon_normal:[-a,i],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*r,u_sky_blend:s,u_inv_proj_matrix:t.inverseProjectionMatrix,u_globe_position:o,u_globe_radius:l,u_atmosphere_blend:e.properties.get("atmosphere-blend")*Y1(Sr(o)-l,l)}},mo=(e,t)=>({}),pz={fillExtrusion:w3,fillExtrusionPattern:T3,fill:D3,fillPattern:E3,fillOutline:P3,fillOutlinePattern:A3,circle:z3,collisionBox:mo,collisionCircle:mo,debug:R3,depth:mo,clippingMask:mo,heatmap:k3,heatmapTexture:L3,hillshade:B3,hillshadePrepare:O3,colorRelief:N3,line:G3,lineGradient:q3,linePattern:Z3,lineSDF:W3,lineGradientSDF:H3,layerOpacity:Q3,raster:DI,symbolIcon:tz,symbolSDF:rz,symbolTextAndIcon:iz,background:nz,backgroundPattern:sz,terrain:l3,terrainDepth:u3,atmosphere:uz,sky:cz};var fz=class{constructor(e,t,r){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw 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)}};const vg={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var mz=class{constructor(e,t,r,i){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let r of this.attributes){let i=t.attributes[r.name];i!==void 0&&e.enableVertexAttribArray(i.location)}}setVertexAttribPointers(e,t,r){for(let i of this.attributes){let a=t.attributes[i.name];if(a!==void 0){let n=i.offset+this.itemSize*(r||0);a.isInteger?e.vertexAttribIPointer(a.location,i.components,e[vg[i.type]],this.itemSize,n):e.vertexAttribPointer(a.location,i.components,e[vg[i.type]],!1,this.itemSize,n)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},Re=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},gz=class extends Re{getDefault(){return oe.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},_z=class extends Re{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},yz=class extends Re{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},xz=class extends Re{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)}},vz=class extends Re{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},bz=class extends Re{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},wz=class extends Re{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)}},Tz=class extends Re{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)}},Sz=class extends Re{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}},Dz=class extends Re{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)}},Ez=class extends Re{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}},Pz=class extends Re{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},Az=class extends Re{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}},Cz=class extends Re{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)}},Iz=class extends Re{getDefault(){return oe.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},Mz=class extends Re{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},zz=class extends Re{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}},Fz=class extends Re{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},Rz=class extends Re{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},kz=class extends Re{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},Lz=class extends Re{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},Bz=class extends Re{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)}},Oz=class extends Re{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}},$z=class extends Re{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}},jz=class extends Re{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}},Vz=class extends Re{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}},Nz=class extends Re{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},Uz=class extends Re{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},Gz=class extends Re{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}},qz=class extends Re{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}},Zz=class extends Re{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}},ip=class extends Re{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},Wz=class extends ip{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}},Hz=class extends ip{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}},Xz=class extends ip{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}},Yz=class{constructor(e,t,r,i,a){this.context=e,this.width=t,this.height=r;let n=e.gl,s=this.framebuffer=n.createFramebuffer();if(this.colorAttachment=new Wz(e,s),i)this.depthAttachment=a?new Xz(e,s):new Hz(e,s);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let r=this.depthAttachment.get();r&&e.deleteRenderbuffer(r)}e.deleteFramebuffer(this.framebuffer)}};const px=ep([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),Jt=px.offsets;function Kz(e){return new tp(e,Zl.FrameUBO,px)}function Jz(e,t){let r=e.pending,{transform:i}=t,a=t.context.gl;r[Jt.u_units_to_pixels]=1/i.pixelsToGLUnits[0],r[Jt.u_units_to_pixels+1]=1/i.pixelsToGLUnits[1],r[Jt.u_world_size]=a.drawingBufferWidth,r[Jt.u_world_size+1]=a.drawingBufferHeight,r[Jt.u_camera_to_center_distance]=i.cameraToCenterDistance,r[Jt.u_symbol_fade_change]=t.options.fadeDuration?t.symbolFadeChange:1,r[Jt.u_aspect_ratio]=i.width/i.height,r[Jt.u_device_pixel_ratio]=t.pixelRatio,r[Jt.u_viewport_size]=i.width,r[Jt.u_viewport_size+1]=i.height,r[Jt.u_pixel_extrude_scale]=1/i.width,r[Jt.u_pixel_extrude_scale+1]=1/i.height,r[Jt.u_pitch]=i.pitch/360*2*Math.PI,e.upload()}var et=class{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}};et.Replace=[1,0],et.disabled=new et(et.Replace,oe.transparent,[!1,!1,!1,!1]),et.unblended=new et(et.Replace,oe.transparent,[!0,!0,!0,!0]),et.alphaBlended=new et([1,771],oe.transparent,[!0,!0,!0,!0]);var Qz=class{constructor(e){this.gl=e,this.clearColor=new gz(this),this.clearDepth=new _z(this),this.clearStencil=new yz(this),this.colorMask=new xz(this),this.depthMask=new vz(this),this.stencilMask=new bz(this),this.stencilFunc=new wz(this),this.stencilOp=new Tz(this),this.stencilTest=new Sz(this),this.depthRange=new Dz(this),this.depthTest=new Ez(this),this.depthFunc=new Pz(this),this.blend=new Az(this),this.blendFunc=new Cz(this),this.blendColor=new Iz(this),this.blendEquation=new Mz(this),this.cullFace=new zz(this),this.cullFaceSide=new Fz(this),this.frontFace=new Rz(this),this.program=new kz(this),this.activeTexture=new Lz(this),this.viewport=new Bz(this),this.bindFramebuffer=new Oz(this),this.bindRenderbuffer=new $z(this),this.bindTexture=new jz(this),this.bindVertexBuffer=new Vz(this),this.bindElementBuffer=new Nz(this),this.bindVertexArray=new Uz(this),this.pixelStoreUnpack=new Gz(this),this.pixelStoreUnpackPremultiplyAlpha=new qz(this),this.pixelStoreUnpackFlipY=new Zz(this),this.extTextureFilterAnisotropic=e.getExtension("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),e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_color_buffer_float"),this.boundUniformBuffers=[],this.projectionUniformBuffer=ix(this),this.keyedProjectionUniformBuffers=new Map,this.freeProjectionUniformBuffers=[],this.terrainUniformBuffer=_3(this),this.frameUniformBuffer=Kz(this)}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,this.boundUniformBuffers=[]}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new fz(this,e,t)}createVertexBuffer(e,t,r){return new mz(this,e,t,r)}createRenderbuffer(e,t,r){let i=this.gl,a=i.createRenderbuffer();return this.bindRenderbuffer.set(a),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,r,i){return new Yz(this,e,t,r,i)}clear({color:e,depth:t,stencil:r}){let i=this.gl,a=0;e&&(a|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),t!==void 0&&(a|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),r!==void 0&&(a|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(a)}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){Br(e.blendFunction,et.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(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},me=class{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}};me.ReadOnly=!1,me.ReadWrite=!0,me.disabled=new me(519,me.ReadOnly,[0,1]);const rh=7680;var Ae=class{constructor(e,t,r,i,a,n){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=a,this.pass=n}};Ae.disabled=new Ae({func:519,mask:0},0,0,rh,rh,rh);const bg=1029,ih=2305;var De=class{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}};De.disabled=new De(!1,bg,ih),De.backCCW=new De(!0,bg,ih),De.frontCCW=new De(!0,1028,ih);function eF(e,t,r){let i=(t==null?void 0:t.transitionState)??0;return{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:e,terrain:r,projectionTransition:i,isRenderingGlobe:i>0}}function Ft(e,t,r={}){let i=e.transform.getProjectionData({overscaledTileID:t,aligned:r.aligned,applyGlobeMatrix:!e.isRenderingToTexture,applyTerrainMatrix:r.applyTerrainMatrix??!0});return e.isRenderingToTexture||(i.uniformBufferKey=r.aligned?`${t.key}/aligned`:t.key),i}function Vt(e,t){var r;return e.isRenderingToTexture?null:((r=e.terrain)==null?void 0:r.getTerrainData(t))??null}let go;function wg(e,t,r,i,a,n){let s=e.context,o=s.gl,l=e.useProgram("collisionBox"),u=[],h=0,c=0;for(let _ of i){let y=t.getTile(_).getBucket(r);if(!y)continue;let v=a?y.textCollisionBox:y.iconCollisionBox,x=y.collisionCircleArray;x.length>0&&(u.push({circleArray:x,circleOffset:c,coord:_}),h+=x.length/4,c=h),v&&l.draw(s,o.LINES,me.disabled,Ae.disabled,e.colorModeForRenderPass(),De.disabled,null,Vt(n,_),Ft(n,_),r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,null,v.collisionVertexBuffer)}if(!a||!u.length)return;let d=e.useProgram("collisionCircle"),p=new J2;p.resize(h*4),p._trim();let f=0;for(let _ of u)for(let y=0;y<_.circleArray.length/4;y++){let v=y*4,x=_.circleArray[v+0],w=_.circleArray[v+1],b=_.circleArray[v+2],S=_.circleArray[v+3];p.emplace(f++,x,w,b,S,0),p.emplace(f++,x,w,b,S,1),p.emplace(f++,x,w,b,S,2),p.emplace(f++,x,w,b,S,3)}(!go||go.length<h*2)&&(go=tF(h));let m=s.createIndexBuffer(go,!0),g=s.createVertexBuffer(p,yS.members,!0);for(let _ of u)d.draw(s,o.TRIANGLES,me.disabled,Ae.disabled,e.colorModeForRenderPass(),De.disabled,null,Vt(n,_.coord),null,r.id,g,m,Ze.simpleSegment(0,_.circleOffset*2,_.circleArray.length,_.circleArray.length/2),null,e.transform.zoom,null,null,null);g.destroy(),m.destroy()}function tF(e){let t=e*2,r=new ew;r.resize(t),r._trim();for(let i=0;i<t;i++){let a=i*6;r.uint16[a+0]=i*4+0,r.uint16[a+1]=i*4+1,r.uint16[a+2]=i*4+2,r.uint16[a+3]=i*4+2,r.uint16[a+4]=i*4+3,r.uint16[a+5]=i*4+0}return r}const rF=Pr(new Float32Array(16));function iF(e,t,r,i,a,n){if(n.currentPass!=="translucent")return;let s=Ae.disabled,o=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&nF(i,e,r,t,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),a),r.paint.get("icon-opacity").constantOr(1)!==0&&Tg(e,t,r,i,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment").constantOr("viewport"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),s,o,n),r.paint.get("text-opacity").constantOr(1)!==0&&Tg(e,t,r,i,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),s,o,n),t.map.showCollisionBoxes&&(wg(e,t,r,i,!0,n),wg(e,t,r,i,!1,n))}function aF(e,t,r,i,a,n){let{horizontalAlign:s,verticalAlign:o}=Vl(e),l=-(s-.5)*t,u=-(o-.5)*r;return new M((l/a+i[0])*n,(u/a+i[1])*n)}function nF(e,t,r,i,a,n,s,o,l){var p;let u=t.transform,h=t.style.map.terrain,c=a==="map",d=n==="map";for(let f of e){let m=i.getTile(f),g=m.getBucket(r);if(!((p=g==null?void 0:g.text)!=null&&p.segments.get().length))continue;let _=g.textSizeData,y=Nl(_,u.zoom),v=nr(m,1,t.transform.zoom),x=Hd(c,t.transform,v),w=r.layout.get("icon-text-fit")!=="none"&&g.hasIconData();if(y){let b=2**(u.zoom-m.tileID.overscaledZ),S=h?(A,P)=>h.getElevation(f,A,P):void 0;oF(g,c,d,l,u,x,b,y,w,Ti(u,m,s,o),f.toUnwrapped(),S,r.layout.get("symbol-height-anchor")==="ground")}}}function sF(e,t,r,i,a,n){let s=t.tileAnchorPoint.add(new M(t.translation[0],t.translation[1]));if(t.pitchWithMap){let o=i.mult(n);r||(o=o.rotate(-a));let l=s.add(o);return Yd(l.x,l.y,t.pitchedLabelPlaneMatrix,ea(t,l.x,l.y)).point}if(r){let o=ta(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),l=Math.atan(o.y/o.x)+(o.x<0?Math.PI:0);return e.add(i.rotate(l))}return e.add(i)}function oF(e,t,r,i,a,n,s,o,l,u,h,c,d){let p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let _=0;_<p.length;_++){let y=p.get(_),v=e.allowVerticalPlacement&&!y.placedOrientation,x=!y.hidden&&y.crossTileID&&!v?i[y.crossTileID]:null;if(!x)Ba(y.numGlyphs,f);else{let w=new M(y.anchorX,y.anchorY),b={getElevation:c,heightOffset:y.heightOffset,heightAnchorGround:d,width:a.width,height:a.height,pitchedLabelPlaneMatrix:n,pitchWithMap:r,transform:a,tileAnchorPoint:w,translation:u,unwrappedTileID:h},S=r?R1(w.x,w.y,b):ta(w.x,w.y,b),A=M1(a.cameraToCenterDistance,S.signedDistanceFromCamera),P=Pd(e.textSizeData,o,y)*A/24;r&&(P*=e.tilePixelRatio/s);let{width:I,height:R,anchor:F,textOffset:T,textBoxScale:E}=x,D=aF(F,I,R,T,E,P),C=a.getPitchedTextCorrection(w.x+u[0],w.y+u[1],h),k=sF(S.point,b,t,D,-a.bearingInRadians,C),B=e.allowVerticalPlacement&&y.placedOrientation===2?Math.PI/2:0;for(let $=0;$<y.numGlyphs;$++)ol(f,k,B);l&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:k,angle:B})}}if(l){m.clear();let _=e.icon.placedSymbolArray;for(let y=0;y<_.length;y++){let v=_.get(y);if(v.hidden)Ba(v.numGlyphs,m);else{let x=g[y];if(!x)Ba(v.numGlyphs,m);else for(let w=0;w<v.numGlyphs;w++)ol(m,x.shiftedAnchor,x.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function lF(e,t,r){return r.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Tg(e,t,r,i,a,n,s,o,l,u,h,c,d){let p=e.context,f=p.gl,m=e.transform,g=o==="map",_=l==="map",y=o!=="viewport"&&r.layout.get("symbol-placement")!=="point",v=g&&!_&&!y,x=!r.layout.get("symbol-sort-key").isConstant(),w=!1,b=e.getDepthModeForSublayer(0,me.ReadOnly),S=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=[],P=m.getCircleRadiusCorrection();for(let F of i){let T=t.getTile(F),E=T.getBucket(r);if(!E)continue;let D=a?E.text:E.icon;if(!(D!=null&&D.segments.get().length)||!D.hasVisibleVertices)continue;let C=D.programConfigurations.get(r.id),k=a||E.sdfIcons,B=a?E.textSizeData:E.iconSizeData,$=_||m.pitch!==0,W=e.useProgram(lF(k,a,E),C),ie=Nl(B,m.zoom),ye=Vt(d,F),ce,ke=[0,0],ve,Ue,Ee=null,pt;if(a){if(ve=T.glyphAtlasTexture,Ue=f.LINEAR,ce=T.glyphAtlasTexture.size,E.iconsInText){ke=T.imageAtlasTexture.size,Ee=T.imageAtlasTexture;let q=B.kind==="composite"||B.kind==="camera";pt=$||e.options.rotating||e.options.zooming||q?f.LINEAR:f.NEAREST}}else{let q=r.layout.get("icon-size").constantOr(0)!==1||E.iconsNeedLinear;ve=T.imageAtlasTexture,Ue=k||e.options.rotating||e.options.zooming||q||$?f.LINEAR:f.NEAREST,ce=T.imageAtlasTexture.size}let yt=nr(T,1,e.transform.zoom),Nt=Hd(g,e.transform,yt),Ut=uM(_,g,e.transform,yt),Tt=Ti(m,T,n,s),nt=Ft(d,F),Yt=S&&E.hasTextData(),xr=r.layout.get("icon-text-fit")!=="none"&&Yt&&E.hasIconData(),sr=r._unevaluatedLayout.hasValue("icon-offset"),Z=r.layout.get("symbol-height-anchor")==="ground";if(y){let q=Pi();nM(q,Nt);let we=e.style.map.terrain?(Te,ne)=>e.style.map.terrain.getElevation(F,Te,ne):void 0;cM(E,e,a,Nt,q,_,u,r.layout.get("text-rotation-alignment")==="map",F.toUnwrapped(),m.width,m.height,Tt,we)}let ge=a&&S||xr,re=_?Nt:e.transform.clipSpaceToPixelsMatrix,j=y||ge?rF:re,xe=k&&r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Q;Q=k?E.iconsInText?az(B.kind,ie,v,_,y,ge,e,j,Ut,Tt,ce,ke,P,sr,Z):dx(B.kind,ie,v,_,y,ge,e,j,Ut,Tt,a,ce,xe,P,sr,Z):cx(B.kind,ie,v,_,y,ge,e,j,Ut,Tt,a,ce,P,sr,Z);let ae={program:W,buffers:D,uniformValues:Q,projectionData:nt,atlasTexture:ve,atlasTextureIcon:Ee,atlasInterpolation:Ue,atlasInterpolationIcon:pt,isSDF:k,hasHalo:xe};if(x&&E.canOverlap){w=!0;let q=D.segments.get();for(let we of q)A.push({segments:new Ze([we]),sortKey:we.sortKey,state:ae,terrainData:ye})}else A.push({segments:D.segments,sortKey:0,state:ae,terrainData:ye})}w&&A.sort((F,T)=>F.sortKey-T.sortKey);let I=r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,R=r.layout.get("text-letter-spacing").constantOr(0)*24<0||I>1;for(let F of A){let T=F.state;p.activeTexture.set(f.TEXTURE0),T.atlasTexture.bind(T.atlasInterpolation,f.CLAMP_TO_EDGE),T.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),T.atlasTextureIcon&&T.atlasTextureIcon.bind(T.atlasInterpolationIcon,f.CLAMP_TO_EDGE));let E=T.isSDF&&T.hasHalo;if(E){let D=T.uniformValues;D.u_is_halo=1,R&&(D.u_is_plain=0,Sg(T.buffers,F.segments,r,e,T.program,b,h,c,D,T.projectionData,F.terrainData),D.u_is_halo=0,D.u_is_plain=1)}Sg(T.buffers,F.segments,r,e,T.program,b,h,c,T.uniformValues,T.projectionData,F.terrainData),E&&!R&&(T.uniformValues.u_is_halo=0)}}function Sg(e,t,r,i,a,n,s,o,l,u,h){let c=i.context,d=c.gl;a.draw(c,d.TRIANGLES,n,s,o,De.backCCW,l,h,u,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,i.transform.zoom,e.programConfigurations.get(r.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function uF(e,t,r,i,a){if(a.currentPass!=="translucent")return;let n=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),o=r.paint.get("circle-stroke-opacity"),l=!r.layout.get("circle-sort-key").isConstant();if(n.constantOr(1)===0&&(s.constantOr(1)===0||o.constantOr(1)===0))return;let u=e.context,h=u.gl,c=e.transform,d=e.getDepthModeForSublayer(0,me.ReadOnly),p=Ae.disabled,f=e.colorModeForRenderPass(),m=[],g=c.getCircleRadiusCorrection();for(let _ of i){let y=t.getTile(_),v=y.getBucket(r);if(!v)continue;let x=r.paint.get("circle-translate"),w=r.paint.get("circle-translate-anchor"),b=Ti(c,y,x,w),S=v.programConfigurations.get(r.id),A=e.useProgram("circle",S),P=v.layoutVertexBuffer,I=v.indexBuffer,R=Vt(a,_),F={programConfiguration:S,program:A,layoutVertexBuffer:P,indexBuffer:I,uniformValues:F3(e,y,r,b,g),terrainData:R,projectionData:Ft(a,_)};if(l){let T=v.segments.get();for(let E of T)m.push({segments:new Ze([E]),sortKey:E.sortKey,state:F})}else m.push({segments:v.segments,sortKey:0,state:F})}l&&m.sort((_,y)=>_.sortKey-y.sortKey);for(let _ of m){let{programConfiguration:y,program:v,layoutVertexBuffer:x,indexBuffer:w,uniformValues:b,terrainData:S,projectionData:A}=_.state,P=_.segments;v.draw(u,h.TRIANGLES,d,p,f,De.backCCW,b,S,A,r.id,x,w,P,r.paint,e.transform.zoom,y)}}function hF(e,t,r,i,a){if(r.paint.get("heatmap-opacity")===0)return;let n=e.context;if(e.style.map.terrain){for(let s of i){let o=t.getTile(s);t.hasRenderableParent(s)||(a.currentPass==="offscreen"?pF(e,o,r,s,a):a.currentPass==="translucent"&&fF(e,r,s,a))}n.viewport.set([0,0,e.width,e.height])}else a.currentPass==="offscreen"?cF(e,t,r,i,a):a.currentPass==="translucent"&&dF(e,r)}function cF(e,t,r,i,a){let n=e.context,s=n.gl,o=e.transform,l=Ae.disabled,u=new et([s.ONE,s.ONE],oe.transparent,[!0,!0,!0,!0]);mF(n,e,r),n.clear({color:oe.transparent});for(let h of i){if(t.hasRenderableParent(h))continue;let c=t.getTile(h),d=c.getBucket(r);if(!d)continue;let p=d.programConfigurations.get(r.id),f=e.useProgram("heatmap",p),m=Ft(a,h,{applyTerrainMatrix:!1}),g=o.getCircleRadiusCorrection();f.draw(n,s.TRIANGLES,me.disabled,l,u,De.backCCW,lx(c,o.zoom,r.paint.get("heatmap-intensity"),g),null,m,r.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,r.paint,o.zoom,p)}n.viewport.set([0,0,e.width,e.height])}function dF(e,t){let r=e.context,i=r.gl;r.setColorMode(e.colorModeForRenderPass());let a=t.heatmapFbos.get(Qo);a&&(r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1),mx(r,t).bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,i.TRIANGLES,me.disabled,Ae.disabled,e.colorModeForRenderPass(),De.disabled,ux(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function pF(e,t,r,i,a){let n=e.context,s=n.gl,o=Ae.disabled,l=new et([s.ONE,s.ONE],oe.transparent,[!0,!0,!0,!0]),u=t.getBucket(r);if(!u)return;let h=i.key,c=r.heatmapFbos.get(h);c||(c=fx(n,t.tileSize,t.tileSize),r.heatmapFbos.set(h,c)),n.bindFramebuffer.set(c.framebuffer),n.viewport.set([0,0,t.tileSize,t.tileSize]),n.clear({color:oe.transparent});let d=u.programConfigurations.get(r.id),p=e.useProgram("heatmap",d,!a.isRenderingGlobe),f=Ft(a,t.tileID),m=Vt(a,i);p.draw(n,s.TRIANGLES,me.disabled,o,l,De.disabled,lx(t,e.transform.zoom,r.paint.get("heatmap-intensity"),1),m,f,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,d)}function fF(e,t,r,i){let a=e.context,n=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let o=mx(a,t),l=r.key,u=t.heatmapFbos.get(l);if(!u)return;a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,u.colorAttachment.get()),a.activeTexture.set(n.TEXTURE1),o.bind(n.LINEAR,n.CLAMP_TO_EDGE);let h=Ft(i,r,{applyTerrainMatrix:i.isRenderingGlobe});e.useProgram("heatmapTexture").draw(a,n.TRIANGLES,me.disabled,Ae.disabled,e.colorModeForRenderPass(),De.disabled,ux(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),u.destroy(),t.heatmapFbos.delete(l)}function mF(e,t,r){let i=e.gl;e.activeTexture.set(i.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=r.heatmapFbos.get(Qo);a?(i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=fx(e,t.width/4,t.height/4),r.heatmapFbos.set(Qo,a))}function fx(e,t,r){let i=e.gl,a=i.createTexture();i.bindTexture(i.TEXTURE_2D,a),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),i.texStorage2D(i.TEXTURE_2D,1,i.RGBA16F,t,r);let n=e.createFramebuffer(t,r,!1,!1);return n.colorAttachment.set(a),n}function mx(e,t){return t.colorRampTexture||(t.colorRampTexture=new dt(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function gx(e,t,r){let i=e.context,a=i.bindFramebuffer.get(),n=i.viewport.get(),[,,s,o]=n;return gF(e,s,o),i.viewport.set([0,0,s,o]),i.clear({color:oe.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,r),{compositeTarget:a,compositeViewport:n}}function gF(e,t,r){let i=e.context.gl;if(!e.layerOpacityFbo){let n=e.context.createFramebuffer(t,r,!0,!0),s=i.createTexture();i.bindTexture(i.TEXTURE_2D,s),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),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t,r,0,i.RGBA,i.UNSIGNED_BYTE,null),n.colorAttachment.set(s),n.depthAttachment.set(e.context.createRenderbuffer(i.DEPTH_STENCIL,t,r)),e.layerOpacityFbo=n,e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}if(e.layerOpacityFbo.width===t&&e.layerOpacityFbo.height===r){e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}let a=e.layerOpacityFbo;i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t,r,0,i.RGBA,i.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(a.depthAttachment.get()),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,t,r),e.context.bindRenderbuffer.set(null),a.width=t,a.height=r,e.context.bindFramebuffer.set(a.framebuffer)}function _x(e,t,r,i){let a=e.context,n=a.gl;a.bindFramebuffer.set(r.compositeTarget),a.viewport.set(r.compositeViewport),a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram("layerOpacity").draw(a,n.TRIANGLES,me.disabled,Ae.disabled,e.colorModeForRenderPass(),De.disabled,ez(t,0),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom),e.currentStencilSource=void 0}function yx(e,t,r,i,a,n,s,o){let l=256;if(a.stepInterpolant){let u=t.getSource().maxzoom,h=s.canonical.z===u?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1,c=n.maxLineLength/L*1024*h;l=se(gv(c),256,r.maxTextureSize)}return o.gradient=Zy({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:n.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new dt(r,o.gradient,i.RGBA),o.version=a.gradientVersion,o.texture}function _F(e,t,r,i,a){e.activeTexture.set(t.TEXTURE0),r.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),i.updatePaintBuffers(a)}function yF(e,t,r,i,a,n){(a||e.lineAtlas.dirty)&&(t.activeTexture.set(r.TEXTURE0),e.lineAtlas.bind(t)),i.updatePaintBuffers(n)}function xF(e,t,r,i,a,n,s){let o=n.gradients[a.id],l=o.texture;a.gradientVersion!==o.version&&(l=yx(e,t,r,i,a,n,s,o)),r.activeTexture.set(i.TEXTURE0),l.bind(a.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE)}function vF(e,t,r,i,a,n,s,o,l){let u=n.gradients[a.id],h=u.texture;a.gradientVersion!==u.version&&(h=yx(e,t,r,i,a,n,s,u)),r.activeTexture.set(i.TEXTURE0),h.bind(a.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE),r.activeTexture.set(i.TEXTURE1),e.lineAtlas.bind(r),o.updatePaintBuffers(l)}function bF(e,t,r,i,a){if(a.currentPass!=="translucent")return;let n=r.paint.get("line-opacity"),s=r.paint.get("line-width"),o=r.paint.get("line-layer-opacity");if(n.constantOr(1)!==0&&s.constantOr(1)!==0&&o!==0){if(o<1){let l=gx(e,r,i);Dg(e,t,r,i,a),_x(e,o,l,r);return}Dg(e,t,r,i,a)}}function Dg(e,t,r,i,a){let n=e.getDepthModeForSublayer(0,me.ReadOnly),s=e.colorModeForRenderPass(),o=r.paint.get("line-dasharray"),l=o.constantOr(1),u=r.paint.get("line-pattern"),h=u.constantOr(1),c=r.paint.get("line-gradient"),d=r.getCrossfadeParameters(),p;p=h?"linePattern":l&&c?"lineGradientSDF":l?"lineSDF":c?"lineGradient":"line";let f=e.context,m=f.gl,g=e.transform,_=!0;for(let y of i){let v=t.getTile(y);if(h&&!v.patternsLoaded())continue;let x=v.getBucket(r);if(!x)continue;let w=x.programConfigurations.get(r.id),b=e.context.program.get(),S=e.useProgram(p,w),A=_||S.program!==b,P=Vt(a,y),I=u.constantOr(null),R=o==null?void 0:o.constantOr(null);if(I&&v.imageAtlas){let C=v.imageAtlas,k=C.patternPositions[I.to.toString()],B=C.patternPositions[I.from.toString()];k&&B&&w.setConstantPatternPositions(k,B)}else if(R){let C=r.layout.get("line-cap").constantOr(null)==="round",k=e.lineAtlas.getDash(R.to,C),B=e.lineAtlas.getDash(R.from,C);w.setConstantDashPositions(k,B)}let F=Ft(a,y),T=g.getPixelScale(),E;h?(E=Y3(e,v,r,T,d),_F(f,m,v,w,d)):l&&c?(E=J3(e,v,r,T,d,x.lineClipsArray.length),vF(e,t,f,m,r,x,y,w,d)):l?(E=K3(e,v,r,T,d),yF(e,f,m,w,A,d)):c?(E=X3(e,v,r,T,x.lineClipsArray.length),xF(e,t,f,m,r,x,y)):E=Wl(e,v,r,T);let D=e.stencilModeForClipping(y);S.draw(f,m.TRIANGLES,n,D,s,De.disabled,E,P,F,r.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,r.paint,e.transform.zoom,w,x.layoutVertexBuffer2),_=!1}}function xx(e,t,r,i,a){if(!r||!(i!=null&&i.imageAtlas))return;let n=i.imageAtlas.patternPositions,s=n[r.to.toString()],o=n[r.from.toString()];if(!s&&o&&(s=o),!o&&s&&(o=s),!s||!o){let l=a.getPaintProperty(t);s=n[l],o=n[l]}s&&o&&e.setConstantPatternPositions(s,o)}function wF(e,t,r,i,a){let n=r.paint.get("fill-color"),s=r.paint.get("fill-opacity"),o=r.paint.get("fill-layer-opacity");if(s.constantOr(1)===0||o===0)return;if(o<1){if(a.currentPass!=="translucent")return;let h=gx(e,r,i);Eg(e,t,r,i,a),_x(e,o,h,r);return}let l=r.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&n.constantOr(oe.transparent).a===1&&s.constantOr(0)===1;if(u&&a.currentPass==="opaque"){let h=e.colorModeForRenderPass();ap(e,t,r,i,e.getDepthModeForSublayer(1,me.ReadWrite),h,!1,a);return}if(u&&a.currentPass==="translucent"){vx(e,t,r,i,a);return}a.currentPass==="translucent"&&Eg(e,t,r,i,a)}function Eg(e,t,r,i,a){let n=e.colorModeForRenderPass();ap(e,t,r,i,e.getDepthModeForSublayer(1,me.ReadOnly),n,!1,a),vx(e,t,r,i,a)}function vx(e,t,r,i,a){if(!r.paint.get("fill-antialias"))return;let n=e.colorModeForRenderPass();ap(e,t,r,i,e.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,me.ReadOnly),n,!0,a)}function ap(e,t,r,i,a,n,s,o){let l=e.context.gl,u="fill-pattern",h=r.paint.get(u),c=h==null?void 0:h.constantOr(1),d=r.getCrossfadeParameters(),p,f,m,g,_,y=e.transform,v=r.paint.get("fill-translate"),x=r.paint.get("fill-translate-anchor");s?(f=c&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=l.LINES):(f=c?"fillPattern":"fill",p=l.TRIANGLES);let w=h.constantOr(null);for(let b of i){let S=t.getTile(b);if(c&&!S.patternsLoaded())continue;let A=S.getBucket(r);if(!A)continue;let P=A.sdfPatterns[r.id]??!1,I=A.programConfigurations.get(r.id),R=e.useProgram(f,I),F=Vt(o,b);c&&(e.context.activeTexture.set(l.TEXTURE0),S.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),I.updatePaintBuffers(d)),xx(I,u,w,S,r);let T=Ft(o,b),E=Ti(y,S,v,x);s?(g=A.indexBuffer2,_=A.segments2,m=f==="fillOutlinePattern"&&c?M3(e,d,S,E,P):I3(E)):(g=A.indexBuffer,_=A.segments,m=c?ox(e,d,S,E,P):C3(E));let D=e.stencilModeForClipping(b);R.draw(e.context,p,a,D,n,De.backCCW,m,F,T,r.id,A.layoutVertexBuffer,g,_,r.paint,e.transform.zoom,I)}}function TF(e,t,r,i,a){let n=r.paint.get("fill-extrusion-opacity");if(n!==0&&a.currentPass==="translucent"){let s=new me(e.context.gl.LEQUAL,me.ReadWrite,a.depthRangeFor3D);if(n===1&&!r.paint.get("fill-extrusion-pattern").constantOr(1)){let o=e.colorModeForRenderPass();ah(e,t,r,i,s,Ae.disabled,o,a)}else ah(e,t,r,i,s,Ae.disabled,et.disabled,a),ah(e,t,r,i,s,e.stencilModeFor3D(),e.colorModeForRenderPass(),a)}}function ah(e,t,r,i,a,n,s,o){let l=e.context,u=l.gl,h="fill-extrusion-pattern",c=r.paint.get(h),d=c.constantOr(1),p=r.getCrossfadeParameters(),f=r.paint.get("fill-extrusion-opacity"),m=c.constantOr(null),g=e.transform;for(let _ of i){let y=t.getTile(_),v=y.getBucket(r);if(!v)continue;let x=Vt(o,_),w=v.programConfigurations.get(r.id),b=e.useProgram(d?"fillExtrusionPattern":"fillExtrusion",w);d&&(e.context.activeTexture.set(u.TEXTURE0),y.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),w.updatePaintBuffers(p));let S=Ft(o,_);xx(w,h,m,y,r);let A=Ti(g,y,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),P=r.paint.get("fill-extrusion-vertical-gradient"),I=d?S3(e,P,f,A,_,p,y):sx(e,P,f,A);b.draw(l,l.gl.TRIANGLES,a,n,s,De.backCCW,I,x,S,r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,r.paint,e.transform.zoom,w,e.style.map.terrain&&v.centroidVertexBuffer)}}function SF(e,t,r,i,a){if(a.currentPass!=="offscreen"&&a.currentPass!=="translucent")return;let n=e.context,s=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,me.ReadOnly),l=e.colorModeForRenderPass();if(a.currentPass==="offscreen")DF(e,t,i,r,o,Ae.disabled,l),n.viewport.set([0,0,e.width,e.height]);else if(a.currentPass==="translucent")if(s){let[u,h,c]=e.stencilConfigForOverlapTwoPass(i);nh(e,t,r,c,u,o,l,!1,a),nh(e,t,r,c,h,o,l,!0,a)}else{let[u,h]=e.getStencilConfigForOverlapAndUpdateStencilID(i);nh(e,t,r,h,u,o,l,!1,a)}}function nh(e,t,r,i,a,n,s,o,l){let u=e.style.projection,h=e.context,c=h.gl,d=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],p=e.useProgram("hillshade",null,!1,d),f=!e.options.moving;for(let m of i){let g=t.getTile(m),_=g.fbo;if(!_)continue;let y=u.getMeshFromTileID(h,m.canonical,o,!0,"raster"),v=Vt(l,m);h.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,_.colorAttachment.get());let x=Ft(l,m,{aligned:f});p.draw(h,c.TRIANGLES,n,a[m.overscaledZ],s,De.backCCW,$3(e,g,r),v,x,r.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function DF(e,t,r,i,a,n,s){let o=e.context,l=o.gl,u=i.paint.get("resampling")==="nearest"?l.NEAREST:l.LINEAR;for(let h of r){let c=t.getTile(h),d=c.dem;if(!(d!=null&&d.data)||!c.needsHillshadePrepare)continue;let p=d.dim+2,f=d.stride,m=d.getPixels();if(o.activeTexture.set(l.TEXTURE1),o.pixelStoreUnpackPremultiplyAlpha.set(!1),c.demTexture||(c.demTexture=e.getTileTexture(f)),c.demTexture){let _=c.demTexture;_.update(m,{premultiply:!1}),_.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else c.demTexture=new dt(o,m,l.RGBA,{premultiply:!1}),c.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);o.activeTexture.set(l.TEXTURE0);let g=c.fbo;if(!g){let _=new dt(o,{width:p,height:p,data:null},l.RGBA);_.bind(u,l.CLAMP_TO_EDGE),g=c.fbo=o.createFramebuffer(p,p,!0,!1),g.colorAttachment.set(_.texture)}o.bindFramebuffer.set(g.framebuffer),o.viewport.set([0,0,p,p]),e.useProgram("hillshadePrepare").draw(o,l.TRIANGLES,a,n,s,De.disabled,j3(c.tileID,d),null,null,i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),c.needsHillshadePrepare=!1}}function EF(e,t,r,i,a){if(a.currentPass!=="translucent"||!i.length)return;let n=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,me.ReadOnly),o=e.colorModeForRenderPass();if(n){let[l,u,h]=e.stencilConfigForOverlapTwoPass(i);sh(e,t,r,h,l,s,o,!1,a),sh(e,t,r,h,u,s,o,!0,a)}else{let[l,u]=e.getStencilConfigForOverlapAndUpdateStencilID(i);sh(e,t,r,u,l,s,o,!1,a)}}let Pg=0;function sh(e,t,r,i,a,n,s,o,l){let u=e.style.projection,h=e.context,c=h.gl,d=e.useProgram("colorRelief"),p=!e.options.moving,f=r.paint.get("resampling")==="nearest"?c.NEAREST:c.LINEAR,m=!0,g=0;for(let _ of i){let y=t.getTile(_),v=y.dem;if(!(v!=null&&v.data))continue;if(m){Pg||(Pg=c.getParameter(c.MAX_TEXTURE_SIZE));let A=Pg,{elevationTexture:P,colorTexture:I}=r.getColorRampTextures(h,A,v.getUnpackVector());h.activeTexture.set(c.TEXTURE1),P.bind(c.NEAREST,c.CLAMP_TO_EDGE),h.activeTexture.set(c.TEXTURE4),I.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=!1,g=P.size[0]}let x=v.stride;h.activeTexture.set(c.TEXTURE0),(!y.demTexture||y.needsColorReliefPrepare)&&(h.pixelStoreUnpackPremultiplyAlpha.set(!1),y.demTexture||(y.demTexture=e.getTileTexture(x)??new dt(h,{width:x,height:x,data:null},c.RGBA)),y.demTexture.update(v.getPixels(),{premultiply:!1}),y.needsColorReliefPrepare=!1),y.demTexture.bind(f,c.CLAMP_TO_EDGE);let w=u.getMeshFromTileID(h,_.canonical,o,!0,"raster"),b=Vt(l,_),S=Ft(l,_,{aligned:p});d.draw(h,c.TRIANGLES,n,a[_.overscaledZ],s,De.backCCW,U3(r,y.dem,g),b,S,r.id,w.vertexBuffer,w.indexBuffer,w.segments)}}const oh=[new M(0,0),new M(L,0),new M(L,L),new M(0,L)];function PF(e,t,r,i,a){if(a.currentPass!=="translucent"||r.paint.get("raster-opacity")===0||!i.length)return;let n=t.getSource(),s=e.style.projection.useSubdivision;if(n instanceof ws)_o(e,t,r,i,null,!1,!1,n.tileCoords,n.imageWarp,n.flippedWindingOrder,a,n.getMesh(e.context,s));else if(s){let[o,l,u]=e.stencilConfigForOverlapTwoPass(i);_o(e,t,r,u,o,!1,!0,oh,La,!1,a),_o(e,t,r,u,l,!0,!0,oh,La,!1,a)}else{let[o,l]=e.getStencilConfigForOverlapAndUpdateStencilID(i);_o(e,t,r,l,o,!1,!0,oh,La,!1,a)}}function _o(e,t,r,i,a,n,s,o,l,u=!1,h,c=null){let d=i[i.length-1].overscaledZ,p=e.context,f=p.gl,m=e.useProgram("raster"),g=e.style.projection,_=e.colorModeForRenderPass(),y=!e.options.moving,v=r.paint.get("raster-opacity"),x=r.paint.get("resampling")==="nearest"||r.paint.get("raster-resampling")==="nearest"?f.NEAREST:f.LINEAR,w=r.paint.get("raster-fade-duration"),b=!!e.style.map.terrain;for(let S of i){let A=e.getDepthModeForSublayer(S.overscaledZ-d,v===1?me.ReadWrite:me.ReadOnly,f.LESS),P=t.getTile(S);p.activeTexture.set(f.TEXTURE0),P.texture.bind(x,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(f.TEXTURE1);let{parentTile:I,parentScaleBy:R,parentTopLeft:F,fadeValues:T}=AF(P,t,w,b);P.fadeOpacity=T.tileOpacity,I?(I.fadeOpacity=T.parentTileOpacity,I.texture.bind(x,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)):P.texture.bind(x,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),P.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&f.texParameterf(f.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let E=Vt(h,S),D=Ft(h,S,{aligned:y}),C=EI(F,R,T.fadeMix,r,o,l),k=c??g.getMeshFromTileID(p,S.canonical,n,s,"raster"),B=a?a[S.overscaledZ]:Ae.disabled;m.draw(p,f.TRIANGLES,A,B,_,u?De.frontCCW:De.backCCW,C,E,D,r.id,k.vertexBuffer,k.indexBuffer,k.segments)}}function AF(e,t,r,i){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(r===0||i)return a;if(e.fadingParentID){let n=t.getLoadedTile(e.fadingParentID);if(!n)return a;let s=2**(n.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:n,parentScaleBy:s,parentTopLeft:[e.tileID.canonical.x*s%1,e.tileID.canonical.y*s%1],fadeValues:CF(e,n,r)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:IF(e,r)}:a}function CF(e,t,r){let i=Fe(),a=(i-e.timeAdded)/r,n=(i-t.timeAdded)/r,s=e.fadingDirection===1,o=se(a,0,1),l=se(1-n,0,1),u=s?o:l;return{tileOpacity:u,parentTileOpacity:s?l:o,fadeMix:{opacity:1,mix:1-u}}}function IF(e,t){let r=(Fe()-e.timeAdded)/t,i=se(r,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}function MF(e,t,r,i,a){let n=r.paint.get("background-color"),s=r.paint.get("background-opacity");if(s===0)return;let o=e.context,l=o.gl,u=e.style.projection,h=e.transform,c=h.tileSize,d=r.paint.get("background-pattern");if(e.isPatternMissing(d))return;let p=!d&&n.a===1&&s===1&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.currentPass!==p)return;let f=Ae.disabled,m=e.getDepthModeForSublayer(0,p==="opaque"?me.ReadWrite:me.ReadOnly),g=e.colorModeForRenderPass(),_=e.useProgram(d?"backgroundPattern":"background"),y=i||en(h,{tileSize:c,terrain:e.style.map.terrain});d&&(o.activeTexture.set(l.TEXTURE0),e.patternAtlas.bind(e.context));let v=r.getCrossfadeParameters();for(let x of y){let w=Ft(a,x),b=d?lz(s,e,d,{tileID:x,tileSize:c},v):oz(s,n),S=Vt(a,x),A=u.getMeshFromTileID(o,x.canonical,!1,!0,"raster");_.draw(o,l.TRIANGLES,m,f,g,De.backCCW,b,S,w,r.id,A.vertexBuffer,A.indexBuffer,A.segments)}}const zF=new oe(1,0,0,1),FF=new oe(0,1,0,1),RF=new oe(0,0,1,1),kF=new oe(1,0,1,1),LF=new oe(0,1,1,1);function BF(e){let t=e.transform.padding;Ag(e,e.transform.height-(t.top||0),3,zF),Ag(e,t.bottom||0,3,FF),Cg(e,t.left||0,3,RF),Cg(e,e.transform.width-(t.right||0),3,kF);let r=e.transform.centerPoint;OF(e,r.x,e.transform.height-r.y,LF)}function OF(e,t,r,i){_l(e,t-1,r-10,2,20,i),_l(e,t-10,r-1,20,2,i)}function Ag(e,t,r,i){_l(e,0,t+r/2,e.transform.width,r,i)}function Cg(e,t,r,i){_l(e,t-r/2,0,r,e.transform.height,i)}function _l(e,t,r,i,a,n){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio,a*e.pixelRatio),s.clear({color:n}),o.disable(o.SCISSOR_TEST)}function $F(e,t,r,i){for(let a of r)jF(e,t,a,i)}function jF(e,t,r,i){var y;let a=e.context,n=a.gl,s=e.useProgram("debug"),o=me.disabled,l=Ae.disabled,u=e.colorModeForRenderPass(),h="$debug",c=Vt(i,r);a.activeTexture.set(n.TEXTURE0);let d=((y=t.getTileByID(r.key).latestRawTileData)==null?void 0:y.byteLength)||0,p=Math.floor(d/1024),f=t.getTile(r).tileSize,m=512/Math.min(f,512)*(r.overscaledZ/e.transform.zoom)*.5,g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=` => ${r.overscaledZ}`),VF(e,`${g} ${p}kB`);let _=Ft(i,r);s.draw(a,n.TRIANGLES,o,l,et.alphaBlended,De.disabled,xg(oe.transparent,m),null,_,h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(a,n.LINE_STRIP,o,l,u,De.disabled,xg(oe.red),c,_,h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function VF(e,t){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,i=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,r.width,r.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}function NF(e,t){let r=null,i=Object.values(e._layers).flatMap(o=>o.source&&!o.isHidden(t)?[e.tileManagers[o.source]]:[]),a=i.filter(o=>o.getSource().type==="vector"),n=i.filter(o=>o.getSource().type!=="vector"),s=o=>{(!r||r.getSource().maxzoom<o.getSource().maxzoom)&&(r=o)};for(let o of a)s(o);if(!r)for(let o of n)s(o);return r}function UF(e,t,r,i){let{isRenderingGlobe:a}=i,n=e.context,s=r.implementation,o=e.style.projection,l=e.transform,u=l.getProjectionDataForCustomLayer(a),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
|
|
822
822
|
uniform mat4 u_projection_matrix;
|
|
823
|
-
${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:u,getProjectionData:d=>l.getProjectionData({overscaledTileID:new Dt(d.tileID.canonical.z,d.tileID.wrap??0,d.tileID.canonical.z,d.tileID.canonical.x,d.tileID.canonical.y),aligned:d.aligned,applyGlobeMatrix:d.applyGlobeMatrix,applyTerrainMatrix:d.applyTerrainMatrix})},c=s.renderingMode?s.renderingMode:"2d";if(i.currentPass==="offscreen"){let d=s.prerender;d&&(e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),d.call(s,n.gl,h),n.setDirty(),e.setBaseState())}else if(i.currentPass==="translucent"){e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),n.setStencilMode(Ae.disabled);let d=c==="3d"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,me.ReadOnly);n.setDepthMode(d),s.render(n.gl,h),n.setDirty(),e.setBaseState(),n.bindFramebuffer.set(null)}}function GF(e,t){let r=e.context,i=r.gl,a=e.transform,n=et.unblended,s=new me(i.LEQUAL,me.ReadWrite,[0,1]),o=t.tileManager.getRenderableTiles(),l=e.useProgram("terrainDepth");r.bindFramebuffer.set(t.getFramebuffer().framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:oe.white,depth:1});for(let u of o){let h=t.getTerrainMesh(u.tileID),c=t.getTerrainData(u.tileID),d=a.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),p=c3(t.getSkirtLength(a.zoom));l.draw(r,i.TRIANGLES,s,Ae.disabled,n,De.backCCW,p,c,d,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function qF(e,t,r,i){let{isRenderingGlobe:a}=i,n=e.context,s=n.gl,o=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram("terrain");n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height]);for(let c of r){let d=t.getTerrainMesh(c.tileID),p=e.renderToTexture.getTexture(c),f=t.getTerrainData(c.tileID);n.activeTexture.set(s.TEXTURE0),p.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_LINEAR);let m=t.getSkirtLength(o.zoom),g=o.calculateFogMatrix(c.tileID.toUnwrapped()),_=h3(m,g,e.style.sky,o.pitch,a),y=Ft(i,c.tileID,{applyTerrainMatrix:!1});h.draw(n,s.TRIANGLES,u,Ae.disabled,l,De.backCCW,_,f,y,"terrain",d.vertexBuffer,d.indexBuffer,d.segments)}}function bx(e,t){if(!t.mesh){let r=new vi;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let i=new Yr;i.emplaceBack(0,1,2),i.emplaceBack(0,2,3),t.mesh=new bs(e.createVertexBuffer(r,Vi.members),e.createIndexBuffer(i),Ze.simpleSegment(0,0,r.length,i.length))}return t.mesh}function ZF(e,t){let r=e.context,i=r.gl,a=dz(t,e.transform,e.pixelRatio),n=new me(i.LEQUAL,me.ReadWrite,[0,1]),s=Ae.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=bx(r,t);l.draw(r,i.TRIANGLES,n,s,o,De.disabled,a,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function WF(e,t){let r=e.getCartesianPosition();Hx(r,r);let i=Pr(new Float64Array(16));return e.properties.get("anchor")==="map"&&(yi(i,i,t.rollInRadians),Oa(i,i,-t.pitchInRadians),yi(i,i,t.bearingInRadians),Oa(i,i,t.center.lat*Math.PI/180),jg(i,i,-t.center.lng*Math.PI/180)),Xx(r,r,i),r}function HF(e,t,r){let i=e.context,a=i.gl,n=e.useProgram("atmosphere"),s=new me(a.LEQUAL,me.ReadOnly,[0,1]),o=e.transform,l=WF(r,e.transform),u=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=Xa(o.worldSize,o.center.lat),c=X1(o),d=Y1(Sr(c)-h,h),p=t.properties.get("atmosphere-blend")*u.projectionTransition*d;if(p===0)return;let f=hz(l,p,c,h,o.inverseProjectionMatrix),m=bx(i,t);n.draw(i,a.TRIANGLES,s,Ae.disabled,et.alphaBlended,De.disabled,f,null,null,"atmosphere",m.vertexBuffer,m.indexBuffer,m.segments)}const XF={symbol:iF,circle:uF,heatmap:hF,line:bF,fill:wF,fillExtrusion:TF,hillshade:SF,colorRelief:EF,raster:PF,background:MF,sky:ZF,atmosphere:HF,custom:UF,debug:$F,debugPadding:BF,terrainDepth:GF};var Hi,YF=(Hi=class{constructor(t,r){this.drawFunctions=XF,this.context=new Qz(t),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:Pr(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Fc.maxOverzooming+Fc.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new B1}resize(t,r,i){if(this.width=Math.round(t*i),this.height=Math.round(r*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let a of this.style._order)this.style._layers[a].resize()}setup(){let t=this.context,r=new vi;r.emplaceBack(0,0),r.emplaceBack(L,0),r.emplaceBack(0,L),r.emplaceBack(L,L),this.tileExtentBuffer=t.createVertexBuffer(r,Vi.members),this.tileExtentSegments=Ze.simpleSegment(0,0,4,2);let i=new vi;i.emplaceBack(0,0),i.emplaceBack(L,0),i.emplaceBack(0,L),i.emplaceBack(L,L),this.debugBuffer=t.createVertexBuffer(i,Vi.members),this.debugSegments=Ze.simpleSegment(0,0,4,5);let a=new U2;a.emplaceBack(0,0,0,0),a.emplaceBack(L,0,L,0),a.emplaceBack(0,L,0,L),a.emplaceBack(L,L,L,L),this.rasterBoundsBuffer=t.createVertexBuffer(a,n3.members),this.rasterBoundsSegments=Ze.simpleSegment(0,0,4,2);let n=new vi;n.emplaceBack(0,0),n.emplaceBack(L,0),n.emplaceBack(0,L),n.emplaceBack(L,L),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(n,Vi.members),this.rasterBoundsSegmentsPosOnly=Ze.simpleSegment(0,0,4,5);let s=new vi;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(s,Vi.members),this.viewportSegments=Ze.simpleSegment(0,0,4,2);let o=new tw;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);let l=new Yr;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new Ae({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new bs(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=Pi();Lr(i,0,this.width,this.height,0,0,1),Et(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]);let a={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,me.disabled,this.stencilClearMode,et.disabled,De.disabled,null,null,a,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!(r!=null&&r.length))return;this.currentStencilSource=t.source,this.nextStencilID+r.length>256&&this.clearStencil();let i=this.context;i.setColorMode(et.disabled),i.setDepthMode(me.disabled);let a={};for(let n of r)a[n.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,r,!0),this._renderTileMasks(a,r,!1),this._tileClippingMaskIDs=a}_renderTileMasks(t,r,i){let a=this.context,n=a.gl,s=this.style.projection,o=this.renderContext,l=this.useProgram("clippingMask");for(let u of r){let h=t[u.key],c=Vt(o,u),d=s.getMeshFromTileID(this.context,u.canonical,i,!0,"stencil"),p=Ft(o,u);l.draw(a,n.TRIANGLES,me.disabled,new Ae({func:n.ALWAYS,mask:0},h,255,n.KEEP,n.KEEP,n.REPLACE),et.disabled,o.isRenderingToTexture?De.disabled:De.backCCW,null,c,p,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){let t=this.context,r=t.gl,i=this.style.projection,a=this.transform,n=this.useProgram("depth"),s=this.getDepthModeFor3D(),o=en(a,{tileSize:a.tileSize});for(let l of o){let u=Vt(this.renderContext,l),h=i.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),c=Ft(this.renderContext,l);n.draw(t,r.TRIANGLES,s,Ae.disabled,et.disabled,De.backCCW,null,u,c,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,r=this.context.gl;return new Ae({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){let r=this.context.gl;return new Ae({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let r=this.context.gl,i=t.sort((s,o)=>o.overscaledZ-s.overscaledZ),a=i[i.length-1].overscaledZ,n=i[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let s={};for(let o=0;o<n;o++)s[o+a]=new Ae({func:r.GEQUAL,mask:255},o+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=n,[s,i]}return[{[a]:Ae.disabled},i]}stencilConfigForOverlapTwoPass(t){let r=this.context.gl,i=t.sort((s,o)=>o.overscaledZ-s.overscaledZ),a=i[i.length-1].overscaledZ,n=i[0].overscaledZ-a+1;if(this.clearStencil(),n>1){let s={},o={};for(let l=0;l<n;l++)s[l+a]=new Ae({func:r.GREATER,mask:255},n+1+l,255,r.KEEP,r.KEEP,r.REPLACE),o[l+a]=new Ae({func:r.GREATER,mask:255},1+l,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID=n*2+1,[s,o,i]}return this.nextStencilID=3,[{[a]:new Ae({func:r.GREATER,mask:255},2,255,r.KEEP,r.KEEP,r.REPLACE)},{[a]:new Ae({func:r.GREATER,mask:255},1,255,r.KEEP,r.KEEP,r.REPLACE)},i]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let r=.125;return new et([t.CONSTANT_COLOR,t.ONE],new oe(r,r,r,0),[!0,!0,!0,!0])}return this.renderContext.currentPass==="opaque"?et.unblended:et.alphaBlended}getDepthModeForSublayer(t,r,i){if(!this.opaquePassEnabledForLayer())return me.disabled;let a=1-((1+this.renderContext.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new me(i||this.context.gl.LEQUAL,r,[a,a])}getDepthModeFor3D(){return new me(this.context.gl.LEQUAL,me.ReadWrite,this.renderContext.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderContext.currentLayer<this.renderContext.opaquePassCutoff}render(t,r){var h;this.style=t,this.options=r;let i=this.renderContext=eF(this.transform,t.projection,t.map.terrain??null);this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Fe()),Jz(this.context.frameUniformBuffer,this),this.imageManager.beginFrame(),m3(this.context);let a=this.style._order,n=this.style.tileManagers,s={},o={},l={};for(let c in n){let d=n[c];d.used&&d.prepare(this.context),s[c]=d.getVisibleCoordinates(!1),o[c]=s[c].slice().reverse(),l[c]=d.getVisibleCoordinates(!0).reverse()}i.opaquePassCutoff=1/0;for(let c=0;c<a.length;c++){let d=a[c];if(this.style._layers[d].is3D()){i.opaquePassCutoff=c;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),i.opaquePassCutoff=0),i.currentPass="offscreen";for(let c of a){let d=this.style._layers[c];if(!d.hasOffscreenPass()||d.isHidden(this.transform.zoom))continue;let p=o[d.source];(d.type==="custom"||p.length)&&this.renderLayer(this,n[d.source],d,p,i)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?oe.black:oe.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,i.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(i.currentPass="opaque",i.currentLayer=a.length-1;i.currentLayer>=0;i.currentLayer--){let c=this.style._layers[a[i.currentLayer]];if(c.isHidden(this.transform.zoom))continue;let d=n[c.source],p=s[c.source];this.renderTileClippingMasks(c,p),this.renderLayer(this,d,c,p,i)}i.currentPass="translucent";let u=!1;for(i.currentLayer=0;i.currentLayer<a.length;i.currentLayer++){let c=this.style._layers[a[i.currentLayer]];if(c.isHidden(this.transform.zoom))continue;let d=n[c.source];if((h=this.renderToTexture)!=null&&h.renderLayer(c,i))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=!0,i.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let p=(c.type==="symbol"?l:o)[c.source];this.renderTileClippingMasks(c,s[c.source]),this.renderLayer(this,d,c,p,i)}if(i.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=NF(this.style,this.transform.zoom);c&&this.drawFunctions.debug(this,c,c.getVisibleCoordinates(),i)}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.renderToTexture&&!this.options.moving&&this.clearRTTPool(),this.context.setDefault()}markTerrainDepthDirty(){this.terrainFacilitator.depthDirty=!0}maybeDrawDepth(){var a,n;if(!((a=this.style)!=null&&a.projection)||!((n=this.style.map)!=null&&n.terrain))return;let t=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.depthDirty;i||(i=!Zx(t,r)),i||(i=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),i&&(Vx(t,r),this.terrainFacilitator.renderTime=Fe(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t,r,i,a,n){if(i.isHidden(this.transform.zoom)||i.type!=="background"&&i.type!=="custom"&&!(a||[]).length)return;this.id=i.id;let s=this.drawFunctions;B0(i)?s.symbol(t,r,i,a,this.style.placement.variableOffsets,n):Cw(i)?s.circle(t,r,i,a,n):Rw(i)?s.heatmap(t,r,i,a,n):pS(i)?s.line(t,r,i,a,n):ET(i)?s.fill(t,r,i,a,n):YT(i)?s.fillExtrusion(t,r,i,a,n):$w(i)?s.hillshade(t,r,i,a,n):qw(i)?s.colorRelief(t,r,i,a,n):Fh(i)?s.raster(t,r,i,a,n):mE(i)?s.background(t,r,i,a,n):yE(i)&&s.custom(t,r,i,n)}saveTileTexture(t){let r=this._tileTextures[t.size[0]];r?r.length<Hi.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?r.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let r=this._tileTextures[t];return r&&r.length>0?r.pop():null}acquireRTT(t){let r=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==t&&(i.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),i.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),i.size=t),i;let a=new dt(this.context,{width:t,height:t,data:null},r.RGBA,{premultiply:!1,useMipmap:!0});return a.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:a,size:t}}bindRTT(t){let r=this.context.gl,i=t.size;if(!this._rttSharedFbo){let a=this.context.createFramebuffer(i,i,!0,!0),n=this.context.createRenderbuffer(r.DEPTH_STENCIL,i,i);a.depthAttachment.set(n),this._rttSharedFbo={fbo:a,depthRenderbuffer:n,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}clearRTTPool(){for(let t of this._rttObjectRecyclePool)t.texture.destroy();this._rttObjectRecyclePool.length=0}destroyRTTResources(){if(this.clearRTTPool(),!this._rttSharedFbo)return;this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let r=this.patternAtlas.getPattern(t.from.toString()),i=this.patternAtlas.getPattern(t.to.toString());return!r||!i}useProgram(t,r,i=!1,a=[]){var m;this.cache||(this.cache={});let n=!!this.style.map.terrain,s=this.style.projection,o=i?Vr.projectionMercator:s.shaderPreludeCode,l=i?O1:s.shaderDefine,u=`/${i?$1:s.shaderVariantName}`,h=r?r.cacheKey:"",c=this._showOverdrawInspector?"/overdraw":"",d=n?"/terrain":"",p=a?`/${a.join("/")}`:"",f=t+h+u+c+d+p;return(m=this.cache)[f]||(m[f]=new v3(this.context,Vr[t],r,pz[t],this._showOverdrawInspector,n,o,l,a)),this.cache[f]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new dt(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){var t,r,i;if(this._tileTextures){for(let a in this._tileTextures){let n=this._tileTextures[a];if(n)for(let s of n)s.destroy()}this._tileTextures={}}if(this.destroyRTTResources(),(t=this.layerOpacityFbo)==null||t.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((r=this.tileExtentMesh.vertexBuffer)==null||r.destroy()),this.tileExtentMesh&&((i=this.tileExtentMesh.indexBuffer)==null||i.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),g3(this.context),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let a in this.cache){let n=this.cache[a];n!=null&&n.program&&this.context.gl.deleteProgram(n.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:r}=this.context.gl;return this.width!==t||this.height!==r}},Hi.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,Hi),KF=class extends Error{constructor(e,t){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=(t==null?void 0:t.statusMessage)??null}};function wx(e,t){let r=!1,i=null,a,n=()=>{i=null,r&&(r=(e(...a),i=setTimeout(n,t),!1))};return(...s)=>(r=!0,a=s,i||n(),i)}var JF=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):([...t.keys()][0]??"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:r,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let n=Array.from(t.keys());n.length>0&&t.delete(n[0])}let r=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=r?`#${r}`:"",a=window.location.href.replace(/(#.+)?$/,i);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=wx(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),r=Math.round(this._map.getZoom()*100)/100,i=10**Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(t.lng*i)/i,n=Math.round(t.lat*i)/i,s=this._map.getBearing(),o=this._map.getPitch(),l="";if(l+=e?`/${a}/${n}/${r}`:`${r}/${n}/${a}`,(s||o)&&(l+=`/${Math.round(s*10)/10}`),o&&(l+=`/${Math.round(o)}`),this._hashName){let u=this._getHashParams();return u.set(this._hashName,l),`#${decodeURIComponent(u.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${l}`}_isValidHash(e){if(e.length<3||e.some(a=>isNaN(+a)))return!1;try{new ee(+e[2],+e[1])}catch{return!1}let t=+e[0],r=+(e[3]||0),i=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&r>=-180&&r<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}};const Ts={linearity:.3,easing:qc(0,0,.3,1)},QF=H({deceleration:2500,maxSpeed:1400},Ts),e5=H({deceleration:20,maxSpeed:1400},Ts),t5=H({deceleration:1e3,maxSpeed:360},Ts),r5=H({deceleration:1e3,maxSpeed:90},Ts),i5=H({deceleration:1e3,maxSpeed:360},Ts);var a5=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Fe(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=Fe();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=Fe()-60,r=Math.max(0,e.length-2);for(;r>0&&e[r-1].time>=t;)r--;return e.slice(r)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2){this.clear();return}let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new M(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of t)n.around&&(r.around=n.around),n.pinchAround&&(r.pinchAround=n.pinchAround);for(let{settings:n}of t.slice(1))r.zoom+=n.zoomDelta||0,r.bearing+=n.bearingDelta||0,r.pitch+=n.pitchDelta||0,r.roll+=n.rollDelta||0,n.panDelta&&r.pan._add(n.panDelta);if(!r.pan.mag()&&!r.zoom&&!r.bearing&&!r.pitch&&!r.roll){this.clear();return}let i=Fe()-t[0].time,a={};if(r.pan.mag()){let n=Sn(r.pan.mag(),i,H({},QF,e||{})),s=r.pan.mult(n.amount/r.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);a.center=o.easingCenter,a.offset=o.easingOffset,Tn(a,n)}if(r.zoom){let n=Sn(r.zoom,i,e5);a.zoom=rr(this._map.getZoom()+n.amount,this._map.getZoomSnap(),n.amount),Tn(a,n)}if(r.bearing){let n=Sn(r.bearing,i,t5);a.bearing=this._map.getBearing()+se(n.amount,-179,179),Tn(a,n)}if(r.pitch){let n=Sn(r.pitch,i,r5);a.pitch=this._map.getPitch()+n.amount,Tn(a,n)}if(r.roll){let n=Sn(r.roll,i,i5);a.roll=this._map.getRoll()+se(n.amount,-179,179),Tn(a,n)}if(a.zoom||a.bearing){let n=r.pinchAround===void 0?r.around:r.pinchAround;a.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),H(a,{noMoveStart:!0})}};function Tn(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Sn(e,t,r){let{maxSpeed:i,linearity:a,deceleration:n}=r,s=se(e*a/(t/1e3),-i,i),o=Math.abs(s)/(n*a);return{easing:r.easing,duration:o*1e3,amount:o/2*s}}var n5=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new wC(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new ir(e.type,this._map,e))}mouseup(e){this._map.fire(new ir(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new ir(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ir(e.type,this._map,e))}mouseover(e){this._map.fire(new ir(e.type,this._map,e))}mouseout(e){this._map.fire(new ir(e.type,this._map,e))}touchstart(e){return this._firePreventable(new no(e.type,this._map,e))}touchmove(e){this._map.fire(new no(e.type,this._map,e))}touchend(e){this._map.fire(new no(e.type,this._map,e))}touchcancel(e){this._map.fire(new no(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},s5=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent,this._clearLongPress(),this._touchActive=!1}mousemove(e){this._map.fire(new ir(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ir("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}touchstart(e,t,r){if(this._clearLongPress(),this._touchActive=r.length>0,r.length!==1)return;this._longPressStart=t[0];let i=r[0];this._longPressTimer=setTimeout(()=>{this._longPressTimer=void 0;let a=new MouseEvent("contextmenu",{clientX:i.clientX,clientY:i.clientY,button:2,bubbles:!0,cancelable:!0});this._map.fire(new ir("contextmenu",this._map,a))},500)}touchmove(e,t,r){this._longPressTimer&&(r.length!==1||!this._longPressStart||t[0].dist(this._longPressStart)>this._clickTolerance)&&this._clearLongPress()}touchend(){this._touchActive=!1,this._clearLongPress()}touchcancel(){this._touchActive=!1,this._clearLongPress()}_clearLongPress(){this._longPressTimer&&(this._longPressTimer=(clearTimeout(this._longPressTimer),void 0)),this._longPressStart=void 0}contextmenu(e){if(this._touchActive){e.preventDefault();return}this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ir(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},o5=class{constructor(e,t,r){this._map=e,this._tr=r,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&typeof t.boxZoom=="object"&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(at.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let r=t;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=r,this._box||(this._box=at.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let a=Math.min(i.x,r.x),n=Math.max(i.x,r.x),s=Math.min(i.y,r.y),o=Math.max(i.y,r.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=`${n-a}px`,this._box.style.height=`${o-s}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let r=this._startPos,i=t;if(this.reset(),at.suppressClick(),r.x===i.x&&r.y===i.y)this._fireEvent("boxzoomcancel",e);else{if(this._map.fire(new Dm("boxzoomend",{originalEvent:e})),this._boxZoomEnd){this._boxZoomEnd(this._map,r,i,e);return}return{cameraAnimation:a=>a.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})}}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box=(this._box.remove(),null)),at.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new Dm(e,{originalEvent:t}))}};function $c(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let r={};for(let i=0;i<e.length;i++)r[e[i].identifier]=t[i];return r}function l5(e){let t=new M(0,0);for(let r of e)t._add(r);return t.div(e.length)}var u5=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=l5(t),this.touches=$c(r,t)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;let i=$c(r,t);for(let a in this.touches){let n=this.touches[a],s=i[a];(!s||s.dist(n)>30)&&(this.aborted=!0)}}touchend(e,t,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),r.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},jc=class{constructor(e){this.singleTap=new u5(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,r){this.singleTap.touchstart(e,t,r)}touchmove(e,t,r){this.singleTap.touchmove(e,t,r)}touchend(e,t,r){let i=this.singleTap.touchend(e,t,r);if(i){let a=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(i)<30;if((!a||!n)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}},h5=class{constructor(e,t){this._tr=t,this._zoomIn=new jc({numTouches:1,numTaps:2}),this._zoomOut=new jc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,r){this._zoomIn.touchstart(e,t,r),this._zoomOut.touchstart(e,t,r)}touchmove(e,t,r){this._zoomIn.touchmove(e,t,r),this._zoomOut.touchmove(e,t,r)}touchend(e,t,r){let i=this._zoomIn.touchend(e,t,r),a=this._zoomOut.touchend(e,t,r),n=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:rr(n.zoom+1,s.getZoomSnap()),around:n.transform.isPointOnMapSurface(i)?n.unproject(i):void 0},{originalEvent:e})};if(a)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:rr(n.zoom-1,s.getZoomSnap()),around:n.transform.isPointOnMapSurface(a)?n.unproject(a):void 0},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Hl=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let i=Array.isArray(t)?t[0]:t;if(!(!this._moved&&i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&at.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}};const c5={0:1,2:2};function d5(e,t){let r=c5[t];return e.buttons===void 0||(e.buttons&r)!==r}var Xl=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!d5(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}};const Yl=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};function p5({enable:e,clickTolerance:t}){return new Hl({clickTolerance:t,move:(r,i)=>({around:i,panDelta:i.sub(r)}),activateOnStart:!0,moveStateManager:new Xl({checkCorrectEvent:r=>r.button===0&&!r.ctrlKey}),enable:e,assignEvents:Yl})}function f5({enable:e,clickTolerance:t,aroundCenter:r=!0,minPixelCenterThreshold:i=100,rotateSpeed:a=.8},n){return new Hl({clickTolerance:t,move:(s,o)=>{let l=n();if(r&&Math.abs(l.y-s.y)>i)return{bearingDelta:Ev(new M(s.x,o.y),o,l)};let u=(o.x-s.x)*a;return r&&o.y<l.y&&(u=-u),{bearingDelta:u}},moveStateManager:new Xl({checkCorrectEvent:s=>s.button===0&&s.ctrlKey||s.button===2&&!s.ctrlKey}),enable:e,assignEvents:Yl})}function m5({enable:e,clickTolerance:t,pitchSpeed:r=-.5}){return new Hl({clickTolerance:t,move:(i,a)=>({pitchDelta:(a.y-i.y)*r}),moveStateManager:new Xl({checkCorrectEvent:i=>i.button===0&&i.ctrlKey||i.button===2}),enable:e,assignEvents:Yl})}function g5({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:r=.3},i){return new Hl({clickTolerance:t,move:(a,n)=>{let s=i(),o=(n.x-a.x)*r;return n.y<s.y&&(o=-o),{rollDelta:o}},moveStateManager:new Xl({checkCorrectEvent:a=>a.button===2&&a.ctrlKey}),enable:e,assignEvents:Yl})}var _5=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new M(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,r){return this._calculateTransform(e,t,r)}touchmove(e,t,r){if(this._active){if(this._shouldBePrevented(r.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,r)}}touchend(e,t,r){this._calculateTransform(e,t,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,r){r.length>0&&(this._active=!0);let i=$c(r,t),a=new M(0,0),n=new M(0,0),s=0;for(let l in i){let u=i[l],h=this._touches[l];h&&(a._add(u),n._add(u.sub(h)),s++,i[l]=u)}if(this._touches=i,this._shouldBePrevented(s)||!n.mag())return;let o=n.div(s);if(this._sum._add(o),!(this._sum.mag()<this._clickTolerance))return{around:a.div(s),panDelta:o}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},np=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,r){if(!this._firstTwoTouches)return;e.preventDefault();let[i,a]=this._firstTwoTouches,n=yo(r,t,i),s=yo(r,t,a);if(!n||!s)return;let o=this._aroundCenter?null:n.add(s).div(2);return this._move([n,s],o,e)}touchend(e,t,r){if(!this._firstTwoTouches)return;let[i,a]=this._firstTwoTouches,n=yo(r,t,i),s=yo(r,t,a);n&&s||(this._active&&at.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function yo(e,t,r){for(let i=0;i<e.length;i++)if(e[i].identifier===r)return t[i]}const Ig=.1;function Mg(e,t){return Math.log(e/t)/Math.LN2}var y5=class extends np{constructor(){super(),this._zoomRate=1,this._zoomThreshold=Ig}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??Ig}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let r=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(Mg(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:Mg(this._distance,r)*this._zoomRate,pinchAround:t}}};function zg(e,t){return e.angleWith(t)*180/Math.PI}var x5=class extends np{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,r){let i=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:zg(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,r=zg(e,this._startVector);return Math.abs(r)<t}};function lh(e){return Math.abs(e.y)>Math.abs(e.x)}var v5=class extends np{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,r){super.touchstart(e,t,r),this._currentTouchCount=r.length}_start(e){this._lastPoints=e,lh(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let i=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(i,a,r.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(i.y+a.y)/2*-.5}}gestureBeginsVertically(e,t,r){if(this._valid!==void 0)return this._valid;let i=e.mag()>=2,a=t.mag()>=2;if(!i&&!a)return;if(!i||!a)return this._firstMove===void 0&&(this._firstMove=r),r-this._firstMove<100&&void 0;let n=e.y>0==t.y>0;return lh(e)&&lh(t)&&n}};const b5={panStep:100,bearingStep:15,pitchStep:10};var w5=class{constructor(e,t){this._tr=t;let r=b5;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,r=0,i=0,a=0,n=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?r=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),n=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:s=>{let o=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:T5,zoom:t?rr(o.zoom+t*(e.shiftKey?2:1),s.getZoomSnap()):o.zoom,bearing:o.bearing+r*this._bearingStep,pitch:o.pitch+i*this._pitchStep,offset:[-a*this._panStep,-n*this._panStep],center:o.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function T5(e){return e*(2-e)}const Fg=4.000244140625;var S5=class{constructor(e,t,r){this._onTimeout=i=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)},this._map=e,this._tr=r,this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,r=Fe(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,t!==0&&t%Fg==0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&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._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=at.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(ee.convert(r.center)):t,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let s=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=s),typeof this._targetZoom=="number"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>Fg?this._wheelZoomRate:this._defaultZoomRate,o=2/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&o!==0&&(o=1/o);let l=typeof this._targetZoom=="number"?$t(this._targetZoom):e.scale,u=e.applyConstrain(e.getCameraLngLat(),It(l*o)).zoom,h=this._map.getZoomSnap();if(this._type==="wheel"&&h>0){let c=rr(e.zoom,h);this._targetZoom=rr(u,h,u-c)}else this._targetZoom=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,r=this._startZoom,i=this._easing,a=!1,n;if(this._type==="wheel"&&r&&i){let s=Fe()-this._lastWheelEventTime,o=Math.min((s+5)/200,1),l=i(o);n=We.number(r,t,l),o<1?this._needsRerender=!0:a=!0}else n=t,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=n,{noInertia:!0,needsRenderFrame:!a,zoomDelta:n-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=gh;if(this._prevEase){let r=this._prevEase,i=(Fe()-r.start)/r.duration,a=r.easing(i+.01)-r.easing(i),n=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-n*n);t=qc(n,s,.25,1)}return this._prevEase={start:Fe(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},D5=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},E5=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:rr(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.transform.isPointOnMapSurface(t)?this._tr.unproject(t):void 0},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},P5=class{constructor(){this._tap=new jc({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,r){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,r);else{let i=t[0],a=e.timeStamp-this._tapTime<500,n=this._tapPoint.dist(i)<30;!a||!n?this.reset():r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier)}}touchmove(e,t,r){if(!this._tapTime)this._tap.touchmove(e,t,r);else if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let i=t[0],a=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}touchend(e,t,r){if(this._tapTime)this._swipePoint&&r.length===0&&this.reset();else{let i=this._tap.touchend(e,t,r);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},A5=class{constructor(e,t,r){this._el=e,this._mousePan=t,this._touchPan=r}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},C5=class{constructor(e,t,r,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=r,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},I5=class{constructor(e,t,r,i){this._el=e,this._touchZoom=t,this._touchRotate=r,this._tapDragZoom=i,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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},M5=class{constructor(e,t){this._bypassKey=navigator.userAgent.includes("Mac")?"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=at.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=t,this._container.appendChild(i);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=r,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new bt("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},z5=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(M.convert(e),this._camera.terrain)}};const xo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var F5=class extends us{};function uh(e){var t;return((t=e.panDelta)==null?void 0:t.mag())||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var R5=class{get _ownerDocument(){var e;return((e=this._el)==null?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,t;return((t=(e=this._el)==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)||window}constructor(e,t,r){this._terrainGesture={inFlight:!1,anchorElevation:null},this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,n)=>{if(a.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let s=a.type==="renderFrame"?void 0:a,o={needsRenderFrame:!1},l={},u={};for(let{handlerName:d,handler:p,allowed:f}of this._handlers){if(!p.isEnabled())continue;let m;if(this._blockedByActive(u,f,d))p.reset();else if(p[n||a.type]){if(Av(a,n||a.type)){let g=at.mousePos(this._map.getCanvas(),a);m=p[n||a.type](a,g)}else if(Pv(a,n||a.type)){let g=a.touches,_=this._getMapTouches(g),y=at.touchPos(this._map.getCanvas(),_);m=p[n||a.type](a,y,_)}else Cv(n||a.type)||(m=p[n||a.type](a));this.mergeHandlerResult(o,l,m,d,s),m!=null&&m.needsRenderFrame&&this._triggerRenderFrame()}(m||p.isActive())&&(u[d]=p)}let h={};for(let d in this._previousActiveHandlers)u[d]||(h[d]=s);this._previousActiveHandlers=u,(Object.keys(h).length||uh(o))&&(this._changes.push([o,l,h]),this._triggerRenderFrame()),(Object.keys(u).length||uh(o))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=o;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._camera=t,this._transformProvider=new z5(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new a5(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);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],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"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],[this._ownerWindow,"blur",void 0]];for(let[a,n,s]of this._listeners)a.addEventListener(n,a===this._ownerDocument?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(let[e,t,r]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(e){let t=this._map,r=t.getCanvasContainer();this._add("mapEvent",new n5(t,e));let i=t.boxZoom=new o5(t,e,this._transformProvider);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let a=t.cooperativeGestures=new M5(t,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let n=new h5(t,this._transformProvider),s=new E5(t,this._transformProvider);t.doubleClickZoom=new D5(s,n),this._add("tapZoom",n),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let o=new P5;this._add("tapDragZoom",o);let l=t.touchPitch=new v5(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>this._camera.transform.centerPoint,h=f5(e,u),c=m5(e),d=g5(e,u);t.dragRotate=new C5(e,h,c,d),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=p5(e),f=new _5(e,t);t.dragPan=new A5(r,p,f),this._add("mousePan",p),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let m=new x5,g=new y5;t.touchZoomRotate=new I5(r,g,m,o),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new s5(t,e),["touchPan"]);let _=t.scrollZoom=new S5(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let y=t.keyboard=new w5(t,this._transformProvider);this._add("keyboard",y),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),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!!xo(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,r){for(let i in e)if(i!==r&&!(t!=null&&t.includes(i)))return!0;return!1}_getMapTouches(e){let t=[];for(let r of e){let i=r.target;this._el.contains(i)&&t.push(r)}return t}mergeHandlerResult(e,t,r,i,a){if(!r)return;H(e,r);let n={handlerName:i,originalEvent:r.originalEvent||a};r.zoomDelta!==void 0&&(t.zoom=n),r.panDelta!==void 0&&(t.drag=n),r.rollDelta!==void 0&&(t.roll=n),r.pitchDelta!==void 0&&(t.pitch=n),r.bearingDelta!==void 0&&(t.rotate=n)}_applyChanges(){let e={},t={},r={};for(let[i,a,n]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new M(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),H(t,a),H(r,n);this._updateMapTransform(e,t,r),this._changes=[]}_updateMapTransform(e,t,r){let i=this._map.terrain;if(!uh(e)){this._fireEvents(t,r,!0);return}let a=this._camera.getTransformForUpdate();this._camera.stop(!0);let{panDelta:n,zoomDelta:s,bearingDelta:o,pitchDelta:l,rollDelta:u}=e,{around:h,aroundOnSurface:c}=this._resolveAround(e,i,a),d=i?this._terrainGestureElevation(i,h,c,a,t):void 0,p={panDelta:n,zoomDelta:s,rollDelta:u,pitchDelta:l,bearingDelta:o,around:h,aroundElevation:d};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(h)&&(h=a.centerPoint);let f=this._computePreZoomAroundLoc(a,h,n,d);this._handleMapControls({terrain:i,tr:a,deltasForHelper:p,preZoomAroundLoc:f,combinedEventsInProgress:t,panDelta:n}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_resolveAround(e,t,r){let i=e.pinchAround===void 0?e.around:e.pinchAround;return i||(i=this._camera.transform.centerPoint),t&&!r.isPointOnMapSurface(i)?{around:r.centerPoint,aroundOnSurface:!1}:{around:i,aroundOnSurface:!0}}_terrainGestureElevation(e,t,r,i,a){if(!r)return;if(this._terrainGesture.anchorElevation===null&&(a.drag||a.zoom)){let s=i.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGesture.anchorElevation=s?s.z:void 0}let n=this._terrainGesture.anchorElevation;if(n!=null&&!(t.distSqr(i.centerPoint)<.01)&&!(n-i.elevation>=.9*(i.getCameraAltitude()-i.elevation)))return n}_computePreZoomAroundLoc(e,t,r,i){if(t.distSqr(e.centerPoint)<.01)return e.center;let a=r?t.sub(r):t;return i===void 0?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,i)}_handleMapControls({terrain:e,tr:t,deltasForHelper:r,preZoomAroundLoc:i,combinedEventsInProgress:a,panDelta:n}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(r,t),!e&&!s.useGlobeControls&&!t.isPointOnMapSurface(r.around)){n&&t.setCenter(t.screenPointToLocation(t.centerPoint.sub(n)));return}if(!e){s.handleMapControlsPan(r,t,i);return}if(!this._terrainGesture.inFlight){this._terrainGesture.inFlight=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(r,t,i);return}if(!s.useGlobeControls&&r.aroundElevation===void 0&&a.drag&&n){t.setCenter(t.screenPointToLocation(t.centerPoint.sub(n)));return}s.handleMapControlsPan(r,t,i)}_fireEvents(e,t,r){let i=xo(this._eventsInProgress),a=xo(e),n={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(n[`${h}start`]=c),this._eventsInProgress[h]=e[h]}!i&&a&&this._fireEvent("movestart",a.originalEvent);for(let h in n)this._fireEvent(h,n[h]);a&&this._fireEvent("move",a.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let s={},o;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:d}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],o=t[c]||d,s[`${h}end`]=o)}for(let h in s)this._fireEvent(h,s[h]);let l=xo(this._eventsInProgress),u=(i||a)&&!l;if(u&&this._terrainGesture.inFlight){this._camera.elevationFreeze=!1,this._terrainGesture={inFlight:!1,anchorElevation:null};let h=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(h)}if(r&&u){this._updatingCamera=!0;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),c=d=>d!==0&&-this._bearingSnap<d&&d<this._bearingSnap;h&&(h.essential||!Xt.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:o})):(this._fireEvent("moveend",o),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._camera.fire(new J(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new F5("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},k5=class extends kt{constructor(e){super(),this._renderFrameCallback=()=>{let t=Math.min((Fe()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new fl,this.cameraHelper=new ml,e.minZoom!==void 0&&this.transform.setMinZoom(e.minZoom),e.maxZoom!==void 0&&this.transform.setMaxZoom(e.maxZoom),e.minPitch!==void 0&&this.transform.setMinPitch(e.minPitch),e.maxPitch!==void 0&&this.transform.setMaxPitch(e.maxPitch),e.renderWorldCopies!==void 0&&this.transform.setRenderWorldCopies(e.renderWorldCopies),e.transformConstrain!==null&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}setTerrain(e){this.terrain=e,this.applyTerrainChange()}migrateProjection(e,t){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t,this._requestedCameraState){let r=e.clone();r.apply(this._requestedCameraState,!0),this._requestedCameraState=r}}getCenter(){return new ee(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,r){return e=M.convert(e).mult(-1),this.panTo(this.transform.center,H({offset:e},t),r)}panTo(e,t,r){return this.easeTo(H({center:e},t),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,r){return this.easeTo(H({zoom:e},t),r)}zoomIn(e,t){return this.zoomTo(rr(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(rr(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.applyTransformChange(r=>r.setFov(e)),this.fire(new J("movestart",t)).fire(new J("move",t)).fire(new J("moveend",t))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,r){return this.easeTo(H({bearing:e},t),r)}resetNorth(e,t){return this.rotateTo(0,H({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(H({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=Wr.convert(e).adjustAntiMeridian();let r=(t==null?void 0:t.bearing)||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,t,r,i){let a={top:0,bottom:0,right:0,left:0};if(i=H({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},i),typeof i.padding=="number"){let u=i.padding;i.padding={top:u,bottom:u,right:u,left:u}}let n=H(a,i.padding);i.padding=n;let s=this.transform,o=new Wr(e,t),l=this.cameraHelper.cameraForBoxAndBearing(i,n,o,r,s);return l&&this._zoomSnap&&(l.zoom=rr(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,t,r,i,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(M.convert(e)),this.transform.screenPointToLocation(M.convert(t)),r,i),i,a)}_fitInternal(e,t,r){return e?(t=H(e,t),delete t.padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}jumpTo(e,t){this.stop(),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=rr(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=!1,a=!1,n=!1,s=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLat(e.center?ee.convert(e.center):r.center,r)),this.cameraHelper.handleJumpToCenterZoom(r,e);let o=r.zoom!==s;return e.elevation!==void 0&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),e.bearing!==void 0&&r.bearing!==+e.bearing&&(i=!0,r.setBearing(+e.bearing)),e.pitch!==void 0&&r.pitch!==+e.pitch&&(a=!0,r.setPitch(+e.pitch)),e.roll!==void 0&&r.roll!==+e.roll&&(n=!0,r.setRoll(+e.roll)),e.padding!=null&&!r.isPaddingEqual(e.padding)&&r.setPadding(e.padding),this.applyUpdatedTransform(r),this.fire(new J("movestart",t)).fire(new J("move",t)),o&&this.fire(new J("zoomstart",t)).fire(new J("zoom",t)).fire(new J("zoomend",t)),i&&this.fire(new J("rotatestart",t)).fire(new J("rotate",t)).fire(new J("rotateend",t)),a&&this.fire(new J("pitchstart",t)).fire(new J("pitch",t)).fire(new J("pitchend",t)),n&&this.fire(new J("rollstart",t)).fire(new J("roll",t)).fire(new J("rollend",t)),this.fire(new J("moveend",t))}calculateAnchoredCameraOptions(e){var n;let t=this.transform.clone(),r=ee.convert(e.anchorLocation),i=M.convert(e.anchorScreenPoint),a={panDelta:i.sub(this.transform.locationToScreenPoint(r,this.terrain)),zoomDelta:e.zoom===void 0?0:e.zoom-t.zoom,bearingDelta:0,pitchDelta:0,rollDelta:0,around:i,aroundElevation:(n=this.terrain)==null?void 0:n.getElevationForLngLat(r,t)};return this.cameraHelper.handleMapControlsRollPitchBearingZoom(a,t),this.cameraHelper.handleMapControlsPan(a,t,r),{center:t.center,zoom:t.zoom}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a){let n=this.transform.calculateCenterFromCameraLngLatAlt(e,t,r,i);return{center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:r,pitch:i,roll:a}}easeTo(e,t){this._stop(!1,e.easeId),e=H({offset:[0,0],duration:500,easing:gh},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=rr(e.zoom,this._zoomSnap)),(e.animate===!1||!e.essential&&Xt.prefersReducedMotion)&&(e.duration=0);let r=this.getTransformForUpdate(),i=this.getBearing(),a=r.pitch,n=r.roll,s=e.bearing===void 0?i:this._normalizeBearing(e.bearing,i),o=e.pitch===void 0?a:+e.pitch,l=e.roll===void 0?n:this._normalizeBearing(e.roll,n),u=e.padding===void 0?r.padding:e.padding,h=M.convert(e.offset),c,d;e.around&&(c=ee.convert(e.around),d=r.locationToScreenPoint(c));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(r,{bearing:s,pitch:o,roll:l,padding:u,around:c,aroundPoint:d,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||(this._rotating=i!==s),this._pitching||(this._pitching=o!==a),this._rolling||(this._rolling=l!==n),this._padding=!r.isPaddingEqual(u),this._zooming||(this._zooming=f.isZooming),this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(f.elevationCenter,r),this._ease(m=>{f.easeFunc(m),this.terrain&&!e.freezeElevation&&this._updateElevation(m,r),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},m=>{this.terrain&&e.freezeElevation?this._finalizeElevation():this.elevationFreeze=!1,this._afterEase(t,m)},e),this}_prepareEase(e,t,r={}){this._moving=!0,!t&&!r.moving&&this.fire(new J("movestart",e)),this._zooming&&!r.zooming&&this.fire(new J("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new J("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new J("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new J("rollstart",e))}_prepareElevation(e,t){this._elevationCenter=e,this._elevationStart=t.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,t),this.elevationFreeze=!0}_updateElevation(e,t){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(t.center,t),t.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,t.tileZoom));let r=this.terrain.getElevationForLngLat(this._elevationCenter,t);if(e<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,a=(r-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-a),this._elevationTarget=r}t.setElevation(We.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}applyTerrainChange(){if(this.elevationFreeze)return;let e=this.transform;e.setMinElevationForCurrentTile(this.terrain?this.terrain.getMinTileElevationForLngLatZoom(e.center,e.tileZoom):0),this.getCenterClampedToGround()&&e.setElevation(this.terrain?this.terrain.getElevationForLngLat(e.center,e):0)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),r=e.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(r<i){let a=e.calculateCameraOptionsFromTo(t,i,e.center,e.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(i=>this._elevateCameraIfInsideTerrain(i)),this.transformCameraUpdate&&t.push(i=>this.transformCameraUpdate(i)),!t.length)return;let r=e.clone();for(let i of t){let a=r.clone(),{center:n,zoom:s,roll:o,pitch:l,bearing:u,elevation:h}=i(a);n&&a.setCenter(n),h!==void 0&&a.setElevation(h),s!==void 0&&a.setZoom(s),o!==void 0&&a.setRoll(o),l!==void 0&&a.setPitch(l),u!==void 0&&a.setBearing(u),r.apply(a,!1)}this.transform.apply(r,!1)}applyTransformChange(e){let t=this._requestedCameraState!==void 0,r=this.getTransformForUpdate();e(r),this.applyUpdatedTransform(r),t||delete this._requestedCameraState}_fireMoveEvents(e){this.fire(new J("move",e)),this._zooming&&this.fire(new J("zoom",e)),this._rotating&&this.fire(new J("rotate",e)),this._pitching&&this.fire(new J("pitch",e)),this._rolling&&this.fire(new J("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let r=this._zooming,i=this._rotating,a=this._pitching,n=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new J("zoomend",e)),i&&this.fire(new J("rotateend",e)),a&&this.fire(new J("pitchend",e)),n&&this.fire(new J("rollend",e)),this.fire(new J("moveend",e))}flyTo(e,t){if(!e.essential&&Xt.prefersReducedMotion){let T=os(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(T,t)}this.stop(),e=H({offset:[0,0],speed:1.2,curve:1.42,easing:gh},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=rr(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=r.bearing,a=r.pitch,n=r.roll,s=r.padding,o=e.bearing===void 0?i:this._normalizeBearing(e.bearing,i),l=e.pitch===void 0?a:+e.pitch,u=e.roll===void 0?n:this._normalizeBearing(e.roll,n),h=e.padding===void 0?r.padding:e.padding,c=M.convert(e.offset),d=r.centerPoint.add(c),p=r.screenPointToLocation(d),f=this.cameraHelper.handleFlyTo(r,{bearing:o,pitch:l,roll:u,padding:h,locationAtOffset:p,offsetAsPoint:c,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),m=e.curve,g=Math.max(r.width,r.height),_=g/f.scaleOfZoom,y=f.pixelPathLength,v=g/f.scaleOfMinZoom;m=Math.min(m,Math.sqrt(v/y*2));let x=m*m;function w(T){let E=(_*_-g*g+(T?-1:1)*x*x*y*y)/(2*(T?_:g)*x*y);return Math.log(Math.sqrt(E*E+1)-E)}function b(T){return(Math.exp(T)-Math.exp(-T))/2}function S(T){return(Math.exp(T)+Math.exp(-T))/2}function A(T){return b(T)/S(T)}let P=w(!1),I=function(T){return S(P)/S(P+m*T)},R=function(T){return g*((S(P)*A(P+m*T)-b(P))/x)/y},F=(w(!0)-P)/m;if(Math.abs(y)<2e-6||!isFinite(F)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let T=_<g?-1:1;F=Math.abs(Math.log(_/g))/m,R=()=>0,I=E=>Math.exp(T*m*E)}if(e.duration!==void 0)e.duration=+e.duration;else{let T=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/m;e.duration=1e3*F/T}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==o,this._pitching=l!==a,this._rolling=u!==n,this._padding=!r.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter,r),this._ease(T=>{let E=T*F,D=1/I(E),C=R(E);this._rotating&&r.setBearing(We.number(i,o,T)),this._pitching&&r.setPitch(We.number(a,l,T)),this._rolling&&r.setRoll(We.number(n,u,T)),this._padding&&(r.interpolatePadding(s,h,T),d=r.centerPoint.add(c)),f.easeFunc(T,D,C,d),this.terrain&&!e.freezeElevation&&this._updateElevation(T,r),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation?this._finalizeElevation():this.elevationFreeze=!1,this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,r){r.animate===!1||r.duration===0?(e(1),t()):(this._easeStart=Fe(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=fr(e,-180,180);let r=Math.abs(e-t);return Math.abs(e-360-t)<r&&(e-=360),Math.abs(e+360-t)<r&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const Tx={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var L5=class{constructor(e=Tx){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&(t.type==="terrain"||t.dataType==="style"||t.dataType==="source"&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=at.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=at.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=at.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(){this._container.remove(),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 r=this._map._getUIString(`AttributionControl.${t}`);e.title=r,e.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(i=>typeof i=="string"?i:"")):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let t=this._map.style.tileManagers;for(let i in t){let a=t[i];if(a.used||a.usedForTerrain){let n=a.getSource();n.attribution&&!e.includes(n.attribution)&&e.push(n.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,a)=>i.length-a.length),e=e.filter((i,a)=>{for(let n=a+1;n<e.length;n++)if(e[n].includes(i))return!1;return!0});let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.replaceChildren(at.sanitize(r)),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},B5=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let r=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&r.classList.add("maplibregl-compact"):r.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){var r;this._map=e,this._compact=(r=this.options)==null?void 0:r.compact,this._container=at.create("div","maplibregl-ctrl");let t=at.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(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},O5=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(let i of r)if(i.id===e){i.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];let r=!1,i;for(let a of t)if(!a.cancelled){try{a.callback(e)}catch(n){r||(r=!0,i=n)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,r)throw i}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const Rg=["none","zoom","sourceTiles","visibleLayers","revision"];var $5=class{constructor(e,t,r,i){this._tileKeys=e.map(a=>a.key).sort().join(),this._revision=t,this._zoom=r,this._visibleLayerIds=i}difference(e){return this._revision===(e==null?void 0:e._revision)?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};const va={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var j5=class{constructor(e,t){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t){let r=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(o=>!e._layers[o].isHidden(t));let i=this._renderableLayerIds.join(),a=new Set;for(let o of this._renderableLayerIds){let l=e._layers[o],u=l.source;u&&va[l.type]&&a.add(u)}this._coordsAscending={},this._rttFingerprints={};for(let o of a){let l=e.tileManagers[o];if(!l)continue;this._coordsAscending[o]={};let u=this._coordsAscending[o],h=l.getSource(),c=h instanceof ws?h.terrainTileRanges:null;for(let f of l.getVisibleCoordinates()){let m=this.terrain.tileManager.getTerrainCoords(f,c);for(let g in m)u[g]||(u[g]=[]),u[g].push(m[g])}this._rttFingerprints[o]={};let d=this._rttFingerprints[o],p=l.getState().revision;for(let f in u)d[f]=new $5(u[f],p,t,i)}this.needsFollowUpFrame=!1;let n=r||this.painter.options.moving,s=!1;for(let o of this._renderableTiles){let l=this._textureDifference(o);l!=="none"&&(l==="zoom"&&n||l==="visibleLayers"&&r?this.needsFollowUpFrame=!0:l==="zoom"||l==="sourceTiles"?(s?this.needsFollowUpFrame=!0:o.releaseRTT(this.painter),s=!0):o.releaseRTT(this.painter))}}_textureDifference(e){let t="none";for(let r in this._rttFingerprints){let i=this._rttFingerprints[r][e.tileID.key];if(!i)continue;let a=i.difference(e.rttFingerprint[r]);Rg.indexOf(a)>Rg.indexOf(t)&&(t=a)}return t}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let r=e.type,i=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(va[r]&&((!this._prevType||!va[this._prevType])&&this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(va[this._prevType]||va[r]&&a){this._prevType=r;let n=this._stacks.length-1,s=this._stacks[n]||[];t.isRenderingToTexture=!0;for(let o of this._renderableTiles){if(this._rttTiles.push(o),o.getRTT(n))continue;let l=o.acquireRTT(i,n,this.rttSize);i.bindRTT(l),i.context.clear({color:oe.transparent,stencil:0}),i.currentStencilSource=void 0;for(let u of s){let h=i.style._layers[u],c=h.source?this._coordsAscending[h.source][o.tileID.key]:[o.tileID];i.context.viewport.set([0,0,this.rttSize,this.rttSize]),i.renderTileClippingMasks(h,c),i.renderLayer(i,i.style.tileManagers[h.source],h,c,t),h.source&&(o.rttFingerprint[h.source]=this._rttFingerprints[h.source][o.tileID.key])}l.texture.generateMipmap()}return t.isRenderingToTexture=!1,qF(this.painter,this.terrain,this._rttTiles,t),this._rttTiles=[],va[r]}return!1}};const V5={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},N5=dC,kg={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Tx,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Yi.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var U5=class extends kt{get _ownerWindow(){var e,t;return((t=(e=this._container)==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)||window}constructor(e){var a,n,s;super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new O5,this._controls=[],this._mapId=Ug(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=o=>{if(o.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new Wu("webglcontextlost",{originalEvent:o}));return}for(let l of Object.values(this.style._layers))if(l.type==="custom"&&console.warn(`Custom layer with id '${l.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),l._listeners)for(let[u]of Object.entries(l._listeners))console.warn(`Custom layer with id '${l.id}' had event listeners for event '${u}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new Wu("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let l in this._lostContextStyle.images){let u=this._lostContextStyle.images[l];u.isWebGLImage&&this.style.imageManager.updateImage(l,u,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(l){this.fire(new Y(l));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new Wu("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...kg,...e,canvasContextAttributes:{...kg.canvasContextAttributes,...e.canvasContextAttributes}};if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new k5({minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,requestRenderFrame:o=>this._requestRenderFrame(o),cancelRenderFrame:o=>this._cancelRenderFrame(o),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>{var o;return(o=this._handlers)==null?void 0:o.stop(!1)}}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=t.trackResize===!0,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale={...V5,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),t.reduceMotion!==void 0&&(Xt.prefersReducedMotion=t.reduceMotion),this._requestManager=new bC(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(o){throw this._cleanupContainer(),o}this._imageQueueHandle=Ur.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.markTerrainDepthDirty(),this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new R5(this,this._camera,t),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let r=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash?new JF(r).addTo(this):void 0,(a=this._hash)!=null&&a._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,H({},t.fitBoundsOptions,{duration:0}))));let i=typeof t.style=="string"||((s=(n=t.style)==null?void 0:n.projection)==null?void 0:s.type)!=="globe";this.resize(null,i),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new L5(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new B5,t.logoPosition),this.on("style.load",()=>{if(i||this._resizeTransform(),this._camera.transform.unmodified){let o=os(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(o)}}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(o.dataType==="style"?new Tr("styledata",o):new Ne("sourcedata",o))}),this.on("dataloading",o=>{this.fire(o.dataType==="style"?new Tr("styledataloading",o):new Ne("sourcedataloading",o))}),this.on("dataabort",o=>{this.fire(new Ne("sourcedataabort",o))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!(e!=null&&e.onAdd))return this.fire(new Y(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let r=e.onAdd(this);this._controls.push(e);let i=this._controlPositions[t];return t.includes("bottom")?i.insertBefore(r,i.firstChild):i.appendChild(r),this}removeControl(e){if(!(e!=null&&e.onRemove))return this.fire(new Y(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return en(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new ee(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,r){return this._camera.panBy(e,t,r),this}panTo(e,t,r){return this._camera.panTo(e,t,r),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,r){return this._camera.zoomTo(e,t,r),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,r){return this._camera.rotateTo(e,t,r),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.transform.roll}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,r){return this._camera.fitBounds(e,t,r),this}fitScreenCoordinates(e,t,r,i,a){return this._camera.fitScreenCoordinates(e,t,r,i,a),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateAnchoredCameraOptions(e){return this._camera.calculateAnchoredCameraOptions(e)}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(ee.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,r,i){return i==null&&this.terrain&&(i=this.terrain.getElevationForLngLat(r,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t,r,i??0)}resize(e,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);let r=!this._camera._moving;return r&&(this.stop(),this.fire(new J("movestart",e)).fire(new J("move",e))),this.fire(new bt("resize",e)),r&&this.fire(new J("moveend",e)),this}_resizeInternal(e=!0){let[t,r]=this._containerDimensions(),i=this._getClampedPixelRatio(t,r);if(this._resizeCanvas(t,r,i),this.painter.resize(t,r,i),this.painter.overLimit()){let a=this.painter.context.gl;this._maxCanvasSize=[a.drawingBufferWidth,a.drawingBufferHeight];let n=this._getClampedPixelRatio(t,r);this._resizeCanvas(t,r,n),this.painter.resize(t,r,n)}this._resizeTransform(e)}_resizeTransform(e=!0){var i;let[t,r]=this._containerDimensions();this._camera.transform.resize(t,r,e),(i=this._camera._requestedCameraState)==null||i.resize(t,r,e)}_getClampedPixelRatio(e,t){let{0:r,1:i}=this._maxCanvasSize,a=this.getPixelRatio(),n=e*a,s=t*a,o=n>r?r/n:1,l=s>i?i/s:1,u=Math.min(o,l);return u<1&&_e("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),u*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.applyTransformChange(t=>t.setMaxBounds(Wr.convert(e))),this._update()}setMinZoom(e){if(e??(e=-2),e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom;return this._camera.applyTransformChange(r=>r.setMinZoom(e)),this._update(),t!==this._camera.transform.zoom&&this.fire(new J("zoomstart")).fire(new J("zoom")).fire(new J("zoomend")).fire(new J("movestart")).fire(new J("move")).fire(new J("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=!1){let t=this._camera.transform;return e?t.applyConstrain(t.center,t.minZoom).zoom:t.minZoom}setMaxZoom(e){if(e??(e=22),e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom;return this._camera.applyTransformChange(r=>r.setMaxZoom(e)),this._update(),t!==this._camera.transform.zoom&&this.fire(new J("zoomstart")).fire(new J("zoom")).fire(new J("zoomend")).fire(new J("movestart")).fire(new J("move")).fire(new J("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??(e=0),e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this._camera.transform.maxPitch){let t=this._camera.transform.pitch;return this._camera.applyTransformChange(r=>r.setMinPitch(e)),this._update(),t!==this._camera.transform.pitch&&this.fire(new J("pitchstart")).fire(new J("pitch")).fire(new J("pitchend")).fire(new J("movestart")).fire(new J("move")).fire(new J("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??(e=60),e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this._camera.transform.minPitch){let t=this._camera.transform.pitch;return this._camera.applyTransformChange(r=>r.setMaxPitch(e)),this._update(),t!==this._camera.transform.pitch&&this.fire(new J("pitchstart")).fire(new J("pitch")).fire(new J("pitchend")).fire(new J("movestart")).fire(new J("move")).fire(new J("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??(e=20),e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.applyTransformChange(t=>t.setRenderWorldCopies(e)),this._update()}setTransformConstrain(e){return this._camera.applyTransformChange(t=>t.setConstrainOverride(e)),this._update()}project(e){return this._camera.transform.locationToScreenPoint(ee.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(M.convert(e),this.terrain)}isMoving(){var e;return this._camera.isMoving()||((e=this._handlers)==null?void 0:e.isMoving())||!1}isZooming(){var e;return this._camera.isZooming()||((e=this._handlers)==null?void 0:e.isZooming())||!1}isRotating(){var e;return this._camera.isRotating()||((e=this._handlers)==null?void 0:e.isRotating())||!1}_createDelegates(e,t,r){if(e==="mouseenter"||e==="mouseover"){let i=!1;return{mousemove:a=>{let n=t.filter(o=>this.getLayer(o)),s=n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n});s.length?i||(i=!0,r.call(this,new ir(e,this,a.originalEvent,{features:s}))):i=!1},mouseout:()=>{i=!1}}}if(e==="mouseleave"||e==="mouseout"){let i=!1;return{mousemove:a=>{let n=t.filter(s=>this.getLayer(s));(n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n})).length?i=!0:i&&(i=!1,r.call(this,new ir(e,this,a.originalEvent)))},mouseout:a=>{i&&(i=!1,r.call(this,new ir(e,this,a.originalEvent)))}}}{let i=a=>{let n=t.filter(o=>this.getLayer(o)),s=n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n});s.length&&(a.features=s,r.call(this,a),delete a.features)};return{[e]:i}}}_addDelegatedListener(e,t){var r;this._delegatedListeners||(this._delegatedListeners={}),(r=this._delegatedListeners)[e]||(r[e]=[]),this._delegatedListeners[e].push(t);for(let i in t.delegates)this.on(i,t.delegates[i])}_removeDelegatedListener(e,t,r){var a;if(!((a=this._delegatedListeners)!=null&&a[e]))return;let i=this._delegatedListeners[e];for(let n=0;n<i.length;n++){let s=i[n];if(s.listener===r&&s.layers.length===t.length&&s.layers.every(o=>t.includes(o))){for(let o in s.delegates)this.off(o,s.delegates[o]);i.splice(n,1);return}}}on(e,t,r){if(r===void 0)return super.on(e,t);let i=typeof t=="string"?[t]:t,a={layers:i,listener:r,delegates:this._createDelegates(e,i,r)};return this._addDelegatedListener(e,a),{unsubscribe:()=>{this._removeDelegatedListener(e,i,r)}}}once(e,t,r){if(r===void 0)return super.once(e,t);let i=typeof t=="string"?[t]:t,a={layers:i,listener:r,delegates:this._createDelegates(e,i,n=>{this._removeDelegatedListener(e,i,r),r.call(this,n)})};return this._addDelegatedListener(e,a),this}off(e,t,r){if(r===void 0)return super.off(e,t);let i=typeof t=="string"?[t]:t;return this._removeDelegatedListener(e,i,r),this}queryRenderedFeatures(e,t){if(!this.style)return[];let r,i=e instanceof M||Array.isArray(e),a=i?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||(t=(i?{}:e)||{}),a instanceof M||typeof a[0]=="number")r=[M.convert(a)];else{let n=M.convert(a[0]),s=M.convert(a[1]);r=[n,new M(s.x,n.y),s,new M(n.x,s.y),n]}return this.style.queryRenderedFeatures(r,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=H({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),this._styleUrl=typeof e=="string"?e:null,t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,a,n;if((i=this._diffStyleRequest)==null||i.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t));return}let r=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new _g(this,t||{});else return this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),(n=(a=this.style)==null?void 0:a.projection)==null||n.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,t,r):this.style.loadJSON(e,t,r),this}_lazyInitEmptyStyle(){this.style||(this.style=new _g(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,t){var r;if((r=this._diffStyleRequest)==null||r.abort(),typeof e=="string"){let i=e;this._diffStyleRequest=new AbortController;let a=this._diffStyleRequest;try{let n=await this._requestManager.transformRequest(i,"Style");if(a.signal.aborted){this._diffStyleRequest=null;return}let s=await xl(n,a);this._diffStyleRequest=null,this._updateDiff(s.data,t)}catch(n){this._diffStyleRequest=null,Si(n)||this.fire(new Y(zt(n)))}}else typeof e=="object"&&(this._diffStyleRequest=null,this._updateDiff(e,t))}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(r){_e(`Unable to perform style diff: ${zt(r).message}. Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){_e("There is no style added to the map.");return}return this.style.loaded()}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){var r;let t=(r=this.style)==null?void 0:r.tileManagers[e];if(t===void 0){this.fire(new Y(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&gs(this,Zt.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this.painter.destroyRTTResources(),this._camera.setTerrain(null);else{let r=this.style.tileManagers[e.source];if(!r)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&r.reload();for(let i in this.style._layers){let a=this.style._layers[i];a.type==="hillshade"&&a.source===e.source&&_e("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===e.source&&_e("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new VM(this.painter,r,e,this._terrainSkirtLength),this.painter.renderToTexture=new j5(this.painter,this.terrain),this._camera.setTerrain(this.terrain),this._terrainDataCallback=i=>this._handleTerrainDataEvent(i,e.source),this.style.on("data",this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new TC({terrain:e})),this}_handleTerrainDataEvent(e,t){var i;if(e.dataType==="style"){this.terrain.tileManager.releaseAllRTT();return}let r=e.sourceId===t;if(r&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),r&&e.tile&&(this.painter.markTerrainDepthDirty(),this._camera.applyTerrainChange()),e.tile){if(((i=e.source)==null?void 0:i.type)==="image"){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){var e;return((e=this.terrain)==null?void 0:e.options)??null}areTilesLoaded(){var t;let e=(t=this.style)==null?void 0:t.tileManagers;for(let r of Object.values(e))if(!r.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){var t;return(t=this.style)==null?void 0:t.getSource(e)}setSourceTileLodParams(e,t,r){if(r){let i=this.getSource(r);if(!i)throw Error(`There is no source with ID "${r}", cannot set LOD parameters`);i.calculateTileZoom=zc(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=zc(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let r=this.style.tileManagers[e];if(!r)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);t===void 0?r.reload(!0):r.refreshTiles(t.map(i=>new Ul(i.z,i.x,i.y)))}addImage(e,t,r={}){var a;this._lazyInitEmptyStyle();let i=this._createStyleImage(t,r);return i?(this.style.addImage(e,i),(a=i.userImage)!=null&&a.onAdd&&i.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){var t;return this._missingStyleImageResolver=e,(t=this.style)==null||t.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:r=1,sdf:i=!1,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l}=t;if(e instanceof HTMLImageElement||Ni(e)){let{width:u,height:h,data:c}=Xt.getImageData(e);return{data:new $e({width:u,height:h},c),pixelRatio:r,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l,sdf:i,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new Y(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`"))),null;{let{width:u,height:h,data:c}=e,d=e,p=nl(d.data);return{data:p?new $e({width:u,height:h}):new $e({width:u,height:h},new Uint8Array(c)),pixelRatio:r,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l,sdf:i,version:0,isWebGLImage:p,userImage:d}}}updateImage(e,t){let r=this.style.getImage(e);if(!r)return this.fire(new Y(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:i,height:a,data:n}=t instanceof HTMLImageElement||Ni(t)?Xt.getImageData(t):t;if(i===void 0||a===void 0)return this.fire(new Y(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(i!==r.data.width||a!==r.data.height)return this.fire(new Y(Error("The width and height of the updated image must be that same as the previous version of the image")));if(r.isWebGLImage=nl(n),r.isWebGLImage)r.userImage=t;else{let s=!(t instanceof HTMLImageElement||Ni(t));r.data.replace(n,s)}return this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new Y(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await Ur.getImage(await this._requestManager.transformRequest(e,"Image"),new AbortController);if(!t.data)throw Error(`Could not load image ${e}: the response is empty`);return t}listImages(){var e;return((e=this.style)==null?void 0:e.listImages())??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){var t;return(t=this.style)==null?void 0:t.getLayer(e)}getLayersOrder(){var e;return((e=this.style)==null?void 0:e.getLayersOrder())??[]}setLayerZoomRange(e,t,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){var i;return(i=this.style)==null||i.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){var a;return(a=this.style)==null||a.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,i=>{i||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,r=>{r||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=Math.floor(this._container.clientWidth)||400,t=Math.floor(this._container.clientHeight)||300),[e,t]}_shouldHandleInitialResize(){var r;if(!((r=this._container)!=null&&r.clientWidth)||!this._container.clientHeight)return!1;let[e,t]=this._containerDimensions();return e!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){let e=!1,t=wx(i=>{this._trackResize&&!this._removed&&(this.resize(i),this.redraw())},50),r=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new r(i=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(i)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e=="string"){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&typeof e=="object"&&e.nodeType===1)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._containerDimensions(),t=this._getClampedPixelRatio(e[0],e[1]),r=this._container;r.classList.add("maplibregl-map");let i=this._canvasContainer=at.create("div","maplibregl-canvas-container",r);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=at.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._resizeCanvas(e[0],e[1],t);let a=this._controlContainer=at.create("div","maplibregl-control-container",r),n=this._controlPositions={};for(let s of["top-left","top-right","bottom-left","bottom-right"])n[s]=at.create("div",`maplibregl-ctrl-${s} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,t,r){let i=Math.round(r*e),a=Math.round(r*t);this._canvas.width=i,this._canvas.height=a,this._canvas.style.width=`${i/r}px`,this._canvas.style.height=`${a/r}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{t=i},{once:!0});let r=this._canvas.getContext("webgl2",e);if(!r)throw new KF(e,t);this.painter=new YF(r,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new SC({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var t;return(t=this.style)!=null&&t._loaded?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var s,o,l,u,h;let t=this._idleTriggered?this._fadeDuration:0,r=((s=this.style.projection)==null?void 0:s.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let c=this._camera.transform.zoom,d=Fe();this.style.zoomHistory.update(c,d);let p=new ze(c,{now:d,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=p.crossFadingFactor();(f!==1||f!==this._crossFadingFactor)&&(i=!0,this._crossFadingFactor=f),this.style.update(p)}let a=((o=this.style.projection)==null?void 0:o.transitionState)>0!==r;this._camera.transform.setTransitionState((l=this.style.projection)==null?void 0:l.transitionState),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=(u=this.style)==null?void 0:u._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new bt("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new bt("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let n=this._sourcesDirty||this._styleDirty||this._placementDirty||((h=this.painter.renderToTexture)==null?void 0:h.needsFollowUpFrame);return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new bt("idle")),this._loaded&&!this._fullyLoaded&&!n&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){var t,r;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),(t=this._diffStyleRequest)==null||t.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Ur.removeThrottleControl(this._imageQueueHandle),(r=this._resizeObserver)==null||r.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new bt("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Xt.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(t){if(!Si(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return N5}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};function G5(e){Yi.WORKER_URL=e}const q5="#DD4B40",Dn="lecodes-user",vo="lecodes-user-halo",Z5="lecodes-user-dot",W5="lecodes-user-heading",hh="lecodes-user-heading",bo={type:"FeatureCollection",features:[]},H5=(e,t)=>{if(e.head.querySelector("style[data-maplibre-css]"))return;const r=e.createElement("style");r.setAttribute("data-maplibre-css",""),r.textContent=t,e.head.appendChild(r)},wo=e=>{if(!e)return null;const[t,r]=e;return!Number.isFinite(t)||!Number.isFinite(r)||r<-90||r>90?null:[t,r]},Lg=(e,t,r)=>{if(typeof e=="number")return{top:e,left:e,bottom:e,right:e};const i=e??{},a=(n,s)=>{if(typeof n=="number")return n;if(typeof n=="string"&&n.endsWith("%")){const o=Number(n.slice(0,-1));return Number.isFinite(o)?s*o/100:0}return 0};return{top:a(i.top,r),left:a(i.left,t),bottom:a(i.bottom,r),right:a(i.right,t)}},X5=e=>typeof e=="string"||typeof e=="number"?e:null,Y5=e=>!e||e.type!=="FeatureCollection"||!Array.isArray(e.features)?e:{...e,features:e.features.map(t=>{const r=(t==null?void 0:t.properties)??{};return r.color==null?{...t,properties:{...r,color:q5}}:t})},K5=e=>{const t=e.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d");return r?(r.scale(2,2),r.beginPath(),r.moveTo(12,1),r.lineTo(18,10),r.lineTo(12,7.5),r.lineTo(6,10),r.closePath(),r.fillStyle="rgb(26,128,255)",r.fill(),r.strokeStyle="#fff",r.lineWidth=1,r.stroke(),r.getImageData(0,0,48,48)):null},J5=(e,t)=>{const r=e/(156543.03392*Math.cos(t*Math.PI/180)),i=["interpolate",["exponential",2],["zoom"],0,r,22,r*4194304];return["step",i,0,10,["min",600,i]]},pk=(e,t,r,i,a)=>{G5(a.workerUrl),H5(i,a.css);const n=t.rotate!==!1,s=t.tilt===!0,o=wo(t.center),l=(()=>{if(t.styleJson!==void 0)try{return JSON.parse(t.styleJson)}catch{return null}return t.style??null})();l||r.error({message:"MapView: `style` must be a URL or a style JSON"});const u=new U5({container:e,style:l??{version:8,sources:{},layers:[]},center:o??[0,0],zoom:t.zoom??(o?12:0),bearing:t.bearing??0,pitch:t.pitch??0,minZoom:t.minZoom,maxZoom:t.maxZoom,attributionControl:!1,dragRotate:n,pitchWithRotate:s,touchPitch:s});n||u.touchZoomRotate.disableRotation();let h=!1,c=new Map,d={},p=null;const f=()=>[e.clientWidth,e.clientHeight],m=()=>{const T=u.getCenter();return{center:[T.lng,T.lat],zoom:u.getZoom(),bearing:u.getBearing(),pitch:u.getPitch()}},g=T=>{var E;return(((E=u.getStyle())==null?void 0:E.layers)??[]).filter(D=>D.source===T).map(D=>D.id)};u.on("load",()=>{c=new Map,p=null,h=!0,r.ready(),I()}),u.on("error",T=>{var E;h||r.error({message:((E=T==null?void 0:T.error)==null?void 0:E.message)??"MapView: failed to load the style"})}),u.on("moveend",()=>{h&&r.moveEnd(m())}),u.on("resize",()=>I());let _=null;u.on("dblclick",()=>{_&&(clearTimeout(_),_=null)}),u.on("click",T=>{_&&clearTimeout(_);const E=T.point,D=[T.lngLat.lng,T.lngLat.lat];_=setTimeout(()=>{_=null,y(E,D)},300)});const y=(T,E)=>{if(!h)return;const D={lngLat:E,point:[T.x,T.y]};for(const C of c.keys()){const k=g(C);if(k.length===0)continue;let B;try{B=u.queryRenderedFeatures([T.x,T.y],{layers:k})}catch{continue}const $=B[0];if(!$)continue;const W=$.properties??{};if(W.cluster===!0||W.cluster==="true"){const ye=u.getSource(C),ce=$.geometry.type==="Point"?$.geometry.coordinates:E;ye==null||ye.getClusterExpansionZoom(Number(W.cluster_id)).then(ke=>u.easeTo({center:ce,zoom:ke}),()=>{});return}const ie=W.id??$.id;r.tap({...D,feature:{source:C,id:X5(ie),properties:W}});return}r.tap(D)},v=()=>new Fp("notReady"),x=(T,E)=>{if(!h)throw v();const D=u.getSource(T);if(!D||D.type!=="geojson")throw new Error(`unknown GeoJSON source "${T}" — call ensureLayer / map.markers(name) first, or declare it in the style`);const C=c.get(T);D.setData((C==null?void 0:C.kind)==="markers"?Y5(E):E)},w=(T,E,D={})=>{if(!h)throw v();if(!c.has(T)){if(u.getSource(T)){c.set(T,{kind:"styleOwned"});return}c.set(T,{kind:E,layerIds:S(T,E,D)})}},b=T=>{var D;const E=c.get(T);if(E){if(c.delete(T),E.kind==="styleOwned"){(D=u.getSource(T))==null||D.setData(bo);return}for(const C of E.layerIds)u.getLayer(C)&&u.removeLayer(C);u.getSource(T)&&u.removeSource(T)}},S=(T,E,D)=>{const C=E==="markers"&&D.cluster===!0;u.addSource(T,{type:"geojson",data:bo,...C?{cluster:!0,clusterRadius:D.clusterRadius??50,...D.clusterMaxZoom===void 0?{}:{clusterMaxZoom:D.clusterMaxZoom}}:{}});const k=[];if(E==="line")k.push({id:`${T}-line`,type:"line",source:T,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":D.color??"rgb(255,64,51)","line-width":D.width??4,"line-opacity":D.opacity??1}});else{const $=C?[["!",["has","point_count"]]]:[];k.push({id:`${T}-dot`,type:"circle",source:T,...C?{filter:["!",["has","point_count"]]}:{},paint:{"circle-radius":8,"circle-color":["get","color"],"circle-stroke-color":"#fff","circle-stroke-width":2}}),k.push({id:`${T}-icon`,type:"symbol",source:T,filter:["all",...$,["has","icon"]],layout:{"icon-image":["get","icon"],"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),k.push({id:`${T}-label`,type:"symbol",source:T,filter:["all",...$,["has","title"]],layout:{"text-field":["get","title"],"text-size":12,"text-anchor":"top","text-offset":[0,.9],"text-optional":!0},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.2}}),C&&(k.push({id:`${T}-clusters`,type:"circle",source:T,filter:["has","point_count"],paint:{"circle-radius":18,"circle-color":"rgb(59,122,214)","circle-stroke-color":"#fff","circle-stroke-width":2}}),k.push({id:`${T}-cluster-count`,type:"symbol",source:T,filter:["has","point_count"],layout:{"text-field":["to-string",["get","point_count"]],"text-size":13,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#fff"}}))}const B=p&&u.getLayer(vo)?vo:void 0;for(const $ of k)u.addLayer($,B);return k.map($=>$.id)},A=(T,E={},D)=>{const C=wo(T);if(!C)throw new Error(`the latitude ${T[1]} is off the globe`);const k={center:C,...E.zoom===void 0?{}:{zoom:E.zoom},...E.bearing===void 0?{}:{bearing:E.bearing},...E.pitch===void 0?{}:{pitch:E.pitch}};D?u.flyTo({...k,duration:E.duration??600}):u.jumpTo(k)},P=(T,E={})=>{const D=T.map(wo).filter(ie=>ie!==null);if(D.length===0)throw new Fp("noPoints");const C=E.animate!==!1,[k,B]=f(),$=new Wr(D[0],D[0]);for(const ie of D)$.extend(ie);const W=E.maxZoom??(D.length===1?16:void 0);u.fitBounds($,{padding:Lg(E.padding,k,B),...W!==void 0?{maxZoom:W}:{},duration:C?600:0})},I=()=>{const[T,E]=f();T===0||E===0||u.setPadding(Lg(d,T,E))},R=()=>{if(p)return;u.addSource(Dn,{type:"geojson",data:bo});const T=K5(i);T&&!u.hasImage(hh)&&u.addImage(hh,T,{pixelRatio:2}),u.addLayer({id:vo,type:"circle",source:Dn,paint:{"circle-color":"rgba(26,128,255,0.18)","circle-radius":0,"circle-pitch-alignment":"map"}}),u.addLayer({id:W5,type:"symbol",source:Dn,filter:["has","heading"],layout:{"icon-image":hh,"icon-rotate":["get","heading"],"icon-rotation-alignment":"map","icon-allow-overlap":!0,"icon-ignore-placement":!0}}),u.addLayer({id:Z5,type:"circle",source:Dn,paint:{"circle-radius":7,"circle-color":"rgb(26,128,255)","circle-stroke-color":"#fff","circle-stroke-width":2.5}}),p={accuracy:null,lat:0}},F=(T,E,D)=>{if(!h)return;R();const C=u.getSource(Dn);if(!(!C||!p)){if(!T){C.setData(bo);return}C.setData({type:"Feature",properties:D==null?{}:{heading:D},geometry:{type:"Point",coordinates:T}}),p.accuracy=E,p.lat=T[1],u.setPaintProperty(vo,"circle-radius",E!=null&&E>0?J5(E,T[1]):0)}};return{el:e,ensureLayer:w,removeLayer:b,setData:x,flyTo:(T,E)=>A(T,E,!0),jumpTo:(T,E)=>A(T,E,!1),fitPoints:P,setPadding:T=>{d=T,I()},getCamera:m,setUserLocation:(T,E)=>F(wo(T),(E==null?void 0:E.accuracy)??null,(E==null?void 0:E.heading)??null),destroy:()=>{_&&clearTimeout(_),u.remove()}}};export{pk as createMap};
|
|
823
|
+
${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:u,getProjectionData:d=>l.getProjectionData({overscaledTileID:new Dt(d.tileID.canonical.z,d.tileID.wrap??0,d.tileID.canonical.z,d.tileID.canonical.x,d.tileID.canonical.y),aligned:d.aligned,applyGlobeMatrix:d.applyGlobeMatrix,applyTerrainMatrix:d.applyTerrainMatrix})},c=s.renderingMode?s.renderingMode:"2d";if(i.currentPass==="offscreen"){let d=s.prerender;d&&(e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),d.call(s,n.gl,h),n.setDirty(),e.setBaseState())}else if(i.currentPass==="translucent"){e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),n.setStencilMode(Ae.disabled);let d=c==="3d"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,me.ReadOnly);n.setDepthMode(d),s.render(n.gl,h),n.setDirty(),e.setBaseState(),n.bindFramebuffer.set(null)}}function GF(e,t){let r=e.context,i=r.gl,a=e.transform,n=et.unblended,s=new me(i.LEQUAL,me.ReadWrite,[0,1]),o=t.tileManager.getRenderableTiles(),l=e.useProgram("terrainDepth");r.bindFramebuffer.set(t.getFramebuffer().framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:oe.white,depth:1});for(let u of o){let h=t.getTerrainMesh(u.tileID),c=t.getTerrainData(u.tileID),d=a.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),p=c3(t.getSkirtLength(a.zoom));l.draw(r,i.TRIANGLES,s,Ae.disabled,n,De.backCCW,p,c,d,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function qF(e,t,r,i){let{isRenderingGlobe:a}=i,n=e.context,s=n.gl,o=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram("terrain");n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height]);for(let c of r){let d=t.getTerrainMesh(c.tileID),p=e.renderToTexture.getTexture(c),f=t.getTerrainData(c.tileID);n.activeTexture.set(s.TEXTURE0),p.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_LINEAR);let m=t.getSkirtLength(o.zoom),g=o.calculateFogMatrix(c.tileID.toUnwrapped()),_=h3(m,g,e.style.sky,o.pitch,a),y=Ft(i,c.tileID,{applyTerrainMatrix:!1});h.draw(n,s.TRIANGLES,u,Ae.disabled,l,De.backCCW,_,f,y,"terrain",d.vertexBuffer,d.indexBuffer,d.segments)}}function bx(e,t){if(!t.mesh){let r=new vi;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let i=new Yr;i.emplaceBack(0,1,2),i.emplaceBack(0,2,3),t.mesh=new bs(e.createVertexBuffer(r,Vi.members),e.createIndexBuffer(i),Ze.simpleSegment(0,0,r.length,i.length))}return t.mesh}function ZF(e,t){let r=e.context,i=r.gl,a=dz(t,e.transform,e.pixelRatio),n=new me(i.LEQUAL,me.ReadWrite,[0,1]),s=Ae.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=bx(r,t);l.draw(r,i.TRIANGLES,n,s,o,De.disabled,a,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function WF(e,t){let r=e.getCartesianPosition();Hx(r,r);let i=Pr(new Float64Array(16));return e.properties.get("anchor")==="map"&&(yi(i,i,t.rollInRadians),Oa(i,i,-t.pitchInRadians),yi(i,i,t.bearingInRadians),Oa(i,i,t.center.lat*Math.PI/180),jg(i,i,-t.center.lng*Math.PI/180)),Xx(r,r,i),r}function HF(e,t,r){let i=e.context,a=i.gl,n=e.useProgram("atmosphere"),s=new me(a.LEQUAL,me.ReadOnly,[0,1]),o=e.transform,l=WF(r,e.transform),u=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=Xa(o.worldSize,o.center.lat),c=X1(o),d=Y1(Sr(c)-h,h),p=t.properties.get("atmosphere-blend")*u.projectionTransition*d;if(p===0)return;let f=hz(l,p,c,h,o.inverseProjectionMatrix),m=bx(i,t);n.draw(i,a.TRIANGLES,s,Ae.disabled,et.alphaBlended,De.disabled,f,null,null,"atmosphere",m.vertexBuffer,m.indexBuffer,m.segments)}const XF={symbol:iF,circle:uF,heatmap:hF,line:bF,fill:wF,fillExtrusion:TF,hillshade:SF,colorRelief:EF,raster:PF,background:MF,sky:ZF,atmosphere:HF,custom:UF,debug:$F,debugPadding:BF,terrainDepth:GF};var Hi,YF=(Hi=class{constructor(t,r){this.drawFunctions=XF,this.context=new Qz(t),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:Pr(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Fc.maxOverzooming+Fc.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new B1}resize(t,r,i){if(this.width=Math.round(t*i),this.height=Math.round(r*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let a of this.style._order)this.style._layers[a].resize()}setup(){let t=this.context,r=new vi;r.emplaceBack(0,0),r.emplaceBack(L,0),r.emplaceBack(0,L),r.emplaceBack(L,L),this.tileExtentBuffer=t.createVertexBuffer(r,Vi.members),this.tileExtentSegments=Ze.simpleSegment(0,0,4,2);let i=new vi;i.emplaceBack(0,0),i.emplaceBack(L,0),i.emplaceBack(0,L),i.emplaceBack(L,L),this.debugBuffer=t.createVertexBuffer(i,Vi.members),this.debugSegments=Ze.simpleSegment(0,0,4,5);let a=new U2;a.emplaceBack(0,0,0,0),a.emplaceBack(L,0,L,0),a.emplaceBack(0,L,0,L),a.emplaceBack(L,L,L,L),this.rasterBoundsBuffer=t.createVertexBuffer(a,n3.members),this.rasterBoundsSegments=Ze.simpleSegment(0,0,4,2);let n=new vi;n.emplaceBack(0,0),n.emplaceBack(L,0),n.emplaceBack(0,L),n.emplaceBack(L,L),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(n,Vi.members),this.rasterBoundsSegmentsPosOnly=Ze.simpleSegment(0,0,4,5);let s=new vi;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(s,Vi.members),this.viewportSegments=Ze.simpleSegment(0,0,4,2);let o=new tw;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);let l=new Yr;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new Ae({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new bs(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=Pi();Lr(i,0,this.width,this.height,0,0,1),Et(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]);let a={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,me.disabled,this.stencilClearMode,et.disabled,De.disabled,null,null,a,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,r){if(this.currentStencilSource===t.source||!t.isTileClipped()||!(r!=null&&r.length))return;this.currentStencilSource=t.source,this.nextStencilID+r.length>256&&this.clearStencil();let i=this.context;i.setColorMode(et.disabled),i.setDepthMode(me.disabled);let a={};for(let n of r)a[n.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,r,!0),this._renderTileMasks(a,r,!1),this._tileClippingMaskIDs=a}_renderTileMasks(t,r,i){let a=this.context,n=a.gl,s=this.style.projection,o=this.renderContext,l=this.useProgram("clippingMask");for(let u of r){let h=t[u.key],c=Vt(o,u),d=s.getMeshFromTileID(this.context,u.canonical,i,!0,"stencil"),p=Ft(o,u);l.draw(a,n.TRIANGLES,me.disabled,new Ae({func:n.ALWAYS,mask:0},h,255,n.KEEP,n.KEEP,n.REPLACE),et.disabled,o.isRenderingToTexture?De.disabled:De.backCCW,null,c,p,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){let t=this.context,r=t.gl,i=this.style.projection,a=this.transform,n=this.useProgram("depth"),s=this.getDepthModeFor3D(),o=en(a,{tileSize:a.tileSize});for(let l of o){let u=Vt(this.renderContext,l),h=i.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),c=Ft(this.renderContext,l);n.draw(t,r.TRIANGLES,s,Ae.disabled,et.disabled,De.backCCW,null,u,c,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,r=this.context.gl;return new Ae({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){let r=this.context.gl;return new Ae({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let r=this.context.gl,i=t.sort((s,o)=>o.overscaledZ-s.overscaledZ),a=i[i.length-1].overscaledZ,n=i[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let s={};for(let o=0;o<n;o++)s[o+a]=new Ae({func:r.GEQUAL,mask:255},o+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=n,[s,i]}return[{[a]:Ae.disabled},i]}stencilConfigForOverlapTwoPass(t){let r=this.context.gl,i=t.sort((s,o)=>o.overscaledZ-s.overscaledZ),a=i[i.length-1].overscaledZ,n=i[0].overscaledZ-a+1;if(this.clearStencil(),n>1){let s={},o={};for(let l=0;l<n;l++)s[l+a]=new Ae({func:r.GREATER,mask:255},n+1+l,255,r.KEEP,r.KEEP,r.REPLACE),o[l+a]=new Ae({func:r.GREATER,mask:255},1+l,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID=n*2+1,[s,o,i]}return this.nextStencilID=3,[{[a]:new Ae({func:r.GREATER,mask:255},2,255,r.KEEP,r.KEEP,r.REPLACE)},{[a]:new Ae({func:r.GREATER,mask:255},1,255,r.KEEP,r.KEEP,r.REPLACE)},i]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let r=.125;return new et([t.CONSTANT_COLOR,t.ONE],new oe(r,r,r,0),[!0,!0,!0,!0])}return this.renderContext.currentPass==="opaque"?et.unblended:et.alphaBlended}getDepthModeForSublayer(t,r,i){if(!this.opaquePassEnabledForLayer())return me.disabled;let a=1-((1+this.renderContext.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new me(i||this.context.gl.LEQUAL,r,[a,a])}getDepthModeFor3D(){return new me(this.context.gl.LEQUAL,me.ReadWrite,this.renderContext.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderContext.currentLayer<this.renderContext.opaquePassCutoff}render(t,r){var h;this.style=t,this.options=r;let i=this.renderContext=eF(this.transform,t.projection,t.map.terrain??null);this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Fe()),Jz(this.context.frameUniformBuffer,this),this.imageManager.beginFrame(),m3(this.context);let a=this.style._order,n=this.style.tileManagers,s={},o={},l={};for(let c in n){let d=n[c];d.used&&d.prepare(this.context),s[c]=d.getVisibleCoordinates(!1),o[c]=s[c].slice().reverse(),l[c]=d.getVisibleCoordinates(!0).reverse()}i.opaquePassCutoff=1/0;for(let c=0;c<a.length;c++){let d=a[c];if(this.style._layers[d].is3D()){i.opaquePassCutoff=c;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),i.opaquePassCutoff=0),i.currentPass="offscreen";for(let c of a){let d=this.style._layers[c];if(!d.hasOffscreenPass()||d.isHidden(this.transform.zoom))continue;let p=o[d.source];(d.type==="custom"||p.length)&&this.renderLayer(this,n[d.source],d,p,i)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?oe.black:oe.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,i.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(i.currentPass="opaque",i.currentLayer=a.length-1;i.currentLayer>=0;i.currentLayer--){let c=this.style._layers[a[i.currentLayer]];if(c.isHidden(this.transform.zoom))continue;let d=n[c.source],p=s[c.source];this.renderTileClippingMasks(c,p),this.renderLayer(this,d,c,p,i)}i.currentPass="translucent";let u=!1;for(i.currentLayer=0;i.currentLayer<a.length;i.currentLayer++){let c=this.style._layers[a[i.currentLayer]];if(c.isHidden(this.transform.zoom))continue;let d=n[c.source];if((h=this.renderToTexture)!=null&&h.renderLayer(c,i))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=!0,i.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let p=(c.type==="symbol"?l:o)[c.source];this.renderTileClippingMasks(c,s[c.source]),this.renderLayer(this,d,c,p,i)}if(i.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=NF(this.style,this.transform.zoom);c&&this.drawFunctions.debug(this,c,c.getVisibleCoordinates(),i)}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.renderToTexture&&!this.options.moving&&this.clearRTTPool(),this.context.setDefault()}markTerrainDepthDirty(){this.terrainFacilitator.depthDirty=!0}maybeDrawDepth(){var a,n;if(!((a=this.style)!=null&&a.projection)||!((n=this.style.map)!=null&&n.terrain))return;let t=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.depthDirty;i||(i=!Zx(t,r)),i||(i=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),i&&(Vx(t,r),this.terrainFacilitator.renderTime=Fe(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t,r,i,a,n){if(i.isHidden(this.transform.zoom)||i.type!=="background"&&i.type!=="custom"&&!(a||[]).length)return;this.id=i.id;let s=this.drawFunctions;B0(i)?s.symbol(t,r,i,a,this.style.placement.variableOffsets,n):Cw(i)?s.circle(t,r,i,a,n):Rw(i)?s.heatmap(t,r,i,a,n):pS(i)?s.line(t,r,i,a,n):ET(i)?s.fill(t,r,i,a,n):YT(i)?s.fillExtrusion(t,r,i,a,n):$w(i)?s.hillshade(t,r,i,a,n):qw(i)?s.colorRelief(t,r,i,a,n):Fh(i)?s.raster(t,r,i,a,n):mE(i)?s.background(t,r,i,a,n):yE(i)&&s.custom(t,r,i,n)}saveTileTexture(t){let r=this._tileTextures[t.size[0]];r?r.length<Hi.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?r.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let r=this._tileTextures[t];return r&&r.length>0?r.pop():null}acquireRTT(t){let r=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==t&&(i.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),i.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),i.size=t),i;let a=new dt(this.context,{width:t,height:t,data:null},r.RGBA,{premultiply:!1,useMipmap:!0});return a.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:a,size:t}}bindRTT(t){let r=this.context.gl,i=t.size;if(!this._rttSharedFbo){let a=this.context.createFramebuffer(i,i,!0,!0),n=this.context.createRenderbuffer(r.DEPTH_STENCIL,i,i);a.depthAttachment.set(n),this._rttSharedFbo={fbo:a,depthRenderbuffer:n,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}clearRTTPool(){for(let t of this._rttObjectRecyclePool)t.texture.destroy();this._rttObjectRecyclePool.length=0}destroyRTTResources(){if(this.clearRTTPool(),!this._rttSharedFbo)return;this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let r=this.patternAtlas.getPattern(t.from.toString()),i=this.patternAtlas.getPattern(t.to.toString());return!r||!i}useProgram(t,r,i=!1,a=[]){var m;this.cache||(this.cache={});let n=!!this.style.map.terrain,s=this.style.projection,o=i?Vr.projectionMercator:s.shaderPreludeCode,l=i?O1:s.shaderDefine,u=`/${i?$1:s.shaderVariantName}`,h=r?r.cacheKey:"",c=this._showOverdrawInspector?"/overdraw":"",d=n?"/terrain":"",p=a?`/${a.join("/")}`:"",f=t+h+u+c+d+p;return(m=this.cache)[f]||(m[f]=new v3(this.context,Vr[t],r,pz[t],this._showOverdrawInspector,n,o,l,a)),this.cache[f]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new dt(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){var t,r,i;if(this._tileTextures){for(let a in this._tileTextures){let n=this._tileTextures[a];if(n)for(let s of n)s.destroy()}this._tileTextures={}}if(this.destroyRTTResources(),(t=this.layerOpacityFbo)==null||t.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((r=this.tileExtentMesh.vertexBuffer)==null||r.destroy()),this.tileExtentMesh&&((i=this.tileExtentMesh.indexBuffer)==null||i.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),g3(this.context),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let a in this.cache){let n=this.cache[a];n!=null&&n.program&&this.context.gl.deleteProgram(n.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:r}=this.context.gl;return this.width!==t||this.height!==r}},Hi.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,Hi),KF=class extends Error{constructor(e,t){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=(t==null?void 0:t.statusMessage)??null}};function wx(e,t){let r=!1,i=null,a,n=()=>{i=null,r&&(r=(e(...a),i=setTimeout(n,t),!1))};return(...s)=>(r=!0,a=s,i||n(),i)}var JF=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):([...t.keys()][0]??"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:r,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let n=Array.from(t.keys());n.length>0&&t.delete(n[0])}let r=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=r?`#${r}`:"",a=window.location.href.replace(/(#.+)?$/,i);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=wx(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),r=Math.round(this._map.getZoom()*100)/100,i=10**Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(t.lng*i)/i,n=Math.round(t.lat*i)/i,s=this._map.getBearing(),o=this._map.getPitch(),l="";if(l+=e?`/${a}/${n}/${r}`:`${r}/${n}/${a}`,(s||o)&&(l+=`/${Math.round(s*10)/10}`),o&&(l+=`/${Math.round(o)}`),this._hashName){let u=this._getHashParams();return u.set(this._hashName,l),`#${decodeURIComponent(u.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${l}`}_isValidHash(e){if(e.length<3||e.some(a=>isNaN(+a)))return!1;try{new ee(+e[2],+e[1])}catch{return!1}let t=+e[0],r=+(e[3]||0),i=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&r>=-180&&r<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}};const Ts={linearity:.3,easing:qc(0,0,.3,1)},QF=H({deceleration:2500,maxSpeed:1400},Ts),e5=H({deceleration:20,maxSpeed:1400},Ts),t5=H({deceleration:1e3,maxSpeed:360},Ts),r5=H({deceleration:1e3,maxSpeed:90},Ts),i5=H({deceleration:1e3,maxSpeed:360},Ts);var a5=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Fe(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=Fe();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=Fe()-60,r=Math.max(0,e.length-2);for(;r>0&&e[r-1].time>=t;)r--;return e.slice(r)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2){this.clear();return}let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new M(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of t)n.around&&(r.around=n.around),n.pinchAround&&(r.pinchAround=n.pinchAround);for(let{settings:n}of t.slice(1))r.zoom+=n.zoomDelta||0,r.bearing+=n.bearingDelta||0,r.pitch+=n.pitchDelta||0,r.roll+=n.rollDelta||0,n.panDelta&&r.pan._add(n.panDelta);if(!r.pan.mag()&&!r.zoom&&!r.bearing&&!r.pitch&&!r.roll){this.clear();return}let i=Fe()-t[0].time,a={};if(r.pan.mag()){let n=Sn(r.pan.mag(),i,H({},QF,e||{})),s=r.pan.mult(n.amount/r.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);a.center=o.easingCenter,a.offset=o.easingOffset,Tn(a,n)}if(r.zoom){let n=Sn(r.zoom,i,e5);a.zoom=rr(this._map.getZoom()+n.amount,this._map.getZoomSnap(),n.amount),Tn(a,n)}if(r.bearing){let n=Sn(r.bearing,i,t5);a.bearing=this._map.getBearing()+se(n.amount,-179,179),Tn(a,n)}if(r.pitch){let n=Sn(r.pitch,i,r5);a.pitch=this._map.getPitch()+n.amount,Tn(a,n)}if(r.roll){let n=Sn(r.roll,i,i5);a.roll=this._map.getRoll()+se(n.amount,-179,179),Tn(a,n)}if(a.zoom||a.bearing){let n=r.pinchAround===void 0?r.around:r.pinchAround;a.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),H(a,{noMoveStart:!0})}};function Tn(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Sn(e,t,r){let{maxSpeed:i,linearity:a,deceleration:n}=r,s=se(e*a/(t/1e3),-i,i),o=Math.abs(s)/(n*a);return{easing:r.easing,duration:o*1e3,amount:o/2*s}}var n5=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new wC(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new ir(e.type,this._map,e))}mouseup(e){this._map.fire(new ir(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new ir(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ir(e.type,this._map,e))}mouseover(e){this._map.fire(new ir(e.type,this._map,e))}mouseout(e){this._map.fire(new ir(e.type,this._map,e))}touchstart(e){return this._firePreventable(new no(e.type,this._map,e))}touchmove(e){this._map.fire(new no(e.type,this._map,e))}touchend(e){this._map.fire(new no(e.type,this._map,e))}touchcancel(e){this._map.fire(new no(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},s5=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent,this._clearLongPress(),this._touchActive=!1}mousemove(e){this._map.fire(new ir(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ir("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}touchstart(e,t,r){if(this._clearLongPress(),this._touchActive=r.length>0,r.length!==1)return;this._longPressStart=t[0];let i=r[0];this._longPressTimer=setTimeout(()=>{this._longPressTimer=void 0;let a=new MouseEvent("contextmenu",{clientX:i.clientX,clientY:i.clientY,button:2,bubbles:!0,cancelable:!0});this._map.fire(new ir("contextmenu",this._map,a))},500)}touchmove(e,t,r){this._longPressTimer&&(r.length!==1||!this._longPressStart||t[0].dist(this._longPressStart)>this._clickTolerance)&&this._clearLongPress()}touchend(){this._touchActive=!1,this._clearLongPress()}touchcancel(){this._touchActive=!1,this._clearLongPress()}_clearLongPress(){this._longPressTimer&&(this._longPressTimer=(clearTimeout(this._longPressTimer),void 0)),this._longPressStart=void 0}contextmenu(e){if(this._touchActive){e.preventDefault();return}this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ir(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},o5=class{constructor(e,t,r){this._map=e,this._tr=r,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&typeof t.boxZoom=="object"&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(at.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let r=t;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=r,this._box||(this._box=at.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let a=Math.min(i.x,r.x),n=Math.max(i.x,r.x),s=Math.min(i.y,r.y),o=Math.max(i.y,r.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=`${n-a}px`,this._box.style.height=`${o-s}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let r=this._startPos,i=t;if(this.reset(),at.suppressClick(),r.x===i.x&&r.y===i.y)this._fireEvent("boxzoomcancel",e);else{if(this._map.fire(new Dm("boxzoomend",{originalEvent:e})),this._boxZoomEnd){this._boxZoomEnd(this._map,r,i,e);return}return{cameraAnimation:a=>a.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})}}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box=(this._box.remove(),null)),at.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new Dm(e,{originalEvent:t}))}};function $c(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let r={};for(let i=0;i<e.length;i++)r[e[i].identifier]=t[i];return r}function l5(e){let t=new M(0,0);for(let r of e)t._add(r);return t.div(e.length)}var u5=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=l5(t),this.touches=$c(r,t)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;let i=$c(r,t);for(let a in this.touches){let n=this.touches[a],s=i[a];(!s||s.dist(n)>30)&&(this.aborted=!0)}}touchend(e,t,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),r.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},jc=class{constructor(e){this.singleTap=new u5(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,r){this.singleTap.touchstart(e,t,r)}touchmove(e,t,r){this.singleTap.touchmove(e,t,r)}touchend(e,t,r){let i=this.singleTap.touchend(e,t,r);if(i){let a=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(i)<30;if((!a||!n)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}},h5=class{constructor(e,t){this._tr=t,this._zoomIn=new jc({numTouches:1,numTaps:2}),this._zoomOut=new jc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,r){this._zoomIn.touchstart(e,t,r),this._zoomOut.touchstart(e,t,r)}touchmove(e,t,r){this._zoomIn.touchmove(e,t,r),this._zoomOut.touchmove(e,t,r)}touchend(e,t,r){let i=this._zoomIn.touchend(e,t,r),a=this._zoomOut.touchend(e,t,r),n=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:rr(n.zoom+1,s.getZoomSnap()),around:n.transform.isPointOnMapSurface(i)?n.unproject(i):void 0},{originalEvent:e})};if(a)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:rr(n.zoom-1,s.getZoomSnap()),around:n.transform.isPointOnMapSurface(a)?n.unproject(a):void 0},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Hl=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let i=Array.isArray(t)?t[0]:t;if(!(!this._moved&&i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&at.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}};const c5={0:1,2:2};function d5(e,t){let r=c5[t];return e.buttons===void 0||(e.buttons&r)!==r}var Xl=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!d5(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}};const Yl=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};function p5({enable:e,clickTolerance:t}){return new Hl({clickTolerance:t,move:(r,i)=>({around:i,panDelta:i.sub(r)}),activateOnStart:!0,moveStateManager:new Xl({checkCorrectEvent:r=>r.button===0&&!r.ctrlKey}),enable:e,assignEvents:Yl})}function f5({enable:e,clickTolerance:t,aroundCenter:r=!0,minPixelCenterThreshold:i=100,rotateSpeed:a=.8},n){return new Hl({clickTolerance:t,move:(s,o)=>{let l=n();if(r&&Math.abs(l.y-s.y)>i)return{bearingDelta:Ev(new M(s.x,o.y),o,l)};let u=(o.x-s.x)*a;return r&&o.y<l.y&&(u=-u),{bearingDelta:u}},moveStateManager:new Xl({checkCorrectEvent:s=>s.button===0&&s.ctrlKey||s.button===2&&!s.ctrlKey}),enable:e,assignEvents:Yl})}function m5({enable:e,clickTolerance:t,pitchSpeed:r=-.5}){return new Hl({clickTolerance:t,move:(i,a)=>({pitchDelta:(a.y-i.y)*r}),moveStateManager:new Xl({checkCorrectEvent:i=>i.button===0&&i.ctrlKey||i.button===2}),enable:e,assignEvents:Yl})}function g5({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:r=.3},i){return new Hl({clickTolerance:t,move:(a,n)=>{let s=i(),o=(n.x-a.x)*r;return n.y<s.y&&(o=-o),{rollDelta:o}},moveStateManager:new Xl({checkCorrectEvent:a=>a.button===2&&a.ctrlKey}),enable:e,assignEvents:Yl})}var _5=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new M(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,r){return this._calculateTransform(e,t,r)}touchmove(e,t,r){if(this._active){if(this._shouldBePrevented(r.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t,r)}}touchend(e,t,r){this._calculateTransform(e,t,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,r){r.length>0&&(this._active=!0);let i=$c(r,t),a=new M(0,0),n=new M(0,0),s=0;for(let l in i){let u=i[l],h=this._touches[l];h&&(a._add(u),n._add(u.sub(h)),s++,i[l]=u)}if(this._touches=i,this._shouldBePrevented(s)||!n.mag())return;let o=n.div(s);if(this._sum._add(o),!(this._sum.mag()<this._clickTolerance))return{around:a.div(s),panDelta:o}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},np=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,r){if(!this._firstTwoTouches)return;e.preventDefault();let[i,a]=this._firstTwoTouches,n=yo(r,t,i),s=yo(r,t,a);if(!n||!s)return;let o=this._aroundCenter?null:n.add(s).div(2);return this._move([n,s],o,e)}touchend(e,t,r){if(!this._firstTwoTouches)return;let[i,a]=this._firstTwoTouches,n=yo(r,t,i),s=yo(r,t,a);n&&s||(this._active&&at.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function yo(e,t,r){for(let i=0;i<e.length;i++)if(e[i].identifier===r)return t[i]}const Ig=.1;function Mg(e,t){return Math.log(e/t)/Math.LN2}var y5=class extends np{constructor(){super(),this._zoomRate=1,this._zoomThreshold=Ig}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??Ig}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let r=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(Mg(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:Mg(this._distance,r)*this._zoomRate,pinchAround:t}}};function zg(e,t){return e.angleWith(t)*180/Math.PI}var x5=class extends np{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,r){let i=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:zg(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,r=zg(e,this._startVector);return Math.abs(r)<t}};function lh(e){return Math.abs(e.y)>Math.abs(e.x)}var v5=class extends np{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,r){super.touchstart(e,t,r),this._currentTouchCount=r.length}_start(e){this._lastPoints=e,lh(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let i=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(i,a,r.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(i.y+a.y)/2*-.5}}gestureBeginsVertically(e,t,r){if(this._valid!==void 0)return this._valid;let i=e.mag()>=2,a=t.mag()>=2;if(!i&&!a)return;if(!i||!a)return this._firstMove===void 0&&(this._firstMove=r),r-this._firstMove<100&&void 0;let n=e.y>0==t.y>0;return lh(e)&&lh(t)&&n}};const b5={panStep:100,bearingStep:15,pitchStep:10};var w5=class{constructor(e,t){this._tr=t;let r=b5;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,r=0,i=0,a=0,n=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?r=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),n=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:s=>{let o=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:T5,zoom:t?rr(o.zoom+t*(e.shiftKey?2:1),s.getZoomSnap()):o.zoom,bearing:o.bearing+r*this._bearingStep,pitch:o.pitch+i*this._pitchStep,offset:[-a*this._panStep,-n*this._panStep],center:o.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function T5(e){return e*(2-e)}const Fg=4.000244140625;var S5=class{constructor(e,t,r){this._onTimeout=i=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)},this._map=e,this._tr=r,this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,r=Fe(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,t!==0&&t%Fg==0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&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._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=at.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(ee.convert(r.center)):t,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let s=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=s),typeof this._targetZoom=="number"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>Fg?this._wheelZoomRate:this._defaultZoomRate,o=2/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&o!==0&&(o=1/o);let l=typeof this._targetZoom=="number"?$t(this._targetZoom):e.scale,u=e.applyConstrain(e.getCameraLngLat(),It(l*o)).zoom,h=this._map.getZoomSnap();if(this._type==="wheel"&&h>0){let c=rr(e.zoom,h);this._targetZoom=rr(u,h,u-c)}else this._targetZoom=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,r=this._startZoom,i=this._easing,a=!1,n;if(this._type==="wheel"&&r&&i){let s=Fe()-this._lastWheelEventTime,o=Math.min((s+5)/200,1),l=i(o);n=We.number(r,t,l),o<1?this._needsRerender=!0:a=!0}else n=t,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=n,{noInertia:!0,needsRenderFrame:!a,zoomDelta:n-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=gh;if(this._prevEase){let r=this._prevEase,i=(Fe()-r.start)/r.duration,a=r.easing(i+.01)-r.easing(i),n=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-n*n);t=qc(n,s,.25,1)}return this._prevEase={start:Fe(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},D5=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},E5=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:rr(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.transform.isPointOnMapSurface(t)?this._tr.unproject(t):void 0},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},P5=class{constructor(){this._tap=new jc({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,r){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,r);else{let i=t[0],a=e.timeStamp-this._tapTime<500,n=this._tapPoint.dist(i)<30;!a||!n?this.reset():r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier)}}touchmove(e,t,r){if(!this._tapTime)this._tap.touchmove(e,t,r);else if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let i=t[0],a=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}touchend(e,t,r){if(this._tapTime)this._swipePoint&&r.length===0&&this.reset();else{let i=this._tap.touchend(e,t,r);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},A5=class{constructor(e,t,r){this._el=e,this._mousePan=t,this._touchPan=r}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},C5=class{constructor(e,t,r,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=r,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},I5=class{constructor(e,t,r,i){this._el=e,this._touchZoom=t,this._touchRotate=r,this._tapDragZoom=i,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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},M5=class{constructor(e,t){this._bypassKey=navigator.userAgent.includes("Mac")?"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=at.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=t,this._container.appendChild(i);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=r,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new bt("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},z5=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(M.convert(e),this._camera.terrain)}};const xo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var F5=class extends us{};function uh(e){var t;return((t=e.panDelta)==null?void 0:t.mag())||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var R5=class{get _ownerDocument(){var e;return((e=this._el)==null?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,t;return((t=(e=this._el)==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)||window}constructor(e,t,r){this._terrainGesture={inFlight:!1,anchorElevation:null},this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,n)=>{if(a.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let s=a.type==="renderFrame"?void 0:a,o={needsRenderFrame:!1},l={},u={};for(let{handlerName:d,handler:p,allowed:f}of this._handlers){if(!p.isEnabled())continue;let m;if(this._blockedByActive(u,f,d))p.reset();else if(p[n||a.type]){if(Av(a,n||a.type)){let g=at.mousePos(this._map.getCanvas(),a);m=p[n||a.type](a,g)}else if(Pv(a,n||a.type)){let g=a.touches,_=this._getMapTouches(g),y=at.touchPos(this._map.getCanvas(),_);m=p[n||a.type](a,y,_)}else Cv(n||a.type)||(m=p[n||a.type](a));this.mergeHandlerResult(o,l,m,d,s),m!=null&&m.needsRenderFrame&&this._triggerRenderFrame()}(m||p.isActive())&&(u[d]=p)}let h={};for(let d in this._previousActiveHandlers)u[d]||(h[d]=s);this._previousActiveHandlers=u,(Object.keys(h).length||uh(o))&&(this._changes.push([o,l,h]),this._triggerRenderFrame()),(Object.keys(u).length||uh(o))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=o;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._camera=t,this._transformProvider=new z5(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new a5(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);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],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"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],[this._ownerWindow,"blur",void 0]];for(let[a,n,s]of this._listeners)a.addEventListener(n,a===this._ownerDocument?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(let[e,t,r]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(e){let t=this._map,r=t.getCanvasContainer();this._add("mapEvent",new n5(t,e));let i=t.boxZoom=new o5(t,e,this._transformProvider);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let a=t.cooperativeGestures=new M5(t,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let n=new h5(t,this._transformProvider),s=new E5(t,this._transformProvider);t.doubleClickZoom=new D5(s,n),this._add("tapZoom",n),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let o=new P5;this._add("tapDragZoom",o);let l=t.touchPitch=new v5(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>this._camera.transform.centerPoint,h=f5(e,u),c=m5(e),d=g5(e,u);t.dragRotate=new C5(e,h,c,d),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=p5(e),f=new _5(e,t);t.dragPan=new A5(r,p,f),this._add("mousePan",p),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let m=new x5,g=new y5;t.touchZoomRotate=new I5(r,g,m,o),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new s5(t,e),["touchPan"]);let _=t.scrollZoom=new S5(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let y=t.keyboard=new w5(t,this._transformProvider);this._add("keyboard",y),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),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!!xo(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,r){for(let i in e)if(i!==r&&!(t!=null&&t.includes(i)))return!0;return!1}_getMapTouches(e){let t=[];for(let r of e){let i=r.target;this._el.contains(i)&&t.push(r)}return t}mergeHandlerResult(e,t,r,i,a){if(!r)return;H(e,r);let n={handlerName:i,originalEvent:r.originalEvent||a};r.zoomDelta!==void 0&&(t.zoom=n),r.panDelta!==void 0&&(t.drag=n),r.rollDelta!==void 0&&(t.roll=n),r.pitchDelta!==void 0&&(t.pitch=n),r.bearingDelta!==void 0&&(t.rotate=n)}_applyChanges(){let e={},t={},r={};for(let[i,a,n]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new M(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),H(t,a),H(r,n);this._updateMapTransform(e,t,r),this._changes=[]}_updateMapTransform(e,t,r){let i=this._map.terrain;if(!uh(e)){this._fireEvents(t,r,!0);return}let a=this._camera.getTransformForUpdate();this._camera.stop(!0);let{panDelta:n,zoomDelta:s,bearingDelta:o,pitchDelta:l,rollDelta:u}=e,{around:h,aroundOnSurface:c}=this._resolveAround(e,i,a),d=i?this._terrainGestureElevation(i,h,c,a,t):void 0,p={panDelta:n,zoomDelta:s,rollDelta:u,pitchDelta:l,bearingDelta:o,around:h,aroundElevation:d};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(h)&&(h=a.centerPoint);let f=this._computePreZoomAroundLoc(a,h,n,d);this._handleMapControls({terrain:i,tr:a,deltasForHelper:p,preZoomAroundLoc:f,combinedEventsInProgress:t,panDelta:n}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_resolveAround(e,t,r){let i=e.pinchAround===void 0?e.around:e.pinchAround;return i||(i=this._camera.transform.centerPoint),t&&!r.isPointOnMapSurface(i)?{around:r.centerPoint,aroundOnSurface:!1}:{around:i,aroundOnSurface:!0}}_terrainGestureElevation(e,t,r,i,a){if(!r)return;if(this._terrainGesture.anchorElevation===null&&(a.drag||a.zoom)){let s=i.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGesture.anchorElevation=s?s.z:void 0}let n=this._terrainGesture.anchorElevation;if(n!=null&&!(t.distSqr(i.centerPoint)<.01)&&!(n-i.elevation>=.9*(i.getCameraAltitude()-i.elevation)))return n}_computePreZoomAroundLoc(e,t,r,i){if(t.distSqr(e.centerPoint)<.01)return e.center;let a=r?t.sub(r):t;return i===void 0?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,i)}_handleMapControls({terrain:e,tr:t,deltasForHelper:r,preZoomAroundLoc:i,combinedEventsInProgress:a,panDelta:n}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(r,t),!e&&!s.useGlobeControls&&!t.isPointOnMapSurface(r.around)){n&&t.setCenter(t.screenPointToLocation(t.centerPoint.sub(n)));return}if(!e){s.handleMapControlsPan(r,t,i);return}if(!this._terrainGesture.inFlight){this._terrainGesture.inFlight=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(r,t,i);return}if(!s.useGlobeControls&&r.aroundElevation===void 0&&a.drag&&n){t.setCenter(t.screenPointToLocation(t.centerPoint.sub(n)));return}s.handleMapControlsPan(r,t,i)}_fireEvents(e,t,r){let i=xo(this._eventsInProgress),a=xo(e),n={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(n[`${h}start`]=c),this._eventsInProgress[h]=e[h]}!i&&a&&this._fireEvent("movestart",a.originalEvent);for(let h in n)this._fireEvent(h,n[h]);a&&this._fireEvent("move",a.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let s={},o;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:d}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],o=t[c]||d,s[`${h}end`]=o)}for(let h in s)this._fireEvent(h,s[h]);let l=xo(this._eventsInProgress),u=(i||a)&&!l;if(u&&this._terrainGesture.inFlight){this._camera.elevationFreeze=!1,this._terrainGesture={inFlight:!1,anchorElevation:null};let h=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(h)}if(r&&u){this._updatingCamera=!0;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),c=d=>d!==0&&-this._bearingSnap<d&&d<this._bearingSnap;h&&(h.essential||!Xt.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:o})):(this._fireEvent("moveend",o),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._camera.fire(new J(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new F5("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},k5=class extends kt{constructor(e){super(),this._renderFrameCallback=()=>{let t=Math.min((Fe()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new fl,this.cameraHelper=new ml,e.minZoom!==void 0&&this.transform.setMinZoom(e.minZoom),e.maxZoom!==void 0&&this.transform.setMaxZoom(e.maxZoom),e.minPitch!==void 0&&this.transform.setMinPitch(e.minPitch),e.maxPitch!==void 0&&this.transform.setMaxPitch(e.maxPitch),e.renderWorldCopies!==void 0&&this.transform.setRenderWorldCopies(e.renderWorldCopies),e.transformConstrain!==null&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}setTerrain(e){this.terrain=e,this.applyTerrainChange()}migrateProjection(e,t){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t,this._requestedCameraState){let r=e.clone();r.apply(this._requestedCameraState,!0),this._requestedCameraState=r}}getCenter(){return new ee(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,r){return e=M.convert(e).mult(-1),this.panTo(this.transform.center,H({offset:e},t),r)}panTo(e,t,r){return this.easeTo(H({center:e},t),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,r){return this.easeTo(H({zoom:e},t),r)}zoomIn(e,t){return this.zoomTo(rr(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(rr(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.applyTransformChange(r=>r.setFov(e)),this.fire(new J("movestart",t)).fire(new J("move",t)).fire(new J("moveend",t))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,r){return this.easeTo(H({bearing:e},t),r)}resetNorth(e,t){return this.rotateTo(0,H({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(H({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=Wr.convert(e).adjustAntiMeridian();let r=(t==null?void 0:t.bearing)||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,t,r,i){let a={top:0,bottom:0,right:0,left:0};if(i=H({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},i),typeof i.padding=="number"){let u=i.padding;i.padding={top:u,bottom:u,right:u,left:u}}let n=H(a,i.padding);i.padding=n;let s=this.transform,o=new Wr(e,t),l=this.cameraHelper.cameraForBoxAndBearing(i,n,o,r,s);return l&&this._zoomSnap&&(l.zoom=rr(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,t,r,i,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(M.convert(e)),this.transform.screenPointToLocation(M.convert(t)),r,i),i,a)}_fitInternal(e,t,r){return e?(t=H(e,t),delete t.padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}jumpTo(e,t){this.stop(),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=rr(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=!1,a=!1,n=!1,s=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLat(e.center?ee.convert(e.center):r.center,r)),this.cameraHelper.handleJumpToCenterZoom(r,e);let o=r.zoom!==s;return e.elevation!==void 0&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),e.bearing!==void 0&&r.bearing!==+e.bearing&&(i=!0,r.setBearing(+e.bearing)),e.pitch!==void 0&&r.pitch!==+e.pitch&&(a=!0,r.setPitch(+e.pitch)),e.roll!==void 0&&r.roll!==+e.roll&&(n=!0,r.setRoll(+e.roll)),e.padding!=null&&!r.isPaddingEqual(e.padding)&&r.setPadding(e.padding),this.applyUpdatedTransform(r),this.fire(new J("movestart",t)).fire(new J("move",t)),o&&this.fire(new J("zoomstart",t)).fire(new J("zoom",t)).fire(new J("zoomend",t)),i&&this.fire(new J("rotatestart",t)).fire(new J("rotate",t)).fire(new J("rotateend",t)),a&&this.fire(new J("pitchstart",t)).fire(new J("pitch",t)).fire(new J("pitchend",t)),n&&this.fire(new J("rollstart",t)).fire(new J("roll",t)).fire(new J("rollend",t)),this.fire(new J("moveend",t))}calculateAnchoredCameraOptions(e){var n;let t=this.transform.clone(),r=ee.convert(e.anchorLocation),i=M.convert(e.anchorScreenPoint),a={panDelta:i.sub(this.transform.locationToScreenPoint(r,this.terrain)),zoomDelta:e.zoom===void 0?0:e.zoom-t.zoom,bearingDelta:0,pitchDelta:0,rollDelta:0,around:i,aroundElevation:(n=this.terrain)==null?void 0:n.getElevationForLngLat(r,t)};return this.cameraHelper.handleMapControlsRollPitchBearingZoom(a,t),this.cameraHelper.handleMapControlsPan(a,t,r),{center:t.center,zoom:t.zoom}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a){let n=this.transform.calculateCenterFromCameraLngLatAlt(e,t,r,i);return{center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:r,pitch:i,roll:a}}easeTo(e,t){this._stop(!1,e.easeId),e=H({offset:[0,0],duration:500,easing:gh},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=rr(e.zoom,this._zoomSnap)),(e.animate===!1||!e.essential&&Xt.prefersReducedMotion)&&(e.duration=0);let r=this.getTransformForUpdate(),i=this.getBearing(),a=r.pitch,n=r.roll,s=e.bearing===void 0?i:this._normalizeBearing(e.bearing,i),o=e.pitch===void 0?a:+e.pitch,l=e.roll===void 0?n:this._normalizeBearing(e.roll,n),u=e.padding===void 0?r.padding:e.padding,h=M.convert(e.offset),c,d;e.around&&(c=ee.convert(e.around),d=r.locationToScreenPoint(c));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(r,{bearing:s,pitch:o,roll:l,padding:u,around:c,aroundPoint:d,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||(this._rotating=i!==s),this._pitching||(this._pitching=o!==a),this._rolling||(this._rolling=l!==n),this._padding=!r.isPaddingEqual(u),this._zooming||(this._zooming=f.isZooming),this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(f.elevationCenter,r),this._ease(m=>{f.easeFunc(m),this.terrain&&!e.freezeElevation&&this._updateElevation(m,r),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},m=>{this.terrain&&e.freezeElevation?this._finalizeElevation():this.elevationFreeze=!1,this._afterEase(t,m)},e),this}_prepareEase(e,t,r={}){this._moving=!0,!t&&!r.moving&&this.fire(new J("movestart",e)),this._zooming&&!r.zooming&&this.fire(new J("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new J("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new J("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new J("rollstart",e))}_prepareElevation(e,t){this._elevationCenter=e,this._elevationStart=t.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,t),this.elevationFreeze=!0}_updateElevation(e,t){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(t.center,t),t.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,t.tileZoom));let r=this.terrain.getElevationForLngLat(this._elevationCenter,t);if(e<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,a=(r-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-a),this._elevationTarget=r}t.setElevation(We.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}applyTerrainChange(){if(this.elevationFreeze)return;let e=this.transform;e.setMinElevationForCurrentTile(this.terrain?this.terrain.getMinTileElevationForLngLatZoom(e.center,e.tileZoom):0),this.getCenterClampedToGround()&&e.setElevation(this.terrain?this.terrain.getElevationForLngLat(e.center,e):0)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),r=e.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(r<i){let a=e.calculateCameraOptionsFromTo(t,i,e.center,e.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(i=>this._elevateCameraIfInsideTerrain(i)),this.transformCameraUpdate&&t.push(i=>this.transformCameraUpdate(i)),!t.length)return;let r=e.clone();for(let i of t){let a=r.clone(),{center:n,zoom:s,roll:o,pitch:l,bearing:u,elevation:h}=i(a);n&&a.setCenter(n),h!==void 0&&a.setElevation(h),s!==void 0&&a.setZoom(s),o!==void 0&&a.setRoll(o),l!==void 0&&a.setPitch(l),u!==void 0&&a.setBearing(u),r.apply(a,!1)}this.transform.apply(r,!1)}applyTransformChange(e){let t=this._requestedCameraState!==void 0,r=this.getTransformForUpdate();e(r),this.applyUpdatedTransform(r),t||delete this._requestedCameraState}_fireMoveEvents(e){this.fire(new J("move",e)),this._zooming&&this.fire(new J("zoom",e)),this._rotating&&this.fire(new J("rotate",e)),this._pitching&&this.fire(new J("pitch",e)),this._rolling&&this.fire(new J("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let r=this._zooming,i=this._rotating,a=this._pitching,n=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new J("zoomend",e)),i&&this.fire(new J("rotateend",e)),a&&this.fire(new J("pitchend",e)),n&&this.fire(new J("rollend",e)),this.fire(new J("moveend",e))}flyTo(e,t){if(!e.essential&&Xt.prefersReducedMotion){let T=os(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(T,t)}this.stop(),e=H({offset:[0,0],speed:1.2,curve:1.42,easing:gh},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=rr(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=r.bearing,a=r.pitch,n=r.roll,s=r.padding,o=e.bearing===void 0?i:this._normalizeBearing(e.bearing,i),l=e.pitch===void 0?a:+e.pitch,u=e.roll===void 0?n:this._normalizeBearing(e.roll,n),h=e.padding===void 0?r.padding:e.padding,c=M.convert(e.offset),d=r.centerPoint.add(c),p=r.screenPointToLocation(d),f=this.cameraHelper.handleFlyTo(r,{bearing:o,pitch:l,roll:u,padding:h,locationAtOffset:p,offsetAsPoint:c,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),m=e.curve,g=Math.max(r.width,r.height),_=g/f.scaleOfZoom,y=f.pixelPathLength,v=g/f.scaleOfMinZoom;m=Math.min(m,Math.sqrt(v/y*2));let x=m*m;function w(T){let E=(_*_-g*g+(T?-1:1)*x*x*y*y)/(2*(T?_:g)*x*y);return Math.log(Math.sqrt(E*E+1)-E)}function b(T){return(Math.exp(T)-Math.exp(-T))/2}function S(T){return(Math.exp(T)+Math.exp(-T))/2}function A(T){return b(T)/S(T)}let P=w(!1),I=function(T){return S(P)/S(P+m*T)},R=function(T){return g*((S(P)*A(P+m*T)-b(P))/x)/y},F=(w(!0)-P)/m;if(Math.abs(y)<2e-6||!isFinite(F)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let T=_<g?-1:1;F=Math.abs(Math.log(_/g))/m,R=()=>0,I=E=>Math.exp(T*m*E)}if(e.duration!==void 0)e.duration=+e.duration;else{let T=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/m;e.duration=1e3*F/T}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==o,this._pitching=l!==a,this._rolling=u!==n,this._padding=!r.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter,r),this._ease(T=>{let E=T*F,D=1/I(E),C=R(E);this._rotating&&r.setBearing(We.number(i,o,T)),this._pitching&&r.setPitch(We.number(a,l,T)),this._rolling&&r.setRoll(We.number(n,u,T)),this._padding&&(r.interpolatePadding(s,h,T),d=r.centerPoint.add(c)),f.easeFunc(T,D,C,d),this.terrain&&!e.freezeElevation&&this._updateElevation(T,r),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation?this._finalizeElevation():this.elevationFreeze=!1,this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,r){r.animate===!1||r.duration===0?(e(1),t()):(this._easeStart=Fe(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=fr(e,-180,180);let r=Math.abs(e-t);return Math.abs(e-360-t)<r&&(e-=360),Math.abs(e+360-t)<r&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const Tx={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var L5=class{constructor(e=Tx){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&(t.type==="terrain"||t.dataType==="style"||t.dataType==="source"&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=at.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=at.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=at.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(){this._container.remove(),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 r=this._map._getUIString(`AttributionControl.${t}`);e.title=r,e.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(i=>typeof i=="string"?i:"")):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let t=this._map.style.tileManagers;for(let i in t){let a=t[i];if(a.used||a.usedForTerrain){let n=a.getSource();n.attribution&&!e.includes(n.attribution)&&e.push(n.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,a)=>i.length-a.length),e=e.filter((i,a)=>{for(let n=a+1;n<e.length;n++)if(e[n].includes(i))return!1;return!0});let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.replaceChildren(at.sanitize(r)),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},B5=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let r=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&r.classList.add("maplibregl-compact"):r.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){var r;this._map=e,this._compact=(r=this.options)==null?void 0:r.compact,this._container=at.create("div","maplibregl-ctrl");let t=at.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(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},O5=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(let i of r)if(i.id===e){i.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];let r=!1,i;for(let a of t)if(!a.cancelled){try{a.callback(e)}catch(n){r||(r=!0,i=n)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,r)throw i}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const Rg=["none","zoom","sourceTiles","visibleLayers","revision"];var $5=class{constructor(e,t,r,i){this._tileKeys=e.map(a=>a.key).sort().join(),this._revision=t,this._zoom=r,this._visibleLayerIds=i}difference(e){return this._revision===(e==null?void 0:e._revision)?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};const va={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var j5=class{constructor(e,t){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t){let r=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(o=>!e._layers[o].isHidden(t));let i=this._renderableLayerIds.join(),a=new Set;for(let o of this._renderableLayerIds){let l=e._layers[o],u=l.source;u&&va[l.type]&&a.add(u)}this._coordsAscending={},this._rttFingerprints={};for(let o of a){let l=e.tileManagers[o];if(!l)continue;this._coordsAscending[o]={};let u=this._coordsAscending[o],h=l.getSource(),c=h instanceof ws?h.terrainTileRanges:null;for(let f of l.getVisibleCoordinates()){let m=this.terrain.tileManager.getTerrainCoords(f,c);for(let g in m)u[g]||(u[g]=[]),u[g].push(m[g])}this._rttFingerprints[o]={};let d=this._rttFingerprints[o],p=l.getState().revision;for(let f in u)d[f]=new $5(u[f],p,t,i)}this.needsFollowUpFrame=!1;let n=r||this.painter.options.moving,s=!1;for(let o of this._renderableTiles){let l=this._textureDifference(o);l!=="none"&&(l==="zoom"&&n||l==="visibleLayers"&&r?this.needsFollowUpFrame=!0:l==="zoom"||l==="sourceTiles"?(s?this.needsFollowUpFrame=!0:o.releaseRTT(this.painter),s=!0):o.releaseRTT(this.painter))}}_textureDifference(e){let t="none";for(let r in this._rttFingerprints){let i=this._rttFingerprints[r][e.tileID.key];if(!i)continue;let a=i.difference(e.rttFingerprint[r]);Rg.indexOf(a)>Rg.indexOf(t)&&(t=a)}return t}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let r=e.type,i=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(va[r]&&((!this._prevType||!va[this._prevType])&&this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(va[this._prevType]||va[r]&&a){this._prevType=r;let n=this._stacks.length-1,s=this._stacks[n]||[];t.isRenderingToTexture=!0;for(let o of this._renderableTiles){if(this._rttTiles.push(o),o.getRTT(n))continue;let l=o.acquireRTT(i,n,this.rttSize);i.bindRTT(l),i.context.clear({color:oe.transparent,stencil:0}),i.currentStencilSource=void 0;for(let u of s){let h=i.style._layers[u],c=h.source?this._coordsAscending[h.source][o.tileID.key]:[o.tileID];i.context.viewport.set([0,0,this.rttSize,this.rttSize]),i.renderTileClippingMasks(h,c),i.renderLayer(i,i.style.tileManagers[h.source],h,c,t),h.source&&(o.rttFingerprint[h.source]=this._rttFingerprints[h.source][o.tileID.key])}l.texture.generateMipmap()}return t.isRenderingToTexture=!1,qF(this.painter,this.terrain,this._rttTiles,t),this._rttTiles=[],va[r]}return!1}};const V5={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},N5=dC,kg={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Tx,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Yi.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var U5=class extends kt{get _ownerWindow(){var e,t;return((t=(e=this._container)==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)||window}constructor(e){var a,n,s;super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new O5,this._controls=[],this._mapId=Ug(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=o=>{if(o.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new Wu("webglcontextlost",{originalEvent:o}));return}for(let l of Object.values(this.style._layers))if(l.type==="custom"&&console.warn(`Custom layer with id '${l.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),l._listeners)for(let[u]of Object.entries(l._listeners))console.warn(`Custom layer with id '${l.id}' had event listeners for event '${u}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new Wu("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let l in this._lostContextStyle.images){let u=this._lostContextStyle.images[l];u.isWebGLImage&&this.style.imageManager.updateImage(l,u,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(l){this.fire(new Y(l));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new Wu("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...kg,...e,canvasContextAttributes:{...kg.canvasContextAttributes,...e.canvasContextAttributes}};if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new k5({minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,requestRenderFrame:o=>this._requestRenderFrame(o),cancelRenderFrame:o=>this._cancelRenderFrame(o),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>{var o;return(o=this._handlers)==null?void 0:o.stop(!1)}}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=t.trackResize===!0,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale={...V5,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),t.reduceMotion!==void 0&&(Xt.prefersReducedMotion=t.reduceMotion),this._requestManager=new bC(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(o){throw this._cleanupContainer(),o}this._imageQueueHandle=Ur.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.markTerrainDepthDirty(),this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new R5(this,this._camera,t),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let r=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash?new JF(r).addTo(this):void 0,(a=this._hash)!=null&&a._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,H({},t.fitBoundsOptions,{duration:0}))));let i=typeof t.style=="string"||((s=(n=t.style)==null?void 0:n.projection)==null?void 0:s.type)!=="globe";this.resize(null,i),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new L5(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new B5,t.logoPosition),this.on("style.load",()=>{if(i||this._resizeTransform(),this._camera.transform.unmodified){let o=os(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(o)}}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(o.dataType==="style"?new Tr("styledata",o):new Ne("sourcedata",o))}),this.on("dataloading",o=>{this.fire(o.dataType==="style"?new Tr("styledataloading",o):new Ne("sourcedataloading",o))}),this.on("dataabort",o=>{this.fire(new Ne("sourcedataabort",o))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!(e!=null&&e.onAdd))return this.fire(new Y(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let r=e.onAdd(this);this._controls.push(e);let i=this._controlPositions[t];return t.includes("bottom")?i.insertBefore(r,i.firstChild):i.appendChild(r),this}removeControl(e){if(!(e!=null&&e.onRemove))return this.fire(new Y(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return en(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new ee(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,r){return this._camera.panBy(e,t,r),this}panTo(e,t,r){return this._camera.panTo(e,t,r),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,r){return this._camera.zoomTo(e,t,r),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,r){return this._camera.rotateTo(e,t,r),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.transform.roll}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,r){return this._camera.fitBounds(e,t,r),this}fitScreenCoordinates(e,t,r,i,a){return this._camera.fitScreenCoordinates(e,t,r,i,a),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateAnchoredCameraOptions(e){return this._camera.calculateAnchoredCameraOptions(e)}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(ee.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,r,i){return i==null&&this.terrain&&(i=this.terrain.getElevationForLngLat(r,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t,r,i??0)}resize(e,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);let r=!this._camera._moving;return r&&(this.stop(),this.fire(new J("movestart",e)).fire(new J("move",e))),this.fire(new bt("resize",e)),r&&this.fire(new J("moveend",e)),this}_resizeInternal(e=!0){let[t,r]=this._containerDimensions(),i=this._getClampedPixelRatio(t,r);if(this._resizeCanvas(t,r,i),this.painter.resize(t,r,i),this.painter.overLimit()){let a=this.painter.context.gl;this._maxCanvasSize=[a.drawingBufferWidth,a.drawingBufferHeight];let n=this._getClampedPixelRatio(t,r);this._resizeCanvas(t,r,n),this.painter.resize(t,r,n)}this._resizeTransform(e)}_resizeTransform(e=!0){var i;let[t,r]=this._containerDimensions();this._camera.transform.resize(t,r,e),(i=this._camera._requestedCameraState)==null||i.resize(t,r,e)}_getClampedPixelRatio(e,t){let{0:r,1:i}=this._maxCanvasSize,a=this.getPixelRatio(),n=e*a,s=t*a,o=n>r?r/n:1,l=s>i?i/s:1,u=Math.min(o,l);return u<1&&_e("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),u*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.applyTransformChange(t=>t.setMaxBounds(Wr.convert(e))),this._update()}setMinZoom(e){if(e??(e=-2),e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom;return this._camera.applyTransformChange(r=>r.setMinZoom(e)),this._update(),t!==this._camera.transform.zoom&&this.fire(new J("zoomstart")).fire(new J("zoom")).fire(new J("zoomend")).fire(new J("movestart")).fire(new J("move")).fire(new J("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=!1){let t=this._camera.transform;return e?t.applyConstrain(t.center,t.minZoom).zoom:t.minZoom}setMaxZoom(e){if(e??(e=22),e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom;return this._camera.applyTransformChange(r=>r.setMaxZoom(e)),this._update(),t!==this._camera.transform.zoom&&this.fire(new J("zoomstart")).fire(new J("zoom")).fire(new J("zoomend")).fire(new J("movestart")).fire(new J("move")).fire(new J("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??(e=0),e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this._camera.transform.maxPitch){let t=this._camera.transform.pitch;return this._camera.applyTransformChange(r=>r.setMinPitch(e)),this._update(),t!==this._camera.transform.pitch&&this.fire(new J("pitchstart")).fire(new J("pitch")).fire(new J("pitchend")).fire(new J("movestart")).fire(new J("move")).fire(new J("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??(e=60),e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this._camera.transform.minPitch){let t=this._camera.transform.pitch;return this._camera.applyTransformChange(r=>r.setMaxPitch(e)),this._update(),t!==this._camera.transform.pitch&&this.fire(new J("pitchstart")).fire(new J("pitch")).fire(new J("pitchend")).fire(new J("movestart")).fire(new J("move")).fire(new J("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??(e=20),e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.applyTransformChange(t=>t.setRenderWorldCopies(e)),this._update()}setTransformConstrain(e){return this._camera.applyTransformChange(t=>t.setConstrainOverride(e)),this._update()}project(e){return this._camera.transform.locationToScreenPoint(ee.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(M.convert(e),this.terrain)}isMoving(){var e;return this._camera.isMoving()||((e=this._handlers)==null?void 0:e.isMoving())||!1}isZooming(){var e;return this._camera.isZooming()||((e=this._handlers)==null?void 0:e.isZooming())||!1}isRotating(){var e;return this._camera.isRotating()||((e=this._handlers)==null?void 0:e.isRotating())||!1}_createDelegates(e,t,r){if(e==="mouseenter"||e==="mouseover"){let i=!1;return{mousemove:a=>{let n=t.filter(o=>this.getLayer(o)),s=n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n});s.length?i||(i=!0,r.call(this,new ir(e,this,a.originalEvent,{features:s}))):i=!1},mouseout:()=>{i=!1}}}if(e==="mouseleave"||e==="mouseout"){let i=!1;return{mousemove:a=>{let n=t.filter(s=>this.getLayer(s));(n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n})).length?i=!0:i&&(i=!1,r.call(this,new ir(e,this,a.originalEvent)))},mouseout:a=>{i&&(i=!1,r.call(this,new ir(e,this,a.originalEvent)))}}}{let i=a=>{let n=t.filter(o=>this.getLayer(o)),s=n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n});s.length&&(a.features=s,r.call(this,a),delete a.features)};return{[e]:i}}}_addDelegatedListener(e,t){var r;this._delegatedListeners||(this._delegatedListeners={}),(r=this._delegatedListeners)[e]||(r[e]=[]),this._delegatedListeners[e].push(t);for(let i in t.delegates)this.on(i,t.delegates[i])}_removeDelegatedListener(e,t,r){var a;if(!((a=this._delegatedListeners)!=null&&a[e]))return;let i=this._delegatedListeners[e];for(let n=0;n<i.length;n++){let s=i[n];if(s.listener===r&&s.layers.length===t.length&&s.layers.every(o=>t.includes(o))){for(let o in s.delegates)this.off(o,s.delegates[o]);i.splice(n,1);return}}}on(e,t,r){if(r===void 0)return super.on(e,t);let i=typeof t=="string"?[t]:t,a={layers:i,listener:r,delegates:this._createDelegates(e,i,r)};return this._addDelegatedListener(e,a),{unsubscribe:()=>{this._removeDelegatedListener(e,i,r)}}}once(e,t,r){if(r===void 0)return super.once(e,t);let i=typeof t=="string"?[t]:t,a={layers:i,listener:r,delegates:this._createDelegates(e,i,n=>{this._removeDelegatedListener(e,i,r),r.call(this,n)})};return this._addDelegatedListener(e,a),this}off(e,t,r){if(r===void 0)return super.off(e,t);let i=typeof t=="string"?[t]:t;return this._removeDelegatedListener(e,i,r),this}queryRenderedFeatures(e,t){if(!this.style)return[];let r,i=e instanceof M||Array.isArray(e),a=i?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||(t=(i?{}:e)||{}),a instanceof M||typeof a[0]=="number")r=[M.convert(a)];else{let n=M.convert(a[0]),s=M.convert(a[1]);r=[n,new M(s.x,n.y),s,new M(n.x,s.y),n]}return this.style.queryRenderedFeatures(r,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=H({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),this._styleUrl=typeof e=="string"?e:null,t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,a,n;if((i=this._diffStyleRequest)==null||i.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t));return}let r=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new _g(this,t||{});else return this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),(n=(a=this.style)==null?void 0:a.projection)==null||n.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,t,r):this.style.loadJSON(e,t,r),this}_lazyInitEmptyStyle(){this.style||(this.style=new _g(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,t){var r;if((r=this._diffStyleRequest)==null||r.abort(),typeof e=="string"){let i=e;this._diffStyleRequest=new AbortController;let a=this._diffStyleRequest;try{let n=await this._requestManager.transformRequest(i,"Style");if(a.signal.aborted){this._diffStyleRequest=null;return}let s=await xl(n,a);this._diffStyleRequest=null,this._updateDiff(s.data,t)}catch(n){this._diffStyleRequest=null,Si(n)||this.fire(new Y(zt(n)))}}else typeof e=="object"&&(this._diffStyleRequest=null,this._updateDiff(e,t))}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(r){_e(`Unable to perform style diff: ${zt(r).message}. Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){_e("There is no style added to the map.");return}return this.style.loaded()}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){var r;let t=(r=this.style)==null?void 0:r.tileManagers[e];if(t===void 0){this.fire(new Y(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&gs(this,Zt.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this.painter.destroyRTTResources(),this._camera.setTerrain(null);else{let r=this.style.tileManagers[e.source];if(!r)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&r.reload();for(let i in this.style._layers){let a=this.style._layers[i];a.type==="hillshade"&&a.source===e.source&&_e("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===e.source&&_e("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new VM(this.painter,r,e,this._terrainSkirtLength),this.painter.renderToTexture=new j5(this.painter,this.terrain),this._camera.setTerrain(this.terrain),this._terrainDataCallback=i=>this._handleTerrainDataEvent(i,e.source),this.style.on("data",this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new TC({terrain:e})),this}_handleTerrainDataEvent(e,t){var i;if(e.dataType==="style"){this.terrain.tileManager.releaseAllRTT();return}let r=e.sourceId===t;if(r&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),r&&e.tile&&(this.painter.markTerrainDepthDirty(),this._camera.applyTerrainChange()),e.tile){if(((i=e.source)==null?void 0:i.type)==="image"){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){var e;return((e=this.terrain)==null?void 0:e.options)??null}areTilesLoaded(){var t;let e=(t=this.style)==null?void 0:t.tileManagers;for(let r of Object.values(e))if(!r.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){var t;return(t=this.style)==null?void 0:t.getSource(e)}setSourceTileLodParams(e,t,r){if(r){let i=this.getSource(r);if(!i)throw Error(`There is no source with ID "${r}", cannot set LOD parameters`);i.calculateTileZoom=zc(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=zc(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let r=this.style.tileManagers[e];if(!r)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);t===void 0?r.reload(!0):r.refreshTiles(t.map(i=>new Ul(i.z,i.x,i.y)))}addImage(e,t,r={}){var a;this._lazyInitEmptyStyle();let i=this._createStyleImage(t,r);return i?(this.style.addImage(e,i),(a=i.userImage)!=null&&a.onAdd&&i.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){var t;return this._missingStyleImageResolver=e,(t=this.style)==null||t.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:r=1,sdf:i=!1,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l}=t;if(e instanceof HTMLImageElement||Ni(e)){let{width:u,height:h,data:c}=Xt.getImageData(e);return{data:new $e({width:u,height:h},c),pixelRatio:r,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l,sdf:i,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new Y(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`"))),null;{let{width:u,height:h,data:c}=e,d=e,p=nl(d.data);return{data:p?new $e({width:u,height:h}):new $e({width:u,height:h},new Uint8Array(c)),pixelRatio:r,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l,sdf:i,version:0,isWebGLImage:p,userImage:d}}}updateImage(e,t){let r=this.style.getImage(e);if(!r)return this.fire(new Y(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:i,height:a,data:n}=t instanceof HTMLImageElement||Ni(t)?Xt.getImageData(t):t;if(i===void 0||a===void 0)return this.fire(new Y(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(i!==r.data.width||a!==r.data.height)return this.fire(new Y(Error("The width and height of the updated image must be that same as the previous version of the image")));if(r.isWebGLImage=nl(n),r.isWebGLImage)r.userImage=t;else{let s=!(t instanceof HTMLImageElement||Ni(t));r.data.replace(n,s)}return this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new Y(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await Ur.getImage(await this._requestManager.transformRequest(e,"Image"),new AbortController);if(!t.data)throw Error(`Could not load image ${e}: the response is empty`);return t}listImages(){var e;return((e=this.style)==null?void 0:e.listImages())??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){var t;return(t=this.style)==null?void 0:t.getLayer(e)}getLayersOrder(){var e;return((e=this.style)==null?void 0:e.getLayersOrder())??[]}setLayerZoomRange(e,t,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){var i;return(i=this.style)==null||i.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){var a;return(a=this.style)==null||a.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,i=>{i||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,r=>{r||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=Math.floor(this._container.clientWidth)||400,t=Math.floor(this._container.clientHeight)||300),[e,t]}_shouldHandleInitialResize(){var r;if(!((r=this._container)!=null&&r.clientWidth)||!this._container.clientHeight)return!1;let[e,t]=this._containerDimensions();return e!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){let e=!1,t=wx(i=>{this._trackResize&&!this._removed&&(this.resize(i),this.redraw())},50),r=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new r(i=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(i)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e=="string"){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&typeof e=="object"&&e.nodeType===1)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._containerDimensions(),t=this._getClampedPixelRatio(e[0],e[1]),r=this._container;r.classList.add("maplibregl-map");let i=this._canvasContainer=at.create("div","maplibregl-canvas-container",r);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=at.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._resizeCanvas(e[0],e[1],t);let a=this._controlContainer=at.create("div","maplibregl-control-container",r),n=this._controlPositions={};for(let s of["top-left","top-right","bottom-left","bottom-right"])n[s]=at.create("div",`maplibregl-ctrl-${s} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,t,r){let i=Math.round(r*e),a=Math.round(r*t);this._canvas.width=i,this._canvas.height=a,this._canvas.style.width=`${i/r}px`,this._canvas.style.height=`${a/r}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{t=i},{once:!0});let r=this._canvas.getContext("webgl2",e);if(!r)throw new KF(e,t);this.painter=new YF(r,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new SC({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var t;return(t=this.style)!=null&&t._loaded?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var s,o,l,u,h;let t=this._idleTriggered?this._fadeDuration:0,r=((s=this.style.projection)==null?void 0:s.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let c=this._camera.transform.zoom,d=Fe();this.style.zoomHistory.update(c,d);let p=new ze(c,{now:d,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=p.crossFadingFactor();(f!==1||f!==this._crossFadingFactor)&&(i=!0,this._crossFadingFactor=f),this.style.update(p)}let a=((o=this.style.projection)==null?void 0:o.transitionState)>0!==r;this._camera.transform.setTransitionState((l=this.style.projection)==null?void 0:l.transitionState),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=(u=this.style)==null?void 0:u._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new bt("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new bt("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let n=this._sourcesDirty||this._styleDirty||this._placementDirty||((h=this.painter.renderToTexture)==null?void 0:h.needsFollowUpFrame);return n||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new bt("idle")),this._loaded&&!this._fullyLoaded&&!n&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){var t,r;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),(t=this._diffStyleRequest)==null||t.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Ur.removeThrottleControl(this._imageQueueHandle),(r=this._resizeObserver)==null||r.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new bt("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Xt.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(t){if(!Si(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return N5}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};function G5(e){Yi.WORKER_URL=e}const q5="#DD4B40",Dn="lecodes-user",vo="lecodes-user-halo",Z5="lecodes-user-dot",W5="lecodes-user-heading",hh="lecodes-user-heading",bo={type:"FeatureCollection",features:[]},H5=(e,t)=>{if(e.head.querySelector("style[data-maplibre-css]"))return;const r=e.createElement("style");r.setAttribute("data-maplibre-css",""),r.textContent=t,e.head.appendChild(r)},wo=e=>{if(!e)return null;const[t,r]=e;return!Number.isFinite(t)||!Number.isFinite(r)||r<-90||r>90?null:[t,r]},Lg=(e,t,r)=>{if(typeof e=="number")return{top:e,left:e,bottom:e,right:e};const i=e??{},a=(n,s)=>{if(typeof n=="number")return n;if(typeof n=="string"&&n.endsWith("%")){const o=Number(n.slice(0,-1));return Number.isFinite(o)?s*o/100:0}return 0};return{top:a(i.top,r),left:a(i.left,t),bottom:a(i.bottom,r),right:a(i.right,t)}},X5=e=>typeof e=="string"||typeof e=="number"?e:null,Y5=e=>!e||e.type!=="FeatureCollection"||!Array.isArray(e.features)?e:{...e,features:e.features.map(t=>{const r=(t==null?void 0:t.properties)??{};return r.color==null?{...t,properties:{...r,color:q5}}:t})},K5=e=>{const t=e.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d");return r?(r.scale(2,2),r.beginPath(),r.moveTo(12,1),r.lineTo(18,10),r.lineTo(12,7.5),r.lineTo(6,10),r.closePath(),r.fillStyle="rgb(26,128,255)",r.fill(),r.strokeStyle="#fff",r.lineWidth=1,r.stroke(),r.getImageData(0,0,48,48)):null},J5=(e,t)=>{const r=e/(156543.03392*Math.cos(t*Math.PI/180)),i=["interpolate",["exponential",2],["zoom"],0,r,22,r*4194304];return["step",i,0,10,["min",600,i]]},fk=(e,t,r,i,a)=>{G5(a.workerUrl),H5(i,a.css);const n=t.rotate!==!1,s=t.tilt===!0,o=wo(t.center),l=(()=>{if(t.styleJson!==void 0)try{return JSON.parse(t.styleJson)}catch{return null}return t.style??null})();l||r.error({message:"MapView: `style` must be a URL or a style JSON"});const u=new U5({container:e,style:l??{version:8,sources:{},layers:[]},center:o??[0,0],zoom:t.zoom??(o?12:0),bearing:t.bearing??0,pitch:t.pitch??0,minZoom:t.minZoom,maxZoom:t.maxZoom,attributionControl:!1,dragRotate:n,pitchWithRotate:s,touchPitch:s});n||u.touchZoomRotate.disableRotation();let h=!1,c=new Map,d={},p=null;const f=()=>[e.clientWidth,e.clientHeight],m=()=>{const T=u.getCenter();return{center:[T.lng,T.lat],zoom:u.getZoom(),bearing:u.getBearing(),pitch:u.getPitch()}},g=T=>{var E;return(((E=u.getStyle())==null?void 0:E.layers)??[]).filter(D=>D.source===T).map(D=>D.id)};u.on("load",()=>{c=new Map,p=null,h=!0,r.ready(),I()}),u.on("error",T=>{var E;h||r.error({message:((E=T==null?void 0:T.error)==null?void 0:E.message)??"MapView: failed to load the style"})}),u.on("moveend",()=>{h&&r.moveEnd(m())}),u.on("resize",()=>I());let _=null;u.on("dblclick",()=>{_&&(clearTimeout(_),_=null)}),u.on("click",T=>{_&&clearTimeout(_);const E=T.point,D=[T.lngLat.lng,T.lngLat.lat];_=setTimeout(()=>{_=null,y(E,D)},300)});const y=(T,E)=>{if(!h)return;const D={lngLat:E,point:[T.x,T.y]};for(const C of c.keys()){const k=g(C);if(k.length===0)continue;let B;try{B=u.queryRenderedFeatures([T.x,T.y],{layers:k})}catch{continue}const $=B[0];if(!$)continue;const W=$.properties??{};if(W.cluster===!0||W.cluster==="true"){const ye=u.getSource(C),ce=$.geometry.type==="Point"?$.geometry.coordinates:E;ye==null||ye.getClusterExpansionZoom(Number(W.cluster_id)).then(ke=>u.easeTo({center:ce,zoom:ke}),()=>{});return}const ie=W.id??$.id;r.tap({...D,feature:{source:C,id:X5(ie),properties:W}});return}r.tap(D)},v=()=>new Fp("notReady"),x=(T,E)=>{if(!h)throw v();const D=u.getSource(T);if(!D||D.type!=="geojson")throw new Error(`unknown GeoJSON source "${T}" — call ensureLayer / map.markers(name) first, or declare it in the style`);const C=c.get(T);D.setData((C==null?void 0:C.kind)==="markers"?Y5(E):E)},w=(T,E,D={})=>{if(!h)throw v();if(!c.has(T)){if(u.getSource(T)){c.set(T,{kind:"styleOwned"});return}c.set(T,{kind:E,layerIds:S(T,E,D)})}},b=T=>{var D;const E=c.get(T);if(E){if(c.delete(T),E.kind==="styleOwned"){(D=u.getSource(T))==null||D.setData(bo);return}for(const C of E.layerIds)u.getLayer(C)&&u.removeLayer(C);u.getSource(T)&&u.removeSource(T)}},S=(T,E,D)=>{const C=E==="markers"&&D.cluster===!0;u.addSource(T,{type:"geojson",data:bo,...C?{cluster:!0,clusterRadius:D.clusterRadius??50,...D.clusterMaxZoom===void 0?{}:{clusterMaxZoom:D.clusterMaxZoom}}:{}});const k=[];if(E==="line")k.push({id:`${T}-line`,type:"line",source:T,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":D.color??"rgb(255,64,51)","line-width":D.width??4,"line-opacity":D.opacity??1}});else{const $=C?[["!",["has","point_count"]]]:[];k.push({id:`${T}-dot`,type:"circle",source:T,...C?{filter:["!",["has","point_count"]]}:{},paint:{"circle-radius":8,"circle-color":["get","color"],"circle-stroke-color":"#fff","circle-stroke-width":2}}),k.push({id:`${T}-icon`,type:"symbol",source:T,filter:["all",...$,["has","icon"]],layout:{"icon-image":["get","icon"],"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),k.push({id:`${T}-label`,type:"symbol",source:T,filter:["all",...$,["has","title"]],layout:{"text-field":["get","title"],"text-size":12,"text-anchor":"top","text-offset":[0,.9],"text-optional":!0},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1.2}}),C&&(k.push({id:`${T}-clusters`,type:"circle",source:T,filter:["has","point_count"],paint:{"circle-radius":18,"circle-color":"rgb(59,122,214)","circle-stroke-color":"#fff","circle-stroke-width":2}}),k.push({id:`${T}-cluster-count`,type:"symbol",source:T,filter:["has","point_count"],layout:{"text-field":["to-string",["get","point_count"]],"text-size":13,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#fff"}}))}const B=p&&u.getLayer(vo)?vo:void 0;for(const $ of k)u.addLayer($,B);return k.map($=>$.id)},A=(T,E={},D)=>{const C=wo(T);if(!C)throw new Error(`the latitude ${T[1]} is off the globe`);const k={center:C,...E.zoom===void 0?{}:{zoom:E.zoom},...E.bearing===void 0?{}:{bearing:E.bearing},...E.pitch===void 0?{}:{pitch:E.pitch}};D?u.flyTo({...k,duration:E.duration??600}):u.jumpTo(k)},P=(T,E={})=>{const D=T.map(wo).filter(ie=>ie!==null);if(D.length===0)throw new Fp("noPoints");const C=E.animate!==!1,[k,B]=f(),$=new Wr(D[0],D[0]);for(const ie of D)$.extend(ie);const W=E.maxZoom??(D.length===1?16:void 0);u.fitBounds($,{padding:Lg(E.padding,k,B),...W!==void 0?{maxZoom:W}:{},duration:C?600:0})},I=()=>{const[T,E]=f();T===0||E===0||u.setPadding(Lg(d,T,E))},R=()=>{if(p)return;u.addSource(Dn,{type:"geojson",data:bo});const T=K5(i);T&&!u.hasImage(hh)&&u.addImage(hh,T,{pixelRatio:2}),u.addLayer({id:vo,type:"circle",source:Dn,paint:{"circle-color":"rgba(26,128,255,0.18)","circle-radius":0,"circle-pitch-alignment":"map"}}),u.addLayer({id:W5,type:"symbol",source:Dn,filter:["has","heading"],layout:{"icon-image":hh,"icon-rotate":["get","heading"],"icon-rotation-alignment":"map","icon-allow-overlap":!0,"icon-ignore-placement":!0}}),u.addLayer({id:Z5,type:"circle",source:Dn,paint:{"circle-radius":7,"circle-color":"rgb(26,128,255)","circle-stroke-color":"#fff","circle-stroke-width":2.5}}),p={accuracy:null,lat:0}},F=(T,E,D)=>{if(!h)return;R();const C=u.getSource(Dn);if(!(!C||!p)){if(!T){C.setData(bo);return}C.setData({type:"Feature",properties:D==null?{}:{heading:D},geometry:{type:"Point",coordinates:T}}),p.accuracy=E,p.lat=T[1],u.setPaintProperty(vo,"circle-radius",E!=null&&E>0?J5(E,T[1]):0)}};return{el:e,ensureLayer:w,removeLayer:b,setData:x,flyTo:(T,E)=>A(T,E,!0),jumpTo:(T,E)=>A(T,E,!1),fitPoints:P,setPadding:T=>{d=T,I()},getCamera:m,setUserLocation:(T,E)=>F(wo(T),(E==null?void 0:E.accuracy)??null,(E==null?void 0:E.heading)??null),destroy:()=>{_&&clearTimeout(_),u.remove()}}};export{fk as createMap};
|