lecodes-viewer 0.19.2 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed/VERSION.json +3 -3
- package/dist-embed/assets/{createViewer2d-D12Wy3VF.js → createViewer2d-Dx-COLjO.js} +1 -1
- package/dist-embed/assets/createViewerLite-DkM-O9BQ.js +852 -0
- package/dist-embed/assets/host-Czj6Nu-U.js +168 -0
- package/dist-embed/assets/{index-UwRci5mq.js → index-mhLEVWyK.js} +1 -1
- package/dist-embed/assets/{loadCreatorUiNode-UAdhjRTd.js → loadCreatorUiNode-D87bZHrH.js} +1 -1
- package/dist-embed/assets/mapViewImpl-B2JcES8l.js +810 -0
- package/dist-embed/assets/maplibre-gl-worker-CJfwIrte.js +8 -0
- package/dist-embed/embed.js +8 -8
- package/package.json +7 -3
- package/src/host.ts +3 -0
- package/src/ui/creator-ui.wasm +0 -0
- package/src/ui/nativeViewSystem.ts +2 -91
- package/src/ui/presentPlayer.ts +2 -156
- package/src/ui/vListSystem.ts +211 -211
- package/src/viewer/creator-gl.wasm +0 -0
- package/src/viewer2d/creator2d.wasm +0 -0
- package/dist-embed/assets/createViewerLite-CinItTpO.js +0 -707
- package/dist-embed/assets/host-Vzbyo0SX.js +0 -162
- package/src/assets/banner.png +0 -0
- package/src/assets/image2.png +0 -0
- package/src/assets/landing.mp4 +0 -0
- package/src/assets/neutral_ibl256.ktx +0 -0
- package/src/assets/output.mp4 +0 -0
- package/src/assets/output2.mp4 +0 -0
- package/src/assets/texture.png +0 -0
- package/src/assets/vue.svg +0 -1
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MapLibre GL JS
|
|
3
|
+
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.7.0/LICENSE.txt
|
|
4
|
+
*/var Tg=Object.create,Xd=Object.defineProperty,Dg=Object.getOwnPropertyDescriptor,Ag=Object.getOwnPropertyNames,Eg=Object.getPrototypeOf,Sg=Object.prototype.hasOwnProperty,Gu=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Cg=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Ag(t),s=0,n=a.length,o;s<n;s++)o=a[s],!Sg.call(e,o)&&o!==r&&Xd(e,o,{get:(l=>t[l]).bind(null,o),enumerable:!(i=Dg(t,o))||i.enumerable});return e},Pg=(e,t,r)=>(r=e==null?{}:Tg(Eg(e)),Cg(Xd(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),s=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=a,this.y=s,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 Ig(e,t,r,i){let a=3*e,s=3*(r-e)-a,n=1-a-s,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 p=h;for(let m=0;m<8;m++){let g=((n*p+s)*p+a)*p-h;if(Math.abs(g)<c)return((u*p+l)*p+o)*p;let _=(3*n*p+2*s)*p+a;if(Math.abs(_)<1e-6)break;p-=g/_}let d=0,f=1;p=h;for(let m=0;m<20;m++){let g=((n*p+s)*p+a)*p;if(Math.abs(g-h)<c)break;h>g?d=p:f=p,p=(d+f)*.5}return((u*p+l)*p+o)*p}}let nc;function Yd(){return nc??(nc=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),nc}let Cs;function Mg(){if(Cs==null&&(Cs=!1,Yd())){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){Cs=!0;break}}}return Cs||!1}var Ye=typeof Float32Array<"u"?Float32Array:Array;function Kd(){var e=new Ye(9);return Ye!=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 Fg(e){var t=e[0],r=e[1],i=e[2],a=e[3],s=e[4],n=e[5],o=e[6],l=e[7],u=e[8];return t*(u*s-n*l)+r*(-u*a+n*o)+i*(l*a-s*o)}function zg(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 kg(e,t){var r=t[0],i=t[1],a=t[2],s=t[3],n=r+r,o=i+i,l=a+a,u=r*n,h=i*n,c=i*o,p=a*n,d=a*o,f=a*l,m=s*n,g=s*o,_=s*l;return e[0]=1-c-f,e[3]=h-_,e[6]=p+g,e[1]=h+_,e[4]=1-u-f,e[7]=d-m,e[2]=p-g,e[5]=d+m,e[8]=1-u-c,e}function Zr(){var e=new Ye(16);return Ye!=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 _l(e){var t=new Ye(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 Rg(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 Xt(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 yn(e,t){var r=t[0],i=t[1],a=t[2],s=t[3],n=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],m=t[13],g=t[14],_=t[15],y=r*o-i*n,x=r*l-a*n,v=r*u-s*n,w=i*l-a*o,b=i*u-s*o,A=a*u-s*l,C=h*m-c*f,E=h*g-p*f,F=h*_-d*f,k=c*g-p*m,B=c*_-d*m,I=p*_-d*g,D=y*I-x*B+v*k+w*F-b*E+A*C;return D?(D=1/D,e[0]=(o*I-l*B+u*k)*D,e[1]=(a*B-i*I-s*k)*D,e[2]=(m*A-g*b+_*w)*D,e[3]=(p*b-c*A-d*w)*D,e[4]=(l*F-n*I-u*E)*D,e[5]=(r*I-a*F+s*E)*D,e[6]=(g*v-f*A-_*x)*D,e[7]=(h*A-p*v+d*x)*D,e[8]=(n*B-o*F+u*C)*D,e[9]=(i*F-r*B-s*C)*D,e[10]=(f*b-m*v+_*y)*D,e[11]=(c*v-h*b-d*y)*D,e[12]=(o*E-n*k-l*C)*D,e[13]=(r*k-i*E+a*C)*D,e[14]=(m*x-f*w-g*y)*D,e[15]=(h*w-c*x+p*y)*D,e):null}function Ri(e,t,r){var i=t[0],a=t[1],s=t[2],n=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],d=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],x=r[0],v=r[1],w=r[2],b=r[3];return e[0]=x*i+v*o+w*c+b*m,e[1]=x*a+v*l+w*p+b*g,e[2]=x*s+v*u+w*d+b*_,e[3]=x*n+v*h+w*f+b*y,x=r[4],v=r[5],w=r[6],b=r[7],e[4]=x*i+v*o+w*c+b*m,e[5]=x*a+v*l+w*p+b*g,e[6]=x*s+v*u+w*d+b*_,e[7]=x*n+v*h+w*f+b*y,x=r[8],v=r[9],w=r[10],b=r[11],e[8]=x*i+v*o+w*c+b*m,e[9]=x*a+v*l+w*p+b*g,e[10]=x*s+v*u+w*d+b*_,e[11]=x*n+v*h+w*f+b*y,x=r[12],v=r[13],w=r[14],b=r[15],e[12]=x*i+v*o+w*c+b*m,e[13]=x*a+v*l+w*p+b*g,e[14]=x*s+v*u+w*d+b*_,e[15]=x*n+v*h+w*f+b*y,e}function Ve(e,t,r){var i=r[0],a=r[1],s=r[2],n,o,l,u,h,c,p,d,f,m,g,_;return t===e?(e[12]=t[0]*i+t[4]*a+t[8]*s+t[12],e[13]=t[1]*i+t[5]*a+t[9]*s+t[13],e[14]=t[2]*i+t[6]*a+t[10]*s+t[14],e[15]=t[3]*i+t[7]*a+t[11]*s+t[15]):(n=t[0],o=t[1],l=t[2],u=t[3],h=t[4],c=t[5],p=t[6],d=t[7],f=t[8],m=t[9],g=t[10],_=t[11],e[0]=n,e[1]=o,e[2]=l,e[3]=u,e[4]=h,e[5]=c,e[6]=p,e[7]=d,e[8]=f,e[9]=m,e[10]=g,e[11]=_,e[12]=n*i+h*a+f*s+t[12],e[13]=o*i+c*a+m*s+t[13],e[14]=l*i+p*a+g*s+t[14],e[15]=u*i+d*a+_*s+t[15]),e}function nt(e,t,r){var i=r[0],a=r[1],s=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]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ki(e,t,r){var i=Math.sin(r),a=Math.cos(r),s=t[4],n=t[5],o=t[6],l=t[7],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=s*a+u*i,e[5]=n*a+h*i,e[6]=o*a+c*i,e[7]=l*a+p*i,e[8]=u*a-s*i,e[9]=h*a-n*i,e[10]=c*a-o*i,e[11]=p*a-l*i,e}function Jd(e,t,r){var i=Math.sin(r),a=Math.cos(r),s=t[0],n=t[1],o=t[2],l=t[3],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*a-u*i,e[1]=n*a-h*i,e[2]=o*a-c*i,e[3]=l*a-p*i,e[8]=s*i+u*a,e[9]=n*i+h*a,e[10]=o*i+c*a,e[11]=l*i+p*a,e}function Br(e,t,r){var i=Math.sin(r),a=Math.cos(r),s=t[0],n=t[1],o=t[2],l=t[3],u=t[4],h=t[5],c=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*a+u*i,e[1]=n*a+h*i,e[2]=o*a+c*i,e[3]=l*a+p*i,e[4]=u*a-s*i,e[5]=h*a-n*i,e[6]=c*a-o*i,e[7]=p*a-l*i,e}function Bg(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 Lg(e,t,r,i,a){var s=1/Math.tan(t/2);if(e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,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 n=1/(i-a);e[10]=(a+i)*n,e[14]=2*a*i*n}else e[10]=-1,e[14]=-2*i;return e}var yl=Lg;function $g(e,t,r,i,a,s,n){var o=1/(t-r),l=1/(i-a),u=1/(s-n);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]=(n+s)*u,e[15]=1,e}var tr=$g;function Og(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 Vg(e,t){var r=e[0],i=e[1],a=e[2],s=e[3],n=e[4],o=e[5],l=e[6],u=e[7],h=e[8],c=e[9],p=e[10],d=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=t[0],x=t[1],v=t[2],w=t[3],b=t[4],A=t[5],C=t[6],E=t[7],F=t[8],k=t[9],B=t[10],I=t[11],D=t[12],T=t[13],S=t[14],j=t[15];return Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-x)<=1e-6*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-v)<=1e-6*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(s-w)<=1e-6*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-A)<=1e-6*Math.max(1,Math.abs(o),Math.abs(A))&&Math.abs(l-C)<=1e-6*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(u-E)<=1e-6*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(h-F)<=1e-6*Math.max(1,Math.abs(h),Math.abs(F))&&Math.abs(c-k)<=1e-6*Math.max(1,Math.abs(c),Math.abs(k))&&Math.abs(p-B)<=1e-6*Math.max(1,Math.abs(p),Math.abs(B))&&Math.abs(d-I)<=1e-6*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(f-D)<=1e-6*Math.max(1,Math.abs(f),Math.abs(D))&&Math.abs(m-T)<=1e-6*Math.max(1,Math.abs(m),Math.abs(T))&&Math.abs(g-S)<=1e-6*Math.max(1,Math.abs(g),Math.abs(S))&&Math.abs(_-j)<=1e-6*Math.max(1,Math.abs(_),Math.abs(j))}function Qd(){var e=new Ye(3);return Ye!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function vl(e){var t=new Ye(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function mi(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function oc(e,t,r){var i=new Ye(3);return i[0]=e,i[1]=t,i[2]=r,i}function Ot(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function jg(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Pe(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function vn(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 Ng(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function wt(e,t){var r=t[0],i=t[1],a=t[2],s=r*r+i*i+a*a;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function Ue(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Tt(e,t,r){var i=t[0],a=t[1],s=t[2],n=r[0],o=r[1],l=r[2];return e[0]=a*l-s*o,e[1]=s*n-i*l,e[2]=i*o-a*n,e}function Ug(e,t,r){var i=t[0],a=t[1],s=t[2],n=r[3]*i+r[7]*a+r[11]*s+r[15];return n||(n=1),e[0]=(r[0]*i+r[4]*a+r[8]*s+r[12])/n,e[1]=(r[1]*i+r[5]*a+r[9]*s+r[13])/n,e[2]=(r[2]*i+r[6]*a+r[10]*s+r[14])/n,e}function qg(e,t,r){var i=t[0],a=t[1],s=t[2];return e[0]=i*r[0]+a*r[3]+s*r[6],e[1]=i*r[1]+a*r[4]+s*r[7],e[2]=i*r[2]+a*r[5]+s*r[8],e}function Io(e,t,r){var i=r[0],a=r[1],s=r[2],n=r[3],o=t[0],l=t[1],u=t[2],h=a*u-s*l,c=s*o-i*u,p=i*l-a*o;return h+=h,c+=c,p+=p,e[0]=o+n*h+a*p-s*c,e[1]=l+n*c+s*h-i*p,e[2]=u+n*p+i*c-a*h,e}function Ps(e,t,r,i){var a=[],s=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],s[0]=a[0],s[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),s[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function _a(e,t,r,i){var a=[],s=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],s[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),s[1]=a[1],s[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function Mo(e,t,r,i){var a=[],s=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],s[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),s[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),s[2]=a[2],e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function Gg(e){return e[0]=0,e[1]=0,e[2]=0,e}var Er=jg,xn=mi;(function(){var e=Qd();return function(t,r,i,a,s,n){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],s(e,e,n),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2];return t}})();function Zg(){var e=new Ye(4);return Ye!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Wg(e,t,r,i){var a=new Ye(4);return a[0]=e,a[1]=t,a[2]=r,a[3]=i,a}function Hg(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 Xg(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 Yg(e,t){var r=t[0],i=t[1],a=t[2],s=t[3],n=r*r+i*i+a*a+s*s;return n>0&&(n=1/Math.sqrt(n)),e[0]=r*n,e[1]=i*n,e[2]=a*n,e[3]=s*n,e}function Xe(e,t,r){var i=t[0],a=t[1],s=t[2],n=t[3];return e[0]=r[0]*i+r[4]*a+r[8]*s+r[12]*n,e[1]=r[1]*i+r[5]*a+r[9]*s+r[13]*n,e[2]=r[2]*i+r[6]*a+r[10]*s+r[14]*n,e[3]=r[3]*i+r[7]*a+r[11]*s+r[15]*n,e}var Kg=Hg;(function(){var e=Zg();return function(t,r,i,a,s,n){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],s(e,e,n),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2],t[o+3]=e[3];return t}})();function lc(){var e=new Ye(4);return Ye!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Jg(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 Qg(e,t,r){var i=t[0],a=t[1],s=t[2],n=t[3],o=r[0],l=r[1],u=r[2],h=r[3];return e[0]=i*h+n*o+a*u-s*l,e[1]=a*h+n*l+s*o-i*u,e[2]=s*h+n*u+i*l-a*o,e[3]=n*h-i*o-a*l-s*u,e}function sn(e,t,r,i){var a=t[0],s=t[1],n=t[2],o=t[3],l=r[0],u=r[1],h=r[2],c=r[3],p,d=a*l+s*u+n*h+o*c,f,m,g;return d<0&&(d=-d,l=-l,u=-u,h=-h,c=-c),1-d>1e-6?(p=Math.acos(d),f=Math.sin(p),m=Math.sin((1-i)*p)/f,g=Math.sin(i*p)/f):(m=1-i,g=i),e[0]=m*a+g*l,e[1]=m*s+g*u,e[2]=m*n+g*h,e[3]=m*o+g*c,e}function e1(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 s=(a+1)%3,n=(a+2)%3;i=Math.sqrt(t[a*3+a]-t[s*3+s]-t[n*3+n]+1),e[a]=.5*i,i=.5/i,e[3]=(t[s*3+n]-t[n*3+s])*i,e[s]=(t[s*3+a]+t[a*3+s])*i,e[n]=(t[n*3+a]+t[a*3+n])*i}return e}function Zu(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",s=Math.PI/360;t*=s,i*=s,r*=s;var n=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]=n*u*c+o*l*h,e[1]=o*l*c-n*u*h,e[2]=o*u*h+n*l*c,e[3]=o*u*c-n*l*h;break;case"xzy":e[0]=n*u*c-o*l*h,e[1]=o*l*c-n*u*h,e[2]=o*u*h+n*l*c,e[3]=o*u*c+n*l*h;break;case"yxz":e[0]=n*u*c+o*l*h,e[1]=o*l*c-n*u*h,e[2]=o*u*h-n*l*c,e[3]=o*u*c+n*l*h;break;case"yzx":e[0]=n*u*c+o*l*h,e[1]=o*l*c+n*u*h,e[2]=o*u*h-n*l*c,e[3]=o*u*c-n*l*h;break;case"zxy":e[0]=n*u*c-o*l*h,e[1]=o*l*c+n*u*h,e[2]=o*u*h+n*l*c,e[3]=o*u*c-n*l*h;break;case"zyx":e[0]=n*u*c-o*l*h,e[1]=o*l*c+n*u*h,e[2]=o*u*h-n*l*c,e[3]=o*u*c+n*l*h;break;default:throw Error("Unknown angle order "+a)}return e}var uc=Wg,hc=Yg;(function(){var e=Qd(),t=oc(1,0,0),r=oc(0,1,0);return function(i,a,s){var n=Ue(a,s);return n<-.999999?(Tt(e,t,a),xn(e)<1e-6&&Tt(e,r,a),wt(e,e),Jg(i,e,Math.PI),i):n>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Tt(e,a,s),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+n,hc(i,i))}})(),(function(){var e=lc(),t=lc();return function(r,i,a,s,n,o){return sn(e,i,n,o),sn(t,a,s,o),sn(r,e,t,2*o*(1-o)),r}})(),(function(){var e=Kd();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],hc(t,e1(t,e))}})();function xl(){var e=new Ye(2);return Ye!=Float32Array&&(e[0]=0,e[1]=0),e}function cc(e,t){var r=new Ye(2);return r[0]=e,r[1]=t,r}function pc(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function dc(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function t1(e){var t=e[0],r=e[1];return t*t+r*r}function r1(e,t){return e[0]*t[0]+e[1]*t[1]}function fc(e){return e[0]=0,e[1]=0,e}var i1=t1;(function(){var e=xl();return function(t,r,i,a,s,n){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],s(e,e,n),t[o]=e[0],t[o+1]=e[1];return t}})();const z=8192;function It(e,t,r){return t*(z/(e.tileSize*2**(r-e.tileID.overscaledZ)))}function ht(e){return e instanceof Error?e:Error(typeof e=="string"?e:String(e))}function ai(){return new Float64Array(4)}function ve(){return new Float64Array(3)}function si(){return new Float64Array(16)}function Is(){let e=new Float64Array(16);return Xt(e),e}function e0(){let e=new Float32Array(16);return Xt(e),e}function jr(e,t,r,i,a=!1){if(!r[0]&&!r[1])return[0,0];let s=a?i==="map"?-e.bearingInRadians:0:i==="viewport"?e.bearingInRadians:0;if(s){let n=Math.sin(s),o=Math.cos(s);r=[r[0]*o-r[1]*n,r[0]*n+r[1]*o]}return[a?r[0]:It(t,r[0],e.zoom),a?r[1]:It(t,r[1],e.zoom)]}function bl(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function Ft(e,t,r){let i=Fg([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=Tt([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),s=Tt([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),n=Tt([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),o=Pe([],a,-e[3]);return Ot(o,o,Pe([],s,-t[3])),Ot(o,o,Pe([],n,-r[3])),Pe(o,o,1/i),o}function a1(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 Ms(e,t,r,i){let a=Math.sqrt(e*e+t*t),s=Math.sqrt(r*r+i*i);e/=a,t/=a,r/=s,i/=s;let n=e*r+t*i,o=Math.acos(n);return-t*r+e*i>0?o:-o}function St(e,t){let r=gi(e,360),i=gi(t,360),a=i-r,s=i>r?a-360:a+360;return Math.abs(a)<Math.abs(s)?a:s}function Fs(e,t){let r=gi(e,Math.PI*2),i=gi(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 gi(e,t){return(e%t+t)%t}function nn(e,t,r,i,a){return Ui(i,a,te((e-t)/(r-t),0,1))}function Ui(e,t,r){return e*(1-r)+t*r}function s1(e){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let s of e)t=Math.min(t,s.x),r=Math.min(r,s.y),i=Math.max(i,s.x),a=Math.max(a,s.y);return[t,r,i,a]}function n1(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,s=-1/0,n=[];for(let l of e){let{x:u,y:h,z:c}=l.canonical,p=2**(t-c),d=u*p,f=h*p;n.push({id:l,x:d,y:f}),d<r&&(r=d),d>i&&(i=d),f<a&&(a=f),f>s&&(s=f)}let o=new Set;for(let l of n)(l.x===r||l.x===i||l.y===a||l.y===s)&&o.add(l.id);return o}function o1(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 Wu(e,t,r,i){return Ig(e,t,r,i)}const wl=Wu(.25,.1,.25,1);function te(e,t,r){return Math.min(r,Math.max(t,e))}function Vt(e,t,r){let i=r-t,a=((e-t)%i+i)%i+t;return a===t?r:a}function q(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function cs(e,t){let r={};for(let i of t)i in e&&(r[i]=e[i]);return r}let l1=1;function t0(){return l1++}function u1(e){return Math.log(e)/Math.LN2%1==0}function h1(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}function yt(e){return 2**e}function ft(e){return Math.log(e)/Math.LN2}function Ct(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 Hu(e,t,r){let i={};for(let a in e)i[a]=t.call(this,e[a],a,e);return i}function r0(e,t,r){let i={};for(let a in e)t.call(this,e[a],a,e)&&(i[a]=e[a]);return i}function rr(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(!rr(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(!rr(e[r],t[r]))return!1;return!0}return e===t}function bt(e){return Array.isArray(e)?e.map(bt):typeof e=="object"&&e?Hu(e,bt):e}const mc={};function fe(e){mc[e]||(typeof console<"u"&&console.warn(e),mc[e]=!0)}function Lr(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function c1(e,t,r,i){let a=t.y-e.y,s=t.x-e.x,n=i.y-r.y,o=i.x-r.x,l=n*s-o*a;if(l===0)return null;let u=e.y-r.y,h=e.x-r.x,c=(o*u-n*h)/l;return new M(e.x+c*s,e.y+c*a)}function p1([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 Ji(e){return typeof WorkerGlobalScope<"u"&&e!==void 0&&e instanceof WorkerGlobalScope}function d1(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,r={};if(e.replace(t,(i,a,s,n)=>{let o=s||n;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 Fo=null;function f1(e){if(Fo==null){let t=e.navigator?e.navigator.userAgent:null;Fo=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Fo}function ui(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}const m1=async(e,t)=>{if(e.byteLength===0)return createImageBitmap(new ImageData(1,1),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 ${ht(i).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},gc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",g1=e=>new Promise((t,r)=>{let i=new Image;i.onload=()=>{t(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>i.src=gc)},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=e.byteLength?URL.createObjectURL(a):gc});function _1(e,t,r,i,a){let s=Math.max(-t,0)*4,n=(Math.max(0,r)-r)*i*4+s,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:n,stride:o}]}}async function y1(e,t,r,i,a){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let s=new VideoFrame(e,{timestamp:0});try{let n=s==null?void 0:s.format;if(!n||!(n.startsWith("BGR")||n.startsWith("RGB")))throw Error(`Unrecognized format ${n}`);let o=n.startsWith("BGR"),l=new Uint8ClampedArray(i*a*4);if(await s.copyTo(l,_1(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{s.close()}}function Tl(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function Be(e){return e*Math.PI/180}function Vi(e){return e/Math.PI*180}function i0(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function v1(e){let t=new Float64Array(9);kg(t,e);let r=Vi(-Math.asin(te(t[2],-1,1))),i,a;return Math.hypot(t[5],t[8])<.001?(i=0,a=-Vi(Math.atan2(t[3],t[4]))):(i=Vi(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),a=Vi(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:i,pitch:r+90,bearing:a}}function x1(e,t,r){let i=cc(t.x-r.x,t.y-r.y),a=cc(e.x-r.x,e.y-r.y),s=i[0]*a[1]-i[1]*a[0];return Vi(Math.atan2(s,r1(i,a)))}function _c(e,t,r){let i=new Float64Array(4);return Zu(i,e,t-90,r),i}const ur=85.051129,a0={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},s0={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function b1(e,t){return a0[t]&&"touches"in e}function w1(e,t){var a,s;if(!s0[t])return!1;let r=e,i=((s=(a=r==null?void 0:r.target)==null?void 0:a.ownerDocument)==null?void 0:s.defaultView)||window;return r instanceof i.MouseEvent||r instanceof i.WheelEvent}function T1(e){return a0[e]||s0[e]}const yc="AbortError";var ps=class extends Error{constructor(e=yc){super(e instanceof Error?e.message:e),this.name=yc,e instanceof Error&&e.stack&&(this.stack=e.stack)}};function Nr(e){return e instanceof Error&&e.name==="AbortError"}function Xu(e){if(e.aborted)throw new ps(e.reason)}const _i={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function n0(e){return _i.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const Dl="global-dispatcher";var bn=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 Yu(){var e;if(Ji(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 D1=e=>{var t;return e.startsWith("file:")||((t=Yu())==null?void 0:t.startsWith("file:"))&&!/^\w+:/.test(e)};async function A1(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:Yu(),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(n){throw Nr(n)?n:new bn(0,ht(n).message,e.url,new Blob)}if(!i.ok){let n=await i.blob();throw new bn(i.status,i.statusText,e.url,n)}let a;a=e.type==="arrayBuffer"||e.type==="image"?i.arrayBuffer():e.type==="json"?i.json():i.text();let s=await a;return Xu(t.signal),{data:s,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}}function E1(e,t){return new Promise((r,i)=>{var s;let a=new XMLHttpRequest;a.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(a.responseType="arraybuffer");for(let n in e.headers)a.setRequestHeader(n,e.headers[n]);e.type==="json"&&(a.responseType="text",(s=e.headers)!=null&&s.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 n=a.response;if(e.type==="json")try{n=JSON.parse(a.response)}catch(o){i(o);return}r({data:n,cacheControl:a.getResponseHeader("Cache-Control"),expires:a.getResponseHeader("Expires"),etag:a.getResponseHeader("ETag")})}else{let n=new Blob([a.response],{type:a.getResponseHeader("Content-Type")});i(new bn(a.status,a.statusText,e.url,n))}},t.signal.addEventListener("abort",()=>{a.abort(),i(new ps(t.signal.reason))}),a.send(e.body)})}const Wn=async function(e,t){var r,i;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let a=n0(e.url);if(a){let s=await a(e,t);return!s.data&&e.type==="arrayBuffer"?q(s,{data:new ArrayBuffer(0)}):s}if(Ji(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Dl},t)}if(!D1(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return A1(e,t);if(Ji(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:Dl},t)}return E1(e,t)},Hn=(e,t)=>Wn(q(e,{type:"json"}),t),o0=(e,t)=>Wn(q(e,{type:"arrayBuffer"}),t);function l0(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 S1=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");l0(i)||(t.crossOrigin="Anonymous"),a.src=i,t.appendChild(a)}})};function vc(e,t,r){var i;(i=r[e])!=null&&i.includes(t)||(r[e]||(r[e]=[]),r[e].push(t))}function zo(e,t,r){if(r!=null&&r[e]){let i=r[e].indexOf(t);i!==-1&&r[e].splice(i,1)}}var ds=class{constructor(e,t={}){q(this,t),this.type=e}},H=class extends ds{constructor(e,t={}){super("error",q({error:e},t))}},vt=class{on(e,t){return this._listeners||(this._listeners={}),vc(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return zo(e,t,this._listeners),zo(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||(this._oneTimeListeners={}),vc(e,t,this._oneTimeListeners),this):new Promise(r=>this.once(e,r))}fire(e,t){var a,s,n,o;let r=typeof e=="string"?new ds(e,t||{}):e,i=r.type;if(this.listens(i)){r.target=this;let l=((s=(a=this._listeners)==null?void 0:a[i])==null?void 0:s.slice())??[];for(let c of l)c.call(this,r);let u=((o=(n=this._oneTimeListeners)==null?void 0:n[i])==null?void 0:o.slice())??[];for(let c of u)zo(i,c,this._oneTimeListeners),c.call(this,r);let h=this._eventedParent;h&&(q(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(r))}else r instanceof H&&console.error(r.error);return this}listens(e){var t,r,i,a,s;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||(s=this._eventedParent)!=null&&s.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},u0={$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,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"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 P=u0,C1=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var R=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 fs={kind:"null"},$={kind:"number"},Q={kind:"string"},ae={kind:"boolean"},Ht={kind:"color"},Xn={kind:"projectionDefinition"},hi={kind:"object"},re={kind:"value"},P1={kind:"error"},Yn={kind:"collator"},ms={kind:"formatted"},Kn={kind:"padding"},Wa={kind:"colorArray"},Jn={kind:"numberArray"},gs={kind:"resolvedImage"},Qn={kind:"variableAnchorOffsetCollection"};function dt(e,t){return{kind:"array",itemType:e,N:t}}function Ie(e){if(e.kind==="array"){let t=Ie(e.itemType);return typeof e.N=="number"?`array<${t}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t}>`}return e.kind}const I1=[fs,$,Q,ae,Ht,Xn,ms,hi,dt(re),Kn,Jn,Wa,gs,Qn];function Ha(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Ha(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 I1)if(!Ha(r,t))return null}}return`Expected ${Ie(e)} but found ${Ie(t)} instead.`}function Ku(e,t){return t.some(r=>r.kind===e.kind)}function ci(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 Fr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}const h0=.96422,c0=.82521,p0=4/29,Al=6/29,d0=3*Al*Al,M1=Math.PI/180,F1=180/Math.PI;function f0(e){return e%=360,e<0&&(e+=360),e}function m0([e,t,r,i]){e=ko(e),t=ko(t),r=ko(r);let a,s,n=Ro((.2225045*e+.7168786*t+.0606169*r)/1);e===t&&t===r?a=s=n:(a=Ro((.4360747*e+.3850649*t+.1430804*r)/h0),s=Ro((.0139322*e+.0971045*t+.7141733*r)/c0));let o=116*n-16;return[o<0?0:o,500*(a-n),200*(n-s),i]}function ko(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Ro(e){return e>.008856451679035631?e**(1/3):e/d0+p0}function g0([e,t,r,i]){let a=(e+16)/116,s=isNaN(t)?a:a+t/500,n=isNaN(r)?a:a-r/200;return a=1*Lo(a),s=h0*Lo(s),n=c0*Lo(n),[Bo(3.1338561*s-1.6168667*a-.4906146*n),Bo(-.9787684*s+1.9161415*a+.033454*n),Bo(.0719453*s-.2289914*a+1.4052427*n),i]}function Bo(e){return e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055,e<0?0:e>1?1:e}function Lo(e){return e>Al?e*e*e:d0*(e-p0)}function z1(e){let[t,r,i,a]=m0(e),s=Math.sqrt(r*r+i*i);return[Math.round(s*1e4)?f0(Math.atan2(i,r)*F1):NaN,s,t,a]}function k1([e,t,r,i]){return e=isNaN(e)?0:e*M1,g0([r,Math.cos(e)*t,Math.sin(e)*t,i])}function R1([e,t,r,i]){e=f0(e),t/=100,r/=100;function a(s){let n=(s+e/30)%12,o=t*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(n-3,9-n,1))}return[a(0),a(8),a(4),i]}const B1=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Oa(e,t){return B1(e,t)?e[t]:void 0}function L1(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Oa($1,e);if(t){let[i,a,s]=t;return[i/255,a/255,s/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[zs(e.slice(a,a+=i)),zs(e.slice(a,a+=i)),zs(e.slice(a,a+=i)),zs(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,s,n,o,l,u,h,c,p,d,f,m]=i,g=[o||" ",h||" ",d].join("");if(g===" "||g===" /"||g===",,"||g===",,,"){let _=[n,u,p].join(""),y=_==="%%%"?100:_===""?255:0;if(y){let x=[Bi(+s/y,0,1),Bi(+l/y,0,1),Bi(+c/y,0,1),f?xc(+f,m):1];if(bc(x))return x}}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,s,n,o,l,u,h,c]=r,p=[s||" ",o||" ",u].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){let d=[+a,Bi(+n,0,100),Bi(+l,0,100),h?xc(+h,c):1];if(bc(d))return R1(d)}}}function zs(e){return parseInt(e.padEnd(2,e),16)/255}function xc(e,t){return Bi(t?e/100:e,0,1)}function Bi(e,t,r){return Math.min(Math.max(t,e),r)}function bc(e){return!e.some(Number.isNaN)}const $1={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 Or(e,t,r){return e+r*(t-e)}function Qi(e,t,r){return e.map((i,a)=>Or(i,t[a],r))}function O1(e){return e==="rgb"||e==="hcl"||e==="lab"}var et,J=(et=class{constructor(t,r,i,a=1,s=!0){this.r=t,this.g=r,this.b=i,this.a=a,s||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t,r,i,a]))}static parse(t){if(t instanceof et)return t;if(typeof t!="string")return;let r=L1(t);if(r)return new et(...r,!1)}get rgb(){let{r:t,g:r,b:i,a}=this,s=a||1/0;return this.overwriteGetter("rgb",[t/s,r/s,i/s,a])}get hcl(){return this.overwriteGetter("hcl",z1(this.rgb))}get lab(){return this.overwriteGetter("lab",m0(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(s=>Math.round(s*255)).join(",")},${a})`}static interpolate(t,r,i,a="rgb"){switch(a){case"rgb":{let[s,n,o,l]=Qi(t.rgb,r.rgb,i);return new et(s,n,o,l,!1)}case"hcl":{let[s,n,o,l]=t.hcl,[u,h,c,p]=r.hcl,d,f;if(!isNaN(s)&&!isNaN(u)){let x=u-s;u>s&&x>180?x-=360:u<s&&s-u>180&&(x+=360),d=s+i*x}else isNaN(s)?isNaN(u)?d=NaN:(d=u,(o===1||o===0)&&(f=h)):(d=s,(c===1||c===0)&&(f=n));let[m,g,_,y]=k1([d,f??Or(n,h,i),Or(o,c,i),Or(l,p,i)]);return new et(m,g,_,y,!1)}case"lab":{let[s,n,o,l]=g0(Qi(t.lab,r.lab,i));return new et(s,n,o,l,!1)}}}},et.black=new et(0,0,0,1),et.white=new et(1,1,1,1),et.transparent=new et(0,0,0,0),et.red=new et(1,0,0,1),et);const V1=["bottom","center","top"];var El=class{constructor(t,r,i,a,s,n){this.text=t,this.image=r,this.scale=i,this.fontStack=a,this.textColor=s,this.verticalAlign=n}},Sr=class on{constructor(t){this.sections=t}static fromString(t){return new on([new El(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 on?t:on.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},pr=class Ma{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ma)return t;if(typeof t=="number")return new Ma([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 Ma(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new Ma(Qi(t.values,r.values,i))}},dr=class Fa{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Fa)return t;if(typeof t=="number")return new Fa([t]);if(Array.isArray(t)){for(let r of t)if(typeof r!="number")return;return new Fa(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new Fa(Qi(t.values,r.values,i))}},Nt=class za{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof za)return t;if(typeof t=="string"){let i=J.parse(t);return i?new za([i]):void 0}if(!Array.isArray(t))return;let r=[];for(let i of t){if(typeof i!="string")return;let a=J.parse(i);if(!a)return;r.push(a)}return new za(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,a="rgb"){let s=[];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 n=0;n<t.values.length;n++)s.push(J.interpolate(t.values[n],r.values[n],i,a));return new za(s)}},Te=class extends Error{constructor(e,t){super(e),this.name="RuntimeError",this.path=t}toJSON(){return this.message}};const j1=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var Wr=class ln{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ln)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"||!j1.has(i)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new ln(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,a){let s=t.values,n=r.values;if(s.length!==n.length)throw new Te(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`,a);let o=[];for(let l=0;l<s.length;l+=2){if(s[l]!==n[l])throw new Te(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${s[l]}, to[${l}]: ${n[l]}`,a);o.push(s[l]);let[u,h]=s[l+1],[c,p]=n[l+1];o.push([Or(u,c,i),Or(h,p,i)])}return new ln(o)}},hr=class _0{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new _0({name:t,available:!1}):null}},Hr=class Li{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 Li(t,r,i)}static parse(t){if(t instanceof Li)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new Li(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new Li(t.from,t.to,t.transition);if(typeof t=="string")return new Li(t,t,1)}},Ju=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 y0(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 ea(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Hr||e instanceof J||e instanceof Ju||e instanceof Sr||e instanceof pr||e instanceof dr||e instanceof Nt||e instanceof Wr||e instanceof hr)return!0;if(Array.isArray(e)){for(let t of e)if(!ea(t))return!1;return!0}if(typeof e=="object"){for(let t in e)if(!ea(e[t]))return!1;return!0}return!1}function $e(e){if(e===null)return fs;if(typeof e=="string")return Q;if(typeof e=="boolean")return ae;if(typeof e=="number")return $;if(e instanceof J)return Ht;if(e instanceof Hr)return Xn;if(e instanceof Ju)return Yn;if(e instanceof Sr)return ms;if(e instanceof pr)return Kn;if(e instanceof dr)return Jn;if(e instanceof Nt)return Wa;if(e instanceof Wr)return Qn;if(e instanceof hr)return gs;if(Array.isArray(e)){let t=e.length,r;for(let i of e){let a=$e(i);if(!r)r=a;else{if(r===a)continue;r=re;break}}return dt(r||re,t)}return hi}function Va(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof J||e instanceof Hr||e instanceof Sr||e instanceof pr||e instanceof dr||e instanceof Nt||e instanceof Wr||e instanceof hr?e.toString():JSON.stringify(e)}var ta=class v0{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(!ea(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let i=t[1],a=$e(i),s=r.expectedType;return a.kind==="array"&&a.N===0&&s&&s.kind==="array"&&(typeof s.N!="number"||s.N===0)&&(a=s),new v0(a,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const N1=["Unknown","Point","LineString","Polygon"];var x0=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"?N1[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=J.parse(t),this._parseColorCache.set(t,r)),r}};function eo(e,t,r){let i=e.length-1,a=0,s=i,n=0,o,l;for(;a<=s;)if(n=Math.floor((a+s)/2),o=e[n],l=e[n+1],o<=t){if(n===i||t<l)return n;a=n+1}else if(o>t)s=n-1;else throw new Te("Input is not a number.",r);return 0}var Qu=class b0{constructor(t,r,i,a){this.type=t,this.input=r,this.key=a,this.labels=[],this.outputs=[];for(let[s,n]of i)this.labels.push(s),this.outputs.push(n)}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,$);if(!i)return null;let a=[],s=null;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);for(let n=1;n<t.length;n+=2){let o=n===1?-1/0:t[n],l=t[n+1],u=n,h=n+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,s);if(!c)return null;s||(s=c.type),a.push([o,c])}return new b0(s,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 s=r.length;return a>=r[s-1]?i[s-1].evaluate(t):i[eo(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 U1(e,t,r,i){let a=3*e,s=3*(r-e)-a,n=1-a-s,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 p=h;for(let m=0;m<8;m++){let g=((n*p+s)*p+a)*p-h;if(Math.abs(g)<c)return((u*p+l)*p+o)*p;let _=(3*n*p+2*s)*p+a;if(Math.abs(_)<1e-6)break;p-=g/_}let d=0,f=1;p=h;for(let m=0;m<20;m++){let g=((n*p+s)*p+a)*p;if(Math.abs(g-h)<c)break;h>g?d=p:f=p,p=(d+f)*.5}return((u*p+l)*p+o)*p}}var Ut=class Sl{constructor(t,r,i,a,s,n){this.type=t,this.operator=r,this.interpolation=i,this.input=a,this.key=n,this.labels=[],this.outputs=[];for(let[o,l]of s)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(t,r,i,a){let s=0;if(t.name==="exponential")s=$o(r,t.base,i,a);else if(t.name==="linear")s=$o(r,1,i,a);else if(t.name==="cubic-bezier"){let n=t.controlPoints;s=U1(n[0],n[1],n[2],n[3])($o(r,1,i,a))}return s}static parse(t,r){let[i,a,s,...n]=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(s=r.parse(s,2,$),!s)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Wa?l=Ht:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<n.length;u+=2){let h=n[u],c=n[u+1],p=u+3,d=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.',p);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.',p);let f=r.parse(c,d,l);if(!f)return null;l||(l=f.type),o.push([h,f])}return!Fr(l,$)&&!Fr(l,Xn)&&!Fr(l,Ht)&&!Fr(l,Kn)&&!Fr(l,Jn)&&!Fr(l,Wa)&&!Fr(l,Qn)&&!Fr(l,dt($))?r.error(`Type ${Ie(l)} is not interpolatable.`):new Sl(l,i,a,s,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 s=r.length;if(a>=r[s-1])return i[s-1].evaluate(t);let n=eo(r,a,this.key),o=r[n],l=r[n+1],u=Sl.interpolationFactor(this.interpolation,a,o,l),h=i[n].evaluate(t),c=i[n+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Or(h,c,u);case"color":return J.interpolate(h,c,u);case"padding":return pr.interpolate(h,c,u);case"colorArray":return Nt.interpolate(h,c,u);case"numberArray":return dr.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Wr.interpolate(h,c,u,this.key);case"array":return Qi(h,c,u);case"projectionDefinition":return Hr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return J.interpolate(h,c,u,"hcl");case"colorArray":return Nt.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return J.interpolate(h,c,u,"lab");case"colorArray":return Nt.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 $o(e,t,r,i){let a=i-r,s=e-r;return a===0?0:t===1?s/a:(t**+s-1)/(t**+a-1)}const Ne={color:J.interpolate,number:Or,padding:pr.interpolate,numberArray:dr.interpolate,colorArray:Nt.interpolate,variableAnchorOffsetCollection:Wr.interpolate,array:Qi};var w0=class T0{constructor(t){this.type=ms,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=[],s=!1;for(let n=1;n<=t.length-1;++n){let o=t[n];if(s&&typeof o=="object"&&!Array.isArray(o)){s=!1;let l=null;if(o["font-scale"]&&(l=r.parse(o["font-scale"],1,$),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,dt(Q)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,Ht),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!V1.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,Q),!c)return null}let p=a[a.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(t[n],1,re);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'.");s=!0,a.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new T0(a)}evaluate(t){return new Sr(this.sections.map(r=>{let i=r.content.evaluate(t);return $e(i)===gs?new El("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new El(Va(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 D0(e,t,r=0,i=e.length-1,a=q1){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),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);D0(e,t,Math.max(r,Math.floor(t-u*c/l+p)),Math.min(i,Math.floor(t+(l-u)*c/l+p)),a)}let s=e[t],n=r,o=i;for(ya(e,r,t),a(e[i],s)>0&&ya(e,r,i);n<o;){for(ya(e,n,o),n++,o--;a(e[n],s)<0;)n++;for(;a(e[o],s)>0;)o--}a(e[r],s)===0?ya(e,r,o):(o++,ya(e,o,i)),o<=t&&(r=o+1),t<=o&&(i=o-1)}}function ya(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function q1(e,t){return e<t?-1:+(e>t)}function eh(e,t){if(e.length<=1)return[e];let r=[],i,a;for(let s of e){let n=Z1(s);n!==0&&(s.area=Math.abs(n),a===void 0&&(a=n<0),a===n<0?(i&&r.push(i),i=[s]):i.push(s))}if(i&&r.push(i),t>1)for(let s=0;s<r.length;s++)r[s].length<=t||(D0(r[s],t,1,r[s].length-1,G1),r[s]=r[s].slice(0,t));return r}function G1(e,t){return t.area-e.area}function Z1(e){let t=0;for(let r=0,i=e.length,a=i-1,s,n;r<i;a=r++)s=e[r],n=e[a],t+=(n.x-s.x)*(s.y+n.y);return t}const ks={string:Q,number:$,boolean:ae,object:hi};var vr=class A0{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,s=t[0];if(s==="array"){let o;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in ks)||u==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=ks[u],i++}else o=re;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=dt(o,l)}else{if(!ks[s])throw Error(`Types doesn't contain name = ${s}`);a=ks[s]}let n=[];for(;i<t.length;i++){let o=r.parse(t[i],i,re);if(!o)return null;n.push(o)}return new A0(a,n,r.key)}evaluate(t){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(t);if(!Ha(this.type,$e(i)))return i;if(r===this.args.length-1)throw new Te(`Expected value to be of type ${Ie(this.type)}, but found ${Ie($e(i))} instead.`,this.key)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};const wc={"to-boolean":ae,"to-color":Ht,"to-number":$,"to-string":Q};var ji=class E0{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(!wc[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=wc[i],s=[];for(let n=1;n<t.length;n++){let o=r.parse(t[n],n,re);if(!o)return null;s.push(o)}return new E0(a,s,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 J)return r;if(typeof r=="string"){let s=t.parseColor(r);if(s)return s}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.`:y0(r[0],r[1],r[2],r[3]),!i))return new J(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Te(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=pr.parse(r);if(a)return a}throw new Te(`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=dr.parse(r);if(a)return a}throw new Te(`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=Nt.parse(r);if(a)return a}throw new Te(`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=Wr.parse(r);if(a)return a}throw new Te(`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 Te(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return Sr.fromString(Va(this.args[0].evaluate(t)));case"resolvedImage":return hr.fromString(Va(this.args[0].evaluate(t)));case"projectionDefinition":{let r=this.args[0].evaluate(t);if(Hr.parse(r))return r;throw new Te(`Could not parse projectionDefinition from value '${typeof r=="string"?r:JSON.stringify(r)}'`,this.key)}default:return Va(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},S0=class C0{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 s=1;s<t.length-1;s+=2){let n=t[s];if(typeof n!="string")return r.error(`Expected string, but found ${typeof n} instead.`,s);if(/[^a-zA-Z0-9_]/.test(n))return r.error("Variable names must contain only alphanumeric characters or '_'.",s);let o=r.parse(t[s+1],s+1);if(!o)return null;i.push([n,o])}let a=r.parse(t[t.length-1],t.length-1,r.expectedType,i);return a?new C0(i,a):null}outputDefined(){return this.result.outputDefined()}},P0=class I0{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 I0(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}},W1=class M0{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,$),a=r.parse(t[2],2,dt(r.expectedType||re));if(!i||!a)return null;let s=a.type;return new M0(s.itemType,i,a,r.key)}evaluate(t){let r=this.index.evaluate(t),i=this.input.evaluate(t);if(r<0)throw new Te(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new Te(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new Te(`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}},H1=class F0{constructor(t,r,i){this.needle=t,this.haystack=r,this.key=i,this.type=ae}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,re),a=r.parse(t[2],2,re);return!i||!a?null:Ku(i.type,[ae,Q,$,fs,re])?new F0(i,a,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ie(i.type)} instead`)}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!ci(r,["boolean","string","number","null"]))throw new Te(`Expected first argument to be of type boolean, string, number or null, but found ${Ie($e(r))} instead.`,this.key);if(!ci(i,["string","array"]))throw new Te(`Expected second argument to be of type array or string, but found ${Ie($e(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},X1=class Cl{constructor(t,r,i,a){this.needle=t,this.haystack=r,this.key=i,this.fromIndex=a,this.type=$}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,re),a=r.parse(t[2],2,re);if(!i||!a)return null;if(!Ku(i.type,[ae,Q,$,fs,re]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ie(i.type)} instead`);if(t.length===4){let s=r.parse(t[3],3,$);return s?new Cl(i,a,r.key,s):null}return new Cl(i,a,r.key)}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!ci(r,["boolean","string","number","null"]))throw new Te(`Expected first argument to be of type boolean, string, number or null, but found ${Ie($e(r))} instead.`,this.key);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(t)),ci(i,["string"])){let s=i.indexOf(r,a);return s===-1?-1:[...i.slice(0,s)].length}if(ci(i,["array"]))return i.indexOf(r,a);throw new Te(`Expected second argument to be of type array or string, but found ${Ie($e(i))} instead.`,this.key)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},Y1=class z0{constructor(t,r,i,a,s,n){this.inputType=t,this.type=r,this.input=i,this.cases=a,this.outputs=s,this.otherwise=n}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 s={},n=[];for(let u=2;u<t.length-1;u+=2){let h=t[u],c=t[u+1];Array.isArray(h)||(h=[h]);let p=r.concat(u);if(h.length===0)return p.error("Expected at least one branch label.");for(let f of h){if(typeof f!="number"&&typeof f!="string")return p.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof f=="number"&&Math.floor(f)!==f)return p.error("Numeric branch labels must be integer values.");if(!i)i=$e(f);else if(p.checkSubtype(i,$e(f)))return null;if(s[String(f)]!==void 0)return p.error("Branch labels must be unique.");s[String(f)]=n.length}let d=r.parse(c,u,a);if(!d)return null;a||(a=d.type),n.push(d)}let o=r.parse(t[1],1,re);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 z0(i,a,o,s,n,l)}evaluate(t){let r=this.input.evaluate(t);return($e(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()}},K1=class k0{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 n=1;n<t.length-1;n+=2){let o=r.parse(t[n],n,ae);if(!o)return null;let l=r.parse(t[n+1],n+1,i);if(!l)return null;a.push([o,l]),i||(i=l.type)}let s=r.parse(t[t.length-1],t.length-1,i);if(!s)return null;if(!i)throw Error("Can't infer output type");return new k0(i,a,s)}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()}},J1=class Pl{constructor(t,r,i,a,s){this.type=t,this.input=r,this.beginIndex=i,this.key=a,this.endIndex=s}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,re),a=r.parse(t[2],2,$);if(!i||!a)return null;if(!Ku(i.type,[dt(re),Q,re]))return r.error(`Expected first argument to be of type array or string, but found ${Ie(i.type)} instead`);if(t.length===4){let s=r.parse(t[3],3,$);return s?new Pl(i.type,i,a,r.key,s):null}return new Pl(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)),ci(r,["string"]))return[...r].slice(i,a).join("");if(ci(r,["array"]))return r.slice(i,a);throw new Te(`Expected first argument to be of type array or string, but found ${Ie($e(r))} instead.`,this.key)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},R0=class Il{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 s=[];for(let n of t.slice(1)){let o=r.parse(n,1+s.length,i,void 0,{typeAnnotation:"omit"});if(!o)return null;i||(i=o.type),s.push(o)}if(!i)throw Error("No output type");return a&&s.some(n=>Ha(a,n.type))?new Il(re,s):new Il(i,s)}evaluate(t){let r=null,i=0,a;for(let s of this.args)if(i++,r=s.evaluate(t),r&&r instanceof hr&&!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 Tc(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 Q1(e,t,r){return t===r}function e_(e,t,r){return t!==r}function t_(e,t,r){return t<r}function r_(e,t,r){return t>r}function i_(e,t,r){return t<=r}function a_(e,t,r){return t>=r}function B0(e,t,r,i){return i.compare(t,r)===0}function s_(e,t,r,i){return!B0(e,t,r,i)}function n_(e,t,r,i){return i.compare(t,r)<0}function o_(e,t,r,i){return i.compare(t,r)>0}function l_(e,t,r,i){return i.compare(t,r)<=0}function u_(e,t,r,i){return i.compare(t,r)>=0}function ua(e,t,r){let i=e!=="=="&&e!=="!=";return class L0{constructor(s,n,o,l){this.lhs=s,this.rhs=n,this.key=o,this.collator=l,this.type=ae,this.hasUntypedArgument=s.type.kind==="value"||n.type.kind==="value"}static parse(s,n){if(s.length!==3&&s.length!==4)return n.error("Expected two or three arguments.");let o=s[0],l=n.parse(s[1],1,re);if(!l)return null;if(!Tc(o,l.type))return n.concat(1).error(`"${o}" comparisons are not supported for type '${Ie(l.type)}'.`);let u=n.parse(s[2],2,re);if(!u)return null;if(!Tc(o,u.type))return n.concat(2).error(`"${o}" comparisons are not supported for type '${Ie(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return n.error(`Cannot compare types '${Ie(l.type)}' and '${Ie(u.type)}'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new vr(u.type,[l],n.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new vr(l.type,[u],n.key)));let h=null;if(s.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return n.error("Cannot use collator to compare non-string types.");if(h=n.parse(s[3],3,Yn),!h)return null}return new L0(l,u,n.key,h)}evaluate(s){let n=this.lhs.evaluate(s),o=this.rhs.evaluate(s);if(i&&this.hasUntypedArgument){let l=$e(n),u=$e(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new Te(`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=$e(n),u=$e(o);if(l.kind!=="string"||u.kind!=="string")return t(s,n,o)}return this.collator?r(s,n,o,this.collator.evaluate(s)):t(s,n,o)}eachChild(s){s(this.lhs),s(this.rhs),this.collator&&s(this.collator)}outputDefined(){return!0}}}const h_=ua("==",Q1,B0),c_=ua("!=",e_,s_),p_=ua("<",t_,n_),d_=ua(">",r_,o_),f_=ua("<=",i_,l_),m_=ua(">=",a_,u_);var $0=class O0{constructor(t,r,i){this.type=Yn,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,ae);if(!a)return null;let s=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,ae);if(!s)return null;let n=null;return i.locale&&(n=r.parse(i.locale,1,Q),!n)?null:new O0(a,s,n)}evaluate(t){return new Ju(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}},g_=class V0{constructor(t,r,i,a,s,n){this.type=Q,this.number=t,this.locale=r,this.currency=i,this.unit=a,this.minFractionDigits=s,this.maxFractionDigits=n}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let i=r.parse(t[1],1,$);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 s=null;if(a.locale&&(s=r.parse(a.locale,1,Q),!s))return null;let n=null;if(a.currency&&(n=r.parse(a.currency,1,Q),!n))return null;let o=null;if(a.unit&&(o=r.parse(a.unit,1,Q),!o))return null;if(n&&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,$),!l))return null;let u=null;return a["max-fraction-digits"]&&(u=r.parse(a["max-fraction-digits"],1,$),!u)?null:new V0(i,s,n,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}},__=class j0{constructor(t){this.type=gs,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let i=r.parse(t[1],1,Q);return i?new j0(i):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),i=hr.fromString(r);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(r)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}},y_=class N0{constructor(t,r){this.input=t,this.key=r,this.type=$}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 ${Ie(i.type)} instead.`):new N0(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 Te(`Expected value to be of type string or array, but found ${Ie($e(r))} instead.`,this.key)}eachChild(t){t(this.input)}outputDefined(){return!1}};const nr=8192;function v_(e,t){let r=x_(e[0]),i=w_(e[1]),a=2**t.z;return[Math.round(r*a*nr),Math.round(i*a*nr)]}function th(e,t){let r=2**t.z,i=(e[0]/nr+t.x)/r,a=(e[1]/nr+t.y)/r;return[b_(i),T_(a)]}function x_(e){return(180+e)/360}function b_(e){return e*360-180}function w_(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function T_(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function _s(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 Xa(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function D_(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 A_(e,t,r){let i=e[0]-t[0],a=e[1]-t[1],s=e[0]-r[0],n=e[1]-r[1];return i*n-s*a===0&&i*s<=0&&a*n<=0}function to(e,t,r,i){let a=[t[0]-e[0],t[1]-e[1]];return P_([i[0]-r[0],i[1]-r[1]],a)!==0&&!!(Dc(e,t,r,i)&&Dc(r,i,e,t))}function E_(e,t,r){for(let i of r)for(let a=0;a<i.length-1;++a)if(to(e,t,i[a],i[a+1]))return!0;return!1}function ha(e,t,r=!1){let i=!1;for(let a of t)for(let s=0;s<a.length-1;s++){if(A_(e,a[s],a[s+1]))return r;D_(e,a[s],a[s+1])&&(i=!i)}return i}function S_(e,t){for(let r of t)if(ha(e,r))return!0;return!1}function U0(e,t){for(let r of e)if(!ha(r,t))return!1;for(let r=0;r<e.length-1;++r)if(E_(e[r],e[r+1],t))return!1;return!0}function C_(e,t){for(let r of t)if(U0(e,r))return!0;return!1}function P_(e,t){return e[0]*t[1]-e[1]*t[0]}function Dc(e,t,r,i){let a=e[0]-r[0],s=e[1]-r[1],n=t[0]-r[0],o=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],h=a*u-l*s,c=n*u-l*o;return h>0&&c<0||h<0&&c>0}function rh(e,t,r){let i=[];for(let a=0;a<e.length;a++){let s=[];for(let n=0;n<e[a].length;n++){let o=v_(e[a][n],r);_s(t,o),s.push(o)}i.push(s)}return i}function q0(e,t,r){let i=[];for(let a=0;a<e.length;a++){let s=rh(e[a],t,r);i.push(s)}return i}function G0(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let a=i*.5,s=e[0]-r[0]>a?-i:r[0]-e[0]>a?i:0;s===0&&(s=e[0]-r[2]>a?-i:r[2]-e[0]>a?i:0),e[0]+=s}_s(t,e)}function I_(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function Ac(e,t,r,i){let a=2**i.z*nr,s=[i.x*nr,i.y*nr],n=[];for(let o of e)for(let l of o){let u=[l.x+s[0],l.y+s[1]];G0(u,t,r,a),n.push(u)}return n}function Ec(e,t,r,i){let a=2**i.z*nr,s=[i.x*nr,i.y*nr],n=[];for(let o of e){let l=[];for(let u of o){let h=[u.x+s[0],u.y+s[1]];_s(t,h),l.push(h)}n.push(l)}if(t[2]-t[0]<=a/2){I_(t);for(let o of n)for(let l of o)G0(l,t,r,a)}return n}function M_(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 s=rh(t.coordinates,i,a),n=Ac(e.geometry(),r,i,a);if(!Xa(r,i))return!1;for(let o of n)if(!ha(o,s))return!1}if(t.type==="MultiPolygon"){let s=q0(t.coordinates,i,a),n=Ac(e.geometry(),r,i,a);if(!Xa(r,i))return!1;for(let o of n)if(!S_(o,s))return!1}return!0}function F_(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 s=rh(t.coordinates,i,a),n=Ec(e.geometry(),r,i,a);if(!Xa(r,i))return!1;for(let o of n)if(!U0(o,s))return!1}if(t.type==="MultiPolygon"){let s=q0(t.coordinates,i,a),n=Ec(e.geometry(),r,i,a);if(!Xa(r,i))return!1;for(let o of n)if(!C_(o,s))return!1}return!0}var ih=class un{constructor(t,r){this.type=ae,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(ea(t[1])){let i=t[1];if(i.type==="FeatureCollection"){let a=[];for(let s of i.features){let{type:n,coordinates:o}=s.geometry;n==="Polygon"&&a.push(o),n==="MultiPolygon"&&a.push(...o)}if(a.length)return new un(i,{type:"MultiPolygon",coordinates:a})}else if(i.type==="Feature"){let a=i.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new un(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new un(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 M_(t,this.geometries);if(t.geometryType()==="LineString")return F_(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Z0=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 s=t-1>>1,n=r[s];if(i(a,n)>=0)break;r[t]=n,t=s}r[t]=a}_down(t){let{data:r,compare:i}=this,a=this.length>>1,s=r[t];for(;t<a;){let n=(t<<1)+1,o=n+1;if(o<this.length&&i(r[o],r[n])<0&&(n=o),i(r[n],s)>=0)break;r[t]=r[n],t=n}r[t]=s}};const Sc=Math.PI/180;var ah=class{constructor(t){let r=Sc*6378.137*1e3,i=Math.cos(t*Sc),a=1/(1-.0066943799901413165*(1-i*i)),s=Math.sqrt(a);this.kx=r*s*i,this.ky=r*s*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,s,n,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,p=(t[l+1][1]-h)*this.ky,d=0;(c!==0||p!==0)&&(d=(this.wrap(r[0]-u)*this.kx*c+(r[1]-h)*this.ky*p)/(c*c+p*p),d>1?(u=t[l+1][0],h=t[l+1][1]):d>0&&(u+=c/this.kx*d,h+=p/this.ky*d)),c=this.wrap(r[0]-u)*this.kx,p=(r[1]-h)*this.ky;let f=c*c+p*p;f<i&&(i=f,a=u,s=h,n=l,o=d)}return{point:[a,s],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function W0(e,t){return t[0]-e[0]}function wn(e){return e[1]-e[0]+1}function Cr(e,t){return e[1]>=e[0]&&e[1]<t}function Ml(e,t){if(e[0]>e[1])return[null,null];let r=wn(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 Fl(e,t){if(!Cr(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)_s(r,e[i]);return r}function zl(e){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)for(let i of r)_s(t,i);return t}function Cc(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function sh(e,t,r){if(!Cc(e)||!Cc(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 ni(e,t,r){let i=r.pointOnLine(t,e);return r.distance(e,i.point)}function nh(e,t,r,i,a){let s=Math.min(ni(e,[r,i],a),ni(t,[r,i],a)),n=Math.min(ni(r,[e,t],a),ni(i,[e,t],a));return Math.min(s,n)}function z_(e,t,r,i,a){if(!(Cr(t,e.length)&&Cr(i,r.length)))return 1/0;let s=1/0;for(let n=t[0];n<t[1];++n){let o=e[n],l=e[n+1];for(let u=i[0];u<i[1];++u){let h=r[u],c=r[u+1];if(to(o,l,h,c))return 0;s=Math.min(s,nh(o,l,h,c,a))}}return s}function k_(e,t,r,i,a){if(!(Cr(t,e.length)&&Cr(i,r.length)))return NaN;let s=1/0;for(let n=t[0];n<=t[1];++n)for(let o=i[0];o<=i[1];++o)if(s=Math.min(s,a.distance(e[n],r[o])),s===0)return s;return s}function R_(e,t,r){if(ha(e,t,!0))return 0;let i=1/0;for(let a of t){let s=a[0],n=a[a.length-1];if(s!==n&&(i=Math.min(i,ni(e,[n,s],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 B_(e,t,r,i){if(!Cr(t,e.length))return NaN;for(let s=t[0];s<=t[1];++s)if(ha(e[s],r,!0))return 0;let a=1/0;for(let s=t[0];s<t[1];++s){let n=e[s],o=e[s+1];for(let l of r)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],d=l[u];if(to(n,o,p,d))return 0;a=Math.min(a,nh(n,o,p,d,i))}}return a}function Pc(e,t){for(let r of e)for(let i of r)if(ha(i,t,!0))return!0;return!1}function L_(e,t,r,i=1/0){let a=zl(e),s=zl(t);if(i!==1/0&&sh(a,s,r)>=i)return i;if(Xa(a,s)){if(Pc(e,t))return 0}else if(Pc(t,e))return 0;let n=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],p=o[l];for(let d of t)for(let f=0,m=d.length,g=m-1;f<m;g=f++){let _=d[g],y=d[f];if(to(c,p,_,y))return 0;n=Math.min(n,nh(c,p,_,y,r))}}return n}function Ic(e,t,r,i,a,s){if(!s)return;let n=sh(Fl(i,s),a,r);n<t&&e.push([n,s,[0,0]])}function Rs(e,t,r,i,a,s,n){if(!s||!n)return;let o=sh(Fl(i,s),Fl(a,n),r);o<t&&e.push([o,s,n])}function Tn(e,t,r,i,a=1/0){let s=Math.min(i.distance(e[0],r[0][0]),a);if(s===0)return s;let n=new Z0([[0,[0,e.length-1],[0,0]]],W0),o=zl(r);for(;n.length>0;){let l=n.pop();if(l[0]>=s)continue;let u=l[1],h=t?50:100;if(wn(u)<=h){if(!Cr(u,e.length))return NaN;if(t){let c=B_(e,u,r,i);if(isNaN(c)||c===0)return c;s=Math.min(s,c)}else for(let c=u[0];c<=u[1];++c){let p=R_(e[c],r,i);if(s=Math.min(s,p),s===0)return 0}}else{let c=Ml(u,t);Ic(n,s,i,e,o,c[0]),Ic(n,s,i,e,o,c[1])}}return s}function Dn(e,t,r,i,a,s=1/0){let n=Math.min(s,a.distance(e[0],r[0]));if(n===0)return n;let o=new Z0([[0,[0,e.length-1],[0,r.length-1]]],W0);for(;o.length>0;){let l=o.pop();if(l[0]>=n)continue;let u=l[1],h=l[2],c=t?50:100,p=i?50:100;if(wn(u)<=c&&wn(h)<=p){if(!Cr(u,e.length)&&Cr(h,r.length))return NaN;let d;if(t&&i)d=z_(e,u,r,h,a),n=Math.min(n,d);else if(t&&!i){let f=e.slice(u[0],u[1]+1);for(let m=h[0];m<=h[1];++m)if(d=ni(r[m],f,a),n=Math.min(n,d),n===0)return n}else if(!t&&i){let f=r.slice(h[0],h[1]+1);for(let m=u[0];m<=u[1];++m)if(d=ni(e[m],f,a),n=Math.min(n,d),n===0)return n}else d=k_(e,u,r,h,a),n=Math.min(n,d)}else{let d=Ml(u,t),f=Ml(h,i);Rs(o,n,a,e,r,d[0],f[0]),Rs(o,n,a,e,r,d[0],f[1]),Rs(o,n,a,e,r,d[1],f[0]),Rs(o,n,a,e,r,d[1],f[1])}}return n}function $_(e,t){let r=e.geometry(),i=r.flat().map(n=>th([n.x,n.y],e.canonical));if(r.length===0)return NaN;let a=new ah(i[0][1]),s=1/0;for(let n of t){switch(n.type){case"Point":s=Math.min(s,Dn(i,!1,[n.coordinates],!1,a,s));break;case"LineString":s=Math.min(s,Dn(i,!1,n.coordinates,!0,a,s));break;case"Polygon":s=Math.min(s,Tn(i,!1,n.coordinates,a,s))}if(s===0)return s}return s}function O_(e,t){let r=e.geometry(),i=r.flat().map(n=>th([n.x,n.y],e.canonical));if(r.length===0)return NaN;let a=new ah(i[0][1]),s=1/0;for(let n of t){switch(n.type){case"Point":s=Math.min(s,Dn(i,!0,[n.coordinates],!1,a,s));break;case"LineString":s=Math.min(s,Dn(i,!0,n.coordinates,!0,a,s));break;case"Polygon":s=Math.min(s,Tn(i,!0,n.coordinates,a,s))}if(s===0)return s}return s}function V_(e,t){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let i=eh(r,0).map(n=>n.map(o=>o.map(l=>th([l.x,l.y],e.canonical)))),a=new ah(i[0][0][0][1]),s=1/0;for(let n of t)for(let o of i){switch(n.type){case"Point":s=Math.min(s,Tn([n.coordinates],!1,o,a,s));break;case"LineString":s=Math.min(s,Tn(n.coordinates,!0,o,a,s));break;case"Polygon":s=Math.min(s,L_(o,n.coordinates,a,s))}if(s===0)return s}return s}function Oo(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 oh=class hn{constructor(t,r){this.type=$,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(ea(t[1])){let i=t[1];if(i.type==="FeatureCollection")return new hn(i,i.features.map(a=>Oo(a.geometry)).flat());if(i.type==="Feature")return new hn(i,Oo(i.geometry));if("type"in i&&"coordinates"in i)return new hn(i,Oo(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 $_(t,this.geometries);if(t.geometryType()==="LineString")return O_(t,this.geometries);if(t.geometryType()==="Polygon")return V_(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},j_=class H0{constructor(t){let r=null;for(let i of t)if(!r)r=i.type;else{if(r===i.type)continue;r=re;break}this.type=dt(r??re,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(!ea(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let i=t[1],a=$e(i);if(a.kind==="array"){let s=i.map(n=>r.parse(n,null,re));return new H0(s)}return new ta(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())}},lh=class X0{constructor(t){this.key=t,this.type=re}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 X0(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:Oa(r,this.key)??null}eachChild(){}outputDefined(){return!1}};const qi={"==":h_,"!=":c_,">":d_,"<":p_,">=":m_,"<=":f_,array:vr,at:W1,boolean:vr,case:K1,coalesce:R0,collator:$0,format:w0,image:__,in:H1,"index-of":X1,interpolate:Ut,"interpolate-hcl":Ut,"interpolate-lab":Ut,length:y_,let:S0,literal:ta,match:Y1,number:vr,"number-format":g_,object:vr,semiliteral:j_,slice:J1,step:Qu,string:vr,"to-boolean":ji,"to-color":ji,"to-number":ji,"to-string":ji,var:P0,within:ih,distance:oh,"global-state":lh};var ir=class extends Error{constructor(t,r){super(r),this.message=r,this.key=t}},N_=class Y0{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[i,a]of r)this.bindings[i]=a}concat(t){return new Y0(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}},K0=class J0{constructor(t,r,i=[],a,s=new N_,n=[]){this.registry=t,this.path=i,this.key=i.map(o=>`[${o}]`).join(""),this.scope=s,this.errors=n,this.expectedType=a,this._isConstant=r}parse(t,r,i,a,s={}){return r?this.concat(r,i,a)._parse(t,s):this._parse(t,s)}_parse(t,r){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);let i=this.key;function a(s,n,o){return o==="assert"?new vr(n,[s],i):o==="coerce"?new ji(n,[s],i):s}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 s=t[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[s];if(n){let o=n.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 ta)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new x0;try{o=new ta(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${s}". 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,s=i?this.scope.concat(i):this.scope;return new J0(this.registry,this._isConstant,a,r||null,s,this.errors)}error(t,...r){let i=`${this.key}${r.map(a=>`[${a}]`).join("")}`;this.errors.push(new ir(i,t))}checkSubtype(t,r){let i=Ha(t,r);return i&&this.error(i),i}},Di=class ka{constructor(t,r,i,a,s){this.name=t,this.type=r,this._evaluate=i,this.args=a,this.key=s}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=ka.definitions[i];if(!a)return r.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let s=Array.isArray(a)?a[0]:a.type,n=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=n.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,h]of o){l=new K0(r.registry,An,r.path,null,r.scope);let c=[],p=!1;for(let d=1;d<t.length;d++){let f=t[d],m=Array.isArray(u)?u[d-1]:u.type,g=l.parse(f,1+c.length,m);if(!g){p=!0;break}c.push(g)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let d=0;d<c.length;d++){let f=Array.isArray(u)?u[d]:u.type,m=c[d];l.concat(d+1).checkSubtype(f,m.type)}if(l.errors.length===0)return new ka(i,s,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:n).map(([c])=>q_(c)).join(" | "),h=[];for(let c=1;c<t.length;c++){let p=r.parse(t[c],1+h.length);if(!p)return null;h.push(Ie(p.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(", ")}) instead.`)}return null}static register(t,r){ka.definitions=r;for(let i in r)t[i]=ka}};function Mc(e,[t,r,i,a],s){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let n=a?a.evaluate(e):1,o=y0(t,r,i,n);if(o)throw new Te(o,s);return new J(t/255,r/255,i/255,n,!1)}function Fc(e,t){return e in t&&t[e]!==void 0}function Vo(e,t){let r=t[e];return r===void 0?null:r}function U_(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 Qr(e){return{type:e}}Di.register(qi,{error:[P1,[Q],(e,[t],r)=>{throw new Te(t.evaluate(e),r)}],typeof:[Q,[re],(e,[t])=>Ie($e(t.evaluate(e)))],"to-rgba":[dt($,4),[Ht],(e,[t])=>{let[r,i,a,s]=t.evaluate(e).rgb;return[r*255,i*255,a*255,s]}],rgb:[Ht,[$,$,$],Mc],rgba:[Ht,[$,$,$,$],Mc],has:{type:ae,overloads:[[[Q],(e,[t])=>Fc(t.evaluate(e),e.properties())],[[Q,hi],(e,[t,r])=>Fc(t.evaluate(e),r.evaluate(e))]]},get:{type:re,overloads:[[[Q],(e,[t])=>Vo(t.evaluate(e),e.properties())],[[Q,hi],(e,[t,r])=>Vo(t.evaluate(e),r.evaluate(e))]]},"feature-state":[re,[Q],(e,[t])=>Vo(t.evaluate(e),e.featureState||{})],properties:[hi,[],e=>e.properties()],"geometry-type":[Q,[],e=>e.geometryType()],id:[re,[],e=>e.id()],zoom:[$,[],e=>e.globals.zoom],"heatmap-density":[$,[],e=>e.globals.heatmapDensity||0],elevation:[$,[],e=>e.globals.elevation||0],"line-progress":[$,[],e=>e.globals.lineProgress||0],accumulated:[re,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[$,Qr($),(e,t)=>{let r=0;for(let i of t)r+=i.evaluate(e);return r}],"*":[$,Qr($),(e,t)=>{let r=1;for(let i of t)r*=i.evaluate(e);return r}],"-":{type:$,overloads:[[[$,$],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[$],(e,[t])=>-t.evaluate(e)]]},"/":[$,[$,$],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[$,[$,$],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[$,[],()=>Math.LN2],pi:[$,[],()=>Math.PI],e:[$,[],()=>Math.E],"^":[$,[$,$],(e,[t,r])=>t.evaluate(e)**+r.evaluate(e)],sqrt:[$,[$],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[$,[$],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[$,[$],(e,[t])=>Math.log(t.evaluate(e))],log2:[$,[$],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[$,[$],(e,[t])=>Math.sin(t.evaluate(e))],cos:[$,[$],(e,[t])=>Math.cos(t.evaluate(e))],tan:[$,[$],(e,[t])=>Math.tan(t.evaluate(e))],asin:[$,[$],(e,[t])=>Math.asin(t.evaluate(e))],acos:[$,[$],(e,[t])=>Math.acos(t.evaluate(e))],atan:[$,[$],(e,[t])=>Math.atan(t.evaluate(e))],min:[$,Qr($),(e,t)=>Math.min(...t.map(r=>r.evaluate(e)))],max:[$,Qr($),(e,t)=>Math.max(...t.map(r=>r.evaluate(e)))],abs:[$,[$],(e,[t])=>Math.abs(t.evaluate(e))],round:[$,[$],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[$,[$],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[$,[$],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ae,[Q,re],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[ae,[re],(e,[t])=>e.id()===t.value],"filter-type-==":[ae,[Q],(e,[t])=>e.geometryType()===t.value],"filter-<":[ae,[Q,re],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<a}],"filter-id-<":[ae,[re],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[ae,[Q,re],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>a}],"filter-id->":[ae,[re],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[ae,[Q,re],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[ae,[re],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[ae,[Q,re],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[ae,[re],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[ae,[re],(e,[t])=>{let r=t.value,i=e.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[ae,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[ae,[dt(Q)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ae,[dt(re)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ae,[Q,dt(re)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ae,[Q,dt(re)],(e,[t,r])=>U_(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:ae,overloads:[[[ae,ae],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Qr(ae),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:ae,overloads:[[[ae,ae],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Qr(ae),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[ae,[ae],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ae,[Q],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[Q,[Q],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Q,[Q],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Q,Qr(re),(e,t)=>t.map(r=>Va(r.evaluate(e))).join("")],split:[dt(Q),[Q,Q],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[Q,[dt(Q),Q],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],"resolved-locale":[Q,[Yn],(e,[t])=>t.evaluate(e).resolvedLocale()]});function q_(e){return Array.isArray(e)?`(${e.map(Ie).join(", ")})`:`(${Ie(e.type)}...)`}function An(e){if(e instanceof P0)return An(e.boundExpression);if(e instanceof Di&&e.name==="error"||e instanceof $0||e instanceof ih||e instanceof oh||e instanceof lh)return!1;let t=e instanceof ji||e instanceof vr,r=!0;return e.eachChild(i=>{r&&(r=t?An(i):i instanceof ta)}),r?ro(e)&&io(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function ro(e){if(e instanceof Di&&(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 ih||e instanceof oh)return!1;let t=!0;return e.eachChild(r=>{t&&!ro(r)&&(t=!1)}),t}function Ya(e){if(e instanceof Di&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(r=>{t&&!Ya(r)&&(t=!1)}),t}function io(e,t){if(e instanceof Di&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(i=>{r&&!io(i,t)&&(r=!1)}),r}function ra(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function Q0(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function uh(e){return!!e.expression&&e.expression.interpolated}function Ka(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function ie(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function ao(e){return typeof e=="object"&&!!e&&!Array.isArray(e)&&$e(e)===hi}function G_(e){return e}function Z_(e){switch(e.type){case"color":return J.parse;case"padding":return pr.parse;case"numberArray":return dr.parse;case"colorArray":return Nt.parse;default:return null}}function W_(e){switch(e){case"exponential":return tf;case"interval":return X_;case"categorical":return H_;case"identity":return Y_;default:throw Error(`Unknown function type "${e}"`)}}function ef(e,t){let r=e.stops&&typeof e.stops[0][0]=="object",i=r||e.property!==void 0,a=r||!i,s=e.type||(uh(t)?"exponential":"interval"),n=Z_(t);if(n&&(e=Ka({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],n(h[1])])),e.default?e.default=n(e.default):e.default=n(t.default)),e.colorSpace&&!O1(e.colorSpace))throw Error(`Unknown color space: "${e.colorSpace}"`);let o=W_(s),l,u;if(s==="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 p=[];for(let f of c)p.push([h[f].zoom,ef(h[f],t)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:Ut.interpolationFactor.bind(void 0,d),zoomStops:p.map(f=>f[0]),evaluate({zoom:f},m){return tf({stops:p,base:e.base},t,f).evaluate(f,m)}}}if(a){let h=s==="exponential"?{name:"exponential",base:e.base===void 0?1:e.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:Ut.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 p=c&&c.properties?c.properties[e.property]:void 0;return p===void 0?ys(e.default,t.default):o(e,t,p,l,u)}}}function ys(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function H_(e,t,r,i,a){return ys(typeof r===a?i[r]:void 0,e.default,t.default)}function X_(e,t,r){if(ie(r)!=="number")return ys(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=eo(e.stops.map(s=>s[0]),r,"");return e.stops[a][1]}function tf(e,t,r){let i=e.base===void 0?1:e.base;if(ie(r)!=="number")return ys(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 s=eo(e.stops.map(h=>h[0]),r,""),n=K_(r,i,e.stops[s][0],e.stops[s+1][0]),o=e.stops[s][1],l=e.stops[s+1][1],u=Ne[t.type]||G_;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,n,e.colorSpace)}}:u(o,l,n,e.colorSpace)}function Y_(e,t,r){switch(t.type){case"color":r=J.parse(r);break;case"formatted":r=Sr.fromString(r.toString());break;case"resolvedImage":r=hr.fromString(r.toString());break;case"padding":r=pr.parse(r);break;case"colorArray":r=Nt.parse(r);break;case"numberArray":r=dr.parse(r);break;default:ie(r)!==t.type&&(t.type!=="enum"||!t.values[r])&&(r=void 0)}return ys(r,e.default,t.default)}function K_(e,t,r,i){let a=i-r,s=e-r;return a===0?0:t===1?s/a:(t**+s-1)/(t**+a-1)}function kl(e){return{result:"success",value:e}}function $i(e){return{result:"error",value:e}}var hh=class{constructor(t,r,i,a){this.expression=t,this._warningHistory={},this._evaluator=new x0,this._defaultValue=i?lf(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=a,this._rootKey=r}evaluateWithoutErrorHandling(t,r,i,a,s,n){return this._globalState&&(t=ia(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=i,this._evaluator.canonical=a,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=n,this.expression.evaluate(this._evaluator)}evaluate(t,r,i,a,s,n){this._globalState&&(t=ia(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=i||null,this._evaluator.canonical=a,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=n||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 Te(`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 Te?o.path:"",u=`${l}|${o.message}`;return this._warningHistory[u]||(this._warningHistory[u]=!0,typeof console<"u"&&console.warn(rf(this._rootKey,l,o.message,this._defaultValue))),this._defaultValue}}};function rf(e,t,r,i){return`${e}${t}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function af(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 so(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in qi}function no(e,t,r,i){af(t);let a=new K0(qi,An,[],r?ey(r):void 0),s=a.parse(e,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?kl(new hh(s,t,r,i)):$i(a.errors)}var Ja=class{constructor(t,r,i){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Ya(r.expression),this.globalStateRefs=vs(r.expression),this._globalState=i}evaluateWithoutErrorHandling(t,r,i,a,s,n){return this._globalState&&(t=ia(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,r,i,a,s,n)}evaluate(t,r,i,a,s,n){return this._globalState&&(t=ia(t,this._globalState)),this._styleExpression.evaluate(t,r,i,a,s,n)}},En=class{constructor(t,r,i,a,s){this.kind=t,this.zoomStops=i,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Ya(r.expression),this.globalStateRefs=vs(r.expression),this.interpolationType=a,this._globalState=s}evaluateWithoutErrorHandling(t,r,i,a,s,n){return this._globalState&&(t=ia(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,r,i,a,s,n)}evaluate(t,r,i,a,s,n){return this._globalState&&(t=ia(t,this._globalState)),this._styleExpression.evaluate(t,r,i,a,s,n)}interpolationFactor(t,r,i){return this.interpolationType?Ut.interpolationFactor(this.interpolationType,t,r,i):0}};function J_(e){return e._styleExpression!==void 0}function sf(e,t,r,i){let a=no(e,t,r,i);if(a.result==="error")return a;let s=a.value.expression,n=ro(s);if(!n&&!ra(r))return $i([new ir("","data expressions not supported")]);let o=io(s,["zoom"]);if(!o&&!Q0(r))return $i([new ir("","zoom expressions not supported")]);let l=cn(s);if(!l&&!o)return $i([new ir("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof ir)return $i([l]);if(l instanceof Ut&&!uh(r))return $i([new ir("",'"interpolate" expressions cannot be used with this property')]);if(!l)return kl(n?new Ja("constant",a.value,i):new Ja("source",a.value,i));let u=l instanceof Ut?l.interpolation:void 0;return kl(n?new En("camera",a.value,l.labels,u,i):new En("composite",a.value,l.labels,u,i))}var nf=class of{constructor(t,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,af(r),this._parameters=t,this._specification=i,this._rootKey=r,this._defaultValue=lf(i),this._warningHistory={};let a=ef(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),s=`|${a}`;return this._warningHistory[s]||(this._warningHistory[s]=!0,typeof console<"u"&&console.warn(rf(this._rootKey,"",a,this._defaultValue))),this._defaultValue}}static deserialize(t){return new of(t._parameters,t._rootKey,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification,_rootKey:t._rootKey}}};function Q_(e,t,r,i){if(ao(e))return new nf(e,t,r);if(so(e)){let a=sf(e,t,r,i);if(a.result==="error")throw Error(a.value.map(s=>`${s.key}: ${s.message}`).join(", "));return a.value}{let a=e;return r.type==="color"&&typeof e=="string"?a=J.parse(e):r.type==="padding"&&(typeof e=="number"||Array.isArray(e))?a=pr.parse(e):r.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?a=dr.parse(e):r.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?a=Nt.parse(e):r.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?a=Wr.parse(e):r.type==="projectionDefinition"&&typeof e=="string"&&(a=Hr.parse(e)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>a}}}function cn(e){let t=null;if(e instanceof S0)t=cn(e.result);else if(e instanceof R0){for(let r of e.args)if(t=cn(r),t)break}else(e instanceof Qu||e instanceof Ut)&&e.input instanceof Di&&e.input.name==="zoom"&&(t=e);return t instanceof ir||e.eachChild(r=>{let i=cn(r);i instanceof ir?t=i:!t&&i?t=new ir("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new ir("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function vs(e,t=new Set){return e instanceof lh&&t.add(e.key),e.eachChild(r=>{vs(r,t)}),t}function ey(e){let t={color:Ht,string:Q,number:$,enum:Q,boolean:ae,formatted:ms,padding:Kn,numberArray:Jn,colorArray:Wa,projectionDefinition:Xn,resolvedImage:gs,variableAnchorOffsetCollection:Qn};return e.type==="array"?dt(t[e.value]||re,e.length):t[e.type]}function lf(e){if(e.type==="color"&&ao(e.default))return new J(0,0,0,0);switch(e.type){case"color":return J.parse(e.default)||null;case"padding":return pr.parse(e.default)||null;case"numberArray":return dr.parse(e.default)||null;case"colorArray":return Nt.parse(e.default)||null;case"variableAnchorOffsetCollection":return Wr.parse(e.default)||null;case"projectionDefinition":return Hr.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function ia(e,t){let{zoom:r,heatmapDensity:i,elevation:a,lineProgress:s,isSupportedScript:n,accumulated:o}=e??{};return{zoom:r,heatmapDensity:i,elevation:a,lineProgress:s,isSupportedScript:n,accumulated:o,globalState:t}}function ty(e){let t=!1;for(let r of e){let i=uf(r);if(i==="expression")return"expression";i==="legacy"&&(t=!0)}return t?"legacy":"neutral"}function uf(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 ty(e.slice(1));default:return"expression"}}function ch(e){return uf(e)!=="legacy"}function zc(e){return e==="$type"?["geometry-type"]:e==="$id"?["id"]:["get",e]}function ry(e){switch(e[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return e.length!==3||typeof e[1]!="string"?null:[e[0],zc(e[1]),e[2]];case"in":case"!in":{if(e.length<2||typeof e[1]!="string")return null;let t=["in",zc(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 hf(e){if((e[0]==="<"||e[0]==="<="||e[0]===">"||e[0]===">=")&&e[1]==="$type")return`"$type" cannot be use with operator "${e[0]}"`;let t=ry(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 jo(e,t,r){let i=r[e];return Array.isArray(i)?ch(i)?ph(i,t.concat(e)):{path:t.concat(e),legacyFilter:i}:null}function ph(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=jo(r,t,e);if(i)return i}break;case"!":{let r=jo(1,t,e);if(r)return r;break}case"case":for(let r=1;r<e.length-1;r+=2){let i=jo(r,t,e);if(i)return i}}return null}function iy(e,t){let r=ph(e);if(!r||typeof console>"u")return;let i=r.path.map(a=>`[${a}]`).join("");console.warn(`${t}${i}: ${hf(r.legacyFilter)}`)}const ay={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Qa(e,t,r){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};ch(e)?iy(e,t):e=Sn(e);let i=no(e,t,ay,r);if(i.result==="error")throw Error(i.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,s,n)=>i.value.evaluate(a,s,{},n),needGeometry:cf(e),getGlobalStateRefs:()=>vs(i.value.expression)}}function sy(e,t){return e<t?-1:+(e>t)}function cf(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(cf(e[t]))return!0;return!1}function Sn(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?No(e[1],e[2],"=="):t==="!="?Bs(No(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?No(e[1],e[2],t):t==="any"?ny(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Sn)):t==="none"?["all"].concat(e.slice(1).map(Sn).map(Bs)):t==="in"?kc(e[1],e.slice(2)):t==="!in"?Bs(kc(e[1],e.slice(2))):t==="has"?Rc(e[1]):t!=="!has"||Bs(Rc(e[1]))}function No(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 ny(e){return["any"].concat(e.map(Sn))}function kc(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(sy)]]:["filter-in-small",e,["literal",t]]}}function Rc(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Bs(e){return["!",e]}function pf(e){let t=e.key,r=e.value;return r?[new R(t,r,"constants have been deprecated as of v8")]:[]}function Le(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function yi(e){if(Array.isArray(e))return e.map(yi);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=yi(e[r]);return t}return Le(e)}function Pt(e){let t=e.key,r=e.value,i=e.valueSpec||{},a=e.objectElementValidators||{},s=e.style,n=e.styleSpec,o=e.validateSpec,l=[],u=ie(r);if(u!=="object")return[new R(t,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],p=Oa(i,c)||i["*"],d;if(Oa(a,c))d=a[c];else if(Oa(i,c)){if(r[h]===void 0)continue;d=o}else if(a["*"])d=a["*"];else if(i["*"])d=o;else{l.push(new R(t,r[h],`unknown property "${h}"`));continue}l=l.concat(d({key:(t&&`${t}.`)+h,value:r[h],valueSpec:p,style:s,styleSpec:n,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 R(t,r,`missing required property "${h}"`));return l}function dh(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,a=e.style,s=e.styleSpec,n=e.key,o=e.arrayElementValidator||i;if(ie(t)!=="array")return[new R(n,t,`array expected, ${ie(t)} found`)];if(r.length&&t.length!==r.length)return[new R(n,t,`array length ${r.length} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};s.$version<7&&(l.function=r.function),ie(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:s,key:`${n}[${h}]`}));return u}function oo(e){let t=e.key,r=e.value,i=e.valueSpec,a=ie(r);return a==="number"&&r!==r&&(a="NaN"),a==="number"?"minimum"in i&&r<i.minimum?[new R(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new R(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new R(t,r,`number expected, ${a} found`)]}function df(e){let t=e.valueSpec,r=Le(e.value.type),i,a={},s,n,o=r!=="categorical"&&e.value.property===void 0,l=!o,u=ie(e.value.stops)==="array"&&ie(e.value.stops[0])==="array"&&ie(e.value.stops[0][0])==="object",h=Pt({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 R(e.key,e.value,'missing required property "property"')),r!=="identity"&&!e.value.stops&&h.push(new R(e.key,e.value,'missing required property "stops"')),r==="exponential"&&e.valueSpec.expression&&!uh(e.valueSpec)&&h.push(new R(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!ra(e.valueSpec)?h.push(new R(e.key,e.value,"property functions not supported")):o&&!Q0(e.valueSpec)&&h.push(new R(e.key,e.value,"zoom functions not supported"))),(r==="categorical"||u)&&e.value.property===void 0&&h.push(new R(e.key,e.value,'"property" property is required')),h;function c(m){if(r==="identity")return[new R(m.key,m.value,'identity function may not have a "stops" property')];let g=[],_=m.value;return g=g.concat(dh({key:m.key,value:_,valueSpec:m.valueSpec,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,arrayElementValidator:p})),ie(_)==="array"&&_.length===0&&g.push(new R(m.key,_,"array must have at least one stop")),g}function p(m){let g=[],_=m.value,y=m.key;if(ie(_)!=="array")return[new R(y,_,`array expected, ${ie(_)} found`)];if(_.length!==2)return[new R(y,_,`array length 2 expected, length ${_.length} found`)];if(u){if(ie(_[0])!=="object")return[new R(y,_,`object expected, ${ie(_[0])} found`)];if(_[0].zoom===void 0)return[new R(y,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new R(y,_,"object stop key must have value")];if(n&&n>Le(_[0].zoom))return[new R(y,_[0].zoom,"stop zoom values must appear in ascending order")];Le(_[0].zoom)!==n&&(n=Le(_[0].zoom),s=void 0,a={}),g=g.concat(Pt({key:`${y}[0]`,value:_[0],valueSpec:{zoom:{}},validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,objectElementValidators:{zoom:oo,value:d}}))}else g=g.concat(d({key:`${y}[0]`,value:_[0],validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec},_));return so(yi(_[1]))?g.concat([new R(`${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 d(m,g){let _=ie(m.value),y=Le(m.value),x=m.value===null?g:m.value;if(!i)i=_;else if(_!==i)return[new R(m.key,x,`${_} stop domain type must match previous stop domain type ${i}`)];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new R(m.key,x,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&r!=="categorical"){let v=`number expected, ${_} found`;return ra(t)&&r===void 0&&(v+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new R(m.key,x,v)]}return r==="categorical"&&_==="number"&&(!isFinite(y)||Math.floor(y)!==y)?[new R(m.key,x,`integer expected, found ${y}`)]:r!=="categorical"&&_==="number"&&s!==void 0&&y<s?[new R(m.key,x,"stop domain values must appear in ascending order")]:(s=y,r==="categorical"&&y in a?[new R(m.key,x,"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 aa(e){let t=(e.expressionContext==="property"?sf:no)(yi(e.value),e.key,e.valueSpec);if(t.result==="error")return t.value.map(i=>new R(`${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 R(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"&&!Ya(r))return[new R(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!Ya(r))return[new R(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!io(r,["zoom","feature-state"]))return[new R(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!ro(r))return[new R(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function oy(e){let t=e.value,r=e.key,i=ie(t);return i==="boolean"?[]:[new R(r,t,`boolean expected, ${i} found`)]}function Rl(e){let t=e.key,r=e.value,i=ie(r);return i==="string"?J.parse(String(r))?[]:[new R(t,r,`color expected, "${r}" found`)]:[new R(t,r,`color expected, ${i} found`)]}function es(e){let t=e.key,r=e.value,i=e.valueSpec,a=[];return Array.isArray(i.values)?i.values.indexOf(Le(r))===-1&&a.push(new R(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Le(r))===-1&&a.push(new R(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),a}function ly(e,t){let r=e;for(let i of t)r=r[i];return r}function uy(e,t){let r=ph(t);return r?[new R(`${e.key}${r.path.map(i=>`[${i}]`).join("")}`,ly(e.value,r.path),hf(r.legacyFilter),null,"warning")]:[]}function fh(e){let t=yi(e.value);return ch(t)?[...uy(e,t),...aa(Ka({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:ff(e)}function ff(e){let t=e.value,r=e.key;if(ie(t)!=="array")return[new R(r,t,`array expected, ${ie(t)} found`)];let i=e.styleSpec,a,s=[];if(t.length<1)return[new R(r,t,"filter array must have at least 1 element")];switch(s=s.concat(es({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),Le(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Le(t[1])==="$type"&&s.push(new R(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&s.push(new R(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(a=ie(t[1]),a!=="string"&&s.push(new R(`${r}[1]`,t[1],`string expected, ${a} found`)));for(let n=2;n<t.length;n++)a=ie(t[n]),Le(t[1])==="$type"?s=s.concat(es({key:`${r}[${n}]`,value:t[n],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&s.push(new R(`${r}[${n}]`,t[n],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let n=1;n<t.length;n++)s=s.concat(ff({key:`${r}[${n}]`,value:t[n],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":a=ie(t[1]),t.length===2?a!=="string"&&s.push(new R(`${r}[1]`,t[1],`string expected, ${a} found`)):s.push(new R(r,t,`filter array for "${t[0]}" operator must have 2 elements`))}return s}function mf(e,t){let r=e.key,i=e.validateSpec,a=e.style,s=e.styleSpec,n=e.value,o=e.objectKey,l=s[`${t}_${e.layerType}`];if(!l)return[];let u=o.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:n,valueSpec:s.transition,style:a,styleSpec:s});let h=e.valueSpec||l[o];if(!h)return[new R(r,n,`unknown property "${o}"`)];let c;if(ie(n)==="string"&&ra(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(n)))return[new R(r,n,`"${o}" does not support interpolation syntax
|
|
5
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];let p=[];return e.layerType==="symbol"&&o==="text-font"&&ao(yi(n))&&Le(n.type)==="identity"&&p.push(new R(r,n,'"text-font" does not support identity functions')),p.concat(i({key:e.key,value:n,valueSpec:h,style:a,styleSpec:s,expressionContext:"property",propertyType:t,propertyKey:o}))}function gf(e){return mf(e,"paint")}function _f(e){return mf(e,"layout")}function yf(e){var l,u;let t=[],r=e.value,i=e.key,a=e.style,s=e.styleSpec;if(ie(r)!=="object")return[new R(i,r,`object expected, ${ie(r)} found`)];!r.type&&!r.ref&&t.push(new R(i,r,'either "type" or "ref" is required'));let n=Le(r.type),o=Le(r.ref);if(r.id){let h=Le(r.id);for(let c=0;c<e.arrayIndex;c++){let p=a.layers[c];Le(p.id)===h&&t.push(new R(i,r.id,`duplicate layer id "${r.id}", previously used at line ${p.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(c=>{c in r&&t.push(new R(i,r[c],`"${c}" is prohibited for ref layers`))});let h;a.layers.forEach(c=>{Le(c.id)===o&&(h=c)}),h?h.ref?t.push(new R(i,r.ref,"ref cannot reference another ref layer")):n=Le(h.type):t.push(new R(i,r.ref,`ref layer "${o}" not found`))}else if(n!=="background")if(!r.source)t.push(new R(i,r,'missing required property "source"'));else{let h=a.sources&&a.sources[r.source],c=h&&Le(h.type);h?c==="vector"&&n==="raster"?t.push(new R(i,r.source,`layer "${r.id}" requires a raster source`)):c!=="raster-dem"&&n==="hillshade"||c!=="raster-dem"&&n==="color-relief"?t.push(new R(i,r.source,`layer "${r.id}" requires a raster-dem source`)):c==="raster"&&n!=="raster"?t.push(new R(i,r.source,`layer "${r.id}" requires a vector source`)):c==="vector"&&!r["source-layer"]?t.push(new R(i,r,`layer "${r.id}" must specify a "source-layer"`)):c==="raster-dem"&&n!=="hillshade"&&n!=="color-relief"?t.push(new R(i,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):n==="line"&&r.paint&&r.paint["line-gradient"]&&(c!=="geojson"||!h.lineMetrics)&&t.push(new R(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new R(i,r.source,`source "${r.source}" not found`))}return n==="raster"&&((l=r.paint)!=null&&l.resampling)&&((u=r.paint)!=null&&u["raster-resampling"])&&t.push(new R(i,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t=t.concat(Pt({key:i,value:r,valueSpec:s.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:`${i}.type`,value:r.type,valueSpec:s.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"})},filter:fh,layout(h){return Pt({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return _f(Ka({layerType:n},c))}}})},paint(h){return Pt({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return gf(Ka({layerType:n},c))}}})}}})),t}function Ur(e){let t=e.value,r=e.key,i=ie(t);return i==="string"?[]:[new R(r,t,`string expected, ${i} found`)]}function hy(e){let t=e.sourceName??"",r=e.value,i=e.styleSpec,a=i.source_raster_dem,s=e.style,n=[],o=ie(r);if(r===void 0)return n;if(o!=="object")return n.push(new R("source_raster_dem",r,`object expected, ${o} found`)),n;let l=Le(r.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let c in r)!l&&u.includes(c)?n.push(new R(c,r[c],`In "${t}": "${c}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):a[c]?n=n.concat(e.validateSpec({key:c,value:r[c],valueSpec:a[c],validateSpec:e.validateSpec,style:s,styleSpec:i})):n.push(new R(c,r[c],`unknown property "${c}"`));return n}const Bc={promoteId:cy};function vf(e){let t=e.value,r=e.key,i=e.styleSpec,a=e.style,s=e.validateSpec;if(!t.type)return[new R(r,t,'"type" is required')];let n=Le(t.type),o;switch(n){case"vector":case"raster":return o=Pt({key:r,value:t,valueSpec:i[`source_${n.replace("-","_")}`],style:e.style,styleSpec:i,objectElementValidators:Bc,validateSpec:s}),o;case"raster-dem":return o=hy({sourceName:r,value:t,style:e.style,styleSpec:i,validateSpec:s}),o;case"geojson":if(o=Pt({key:r,value:t,valueSpec:i.source_geojson,style:a,styleSpec:i,validateSpec:s,objectElementValidators:Bc}),t.cluster)for(let l in t.clusterProperties){let[u,h]=t.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;o.push(...aa({key:`${r}.${l}.map`,value:h,expressionContext:"cluster-map"})),o.push(...aa({key:`${r}.${l}.reduce`,value:c,expressionContext:"cluster-reduce"}))}return o;case"video":return Pt({key:r,value:t,valueSpec:i.source_video,style:a,validateSpec:s,styleSpec:i});case"image":return Pt({key:r,value:t,valueSpec:i.source_image,style:a,validateSpec:s,styleSpec:i});case"canvas":return[new R(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return es({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function cy({key:e,value:t}){if(ie(t)==="string")return Ur({key:e,value:t});{let r=[];for(let i in t)r.push(...Ur({key:`${e}.${i}`,value:t[i]}));return r}}function xf(e){let t=e.value,r=e.styleSpec,i=r.light,a=e.style,s=[],n=ie(t);if(t===void 0)return s;if(n!=="object")return s=s.concat([new R("light",t,`object expected, ${n} found`)]),s;for(let o in t){let l=o.match(/^(.*)-transition$/);s=l&&i[l[1]]&&i[l[1]].transition?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:r.transition,validateSpec:e.validateSpec,style:a,styleSpec:r})):i[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],validateSpec:e.validateSpec,style:a,styleSpec:r})):s.concat([new R(o,t[o],`unknown property "${o}"`)])}return s}function bf(e){let t=e.value,r=e.styleSpec,i=r.sky,a=e.style,s=ie(t);if(t===void 0)return[];if(s!=="object")return[new R("sky",t,`object expected, ${s} found`)];let n=[];for(let o in t)n=i[o]?n.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],style:a,styleSpec:r})):n.concat([new R(o,t[o],`unknown property "${o}"`)]);return n}function wf(e){let t=e.value,r=e.styleSpec,i=r.terrain,a=e.style,s=[],n=ie(t);if(t===void 0)return s;if(n!=="object")return s=s.concat([new R("terrain",t,`object expected, ${n} found`)]),s;for(let o in t)s=i[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],validateSpec:e.validateSpec,style:a,styleSpec:r})):s.concat([new R(o,t[o],`unknown property "${o}"`)]);return s}function py(e){return Ur(e).length===0?[]:aa(e)}function dy(e){return Ur(e).length===0?[]:aa(e)}function fy(e){let t=e.key,r=e.value;if(ie(r)==="array"){if(r.length<1||r.length>4)return[new R(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},a=[];for(let s=0;s<r.length;s++)a=a.concat(e.validateSpec({key:`${t}[${s}]`,value:r[s],validateSpec:e.validateSpec,valueSpec:i}));return a}return oo({key:t,value:r,valueSpec:{}})}function my(e){let t=e.key,r=e.value;if(ie(r)==="array"){let i={type:"number"};if(r.length<1)return[new R(t,r,"array length at least 1 expected, length 0 found")];let a=[];for(let s=0;s<r.length;s++)a=a.concat(e.validateSpec({key:`${t}[${s}]`,value:r[s],validateSpec:e.validateSpec,valueSpec:i}));return a}return oo({key:t,value:r,valueSpec:{}})}function gy(e){let t=e.key,r=e.value;if(ie(r)==="array"){if(r.length<1)return[new R(t,r,"array length at least 1 expected, length 0 found")];let i=[];for(let a=0;a<r.length;a++)i=i.concat(Rl({key:`${t}[${a}]`,value:r[a]}));return i}return Rl({key:t,value:r})}function _y(e){let t=e.key,r=e.value,i=ie(r),a=e.styleSpec;if(i!=="array"||r.length<1||r.length%2!=0)return[new R(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<r.length;n+=2)s=s.concat(es({key:`${t}[${n}]`,value:r[n],valueSpec:a.layout_symbol["text-anchor"]})),s=s.concat(dh({key:`${t}[${n+1}]`,value:r[n+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return s}function Tf(e){let t=[],r=e.value,i=e.key;if(Array.isArray(r)){let a=[],s=[];for(let n in r)r[n].id&&a.includes(r[n].id)&&t.push(new R(i,r,`all the sprites' ids must be unique, but ${r[n].id} is duplicated`)),a.push(r[n].id),r[n].url&&s.includes(r[n].url)&&t.push(new R(i,r,`all the sprites' URLs must be unique, but ${r[n].url} is duplicated`)),s.push(r[n].url),t=t.concat(Pt({key:`${i}[${n}]`,value:r[n],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Ur({key:i,value:r})}function yy(e){let t=e.value,r=e.styleSpec,i=r.projection,a=e.style,s=ie(t);if(t===void 0)return[];if(s!=="object")return[new R("projection",t,`object expected, ${s} found`)];let n=[];for(let o in t)n=i[o]?n.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],style:a,styleSpec:r})):n.concat([new R(o,t[o],`unknown property "${o}"`)]);return n}function vy(e){let t=e.key,r=e.value;r=r instanceof String?r.valueOf():r;let i=ie(r);return i==="array"&&!by(r)&&!xy(r)?[new R(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(i)?[]:[new R(t,r,`projection expected, invalid type "${i}" found`)]}function xy(e){return!!["interpolate","step","literal"].includes(e[0])}function by(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function Bl(e){return!!e&&e.constructor===Object}function Df(e){return Bl(e.value)?[]:[new R(e.key,e.value,`object expected, ${ie(e.value)} found`)]}const Lc=1114111,wy=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;function Ty(e,t){if(ie(t)!=="string")return[];let r=`${t}`,i=()=>[new R(e,t,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],a=r.match(wy);if(!a)return i();let[,s,n,o]=a;if(o!==void 0)return o.length>6?i():[];let l=parseInt(s,16),u=n===void 0?l:parseInt(n,16);return l>Lc||u>Lc?[new R(e,t,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new R(e,t,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function Af(e){let t=e.key??"font-faces",r=e.value,i=e.validateSpec,a=e.styleSpec??u0,s=e.style;if(!Bl(r))return[new R(t,r,`object expected, ${ie(r)} found`)];let n=[];for(let o in r){let l=r[o],u=ie(l);if(u==="string")n.push(...Ur({key:`${t}.${o}`,value:l}));else if(u==="array"){let h={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[c,p]of l.entries()){let d=`${t}.${o}[${c}]`;n.push(...Pt({key:d,value:p,valueSpec:h,styleSpec:a,style:s,validateSpec:i}));let f=Bl(p)?p["unicode-range"]:void 0;if(ie(f)==="array")for(let[m,g]of f.entries())n.push(...Ty(`${d}.unicode-range[${m}]`,g))}}else n.push(new R(`${t}.${o}`,l,`string or array expected, ${u} found`))}return n}const $c={"*"(){return[]},array:dh,boolean:oy,number:oo,color:Rl,constants:pf,enum:es,filter:fh,function:df,layer:yf,object:Pt,source:vf,light:xf,sky:bf,terrain:wf,projection:yy,projectionDefinition:vy,string:Ur,formatted:py,resolvedImage:dy,padding:fy,numberArray:my,colorArray:gy,variableAnchorOffsetCollection:_y,sprite:Tf,state:Df,fontFaces:Af};function Cn(e){let t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=Cn,r.expression&&ao(Le(t))?df(e):r.expression&&so(yi(t))?aa(e):r.type&&$c[r.type]?$c[r.type](e):Pt(Ka({},e,{valueSpec:r.type?i[r.type]:r}))}function Ef(e){let t=e.value,r=e.key,i=Ur(e);return i.length||(t.indexOf("{fontstack}")===-1&&i.push(new R(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&i.push(new R(r,t,'"glyphs" url must include a "{range}" token'))),i}function Et(e,t=P){let r=[];return r=r.concat(Cn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Cn,objectElementValidators:{glyphs:Ef,"*"(){return[]}}})),e.constants&&(r=r.concat(pf({key:"constants",value:e.constants}))),Sf(r)}Et.source=kt(zt(vf)),Et.sprite=kt(zt(Tf)),Et.glyphs=kt(zt(Ef)),Et.fontFaces=kt(zt(Af)),Et.light=kt(zt(xf)),Et.sky=kt(zt(bf)),Et.terrain=kt(zt(wf)),Et.state=kt(zt(Df)),Et.layer=kt(zt(yf)),Et.filter=kt(zt(fh)),Et.paintProperty=kt(zt(gf)),Et.layoutProperty=kt(zt(_f));function zt(e){return function(t){return e(Object.assign({},t,{validateSpec:Cn}))}}function Sf(e){return[].concat(e).sort((t,r)=>t.line-r.line)}function kt(e){return function(...t){return Sf(e.apply(this,t))}}const Dy={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};var Ay=class{constructor(t,r,i){this._rootKey=r,this._globalState=i,this.setValue(t)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(t){if(t==null||t==="visible"||t==="none"){this._literalValue=t==="none"?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let r=no(t,this._rootKey,Dy,this._globalState);if(r.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));this._literalValue=void 0,this._compiledValue=r.value,this._globalStateRefs=vs(r.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Ey(e,t,r){return new Ay(e,t,r)}const xt=Et,Cf=new Set(Object.keys(P).filter(e=>e.startsWith("source_")).map(e=>e.slice(7).replaceAll("_","-")));function Sy(e){return Object.entries(e.sources??{}).filter(([,t])=>!Cf.has(t.type)).map(([t])=>`sources.${t}`)}function Oc(e,t){let r=Sy(t);return mh(e,xt(t).filter(({message:i})=>!r.some(a=>i.startsWith(`${a}:`)||i.startsWith(`${a}.`))))}function mh(e,t){let r=!1;for(let i of t){if(i.severity==="warning"){fe(i.message);continue}e.fire(new H(Error(i.message))),r=!0}return r}function xs(e,t,r,i){return(i==null?void 0:i.validate)!==!1&&mh(e,t({styleSpec:P,...r}))}var Ll=class Pf{constructor(t,r,i){let a=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let n=new Int32Array(this.arrayBuffer);t=n[0],r=n[1],i=n[2],this.d=r+2*i;for(let u=0;u<this.d*this.d;u++){let h=n[3+u],c=n[3+u+1];a.push(h===c?null:n.subarray(h,c))}let o=n[3+a.length],l=n[3+a.length+1];this.keys=n.subarray(o,l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*i;for(let n=0;n<this.d*this.d;n++)a.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=i,this.scale=r/t,this.uid=0;let s=i/r*t;this.min=-s,this.max=t+s}insert(t,r,i,a,s){this._forEachCell(r,i,a,s,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(a),this.bboxes.push(s)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,i,a,s,n){this.cells[s].push(n)}query(t,r,i,a,s){let n=this.min,o=this.max;if(t<=n&&r<=n&&o<=i&&o<=a&&!s)return[...this.keys];{let l=[];return this._forEachCell(t,r,i,a,this._queryCell,l,{},s),l}}_queryCell(t,r,i,a,s,n,o,l){let u=this.cells[s];if(u!==null){let h=this.keys,c=this.bboxes;for(let p of u)if(o[p]===void 0){let d=p*4;(l?l(c[d+0],c[d+1],c[d+2],c[d+3]):t<=c[d+2]&&r<=c[d+3]&&i>=c[d+0]&&a>=c[d+1])?(o[p]=!0,n.push(h[p])):o[p]=!1}}}_forEachCell(t,r,i,a,s,n,o,l){let u=this._convertToCellCoord(t),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(a);for(let d=u;d<=c;d++)for(let f=h;f<=p;f++){let m=this.d*f+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(f),this._convertFromCellCoord(d+1),this._convertFromCellCoord(f+1)))&&s.call(this,t,r,i,a,m,n,o,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,i=0;for(let n of this.cells)i+=n.length;let a=new Int32Array(r+i+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let s=r;for(let n=0;n<t.length;n++){let o=t[n];a[3+n]=s,a.set(o,s),s+=o.length}return a[3+t.length]=s,a.set(this.keys,s),s+=this.keys.length,a[3+t.length+1]=s,a.set(this.bboxes,s),s+=this.bboxes.length,a.buffer}static serialize(t,r){let i=t.toArrayBuffer();return r&&r.push(i),{buffer:i}}static deserialize(t){return new Pf(t.buffer)}};const xr={};function V(e,t,r={}){if(xr[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),xr[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}V("Object",Object),V("Set",Set),V("TransferableGridIndex",Ll),V("Color",J),V("Error",Error),V("AJAXError",bn),V("ResolvedImage",hr),V("StylePropertyFunction",nf),V("StyleExpression",hh,{omit:["_evaluator"]}),V("ZoomDependentExpression",En),V("ZoomConstantExpression",Ja),V("CompoundExpression",Di,{omit:["_evaluate"]});for(let e in qi)qi[e]._classRegistryKey||V(`Expression_${e}`,qi[e]);function If(e){var t;return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||((t=e.constructor)==null?void 0:t.name)==="ArrayBuffer")}function gh(e){let t=e.constructor;return e.$name||t._classRegistryKey}function Cy(e){if(typeof e!="object"||!e)return!1;let t=gh(e);return t&&t!=="Object"}function Mf(e){return!Cy(e)&&(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||If(e)||ui(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function ja(e,t){if(Mf(e))return(If(e)||ui(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let s=[];for(let n of e)s.push(ja(n,t));return s}if(typeof e!="object")throw Error(`can't serialize object of type ${typeof e}`);let r=gh(e);if(!r)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!xr[r])throw Error(`${r} is not registered.`);let{klass:i}=xr[r],a=i.serialize?i.serialize(e,t):{};if(i.serialize){if(a===(t==null?void 0:t[t.length-1]))throw Error("statically serialized object won't survive transfer of $name property")}else{for(let s in e){if(!e.hasOwnProperty(s)||xr[r].omit.includes(s))continue;let n=e[s];n!==void 0&&(a[s]=xr[r].shallow.includes(s)?n:ja(n,t))}e instanceof Error&&(a.message=e.message)}if(a.$name)throw Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(a.$name=r),a}function Na(e){if(Mf(e))return e;if(Array.isArray(e))return e.map(Na);if(typeof e!="object")throw Error(`can't deserialize object of type ${typeof e}`);let t=gh(e)||"Object";if(!xr[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:r}=xr[t];if(!r)throw Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);let i=Object.create(r.prototype);for(let a of Object.keys(e)){if(a==="$name")continue;let s=e[a];i[a]=xr[t].shallow.includes(a)?s:Na(s)}return i}var $l=class{constructor(){this.first=!0}update(t,r){let i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}};function Py(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function Iy(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function Ff(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function My(e){return/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))}function Fy(e){return/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e))}function zy(e){return/[\r\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0600-\u0605\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DD\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0890\u0891\u0897-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E33-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB3-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1037\u1039-\u103E\u1056-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1084-\u1086\u108D\u109D\u1100-\u11FF\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60\u1A62\u1A65-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA960-\uA97C\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCBD\uDCC2\uDCCD\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC2\uDDC3\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF1F\uDF22-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE84-\uDE99\uDF60-\uDF67]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6\uDF00-\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD2F]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD63\uDD67-\uDD6A\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF\uDDEE\uDDEF\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDDE6-\uDDFF\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF]/.test(e)}function Vc(e){return/[\u0E01-\u0E3A\u0E40-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA\u1000-\u109F\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u19E0-\u19FF\u1B00-\u1B4C\u1B4E-\u1B7F\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE-\uA9FE\uAA60-\uAA7F]|\uD805[\uDED0-\uDEE3]/gim.test(String.fromCodePoint(e))}function ky(e,t){return/(?:[\u1039\u17D2\u1A60\u1BAB\u200D\uAAF6]|\uD802\uDE3F|\uD804[\uDD33\uDFD0]|\uD806[\uDD3E\uDE47\uDE99]|\uD807[\uDD45\uDD97\uDF42])$/.test(e)||new RegExp("^\\p{gc=Mc}","u").test(t)}function Ry(e){return/\s/u.test(String.fromCodePoint(e))}function By(e){for(let t of e)if(Ff(t.codePointAt(0)))return!0;return!1}function zf(e){let t=e.map(r=>{try{return RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}zf(["Arab","Dupl","Mong","Ougr","Syrc"]);function jc(e){return!(Ff(e)||My(e))}const Ly=zf("Adlm.Arab.Armi.Avst.Chrs.Cprt.Egyp.Elym.Gara.Hatr.Hebr.Hung.Khar.Lydi.Mand.Mani.Mend.Merc.Mero.Narb.Nbat.Nkoo.Orkh.Palm.Phli.Phlp.Phnx.Prti.Rohg.Samr.Sarb.Sogo.Syrc.Thaa.Todr.Yezi".split("."));function kf(e){return Ly.test(String.fromCodePoint(e))}function $y(e,t){return!t&&kf(e)?!1:!Fy(e)}function Oy(e){for(let t of e)if(kf(t.codePointAt(0)))return!0;return!1}function Vy(e,t){for(let r of e)if(!$y(r.codePointAt(0),t))return!1;return!0}const sa=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(sa.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let r=e.pluginURL,i=new Promise(s=>{this.loadScriptResolve=s}),a=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await t(r),await Promise.race([i,a]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:r};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}};var Ae=class{constructor(t,r){this.isSupportedScript=jy,this.zoom=t,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new $l,this.transition=r.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new $l,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*r}}};function jy(e){return Vy(e,sa.getRTLTextPluginStatus()==="loaded")}const _h="-transition";var lo=class{constructor(t,r,i,a){this.property=t,this.value=r,this.expression=Q_(r===void 0?t.specification.default:r,i,t.specification,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,r,i){return this.property.possiblyEvaluate(this,t,r,i)}},Ol=class{constructor(t,r,i){this.property=t,this.value=new lo(t,void 0,r,i)}transitioned(t,r){return new Nc(this.property,this.value,r,q({},t.transition,this.transition),t.now)}untransitioned(){return new Nc(this.property,this.value,null,{},0)}},uo=class{constructor(t,r,i){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=i,this._rootKey=r}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return bt(this._values[t].value.value)}setValue(t,r){Object.hasOwn(this._values,t)||(this._values[t]=new Ol(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new lo(this._values[t].property,r===null?void 0:bt(r),this._propertyRootKey(t),this._globalState)}getTransition(t){return bt(this._values[t].transition)}setTransition(t,r){Object.hasOwn(this._values,t)||(this._values[t]=new Ol(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=bt(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let i=this.getValue(r);i!==void 0&&(t[r]=i);let a=this.getTransition(r);a!==void 0&&(t[`${r}${_h}`]=a)}return t}transitioned(t,r){let i=new Uc(this._properties);for(let a of Object.keys(this._values))i._values[a]=this._values[a].transitioned(t,r._values[a]);return i}untransitioned(){let t=new Uc(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}},Nc=class{constructor(t,r,i,a,s){this.property=t,this.value=r,this.begin=s+a.delay||0,this.end=this.begin+a.duration||0,t.specification.transition&&(a.delay||a.duration)&&(this.prior=i)}possiblyEvaluate(t,r,i){let a=t.now||0,s=this.value.possiblyEvaluate(t,r,i),n=this.prior;if(!n)return s;if(a>this.end||this.value.isDataDriven())return this.prior=null,s;if(a<this.begin)return n.possiblyEvaluate(t,r,i);{let o=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(n.possiblyEvaluate(t,r,i),s,o1(o))}}},Uc=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,i){let a=new ho(this._properties);for(let s of Object.keys(this._values))a._values[s]=this._values[s].possiblyEvaluate(t,r,i);return a}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},Ny=class{constructor(t,r,i){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=i,this._rootKey=r}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasValue(t){return this._values[t].value!==void 0}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return bt(this._values[t].value)}setValue(t,r){this._values[t]=new lo(this._values[t].property,r===null?void 0:bt(r),this._propertyRootKey(t),this._globalState)}serialize(){let t={};for(let r of Object.keys(this._values)){let i=this.getValue(r);i!==void 0&&(t[r]=i)}return t}possiblyEvaluate(t,r,i){let a=new ho(this._properties);for(let s of Object.keys(this._values))a._values[s]=this._values[s].possiblyEvaluate(t,r,i);return a}},jt=class{constructor(t,r,i){this.property=t,this.value=r,this.parameters=i}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,i,a){return this.property.evaluate(this.value,this.parameters,t,r,i,a)}},ho=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function qc(e){if(Array.isArray(e))return e.length;let t=e==null?void 0:e.values;return Array.isArray(t)?t.length:void 0}function Rf(e,t){let r=qc(e),i=qc(t);return r!==void 0&&i!==void 0&&r!==i}var O=class{constructor(t,r){this.specification=t,this.name=r}possiblyEvaluate(t,r){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,i){if(Rf(t,r))return fe(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),r;let a=this.specification.type,s=Ne[a];return s?s(t,r,i):t}},Z=class{constructor(t,r,i){this.specification=t,this.name=r,this.overrides=i}possiblyEvaluate(t,r,i,a){return t.expression.kind==="constant"||t.expression.kind==="camera"?new jt(this,{kind:"constant",value:t.expression.evaluate(r,null,{},i,a)},r):new jt(this,t.expression,r)}interpolate(t,r,i){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new jt(this,{kind:"constant",value:void 0},t.parameters);if(Rf(t.value.value,r.value.value))return fe(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),r;let a=this.specification.type,s=Ne[a];if(s){let n=s(t.value.value,r.value.value,i);return new jt(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,r,i,a,s,n){return t.kind==="constant"?t.value:t.evaluate(r,i,a,s,n)}},ts=class extends Z{possiblyEvaluate(t,r,i,a){if(t.value===void 0)return new jt(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let s=t.expression.evaluate(r,null,{},i,a),n=t.property.specification.type==="resolvedImage"&&typeof s!="string"?s.name:s,o=this._calculate(n,n,n,r);return new jt(this,{kind:"constant",value:o},r)}if(t.expression.kind==="camera"){let s=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new jt(this,{kind:"constant",value:s},r)}return new jt(this,t.expression,r)}evaluate(t,r,i,a,s,n){if(t.kind==="source"){let o=t.evaluate(r,i,a,s,n);return this._calculate(o,o,o,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},i,a),t.evaluate({zoom:Math.floor(r.zoom)},i,a),t.evaluate({zoom:Math.floor(r.zoom)+1},i,a),r):t.value}_calculate(t,r,i,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:i,to:r}}interpolate(t){return t}},Bf=class{constructor(t,r){this.specification=t,this.name=r}possiblyEvaluate(t,r,i,a){if(t.value!==void 0){if(t.expression.kind==="constant"){let s=t.expression.evaluate(r,null,{},i,a);return this._calculate(s,s,s,r)}return this._calculate(t.expression.evaluate(new Ae(Math.floor(r.zoom-1),r)),t.expression.evaluate(new Ae(Math.floor(r.zoom),r)),t.expression.evaluate(new Ae(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,i,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:i,to:r}}interpolate(t){return t}},co=class{constructor(t,r){this.specification=t,this.name=r}possiblyEvaluate(t,r,i,a){return!!t.expression.evaluate(r,null,{},i,a)}interpolate(){return!1}},it=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let i=t[r];i.specification.overridable&&this.overridableProperties.push(r);let a=this.defaultPropertyValues[r]=new lo(i,void 0,i.name,void 0),s=this.defaultTransitionablePropertyValues[r]=new Ol(i,i.name,void 0);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=a.possiblyEvaluate({})}}};V("DataDrivenProperty",Z),V("DataConstantProperty",O),V("CrossFadedDataDrivenProperty",ts),V("CrossFadedProperty",Bf),V("ColorRampProperty",co);const Gc=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Uo=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";var Kt=class extends vt{constructor(t,r,i){if(super(),this.id=t.id,this.type=t.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Ey(this.visibility,`layers[${this.id}].layout.visibility`,i),t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=Qa(t.filter,`layers[${this.id}].filter`,i)),r.layout&&(this._unevaluatedLayout=new Ny(r.layout,`layers[${this.id}].layout`,i)),r.paint)){this._transitionablePaint=new uo(r.paint,`layers[${this.id}].paint`,i);for(let a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(let a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ho(r.paint)}}setFilter(t){this.filter=t,this._featureFilter=Qa(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var r;if(t==="visibility")return this.visibility;if((r=this._transitionablePaint)!=null&&r.hasProperty(t))throw Error(t+Gc);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let r of this._visibilityExpression.getGlobalStateRefs())t.add(r);if(this._unevaluatedLayout)for(let r in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[r];for(let a of i.getGlobalStateRefs())t.add(a)}for(let r of this._featureFilter.getGlobalStateRefs())t.add(r);return t}getPaintAffectingGlobalStateRefs(){let t=new globalThis.Map;if(this._transitionablePaint)for(let r in this._transitionablePaint._values){let i=this._transitionablePaint._values[r].value;for(let a of i.getGlobalStateRefs()){let s=t.get(a)??[];s.push({name:r,value:i.value}),t.set(a,s)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,r,i={}){var a;if(t==="visibility"){this.visibility=r,this._visibilityExpression.setValue(r),this.recalculateVisibility();return}if((a=this._transitionablePaint)!=null&&a.hasProperty(t)){this.fire(new H(Error(t+Gc)));return}r!=null&&this._validate(xt.layoutProperty,`layers.${this.id}.layout.${t}`,t,r,i)||this._unevaluatedLayout.setValue(t,r)}getPaintProperty(t){var r,i;if(t.endsWith("-transition")){let a=t.slice(0,-11);if(a==="visibility"||(r=this._unevaluatedLayout)!=null&&r.hasProperty(a))throw Error(t+Uo);return this._transitionablePaint.getTransition(a)}if(t==="visibility"||(i=this._unevaluatedLayout)!=null&&i.hasProperty(t))throw Error(t+Uo);return this._transitionablePaint.getValue(t)}setPaintProperty(t,r,i={}){var a;if(t==="visibility"||(a=this._unevaluatedLayout)!=null&&a.hasProperty(t))return this.fire(new H(Error(t+Uo))),!1;if(r!=null&&this._validate(xt.paintProperty,`layers.${this.id}.paint.${t}`,t,r,i))return!1;if(t.endsWith("-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{let s=this._transitionablePaint._values[t],n=s.property.specification["property-type"]==="cross-faded-data-driven",o=s.value.isDataDriven(),l=s.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let u=this._transitionablePaint._values[t].value;return u.isDataDriven()||o||n||this._handleOverridablePaintPropertyUpdate(t,l,u)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,i){return!1}isHidden(t=this.minzoom,r=!1){return this.minzoom&&t<(r?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom?!0:this._evaluatedVisibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){var r,i;let t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(r=this._unevaluatedLayout)==null?void 0:r.serialize(),paint:(i=this._transitionablePaint)==null?void 0:i.serialize()};return this.visibility&&(t.layout||(t.layout={}),t.layout.visibility=this.visibility),r0(t,(a,s)=>a!==void 0&&!(s==="layout"&&!Object.keys(a).length)&&!(s==="paint"&&!Object.keys(a).length))}_validate(t,r,i,a,s={}){return xs(this,t,{key:r,layerType:this.type,objectKey:i,value:a},s)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(!(!(r instanceof jt)||!ra(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};let Uy;const qy=()=>Uy||(Uy=new it({"raster-opacity":new O(P.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new O(P.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new O(P.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new O(P.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new O(P.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new O(P.paint_raster["raster-contrast"],"raster-contrast"),resampling:new O(P.paint_raster.resampling,"resampling"),"raster-resampling":new O(P.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new O(P.paint_raster["raster-fade-duration"],"raster-fade-duration")}));var Gy={get paint(){return qy()}};const Vl=e=>e.type==="raster";var Zy=class extends Kt{constructor(t,r){super(t,Gy,r)}};const Wy={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};var bs=class{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},Me=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function Ce(e,t=1){let r=0,i=0;return{members:e.map(a=>{let s=Hy(a.type),n=r=Zc(r,Math.max(t,s)),o=a.components||1;return i=Math.max(i,s),r+=s*o,{name:a.name,type:a.type,components:o,offset:n}}),size:Zc(r,Math.max(i,t)),alignment:t}}function Hy(e){return Wy[e].BYTES_PER_ELEMENT}function Zc(e,t){return Math.ceil(e/t)*t}var rs=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,r)}emplace(t,r,i){let a=t*2;return this.int16[a+0]=r,this.int16[a+1]=i,t}};rs.prototype.bytesPerElement=4,V("StructArrayLayout2i4",rs);var Pn=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,t,r,i)}emplace(t,r,i,a){let s=t*3;return this.int16[s+0]=r,this.int16[s+1]=i,this.int16[s+2]=a,t}};Pn.prototype.bytesPerElement=6,V("StructArrayLayout3i6",Pn);var jl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,r,i,a)}emplace(t,r,i,a,s){let n=t*4;return this.int16[n+0]=r,this.int16[n+1]=i,this.int16[n+2]=a,this.int16[n+3]=s,t}};jl.prototype.bytesPerElement=8,V("StructArrayLayout4i8",jl);var Nl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n){let o=this.length;return this.resize(o+1),this.emplace(o,t,r,i,a,s,n)}emplace(t,r,i,a,s,n,o){let l=t*6;return this.int16[l+0]=r,this.int16[l+1]=i,this.int16[l+2]=a,this.int16[l+3]=s,this.int16[l+4]=n,this.int16[l+5]=o,t}};Nl.prototype.bytesPerElement=12,V("StructArrayLayout2i4i12",Nl);var Ul=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n){let o=this.length;return this.resize(o+1),this.emplace(o,t,r,i,a,s,n)}emplace(t,r,i,a,s,n,o){let l=t*4,u=t*8;return this.int16[l+0]=r,this.int16[l+1]=i,this.uint8[u+4]=a,this.uint8[u+5]=s,this.uint8[u+6]=n,this.uint8[u+7]=o,t}};Ul.prototype.bytesPerElement=8,V("StructArrayLayout2i4ub8",Ul);var is=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,r)}emplace(t,r,i){let a=t*2;return this.float32[a+0]=r,this.float32[a+1]=i,t}};is.prototype.bytesPerElement=8,V("StructArrayLayout2f8",is);var ql=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n,o,l,u,h){let c=this.length;return this.resize(c+1),this.emplace(c,t,r,i,a,s,n,o,l,u,h)}emplace(t,r,i,a,s,n,o,l,u,h,c){let p=t*10;return this.uint16[p+0]=r,this.uint16[p+1]=i,this.uint16[p+2]=a,this.uint16[p+3]=s,this.uint16[p+4]=n,this.uint16[p+5]=o,this.uint16[p+6]=l,this.uint16[p+7]=u,this.uint16[p+8]=h,this.uint16[p+9]=c,t}};ql.prototype.bytesPerElement=20,V("StructArrayLayout10ui20",ql);var Gl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,r,i,a,s,n,o,l)}emplace(t,r,i,a,s,n,o,l,u){let h=t*8;return this.uint16[h+0]=r,this.uint16[h+1]=i,this.uint16[h+2]=a,this.uint16[h+3]=s,this.uint16[h+4]=n,this.uint16[h+5]=o,this.uint16[h+6]=l,this.uint16[h+7]=u,t}};Gl.prototype.bytesPerElement=16,V("StructArrayLayout8ui16",Gl);var Zl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n,o,l,u,h,c,p,d){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,i,a,s,n,o,l,u,h,c,p,d)}emplace(t,r,i,a,s,n,o,l,u,h,c,p,d,f){let m=t*14,g=t*7;return this.int16[m+0]=r,this.int16[m+1]=i,this.int16[m+2]=a,this.int16[m+3]=s,this.uint16[m+4]=n,this.uint16[m+5]=o,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=h,this.int16[m+9]=c,this.int16[m+10]=p,this.int16[m+11]=d,this.float32[g+6]=f,t}};Zl.prototype.bytesPerElement=28,V("StructArrayLayout4i4ui4i1f28",Zl);var Wl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,t,r,i)}emplace(t,r,i,a){let s=t*3;return this.float32[s+0]=r,this.float32[s+1]=i,this.float32[s+2]=a,t}};Wl.prototype.bytesPerElement=12,V("StructArrayLayout3f12",Wl);var Hl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){let i=t*1;return this.uint32[i+0]=r,t}};Hl.prototype.bytesPerElement=4,V("StructArrayLayout1ul4",Hl);var Xl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,r,i,a,s,n,o,l,u)}emplace(t,r,i,a,s,n,o,l,u,h){let c=t*10,p=t*5;return this.int16[c+0]=r,this.int16[c+1]=i,this.int16[c+2]=a,this.int16[c+3]=s,this.int16[c+4]=n,this.int16[c+5]=o,this.uint32[p+3]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};Xl.prototype.bytesPerElement=20,V("StructArrayLayout6i1ul2ui20",Xl);var Yl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n){let o=this.length;return this.resize(o+1),this.emplace(o,t,r,i,a,s,n)}emplace(t,r,i,a,s,n,o){let l=t*6;return this.int16[l+0]=r,this.int16[l+1]=i,this.int16[l+2]=a,this.int16[l+3]=s,this.int16[l+4]=n,this.int16[l+5]=o,t}};Yl.prototype.bytesPerElement=12,V("StructArrayLayout2i2i2i12",Yl);var Kl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s){let n=this.length;return this.resize(n+1),this.emplace(n,t,r,i,a,s)}emplace(t,r,i,a,s,n){let o=t*4,l=t*8;return this.float32[o+0]=r,this.float32[o+1]=i,this.float32[o+2]=a,this.int16[l+6]=s,this.int16[l+7]=n,t}};Kl.prototype.bytesPerElement=16,V("StructArrayLayout2f1f2i16",Kl);var Jl=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n){let o=this.length;return this.resize(o+1),this.emplace(o,t,r,i,a,s,n)}emplace(t,r,i,a,s,n,o){let l=t*16,u=t*4,h=t*8;return this.uint8[l+0]=r,this.uint8[l+1]=i,this.float32[u+1]=a,this.float32[u+2]=s,this.int16[h+6]=n,this.int16[h+7]=o,t}};Jl.prototype.bytesPerElement=16,V("StructArrayLayout2ub2f2i16",Jl);var In=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,t,r,i)}emplace(t,r,i,a){let s=t*3;return this.uint16[s+0]=r,this.uint16[s+1]=i,this.uint16[s+2]=a,t}};In.prototype.bytesPerElement=6,V("StructArrayLayout3ui6",In);var Ql=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n,o,l,u,h,c,p,d,f,m,g,_,y){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,i,a,s,n,o,l,u,h,c,p,d,f,m,g,_,y)}emplace(t,r,i,a,s,n,o,l,u,h,c,p,d,f,m,g,_,y,x){let v=t*26,w=t*13,b=t*52;return this.int16[v+0]=r,this.int16[v+1]=i,this.uint16[v+2]=a,this.uint16[v+3]=s,this.uint32[w+2]=n,this.uint32[w+3]=o,this.uint32[w+4]=l,this.uint16[v+10]=u,this.uint16[v+11]=h,this.uint16[v+12]=c,this.float32[w+7]=p,this.float32[w+8]=d,this.uint8[b+36]=f,this.uint8[b+37]=m,this.uint8[b+38]=g,this.uint32[w+10]=_,this.int16[v+22]=y,this.float32[w+12]=x,t}};Ql.prototype.bytesPerElement=52,V("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Ql);var eu=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i,a,s,n,o,l,u,h,c,p,d,f,m,g,_,y,x,v,w,b,A,C,E,F,k,B,I){let D=this.length;return this.resize(D+1),this.emplace(D,t,r,i,a,s,n,o,l,u,h,c,p,d,f,m,g,_,y,x,v,w,b,A,C,E,F,k,B,I)}emplace(t,r,i,a,s,n,o,l,u,h,c,p,d,f,m,g,_,y,x,v,w,b,A,C,E,F,k,B,I,D){let T=t*34,S=t*17;return this.int16[T+0]=r,this.int16[T+1]=i,this.int16[T+2]=a,this.int16[T+3]=s,this.int16[T+4]=n,this.int16[T+5]=o,this.int16[T+6]=l,this.int16[T+7]=u,this.uint16[T+8]=h,this.uint16[T+9]=c,this.uint16[T+10]=p,this.uint16[T+11]=d,this.uint16[T+12]=f,this.uint16[T+13]=m,this.uint16[T+14]=g,this.uint16[T+15]=_,this.uint16[T+16]=y,this.uint16[T+17]=x,this.uint16[T+18]=v,this.uint16[T+19]=w,this.uint16[T+20]=b,this.uint16[T+21]=A,this.uint16[T+22]=C,this.uint32[S+12]=E,this.float32[S+13]=F,this.float32[S+14]=k,this.uint16[T+30]=B,this.uint16[T+31]=I,this.float32[S+16]=D,t}};eu.prototype.bytesPerElement=68,V("StructArrayLayout8i15ui1ul2f2ui1f68",eu);var Mn=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){let i=t*1;return this.float32[i+0]=r,t}};Mn.prototype.bytesPerElement=4,V("StructArrayLayout1f4",Mn);var tu=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,t,r,i)}emplace(t,r,i,a){let s=t*6,n=t*3;return this.uint16[s+0]=r,this.float32[n+1]=i,this.float32[n+2]=a,t}};tu.prototype.bytesPerElement=12,V("StructArrayLayout1ui2f12",tu);var ru=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,t,r,i)}emplace(t,r,i,a){let s=t*2,n=t*4;return this.uint32[s+0]=r,this.uint16[n+2]=i,this.uint16[n+3]=a,t}};ru.prototype.bytesPerElement=8,V("StructArrayLayout1ul2ui8",ru);var iu=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,r)}emplace(t,r,i){let a=t*2;return this.uint16[a+0]=r,this.uint16[a+1]=i,t}};iu.prototype.bytesPerElement=4,V("StructArrayLayout2ui4",iu);var au=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){let i=t*1;return this.uint16[i+0]=r,t}};au.prototype.bytesPerElement=2,V("StructArrayLayout1ui2",au);var su=class extends Me{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,i,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,r,i,a)}emplace(t,r,i,a,s){let n=t*4;return this.float32[n+0]=r,this.float32[n+1]=i,this.float32[n+2]=a,this.float32[n+3]=s,t}};su.prototype.bytesPerElement=16,V("StructArrayLayout4f16",su);var Lf=class extends bs{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new M(this.anchorPointX,this.anchorPointY)}};Lf.prototype.size=20;var $f=class extends Xl{get(t){return new Lf(this,t)}};V("CollisionBoxArray",$f);var Of=class extends bs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Of.prototype.size=52;var Vf=class extends Ql{get(t){return new Of(this,t)}};V("PlacedSymbolArray",Vf);var jf=class extends bs{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};jf.prototype.size=68;var Nf=class extends eu{get(t){return new jf(this,t)}};V("SymbolInstanceArray",Nf);var Uf=class extends Mn{getoffsetX(t){return this.float32[t*1+0]}};V("GlyphOffsetArray",Uf);var qf=class extends Pn{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};V("SymbolLineVertexArray",qf);var Gf=class extends bs{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};Gf.prototype.size=12;var Zf=class extends tu{get(t){return new Gf(this,t)}};V("TextAnchorOffsetArray",Zf);var Wf=class extends bs{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Wf.prototype.size=8;var Hf=class extends ru{get(t){return new Wf(this,t)}};V("FeatureIndexArray",Hf);var $r=class extends rs{},Xy=class extends Pn{},Yy=class extends jl{},Ky=class extends rs{},Jy=class extends rs{},Qy=class extends Nl{},ev=class extends Ul{},tv=class extends is{},Fi=class extends ql{},Wc=class extends Gl{},rv=class extends Zl{},iv=class extends Wl{},av=class extends Hl{},Hc=class extends Yl{},sv=class extends Kl{},nv=class extends Jl{},ov=class extends In{},fr=class extends In{},nu=class extends iu{},lv=class extends au{};const uv=Ce([{name:"a_pos",components:2,type:"Int16"}],4),hv=uv.members;var De=class Oi{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,i,a){let s=this.segments[this.segments.length-1];return t>Oi.MAX_VERTEX_ARRAY_LENGTH&&fe(`Max vertices per segment is ${Oi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Oi.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!s||s.vertexLength+t>Oi.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==a?this.createNewSegment(r,i,a):s}createNewSegment(t,r,i){let a={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(a.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(t,r,i){return this.prepareSegment(0,t,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,i,a){return new Oi([{vertexOffset:t,primitiveOffset:r,vertexLength:i,primitiveLength:a,vaos:{},sortKey:0}])}};De.MAX_VERTEX_ARRAY_LENGTH=2**16-1,V("SegmentVector",De);function Xc(e,t){return e=te(Math.floor(e),0,255),t=te(Math.floor(t),0,255),256*e+t}const cv=Ce([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),pv=Ce([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var dv=Gu(((e,t)=>{function r(i,a){for(var s=i.length&3,n=i.length-s,o=a,l,u=3432918353,h=461845907,c,p=0;p<n;)c=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,s){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}t!==void 0&&(t.exports=r)})),fv=Gu(((e,t)=>{function r(i,a){for(var s=i.length,n=a^s,o=0,l;s>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^l,s-=4,++o;switch(s){case 3:n^=(i.charCodeAt(o+2)&255)<<16;case 2:n^=(i.charCodeAt(o+1)&255)<<8;case 1:n^=i.charCodeAt(o)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}t.exports=r})),mv=Pg(Gu(((e,t)=>{var r=dv(),i=fv();t.exports=r,t.exports.murmur3=r,t.exports.murmur2=i}))()),Xf=class Yf{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,i,a){this.ids.push(Yc(t)),this.positions.push(r,i,a)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let r=Yc(t),i=0,a=this.ids.length-1;for(;i<a;){let n=i+a>>1;this.ids[n]>=r?a=n:i=n+1}let s=[];for(;this.ids[i]===r;){let n=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];s.push({index:n,start:o,end:l}),i++}return s}static serialize(t,r){let i=new Float64Array(t.ids),a=new Uint32Array(t.positions);return ou(i,a,0,i.length-1),r&&r.push(i.buffer,a.buffer),{ids:i,positions:a}}static deserialize(t){let r=new Yf;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};function Yc(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:(0,mv.default)(String(e))}function ou(e,t,r,i){for(;r<i;){let a=e[r+i>>1],s=r-1,n=i+1;for(;;){do s++;while(e[s]<a);do n--;while(e[n]>a);if(s>=n)break;Ls(e,s,n),Ls(t,3*s,3*n),Ls(t,3*s+1,3*n+1),Ls(t,3*s+2,3*n+2)}n-r<i-n?(ou(e,t,r,n),r=n+1):(ou(e,t,n+1,i),i=n)}}function Ls(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}V("FeaturePositionMap",Xf);var Pr=class{constructor(t,r){this.gl=t.gl,this.location=r}},W=class extends Pr{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},L=class extends Pr{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}},Y=class extends Pr{constructor(t,r){super(t,r),this.current=[0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1])&&(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},Dt=class extends Pr{constructor(t,r){super(t,r),this.current=[0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2])&&(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},qr=class extends Pr{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},Gr=class extends Pr{constructor(t,r){super(t,r),this.current=J.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}},Kc=class extends Pr{constructor(t,r){super(t,r),this.current=[]}set(t){if(t!=this.current){this.current=t;let r=new Float32Array(t.length*4);for(let i=0;i<t.length;i++)r[4*i]=t[i].r,r[4*i+1]=t[i].g,r[4*i+2]=t[i].b,r[4*i+3]=t[i].a;this.gl.uniform4fv(this.location,r)}}},Jc=class extends Pr{constructor(t,r){super(t,r),this.current=[]}set(t){if(t!=this.current){this.current=t;let r=new Float32Array(t);this.gl.uniform1fv(this.location,r)}}};const gv=new Float32Array(16);var Mt=class extends Pr{constructor(t,r){super(t,r),this.current=gv}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);return}for(let r=1;r<16;r++)if(t[r]!==this.current[r]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}};function lu(e){return[Xc(255*e.r,255*e.g),Xc(255*e.b,255*e.a)]}var Ra=class{constructor(t,r,i){this.value=t,this.uniformNames=r.map(a=>`u_${a}`),this.type=i}setUniform(t,r,i){t.set(i.constantOr(this.value))}getBinding(t,r,i){return this.type==="color"?new Gr(t,r):new L(t,r)}},ri=class{constructor(t,r){this.uniformNames=r.map(i=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,r){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,r.y,r.height,r.width]}setUniform(t,r,i,a){let s=null;a==="u_pattern_to"?s=this.patternTo:a==="u_pattern_from"?s=this.patternFrom:a==="u_dasharray_to"?s=this.dashTo:a==="u_dasharray_from"?s=this.dashFrom:a==="u_pixel_ratio_to"?s=this.pixelRatioTo:a==="u_pixel_ratio_from"&&(s=this.pixelRatioFrom),s!==null&&t.set(s)}getBinding(t,r,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new qr(t,r):new L(t,r)}},gr=class{constructor(t,r,i,a){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:`a_${s}`,type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,r,i){let a=this.paintVertexArray.length,s=this.expression.evaluate(new Ae(0,i),r,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s)}updatePaintArray(t,r,i,a,s){let n=this.expression.evaluate(new Ae(0,s),i,a);this._setPaintValue(t,r,n)}_setPaintValue(t,r,i){if(this.type==="color"){let a=lu(i);for(let s=t;s<r;s++)this.paintVertexArray.emplace(s,a[0],a[1])}else{for(let a=t;a<r;a++)this.paintVertexArray.emplace(a,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){var r,i;(r=this.paintVertexArray)!=null&&r.arrayBuffer.byteLength&&((i=this.paintVertexBuffer)!=null&&i.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},Gt=class{constructor(t,r,i,a,s,n){this.expression=t,this.uniformNames=r.map(o=>`u_${o}_t`),this.type=i,this.useIntegerZoom=a,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:`a_${o}`,type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new n}populatePaintArray(t,r,i){let a=this.expression.evaluate(new Ae(this.zoom,i),r,{},i.canonical,[],i.formattedSection),s=this.expression.evaluate(new Ae(this.zoom+1,i),r,{},i.canonical,[],i.formattedSection),n=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(n,t,a,s)}updatePaintArray(t,r,i,a,s){let n=this.expression.evaluate(new Ae(this.zoom,s),i,a),o=this.expression.evaluate(new Ae(this.zoom+1,s),i,a);this._setPaintValue(t,r,n,o)}_setPaintValue(t,r,i,a){if(this.type==="color"){let s=lu(i),n=lu(a);for(let o=t;o<r;o++)this.paintVertexArray.emplace(o,s[0],s[1],n[0],n[1])}else{for(let s=t;s<r;s++)this.paintVertexArray.emplace(s,i,a);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(a))}}upload(t){var r,i;(r=this.paintVertexArray)!=null&&r.arrayBuffer.byteLength&&((i=this.paintVertexBuffer)!=null&&i.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let i=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,a=te(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(a)}getBinding(t,r,i){return new L(t,r)}},kr=class{constructor(t,r,i,a,s,n){this.expression=t,this.type=r,this.useIntegerZoom=i,this.zoom=a,this.layerId=n,this.zoomInPaintVertexArray=new s,this.zoomOutPaintVertexArray=new s}populatePaintArray(t,r,i){let a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(a,t,this.getPositionIds(r),i)}updatePaintArray(t,r,i,a,s){this._setPaintValues(t,r,this.getPositionIds(i),s)}_setPaintValues(t,r,i,a){let s=this.getPositions(a);if(!s||!i)return;let n=s[i.min],o=s[i.mid],l=s[i.max];if(!(!n||!o||!l))for(let u=t;u<r;u++)this.emplace(this.zoomInPaintVertexArray,u,n,o),this.emplace(this.zoomOutPaintVertexArray,u,l,o)}upload(t){var r,i;if((r=this.zoomInPaintVertexArray)!=null&&r.arrayBuffer.byteLength&&((i=this.zoomOutPaintVertexArray)!=null&&i.arrayBuffer.byteLength)){let a=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,a,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,a,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Kf=class extends kr{getPositions(t){return t.imagePositions}getPositionIds(t){var r;return(r=t.patterns)==null?void 0:r[this.layerId]}getVertexAttributes(){return cv.members}emplace(t,r,i,a){t.emplace(r,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],i.pixelRatio,a.pixelRatio)}},Jf=class extends kr{getPositions(t){return t.dashPositions}getPositionIds(t){var r;return(r=t.dashes)==null?void 0:r[this.layerId]}getVertexAttributes(){return pv.members}emplace(t,r,i,a){t.emplace(r,0,i.y,i.height,i.width,0,a.y,a.height,a.width)}},Qf=class{constructor(t,r,i){this.binders={},this._buffers=[];let a=[];for(let s in t.paint._values){if(!i(s))continue;let n=t.paint.get(s);if(!(n instanceof jt)||!ra(n.property.specification))continue;let o=_v(s,t.type),l=n.value,u=n.property.specification.type,h=n.property.useIntegerZoom,c=n.property.specification["property-type"],p=c==="cross-faded"||c==="cross-faded-data-driven";if(l.kind==="constant")this.binders[s]=p?new ri(l.value,o):new Ra(l.value,o,u),a.push(`/u_${s}`);else if(l.kind==="source"||p){let d=Qc(s,u,"source");this.binders[s]=p?s==="line-dasharray"?new Jf(l,u,h,r,d,t.id):new Kf(l,u,h,r,d,t.id):new gr(l,o,u,d),a.push(`/a_${s}`)}else{let d=Qc(s,u,"composite");this.binders[s]=new Gt(l,o,u,h,r,d),a.push(`/z_${s}`)}}this.cacheKey=a.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof gr||r instanceof Gt?r.maxValue:0}populatePaintArrays(t,r,i){for(let a in this.binders){let s=this.binders[a];(s instanceof gr||s instanceof Gt||s instanceof kr)&&s.populatePaintArray(t,r,i)}}setConstantPatternPositions(t,r){for(let i in this.binders){let a=this.binders[i];a instanceof ri&&a.setConstantPatternPositions(t,r)}}setConstantDashPositions(t,r){for(let i in this.binders){let a=this.binders[i];a instanceof ri&&a.setConstantDashPositions(t,r)}}updatePaintArrays(t,r,i,a,s){let n=!1;for(let o of t){let l=r.getPositions(o.id);for(let u of l){let h=i.feature(u.index);for(let c in this.binders){let p=this.binders[c];(p instanceof gr||p instanceof Gt||p instanceof kr)&&p.expression.isStateDependent===!0&&(p.expression=a.paint.get(c).value,p.updatePaintArray(u.start,u.end,h,o.state,s),n=!0)}}}return n}defines(){let t=[];for(let r in this.binders){let i=this.binders[r];(i instanceof Ra||i instanceof ri)&&t.push(...i.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof gr||i instanceof Gt)for(let a of i.paintVertexAttributes)t.push(a.name);else if(i instanceof kr){let a=i.getVertexAttributes();for(let s of a)t.push(s.name)}}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof Ra||i instanceof ri||i instanceof Gt)for(let a of i.uniformNames)t.push(a)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let i=[];for(let a in this.binders){let s=this.binders[a];if(s instanceof Ra||s instanceof ri||s instanceof Gt){for(let n of s.uniformNames)if(r[n]){let o=s.getBinding(t,r[n],n);i.push({name:n,property:a,binding:o})}}}return i}setUniforms(t,r,i,a){for(let{name:s,property:n,binding:o}of r)this.binders[n].setUniform(o,a,i.get(n),s)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let i=this.binders[r];if(t&&i instanceof kr){let a=t.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;a&&this._buffers.push(a)}else(i instanceof gr||i instanceof Gt)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(let r in this.binders){let i=this.binders[r];(i instanceof gr||i instanceof Gt||i instanceof kr)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof gr||r instanceof Gt||r instanceof kr)&&r.destroy()}}},vi=class{constructor(t,r,i=()=>!0){this.programConfigurations={};for(let a of t)this.programConfigurations[a.id]=new Qf(a,r,i);this.needsUpload=!1,this._featureMap=new Xf,this._bufferOffset=0}populatePaintArrays(t,r,i,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(t,r,a);r.id!==void 0&&this._featureMap.add(r.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,i,a){for(let s of i)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(t,this._featureMap,r,s,a)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function _v(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function yv(e){return{"line-pattern":{source:Fi,composite:Fi},"fill-pattern":{source:Fi,composite:Fi},"fill-extrusion-pattern":{source:Fi,composite:Fi},"line-dasharray":{source:Wc,composite:Wc}}[e]}function Qc(e,t,r){var a;let i={color:{source:is,composite:su},number:{source:Mn,composite:is}};return((a=yv(e))==null?void 0:a[r])||i[t][r]}V("ConstantBinder",Ra),V("CrossFadedConstantBinder",ri),V("SourceExpressionBinder",gr),V("CrossFadedPatternBinder",Kf),V("CrossFadedDasharrayBinder",Jf),V("CompositeExpressionBinder",Gt),V("ProgramConfiguration",Qf,{omit:["_buffers"]}),V("ProgramConfigurationSet",vi);const uu=2**14-1,ep=-uu-1;function Ai(e){let t=z/e.extent,r=e.loadGeometry();for(let i of r)for(let a of i){let s=Math.round(a.x*t),n=Math.round(a.y*t);a.x=te(s,ep,uu),a.y=te(n,ep,uu),(s<a.x||s>a.x+1||n<a.y||n>a.y+1)&&fe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Ei(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Ai(e):[]}}const tp=-32768;function vv(e,t,r,i,a){e.emplaceBack(tp+t*8+i,tp+r*8+a)}var yh=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Ky,this.indexArray=new fr,this.segments=new De,this.programConfigurations=new vi(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,i){let a=this.layers[0],s=[],n=null,o=!1,l=a.type==="heatmap";if(a.type==="circle"){let p=a;n=p.layout.get("circle-sort-key"),o=!n.isConstant(),l||(l=p.paint.get("circle-pitch-alignment")==="map")}let u=l?r.subdivisionGranularity.circle:1,h=new Ae(this.zoom),c=this.layers[0]._featureFilter.needGeometry;for(let{feature:p,id:d,index:f,sourceLayerIndex:m}of t){let g=Ei(p,c);if(!this.layers[0]._featureFilter.filter(h,g,i))continue;let _=o?n.evaluate(g,{},i):void 0,y={id:d,properties:p.properties,type:p.type,sourceLayerIndex:m,index:f,geometry:c?g.geometry:Ai(p),patterns:{},sortKey:_};s.push(y)}o&&s.sort((p,d)=>p.sortKey-d.sortKey);for(let p of s){let{geometry:d,index:f,sourceLayerIndex:m}=p,g=t[f].feature;this.addFeature(p,d,f,i,u),r.featureIndex.insert(g,d,f,m,this.index)}}update(t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hv),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,i,a,s=1){let n;switch(s){case 1:n=[0,7];break;case 3:n=[0,2,5,7];break;case 5:n=[0,1,3,4,6,7];break;case 7:n=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${s}; valid values are 1, 3, 5, 7.`)}let o=n.length;for(let l of r)for(let u of l){let h=u.x,c=u.y;if(h<0||h>=8192||c<0||c>=8192)continue;let p=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t.sortKey),d=p.vertexLength;for(let f=0;f<o;f++)for(let m=0;m<o;m++)vv(this.layoutVertexArray,h,c,n[m],n[f]);for(let f=0;f<o-1;f++)for(let m=0;m<o-1;m++){let g=d+f*o+m,_=d+(f+1)*o+m;this.indexArray.emplaceBack(g,_+1,g+1),this.indexArray.emplaceBack(g,_,_+1)}p.vertexLength+=o*o,p.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:{},canonical:a})}};V("CircleBucket",yh,{omit:["layers"]});function e2(e,t){for(let r of e)if(na(t,r))return!0;for(let r of t)if(na(e,r))return!0;return vh(e,t)}function po(e,t,r){return na(e,t)?!0:hu(t,e,r)}function t2(e,t){if(e.length===1)return rp(t,e[0]);for(let r of t)for(let i of r)if(na(e,i))return!0;for(let r of e)if(rp(t,r))return!0;for(let r of t)if(vh(e,r))return!0;return!1}function xv(e,t,r){for(let i of t){if(e.length>=3){for(let a of i)if(na(e,a))return!0}if(bv(e,i,r))return!0}return!1}function bv(e,t,r){if(e.length>1){if(vh(e,t))return!0;for(let i of t)if(hu(i,e,r))return!0}for(let i of e)if(hu(i,t,r))return!0;return!1}function vh(e,t){if(e.length===0||t.length===0)return!1;for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1];for(let s=0;s<t.length-1;s++){let n=t[s],o=t[s+1];if(wv(i,a,n,o))return!0}}return!1}function wv(e,t,r,i){return Lr(e,r,i)!==Lr(t,r,i)&&Lr(e,t,r)!==Lr(e,t,i)}function hu(e,t,r){let i=r*r;if(t.length===1)return e.distSqr(t[0])<i;for(let a=1;a<t.length;a++){let s=t[a-1],n=t[a];if(Tv(e,s,n)<i)return!0}return!1}function Tv(e,t,r){let i=t.distSqr(r);if(i===0)return e.distSqr(t);let a=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return a<0?e.distSqr(t):a>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(a)._add(t))}function rp(e,t){let r=!1,i,a,s;for(let n of e){i=n;for(let o=0,l=i.length-1;o<i.length;l=o++)a=i[o],s=i[l],a.y>t.y!=s.y>t.y&&t.x<(s.x-a.x)*(t.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function na(e,t){let r=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let s=e[i],n=e[a];s.y>t.y!=n.y>t.y&&t.x<(n.x-s.x)*(t.y-s.y)/(n.y-s.y)+s.x&&(r=!r)}return r}function Dv(e,t,r,i,a){for(let n of e)if(t<=n.x&&r<=n.y&&i>=n.x&&a>=n.y)return!0;let s=[new M(t,r),new M(t,a),new M(i,a),new M(i,r)];if(e.length>2){for(let n of s)if(na(e,n))return!0}for(let n=0;n<e.length-1;n++){let o=e[n],l=e[n+1];if(Av(o,l,s))return!0}return!1}function Av(e,t,r){let i=r[0],a=r[2];if(e.x<i.x&&t.x<i.x||e.x>a.x&&t.x>a.x||e.y<i.y&&t.y<i.y||e.y>a.y&&t.y>a.y)return!1;let s=Lr(e,t,r[0]);return s!==Lr(e,t,r[1])||s!==Lr(e,t,r[2])||s!==Lr(e,t,r[3])}function Gi(e,t,r){let i=t.paint.get(e).value;return i.kind==="constant"?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function fo(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function mo(e,t,r,i,a){if(!t[0]&&!t[1])return e;let s=M.convert(t)._mult(a);r==="viewport"&&s._rotate(-i);let n=[];for(let o of e)n.push(o.sub(s));return n}function Ev(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.at(-1);(r===0||a&&!i.equals(a))&&t.push(i)}return t}function Sv(e,t){let r=[];for(let i of e){let a=Ev(i),s=[];for(let n=0;n<a.length;n++){let o=a[n],l=a[n-1],u=a[n+1],h=n===0?new M(0,0):o.sub(l)._unit()._perp(),c=n===a.length-1?new M(0,0):u.sub(o)._unit()._perp(),p=h._add(c)._unit(),d=p.x*c.x+p.y*c.y;d!==0&&p._mult(1/d),s.push(p._mult(t)._add(o))}r.push(s)}return r}function Cv({queryGeometry:e,size:t},r){return po(e,r,t)}function Pv({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a},s){return po(e,s,t*(r.projectTileCoordinates(s.x,s.y,i,a==null?void 0:a(s.x,s.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function Iv({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a},s){let n=r.projectTileCoordinates(s.x,s.y,i,a==null?void 0:a(s.x,s.y)).signedDistanceFromCamera,o=t*(r.cameraToCenterDistance/n);return po(e,xh(s,r,i,a),o)}function Mv({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a},s){return po(e,xh(s,r,i,a),t)}function r2({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a,pitchAlignment:s="map",pitchScale:n="map"},o){let l=s==="map"?n==="map"?Cv:Pv:n==="map"?Iv:Mv,u={queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a};for(let h of o)for(let c of h)if(l(u,c))return!0;return!1}function xh(e,t,r,i){let a=t.projectTileCoordinates(e.x,e.y,r,i==null?void 0:i(e.x,e.y)).point;return new M((a.x*.5+.5)*t.width,(-a.y*.5+.5)*t.height)}function Fv(e,t,r,i){return e.map(a=>xh(a,t,r,i))}let zv;const kv=()=>zv||(zv=new it({"circle-sort-key":new Z(P.layout_circle["circle-sort-key"],"circle-sort-key")}));let Rv;const Bv=()=>Rv||(Rv=new it({"circle-radius":new Z(P.paint_circle["circle-radius"],"circle-radius"),"circle-color":new Z(P.paint_circle["circle-color"],"circle-color"),"circle-blur":new Z(P.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new Z(P.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new O(P.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new O(P.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new O(P.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new O(P.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new Z(P.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new Z(P.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new Z(P.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")}));var Lv={get paint(){return Bv()},get layout(){return kv()}};const $v=e=>e.type==="circle";var Ov=class extends Kt{constructor(t,r){super(t,Lv,r)}createBucket(t){return new yh(t)}queryRadius(t){let r=t;return Gi("circle-radius",this,r)+Gi("circle-stroke-width",this,r)+fo(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:i,geometry:a,transform:s,pixelsToTileUnits:n,unwrappedTileID:o,getElevation:l}){let u=mo(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-s.bearingInRadians,n),h=this.paint.get("circle-radius").evaluate(r,i)+this.paint.get("circle-stroke-width").evaluate(r,i),c=this.paint.get("circle-pitch-scale"),p=this.paint.get("circle-pitch-alignment"),d,f;return p==="map"?(d=u,f=h*n):(d=Fv(u,s,o,l),f=h),r2({queryGeometry:d,size:f,transform:s,unwrappedTileID:o,getElevation:l,pitchAlignment:p,pitchScale:c},a)}},i2=class extends yh{};V("HeatmapBucket",i2,{omit:["layers"]});let Vv;const jv=()=>Vv||(Vv=new it({"heatmap-radius":new Z(P.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new Z(P.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new O(P.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new co(P.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new O(P.paint_heatmap["heatmap-opacity"],"heatmap-opacity")}));var Nv={get paint(){return jv()}};function bh(e,{width:t,height:r},i,a){if(!a)a=new Uint8Array(t*r*i);else if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*r*i)throw RangeError(`mismatched image size. expected: ${a.length} but got: ${t*r*i}`);return e.width=t,e.height=r,e.data=a,e}function a2(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;let a=bh({},{width:t,height:r},i);wh(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=a.data}function wh(e,t,r,i,a,s){if(a.width===0||a.height===0)return t;if(a.width>e.width||a.height>e.height||r.x>e.width-a.width||r.y>e.height-a.height)throw RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||i.x>t.width-a.width||i.y>t.height-a.height)throw RangeError("out of range destination coordinates for image copy");let n=e.data,o=t.data;if(n===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<a.height;l++){let u=((r.y+l)*e.width+r.x)*s,h=((i.y+l)*t.width+i.x)*s;for(let c=0;c<a.width*s;c++)o[h+c]=n[u+c]}return t}var Th=class s2{constructor(t,r){bh(this,t,1,r)}resize(t){a2(this,t,1)}clone(){return new s2({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,i,a,s){wh(t,r,i,a,s,1)}},be=class n2{constructor(t,r){bh(this,t,4,r)}resize(t){a2(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new n2({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,i,a,s){wh(t,r,i,a,s,4)}setPixel(t,r,i){let a=(t*this.width+r)*4;this.data[a+0]=Math.round(i.r*255/i.a),this.data[a+1]=Math.round(i.g*255/i.a),this.data[a+2]=Math.round(i.b*255/i.a),this.data[a+3]=Math.round(i.a*255)}};function qo(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=4){let i=e[r+3];t[r+0]=Math.round(e[r+0]*i/255),t[r+1]=Math.round(e[r+1]*i/255),t[r+2]=Math.round(e[r+2]*i/255),t[r+3]=i}return t}V("AlphaImage",Th),V("RGBAImage",be);function o2(e){let t={},r=e.resolution||256,i=e.clips?e.clips.length:1,a=e.image||new be({width:r,height:i});if(!u1(r))throw Error(`width is not a power of 2 - ${r}`);let s=(n,o,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);a.setPixel(n/4/r,o/4,u)};if(e.clips)for(let n=0,o=0;n<i;++n,o+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let h=l/(r-1),{start:c,end:p}=e.clips[n],d=c*(1-h)+p*h;s(o,u,d)}else for(let n=0,o=0;n<r;n++,o+=4){let l=n/(r-1);s(0,o,l)}return a}const Fn="big-fb",Uv=e=>e.type==="heatmap";var qv=class extends Kt{createBucket(t){return new i2(t)}constructor(t,r){super(t,Nv,r),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let t=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=o2({expression:t,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(Fn)}queryRadius(t){return Gi("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:i,geometry:a,transform:s,pixelsToTileUnits:n,unwrappedTileID:o,getElevation:l}){return r2({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(r,i)*n,transform:s,unwrappedTileID:o,getElevation:l},a)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}};let Gv;const Zv=()=>Gv||(Gv=new it({"hillshade-illumination-direction":new O(P.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new O(P.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new O(P.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new O(P.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new O(P.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new O(P.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new O(P.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new O(P.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new O(P.paint_hillshade.resampling,"resampling")}));var Wv={get paint(){return Zv()}};const Hv=e=>e.type==="hillshade";var Xv=class extends Kt{constructor(t,r){super(t,Wv,r),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,a=this.paint.get("hillshade-shadow-color").values,s=Math.max(t.length,r.length,i.length,a.length);t=t.concat(Array(s-t.length).fill(t.at(-1))),r=r.concat(Array(s-r.length).fill(r.at(-1))),i=i.concat(Array(s-i.length).fill(i.at(-1))),a=a.concat(Array(s-a.length).fill(a.at(-1)));let n=r.map(Be);return{directionRadians:t.map(Be),altitudeRadians:n,shadowColor:a,highlightColor:i}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}};let Yv;const Kv=()=>Yv||(Yv=new it({"color-relief-opacity":new O(P["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new co(P["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new O(P["paint_color-relief"].resampling,"resampling")}));var Jv={get paint(){return Kv()}};function Go(e){return"data"in e}var Ge=class{constructor(t,r,i,a){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(r,a)}update(t,r,i){var h;let{width:a,height:s}=t,n=(((h=this.size)==null?void 0:h[0])!==a||this.size[1]!==s)&&!i,{context:o}=this,{gl:l}=o;this.useMipmap=!!(r!=null&&r.useMipmap),n&&this.size&&this.format===l.RGBA&&(l.deleteTexture(this.texture),this.texture=l.createTexture(),this._ownedHandle=this.texture,this.filter=void 0,this.wrap=void 0),l.bindTexture(l.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let u=this.format===l.RGBA&&(r==null?void 0:r.premultiply)!==!1;if(n)if(this.size=[a,s],this.format===l.RGBA&&a>0&&s>0){let c=this.useMipmap?Math.floor(Math.log2(Math.max(a,s)))+1:1;if(l.texStorage2D(l.TEXTURE_2D,c,l.RGBA8,a,s),Go(t)){o.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:p}=t;u&&p&&(p=qo(p)),p&&l.texSubImage2D(l.TEXTURE_2D,0,0,0,a,s,l.RGBA,l.UNSIGNED_BYTE,p)}else o.pixelStoreUnpackPremultiplyAlpha.set(u),l.texSubImage2D(l.TEXTURE_2D,0,0,0,l.RGBA,l.UNSIGNED_BYTE,t)}else Go(t)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,u,a,s,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(u),this._uploadDomImage(t,l));else{let{x:c,y:p}=i||{x:0,y:0};Go(t)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,u,c,p,a,s,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(u),this._updateDomImage(t,c,p,l))}this.useMipmap&&l.generateMipmap(l.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,r){r.texImage2D(r.TEXTURE_2D,0,this.format,this.format,r.UNSIGNED_BYTE,t)}_uploadRawData(t,r,i,a,s){let{data:n}=t;r&&n&&(n=qo(n)),s.texImage2D(s.TEXTURE_2D,0,this.format,i,a,0,this.format,s.UNSIGNED_BYTE,n)}_updateDomImage(t,r,i,a){a.texSubImage2D(a.TEXTURE_2D,0,r,i,a.RGBA,a.UNSIGNED_BYTE,t)}_updateRawData(t,r,i,a,s,n,o){let{data:l}=t;r&&l&&(l=qo(l)),o.texSubImage2D(o.TEXTURE_2D,0,i,a,s,n,o.RGBA,o.UNSIGNED_BYTE,l)}bind(t,r,i){let{context:a}=this,{gl:s}=a;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),s.bindTexture(s.TEXTURE_2D,this.texture),i===s.LINEAR_MIPMAP_NEAREST&&!this.useMipmap&&(i=s.LINEAR),t!==this.filter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,i||t),this.filter=t),r!==this.wrap&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,r),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,r),this.wrap=r)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Dr,Qv=(Dr=class{constructor(t,r,i,a=1,s=1,n=1,o=0){if(this.uid=t,r.height!==r.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){fe(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),Dr.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=a,this.greenFactor=s,this.blueFactor=n,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=0;h<l;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(l,h)]=this.data[this._idx(l-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,l)]=this.data[this._idx(h,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)];let u=this._getByteView();this.min=2**53-1,this.max=-9007199254740991;for(let h=0;h<l;h++)for(let c=0;c<l;c++){let p=this._idx(h,c)*4,d=this._unpackAtIndex(u,p);d>this.max&&(this.max=d),d<this.min&&(this.min=d)}}get(t,r){let i=this._getByteView(),a=this._idx(t,r)*4;return this._unpackAtIndex(i,a)}sampleBilinear(t,r){let i=Math.floor(t),a=Math.floor(r);if(i<-1||i>=this.dim||a<-1||a>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${r}, dim: ${this.dim}`);let s=this._getByteView(),n=((a+1)*this.stride+i+1)*4,o=this.stride*4,l=t-i,u=r-a,h=this._unpackAtIndex(s,n),c=this._unpackAtIndex(s,n+4),p=this._unpackAtIndex(s,n+o),d=this._unpackAtIndex(s,n+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+d*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${r}, dim: ${this.dim}`);return(r+1)*this.stride+(t+1)}unpack(t,r,i){return t*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(t){return l2(t,this.getUnpackVector())}getPixels(){return new be({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(t,r,i){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let a=r*this.dim,s=r*this.dim+this.dim,n=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:a=s-1;break;case 1:s=a+1}switch(i){case-1:n=o-1;break;case 1:o=n+1}let l=-r*this.dim,u=-i*this.dim;for(let h=n;h<o;h++)for(let c=a;c<s;c++)this.data[this._idx(c,h)]=t.data[this._idx(c+l,h+u)]}_getByteView(){let t=Dr.byteViewCache.get(this);return(t==null?void 0:t.buffer)!==this.data.buffer&&(t=new Uint8Array(this.data.buffer),Dr.byteViewCache.set(this,t)),t}_unpackAtIndex(t,r){return this.unpack(t[r],t[r+1],t[r+2])}},Dr.byteViewCache=new WeakMap,Dr);function l2(e,t){let r=t[0],i=t[1],a=t[2],s=t[3],n=Math.min(r,i,a),o=Math.round((e+s)/n);return{r:Math.floor(o*n/r)%256,g:Math.floor(o*n/i)%256,b:Math.floor(o*n/a)%256}}V("DEMData",Qv);const ex=e=>e.type==="color-relief";var tx=class extends Kt{constructor(t,r){super(t,Jv,r)}_createColorRamp(t){let r={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof Ja&&i._styleExpression.expression instanceof Ut){this.colorRampExpression=i;let n=i._styleExpression.expression;r.elevationStops=n.labels,r.colorStops=[];for(let o of r.elevationStops)r.colorStops.push(n.evaluate({globals:{elevation:o}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[J.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=t)return r;let a={elevationStops:[],colorStops:[]},s=(r.elevationStops.length-1)/(t-1);for(let n=0;n<r.elevationStops.length-.5;n+=s)a.elevationStops.push(r.elevationStops[Math.round(n)]),a.colorStops.push(r.colorStops[Math.round(n)]);return fe(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${r.elevationStops.length}`),a}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,r,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let a=this._createColorRamp(r),s=new be({width:a.colorStops.length,height:1}),n=new be({width:a.colorStops.length,height:1});for(let o=0;o<a.elevationStops.length;o++){let l=l2(a.elevationStops[o],i);n.setPixel(0,o,new J(l.r/255,l.g/255,l.b/255,1)),s.setPixel(0,o,a.colorStops[o])}return this.colorRampTextures={elevationTexture:new Ge(t,n,t.gl.RGBA),colorTexture:new Ge(t,s,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};const rx=Ce([{name:"a_pos",components:2,type:"Int16"}],4),ix=rx.members;function zn(e,t,r){let i=r.patternDependencies,a=!1;for(let s of t){let n=s.paint.get(`${e}-pattern`);n.isConstant()||(a=!0);let o=n.constantOr(null);o&&(a=!0,i[o.to]=!0,i[o.from]=!0)}return a}function Dh(e,t,r,i,a){let{zoom:s}=i,n=a.patternDependencies;for(let o of t){let l=o.paint.get(`${e}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:s-1},r,{},a.availableImages),h=l.evaluate({zoom:s},r,{},a.availableImages),c=l.evaluate({zoom:s+1},r,{},a.availableImages);u=u!=null&&u.name?u.name:u,h=h!=null&&h.name?h.name:h,c=c!=null&&c.name?c.name:c,n[u]=!0,n[h]=!0,n[c]=!0,r.patterns[o.id]={min:u,mid:h,max:c}}}return r}const as=new Set;let cu=!1;function ax(e,t,r=2){let i=t&&t.length,a=i?t[0]*r:e.length;as.size&&as.clear();let s=u2(e,0,a,r,!0),n=[];if(!s||s.next===s.prev)return n;let o=0,l=0,u=0;if(i&&(s=ux(e,t,s,r)),e.length>80*r){o=e[0],l=e[1];let h=o,c=l;for(let p=r;p<a;p+=r){let d=e[p],f=e[p+1];d<o&&(o=d),f<l&&(l=f),d>h&&(h=d),f>c&&(c=f)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return pu(s,n,o,l,u),n}function u2(e,t,r,i,a){let s=null;if(a===wx(e,t,r,i)>0)for(let n=t;n<r;n+=i)s=sp(n/i|0,e[n],e[n+1],s);else for(let n=r-i;n>=t;n-=i)s=sp(n/i|0,e[n],e[n+1],s);return s&&ss(s,s.next)&&(os(s),s=s.next),s}function xi(e,t=e){let r=t===e,i=e,a;do a=!1,i!==i.next&&(as.size===0||!as.has(i))&&(ss(i,i.next)||qe(i.prev,i,i.next)===0)?((r||i===t)&&(t=i.prev),cu=!0,os(i),i=i.prev,a=!0):(r||i!==t)&&(i=i.next,a=!r);while(a||i!==t);return t}function pu(e,t,r,i,a){a&&gx(e,r,i,a);let s=e,n=!1;for(;e.prev!==e.next;){let o=e.prev,l=e.next;if(qe(o,e,l)<0&&(a?nx(e,r,i,a):sx(e))){t.push(o.i,e.i,l.i),os(e),e=l,s=l;continue}if(e=l,e===s){if(cu=!1,e=xi(e),cu){s=e;continue}if(!n){e=ox(e,t),s=e,n=!0;continue}lx(e,t,r,i,a);break}}}function sx(e){let t=e.prev,r=e,i=e.next,a=t.x,s=r.x,n=i.x,o=t.y,l=r.y,u=i.y,h=Math.min(a,s,n),c=Math.min(o,l,u),p=Math.max(a,s,n),d=Math.max(o,l,u),f=i.next;for(;f!==t;){if(f.x>=h&&f.x<=p&&f.y>=c&&f.y<=d&&(a!==f.x||o!==f.y)&&Rn(a,o,s,l,n,u,f.x,f.y)&&qe(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function nx(e,t,r,i){let a=e.prev,s=e,n=e.next,o=a.x,l=s.x,u=n.x,h=a.y,c=s.y,p=n.y,d=Math.min(o,l,u),f=Math.min(h,c,p),m=Math.max(o,l,u),g=Math.max(h,c,p),_=gu(d,f,t,r,i),y=gu(m,g,t,r,i),x=e.prevZ;for(;x&&x.z>=_;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&(o!==x.x||h!==x.y)&&Rn(o,h,l,c,u,p,x.x,x.y)&&qe(x.prev,x,x.next)>=0)return!1;x=x.prevZ}let v=e.nextZ;for(;v&&v.z<=y;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&(o!==v.x||h!==v.y)&&Rn(o,h,l,c,u,p,v.x,v.y)&&qe(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function ox(e,t){let r=e,i=!1;do{let a=r.prev,s=r.next.next;c2(a,r,r.next,s,!1)&&ns(a,s)&&ns(s,a)&&(t.push(a.i,r.i,s.i),os(r),os(r.next),r=e=s,i=!0),r=r.next}while(r!==e);return i?xi(r):r}function lx(e,t,r,i,a){let s=e;do{let n=s.next.next;for(;n!==s.prev;){if(s.i!==n.i&&vx(s,n)){let o=p2(s,n);s=xi(s,s.next),o=xi(o,o.next),pu(s,t,r,i,a),pu(o,t,r,i,a);return}n=n.next}s=s.next}while(s!==e)}let du=!1;function ux(e,t,r,i){let a=[];for(let s=0,n=t.length;s<n;s++){let o=u2(e,t[s]*i,s<n-1?t[s+1]*i:e.length,i,!1);o===o.next&&as.add(o),a.push(yx(o))}a.sort(hx),px(e.length/i,t.length),h2(r,r),du=!0;for(let s=0;s<a.length;s++)r=cx(a[s],r);return du=!1,xi(r)}function hx(e,t){return e.x-t.x||e.y-t.y||(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}function cx(e,t){let r=fx(e,t);if(!r)return t;let i=p2(r,e),a=i.next;return h2(r,a.next),xi(i,i.next),xi(r,r.next)}let Re=new Float64Array,kn=0;const fu=[],mu=[];function px(e,t){let r=Math.ceil((e+2*t)/16)+t+2;Re.length<r*4&&(Re=new Float64Array(r*4)),kn=0}function h2(e,t){let r=e;do{let i=kn++;fu[i]=r;let a=1/0,s=1/0,n=-1/0,o=-1/0,l=0;do{let h=r.next;r.z=i,r.x<a&&(a=r.x),r.x>n&&(n=r.x),r.y<s&&(s=r.y),r.y>o&&(o=r.y),h.x<a&&(a=h.x),h.x>n&&(n=h.x),h.y<s&&(s=h.y),h.y>o&&(o=h.y),r=h}while(++l<16&&r!==t);mu[i]=r;let u=i*4;Re[u]=a,Re[u+1]=s,Re[u+2]=n,Re[u+3]=o}while(r!==t)}function dx(e,t){let r=e.z*4;t.x<Re[r]&&(Re[r]=t.x),t.y<Re[r+1]&&(Re[r+1]=t.y),t.x>Re[r+2]&&(Re[r+2]=t.x),t.y>Re[r+3]&&(Re[r+3]=t.y)}function ip(e){let t=mu[e];for(;t.prev.next!==t;)t=t.next;return mu[e]=t,t}function ap(e){let t=fu[e];for(;t.prev.next!==t;)t=t.next;return fu[e]=t,t}function fx(e,t){let r=t,i=e.x,a=e.y,s=-1/0,n;if(ss(e,r))return r;for(let p=0,d=0;p<kn;p++,d+=4){if(a<Re[d+1]||a>Re[d+3]||Re[d]>i||Re[d+2]<=s)continue;let f=ip(p);r=ap(p);do{if(r.prev.next===r){if(ss(e,r.next))return r.next;if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){let m=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(m<=i&&m>s&&(s=m,n=r.x<r.next.x?r:r.next,m===i))return n}}r=r.next}while(r!==f)}if(!n)return null;let o=n.x,l=n.y,u=Math.min(a,l),h=Math.max(a,l),c=1/0;for(let p=0,d=0;p<kn;p++,d+=4){if(Re[d+2]<o||Re[d]>i||Re[d+3]<u||Re[d+1]>h)continue;let f=ip(p);r=ap(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&Rn(a<l?i:s,a,o,l,a<l?s:i,a,r.x,r.y)){let m=Math.abs(a-r.y)/(i-r.x);(ns(r,e)||r.y===a&&r.next.y===a&&r.next.x>i)&&(m<c||m===c&&(r.x>n.x||r.x===n.x&&mx(n,r)))&&(n=r,c=m)}r=r.next}while(r!==f)}return n}function mx(e,t){return qe(e.prev,e,t.prev)<0&&qe(t.next,e,e.next)<0}const Bt=[];let va=[],ei=new Uint32Array,xa=new Uint32Array;const ba=new Uint32Array(256);function gx(e,t,r,i){let a=e,s=0;do a.z=gu(a.x,a.y,t,r,i),Bt[s++]=a,a=a.next;while(a!==e);_x(s);let n=null;for(let o=0;o<s;o++){let l=Bt[o];l.prevZ=n,n&&(n.nextZ=l),n=l}n.nextZ=null}function _x(e){if(e<=32){for(let t=1;t<e;t++){let r=Bt[t],i=r.z,a=t-1;for(;a>=0&&Bt[a].z>i;)Bt[a+1]=Bt[a],a--;Bt[a+1]=r}return}ei.length<e&&(ei=new Uint32Array(e),xa=new Uint32Array(e),va=Array(e));for(let t=0;t<e;t++)ei[t]=Bt[t].z;$s(e,Bt,ei,va,xa,0),$s(e,va,xa,Bt,ei,8),$s(e,Bt,ei,va,xa,16),$s(e,va,xa,Bt,ei,24)}function $s(e,t,r,i,a,s){ba.fill(0);for(let o=0;o<e;o++)ba[r[o]>>>s&255]++;let n=0;for(let o=0;o<256;o++){let l=ba[o];ba[o]=n,n+=l}for(let o=0;o<e;o++){let l=r[o],u=ba[l>>>s&255]++;i[u]=t[o],a[u]=l}}function gu(e,t,r,i,a){return e=(e-r)*a|0,t=(t-i)*a|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function yx(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Rn(e,t,r,i,a,s,n,o){return(a-n)*(t-o)>=(e-n)*(s-o)&&(e-n)*(i-o)>=(r-n)*(t-o)&&(r-n)*(s-o)>=(a-n)*(i-o)}function vx(e,t){let r=ss(e,t)&&qe(e.prev,e,e.next)>0&&qe(t.prev,t,t.next)>0;return e.next.i!==t.i&&(r||ns(e,t)&&ns(t,e)&&(qe(e.prev,e,t.prev)!==0||qe(e,t.prev,t)!==0))&&!xx(e,t)&&(r||bx(e,t))}function qe(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function ss(e,t){return e.x===t.x&&e.y===t.y}function c2(e,t,r,i,a=!0){let s=qe(e,t,r),n=qe(e,t,i),o=qe(r,i,e),l=qe(r,i,t);return(s>0&&n<0||s<0&&n>0)&&(o>0&&l<0||o<0&&l>0)?!0:a?!!(s===0&&Os(e,r,t)||n===0&&Os(e,i,t)||o===0&&Os(r,e,i)||l===0&&Os(r,t,i)):!1}function Os(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function xx(e,t){let r=Math.min(e.x,t.x),i=Math.max(e.x,t.x),a=Math.min(e.y,t.y),s=Math.max(e.y,t.y),n=e;do{let o=n.next;if(n.x>i&&o.x>i||n.x<r&&o.x<r||n.y>s&&o.y>s||n.y<a&&o.y<a){n=o;continue}if(n.i!==e.i&&o.i!==e.i&&n.i!==t.i&&o.i!==t.i&&c2(n,o,e,t))return!0;n=o}while(n!==e);return!1}function ns(e,t){return qe(e.prev,e,e.next)<0?qe(e,t,e.next)>=0&&qe(e,e.prev,t)>=0:qe(e,t,e.prev)<0||qe(e,e.next,t)<0}function bx(e,t){let r=e,i=!1,a=(e.x+t.x)/2,s=(e.y+t.y)/2;do{let n=r.next;r.y>s!=n.y>s&&a<(n.x-r.x)*(s-r.y)/(n.y-r.y)+r.x&&(i=!i),r=n}while(r!==e);return i}function p2(e,t){let r=_u(e.i,e.x,e.y),i=_u(t.i,t.x,t.y),a=e.next,s=t.prev;return e.next=t,t.prev=e,r.next=a,a.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function sp(e,t,r,i){let a=_u(e,t,r);return i?(a.next=i.next,a.prev=i,i.next.prev=a,i.next=a):(a.prev=a,a.next=a),a}function os(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ),du&&dx(e.prev,e.next)}function _u(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function wx(e,t,r,i){let a=0;for(let s=t,n=r-i;s<r;s+=i)a+=(e[n]-e[s])*(e[s+1]+e[n+1]),n=s;return a}var br=class{constructor(t,r){if(r>t)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){let r=1<<t;return Math.max(Math.floor(this._baseZoomGranularity/r),this._minGranularity,1)}},di,Ah=(di=class{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}},di.noSubdivision=new di({fill:new br(0,0),line:new br(0,0),tile:new br(0,0),stencil:new br(0,0),circle:1}),di);V("SubdivisionGranularityExpression",br),V("SubdivisionGranularitySetting",Ah);const Ua=-32768,qa=32767;var Tx=class{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=z/t,this._canonical=r}_getKey(t,r){return t+=32768,r+=32768,t<<16|r<<0}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let i=Math.round(t)|0,a=Math.round(r)|0,s=this._getKey(i,a);if(this._vertexDictionary.has(s))return this._vertexDictionary.get(s);let n=this._vertexBuffer.length/2;return this._vertexDictionary.set(s,n),this._vertexBuffer.push(i,a),n}_subdivideTrianglesScanline(t){if(this._granularity<2)return Ax(this._vertexBuffer,t);let r=[],i=t.length;for(let a=0;a<i;a+=3){let s=[t[a+0],t[a+1],t[a+2]],n=[this._vertexBuffer[t[a+0]*2+0],this._vertexBuffer[t[a+0]*2+1],this._vertexBuffer[t[a+1]*2+0],this._vertexBuffer[t[a+1]*2+1],this._vertexBuffer[t[a+2]*2+0],this._vertexBuffer[t[a+2]*2+1]],o=1/0,l=1/0,u=-1/0,h=-1/0;for(let m=0;m<3;m++){let g=n[m*2],_=n[m*2+1];o=Math.min(o,g),u=Math.max(u,g),l=Math.min(l,_),h=Math.max(h,_)}if(o===u||l===h)continue;let c=Math.floor(o/this._granularityCellSize),p=Math.ceil(u/this._granularityCellSize),d=Math.floor(l/this._granularityCellSize),f=Math.ceil(h/this._granularityCellSize);if(c===p&&d===f){r.push(...s);continue}for(let m=d;m<f;m++){let g=this._scanlineGenerateVertexRingForCellRow(m,n,s);Ex(this._vertexBuffer,g,r)}}return r}_scanlineGenerateVertexRingForCellRow(t,r,i){let a=t*this._granularityCellSize,s=a+this._granularityCellSize,n=[];for(let o=0;o<3;o++){let l=r[o*2],u=r[o*2+1],h=r[(o+1)*2%6],c=r[((o+1)*2+1)%6],p=r[(o+2)*2%6],d=r[((o+2)*2+1)%6],f=h-l,m=c-u,g=f===0,_=m===0,y=(a-u)/m,x=(s-u)/m,v=Math.min(y,x),w=Math.max(y,x);if(!_&&(v>=1||w<=0)||_&&(u<a||u>s)){c>=a&&c<=s&&n.push(i[(o+1)%3]);continue}if(!_&&v>0){let C=l+f*v,E=u+m*v;n.push(this._vertexToIndex(C,E))}let b=l+f*Math.max(v,0),A=l+f*Math.min(w,1);if(g||this._generateIntraEdgeVertices(n,l,u,h,c,b,A),!_&&w<1){let C=l+f*w,E=u+m*w;n.push(this._vertexToIndex(C,E))}(_||c>=a&&c<=s)&&n.push(i[(o+1)%3]),!_&&(c<=a||c>=s)&&this._generateInterEdgeVertices(n,l,u,h,c,p,d,A,a,s)}return n}_generateIntraEdgeVertices(t,r,i,a,s,n,o){let l=a-r,u=s-i,h=u===0,c=h?Math.min(r,a):Math.min(n,o),p=h?Math.max(r,a):Math.max(n,o),d=Math.floor(c/this._granularityCellSize)+1,f=Math.ceil(p/this._granularityCellSize)-1;if(h?r<a:n<o)for(let m=d;m<=f;m++){let g=m*this._granularityCellSize,_=i+u*(g-r)/l;t.push(this._vertexToIndex(g,_))}else for(let m=f;m>=d;m--){let g=m*this._granularityCellSize,_=i+u*(g-r)/l;t.push(this._vertexToIndex(g,_))}}_generateInterEdgeVertices(t,r,i,a,s,n,o,l,u,h){let c=s-i,p=n-a,d=o-s,f=(u-s)/d,m=(h-s)/d,g=Math.min(f,m),_=Math.max(f,m),y=a+p*g,x=Math.floor(Math.min(y,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(y,l)/this._granularityCellSize)-1,w=l<y,b=d===0;if(b&&(o===u||o===h))return;if(b||g>=1||_<=0){let C=r-n,E=i-o,F=(u-o)/E,k=(h-o)/E,B=n+C*Math.min(F,k);x=Math.floor(Math.min(B,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(B,l)/this._granularityCellSize)-1,w=l<B}let A=c>0?h:u;if(w)for(let C=x;C<=v;C++){let E=C*this._granularityCellSize;t.push(this._vertexToIndex(E,A))}else for(let C=v;C>=x;C--){let E=C*this._granularityCellSize;t.push(this._vertexToIndex(E,A))}}_generateOutline(t){let r=[];for(let i of t){let a=Eh(i,this._granularity,!0),s=this._pointArrayToIndices(a),n=[];for(let o=1;o<s.length;o++)n.push(s[o-1]),n.push(s[o]);r.push(n)}return r}_handlePoles(t){let r=!1,i=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(r||i)&&this._fillPoles(t,r,i)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){let i=t[r+1];i===-32768&&(t[r+1]=-32767),i===32767&&(t[r+1]=32766)}}_generatePoleQuad(t,r,i,a,s,n){a>s==(n===-32768)?(t.push(i),t.push(r),t.push(this._vertexToIndex(a,n)),t.push(this._vertexToIndex(s,n)),t.push(i),t.push(this._vertexToIndex(a,n))):(t.push(r),t.push(i),t.push(this._vertexToIndex(a,n)),t.push(i),t.push(this._vertexToIndex(s,n)),t.push(this._vertexToIndex(a,n)))}_fillPoles(t,r,i){let a=this._vertexBuffer,s=z,n=t.length;for(let o=2;o<n;o+=3){let l=t[o-2],u=t[o-1],h=t[o],c=a[l*2],p=a[l*2+1],d=a[u*2],f=a[u*2+1],m=a[h*2],g=a[h*2+1];r&&(p===0&&f===0&&this._generatePoleQuad(t,l,u,c,d,Ua),f===0&&g===0&&this._generatePoleQuad(t,u,h,d,m,Ua),g===0&&p===0&&this._generatePoleQuad(t,h,l,m,c,Ua)),i&&(p===s&&f===s&&this._generatePoleQuad(t,l,u,c,d,qa),f===s&&g===s&&this._generatePoleQuad(t,u,h,d,m,qa),g===s&&p===s&&this._generatePoleQuad(t,h,l,m,c,qa))}}_initializeVertices(t){for(let r=0;r<t.length;r+=2)this._vertexToIndex(t[r],t[r+1])}subdividePolygonInternal(t,r){var o;if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:i,holeIndices:a}=Dx(t);this._initializeVertices(i);let s;try{let l=ax(i,a),u=this._convertIndices(i,l);s=this._subdivideTrianglesScanline(u)}catch(l){console.error(l)}let n=[];return r&&(n=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(s),this._granularity>=2&&((o=this._canonical)==null?void 0:o.z)===0&&(s=this._removeTrianglesOutsideTileX(s),n=n.map(l=>this._removeLinesOutsideTileX(l))),{verticesFlattened:this._vertexBuffer,indicesTriangles:s,indicesLineList:n}}_vertexOutsideTileX(t){let r=this._vertexBuffer[t*2];return r<0||r>8192}_removeTrianglesOutsideTileX(t){let r=[];for(let i=0;i<t.length;i+=3)this._vertexOutsideTileX(t[i])||this._vertexOutsideTileX(t[i+1])||this._vertexOutsideTileX(t[i+2])||r.push(t[i],t[i+1],t[i+2]);return r}_removeLinesOutsideTileX(t){let r=[];for(let i=0;i<t.length;i+=2)this._vertexOutsideTileX(t[i])||this._vertexOutsideTileX(t[i+1])||r.push(t[i],t[i+1]);return r}_convertIndices(t,r){let i=[];for(let a of r){let s=t[a*2],n=t[a*2+1];i.push(this._vertexToIndex(s,n))}return i}_pointArrayToIndices(t){let r=[];for(let i of t)r.push(this._vertexToIndex(i.x,i.y));return r}};function d2(e,t,r,i=!0){return new Tx(r,t).subdividePolygonInternal(e,i)}function Eh(e,t,r=!1){if(!e||e.length<1||e.length<2)return[];let i=e[0],a=e[e.length-1],s=r&&(i.x!==a.x||i.y!==a.y);if(t<2)return s?[...e,e[0]]:[...e];let n=Math.floor(z/t),o=[];o.push(new M(e[0].x,e[0].y));let l=e.length,u=s?l:l-1;for(let h=0;h<u;h++){let c=e[h],p=h<l-1?e[h+1]:e[0],d=c.x,f=c.y,m=p.x,g=p.y,_=d!==m,y=f!==g;if(!_&&!y)continue;let x=m-d,v=g-f,w=Math.abs(x),b=Math.abs(v),A=d,C=f;for(;;){let F=x>0?(Math.floor(A/n)+1)*n:(Math.ceil(A/n)-1)*n,k=v>0?(Math.floor(C/n)+1)*n:(Math.ceil(C/n)-1)*n,B=Math.abs(A-F),I=Math.abs(C-k),D=Math.abs(A-m),T=Math.abs(C-g),S=_?B/w:1/0,j=y?I/b:1/0;if((D<=B||!_)&&(T<=I||!y))break;if(S<j&&_||!y){A=F,C+=v*S;let N=new M(A,Math.round(C));(o[o.length-1].x!==N.x||o[o.length-1].y!==N.y)&&o.push(N)}else{A+=x*j,C=k;let N=new M(Math.round(A),C);(o[o.length-1].x!==N.x||o[o.length-1].y!==N.y)&&o.push(N)}}let E=new M(m,g);(o[o.length-1].x!==E.x||o[o.length-1].y!==E.y)&&o.push(E)}return o}function Dx(e){let t=[],r=[];for(let i of e)if(i.length!==0){i!==e[0]&&t.push(r.length/2);for(let a of i)r.push(a.x),r.push(a.y)}return{flattened:r,holeIndices:t}}function Ax(e,t){let r=[];for(let i=0;i<t.length;i+=3){let a=t[i],s=t[i+1],n=t[i+2],o=e[a*2],l=e[a*2+1],u=e[s*2],h=e[s*2+1],c=e[n*2],p=e[n*2+1],d=u-o,f=h-l,m=c-o;d*(p-l)-f*m>0?(r.push(a),r.push(n),r.push(s)):(r.push(a),r.push(s),r.push(n))}return r}function Ex(e,t,r){if(t.length===0)throw Error("Subdivision vertex ring is empty.");let i=0,a=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<a&&(a=u,i=l)}let s=t.length,n=i,o=(n+1)%s;for(;;){let l=n-1>=0?n-1:s-1,u=(o+1)%s,h=e[t[l]*2],c=e[t[l]*2+1],p=e[t[u]*2],d=e[t[u]*2+1],f=e[t[n]*2],m=e[t[n]*2+1],g=e[t[o]*2],_=e[t[o]*2+1],y=!1;if(h<p)y=!0;else if(h>p)y=!1;else{let x=_-m,v=-(g-f),w=m<_?1:-1;((h-f)*x+(c-m)*v)*w>((p-f)*x+(d-m)*v)*w&&(y=!0)}if(y){let x=t[l],v=t[n],w=t[o];x!==v&&x!==w&&v!==w&&r.push(w,v,x),n--,n<0&&(n=s-1)}else{let x=t[u],v=t[n],w=t[o];x!==v&&x!==w&&v!==w&&r.push(w,v,x),o++,o>=s&&(o=0)}if(l===u)break}}function f2(e,t,r,i,a,s,n,o,l){let u=a.length/2,h=n&&o&&l;if(u<De.MAX_VERTEX_ARRAY_LENGTH){let c=t.prepareSegment(u,r,i),p=c.vertexLength;for(let m=0;m<s.length;m+=3)i.emplaceBack(p+s[m],p+s[m+1],p+s[m+2]);c.vertexLength+=u,c.primitiveLength+=s.length/3;let d,f;h&&(f=n.prepareSegment(u,r,o),d=f.vertexLength,f.vertexLength+=u);for(let m=0;m<a.length;m+=2)e(a[m],a[m+1]);if(h)for(let m of l){for(let g=1;g<m.length;g+=2)o.emplaceBack(d+m[g-1],d+m[g]);f.primitiveLength+=m.length/2}}else Sx(t,r,i,a,s,e),h&&Cx(n,r,o,a,l,e),t.forceNewSegmentOnNextPrepare(),n==null||n.forceNewSegmentOnNextPrepare()}function Ga(e,t,r,i,a,s,n){if(s){let o=i.count;return r(t[a*2],t[a*2+1]),e[a]=i.count,i.count++,n.vertexLength++,o}return e[a]}function Sx(e,t,r,i,a,s){let n=[];for(let c=0;c<i.length/2;c++)n.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),h=u.vertexLength;for(let c=2;c<a.length;c+=3){let p=a[c-2],d=a[c-1],f=a[c],m=n[p]<l,g=n[d]<l,_=n[f]<l,y=+!!m+ +!!g+ +!!_;u.vertexLength+y>De.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=o.count,m=!0,g=!0,_=!0,h=0);let x=Ga(n,i,s,o,p,m,u),v=Ga(n,i,s,o,d,g,u),w=Ga(n,i,s,o,f,_,u);r.emplaceBack(h+x-l,h+v-l,h+w-l),u.primitiveLength++}}function Cx(e,t,r,i,a,s){let n=[];for(let c=0;c<i.length/2;c++)n.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),h=u.vertexLength;for(let c of a)for(let p=1;p<c.length;p+=2){let d=c[p-1],f=c[p],m=n[d]<l,g=n[f]<l,_=+!!m+ +!!g;u.vertexLength+_>De.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=o.count,m=!0,g=!0,h=0);let y=Ga(n,i,s,o,d,m,u),x=Ga(n,i,s,o,f,g,u);r.emplaceBack(h+y-l,h+x-l),u.primitiveLength++}}var m2=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Jy,this.indexArray=new fr,this.indexArray2=new nu,this.programConfigurations=new vi(t.layers,t.zoom),this.segments=new De,this.segments2=new De,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,i){this.hasDependencies=zn("fill",this.layers,r);let a=this.layers[0].layout.get("fill-sort-key"),s=!a.isConstant(),n=[],o=new Ae(this.zoom),l=this.layers[0]._featureFilter.needGeometry;for(let{feature:u,id:h,index:c,sourceLayerIndex:p}of t){let d=Ei(u,l);if(!this.layers[0]._featureFilter.filter(o,d,i))continue;let f=s?a.evaluate(d,{},i,r.availableImages):void 0,m={id:h,properties:u.properties,type:u.type,sourceLayerIndex:p,index:c,geometry:l?d.geometry:Ai(u),patterns:{},sortKey:f};n.push(m)}s&&n.sort((u,h)=>u.sortKey-h.sortKey);for(let u of n){let{geometry:h,index:c,sourceLayerIndex:p}=u;if(this.hasDependencies){let f=Dh("fill",this.layers,u,{zoom:this.zoom},r);this.patternFeatures.push(f)}else this.addFeature(u,h,c,i,{},r.subdivisionGranularity);let d=t[c].feature;r.featureIndex.insert(d,h,c,p,this.index)}}update(t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:i})}addFeatures(t,r,i){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ix),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,i,a,s,n){for(let o of eh(r,500)){let l=d2(o,a,n.fill.getGranularityForZoomLevel(a.z)),u=this.layoutVertexArray;f2((h,c)=>{u.emplaceBack(h,c)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:s,canonical:a})}};V("FillBucket",m2,{omit:["layers","patternFeatures"]});let Px;const Ix=()=>Px||(Px=new it({"fill-sort-key":new Z(P.layout_fill["fill-sort-key"],"fill-sort-key")}));let Mx;const Fx=()=>Mx||(Mx=new it({"fill-antialias":new O(P.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new Z(P.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new O(P.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new Z(P.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new Z(P.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new O(P.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new O(P.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new ts(P.paint_fill["fill-pattern"],"fill-pattern")}));var zx={get paint(){return Fx()},get layout(){return Ix()}};const kx=e=>e.type==="fill";var Rx=class extends Kt{constructor(t,r){super(t,zx,r)}recalculate(t,r){super.recalculate(t,r);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new m2(t)}queryRadius(){return fo(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:i,pixelsToTileUnits:a}){return t2(mo(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,a),r)}isTileClipped(){return!0}};const Bx=Ce([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Lx=Ce([{name:"a_centroid",components:2,type:"Int16"}],4),$x=Bx.members;var or=class yu{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let r=new yu;return r.extend(t(new M(this.minX,this.minY))),r.extend(t(new M(this.maxX,this.minY))),r.extend(t(new M(this.minX,this.maxY))),r.extend(t(new M(this.maxX,this.maxY))),r}static fromPoints(t){let r=new yu;for(let i of t)r.extend(i);return r}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}};const Ox=or.fromPoints([new M(0,0),new M(z,z)]);function vu(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function np(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var ws=class{constructor(t,r,i,a,s){for(this.properties=Object.create(null),this.extent=i,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=a,this._values=s;t.pos<r;){let n=t.readVarint();if(n===8)this.id=t.readVarint();else if(n===18){let o=t.readVarint()+t.pos;for(;t.pos<o;){let l=a[t.readVarint()],u=s[t.readVarint()];this.properties[l]=u}}else n===24?this.type=t.readVarint():(n===34&&(this._geometry=t.pos),t.skip(n))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,i=[],a,s=1,n=0,o=0,l=0;for(;t.pos<r;){if(n<=0){let u=t.readVarint();if(s=u&7,n=u>>3,n===0)continue}if(n--,s===1)o+=t.readSVarint(),l+=t.readSVarint(),a&&i.push(a),a=[new M(o,l)];else if(s===2)o+=t.readSVarint(),l+=t.readSVarint(),a&&a.push(new M(o,l));else if(s===7)a&&a.push(a[0].clone());else throw Error(`unknown command ${s}`)}return a&&i.push(a),i}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,i=1,a=0,s=0,n=0,o=1/0,l=-1/0,u=1/0,h=-1/0;for(;t.pos<r;){if(a<=0){let c=t.readVarint();if(i=c&7,a=c>>3,a===0)continue}if(a--,i===1||i===2)s+=t.readSVarint(),n+=t.readSVarint(),s<o&&(o=s),s>l&&(l=s),n<u&&(u=n),n>h&&(h=n);else if(i!==7)throw Error(`unknown command ${i}`)}return[o,u,l,h]}toGeoJSON(t,r,i){let a=this.extent*2**i,s=this.extent*t,n=this.extent*r,o=this.loadGeometry();function l(p){return[(p.x+s)*360/a-180,360/Math.PI*Math.atan(Math.exp((1-(p.y+n)*2/a)*Math.PI))-90]}function u(p){return p.map(l)}let h;if(this.type===1){let p=[];for(let f of o)p.push(f[0]);let d=u(p);h=p.length===1?{type:"Point",coordinates:d[0]}:{type:"MultiPoint",coordinates:d}}else if(this.type===2){let p=o.map(u);h=p.length===1?{type:"LineString",coordinates:p[0]}:{type:"MultiLineString",coordinates:p}}else if(this.type===3){let p=g2(o),d=[];for(let f of p)d.push(f.map(u));h=d.length===1?{type:"Polygon",coordinates:d[0]}:{type:"MultiPolygon",coordinates:d}}else throw Error("unknown feature type");let c={type:"Feature",geometry:h,properties:this.properties};return this.id!=null&&(c.id=this.id),c}};ws.types=["Unknown","Point","LineString","Polygon"];function g2(e){let t=e.length;if(t<=1)return[e];let r=[],i,a;for(let s=0;s<t;s++){let n=Vx(e[s]);n!==0&&(a===void 0&&(a=n<0),a===n<0?(i&&r.push(i),i=[e[s]]):i&&i.push(e[s]))}return i&&r.push(i),r}function Vx(e){let t=0;for(let r=0,i=e.length,a=i-1,s,n;r<i;a=r++)s=e[r],n=e[a],t+=(n.x-s.x)*(s.y+n.y);return t}var jx=class{constructor(t,r){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],r===void 0&&(r=t.length);t.pos<r;){let i=t.readVarint();i===10?this.name=t.readString():i===18?(this._features.push(t.pos),t.skip(i)):i===26?this._keys.push(t.readString()):i===34?this._values.push(Nx(t)):i===40?this.extent=t.readVarint():i===120?this.version=t.readVarint():t.skip(i)}this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new ws(this._pbf,r,this.extent,this._keys,this._values)}};function Nx(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let i=e.readVarint();t=i===10?e.readString():i===21?e.readFloat():i===25?e.readDouble():i===32?e.readVarint(!0):i===40?e.readVarint():i===48?e.readSVarint():i===56?e.readBoolean():(e.skip(i),null)}if(t==null)throw Error("unknown feature value");return t}var Ux=class{constructor(t,r=t.length){let i=Object.create(null);for(;t.pos<r;){let a=t.readVarint();if(a===26){let s=new jx(t,t.readVarint()+t.pos);s.length&&(i[s.name]=s)}else t.skip(a)}this.layers=i}};const Wt=63710088e-1;var K=class Ba{constructor(t,r){if(isNaN(t)||isNaN(r))throw Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ba(Vt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,i=this.lat*r,a=t.lat*r,s=Math.sin(i)*Math.sin(a)+Math.cos(i)*Math.cos(a)*Math.cos((t.lng-this.lng)*r);return Wt*Math.acos(Math.min(s,1))}static convert(t){if(t instanceof Ba)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Ba(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t)return new Ba(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};const _2=2*Math.PI*Wt;function y2(e){return _2*Math.cos(e*Math.PI/180)}function oa(e){return(180+e)/360}function la(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function bi(e,t){return e/y2(t)}function xu(e){return e*360-180}function ls(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function v2(e,t){return e*y2(ls(t))}function qx(e){return 1/Math.cos(e*Math.PI/180)}var de=class x2{constructor(t,r,i=0){this.x=+t,this.y=+r,this.z=+i}static fromLngLat(t,r=0){let i=K.convert(t);return new x2(oa(i.lng),la(i.lat),bi(r,i.lat))}toLngLat(){return new K(xu(this.x),ls(this.y))}toAltitude(){return v2(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/_2*qx(ls(this.y))}};const pi=89.25;function b2(e,t,r){let i=1/(1<<r.z);return new de(e/z*i+r.x*i,t/z*i+r.y*i)}function Gx(e,t,r){return b2(e,t,r).toLngLat()}function ar(e,t){let r=te(t.lat,-85.051129,ur);return new M(oa(t.lng)*e,la(r)*e)}function us(e,t){return new de(t.x/e,t.y/e).toLngLat()}function Za(e){return e.cameraToCenterDistance*Math.min(Math.tan(Be(90-e.pitch))*.85,Math.tan(Be(pi-e.pitch)))}function Zo(e,t){let r=e.canonical,i=t/yt(r.z),a=r.x+2**r.z*e.wrap,s=new Float64Array(16);return Xt(s),Ve(s,s,[a*i,r.y*i,0]),nt(s,s,[i/z,i/z,1]),s}function w2(e,t,r,i,a){let s=de.fromLngLat(e,t),n=a*bi(1,e.lat),{x:o,y:l,z:u}=bu(r,i),h=n*-o,c=n*-l,p=n*u;return new de(s.x+h,s.y+c,s.z+p)}function T2(e){let t=bi(1,e.center.lat)*e.worldSize;return w2(e.center,e.elevation,e.pitch,e.bearing,e.cameraToCenterDistance/t)}function bu(e,t){let r=Be(e),i=Be(t),a=Math.cos(-r),s=Math.sin(r);return{x:s*Math.sin(i),y:-s*Math.cos(i),z:a}}function op(e,t,r){if(t<=0||!e||e.length===0)return e;let i=Zx(t,r);return e.map(a=>Wx(a,i))}function Zx(e,t){let r=Gx(z/2,z/2,t),i=de.fromLngLat(r).meterInMercatorCoordinateUnits(),a=(1<<t.z)*z;return e*i*a}function Wx(e,t){if(!e||e.length<3)return e;let r=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,i=r?e.length-1:e.length;if(i<3)return e;let a=[];for(let n=0;n<i;n++){let o=e[(n-1+i)%i],l=e[n],u=e[(n+1)%i];if(vu(o,l)||vu(l,u)){a.push(l.clone());continue}Xx(a,o,l,u,t)}let s=Hx(a);return s.length<3?e:(r&&s.push(s[0].clone()),s)}function Hx(e){let t=[];for(let r of e){let i=r.round(),a=t[t.length-1];((a==null?void 0:a.x)!==i.x||(a==null?void 0:a.y)!==i.y)&&t.push(i)}for(;t.length>1&&t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y;)t.pop();return t}function Xx(e,t,r,i,a){let s=t.sub(r),n=i.sub(r),o=s.mag(),l=n.mag();if(o<1e-6||l<1e-6){e.push(r.clone());return}s._div(o),n._div(l);let u=s.x*n.x+s.y*n.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){e.push(r.clone());return}let h=.2,c=Math.min(a,o*h,l*h),p=r.add(s.mult(c)),d=r.add(n.mult(c)),f=Math.sqrt((1+u)/2),m=r.add(s.add(n)._unit()._mult(c/f)),g=p.sub(m).angleWith(d.sub(m)),_=Math.max(2,Math.ceil(Math.abs(g)/(Math.PI/6)-1e-6));for(let y=0;y<=_;y++)e.push(p.rotateAround(y/_*g,m))}const Wo=8192;function wa(e,t,r,i,a,s,n,o){e.emplaceBack(t,r,Math.floor(i*Wo)*2+n,a*Wo*2,s*Wo*2,Math.round(o))}var D2=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Qy,this.centroidVertexArray=new $r,this.indexArray=new fr,this.programConfigurations=new vi(e.layers,e.zoom),this.segments=new De,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,r){this.features=[],this.hasDependencies=zn("fill-extrusion",this.layers,t);let i=new Ae(this.zoom),a=this.layers[0],s=a.layout.get("fill-extrusion-rounded-corner-distance"),n=a._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of e){let c=Ei(o,n);if(!a._featureFilter.filter(i,c,r))continue;let p=n?c.geometry:Ai(o),d={id:l,sourceLayerIndex:h,index:u,geometry:s>0?op(p,s,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Dh("fill-extrusion",this.layers,d,{zoom:this.zoom},t)):this.addFeature(d,d.geometry,u,r,{},t.subdivisionGranularity),t.featureIndex.insert(o,d.geometry,u,h,this.index,!0)}}addFeatures(e,t,r){for(let i of this.features){let{geometry:a}=i;this.addFeature(i,a,i.index,t,r,e.subdivisionGranularity)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$x),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Lx.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,r,i,a,s){let n=this.layers[0],o=n.layout?n.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?op(t,o,i):t;for(let u of eh(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,e,u,s);let p=this.layoutVertexArray.length-c,d=Math.floor(h.x/h.sampleCount),f=Math.floor(h.y/h.sampleCount);for(let m=0;m<p;m++)this.centroidVertexArray.emplaceBack(d,f)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:a,canonical:i})}processPolygon(e,t,r,i,a){if(i.length<1||np(i[0]))return;for(let h of i)h.length!==0&&Yx(e,h);let s={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},n=a.fill.getGranularityForZoomLevel(t.z),o=ws.types[r.type]==="Polygon";for(let h of i){if(h.length===0||np(h))continue;let c=Eh(h,n,o);this._generateSideFaces(c,s)}if(!o)return;let l=d2(i,t,n,!1),u=this.layoutVertexArray;f2((h,c)=>{wa(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let r=0;for(let i=1;i<e.length;i++){let a=e[i],s=e[i-1];if(vu(a,s))continue;t.segment.vertexLength+4>De.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let n=a.sub(s)._perp()._unit(),o=s.dist(a);r+o>32768&&(r=0),wa(this.layoutVertexArray,a.x,a.y,n.x,n.y,0,0,r),wa(this.layoutVertexArray,a.x,a.y,n.x,n.y,0,1,r),r+=o,wa(this.layoutVertexArray,s.x,s.y,n.x,n.y,0,0,r),wa(this.layoutVertexArray,s.x,s.y,n.x,n.y,0,1,r);let l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};function Yx(e,t){for(let r=0;r<t.length;r++){let i=t[r];(r!==t.length-1||t[0].x!==i.x||t[0].y!==i.y)&&(e.x+=i.x,e.y+=i.y,e.sampleCount++)}}V("FillExtrusionBucket",D2,{omit:["layers","features"]});let Kx;const Jx=()=>Kx||(Kx=new it({"fill-extrusion-rounded-corner-distance":new O(P["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")}));let Qx;const eb=()=>Qx||(Qx=new it({"fill-extrusion-opacity":new O(P["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new Z(P["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new O(P["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new O(P["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new ts(P["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new Z(P["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new Z(P["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new O(P["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")}));var tb={get paint(){return eb()},get layout(){return Jx()}};const rb=e=>e.type==="fill-extrusion";var ib=class extends Kt{constructor(e,t){super(e,tb,t)}createBucket(e){return new D2(e)}queryRadius(){return fo(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:s,pixelPosMatrix:n}){let o=mo(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-a.bearingInRadians,s),l=this.paint.get("fill-extrusion-height").evaluate(t,r),u=this.paint.get("fill-extrusion-base").evaluate(t,r),h=nb(o,n,0),c=sb(i,u,l,n),p=c[0],d=c[1];return ab(p,d,h)}};function Ta(e,t){return e.x*t.x+e.y*t.y}function lp(e,t){if(e.length===1){let r=0,i=t[r++],a;for(;!a||i.equals(a);)if(a=t[r++],!a)return 1/0;for(;r<t.length;r++){let s=t[r],n=e[0],o=a.sub(i),l=s.sub(i),u=n.sub(i),h=Ta(o,o),c=Ta(o,l),p=Ta(l,l),d=Ta(u,o),f=Ta(u,l),m=h*p-c*c,g=(p*d-c*f)/m,_=(h*f-c*d)/m,y=1-g-_,x=i.z*y+a.z*g+s.z*_;if(isFinite(x))return x}return 1/0}{let r=1/0;for(let i of t)r=Math.min(r,i.z);return r}}function ab(e,t,r){let i=1/0;t2(r,t)&&(i=lp(r,t[0]));for(let a=0;a<t.length;a++){let s=t[a],n=e[a];for(let o=0;o<s.length-1;o++){let l=s[o],u=s[o+1],h=n[o],c=[l,u,n[o+1],h,l];e2(r,c)&&(i=Math.min(i,lp(r,c)))}}return i!==1/0&&i}function sb(e,t,r,i){let a=[],s=[],n=i[8]*t,o=i[9]*t,l=i[10]*t,u=i[11]*t,h=i[8]*r,c=i[9]*r,p=i[10]*r,d=i[11]*r;for(let f of e){let m=[],g=[];for(let _ of f){let y=_.x,x=_.y,v=i[0]*y+i[4]*x+i[12],w=i[1]*y+i[5]*x+i[13],b=i[2]*y+i[6]*x+i[14],A=i[3]*y+i[7]*x+i[15],C=v+n,E=w+o,F=b+l,k=A+u,B=v+h,I=w+c,D=b+p,T=A+d,S=new M(C/k,E/k);S.z=F/k,m.push(S);let j=new M(B/T,I/T);j.z=D/T,g.push(j)}a.push(m),s.push(g)}return[a,s]}function nb(e,t,r){let i=[];for(let a of e){let s=[a.x,a.y,r,1];Xe(s,s,t),i.push(new M(s[0]/s[3],s[1]/s[3]))}return i}const ob="geojsonvt_clip_start",lb="geojsonvt_clip_end",ub=Ce([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),hb=ub.members,cb=Ce([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),pb=cb.members,db=Math.cos(75/2*(Math.PI/180)),A2=1/2,up=2**14/A2;var E2=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let t of this.layers)this.gradients[t.id]={};this.layoutVertexArray=new ev,this.layoutVertexArray2=new tv,this.indexArray=new fr,this.programConfigurations=new vi(e.layers,e.zoom),this.segments=new De,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,r){this.hasDependencies=zn("line",this.layers,t)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),a=!i.isConstant(),s=[],n=new Ae(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of e){let p=Ei(l,o);if(!this.layers[0]._featureFilter.filter(n,p,r))continue;let d=a?i.evaluate(p,{},r):void 0,f={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ai(l),patterns:{},dashes:{},sortKey:d};s.push(f)}a&&s.sort((l,u)=>l.sortKey-u.sortKey);for(let l of s){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(zn("line",this.layers,t)?Dh("line",this.layers,l,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,t),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},t.subdivisionGranularity);let p=e[h].feature;t.featureIndex.insert(p,u,h,c,this.index)}}update(e,t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(e,t,r,i){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t,r,i,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,pb)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hb),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,"geojsonvt_clip_start")&&Object.hasOwn(e.properties,"geojsonvt_clip_end"))return{start:+e.properties[ob],end:+e.properties[lb]}}addFeature(e,t,r,i,a,s,n){let o=this.layers[0].layout,l=o.get("line-join").evaluate(e,{}),u=o.get("line-cap").evaluate(e,{}),h=o.get("line-miter-limit").evaluate(e,{}),c=o.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let p of t)this.addLine(p,e,l,u,h,c,i,n);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:a,dashPositions:s,canonical:i})}addLine(e,t,r,i,a,s,n,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=n?o.line.getGranularityForZoomLevel(n.z):1;if(e=Eh(e,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let x=0;x<e.length-1;x++)this.totalDistance+=e[x].dist(e[x+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=ws.types[t.type]==="Polygon",h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let c=0;for(;c<h-1&&e[c].equals(e[c+1]);)c++;if(h-c<(u?3:2))return;r==="bevel"&&(a=1.05);let p=this.overscaling<=16?15*z/(512*this.overscaling):0,d=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),f,m,g,_,y;this.e1=this.e2=-1,u&&(f=e[h-2],y=e[c].sub(f)._unit()._perp());for(let x=c;x<h;x++){if(g=x===h-1?u?e[c+1]:void 0:e[x+1],g&&e[x].equals(g))continue;y&&(_=y),f&&(m=f),f=e[x],y=g?g.sub(f)._unit()._perp():_,_||(_=y);let v=_.add(y);(v.x!==0||v.y!==0)&&v._unit();let w=_.x*y.x+_.y*y.y,b=v.x*y.x+v.y*y.y,A=b===0?1/0:1/b,C=2*Math.sqrt(2-2*b),E=b<db&&m&&g,F=_.x*y.y-_.y*y.x>0;if(E&&x>c){let I=f.dist(m);if(I>2*p){let D=f.sub(f.sub(m)._mult(p/I)._round());this.updateDistance(m,D),this.addCurrentVertex(D,_,0,0,d),m=D}}let k=m&&g,B=k?r:u?"butt":i;if(k&&B==="round"&&(A<s?B="miter":A<=2&&(B="fakeround")),B==="miter"&&A>a&&(B="bevel"),B==="bevel"&&(A>2&&(B="flipbevel"),A<a&&(B="miter")),m&&this.updateDistance(m,f),B==="miter")v._mult(A),this.addCurrentVertex(f,v,0,0,d);else if(B==="flipbevel"){if(A>100)v=y.mult(-1);else{let I=A*_.add(y).mag()/_.sub(y).mag();v._perp()._mult(I*(F?-1:1))}this.addCurrentVertex(f,v,0,0,d),this.addCurrentVertex(f,v.mult(-1),0,0,d)}else if(B==="bevel"||B==="fakeround"){let I=-Math.sqrt(A*A-1),D=F?I:0,T=F?0:I;if(m&&this.addCurrentVertex(f,_,D,T,d),B==="fakeround"){let S=Math.round(C*180/Math.PI/20);for(let j=1;j<S;j++){let N=j/S;if(N!==.5){let X=N-.5,_e=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),mt=.848013+w*(-1.06021+w*.215638);N+=N*X*(N-1)*(_e*X*X+mt)}let U=y.sub(_)._mult(N)._add(_)._unit()._mult(F?-1:1);this.addHalfVertex(f,U.x,U.y,!1,F,0,d)}}g&&this.addCurrentVertex(f,y,-D,-T,d)}else if(B==="butt")this.addCurrentVertex(f,v,0,0,d);else if(B==="square"){let I=m?1:-1;this.addCurrentVertex(f,v,I,I,d)}else B==="round"&&(m&&(this.addCurrentVertex(f,_,0,0,d),this.addCurrentVertex(f,_,1,1,d,!0)),g&&(this.addCurrentVertex(f,y,-1,-1,d,!0),this.addCurrentVertex(f,y,0,0,d)));if(E&&x<h-1){let I=f.dist(g);if(I>2*p){let D=f.add(g.sub(f)._mult(p/I)._round());this.updateDistance(f,D),this.addCurrentVertex(D,y,0,0,d),f=D}}}}addCurrentVertex(e,t,r,i,a,s=!1){let n=t.x+t.y*r,o=t.y-t.x*r,l=-t.x+t.y*i,u=-t.y-t.x*i;this.addHalfVertex(e,n,o,s,!1,r,a),this.addHalfVertex(e,l,u,s,!0,-i,a),this.distance>up/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,i,a,s))}addHalfVertex({x:e,y:t},r,i,a,s,n,o){let l=(this.lineClips?this.scaledDistance*(up-1):this.scaledDistance)*A2;if(this.layoutVertexArray.emplaceBack((e<<1)+ +!!a,(t<<1)+ +!!s,Math.round(63*r)+128,Math.round(63*i)+128,(n===0?0:n<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(let t of e){let r=t.paint.get("line-dasharray");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(e,t,r,i){for(let a of e){let s=a.paint.get("line-dasharray");if(!s||s.value.kind==="constant")continue;let n=a.layout.get("line-cap").evaluate(t,{})==="round",o={dasharray:s.value.evaluate({zoom:r-1},t,{}),round:n},l={dasharray:s.value.evaluate({zoom:r},t,{}),round:n},u={dasharray:s.value.evaluate({zoom:r+1},t,{}),round:n},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,p=`${u.dasharray.join(",")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,t.dashes[a.id]={min:h,mid:c,max:p}}}};V("LineBucket",E2,{omit:["layers","patternFeatures"]});let fb;const mb=()=>fb||(fb=new it({"line-cap":new Z(P.layout_line["line-cap"],"line-cap"),"line-join":new Z(P.layout_line["line-join"],"line-join"),"line-miter-limit":new Z(P.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new Z(P.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new Z(P.layout_line["line-sort-key"],"line-sort-key")}));let gb;const _b=()=>gb||(gb=new it({"line-opacity":new Z(P.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new O(P.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new Z(P.paint_line["line-color"],"line-color"),"line-translate":new O(P.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new O(P.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new Z(P.paint_line["line-width"],"line-width"),"line-gap-width":new Z(P.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new Z(P.paint_line["line-offset"],"line-offset"),"line-blur":new Z(P.paint_line["line-blur"],"line-blur"),"line-dasharray":new ts(P.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new ts(P.paint_line["line-pattern"],"line-pattern"),"line-gradient":new co(P.paint_line["line-gradient"],"line-gradient")}));var hp={get paint(){return _b()},get layout(){return mb()}},yb=class extends Z{possiblyEvaluate(e,t){return t=new Ae(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=q({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}};let Vs;const vb=e=>e.type==="line";var xb=class extends Kt{constructor(e,t){super(e,hp,t),this.gradientVersion=0,Vs||(Vs=new yb(hp.paint.properties["line-width"].specification,"line-floorwidth"),Vs.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();this.stepInterpolant=J_(t)?t._styleExpression.expression instanceof Qu:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=Vs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new E2(e)}queryRadius(e){let t=e,r=cp(Gi("line-width",this,t),Gi("line-gap-width",this,t)),i=Gi("line-offset",this,t);return r/2+Math.abs(i)+fo(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:s}){let n=mo(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-a.bearingInRadians,s),o=s/2*cp(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),l=this.paint.get("line-offset").evaluate(t,r);return l&&(i=Sv(i,l*s)),xv(n,i,o)}isTileClipped(){return!0}};function cp(e,t){return t>0?t+2*e:e}const bb=Ce([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),wb=Ce([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ce([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Tb=Ce([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ce([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const pp=Ce([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Db=Ce([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ce([{name:"triangle",components:3,type:"Uint16"}]),Ce([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),Ce([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),Ce([{type:"Float32",name:"offsetX"}]),Ce([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ce([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);function Ab(e,t,r){let i=t.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?e=e.toLocaleUpperCase():i==="lowercase"&&(e=e.toLocaleLowerCase()),sa.applyArabicShaping&&(e=sa.applyArabicShaping(e)),e}function Eb(e,t,r){for(let i of e.sections)i.text=Ab(i.text,t,r);return e}function Sb(e){let t={},r={},i=[],a=0;function s(u){i.push(e[u]),a++}function n(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=t[h];return delete t[h],t[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;u<e.length;u++){let h=e[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){s(u);continue}let d=l(p,c),f=l(p,c,!0);if(d in r&&f in t&&r[d]!==t[f]){let m=o(d,f,c),g=n(d,f,i[m].geometry);delete t[d],delete r[f],r[l(p,i[g].geometry,!0)]=g,i[m].geometry=null}else d in r?n(d,f,c):f in t?o(d,f,c):(s(u),t[d]=a-1,r[f]=a-1)}return i.filter(u=>u.geometry)}const S2=typeof Intl<"u"&&"Segmenter"in Intl,dp=S2?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null,fp=S2?new Intl.Segmenter(void 0,{granularity:"word"}):null;function mp(e){if(!dp||!zy(e))return[...e];let t=[];for(let{segment:r}of dp.segment(e)){let i=t.length-1;i>=0&&ky(t[i],r)?t[i]+=r:t.push(r)}return t}function Cb(e){let t=new Set;if(fp){for(let{index:i}of fp.segment(e))t.add(i);return t}let r=0;for(let i of e.split(new RegExp("\\b|(?=\\p{Ideo})","u")))t.add(r),r+=i.length;return t}function wu(e){let t=e.codePointAt(0);return e.length>(t>65535?2:1)}const La={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Pb(e){let t="",r={premature:!0,value:void 0},i=e[Symbol.iterator](),a=i.next(),s=e[Symbol.iterator]();s.next();let n=s.next();for(;!a.done;)(n.done||!jc(n.value.codePointAt(0))||La[n.value])&&(r.premature||!jc(r.value.codePointAt(0))||La[r.value])&&La[a.value]?t+=La[a.value]:t+=a.value,r={value:a.value,premature:!1},a=i.next(),n=s.next();return t}const Ib={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Mb={40:!0};function gp(e,t,r,i,a,s){if("fontStack"in t){let n=r[t.fontStack],o=n==null?void 0:n[e];if(o)return o.metrics.advance*t.scale+a;let l=0;for(let u of e){let h=n==null?void 0:n[u];h&&(l+=h.metrics.advance*t.scale+a)}return l}{let n=i[t.imageName];return n?n.displaySize[0]*t.scale*24/s+a:0}}function _p(e,t,r,i){let a=(e-t)**2;return i?e<t?a/2:a*2:a+Math.abs(r)*r}function yp(e){return/^\s+$/u.test(e)}function Fb(e,t,r){let i=0;return(e===10||e===13)&&(i-=1e4),r&&(i+=150),(e===40||e===65288)&&(i+=50),(t===41||t===65289)&&(i+=50),i}function vp(e,t,r,i,a,s){let n=null,o=_p(t,r,a,s);for(let l of i){let u=_p(t-l.x,r,a,s)+l.badness;u<=o&&(n=l,o=u)}return{index:e,x:t,priorBreak:n,badness:o}}function C2(e){return e?C2(e.priorBreak).concat(e.index):[]}var zb=class Tu{constructor(t="",r=[],i=[]){this.text=t,this.sections=r,this.sectionIndex=i,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??(this._graphemes=mp(this.text)),this._graphemes}static fromFeature(t,r){let i=new Tu;for(let a of t.sections)a.image?i.addImageSection(a):i.addTextSection(a,r);return i}length(){return this.graphemes().length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=Pb(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("")}trim(){let t=this.graphemes(),r=0;for(;r<t.length&&yp(t[r]);)r++;let i=t.length;for(;i>r&&yp(t[i-1]);)i--;this.text=t.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(t,r){let i=this.graphemes().slice(t,r).join(""),a=this.sectionIndex.slice(t,r);return new Tu(i,this.sections,a)}toCodeUnitIndex(t){return this.graphemes().slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=0,i=0;for(let a=0;a<this.length();a++){let s=this.getSection(a);if("imageName"in s){let n=t[s.imageName];if(!n)continue;let o=n.displaySize;r=Math.max(r,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:r,maxImageHeight:i}}_appendSection(t,r){let i=this.graphemes(),a=i.length>0?i[i.length-1]:"",s=mp(a+t);this.text+=t,this._graphemes=i.slice(0,a?-1:void 0).concat(s);let n=s.length-+!!a;for(let o=0;o<n;o++)this.sectionIndex.push(r)}addTextSection(t,r){this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||r}),this._appendSection(t.text,this.sections.length-1)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0){fe("Can't add FormattedSection with an empty image.");return}let i=this.getNextImageSectionCharCode();if(!i){fe("Reached maximum number of images 6401");return}this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:r}),this._appendSection(String.fromCharCode(i),this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,r,i,a,s){let n=[],o=this.determineAverageLineWidth(t,r,i,a,s),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let d=0;d<u.length;d++){let f=u[d];if(d>0){let m=u[d-1].codePointAt(0),g=f.codePointAt(0),_=Iy(m),y=Vc(m)&&Vc(g);(Ib[m]||_||"imageName"in this.getSection(d-1)||u[d+1]!==void 0&&Mb[g]||y&&(h??(h=Cb(this.text))).has(p))&&n.push(vp(d,c,o,n,Fb(m,g,_&&l),!1))}Ry(f.codePointAt(0))||(c+=gp(f,this.getSection(d),i,a,t,s)),p+=f.length}return C2(vp(this.length(),c,o,n,0,!0))}determineAverageLineWidth(t,r,i,a,s){let n=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);n+=gp(u,h,i,a,t,s),o++}let l=Math.max(1,Math.ceil(n/r));return n/l}};const xp=4294967296,bp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");var P2=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,r=this.length){let i;for(;i=this.nextField(r);)e(i,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*xp;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*xp;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,r=t[this.pos++];if(r<128)return r;let i=r&127,a;return a=t[this.pos++],i|=(a&127)<<7,a<128||(a=t[this.pos++],i|=(a&127)<<14,a<128)||(a=t[this.pos++],i|=(a&127)<<21,a<128)?i:(a=t[this.pos],i|=(a&15)<<28,kb(i,e,this))}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&bp?bp.decode(this.buf.subarray(t,e)):Bb(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;let t=this.readVarint();return this.type=t&7,this._valueStart=this.pos,t>>>3}skip(e){let t=e&7;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else if(t===1)this.pos+=8;else throw Error(`Unimplemented type: ${t}`)}};function kb(e,t,r){let i=r.buf,a,s;if(s=i[r.pos++],a=(s&112)>>4,s<128||(s=i[r.pos++],a|=(s&127)<<3,s<128)||(s=i[r.pos++],a|=(s&127)<<10,s<128)||(s=i[r.pos++],a|=(s&127)<<17,s<128)||(s=i[r.pos++],a|=(s&127)<<24,s<128)||(s=i[r.pos++],a|=(s&1)<<31,s<128))return Rb(e,a,t);throw Error("Expected varint not more than 10 bytes")}function Rb(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Bb(e,t,r){let i="",a=t;for(;a<r;){let s=e[a],n=null,o=s>239?4:s>223?3:s>191?2:1;if(a+o>r)break;let l,u,h;o===1?s<128&&(n=s):o===2?(l=e[a+1],(l&192)==128&&(n=(s&31)<<6|l&63,n<=127&&(n=null))):o===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(n=(s&15)<<12|(l&63)<<6|u&63,(n<=2047||n>=55296&&n<=57343)&&(n=null))):o===4&&(l=e[a+1],u=e[a+2],h=e[a+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(n=(s&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(n<=65535||n>=1114112)&&(n=null))),n===null?(n=65533,o=1):n>65535&&(n-=65536,i+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),i+=String.fromCharCode(n),a+=o}return i}function Lb(e,t,r){e===1&&r.readMessage($b,t)}function $b(e,t,r){if(e===3){let{id:i,bitmap:a,width:s,height:n,left:o,top:l,advance:u}=r.readMessage(Ob,{});t.push({id:i,bitmap:new Th({width:s+6,height:n+6},a),metrics:{width:s,height:n,left:o,top:l,advance:u}})}}function Ob(e,t,r){e===1?t.id=r.readVarint():e===2?t.bitmap=r.readBytes():e===3?t.width=r.readVarint():e===4?t.height=r.readVarint():e===5?t.left=r.readSVarint():e===6?t.top=r.readSVarint():e===7&&(t.advance=r.readVarint())}function Vb(e){return new P2(e).readFields(Lb,[])}function Bn(e){return typeof(e==null?void 0:e.renderWithWebGL)=="function"}function jb(e){let{userImage:t}=e;return!(t!=null&&t.render)||!t.render()?!1:(Bn(t.data)||e.data.replace(new Uint8Array(t.data.buffer)),!0)}function I2(e){let t=0,r=0;for(let n of e)t+=n.w*n.h,r=Math.max(r,n.w);e.sort((n,o)=>o.h-n.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],a=0,s=0;for(let n of e)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(n.w>l.w||n.h>l.h)){if(n.x=l.x,n.y=l.y,s=Math.max(s,n.y+n.h),a=Math.max(a,n.x+n.w),n.w===l.w&&n.h===l.h){let u=i.pop();u&&o<i.length&&(i[o]=u)}else n.h===l.h?(l.x+=n.w,l.w-=n.w):n.w===l.w?(l.y+=n.h,l.h-=n.h):(i.push({x:l.x+n.w,y:l.y,w:l.w-n.w,h:n.h}),l.y+=n.h,l.h-=n.h);break}}return{w:a,h:s,fill:t/(a*s)||0}}var Sh=class{constructor(e,{pixelRatio:t,version:r,isWebGLImage:i=!1,stretchX:a,stretchY:s,content:n,textFitWidth:o,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=a,this.stretchY=s,this.content=n,this.version=r,this.needsFirstWebGLRender=i,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},Nb=class{constructor(e,t){let r={},i={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let a=[];this.addImages(e,r,a),this.addImages(t,i,a);let{w:s,h:n}=I2(a),o=new be({width:s||1,height:n||1});for(let l in e){let u=e[l];if(u.isWebGLImage)continue;let h=r[l].paddedRect;be.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in t){let u=t[l],h=i[l].paddedRect,c=h.x+1,p=h.y+1,d=u.data.width,f=u.data.height;be.copy(u.data,o,{x:0,y:0},{x:c,y:p},u.data),be.copy(u.data,o,{x:0,y:f-1},{x:c,y:p-1},{width:d,height:1}),be.copy(u.data,o,{x:0,y:0},{x:c,y:p+f},{width:d,height:1}),be.copy(u.data,o,{x:d-1,y:0},{x:c-1,y:p},{width:1,height:f}),be.copy(u.data,o,{x:0,y:0},{x:c+d,y:p},{width:1,height:f})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(e,t,r){for(let i in e){let a=e[i],s={x:0,y:0,w:a.data.width+2,h:a.data.height+2};r.push(s),t[i]=new Sh(s,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){if(e.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==e.updateVersion){this.patchedUpdateVersion=e.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}}patchUpdatedImage(e,t,r){var l;if(!e||!t||!e.needsFirstWebGLRender&&e.version===t.version)return;e.needsFirstWebGLRender=!1,e.version=t.version;let[i,a]=e.tl,s=(l=t.userImage)==null?void 0:l.data;if(!Bn(s)){r.update(t.data,void 0,{x:i,y:a});return}let{width:n,height:o}=t.data;r.context.setCustomLayerDefaults(),s.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:i,y:a,width:n,height:o}),r.context.setDirty()}};V("ImagePosition",Sh),V("ImageAtlas",Nb);var M2=(function(e){return e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e})(M2||{});function F2(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}const wp=32640;function Tp(e,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Ae(e+1))};if(r.kind==="source")return{kind:"source"};if(r.kind==="composite"){let{minZoom:i,maxZoom:a}=Ub(r.zoomStops,e);return{kind:"composite",minZoom:i,maxZoom:a,interpolationType:r.interpolationType}}{let i=qb(r),a=r.evaluate(new Ae(e+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:i,layoutSize:a,interpolationType:r.interpolationType}}}function Ub(e,t){let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let i=r;for(;i<e.length&&e[i]<t+1;)i++;return i=Math.min(e.length-1,i),{minZoom:e[r],maxZoom:e[i]}}function qb(e){return e.zoomStops.map(t=>e.evaluate(new Ae(t===-1/0?e.zoomStops[1]-1:t)))}function Ch(e,{uSize:t,uSizeT:r},{lowerSize:i,upperSize:a}){return e.kind==="source"?i/128:e.kind==="composite"?Ne.number(i/128,a/128,r):t}function go(e,t){let r=0,i=0;return e.kind==="constant"?i=e.layoutSize:e.kind==="camera"?i=Gb(e,t):e.kind==="composite"&&(r=Zb(e,t)),{uSizeT:r,uSize:i}}function Gb({zoomStops:e,sizes:t,layoutSize:r,interpolationType:i},a){let s=e.length-1;for(;s>0&&e[s]>a;)s--;let n=Math.min(s+1,e.length-1),o=i?te(Ut.interpolationFactor(i,a,e[s],e[n]),0,1):0;return Math.min(Ne.number(t[s],t[n],o),r)}function Zb({interpolationType:e,minZoom:t,maxZoom:r},i){return e?te(Ut.interpolationFactor(e,i,t,r),0,1):0}function Ln(e,t,r){let i="never",a=e.get(t);return a?i=a:e.get(r)&&(i="always"),i}const Wb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function js(e,t,r,i,a,s,n,o,l,u,h,c,p,d){let f=o?Math.min(wp,Math.round(o[0])):0,m=o?Math.min(wp,Math.round(o[1])):0;e.emplaceBack(t,r,Math.round(i*32),Math.round(a*32),s,n,(f<<1)+ +!!l,m,u*16,h*16,c*256,p*256,d)}function hs(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function Hb(e){for(let t of e.sections)if(Oy(t.text))return!0;return!1}var Du=class{constructor(e){this.layoutVertexArray=new rv,this.indexArray=new fr,this.programConfigurations=e,this.segments=new De,this.dynamicLayoutVertexArray=new iv,this.opacityVertexArray=new av,this.hasVisibleVertices=!1,this.placedSymbolArray=new Vf}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bb.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,wb.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Wb,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};V("SymbolBuffers",Du);var Au=class{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new De,this.collisionVertexArray=new nv}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Tb.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};V("CollisionBuffers",Au);var Zi=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(n=>n.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Tp(this.zoom,t["text-size"]),this.iconSizeData=Tp(this.zoom,t["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),a=r.get("symbol-z-order");this.canOverlap=Ln(r,"text-overlap","text-allow-overlap")!=="never"||Ln(r,"icon-overlap","icon-allow-overlap")!=="never"||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!i.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,r.get("symbol-placement")==="point"&&(this.writingModes=r.get("text-writing-mode").map(n=>M2[n])),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.sourceID=e.sourceID}createArrays(){this.text=new Du(new vi(this.layers,this.zoom,e=>e.startsWith("text"))),this.icon=new Du(new vi(this.layers,this.zoom,e=>e.startsWith("icon"))),this.glyphOffsetArray=new Uf,this.lineVertexArray=new qf,this.symbolInstances=new Nf,this.textAnchorOffsets=new Zf}calculateGlyphDependencies(e,t,r,i,a){var l;let s=(i||this.allowVerticalPlacement)&&a,n=zb.fromFeature(e,r),o=n.graphemes();for(let u=0;u<o.length;u++){let h=n.getSection(u);if("imageName"in h)continue;let c=t[l=h.fontStack]||(t[l]={}),p=o[u];wu(p)&&(c[p]=!0);for(let d of p){if(c[d]=!0,!s)continue;let f=La[d];f&&(c[f]=!0)}}}populate(e,t,r){var m;let i=this.layers[0],a=i.layout,s=a.get("text-font"),n=a.get("text-field"),o=a.get("icon-image"),l=(n.value.kind!=="constant"||n.value.value instanceof Sr&&!n.value.value.isEmpty()||n.value.value.toString().length>0)&&(s.value.kind!=="constant"||s.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=a.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,p=t.glyphDependencies,d=t.availableImages,f=new Ae(this.zoom);for(let{feature:g,id:_,index:y,sourceLayerIndex:x}of e){let v=i._featureFilter.needGeometry,w=Ei(g,v);if(!i._featureFilter.filter(f,w,r))continue;v||(w.geometry=Ai(g));let b;if(l){let F=i.getValueAndResolveTokens("text-field",w,r,d),k=Sr.factory(F);this.hasRTLText||(this.hasRTLText=Hb(k)),(!this.hasRTLText||sa.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&sa.isParsed())&&(b=Eb(k,i,w))}let A;if(u){let F=i.getValueAndResolveTokens("icon-image",w,r,d);A=F instanceof hr?F:hr.fromString(F)}if(!b&&!A)continue;let C=this.sortFeaturesByKey?h.evaluate(w,{},r):void 0,E={id:_,text:b,icon:A,index:y,sourceLayerIndex:x,geometry:w.geometry,properties:g.properties,type:ws.types[g.type],sortKey:C};if(this.features.push(E),A&&(c[A.name]=!0),b){let F=s.evaluate(w,{},r).join(","),k=a.get("text-rotation-alignment")!=="viewport"&&a.get("symbol-placement")!=="point";this.allowVerticalPlacement=(m=this.writingModes)==null?void 0:m.includes(2);let B=By(b.toString());this.calculateGlyphDependencies(b,p,F,k,B);for(let I of b.sections)I.image&&(c[I.image.name]=!0)}}a.get("symbol-placement")==="line"&&(this.features=Sb(this.features)),this.sortFeaturesByKey&&this.features.sort((g,_)=>g.sortKey-_.sortKey)}update(e,t,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let r=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(t[e.segment+1]),a=e.dist(t[e.segment]),s={};for(let n=e.segment+1;n<t.length;n++)s[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:i},n<t.length-1&&(i+=t[n+1].dist(t[n]));for(let n=e.segment||0;n>=0;n--)s[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:a},n>0&&(a+=t[n-1].dist(t[n]));for(let n=0;n<t.length;n++){let o=s[n];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,i,a,s,n,o,l,u,h,c,p){let d=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*t.length,f,d,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&n===2?Math.PI/2:0,x=s.text&&s.text.sections;for(let v=0;v<t.length;v++){let{tl:w,tr:b,bl:A,br:C,tex:E,pixelOffsetTL:F,pixelOffsetBR:k,minFontScaleX:B,minFontScaleY:I,glyphOffset:D,isSDF:T,sectionIndex:S}=t[v],j=m.vertexLength,N=D[1];js(f,o.x,o.y,w.x,N+w.y,E.x,E.y,r,T,F.x,F.y,B,I,p),js(f,o.x,o.y,b.x,N+b.y,E.x+E.w,E.y,r,T,k.x,F.y,B,I,p),js(f,o.x,o.y,A.x,N+A.y,E.x,E.y+E.h,r,T,F.x,k.y,B,I,p),js(f,o.x,o.y,C.x,N+C.y,E.x+E.w,E.y+E.h,r,T,k.x,k.y,B,I,p),hs(e.dynamicLayoutVertexArray,o,y),d.emplaceBack(j,j+2,j+1),d.emplaceBack(j+1,j+2,j+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),(v===t.length-1||S!==t[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(f.length,s,s.index,{imagePositions:{},canonical:c,formattedSection:x==null?void 0:x[S]})}e.placedSymbolArray.emplaceBack(o.x,o.y,g,this.glyphOffsetArray.length-g,_,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],n,0,!1,0,h,p)}_addCollisionDebugVertex(e,t,r,i,a,s){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,i,a,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(e,t,r,i,a,s,n){let o=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=o.vertexLength,u=a.layoutVertexArray,h=a.collisionVertexArray,c=n.anchorX,p=n.anchorY;this._addCollisionDebugVertex(u,h,s,c,p,new M(e,t)),this._addCollisionDebugVertex(u,h,s,c,p,new M(r,t)),this._addCollisionDebugVertex(u,h,s,c,p,new M(r,i)),this._addCollisionDebugVertex(u,h,s,c,p,new M(e,i)),o.vertexLength+=4;let d=a.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,i){for(let a=e;a<t;a++){let s=this.collisionBoxArray.get(a),n=s.x1,o=s.y1,l=s.x2,u=s.y2;this.addCollisionDebugVertices(n,o,l,u,i?this.textCollisionBox:this.iconCollisionBox,s.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Au(Hc,pp.members,nu),this.iconCollisionBox=new Au(Hc,pp.members,nu);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,r,i,a,s,n,o,l){let u={};for(let h=t;h<r;h++){let c=e.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=i;h<a;h++){let c=e.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=s;h<n;h++){let c=e.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=o;h<l;h++){let c=e.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+r.numGlyphs*4;for(let a=r.vertexStartIndex;a<i;a+=4)e.indexArray.emplaceBack(a,a+2,a+1),e.indexArray.emplaceBack(a+1,a+2,a+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),r=Math.cos(e),i=[],a=[],s=[];for(let n=0;n<this.symbolInstances.length;++n){s.push(n);let o=this.symbolInstances.get(n);i.push(Math.round(t*o.anchorX+r*o.anchorY)|0),a.push(o.featureIndex)}return s.sort((n,o)=>i[n]-i[o]||a[o]-a[n]),s}addToSortKeyRanges(e,t){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];(r==null?void 0:r.sortKey)===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let r=this.symbolInstances.get(t);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let a=0;a<i.length;a++){let s=i[a];s>=0&&i.indexOf(s)===a&&this.addIndicesForPlacedSymbol(this.text,s)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};V("SymbolBucket",Zi,{omit:["layers","collisionBoxArray","features","compareText"]}),Zi.MAX_GLYPHS=65535,Zi.addDynamicAttributes=hs;function Xb(e,t){return t.replace(/{([^{}]+)}/g,(r,i)=>e&&i in e?String(e[i]):"")}let Yb;const Kb=()=>Yb||(Yb=new it({"symbol-placement":new O(P.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new O(P.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new O(P.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new Z(P.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new O(P.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new O(P.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new O(P.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new O(P.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new O(P.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new Z(P.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new Z(P.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new O(P.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new O(P.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new Z(P.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new Z(P.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new Z(P.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new O(P.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new Z(P.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new Z(P.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new O(P.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new O(P.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new O(P.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new Z(P.layout_symbol["text-field"],"text-field"),"text-font":new Z(P.layout_symbol["text-font"],"text-font"),"text-size":new Z(P.layout_symbol["text-size"],"text-size"),"text-max-width":new Z(P.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new O(P.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new Z(P.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new Z(P.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new Z(P.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new O(P.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new Z(P.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new Z(P.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new O(P.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new O(P.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new Z(P.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new O(P.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new O(P.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new Z(P.layout_symbol["text-transform"],"text-transform"),"text-offset":new Z(P.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new O(P.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new O(P.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new O(P.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new O(P.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new Z(P.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new O(P.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")}));let Jb;const Qb=()=>Jb||(Jb=new it({"icon-opacity":new Z(P.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new Z(P.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new Z(P.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new Z(P.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new Z(P.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new O(P.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new O(P.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new Z(P.paint_symbol["text-opacity"],"text-opacity"),"text-color":new Z(P.paint_symbol["text-color"],"text-color",{runtimeType:Ht,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Z(P.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new Z(P.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new Z(P.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new O(P.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new O(P.paint_symbol["text-translate-anchor"],"text-translate-anchor")}));var Ho={get paint(){return Qb()},get layout(){return Kb()}},z2=class{constructor(e){if(e.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:fs,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t!=null&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};V("FormatSectionOverride",z2,{omit:["defaultValue"]});const k2=e=>e.type==="symbol";var e3=class Eu extends Kt{constructor(t,r){super(t,Ho,r)}recalculate(t,r){super.recalculate(t,r);let i=this.layout.get("icon-rotation-alignment");if((i.value.kind!=="constant"||i.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new jt(i.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},i.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let a=this.layout.get("text-writing-mode");if(a){let s=[];for(let n of a)s.includes(n)||s.push(n);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,i,a){let s=this.layout.get(t).evaluate(r,{},i,a),n=this._unevaluatedLayout._values[t];return!n.isDataDriven()&&!so(n.value)&&s?Xb(r.properties,s):s}createBucket(t){return new Zi(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of Ho.paint.overridableProperties){if(!Eu.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),i=new hh(new z2(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),a=null;a=r.value.kind==="constant"||r.value.kind==="source"?new Ja("source",i):new En("composite",i,r.value.zoomStops),this.paint._values[t]=new jt(r.property,a,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:Eu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let i=t.get("text-field"),a=Ho.paint.properties[r],s=!1,n=o=>{var l;for(let u of o)if((l=a.overrides)!=null&&l.hasOverride(u)){s=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof Sr)n(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let o=u=>{if(!s)if(u instanceof ta&&$e(u.value)===ms){let h=u.value;n(h.sections)}else u instanceof w0?n(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return s}};let t3;const r3=()=>t3||(t3=new it({"background-color":new O(P.paint_background["background-color"],"background-color"),"background-pattern":new Bf(P.paint_background["background-pattern"],"background-pattern"),"background-opacity":new O(P.paint_background["background-opacity"],"background-opacity")}));var i3={get paint(){return r3()}};const a3=e=>e.type==="background";var s3=class extends Kt{constructor(e,t){super(e,i3,t)}};function n3(e){let t=[],r=e.id;return r===void 0&&t.push(new R(`layers.${r}`,null,'missing required property "id"')),e.render===void 0&&t.push(new R(`layers.${r}`,null,'missing required method "render"')),e.renderingMode&&e.renderingMode!=="2d"&&e.renderingMode!=="3d"&&t.push(new R(`layers.${r}`,null,'property "renderingMode" must be either "2d" or "3d"')),t}const o3=e=>e.type==="custom";var l3=class extends Kt{constructor(e,t){super(e,{},t),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function Xo(e,t){if(e.type==="custom")return new l3(e,t);switch(e.type){case"background":return new s3(e,t);case"circle":return new Ov(e,t);case"color-relief":return new tx(e,t);case"fill":return new Rx(e,t);case"fill-extrusion":return new ib(e,t);case"heatmap":return new qv(e,t);case"hillshade":return new Xv(e,t);case"line":return new xb(e,t);case"raster":return new Zy(e,t);case"symbol":return new e3(e,t)}}var u3=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)==null||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};const h3={once:!0};var c3=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new u3(()=>this.process()),this.subscription=Tl(this.target,"message",r=>this.receive(r),!1),this.globalScope=Ji(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((r,i)=>{let a=Math.round(Math.random()*1e18).toString(36).substring(0,10),s=t?Tl(t.signal,"abort",()=>{s==null||s.unsubscribe(),delete this.resolveRejects[a];let l={id:a,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new ps(t.signal.reason))},h3):null;this.resolveRejects[a]={resolve:l=>{s==null||s.unsubscribe(),r(l)},reject:l=>{s==null||s.unsubscribe(),i(l)}};let n=[],o={...e,id:a,sourceMapId:this.mapId,origin:location.origin,data:ja(e.data,n)};this.target.postMessage(o,{transfer:n})})}receive(e){let t=e.data,r=t.id,i=["file://","resource://android","null"],a=[t.origin,location.origin],s=t.origin===location.origin,n=a.some(o=>i.includes(o));if(!(!s&&!n)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(Ji(self)||t.mustQueue){this.tasks[r]=t,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let a=this.resolveRejects[e];if(delete this.resolveRejects[e],!a)return;t.error?a.reject(ht(Na(t.error))):a.resolve(Na(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,null,null);return}let r=Na(t.data),i=new AbortController;this.abortControllers[e]=i;try{let a=await this.messageHandlers[t.type](t.sourceMapId,r,i);this.completeTask(e,null,a)}catch(a){this.completeTask(e,ht(a))}}completeTask(e,t,r){let i=[];delete this.abortControllers[e];let a={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?ja(t):null,data:ja(r,i)};this.target.postMessage(a,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function p3(e,t,r){return!(e<0||e>25||r<0||r>=2**e||t<0||t>=2**e)}function Dp(e,t){let{x:r,y:i}=de.fromLngLat(t);return!(e<0||e>25||i<0||i>=1||r<0||r>=1)}var _o=class{constructor(e,t,r){if(!p3(e,t,r))throw Error(`x=${t}, y=${r}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=r,this.key=Wi(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){let i=d3(this.x,this.y,this.z),a=f3(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,a).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new M((e.x*t-this.x)*z,(e.y*t-this.y)*z)}toString(){return`${this.z}/${this.x}/${this.y}`}},$n=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Wi(e,t.z,t.z,t.x,t.y)}},st=class Rt{constructor(t,r,i,a,s){if(this.terrainRttPosMatrix32f=null,t<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=r,this.canonical=new _o(i,+a,+s),this.key=Wi(r,t,i,a,s)}clone(){return new Rt(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new Rt(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Rt(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,r){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?Wi(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Wi(this.wrap*+r,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-t.canonical.z;return r<0?!1:t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Rt(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,a=this.canonical.y*2;return[new Rt(r,this.wrap,r,i,a),new Rt(r,this.wrap,r,i+1,a),new Rt(r,this.wrap,r,i,a+1),new Rt(r,this.wrap,r,i+1,a+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new Rt(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Rt(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new $n(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new de(t.x-this.wrap,t.y))}normalizeCoordinates(t,r,i=z){if(t>=0&&t<i&&r>=0&&r<i)return{tileID:this,x:t,y:r};let a=Math.floor(t/i),s=Math.floor(r/i),n=t-a*i,o=r-s*i,l=this.canonical.z,u=1<<l,h=this.canonical.y+s;if(h<0||h>=u)return null;let c=this.canonical.x+a,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new Rt(this.overscaledZ,p,l,c,h),x:n,y:o}}};function Wi(e,t,r,i,a){e*=2,e<0&&(e=e*-1-1);let s=1<<r;return(s*s*e+s*a+i).toString(36)+r.toString(36)+t.toString(36)}const Yo=Math.PI*6378137;function d3(e,t,r){t=2**r-t-1;let i=Ap(e*256,t*256,r),a=Ap((e+1)*256,(t+1)*256,r);return`${i[0]},${i[1]},${a[0]},${a[1]}`}function Ap(e,t,r){let i=2*Yo/256/2**r;return[e*i-Yo,t*i-Yo]}function f3(e,t,r){let i="";for(let a=e;a>0;a--){let s=1<<a-1;i+=(t&s?1:0)+(r&s?2:0)}return i}function Ep(e,t){let r=Math.abs(e.wrap*2)-+(e.wrap<0),i=Math.abs(t.wrap*2)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}V("CanonicalTileID",_o),V("OverscaledTileID",st,{omit:["terrainRttPosMatrix32f"]});const pn="_geojsonTileLayer";var m3=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},R2=class{constructor(e,t,r,i,a){this.type="Feature",this._vectorTileFeature=e,this._x=r,this._y=i,this._z=t;for(let s in e.properties)typeof e.properties[s]!="string"||!e.properties[s].startsWith("__$json__:")||(e.properties[s]=JSON.parse(e.properties[s].slice(10)));this.properties=e.properties,this.id=a}projectPoint(e,t,r,i){return[(e.x+t)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(e.y+r)*2/i)*Math.PI))-90]}projectLine(e,t,r,i){return e.map(a=>this.projectPoint(a,t,r,i))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,r=e.extent*this._x,i=e.extent*this._y,a=e.loadGeometry();switch(e.type){case 1:{let s=[];for(let o of a)s.push(o[0]);let n=this.projectLine(s,r,i,t);this._geometry=s.length===1?{type:"Point",coordinates:n[0]}:{type:"MultiPoint",coordinates:n};break}case 2:{let s=a.map(n=>this.projectLine(n,r,i,t));this._geometry=s.length===1?{type:"LineString",coordinates:s[0]}:{type:"MultiLineString",coordinates:s};break}case 3:{let s=g2(a),n=[];for(let o of s)n.push(o.map(l=>this.projectLine(l,r,i,t)));this._geometry=n.length===1?{type:"Polygon",coordinates:n[0]}:{type:"MultiPolygon",coordinates:n};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!=="_geometry"&&t!=="_vectorTileFeature"&&t!=="_x"&&t!=="_y"&&t!=="_z"&&(e[t]=this[t]);return e}},Si=class{constructor(e,t,r){this._name=e,this.dataBuffer=t,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){var t;return((t=this.nullabilityBuffer)==null?void 0:t.get(e))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},yo=class extends Si{},Ph=class extends yo{getValueFromBuffer(e){return this.dataBuffer[e]}},Ih=class extends yo{getValueFromBuffer(e){return this.dataBuffer[e]}},B2=class extends Si{constructor(e,t,r,i){super(e,t,i),this.delta=r}},Mh=class extends B2{constructor(e,t,r,i,a){super(e,a?Int32Array.of(t):Uint32Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}},Fh=class extends Si{constructor(e,t,r,i){super(e,i?Int32Array.of(t):Uint32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},g3=class{constructor(e,t,r,i,a=4096){if(this._name=e,this._geometryVector=t,this._idVector=r,this._propertyVectors=i,this._extent=a,e.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;if(this.idVector){let n=this.idVector.getValue(r);n!==null&&(i=this.containsMaxSafeIntegerValues(this.idVector)?Number(n):n)}let a={coordinates:t[r],type:this.geometryVector.geometryType(r)},s={};for(let n of this.propertyVectors){if(!n)continue;let o=n.name,l=n.getValue(r);l!==null&&(s[o]=l)}e.push({id:i,geometry:a,properties:s})}return e}containsMaxSafeIntegerValues(e){return e instanceof Ph||e instanceof Fh||e instanceof Mh||e instanceof Ih}};const $a={FEATURE:0},oe={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},Vr={GEOMETRY:0,STRUCT:1,MAP:2},L2={ID:0};var $2=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}},ee;(function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON",e.PDE="PDE"})(ee||(ee={}));var qt;(function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT"})(qt||(qt={}));const zh=new Uint32Array(33);zh[0]=0;for(let e=1;e<=32;e++)zh[e]=e===32?4294967295:4294967295>>>32-e;const Su=zh,O2=65536;function kh(e,t){return e-e%t}function _3(e){return kh(e+31,32)}function y3(e){if(!Number.isFinite(e)||e<=0)return O2;let t=kh(Math.floor(e),256);return t===0?256:t}function v3(e){let t=e>>>0;return((t&255)<<24|(t&65280)<<8|t>>>8&65280|t>>>24&255)>>>0}function x3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0;r[a++]=s>>>0&3,r[a++]=s>>>2&3,r[a++]=s>>>4&3,r[a++]=s>>>6&3,r[a++]=s>>>8&3,r[a++]=s>>>10&3,r[a++]=s>>>12&3,r[a++]=s>>>14&3,r[a++]=s>>>16&3,r[a++]=s>>>18&3,r[a++]=s>>>20&3,r[a++]=s>>>22&3,r[a++]=s>>>24&3,r[a++]=s>>>26&3,r[a++]=s>>>28&3,r[a++]=s>>>30&3,r[a++]=n>>>0&3,r[a++]=n>>>2&3,r[a++]=n>>>4&3,r[a++]=n>>>6&3,r[a++]=n>>>8&3,r[a++]=n>>>10&3,r[a++]=n>>>12&3,r[a++]=n>>>14&3,r[a++]=n>>>16&3,r[a++]=n>>>18&3,r[a++]=n>>>20&3,r[a++]=n>>>22&3,r[a++]=n>>>24&3,r[a++]=n>>>26&3,r[a++]=n>>>28&3,r[a]=n>>>30&3}function b3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0;r[a++]=s>>>0&7,r[a++]=s>>>3&7,r[a++]=s>>>6&7,r[a++]=s>>>9&7,r[a++]=s>>>12&7,r[a++]=s>>>15&7,r[a++]=s>>>18&7,r[a++]=s>>>21&7,r[a++]=s>>>24&7,r[a++]=s>>>27&7,r[a++]=(s>>>30|(n&1)<<2)&7,r[a++]=n>>>1&7,r[a++]=n>>>4&7,r[a++]=n>>>7&7,r[a++]=n>>>10&7,r[a++]=n>>>13&7,r[a++]=n>>>16&7,r[a++]=n>>>19&7,r[a++]=n>>>22&7,r[a++]=n>>>25&7,r[a++]=n>>>28&7,r[a++]=(n>>>31|(o&3)<<1)&7,r[a++]=o>>>2&7,r[a++]=o>>>5&7,r[a++]=o>>>8&7,r[a++]=o>>>11&7,r[a++]=o>>>14&7,r[a++]=o>>>17&7,r[a++]=o>>>20&7,r[a++]=o>>>23&7,r[a++]=o>>>26&7,r[a]=o>>>29&7}function w3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0;r[a++]=s>>>0&15,r[a++]=s>>>4&15,r[a++]=s>>>8&15,r[a++]=s>>>12&15,r[a++]=s>>>16&15,r[a++]=s>>>20&15,r[a++]=s>>>24&15,r[a++]=s>>>28&15,r[a++]=n>>>0&15,r[a++]=n>>>4&15,r[a++]=n>>>8&15,r[a++]=n>>>12&15,r[a++]=n>>>16&15,r[a++]=n>>>20&15,r[a++]=n>>>24&15,r[a++]=n>>>28&15,r[a++]=o>>>0&15,r[a++]=o>>>4&15,r[a++]=o>>>8&15,r[a++]=o>>>12&15,r[a++]=o>>>16&15,r[a++]=o>>>20&15,r[a++]=o>>>24&15,r[a++]=o>>>28&15,r[a++]=l>>>0&15,r[a++]=l>>>4&15,r[a++]=l>>>8&15,r[a++]=l>>>12&15,r[a++]=l>>>16&15,r[a++]=l>>>20&15,r[a++]=l>>>24&15,r[a]=l>>>28&15}function T3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0;r[a++]=s>>>0&31,r[a++]=s>>>5&31,r[a++]=s>>>10&31,r[a++]=s>>>15&31,r[a++]=s>>>20&31,r[a++]=s>>>25&31,r[a++]=(s>>>30|(n&7)<<2)&31,r[a++]=n>>>3&31,r[a++]=n>>>8&31,r[a++]=n>>>13&31,r[a++]=n>>>18&31,r[a++]=n>>>23&31,r[a++]=(n>>>28|(o&1)<<4)&31,r[a++]=o>>>1&31,r[a++]=o>>>6&31,r[a++]=o>>>11&31,r[a++]=o>>>16&31,r[a++]=o>>>21&31,r[a++]=o>>>26&31,r[a++]=(o>>>31|(l&15)<<1)&31,r[a++]=l>>>4&31,r[a++]=l>>>9&31,r[a++]=l>>>14&31,r[a++]=l>>>19&31,r[a++]=l>>>24&31,r[a++]=(l>>>29|(u&3)<<3)&31,r[a++]=u>>>2&31,r[a++]=u>>>7&31,r[a++]=u>>>12&31,r[a++]=u>>>17&31,r[a++]=u>>>22&31,r[a]=u>>>27&31}function D3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0;r[a++]=s>>>0&63,r[a++]=s>>>6&63,r[a++]=s>>>12&63,r[a++]=s>>>18&63,r[a++]=s>>>24&63,r[a++]=(s>>>30|(n&15)<<2)&63,r[a++]=n>>>4&63,r[a++]=n>>>10&63,r[a++]=n>>>16&63,r[a++]=n>>>22&63,r[a++]=(n>>>28|(o&3)<<4)&63,r[a++]=o>>>2&63,r[a++]=o>>>8&63,r[a++]=o>>>14&63,r[a++]=o>>>20&63,r[a++]=o>>>26&63,r[a++]=l>>>0&63,r[a++]=l>>>6&63,r[a++]=l>>>12&63,r[a++]=l>>>18&63,r[a++]=l>>>24&63,r[a++]=(l>>>30|(u&15)<<2)&63,r[a++]=u>>>4&63,r[a++]=u>>>10&63,r[a++]=u>>>16&63,r[a++]=u>>>22&63,r[a++]=(u>>>28|(h&3)<<4)&63,r[a++]=h>>>2&63,r[a++]=h>>>8&63,r[a++]=h>>>14&63,r[a++]=h>>>20&63,r[a]=h>>>26&63}function A3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0;r[a++]=s>>>0&127,r[a++]=s>>>7&127,r[a++]=s>>>14&127,r[a++]=s>>>21&127,r[a++]=(s>>>28|(n&7)<<4)&127,r[a++]=n>>>3&127,r[a++]=n>>>10&127,r[a++]=n>>>17&127,r[a++]=n>>>24&127,r[a++]=(n>>>31|(o&63)<<1)&127,r[a++]=o>>>6&127,r[a++]=o>>>13&127,r[a++]=o>>>20&127,r[a++]=(o>>>27|(l&3)<<5)&127,r[a++]=l>>>2&127,r[a++]=l>>>9&127,r[a++]=l>>>16&127,r[a++]=l>>>23&127,r[a++]=(l>>>30|(u&31)<<2)&127,r[a++]=u>>>5&127,r[a++]=u>>>12&127,r[a++]=u>>>19&127,r[a++]=(u>>>26|(h&1)<<6)&127,r[a++]=h>>>1&127,r[a++]=h>>>8&127,r[a++]=h>>>15&127,r[a++]=h>>>22&127,r[a++]=(h>>>29|(c&15)<<3)&127,r[a++]=c>>>4&127,r[a++]=c>>>11&127,r[a++]=c>>>18&127,r[a]=c>>>25&127}function E3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0;r[a++]=s>>>0&255,r[a++]=s>>>8&255,r[a++]=s>>>16&255,r[a++]=s>>>24&255,r[a++]=n>>>0&255,r[a++]=n>>>8&255,r[a++]=n>>>16&255,r[a++]=n>>>24&255,r[a++]=o>>>0&255,r[a++]=o>>>8&255,r[a++]=o>>>16&255,r[a++]=o>>>24&255,r[a++]=l>>>0&255,r[a++]=l>>>8&255,r[a++]=l>>>16&255,r[a++]=l>>>24&255,r[a++]=u>>>0&255,r[a++]=u>>>8&255,r[a++]=u>>>16&255,r[a++]=u>>>24&255,r[a++]=h>>>0&255,r[a++]=h>>>8&255,r[a++]=h>>>16&255,r[a++]=h>>>24&255,r[a++]=c>>>0&255,r[a++]=c>>>8&255,r[a++]=c>>>16&255,r[a++]=c>>>24&255,r[a++]=p>>>0&255,r[a++]=p>>>8&255,r[a++]=p>>>16&255,r[a]=p>>>24&255}function S3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0;r[a++]=s>>>0&511,r[a++]=s>>>9&511,r[a++]=s>>>18&511,r[a++]=(s>>>27|(n&15)<<5)&511,r[a++]=n>>>4&511,r[a++]=n>>>13&511,r[a++]=n>>>22&511,r[a++]=(n>>>31|(o&255)<<1)&511,r[a++]=o>>>8&511,r[a++]=o>>>17&511,r[a++]=(o>>>26|(l&7)<<6)&511,r[a++]=l>>>3&511,r[a++]=l>>>12&511,r[a++]=l>>>21&511,r[a++]=(l>>>30|(u&127)<<2)&511,r[a++]=u>>>7&511,r[a++]=u>>>16&511,r[a++]=(u>>>25|(h&3)<<7)&511,r[a++]=h>>>2&511,r[a++]=h>>>11&511,r[a++]=h>>>20&511,r[a++]=(h>>>29|(c&63)<<3)&511,r[a++]=c>>>6&511,r[a++]=c>>>15&511,r[a++]=(c>>>24|(p&1)<<8)&511,r[a++]=p>>>1&511,r[a++]=p>>>10&511,r[a++]=p>>>19&511,r[a++]=(p>>>28|(d&31)<<4)&511,r[a++]=d>>>5&511,r[a++]=d>>>14&511,r[a]=d>>>23&511}function C3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0,f=e[t+9]>>>0;r[a++]=s>>>0&1023,r[a++]=s>>>10&1023,r[a++]=s>>>20&1023,r[a++]=(s>>>30|(n&255)<<2)&1023,r[a++]=n>>>8&1023,r[a++]=n>>>18&1023,r[a++]=(n>>>28|(o&63)<<4)&1023,r[a++]=o>>>6&1023,r[a++]=o>>>16&1023,r[a++]=(o>>>26|(l&15)<<6)&1023,r[a++]=l>>>4&1023,r[a++]=l>>>14&1023,r[a++]=(l>>>24|(u&3)<<8)&1023,r[a++]=u>>>2&1023,r[a++]=u>>>12&1023,r[a++]=u>>>22&1023,r[a++]=h>>>0&1023,r[a++]=h>>>10&1023,r[a++]=h>>>20&1023,r[a++]=(h>>>30|(c&255)<<2)&1023,r[a++]=c>>>8&1023,r[a++]=c>>>18&1023,r[a++]=(c>>>28|(p&63)<<4)&1023,r[a++]=p>>>6&1023,r[a++]=p>>>16&1023,r[a++]=(p>>>26|(d&15)<<6)&1023,r[a++]=d>>>4&1023,r[a++]=d>>>14&1023,r[a++]=(d>>>24|(f&3)<<8)&1023,r[a++]=f>>>2&1023,r[a++]=f>>>12&1023,r[a]=f>>>22&1023}function P3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0;r[a++]=s>>>0&2047,r[a++]=s>>>11&2047,r[a++]=(s>>>22|(n&1)<<10)&2047,r[a++]=n>>>1&2047,r[a++]=n>>>12&2047,r[a++]=(n>>>23|(o&3)<<9)&2047,r[a++]=o>>>2&2047,r[a++]=o>>>13&2047,r[a++]=(o>>>24|(l&7)<<8)&2047,r[a++]=l>>>3&2047,r[a++]=l>>>14&2047,r[a++]=(l>>>25|(u&15)<<7)&2047,r[a++]=u>>>4&2047,r[a++]=u>>>15&2047,r[a++]=(u>>>26|(h&31)<<6)&2047,r[a++]=h>>>5&2047,r[a++]=h>>>16&2047,r[a++]=(h>>>27|(c&63)<<5)&2047,r[a++]=c>>>6&2047,r[a++]=c>>>17&2047,r[a++]=(c>>>28|(p&127)<<4)&2047,r[a++]=p>>>7&2047,r[a++]=p>>>18&2047,r[a++]=(p>>>29|(d&255)<<3)&2047,r[a++]=d>>>8&2047,r[a++]=d>>>19&2047,r[a++]=(d>>>30|(f&511)<<2)&2047,r[a++]=f>>>9&2047,r[a++]=f>>>20&2047,r[a++]=(f>>>31|(m&1023)<<1)&2047,r[a++]=m>>>10&2047,r[a]=m>>>21&2047}function I3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0;r[a++]=s>>>0&4095,r[a++]=s>>>12&4095,r[a++]=(s>>>24|(n&15)<<8)&4095,r[a++]=n>>>4&4095,r[a++]=n>>>16&4095,r[a++]=(n>>>28|(o&255)<<4)&4095,r[a++]=o>>>8&4095,r[a++]=o>>>20&4095,r[a++]=l>>>0&4095,r[a++]=l>>>12&4095,r[a++]=(l>>>24|(u&15)<<8)&4095,r[a++]=u>>>4&4095,r[a++]=u>>>16&4095,r[a++]=(u>>>28|(h&255)<<4)&4095,r[a++]=h>>>8&4095,r[a++]=h>>>20&4095,r[a++]=c>>>0&4095,r[a++]=c>>>12&4095,r[a++]=(c>>>24|(p&15)<<8)&4095,r[a++]=p>>>4&4095,r[a++]=p>>>16&4095,r[a++]=(p>>>28|(d&255)<<4)&4095,r[a++]=d>>>8&4095,r[a++]=d>>>20&4095,r[a++]=f>>>0&4095,r[a++]=f>>>12&4095,r[a++]=(f>>>24|(m&15)<<8)&4095,r[a++]=m>>>4&4095,r[a++]=m>>>16&4095,r[a++]=(m>>>28|(g&255)<<4)&4095,r[a++]=g>>>8&4095,r[a]=g>>>20&4095}function M3(e,t,r,i){let a=i,s=e[t]>>>0,n=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0,_=e[t+12]>>>0,y=e[t+13]>>>0,x=e[t+14]>>>0,v=e[t+15]>>>0;r[a++]=s>>>0&65535,r[a++]=s>>>16&65535,r[a++]=n>>>0&65535,r[a++]=n>>>16&65535,r[a++]=o>>>0&65535,r[a++]=o>>>16&65535,r[a++]=l>>>0&65535,r[a++]=l>>>16&65535,r[a++]=u>>>0&65535,r[a++]=u>>>16&65535,r[a++]=h>>>0&65535,r[a++]=h>>>16&65535,r[a++]=c>>>0&65535,r[a++]=c>>>16&65535,r[a++]=p>>>0&65535,r[a++]=p>>>16&65535,r[a++]=d>>>0&65535,r[a++]=d>>>16&65535,r[a++]=f>>>0&65535,r[a++]=f>>>16&65535,r[a++]=m>>>0&65535,r[a++]=m>>>16&65535,r[a++]=g>>>0&65535,r[a++]=g>>>16&65535,r[a++]=_>>>0&65535,r[a++]=_>>>16&65535,r[a++]=y>>>0&65535,r[a++]=y>>>16&65535,r[a++]=x>>>0&65535,r[a++]=x>>>16&65535,r[a++]=v>>>0&65535,r[a]=v>>>16&65535}function F3(e,t,r,i){let a=i,s=t;for(let n=0;n<8;n++){let o=e[s++]>>>0;r[a++]=o>>>0&1,r[a++]=o>>>1&1,r[a++]=o>>>2&1,r[a++]=o>>>3&1,r[a++]=o>>>4&1,r[a++]=o>>>5&1,r[a++]=o>>>6&1,r[a++]=o>>>7&1,r[a++]=o>>>8&1,r[a++]=o>>>9&1,r[a++]=o>>>10&1,r[a++]=o>>>11&1,r[a++]=o>>>12&1,r[a++]=o>>>13&1,r[a++]=o>>>14&1,r[a++]=o>>>15&1,r[a++]=o>>>16&1,r[a++]=o>>>17&1,r[a++]=o>>>18&1,r[a++]=o>>>19&1,r[a++]=o>>>20&1,r[a++]=o>>>21&1,r[a++]=o>>>22&1,r[a++]=o>>>23&1,r[a++]=o>>>24&1,r[a++]=o>>>25&1,r[a++]=o>>>26&1,r[a++]=o>>>27&1,r[a++]=o>>>28&1,r[a++]=o>>>29&1,r[a++]=o>>>30&1,r[a++]=o>>>31&1}}function z3(e,t,r,i){let a=i,s=t;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0;r[a++]=o>>>0&3,r[a++]=o>>>2&3,r[a++]=o>>>4&3,r[a++]=o>>>6&3,r[a++]=o>>>8&3,r[a++]=o>>>10&3,r[a++]=o>>>12&3,r[a++]=o>>>14&3,r[a++]=o>>>16&3,r[a++]=o>>>18&3,r[a++]=o>>>20&3,r[a++]=o>>>22&3,r[a++]=o>>>24&3,r[a++]=o>>>26&3,r[a++]=o>>>28&3,r[a++]=o>>>30&3,r[a++]=l>>>0&3,r[a++]=l>>>2&3,r[a++]=l>>>4&3,r[a++]=l>>>6&3,r[a++]=l>>>8&3,r[a++]=l>>>10&3,r[a++]=l>>>12&3,r[a++]=l>>>14&3,r[a++]=l>>>16&3,r[a++]=l>>>18&3,r[a++]=l>>>20&3,r[a++]=l>>>22&3,r[a++]=l>>>24&3,r[a++]=l>>>26&3,r[a++]=l>>>28&3,r[a++]=l>>>30&3}}function k3(e,t,r,i){let a=i,s=t;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0;r[a++]=o>>>0&7,r[a++]=o>>>3&7,r[a++]=o>>>6&7,r[a++]=o>>>9&7,r[a++]=o>>>12&7,r[a++]=o>>>15&7,r[a++]=o>>>18&7,r[a++]=o>>>21&7,r[a++]=o>>>24&7,r[a++]=o>>>27&7,r[a++]=(o>>>30|(l&1)<<2)&7,r[a++]=l>>>1&7,r[a++]=l>>>4&7,r[a++]=l>>>7&7,r[a++]=l>>>10&7,r[a++]=l>>>13&7,r[a++]=l>>>16&7,r[a++]=l>>>19&7,r[a++]=l>>>22&7,r[a++]=l>>>25&7,r[a++]=l>>>28&7,r[a++]=(l>>>31|(u&3)<<1)&7,r[a++]=u>>>2&7,r[a++]=u>>>5&7,r[a++]=u>>>8&7,r[a++]=u>>>11&7,r[a++]=u>>>14&7,r[a++]=u>>>17&7,r[a++]=u>>>20&7,r[a++]=u>>>23&7,r[a++]=u>>>26&7,r[a++]=u>>>29&7}}function R3(e,t,r,i){let a=i,s=t;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0;r[a++]=o>>>0&15,r[a++]=o>>>4&15,r[a++]=o>>>8&15,r[a++]=o>>>12&15,r[a++]=o>>>16&15,r[a++]=o>>>20&15,r[a++]=o>>>24&15,r[a++]=o>>>28&15,r[a++]=l>>>0&15,r[a++]=l>>>4&15,r[a++]=l>>>8&15,r[a++]=l>>>12&15,r[a++]=l>>>16&15,r[a++]=l>>>20&15,r[a++]=l>>>24&15,r[a++]=l>>>28&15,r[a++]=u>>>0&15,r[a++]=u>>>4&15,r[a++]=u>>>8&15,r[a++]=u>>>12&15,r[a++]=u>>>16&15,r[a++]=u>>>20&15,r[a++]=u>>>24&15,r[a++]=u>>>28&15,r[a++]=h>>>0&15,r[a++]=h>>>4&15,r[a++]=h>>>8&15,r[a++]=h>>>12&15,r[a++]=h>>>16&15,r[a++]=h>>>20&15,r[a++]=h>>>24&15,r[a++]=h>>>28&15}}function B3(e,t,r,i){let a=i,s=t;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0,c=e[s++]>>>0;r[a++]=o>>>0&31,r[a++]=o>>>5&31,r[a++]=o>>>10&31,r[a++]=o>>>15&31,r[a++]=o>>>20&31,r[a++]=o>>>25&31,r[a++]=(o>>>30|(l&7)<<2)&31,r[a++]=l>>>3&31,r[a++]=l>>>8&31,r[a++]=l>>>13&31,r[a++]=l>>>18&31,r[a++]=l>>>23&31,r[a++]=(l>>>28|(u&1)<<4)&31,r[a++]=u>>>1&31,r[a++]=u>>>6&31,r[a++]=u>>>11&31,r[a++]=u>>>16&31,r[a++]=u>>>21&31,r[a++]=u>>>26&31,r[a++]=(u>>>31|(h&15)<<1)&31,r[a++]=h>>>4&31,r[a++]=h>>>9&31,r[a++]=h>>>14&31,r[a++]=h>>>19&31,r[a++]=h>>>24&31,r[a++]=(h>>>29|(c&3)<<3)&31,r[a++]=c>>>2&31,r[a++]=c>>>7&31,r[a++]=c>>>12&31,r[a++]=c>>>17&31,r[a++]=c>>>22&31,r[a++]=c>>>27&31}}function L3(e,t,r,i){let a=i,s=t;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0,c=e[s++]>>>0,p=e[s++]>>>0;r[a++]=o>>>0&63,r[a++]=o>>>6&63,r[a++]=o>>>12&63,r[a++]=o>>>18&63,r[a++]=o>>>24&63,r[a++]=(o>>>30|(l&15)<<2)&63,r[a++]=l>>>4&63,r[a++]=l>>>10&63,r[a++]=l>>>16&63,r[a++]=l>>>22&63,r[a++]=(l>>>28|(u&3)<<4)&63,r[a++]=u>>>2&63,r[a++]=u>>>8&63,r[a++]=u>>>14&63,r[a++]=u>>>20&63,r[a++]=u>>>26&63,r[a++]=h>>>0&63,r[a++]=h>>>6&63,r[a++]=h>>>12&63,r[a++]=h>>>18&63,r[a++]=h>>>24&63,r[a++]=(h>>>30|(c&15)<<2)&63,r[a++]=c>>>4&63,r[a++]=c>>>10&63,r[a++]=c>>>16&63,r[a++]=c>>>22&63,r[a++]=(c>>>28|(p&3)<<4)&63,r[a++]=p>>>2&63,r[a++]=p>>>8&63,r[a++]=p>>>14&63,r[a++]=p>>>20&63,r[a++]=p>>>26&63}}function $3(e,t,r,i){let a=i,s=t;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0,c=e[s++]>>>0,p=e[s++]>>>0,d=e[s++]>>>0;r[a++]=o>>>0&127,r[a++]=o>>>7&127,r[a++]=o>>>14&127,r[a++]=o>>>21&127,r[a++]=(o>>>28|(l&7)<<4)&127,r[a++]=l>>>3&127,r[a++]=l>>>10&127,r[a++]=l>>>17&127,r[a++]=l>>>24&127,r[a++]=(l>>>31|(u&63)<<1)&127,r[a++]=u>>>6&127,r[a++]=u>>>13&127,r[a++]=u>>>20&127,r[a++]=(u>>>27|(h&3)<<5)&127,r[a++]=h>>>2&127,r[a++]=h>>>9&127,r[a++]=h>>>16&127,r[a++]=h>>>23&127,r[a++]=(h>>>30|(c&31)<<2)&127,r[a++]=c>>>5&127,r[a++]=c>>>12&127,r[a++]=c>>>19&127,r[a++]=(c>>>26|(p&1)<<6)&127,r[a++]=p>>>1&127,r[a++]=p>>>8&127,r[a++]=p>>>15&127,r[a++]=p>>>22&127,r[a++]=(p>>>29|(d&15)<<3)&127,r[a++]=d>>>4&127,r[a++]=d>>>11&127,r[a++]=d>>>18&127,r[a++]=d>>>25&127}}function O3(e,t,r,i){let a=i,s=t;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0,c=e[s++]>>>0,p=e[s++]>>>0,d=e[s++]>>>0,f=e[s++]>>>0;r[a++]=o>>>0&255,r[a++]=o>>>8&255,r[a++]=o>>>16&255,r[a++]=o>>>24&255,r[a++]=l>>>0&255,r[a++]=l>>>8&255,r[a++]=l>>>16&255,r[a++]=l>>>24&255,r[a++]=u>>>0&255,r[a++]=u>>>8&255,r[a++]=u>>>16&255,r[a++]=u>>>24&255,r[a++]=h>>>0&255,r[a++]=h>>>8&255,r[a++]=h>>>16&255,r[a++]=h>>>24&255,r[a++]=c>>>0&255,r[a++]=c>>>8&255,r[a++]=c>>>16&255,r[a++]=c>>>24&255,r[a++]=p>>>0&255,r[a++]=p>>>8&255,r[a++]=p>>>16&255,r[a++]=p>>>24&255,r[a++]=d>>>0&255,r[a++]=d>>>8&255,r[a++]=d>>>16&255,r[a++]=d>>>24&255,r[a++]=f>>>0&255,r[a++]=f>>>8&255,r[a++]=f>>>16&255,r[a++]=f>>>24&255}}function V3(e,t,r,i){let a=i,s=t;for(let n=0;n<128;n++){let o=e[s++]>>>0;r[a++]=o&65535,r[a++]=o>>>16&65535}}function j3(e,t,r,i,a){let s=Su[a]>>>0,n=t,o=0,l=e[n]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+a<=32){let p=l>>>o&s;r[u+c]=p|0,o+=a,o===32&&(o=0,n++,c!==31&&(l=e[n]>>>0))}else{let p=32-o,d=l>>>o;n++,l=e[n]>>>0;let f=a-p,m=-1>>>32-f>>>0,g=(d|(l&m)<<p)&s;r[u+c]=g|0,o=f}u+=32,o=0,h<7&&(l=e[n]>>>0)}}const Cu=y3(O2),N3=3*Cu/256+Cu|0;function V2(){let e=new Uint8Array(N3);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function U3(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,e|0);return{encodedWords:new Uint32Array(t),decoderWorkspace:V2()}}function q3(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let r=new Uint32Array(Math.max(16,t*2));return e.encodedWords=r,r}function G3(e,t,r,i){i.byteContainer.length<r&&(i.byteContainer=new Uint8Array(r*2),i.byteContainerI32=void 0);let a=i.byteContainer,s=r>>>2;if(a.byteOffset&3)for(let o=0;o<s;o=o+1|0){let l=e[t+o|0]|0,u=o<<2;a[u]=l&255,a[u+1|0]=l>>>8&255,a[u+2|0]=l>>>16&255,a[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==a.buffer||o.byteOffset!==a.byteOffset||o.length<s)&&(o=i.byteContainerI32=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>>2)),o.set(e.subarray(t,t+s))}let n=r&3;if(n>0){let o=e[t+s|0]|0,l=s<<2;for(let u=0;u<n;u=u+1|0)a[l+u|0]=o>>>(u<<3)&255}return a}function Z3(e,t,r){let i=e[t++]|0,a=r.dataToBePacked;for(let s=2;s<=32;s=s+1|0){if(!(i>>>s-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${s}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let n=e[t++]>>>0,o=_3(n),l=n*s+31>>>5;if(t+l>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${s}, size=${n}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let u=a[s];(!u||u.length<o)&&(u=a[s]=new Uint32Array(o));let h=0;for(;h<n;h=h+32|0)rw(e,t,u,h,s),t=t+s|0;let c=h-n|0;t=t-(c*s>>>5)|0,r.exceptionSizes[s]=n}return t}function W3(e,t,r,i,a){switch(a){case 1:F3(e,t,r,i);break;case 2:z3(e,t,r,i);break;case 3:k3(e,t,r,i);break;case 4:R3(e,t,r,i);break;case 5:B3(e,t,r,i);break;case 6:L3(e,t,r,i);break;case 7:$3(e,t,r,i);break;case 8:O3(e,t,r,i);break;case 16:V3(e,t,r,i);break;default:j3(e,t,r,i,a)}return t+(a<<3)|0}function H3(e,t,r,i){if(r+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${t})`);let a=e[r++],s=e[r++];if(a>32)throw Error(`FastPFOR decode: invalid bitWidth=${a} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:s,bytePosIn:r}}function X3(e,t,r,i,a,s){if(r+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${s} (need 1 byte for maxBits, bytePos=${r}, byteSize=${t})`);let n=e[r++];if(n<i||n>32)throw Error(`FastPFOR decode: invalid maxBits=${n} at block=${s} (bitWidth=${i}, expected ${i}..32)`);let o=n-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${s} (bitWidth=${i}, maxBits=${n})`);if(r+a>t)throw Error(`FastPFOR decode: exception positions underflow at block=${s} (need=${a}, have=${t-r})`);return{maxBits:n,exceptionBitWidth:o,bytePosIn:r}}function Y3(e,t,r,i,a,s,n,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=X3(a,s,n,r,i,l);if(n=c,h===1){let g=1<<r;for(let _=0;_<i;_=_+1|0){let y=a[n++];e[y+t|0]|=g}return n}let p=o.dataToBePacked[h];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let d=o.dataPointers,f=d[h]|0,m=o.exceptionSizes[h]|0;if(f+i>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${f}, need ${i}, size=${m}) at block ${l}`);for(let g=0;g<i;g=g+1|0){let _=a[n++],y=p[f++]|0;e[_+t|0]|=y<<r}return d[h]=f,n}function K3(e,t,r,i,a,s,n,o,l,u){let h=r|0,c=0;for(let p=0;p<n;p=p+1|0){let d=H3(o,l,c,p);c=d.bytePosIn;let f=d.bitWidth,m=d.exceptionCount,g=s+p*256|0;switch(f){case 0:a.fill(0,g,g+256);break;case 32:for(let _=0;_<256;_=_+1|0)a[g+_|0]=e[h+_|0]|0;h=h+256|0;break;default:h=W3(e,h,a,g,f)}m>0&&(c=Y3(a,g,f,m,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${e.length})`)}function J3(e,t,r,i,a,s){let n=r|0,o=e[n]|0;if(o<=0||n+o>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${n} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=n+1|0,u=n+o|0,h=e[u]>>>0,c=h+3>>>2,p=u+1,d=p+c;if(d>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${n}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${d} out of bounds (encoded.length=${e.length})`);let f=G3(e,p,h,s),m=h,g=Z3(e,d,s);return s.dataPointers.fill(0),K3(e,n,l,u,t,i|0,a/256|0,f,m,s),g}function Q3(e,t,r,i,a,s){let n=i+kh(a,256),o=i,l=r;for(;o!==n;){let u=Math.min(Cu,n-o);l=J3(e,t,l,o,u,s),o=o+u|0}return l}function ew(e,t,r,i,a,s){if(s===0)return t;let n=0,o=t,l=t+r,u=a,h=a,c=a+s,p=0,d=0;for(;o<l&&h<c;){let f=e[o]>>>n&255;if(n+=8,o+=n>>>5,n&=31,p|=(f&127)<<d,f&128)i[h++]=p|0,p=0,d=0;else if(d+=7,d>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${d}, partial=${p}, decoded=${h-u}/${s}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${s}, consumedWords=${o-t}/${r}, vbyteStart=${t}, vbyteEnd=${l})`);return o}function tw(e,t,r){let i=0,a=0,s=new Uint32Array(t),n=r??V2();if(e.length>0){let u=e[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(a+u>s.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${a}, alignedLength=${u}, out.length=${s.length})`);i=Q3(e,s,i,a,u,n),a=a+u|0}let o=e.length-i|0,l=t-a|0;return ew(e,i,o,s,a,l),s}function rw(e,t,r,i,a){switch(a){case 2:x3(e,t,r,i);return;case 3:b3(e,t,r,i);return;case 4:w3(e,t,r,i);return;case 5:T3(e,t,r,i);return;case 6:D3(e,t,r,i);return;case 7:A3(e,t,r,i);return;case 8:E3(e,t,r,i);return;case 9:S3(e,t,r,i);return;case 10:C3(e,t,r,i);return;case 11:P3(e,t,r,i);return;case 12:I3(e,t,r,i);return;case 16:M3(e,t,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=e[t+u|0]|0;return}let s=Su[a]>>>0,n=t,o=0,l=e[n]>>>0;for(let u=0;u<32;u++)if(o+a<=32){let h=l>>>o&s;r[i+u]=h|0,o+=a,o===32&&(o=0,n++,u!==31&&(l=e[n]>>>0))}else{let h=32-o,c=l>>>o;n++,l=e[n]>>>0;let p=Su[a-h]>>>0,d=(c|(l&p)<<h)&s;r[i+u]=d|0,o=a-h}}function iw(e,t,r,i){if(t<0||r<0||t+r>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${r}, bytes.length=${e.length})`);let a=Math.floor(r/4),s=r%4!=0,n=s?a+1:a;if(i.length<n)throw RangeError(`decodeBigEndianInt32sInto: out.length=${i.length} < ${n}`);if(a>0){let o=e.byteOffset+t;if(o&3)for(let l=0;l<a;l++){let u=t+l*4;i[l]=e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]|0}else{let l=new Uint32Array(e.buffer,o,a);for(let u=0;u<a;u++)i[u]=v3(l[u])|0}}if(s){let o=t+a*4,l=r-a*4,u=0;for(let h=0;h<l;h++)u|=e[o+h]<<24-h*8;i[a]=u|0}return n}function ut(e,t,r){let i=new Uint32Array(r),a=0,s=t.get();for(let n=0;n<i.length;n++){let o=e[s++],l=o&127;if(o<128){i[a++]=l;continue}if(o=e[s++],l|=(o&127)<<7,o<128){i[a++]=l;continue}if(o=e[s++],l|=(o&127)<<14,o<128){i[a++]=l;continue}if(o=e[s++],l|=(o&127)<<21,o<128){i[a++]=l;continue}o=e[s++],l|=(o&15)<<28,i[a++]=l}return t.set(s),i}function Rh(e,t,r){let i=new BigUint64Array(r);for(let a=0;a<i.length;a++)i[a]=aw(e,t);return i}function aw(e,t){let r=0n,i=0,a=t.get();for(;a<e.length;){let s=e[a++];if(r|=BigInt(s&127)<<BigInt(i),!(s&128))break;if(i+=7,i>=64)throw Error("Varint too long")}return t.set(a),r}function sw(e,t,r){let i=new Float64Array(r);for(let a=0;a<r;a++)i[a]=nw(e,t);return i}function nw(e,t){let r,i;return i=e[t.get()],t.increment(),r=i&127,i<128||(i=e[t.get()],t.increment(),r|=(i&127)<<7,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<14,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<21,i<128)?r:(i=e[t.get()],r|=(i&15)<<28,ow(r,e,t))}function ow(e,t,r){let i,a;if(a=t[r.get()],r.increment(),i=(a&112)>>4,a<128||(a=t[r.get()],r.increment(),i|=(a&127)<<3,a<128)||(a=t[r.get()],r.increment(),i|=(a&127)<<10,a<128)||(a=t[r.get()],r.increment(),i|=(a&127)<<17,a<128)||(a=t[r.get()],r.increment(),i|=(a&127)<<24,a<128)||(a=t[r.get()],r.increment(),i|=(a&1)<<31,a<128))return i*4294967296+(e>>>0);throw Error("Expected varint not more than 10 bytes")}function lw(e,t,r,i){return uw(e,t,r,i,U3(r>>>2))}function uw(e,t,r,i,a){let s=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${s} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let n=r>>>2,o=q3(a,n);iw(e,s,r,o);let l=tw(o.subarray(0,n),t,a.decoderWorkspace);return i.add(r),l}function pe(e){return e>>>1^-(e&1)}function ot(e){return e>>1n^-(e&1n)}function ii(e){return e%2==1?(e+1)/-2:e/2}function hw(e){let t=new Int32Array(e.length);for(let r=0;r<e.length;r++)t[r]=pe(e[r]);return t}function cw(e){let t=new BigInt64Array(e.length);for(let r=0;r<e.length;r++)t[r]=ot(e[r]);return t}function Pu(e,t,r){if(r===void 0){r=0;for(let s=0;s<t;s++)r+=e[s]}let i=new Uint32Array(r),a=0;for(let s=0;s<t;s++){let n=e[s],o=e[s+t];i.fill(o,a,a+n),a+=n}return i}function Iu(e,t,r){if(r===void 0){r=0;for(let s=0;s<t;s++)r+=Number(e[s])}let i=new BigUint64Array(r),a=0;for(let s=0;s<t;s++){let n=Number(e[s]),o=e[s+t];i.fill(o,a,a+n),a+=n}return i}function j2(e,t,r){let i=new Float64Array(r),a=0;for(let s=0;s<t;s++){let n=e[s],o=e[s+t];i.fill(o,a,a+n),a+=n}return i}function Sp(e){let t=new Int32Array(e.length);t[0]=pe(e[0]);let r=e.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let a=e[i],s=e[i+1],n=e[i+2],o=e[i+3];t[i]=pe(a)+t[i-1],t[i+1]=pe(s)+t[i],t[i+2]=pe(n)+t[i+1],t[i+3]=pe(o)+t[i+2]}for(;i!==e.length;++i)t[i]=pe(e[i])+t[i-1];return t}function Cp(e){let t=new BigInt64Array(e.length);t[0]=ot(e[0]);let r=e.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let a=e[i],s=e[i+1],n=e[i+2],o=e[i+3];t[i]=ot(a)+t[i-1],t[i+1]=ot(s)+t[i],t[i+2]=ot(n)+t[i+1],t[i+3]=ot(o)+t[i+2]}for(;i!==t.length;++i)t[i]=ot(e[i])+t[i-1];return t}function pw(e){e[0]=ii(e[0]);let t=e.length/4*4,r=1;if(t>=4)for(;r<t-4;r+=4){let i=e[r],a=e[r+1],s=e[r+2],n=e[r+3];e[r]=ii(i)+e[r-1],e[r+1]=ii(a)+e[r],e[r+2]=ii(s)+e[r+1],e[r+3]=ii(n)+e[r+2]}for(;r!==e.length;++r)e[r]=ii(e[r])+e[r-1]}function dw(e,t,r){if(r===void 0){r=0;for(let s=0;s<t;s++)r+=e[s]}let i=new Int32Array(r),a=0;for(let s=0;s<t;s++){let n=e[s],o=e[s+t];o=pe(o),i.fill(o,a,a+n),a+=n}return i}function fw(e,t,r){if(r===void 0){r=0;for(let s=0;s<t;s++)r+=Number(e[s])}let i=new BigInt64Array(r),a=0;for(let s=0;s<t;s++){let n=Number(e[s]),o=e[s+t];o=ot(o),i.fill(o,a,a+n),a+=n}return i}function mw(e,t,r){let i=new Float64Array(r),a=0;for(let s=0;s<t;s++){let n=e[s],o=e[s+t];o=ii(o),i.fill(o,a,a+n),a+=n}return i}function Bh(e){let t=e.length/4*4,r=1;if(t>=4)for(let i=e[0];r<t-4;r+=4)i=e[r]+=i,i=e[r+1]+=i,i=e[r+2]+=i,i=e[r+3]+=i;for(;r!==e.length;)e[r]+=e[r-1],++r}function gw(e){let t=0;for(let r=0;r<e.length;r++)e[r]+=t,t=e[r]}function _w(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=pe(e[0]),t[1]=pe(e[1]);let r=e.length/4*4,i=2;if(r>=4)for(;i<r-4;i+=4){let a=e[i],s=e[i+1],n=e[i+2],o=e[i+3];t[i]=pe(a)+t[i-2],t[i+1]=pe(s)+t[i-1],t[i+2]=pe(n)+t[i],t[i+3]=pe(o)+t[i+1]}for(;i!==e.length;i+=2)t[i]=pe(e[i])+t[i-2],t[i+1]=pe(e[i+1])+t[i-1];return t}function yw(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=pe(e[0]);let r=t[1];for(let i=2;i!==t.length;++i){let a=e[i-1],s=pe(a);r+=s,t[i]=t[i-1]+r}return new Uint32Array(t)}function vw(e,t,r){let i=new Int32Array(r+1);i[0]=0;let a=1,s=i[0];for(let n=0;n<t;n++){let o=e[n],l=e[n+t];l=pe(l);for(let u=a;u<a+o;u++)i[u]=l+s,s=i[u];a+=o}return i}function xw(e,t,r){let i=new Uint32Array(r+1);i[0]=0;let a=1,s=i[0];for(let n=0;n<t;n++){let o=e[n],l=e[n+t];for(let u=a;u<a+o;u++)i[u]=l+s,s=i[u];a+=o}return i}function bw(e,t,r){let i=new Int32Array(r),a=0,s=0;for(let n=0;n<t;n++){let o=e[n],l=e[n+t],u=pe(l);for(let h=0;h<o;h++)s+=u,i[a++]=s}return i}function ww(e,t,r){let i=new BigInt64Array(r),a=0,s=0n;for(let n=0;n<t;n++){let o=Number(e[n]),l=e[n+t],u=ot(l);for(let h=0;h<o;h++)s+=u,i[a++]=s}return i}function Pp(e){let t=new Uint32Array(e.length);t[0]=pe(e[0])>>>0;for(let r=1;r<e.length;r++)t[r]=t[r-1]+pe(e[r])>>>0;return t}function Ip(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,ot(e[0]));for(let r=1;r<e.length;r++)t[r]=BigInt.asUintN(64,t[r-1]+ot(e[r]));return t}function Tw(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=pe(e[0])>>>0,t[1]=pe(e[1])>>>0;for(let r=2;r<e.length;r+=2)t[r]=t[r-2]+pe(e[r])>>>0,t[r+1]=t[r-1]+pe(e[r+1])>>>0;return t}function Dw(e){return e[1]}function Aw(e){return pe(e[1])}function Ew(e){if(e.length===2){let t=pe(e[1]);return[t,t]}return[pe(e[2]),pe(e[3])]}function Sw(e){return e[1]}function Cw(e){return ot(e[1])}function Pw(e){if(e.length===2){let t=ot(e[1]);return[t,t]}return[ot(e[2]),ot(e[3])]}var je;(function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"})(je||(je={}));var _t;(function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"})(_t||(_t={}));var wr;(function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"})(wr||(wr={}));var He;(function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"})(He||(He={}));const Iw=[je.PRESENT,je.DATA,je.OFFSET,je.LENGTH],Mp=[ee.NONE,ee.DELTA,ee.COMPONENTWISE_DELTA,ee.RLE,ee.MORTON,ee.PDE],Mw=[qt.NONE,qt.FAST_PFOR,qt.VARINT],Fw=[_t.NONE,_t.SINGLE,_t.SHARED,_t.VERTEX,_t.MORTON,_t.FSST],zw=[wr.VERTEX,wr.INDEX,wr.STRING,wr.KEY],kw=[He.VAR_BINARY,He.GEOMETRIES,He.PARTS,He.RINGS,He.TRIANGLES,He.SYMBOL,He.DICTIONARY];function Ee(e,t){let r=Lw(e,t);return r.logicalLevelTechnique1===ee.MORTON?Rw(r,e,t):(ee.RLE===r.logicalLevelTechnique1||ee.RLE===r.logicalLevelTechnique2)&&qt.NONE!==r.physicalLevelTechnique?Bw(r,e,t):r}function Rw(e,t,r){let i=ut(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function Bw(e,t,r){let i=ut(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function Lw(e,t){let r=e[t.get()],i=Iw[r>>4],a={};switch(i){case je.DATA:a={dictionaryType:Fw[r&15]};break;case je.OFFSET:a={offsetType:zw[r&15]};break;case je.LENGTH:a={lengthType:kw[r&15]}}t.increment();let s=e[t.get()],n=Mp[s>>5],o=Mp[s>>2&7],l=Mw[s&3];t.increment();let u=ut(e,t,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:a,logicalLevelTechnique1:n,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var xe;(function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(xe||(xe={}));var Yt=class{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8),r=e%8;return(this.values[t]>>r&1)==1}set(e,t){let r=Math.floor(e/8),i=e%8;this.values[r]=this.values[r]|+!!t<<i}getInt(e){let t=Math.floor(e/8),r=e%8;return this.values[t]>>r&1}size(){return this._size}getBuffer(){return this.values}};function Ci(e,t,r){if(!t)return e;let i=t.size(),a=e.constructor,s=new a(i),n=0;for(let o=0;o<i;o++)s[o]=t.get(o)?e[n++]:r;return s}function $w(e,t,r){if(!r)return e;let i=r.size(),a=new Yt(e,t),s=new Yt(new Uint8Array(Math.ceil(i/8)),i),n=0;for(let o=0;o<i;o++){let l=r.get(o)?a.get(n++):!1;s.set(o,l)}return s.getBuffer()}function ca(e,t,r,i,a){let s=Ow(e,Math.ceil(t/8),r,i);return a?$w(s,t,a):s}function Ow(e,t,r,i){let a=new Uint8Array(t),s=0,n=i.get()+r;for(;s<t&&!(i.get()>=n);){let o=e[i.increment()];if(o<=127){let l=o+3,u=e[i.increment()],h=Math.min(s+l,t);a.fill(u,s,h),s=h}else{let l=256-o;for(let u=0;u<l&&s<t;u++)a[s++]=e[i.increment()]}}return i.set(n),a}function N2(e,t,r,i){let a=t.get(),s=a+r*Float32Array.BYTES_PER_ELEMENT,n=new Uint8Array(e.subarray(a,s)).buffer,o=new Float32Array(n);return t.set(s),i?Ci(o,i,0):o}function U2(e,t,r,i){let a=t.get(),s=a+r*Float64Array.BYTES_PER_ELEMENT,n=new Uint8Array(e.subarray(a,s)).buffer,o=new Float64Array(n);return t.set(s),i?Ci(o,i,0):o}function Vw(e,t,r){let i=t.get(),a=r*Uint32Array.BYTES_PER_ELEMENT,s=new DataView(e.buffer,e.byteOffset,e.byteLength),n=new Uint32Array(r);for(let o=0;o<r;o++)n[o]=s.getUint32(i+o*Uint32Array.BYTES_PER_ELEMENT,!0);return t.add(a),n}function jw(e,t,r){let i=t.get(),a=r*BigUint64Array.BYTES_PER_ELEMENT,s=new DataView(e.buffer,e.byteOffset,e.byteLength),n=new BigUint64Array(r);for(let o=0;o<r;o++)n[o]=s.getBigUint64(i+o*BigUint64Array.BYTES_PER_ELEMENT,!0);return t.add(a),n}const Nw=new TextDecoder;function Lh(e,t,r){return r-t>=12?Nw.decode(e.subarray(t,r)):Uw(e,t,r)}function Uw(e,t,r){let i="",a=t;for(;a<r;){let s=e[a],n=null,o=s>239?4:s>223?3:s>191?2:1;if(a+o>r)break;let l,u,h;o===1?s<128&&(n=s):o===2?(l=e[a+1],(l&192)==128&&(n=(s&31)<<6|l&63,n<=127&&(n=null))):o===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(n=(s&15)<<12|(l&63)<<6|u&63,(n<=2047||n>=55296&&n<=57343)&&(n=null))):o===4&&(l=e[a+1],u=e[a+2],h=e[a+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(n=(s&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(n<=65535||n>=1114112)&&(n=null))),n===null?(n=65533,o=1):n>65535&&(n-=65536,i+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),i+=String.fromCharCode(n),a+=o}return i}function On(e,t,r,i,a){return Hw(pa(e,t,r),r,i,a)}function at(e,t,r,i,a){return Xw(pa(e,t,r),r,i,a)}function Rr(e,t,r){return Jw(pa(e,t,r),r)}function pa(e,t,r){let i=r.physicalLevelTechnique;switch(i){case qt.FAST_PFOR:return lw(e,r.numValues,r.byteLength,t);case qt.VARINT:return ut(e,t,r.numValues);case qt.NONE:return Vw(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function Ts(e,t,r){let i=r.physicalLevelTechnique;switch(i){case qt.VARINT:return Rh(e,t,r.numValues);case qt.NONE:return jw(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function qw(e,t,r){let i=pa(e,t,r);return i.length===1?pe(i[0]):Aw(i)}function $h(e,t,r){let i=pa(e,t,r);return i.length===1?r.logicalLevelTechnique1===ee.DELTA?pe(i[0]):i[0]:Dw(i)}function q2(e,t,r){return Ew(pa(e,t,r))}function G2(e,t,r){return Pw(Rh(e,t,r.numValues))}function Z2(e,t,r,i){return Yw(Ts(e,t,r),r,i)}function Oh(e,t,r,i){return H2(Ts(e,t,r),r,i)}function Gw(e,t,r,i){let a=Zw(e,t,r,!1);return i?Ci(a,i,0):a}function Zw(e,t,r,i){if(r.physicalLevelTechnique===qt.VARINT)return Kw(sw(e,t,r.numValues),r,i);let a=Ts(e,t,r),s=H2(a,r);return Float64Array.from(s,Number)}function Ww(e,t,r){let i=Ts(e,t,r);return i.length===1?ot(i[0]):Cw(i)}function W2(e,t,r){let i=Ts(e,t,r);return i.length===1?r.logicalLevelTechnique1===ee.DELTA?ot(i[0]):i[0]:Sw(i)}function Hw(e,t,r,i){let a;switch(t.logicalLevelTechnique1){case ee.DELTA:if(t.logicalLevelTechnique2===ee.RLE){let s=t;if(!i)return bw(e,s.runs,s.numRleValues);e=Pu(e,s.runs,s.numRleValues),a=Sp(e)}else a=Sp(e);break;case ee.RLE:a=dw(e,t.runs,t.numRleValues);break;case ee.MORTON:Bh(e),a=new Int32Array(e);break;case ee.COMPONENTWISE_DELTA:a=_w(e);break;case ee.NONE:a=hw(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Ci(a,i,0):a}function Xw(e,t,r,i){let a;switch(t.logicalLevelTechnique1){case ee.DELTA:if(t.logicalLevelTechnique2===ee.RLE){let s=t;a=Pp(Pu(e,s.runs,s.numRleValues))}else a=Pp(e);break;case ee.RLE:a=Pu(e,t.runs,t.numRleValues);break;case ee.MORTON:Bh(e),a=e;break;case ee.COMPONENTWISE_DELTA:a=Tw(e);break;case ee.NONE:a=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Ci(a,i,0):a}function Yw(e,t,r){let i;switch(t.logicalLevelTechnique1){case ee.DELTA:if(t.logicalLevelTechnique2===ee.RLE){let a=t;if(!r)return ww(e,a.runs,a.numRleValues);e=Iu(e,a.runs,a.numRleValues),i=Cp(e)}else i=Cp(e);break;case ee.RLE:i=fw(e,t.runs,t.numRleValues);break;case ee.NONE:i=cw(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Ci(i,r,0n):i}function H2(e,t,r){let i;switch(t.logicalLevelTechnique1){case ee.DELTA:if(t.logicalLevelTechnique2===ee.RLE){let a=t;i=Ip(Iu(e,a.runs,a.numRleValues))}else i=Ip(e);break;case ee.RLE:i=Iu(e,t.runs,t.numRleValues);break;case ee.NONE:i=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Ci(i,r,0n):i}function Kw(e,t,r){switch(t.logicalLevelTechnique1){case ee.DELTA:if(t.logicalLevelTechnique2===ee.RLE){let i=t;e=j2(e,i.runs,i.numRleValues)}return pw(e),e;case ee.RLE:return e5(e,t,r);case ee.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}function Jw(e,t){if(t.logicalLevelTechnique1===ee.DELTA&&t.logicalLevelTechnique2===ee.NONE)return yw(e);if(t.logicalLevelTechnique1===ee.RLE&&t.logicalLevelTechnique2===ee.NONE){let r=t;return xw(e,r.runs,r.numRleValues)}if(t.logicalLevelTechnique1===ee.NONE&&t.logicalLevelTechnique2===ee.NONE){gw(e);let r=new Uint32Array(t.numValues+1);return r[0]=0,r.set(e,1),r}if(t.logicalLevelTechnique1===ee.DELTA&&t.logicalLevelTechnique2===ee.RLE){let r=t,i=vw(e,r.runs,r.numRleValues);return Bh(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function vo(e,t,r,i,a="int32"){let s=e.logicalLevelTechnique1;if(s===ee.RLE)return e.runs===1?xe.CONST:xe.FLAT;if(s!==ee.DELTA||e.logicalLevelTechnique2!==ee.RLE)return e.numValues===1?xe.CONST:xe.FLAT;let n=t instanceof Yt?t.size():t,o=e;if(o.numRleValues!==n)return xe.FLAT;if(o.runs===1)return xe.SEQUENCE;if(o.runs!==2)return e.numValues===1?xe.CONST:xe.FLAT;let l=i.get();if(e.physicalLevelTechnique===qt.VARINT)return Qw(r,i,a)?xe.SEQUENCE:e.numValues===1?xe.CONST:xe.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?xe.SEQUENCE:e.numValues===1?xe.CONST:xe.FLAT}function Qw(e,t,r){let i=new $2(t.get());if(r==="int64"){let s=Rh(e,i,4);return s[2]===2n&&s[3]===2n}let a=ut(e,i,4);return a[2]===2&&a[3]===2}function e5(e,t,r){return r?mw(e,t.runs,t.numRleValues):j2(e,t.runs,t.numRleValues)}var X2=class extends yo{getValueFromBuffer(e){return this.dataBuffer[e]}},Y2=class extends B2{constructor(e,t,r,i,a){super(e,a?BigInt64Array.of(t):BigUint64Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}};function Vh(e,t,r){return{x:Fp(e,t)-r,y:Fp(e>>1,t)-r}}function Fp(e,t){let r=0;for(let i=0;i<t;i++)r|=(e&1<<2*i)>>i;return r}var lt;(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"})(lt||(lt={}));var t5;(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"})(t5||(t5={}));var Pi;(function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"})(Pi||(Pi={}));function r5(e){let t=Array(e.numGeometries),r=1,i=1,a=1,s=0,n=0,o=0,l=e.mortonSettings,u=e.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,d=e.vertexOffsets,f=!d||d.length===0,m=e.containsPolygonGeometry(),g=e.vertexBuffer;for(let _=0;_<e.numGeometries;_++){let y=e.geometryType(_);switch(y){case lt.POINT:{let x,v;if(f)x=g[n++],v=g[n++];else if(e.vertexBufferType===Pi.MORTON){let w=g[d[o++]],b=Vh(w,l.numBits,l.coordinateShift);x=b.x,v=b.y}else{let w=d[o++]*2;x=g[w],v=g[w+1]}t[s++]=[[new M(x,v)]],h&&a++,c&&r++,p&&i++}break;case lt.MULTIPOINT:{let x=h[a]-h[a-1];a++;let v;if(f){v=Array(x);for(let w=0;w<x;w++){let b=g[n++],A=g[n++];v[w]=new M(b,A)}}else v=ti(e.vertexBufferType,g,d,o,x,!1,l),o+=x;t[s++]=v.map(w=>[w]),r+=x,i+=x}break;case lt.LINESTRING:{let x;m?(x=p[i]-p[i-1],i++):x=c[r]-c[r-1],r++;let v;f?(v=zi(g,n,x,!1),n+=x*2):(v=ti(e.vertexBufferType,g,d,o,x,!1,l),o+=x),t[s++]=[v],h&&a++}break;case lt.POLYGON:{let x=c[r]-c[r-1];r++;let v=Array(x-1),w,b=p[i]-p[i-1];if(i++,f){w=zi(g,n,b,!0),n+=b*2;for(let A=0;A<v.length;A++)b=p[i]-p[i-1],i++,v[A]=zi(g,n,b,!0),n+=b*2}else{w=ti(e.vertexBufferType,g,d,o,b,!0,l),o+=b;for(let A=0;A<v.length;A++)b=p[i]-p[i-1],i++,v[A]=ti(e.vertexBufferType,g,d,o,b,!0,l),o+=b}t[s++]=[w].concat(v),h&&a++}break;case lt.MULTILINESTRING:{let x=h[a]-h[a-1];a++;let v=Array(x);for(let w=0;w<x;w++){let b;if(m?(b=p[i]-p[i-1],i++):b=c[r]-c[r-1],r++,f)v[w]=zi(g,n,b,!1),n+=b*2;else{let A=ti(e.vertexBufferType,g,d,o,b,!1,l);v[w]=A,o+=b}}t[s++]=v}break;case lt.MULTIPOLYGON:{let x=h[a]-h[a-1];a++;let v=Array(x);for(let w=0;w<x;w++){let b=c[r]-c[r-1];r++;let A,C=Array(b-1),E=p[i]-p[i-1];i++,f?(A=zi(g,n,E,!0),n+=E*2):(A=ti(e.vertexBufferType,g,d,o,E,!0,l),o+=E);for(let F=0;F<C.length;F++){let k=p[i]-p[i-1];i++,f?(C[F]=zi(g,n,k,!0),n+=k*2):(C[F]=ti(e.vertexBufferType,g,d,o,k,!0,l),o+=k)}v[w]=[A].concat(C)}t[s++]=v.flat()}break;default:throw Error(`The specified geometry type (${y}) is currently not supported.`)}}return t}function ti(e,t,r,i,a,s,n){return e===Pi.MORTON?a5(t,r,i,a,s,n):i5(t,r,i,a,s)}function zi(e,t,r,i){let a=Array(i?r+1:r);for(let s=0;s<r*2;s+=2){let n=e[t+s],o=e[t+s+1];a[s/2]=new M(n,o)}return i&&(a[a.length-1]=a[0]),a}function i5(e,t,r,i,a){let s=Array(a?i+1:i);for(let n=0;n<i*2;n+=2){let o=t[r+n/2]*2,l=e[o],u=e[o+1];s[n/2]=new M(l,u)}return a&&(s[s.length-1]=s[0]),s}function a5(e,t,r,i,a,s){let n=Array(a?i+1:i);for(let o=0;o<i;o++){let l=e[t[r+o]],u=Vh(l,s.numBits,s.coordinateShift);n[o]=new M(u.x,u.y)}return a&&(n[n.length-1]=n[0]),n}var K2=class{constructor(e,t,r,i,a){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=a}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let r=this.vertexOffsets[e],i=this.vertexBuffer[r],a=Vh(i,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return r5(this)}get mortonSettings(){return this._mortonSettings}};function s5(e,t,r,i,a){return new J2(e,t,Pi.VEC_2,r,i,a)}function n5(e,t,r,i,a,s){return new J2(e,t,Pi.MORTON,r,i,a,s)}var J2=class extends K2{constructor(e,t,r,i,a,s,n){super(r,i,a,s,n),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===lt.POLYGON||this._geometryType===lt.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function Q2(e,t,r,i){return new em(Pi.VEC_2,e,t,r,i)}function o5(e,t,r,i,a){return new em(Pi.MORTON,e,t,r,i,a)}var em=class extends K2{constructor(e,t,r,i,a,s){super(e,r,i,a,s),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===lt.POLYGON||this.geometryType(e)===lt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},tm=class{constructor(e,t,r,i){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let e=new Uint32Array(this.numGeometries);for(let t=0;t<this.numGeometries;t++)e[t]=this.geometryType(t);return Q2(e,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function zp(e,t,r,i,a,s){return new l5(e,t,r,i,a,s)}var l5=class extends tm{constructor(e,t,r,i,a,s){super(r,i,a,s),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function kp(e,t,r,i,a){return new u5(e,t,r,i,a)}var u5=class extends tm{constructor(e,t,r,i,a){super(t,r,i,a),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function h5(e,t,r,i,a){let s=Ee(e,r),n=vo(s,i,e,r),o,l,u,h;if(n===xe.CONST){let x=$h(e,r,s),v,w,b,A;for(let C=0;C<t-1;C++){let E=Ee(e,r);switch(E.physicalStreamType){case je.LENGTH:switch(E.logicalStreamType.lengthType){case He.GEOMETRIES:v=Rr(e,r,E);break;case He.PARTS:w=Rr(e,r,E);break;case He.RINGS:b=Rr(e,r,E);break;case He.TRIANGLES:A=Rr(e,r,E)}break;case je.OFFSET:switch(E.logicalStreamType.offsetType){case wr.VERTEX:o=at(e,r,E);break;case wr.INDEX:h=at(e,r,E)}break;case je.DATA:if(_t.VERTEX===E.logicalStreamType.dictionaryType)l=On(e,r,E,a);else{let F=E;u={numBits:F.numBits,coordinateShift:F.coordinateShift},l=at(e,r,E,a)}}}return h?v!==void 0||w!==void 0?zp(i,x,A,h,l,{geometryOffsets:v,partOffsets:w,ringOffsets:b}):zp(i,x,A,h,l):u===void 0?s5(i,x,{geometryOffsets:v,partOffsets:w,ringOffsets:b},o,l):n5(i,x,{geometryOffsets:v,partOffsets:w,ringOffsets:b},o,l,u)}let c=at(e,r,s),p,d,f,m;for(let x=0;x<t-1;x++){let v=Ee(e,r);switch(v.physicalStreamType){case je.LENGTH:switch(v.logicalStreamType.lengthType){case He.GEOMETRIES:p=at(e,r,v);break;case He.PARTS:d=at(e,r,v);break;case He.RINGS:f=at(e,r,v);break;case He.TRIANGLES:m=Rr(e,r,v)}break;case je.OFFSET:switch(v.logicalStreamType.offsetType){case wr.VERTEX:o=at(e,r,v);break;case wr.INDEX:h=at(e,r,v)}break;case je.DATA:if(_t.VERTEX===v.logicalStreamType.dictionaryType)l=On(e,r,v,a);else{let w=v;u={numBits:w.numBits,coordinateShift:w.coordinateShift},l=at(e,r,v,a)}}}let g,_,y;return p?(g=Ko(c,p,2),d&&f?(_=Rp(c,g,d,!1),y=p5(c,g,_,f)):d&&(_=c5(c,g,d))):d&&f?(_=Ko(c,d,1),y=Rp(c,_,f,!0)):d&&(_=Ko(c,d,0)),h&&!_?kp(c,m,h,l):h?kp(c,m,h,l,{geometryOffsets:g,partOffsets:_,ringOffsets:y}):u===void 0?Q2(c,{geometryOffsets:g,partOffsets:_,ringOffsets:y},o,l):o5(c,{geometryOffsets:g,partOffsets:_,ringOffsets:y},o,l,u)}function Ko(e,t,r){let i=new Uint32Array(e.length+1),a=0;i[0]=a;let s=0;for(let n=0;n<e.length;n++)a=i[n+1]=a+(e[n]>r?t[s++]:1);return i}function Rp(e,t,r,i){let a=new Uint32Array(t[t.length-1]+1),s=0;a[0]=s;let n=1,o=0;for(let l=0;l<e.length;l++){let u=e[l],h=t[l+1]-t[l];if(u===5||u===2||i&&(u===4||u===1))for(let c=0;c<h;c++)s=a[n++]=s+r[o++];else for(let c=0;c<h;c++)a[n++]=++s}return a}function c5(e,t,r){let i=new Uint32Array(t[t.length-1]+1),a=0;i[0]=a;let s=1,n=0;for(let o=0;o<e.length;o++){let l=e[o],u=t[o+1]-t[o];if(l===4||l===1)for(let h=0;h<u;h++)a=i[s++]=a+r[n++];else for(let h=0;h<u;h++)i[s++]=++a}return i}function p5(e,t,r,i){let a=new Uint32Array(r[r.length-1]+1),s=0;a[0]=s;let n=1,o=1,l=0;for(let u=0;u<e.length;u++){let h=e[u],c=t[u+1]-t[u];if(h!==0&&h!==3)for(let p=0;p<c;p++){let d=r[n]-r[n-1];n++;for(let f=0;f<d;f++)s=a[o++]=s+i[l++]}else for(let p=0;p<c;p++)a[o++]=++s,n++}return a}var d5=class extends Si{constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}},f5=class extends yo{getValueFromBuffer(e){return this.dataBuffer[e]}},rm=class extends Si{constructor(e,t,r,i){super(e,i?BigInt64Array.of(t):BigUint64Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},jh=class extends Si{constructor(e,t,r,i){super(e,r,i),this.offsetBuffer=t}},Bp=class extends jh{constructor(e,t,r,i){super(e,t,r,i??t.length-1)}getValueFromBuffer(e){let t=this.offsetBuffer[e],r=this.offsetBuffer[e+1];return Lh(this.dataBuffer,t,r)}},Hi=class extends jh{constructor(e,t,r,i,a){super(e,r,i,a??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return Lh(this.dataBuffer,r,i)}};function m5(e,t){let r=0;for(let i=0;i<t.length;i++){let a=t[i];a===255?(r++,i++):r+=e[a]}return r}function g5(e,t,r){let i=new Uint32Array(t.length);for(let n=1;n<t.length;n++)i[n]=i[n-1]+t[n-1];let a=new Uint8Array(m5(t,r)),s=0;for(let n=0;n<r.length;n++){let o=r[n];if(o===255)n++,a[s++]=r[n];else{let l=t[o],u=i[o];for(;l-- >0;)a[s++]=e[u++]}}return a}var im=class extends jh{constructor(e,t,r,i,a,s,n,o){super(e,r,i,n??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=a,this.symbolTableBuffer=s,this.sharedDictionaryCache=o}getValueFromBuffer(e){var a;this.decodedDictionary??(this.decodedDictionary=(a=this.sharedDictionaryCache)==null?void 0:a.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return Lh(this.decodedDictionary,r,i)}decodeDictionary(){return this.symbolLengthBuffer??(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),g5(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),r=e[0];for(let i=1;i<e.length;i++){let a=e[i];t[i-1]=a-r,r=a}return t}};function am(e,t,r,i,a){let s,n,o,l,u,h=a,c,p;for(let d=0;d<i;d++){let f=Ee(t,r);switch(f.physicalStreamType){case je.PRESENT:{let m=new Yt(ca(t,f.numValues,f.byteLength,r),f.numValues);h=a??m;break}case je.OFFSET:n=at(t,r,f,void 0,h);break;case je.LENGTH:{let m=Rr(t,r,f);He.DICTIONARY===f.logicalStreamType.lengthType?s=m:He.SYMBOL===f.logicalStreamType.lengthType?l=m:c=m;break}case je.DATA:{let m=t.subarray(r.get(),r.get()+f.byteLength);r.add(f.byteLength);let g=f.logicalStreamType.dictionaryType;_t.FSST===g?u=m:_t.SINGLE===g||_t.SHARED===g?o=m:_t.NONE===g&&(p=m);break}}}return _5(e,u,n,s,o,l,h)??y5(e,o,n,s,h)??v5(e,c,p,n,h)}function _5(e,t,r,i,a,s,n){if(t){if(!r||!i||!a||!s)throw Error(`Incomplete FSST dictionary string column "${e}"`);return new im(e,r,i,a,s,t,n)}}function y5(e,t,r,i,a){if(t){if(!r||!i)throw Error(`Incomplete dictionary string column "${e}"`);return a?new Hi(e,r,i,t,a):new Hi(e,r,i,t)}}function v5(e,t,r,i,a){if(!(!t||!r)){if(i)return a?new Hi(e,i,t,r,a):new Hi(e,i,t,r);if(a&&a.size()!==t.length-1){let s=new Uint32Array(a.size()),n=0;for(let o=0;o<a.size();o++)a.get(o)?s[o]=n++:s[o]=0;return new Hi(e,s,t,r,a)}return a?new Bp(e,t,r,a):new Bp(e,t,r)}}function x5(e,t,r,i){let a,s,n,o,l=!1;for(;!l;){let d=Ee(e,t);switch(d.physicalStreamType){case je.LENGTH:He.DICTIONARY===d.logicalStreamType.lengthType?a=Rr(e,t,d):n=Rr(e,t,d);break;case je.DATA:_t.SINGLE===d.logicalStreamType.dictionaryType||_t.SHARED===d.logicalStreamType.dictionaryType?(s=e.subarray(t.get(),t.get()+d.byteLength),l=!0):o=e.subarray(t.get(),t.get()+d.byteLength),t.add(d.byteLength)}}if(r.type!=="complexType")throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!a||!s)throw Error(`Incomplete shared dictionary for column "${r.name}"`);let u=r.complexType.children,h=[],c=o?{}:void 0,p=0;for(let d of u){let f=ut(e,t,1)[0];if(f===0)continue;let m=d.name?`${r.name}${d.name}`:r.name;if(d.type!=="scalarField"||d.scalarField.physicalType!==oe.STRING)throw Error("Currently only scalar string fields are implemented for a struct.");if(f>1&&!d.nullable||f===1&&d.nullable)throw Error(`The number of streams for the child field ${d.name} does not match its nullability. nullibilty: ${d.nullable}, numStreams: ${f}`);let g;if(d.nullable){let y=Ee(e,t);g=new Yt(ca(e,y.numValues,y.byteLength,t),y.numValues)}let _=at(e,t,Ee(e,t),void 0,g);if(o){if(!n)throw Error(`Incomplete shared FSST dictionary for column "${m}"`);h[p++]=new im(m,_,a,s,n,o,g,c)}else h[p++]=new Hi(m,_,a,s,g)}return h}var Lp=class extends Si{constructor(e,t,r){super(e,new Uint8Array,r??t.length),this.values=t}getValueFromBuffer(e){return this.values[e]}},Tr;(function(e){e[e.STRING=1]="STRING",e[e.INT32=2]="INT32",e[e.UINT32=4]="UINT32",e[e.INT64=8]="INT64",e[e.UINT64=16]="UINT64",e[e.FLOAT=32]="FLOAT",e[e.DOUBLE=64]="DOUBLE",e[e.PRESENCE=128]="PRESENCE"})(Tr||(Tr={}));var oi;(function(e){e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e[e.START_MAP=2]="START_MAP",e[e.START_LIST=3]="START_LIST",e[e.COUNT=4]="COUNT"})(oi||(oi={}));function b5(e,t,r,i){let a=w5(r);if(i===0)return a.map(h=>new Lp(h,[]));let s=T5(e,t,i),n=(s.presentStream?s.presentCount:s.lengthStream.length)/a.length,o=[],l=0,u=0;for(let h=0;h<a.length;h++){let c=C5(s,h,n,l,u);o.push(new Lp(a[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function w5(e){let t=e.type==="complexType"?e.complexType.children:void 0;return!t||t.length===0?[e.name]:t.map(r=>e.name+(r.name??""))}function T5(e,t,r){let i=e[t.get()];t.add(1);let a=at(e,t,Ee(e,t)),s=r-1,n=[];i&Tr.STRING&&(s-=D5(e,t,n)),s-=A5(e,t,i,n),s-=E5(e,t,i,n);let o,l=0;if(i&Tr.PRESENCE){let h=S5(e,t);o=h.value,l=h.count,s--}let u=new Uint32Array;if(s>0&&(u=at(e,t,Ee(e,t)),s--),s!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${s}`);return{lengthStream:a,dictionary:n,presentStream:o,presentCount:l,flattenedValues:u}}function D5(e,t,r){let i=e[t.get()];t.add(1);let a=am("",e,t,i);if(a)for(let s=0;s<a.size;s++)r.push(a.getValue(s));return i}function A5(e,t,r,i){let a=0;return r&Tr.INT32?(Ni(i,On(e,t,Ee(e,t))),a++):r&Tr.INT64&&(Ni(i,Z2(e,t,Ee(e,t))),a++),r&Tr.UINT32?(Ni(i,at(e,t,Ee(e,t))),a++):r&Tr.UINT64&&(Ni(i,Oh(e,t,Ee(e,t))),a++),a}function E5(e,t,r,i){let a=0;return r&Tr.FLOAT&&(Ni(i,N2(e,t,Ee(e,t).numValues)),a++),r&Tr.DOUBLE&&(Ni(i,U2(e,t,Ee(e,t).numValues)),a++),a}function S5(e,t){let r=Ee(e,t);if(r.physicalStreamType!==je.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let i=r.numValues,a=t.get(),s=new Yt(ca(e,i,r.byteLength,t),i);return t.set(a+r.byteLength),{value:s,count:i}}function C5(e,t,r,i,a){let{lengthStream:s,flattenedValues:n,presentStream:o,dictionary:l}=e,u=t*r,h=r,c;if(o){c=new Yt(new Uint8Array(Math.ceil(r/8)),r),h=0;for(let y=0;y<r;y++)o.get(u+y)&&(c.set(y,!0),h++)}let p=i+h;if(p>s.length)throw Error("Merged map counts underflow while decoding child streams");let d=Array(r),f=i,m=a;for(let y=0;y<r;y++){if(o&&!o.get(u+y)){d[y]=null;continue}let x=m+s[f++];if(x>n.length)throw Error("Map value stream underflow while decoding feature payload");let v=P5(n,m,x,l);d[y]=v.value,m=v.nextIndex}let g=0;for(let y=i;y<p;y++)g+=s[y];let _=a+g;if(m!==_)throw Error("Unused flattened map values remain after decode");return{value:d,nullabilityBuffer:c,countsEnd:p,valuesEnd:_}}function P5(e,t,r,i){return r-t===1||e[t]===oi.START_LIST?Nh(e,t,r,i):sm(e,t,r,i)}function sm(e,t,r,i){let a=Object.create(null),s=t;for(;s<r;){let n=nm(e[s++],i);if(typeof n!="string")throw Error(`Map key dictionary index does not resolve to a string: ${n}`);let o=Nh(e,s,r,i);a[n]=o.value,s=o.nextIndex}return{value:a,nextIndex:s}}function Nh(e,t,r,i){if(t>=r)throw Error("Unexpected end of map value stream");let a=e[t];if(a===oi.FALSE)return{value:!1,nextIndex:t+1};if(a===oi.TRUE)return{value:!0,nextIndex:t+1};if(a===oi.START_MAP){let s=$p(e,t,r);return{value:sm(e,t+2,s,i).value,nextIndex:s}}if(a===oi.START_LIST){let s=$p(e,t,r),n=[],o=t+2;for(;o<s;){let l=Nh(e,o,s,i);n.push(l.value),o=l.nextIndex}return{value:n,nextIndex:s}}return{value:nm(a,i),nextIndex:t+1}}function $p(e,t,r){if(t+1>=r)throw Error("Missing length for nested map/list payload");let i=e[t+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let a=t+i;if(a>r)throw Error("Nested payload exceeds containing payload bounds");return a}function nm(e,t){let r=e-oi.COUNT;if(r<0||r>=t.length)throw Error(`Scalar dictionary index out of range: ${e}`);return t[r]}function Ni(e,t){for(let r of t)e.push(r)}function I5(e,t,r,i,a,s){var n;return r.type==="scalarType"?M5(i,e,t,a,r.scalarType,r):((n=r.complexType)==null?void 0:n.physicalType)===Vr.MAP?b5(e,t,r,i):i===0?null:x5(e,t,r)}function M5(e,t,r,i,a,s){let n;if(e===0)return null;if(s.nullable){let l=Ee(t,r),u=l.numValues,h=r.get(),c=ca(t,u,l.byteLength,r);r.set(h+l.byteLength),n=new Yt(c,l.numValues)}let o=n??i;switch(a.physicalType){case oe.UINT_32:case oe.INT_32:return B5(t,r,s,a,o);case oe.STRING:{let l=s.nullable?e-1:e;return am(s.name,t,r,l,n)??null}case oe.BOOLEAN:return F5(t,r,s,i,o);case oe.UINT_64:case oe.INT_64:return R5(t,r,s,o,a);case oe.FLOAT:return z5(t,r,s,o);case oe.DOUBLE:return k5(t,r,s,o);default:throw Error(`The specified data type for the field is currently not supported: ${a}`)}}function F5(e,t,r,i,a){let s=Ee(e,t),n=s.numValues,o=t.get(),l=Ds(a)?a:void 0,u=ca(e,n,s.byteLength,t,l);t.set(o+s.byteLength);let h=new Yt(u,n);return new d5(r.name,h,a)}function z5(e,t,r,i){let a=Ee(e,t),s=Ds(i)?i:void 0,n=N2(e,t,a.numValues,s);return new f5(r.name,n,i)}function k5(e,t,r,i){let a=Ee(e,t),s=Ds(i)?i:void 0,n=U2(e,t,a.numValues,s);return new Ih(r.name,n,i)}function R5(e,t,r,i,a){let s=Ee(e,t),n=vo(s,i,e,t,"int64"),o=a.physicalType===oe.INT_64;if(n===xe.FLAT){let u=Ds(i)?i:void 0,h=o?Z2(e,t,s,u):Oh(e,t,s,u);return new X2(r.name,h,i)}if(n===xe.SEQUENCE){let u=G2(e,t,s);return new Y2(r.name,u[0],u[1],s.numRleValues,o)}let l=o?Ww(e,t,s):W2(e,t,s);return new rm(r.name,l,i,o)}function B5(e,t,r,i,a){let s=Ee(e,t),n=vo(s,a,e,t),o=i.physicalType===oe.INT_32;if(n===xe.FLAT){let u=Ds(a)?a:void 0,h=o?On(e,t,s,void 0,u):at(e,t,s,void 0,u);return new Ph(r.name,h,a)}if(n===xe.SEQUENCE){let u=q2(e,t,s);return new Mh(r.name,u[0],u[1],s.numRleValues,o)}let l=o?qw(e,t,s):$h(e,t,s);return new Fh(r.name,l,a,o)}function Ds(e){return e instanceof Yt}const We={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function om(e){switch(e){case We.ID:case We.ID|We.ID_NULLABLE:case We.ID|We.ID_LONG:case We.ID|We.ID_LONG|We.ID_NULLABLE:return{nullable:(e&We.ID_NULLABLE)!==0,columnScope:$a.FEATURE,type:"scalarType",scalarType:{longID:(e&We.ID_LONG)!==0,type:"logicalType",logicalType:L2.ID}};case We.GEOMETRY:return{nullable:!1,columnScope:$a.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Vr.GEOMETRY,children:[]}};case We.STRUCT:return{nullable:!1,columnScope:$a.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Vr.STRUCT,children:[]}};case We.MAP:return{nullable:!0,columnScope:$a.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Vr.MAP,children:[]}};default:return j5(e)}}function L5(e){return e>=We.SCALAR_BASE}function lm(e){return e===We.STRUCT||e===We.MAP}function $5(e){if(e.type==="scalarType"){let t=e.scalarType;if(t.type==="physicalType")switch(t.physicalType){case oe.BOOLEAN:case oe.INT_8:case oe.UINT_8:case oe.INT_32:case oe.UINT_32:case oe.INT_64:case oe.UINT_64:case oe.FLOAT:case oe.DOUBLE:return!1;case oe.STRING:return!0;default:return!1}if(t.type==="logicalType")return!1}else if(e.type==="complexType"){let t=e.complexType;if(t.type==="physicalType")switch(t.physicalType){case Vr.GEOMETRY:case Vr.STRUCT:case Vr.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}function O5(e){var t;return e.type==="scalarType"&&((t=e.scalarType)==null?void 0:t.type)==="logicalType"&&e.scalarType.logicalType===L2.ID}function V5(e){var t;return e.type==="complexType"&&((t=e.complexType)==null?void 0:t.type)==="physicalType"&&e.complexType.physicalType===Vr.GEOMETRY}function j5(e){let t;switch(e){case 10:case 11:t=oe.BOOLEAN;break;case 12:case 13:t=oe.INT_8;break;case 14:case 15:t=oe.UINT_8;break;case 16:case 17:t=oe.INT_32;break;case 18:case 19:t=oe.UINT_32;break;case 20:case 21:t=oe.INT_64;break;case 22:case 23:t=oe.UINT_64;break;case 24:case 25:t=oe.FLOAT;break;case 26:case 27:t=oe.DOUBLE;break;case 28:case 29:t=oe.STRING;break;default:return null}return{nullable:!!(e&1),columnScope:$a.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:t}}}const N5=new TextDecoder,Op="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function Uh(e,t){let r=ut(e,t,1)[0];if(r===0)return"";let i=t.get(),a=i+r,s=e.subarray(i,a);return t.add(r),N5.decode(s)}function U5(e){let t=e.name,r=e.nullable;return e.type==="scalarType"?{type:"scalarField",scalarField:e.scalarType,name:t,nullable:r}:{type:"complexField",complexField:e.complexType,name:t,nullable:r}}function um(e,t){let r=ut(e,t,1)[0]>>>0,i=r>=We.SCALAR_BASE?om(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let a={...i,name:Uh(e,t)};if(a.type==="complexType"&&lm(r)){let s=a.complexType,n=ut(e,t,1)[0]>>>0;s.children=Array(n);for(let o=0;o<n;o++)s.children[o]=um(e,t)}return U5(a)}function q5(e,t){let r=ut(e,t,1)[0]>>>0,i=om(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${Op}`);let a;if(L5(r))a=Uh(e,t);else if(r<We.GEOMETRY)a="id";else if(r===We.GEOMETRY)a="geometry";else throw Error(`Unsupported column type code ${r}. Supported: ${Op}`);let s={...i,name:a};if(s.type==="complexType"&&lm(r)){let n=ut(e,t,1)[0]>>>0,o=s.complexType;o.children=Array(n);for(let l=0;l<n;l++)o.children[l]=um(e,t)}return s}function G5(e,t){let r={};r.featureTables=[];let i={};if(i.name=Uh(e,t),i.name.length===0)throw Error("Missing layer name");let a=ut(e,t,1)[0]>>>0,s=ut(e,t,1)[0]>>>0;i.columns=Array(s);for(let n=0;n<s;n++)i.columns[n]=q5(e,t);return r.featureTables.push(i),[r,a]}function Z5(e,t,r=!0){let i=new $2(0),a=[];for(;i.get()<e.length;){let s=ut(e,i,1)[0]>>>0,n=i.get()+s;if(n>e.length)throw Error(`Block overruns tile: ${n} > ${e.length}`);let o=ut(e,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(n);continue}let[l,u]=G5(e,i),h=l.featureTables[0],c=null,p=null,d=[],f=0;for(let g of h.columns){let _=g.name;if(O5(g)){let y=null;if(g.nullable){let v=Ee(e,i),w=i.get(),b=ca(e,v.numValues,v.byteLength,i);i.set(w+v.byteLength),y=new Yt(b,v.numValues)}let x=Ee(e,i);f=y?y.size():x.decompressedCount,c=W5(e,g,i,_,x,y??f,r)}else if(V5(g)){let y=ut(e,i,1)[0];if(f===0){let x=i.get();f=Ee(e,i).decompressedCount,i.set(x)}p=h5(e,y,i,f,t)}else{let y=$5(g)?ut(e,i,1)[0]:1;if(y===0)continue;let x=I5(e,i,g,y,f);if(x)if(Array.isArray(x))for(let v of x)d.push(v);else d.push(x)}}let m=new g3(h.name,p,c,d,u);a.push(m),i.set(n)}return a}function W5(e,t,r,i,a,s,n=!1){var h;let o=(h=t.scalarType)!=null&&h.longID?oe.UINT_64:oe.UINT_32,l=typeof s=="number"?void 0:s,u=vo(a,s,e,r,o===oe.UINT_64?"int64":"int32");if(o===oe.UINT_32)switch(u){case xe.FLAT:return new Ph(i,at(e,r,a,void 0,l),s);case xe.SEQUENCE:{let c=q2(e,r,a);return new Mh(i,c[0],c[1],a.numRleValues,!1)}case xe.CONST:return new Fh(i,$h(e,r,a),s,!1)}switch(u){case xe.FLAT:return n?new Ih(i,Gw(e,r,a,l),s):new X2(i,Oh(e,r,a,l),s);case xe.SEQUENCE:{let c=G2(e,r,a);return new Y2(i,c[0],c[1],a.numRleValues,!1)}case xe.CONST:return new rm(i,W2(e,r,a),s,!1)}throw Error("Vector type not supported for id column.")}var H5=class{constructor(e,t){var r;switch(this._featureData=e,this.properties=this._featureData.properties||{},(r=this._featureData.geometry)==null?void 0:r.type){case lt.POINT:case lt.MULTIPOINT:this.type=1;break;case lt.LINESTRING:case lt.MULTILINESTRING:this.type=2;break;case lt.POLYGON:case lt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let r=[];for(let i of t)r.push(new M(i.x,i.y));e.push(r)}return e}},X5=class{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new H5(this.features[e],this.extent)}},Y5=class{constructor(e){this.layers={};let t=Z5(new Uint8Array(e));this.layers=t.reduce((r,i)=>({...r,[i.name]:new X5(i)}),{})}},K5=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ll(z,16,0),this.grid3D=new Ll(z,16,0),this.featureIndexArray=new Hf,this.promoteId=t}insert(e,t,r,i,a,s){let n=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,a);let o=s?this.grid3D:this.grid;for(let l of t){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(n,u[0],u[1],u[2],u[3])}}loadVTLayers(){if(!this.vtLayers){switch(this.encoding){case"mlt":this.vtLayers=new Y5(this.rawTileData).layers;break;default:this.vtLayers=new Ux(new P2(this.rawTileData)).layers}this.sourceLayerCoder=new m3(this.vtLayers?Object.keys(this.vtLayers).sort():[pn])}return this.vtLayers}query(e,t,r,i){this.loadVTLayers();let a=e.params,s=z/e.tileSize/e.scale,n=Qa(a.filter,"queryRenderedFeatures filter",a.globalState),o=e.queryGeometry,l=e.queryPadding*s,u=or.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=or.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(m,g,_,y)=>Dv(e.cameraQueryGeometry,m-l,g-l,_+l,y+l));for(let m of p)h.push(m);h.sort(Q5);let d={},f;for(let m of h){if(m===f)continue;f=m;let g=this.featureIndexArray.get(m),_=null;this.loadMatchingFeature(d,g.bucketIndex,g.sourceLayerIndex,g.featureIndex,n,a.layers,a.availableImages,t,r,i,(y,x,v)=>(_||(_=Ai(y)),x.queryIntersectsFeature({queryGeometry:o,feature:y,featureState:v,geometry:_,zoom:this.z,transform:e.transform,pixelsToTileUnits:s,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return d}loadMatchingFeature(e,t,r,i,a,s,n,o,l,u,h){let c=this.bucketLayerIDs[t];if(s&&!c.some(m=>s.has(m)))return;let p=this.sourceLayerCoder.decode(r),d=this.vtLayers[p].feature(i);if(a.needGeometry){let m=Ei(d,!0);if(!a.filter(new Ae(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!a.filter(new Ae(this.tileID.overscaledZ),d))return;let f=this.getId(d,p);for(let m of c){if(s&&!s.has(m))continue;let g=o[m];if(!g)continue;let _={};f&&u&&(_=u.getState(g.sourceLayer||"_geojsonTileLayer",f));let y=q({},l[m]);y.paint=Vp(y.paint,g.paint,d,_,n),y.layout=Vp(y.layout,g.layout,d,_,n);let x=!h||h(d,g,_);if(!x)continue;let v=new R2(d,this.z,this.x,this.y,f);v.layer=y;let w=e[m];w===void 0&&(w=e[m]=[]),w.push({featureIndex:i,feature:v,intersectionZ:x})}}lookupSymbolFeatures(e,t,r,i,a,s,n,o){let l={};this.loadVTLayers();let u=Qa(a.filterSpec,"queryRenderedFeatures symbol filter",a.globalState);for(let h of e)this.loadMatchingFeature(l,r,i,h,u,s,n,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let r of t)if(e===r)return!0;return!1}getId(e,t){var i;let r=e.id;if(this.promoteId){let a=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];r=e.properties[a],typeof r=="boolean"&&(r=Number(r)),r===void 0&&((i=e.properties)!=null&&i.cluster)&&this.promoteId&&(r=Number(e.properties.cluster_id))}return r}};V("FeatureIndex",K5,{omit:["rawTileData","sourceLayerCoder"]});function J5(e){return typeof e=="object"&&!!e&&"evaluate"in e}function Vp(e,t,r,i,a){return Hu(e,(s,n)=>{let o=t instanceof ho?t.get(n):null;return J5(o)?o.evaluate(r,i,void 0,a):o})}function Q5(e,t){return t-e}var e4=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,r){let i=e.wrapped().key;this.data[i]===void 0&&(this.data[i]=[]);let a={value:t,timeout:void 0};if(r!==void 0&&(a.timeout=setTimeout(()=>{this.remove(e,a)},r)),this.data[i].push(a),this.order.push(i),this.order.length>this.max){let s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let r=e.wrapped().key,i=t===void 0?0:this.data[r].indexOf(t),a=this.data[r][i];return this.data[r].splice(i,1),a.timeout&&clearTimeout(a.timeout),this.data[r].length===0&&delete this.data[r],this.onRemove(a.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let r in this.data)for(let i of this.data[r])e(i.value)||t.push(i);for(let r of t)this.remove(r.value.tileID,r)}};function t4(e,t,r,i,a){let s=[];for(let n of e){let o;for(let l=0;l<n.length-1;l++){let u=n[l],h=n[l+1];u.x<t&&h.x<t||(u.x<t?u=new M(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round():h.x<t&&(h=new M(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round()),!(u.y<r&&h.y<r)&&(u.y<r?u=new M(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round():h.y<r&&(h=new M(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round()),!(u.x>=i&&h.x>=i)&&(u.x>=i?u=new M(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new M(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=a&&h.y>=a)&&(u.y>=a?u=new M(u.x+(h.x-u.x)*((a-u.y)/(h.y-u.y)),a)._round():h.y>=a&&(h=new M(u.x+(h.x-u.x)*((a-u.y)/(h.y-u.y)),a)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],s.push(o)),o.push(h)))))}}return s}var r4=class hm extends M{constructor(t,r,i,a){super(t,r),this.angle=i,a!==void 0&&(this.segment=a)}clone(){return new hm(this.x,this.y,this.angle,this.segment)}};V("Anchor",r4);let jp=(function(e){return e[e.center=1]="center",e[e.left=2]="left",e[e.right=3]="right",e[e.top=4]="top",e[e.bottom=5]="bottom",e[e["top-left"]=6]="top-left",e[e["top-right"]=7]="top-right",e[e["bottom-left"]=8]="bottom-left",e[e["bottom-right"]=9]="bottom-right",e})({});function i4(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}/**
|
|
6
|
+
* MapLibre GL JS
|
|
7
|
+
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.7.0/LICENSE.txt
|
|
8
|
+
*/var a4="6.7.0";function cm(){var e=new Ye(4);return Ye!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function s4(e,t){var r=t[0],i=t[1],a=t[2],s=t[3],n=r*s-a*i;return n?(n=1/n,e[0]=s*n,e[1]=-i*n,e[2]=-a*n,e[3]=r*n,e):null}function n4(e){return e[0]*e[3]-e[2]*e[1]}function o4(e,t,r){var i=t[0],a=t[1],s=t[2],n=t[3],o=Math.sin(r),l=Math.cos(r);return e[0]=i*l+s*o,e[1]=a*l+n*o,e[2]=i*-o+s*l,e[3]=a*-o+n*l,e}let Jo,Np,Qo;const At={frame(e,t,r,i){let a=i||window,s=a.requestAnimationFrame(o=>{n(),t(o)}),{unsubscribe:n}=Tl(e.signal,"abort",()=>{n(),a.cancelAnimationFrame(s),r(new ps(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((r,i)=>{this.frame(e,r,i,t)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),r=t.getContext("2d",{willReadFrequently:!0});if(!r)throw Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0,e.width,e.height),r},resolveURL(e){return Jo||(Jo=document.createElement("a")),Jo.href=e,Jo.href},get hardwareConcurrency(){return typeof navigator<"u"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return Qo===void 0?matchMedia?(Np??(Np=matchMedia("(prefers-reduced-motion: reduce)")),Np.matches):!1:Qo},set prefersReducedMotion(e){Qo=e}},l4=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function ge(){return l4.getCurrentTime()}var t,he,Oe=(he=class{static create(t,r,i){let a=window.document.createElement(t);return r!==void 0&&(a.className=r),i&&i.appendChild(a),a}static createNS(t,r){return window.document.createElementNS(t,r)}static disableDrag(){he.docStyle&&he.selectProp&&(he.userSelect=he.docStyle[he.selectProp],he.docStyle[he.selectProp]="none")}static enableDrag(){he.docStyle&&he.selectProp&&(he.docStyle[he.selectProp]=he.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",he.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",he.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",he.suppressClickInternal,!0)},0)}static getScale(t){let r=t.getBoundingClientRect();return{x:r.width/t.offsetWidth||1,y:r.height/t.offsetHeight||1,boundingClientRect:r}}static getPoint(t,r,i){let a=r.boundingClientRect;return new M((i.clientX-a.left)/r.x-t.clientLeft,(i.clientY-a.top)/r.y-t.clientTop)}static mousePos(t,r){let i=he.getScale(t);return he.getPoint(t,i,r)}static touchPos(t,r){let i=[],a=he.getScale(t);for(let s of r)i.push(he.getPoint(t,a,s));return i}static sanitize(t){let r=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),i=r.querySelectorAll("script");for(let a of i)a.remove();return he.clean(r),r.innerHTML}static isPossiblyDangerous(t,r){let i=r.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(t)&&(i.includes("javascript:")||i.includes("data:"))||t.startsWith("on"))return!0}static clean(t){let r=t.children;for(let i of r)he.removeAttributes(i),he.clean(i)}static removeAttributes(t){for(let{name:r,value:i}of Array.from(t.attributes))he.isPossiblyDangerous(r,i)&&t.removeAttribute(r)}},he.docStyle=typeof window<"u"&&((t=window.document)==null?void 0:t.documentElement.style),he.selectProp=!he.docStyle||"userSelect"in he.docStyle?"userSelect":"webkitUserSelect",he);let lr;(function(e){let t,r,i,a;e.resetRequestQueue=()=>{t=[],r=0,i=0,a={}},e.addThrottleControl=c=>{let p=i++;return a[p]=c,p},e.removeThrottleControl=c=>{delete a[c],u()};let s=()=>{for(let c of Object.keys(a))if(a[c]())return!0;return!1};async function n(c,p,d,f,m=!0,g){let _=await c.transformRequest(p,d);return Xu(f.signal),lr.getImage(_,f,m,g)}e.transformAndGetImage=n,e.getImage=(c,p,d=!0,f)=>new Promise((m,g)=>{c.headers||(c.headers={}),c.headers.accept="image/webp,*/*",q(c,{type:"image"});let _={abortController:p,requestParameters:c,supportImageRefresh:d,imageBitmapOptions:f,state:"queued",onError:y=>{g(y)},onSuccess:y=>{m(y)}};t.push(_),u()});let o=(c,p)=>typeof createImageBitmap=="function"?m1(c,p):g1(c),l=async c=>{c.state="running";let{requestParameters:p,supportImageRefresh:d,imageBitmapOptions:f,onError:m,onSuccess:g,abortController:_}=c,y=d===!1&&!f&&!Ji(self)&&!n0(p.url)&&(!p.headers||Object.keys(p.headers).reduce((v,w)=>v&&w==="accept",!0));r++;let x=y?h(p,_):Wn(p,_);try{let v=await x;delete c.abortController,c.state="completed",v.data instanceof HTMLImageElement||ui(v.data)?g(v):v.data&&g({data:await o(v.data,f),cacheControl:v.cacheControl,expires:v.expires})}catch(v){delete c.abortController,m(ht(v))}finally{r--,u()}},u=()=>{let c=s()?_i.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:_i.MAX_PARALLEL_IMAGE_REQUESTS;for(let p=r;p<c&&t.length>0;p++){let d=t.shift();if(d.abortController.signal.aborted){p--;continue}l(d)}},h=(c,p)=>new Promise((d,f)=>{let m=new Image,g=c.url,_=c.credentials;_&&_==="include"?m.crossOrigin="use-credentials":(_&&_==="same-origin"||!l0(g))&&(m.crossOrigin="anonymous"),p.signal.addEventListener("abort",()=>{m.src="",f(new ps(p.signal.reason))}),m.fetchPriority="high",m.onload=()=>{m.onerror=m.onload=null,d({data:m})},m.onerror=()=>{m.onerror=m.onload=null,!p.signal.aborted&&f(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."))},m.src=g})})(lr||(lr={})),lr.resetRequestQueue();var u4=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},rt=class extends ds{},G=class extends rt{},Up=class extends rt{constructor(e={}){super("style.load",e)}},Zt=class extends rt{constructor(e,t={}){super(e,t),this.dataType="style"}},we=class extends rt{constructor(e,t={}){super(e,t),this.dataType="source"}},$t=class extends rt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r,i={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);let a=Oe.mousePos(t.getCanvas(),r),s=t.unproject(a);super(e,q({point:a,lngLat:s,originalEvent:r},i)),this._defaultPrevented=!1,this.target=t}},Ns=class extends rt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r){let i=e==="touchend"?r.changedTouches:r.touches,a=Oe.touchPos(t.getCanvasContainer(),i),s=a.map(l=>t.unproject(l)),n=a.reduce((l,u,h,c)=>l.add(u.div(c.length)),new M(0,0)),o=t.unproject(n);super(e,{points:a,point:n,lngLats:s,lngLat:o,originalEvent:r}),this._defaultPrevented=!1}},h4=class extends rt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}},qp=class extends rt{},c4=class extends rt{constructor(e={}){super("terrain",e)}},p4=class extends rt{constructor(e={}){super("projectiontransition",e)}},el=class extends rt{},d4=class extends rt{constructor(e={}){super("styleimagemissing",e)}};function f4(e,t){let r={};for(let i in e)i!=="ref"&&(r[i]=e[i]);return C1.forEach(i=>{i in t&&(r[i]=t[i])}),r}function Gp(e){e=e.slice();let t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=f4(e[r],t[e[r].ref]));return e}function ce(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(!ce(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(!ce(e[r],t[r]))return!1;return!0}return e===t}function Lt(e,t){e.push(t)}function pm(e,t,r){Lt(r,{command:"addSource",args:[e,t[e]]})}function dm(e,t,r){Lt(t,{command:"removeSource",args:[e]}),r[e]=!0}function m4(e,t,r,i){dm(e,r,i),pm(e,t,r)}function g4(e,t,r){let i;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&i!=="data"&&!ce(e[r][i],t[r][i]))return!1;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&i!=="data"&&!ce(e[r][i],t[r][i]))return!1;return!0}function _4(e,t,r,i){e||(e={}),t||(t={});let a;for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t,a)||dm(a,r,i));for(a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?ce(e[a],t[a])||(e[a].type==="geojson"&&t[a].type==="geojson"&&g4(e,t,a)?Lt(r,{command:"setGeoJSONSourceData",args:[a,t[a].data]}):m4(a,t,r,i)):pm(a,t,r))}function Us(e,t,r,i,a,s){e||(e={}),t||(t={});for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(ce(e[n],t[n])||r.push({command:s,args:[i,n,t[n],a]}));for(let n in t)!Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(e,n)||ce(e[n],t[n])||r.push({command:s,args:[i,n,t[n],a]})}function Zp(e){return e.id}function Wp(e,t){return e[t.id]=t,e}function y4(e,t,r){e||(e=[]),t||(t=[]);let i=e.map(Zp),a=t.map(Zp),s=e.reduce(Wp,{}),n=t.reduce(Wp,{}),o=i.slice(),l=Object.create(null),u,h,c,p,d;for(let f=0,m=0;f<i.length;f++)u=i[f],Object.prototype.hasOwnProperty.call(n,u)?m++:(Lt(r,{command:"removeLayer",args:[u]}),o.splice(o.indexOf(u,m),1));for(let f=0,m=0;f<a.length;f++)u=a[a.length-1-f],o[o.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(s,u)?(Lt(r,{command:"removeLayer",args:[u]}),o.splice(o.lastIndexOf(u,o.length-m),1)):m++,p=o[o.length-f],Lt(r,{command:"addLayer",args:[n[u],p]}),o.splice(o.length-f,0,u),l[u]=!0);for(let f=0;f<a.length;f++)if(u=a[f],h=s[u],c=n[u],!(l[u]||ce(h,c))){if(!ce(h.source,c.source)||!ce(h["source-layer"],c["source-layer"])||!ce(h.type,c.type)){Lt(r,{command:"removeLayer",args:[u]}),p=o[o.lastIndexOf(u)+1],Lt(r,{command:"addLayer",args:[c,p]});continue}for(d in Us(h.layout,c.layout,r,u,null,"setLayoutProperty"),Us(h.paint,c.paint,r,u,null,"setPaintProperty"),ce(h.filter,c.filter)||Lt(r,{command:"setFilter",args:[u,c.filter]}),(!ce(h.minzoom,c.minzoom)||!ce(h.maxzoom,c.maxzoom))&&Lt(r,{command:"setLayerZoomRange",args:[u,c.minzoom,c.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,d)&&d!=="layout"&&d!=="paint"&&d!=="filter"&&d!=="metadata"&&d!=="minzoom"&&d!=="maxzoom"&&(d.indexOf("paint.")===0?Us(h[d],c[d],r,u,d.slice(6),"setPaintProperty"):ce(h[d],c[d])||Lt(r,{command:"setLayerProperty",args:[u,d,c[d]]}));for(d in c)!Object.prototype.hasOwnProperty.call(c,d)||Object.prototype.hasOwnProperty.call(h,d)||d!=="layout"&&d!=="paint"&&d!=="filter"&&d!=="metadata"&&d!=="minzoom"&&d!=="maxzoom"&&(d.indexOf("paint.")===0?Us(h[d],c[d],r,u,d.slice(6),"setPaintProperty"):ce(h[d],c[d])||Lt(r,{command:"setLayerProperty",args:[u,d,c[d]]}))}}function v4(e,t){if(!e)return[{command:"setStyle",args:[t]}];let r=[];try{if(!ce(e.version,t.version))return[{command:"setStyle",args:[t]}];ce(e.center,t.center)||r.push({command:"setCenter",args:[t.center]}),ce(e.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),ce(e.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ce(e.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),ce(e.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),ce(e.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),ce(e.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),ce(e.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),ce(e.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),ce(e["font-faces"],t["font-faces"])||r.push({command:"setFontFaces",args:[t["font-faces"]]}),ce(e.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),ce(e.light,t.light)||r.push({command:"setLight",args:[t.light]}),ce(e.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),ce(e.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),ce(e.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});let i={},a=[];_4(e.sources,t.sources,a,i);let s=[];e.layers&&e.layers.forEach(n=>{"source"in n&&i[n.source]?r.push({command:"removeLayer",args:[n.id]}):s.push(n)}),r=r.concat(a),y4(s,t.layers,r)}catch(i){console.warn("Unable to compute style diff:",i),r=[{command:"setStyle",args:[t]}]}return r}function x4(){let e={},t=P.$version;for(let r in P.$root){let i=P.$root[r];if(i.required){let a=null;a=r==="version"?t:i.type==="array"?[]:{},a!=null&&(e[r]=a)}}return e}function dn(e){let t=[];if(typeof e=="string")t.push({id:"default",url:e});else if(e&&e.length>0){let r=[];for(let{id:i,url:a}of e){let s=`${i}${a}`;r.includes(s)||(r.push(s),t.push({id:i,url:a}))}}return t}function Hp(e,t,r){try{let i=new URL(e);return i.pathname+=`${t}${r}`,i.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function b4(e,t,r,i){let a=dn(e),s=r>1?"@2x":"",n={},o={};for(let{id:l,url:u}of a){let h=await t.transformRequest(Hp(u,s,".json"),"SpriteJSON");n[l]=Hn(h,i);let c=await t.transformRequest(Hp(u,s,".png"),"SpriteImage");o[l]=lr.getImage(c,i)}return await Promise.all([...Object.values(n),...Object.values(o)]),w4(n,o)}async function w4(e,t){let r={};for(let i in e){r[i]={};let a=At.getImageCanvasContext((await t[i]).data),s=(await e[i]).data;for(let n in s){let{width:o,height:l,x:u,y:h,sdf:c,pixelRatio:p,stretchX:d,stretchY:f,content:m,textFitWidth:g,textFitHeight:_}=s[n],y={width:o,height:l,x:u,y:h,context:a};r[i][n]={data:null,pixelRatio:p,sdf:c,stretchX:d,stretchY:f,content:m,textFitWidth:g,textFitHeight:_,spriteData:y}}}return r}var T4=class extends vt{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t,promiseResolve:r}of this.requestors)r(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let r=t.spriteData;t.data=new be({width:r.width,height:r.height},r.context.getImageData(r.x,r.y,r.width,r.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t,this._imagesIds=null,t.isWebGLImage&&this.updateImage(e,t,!1))}_validate(e,t){let r=!0,i=t.data||t.spriteData;return this._validateStretch(t.stretchX,i==null?void 0:i.width)||(this.fire(new H(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(t.stretchY,i==null?void 0:i.height)||(this.fire(new H(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(t.content,t)||(this.fire(new H(Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let r=0;for(let i of e){if(i[0]<r||i[1]<i[0]||t<i[1])return!1;r=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let r=t.spriteData,i=(r==null?void 0:r.width)||t.data.width,a=(r==null?void 0:r.height)||t.data.height;return e[0]<0||i<e[0]||e[1]<0||a<e[1]||e[2]<0||i<e[2]||e[3]<0||a<e[3]||e[2]<e[0]?!1:e[3]>=e[1]}updateImage(e,t,r=!0){let i=this.images[e];if(r){let a=i.data||i.spriteData;if(a.width!==t.data.width||a.height!==t.data.height)throw Error(`size mismatch between old image (${a.width}x${a.height}) and new image (${t.data.width}x${t.data.height}).`)}t.version=(i.version??0)+1,this.images[e]=t,this.updateVersion++}removeImage(e){var r;let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,(r=t.userImage)!=null&&r.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??(this._imagesIds=Object.keys(this.images)),this._imagesIds}_getSpriteImageId(e,t){return e==="default"?t:`${e}:${t}`}setSpriteImages(e,t){let r=this._spriteImagesIds[e]??[],i=[];for(let n in t){let o=this._getSpriteImageId(e,n);i.push(o),o in this.images?this.updateImage(o,t[n],!1):this.addImage(o,t[n])}let a=new Set(i),s=r.filter(n=>!a.has(n));for(let n of s)this.removeImage(n);return this._spriteImagesIds[e]=i,{loaded:i,removed:s}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let r of t)this.removeImage(r);return delete this._spriteImagesIds[e],t}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t of e)this.removeImage(t);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t,r)=>{let i=!0;if(!this.isLoaded())for(let a of e)this.images[a]||(i=!1);this.isLoaded()||i?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){var a;let t=new Set(e.filter(s=>!this.getImage(s))),r=this.missingImageResolver;r&&await Promise.allSettled(Array.from(t,s=>r(s)));let i={};for(let s of e){let n=this.getImage(s);n&&(t.delete(s),i[s]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,textFitWidth:n.textFitWidth,textFitHeight:n.textFitHeight,hasRenderCallback:!!((a=n.userImage)!=null&&a.render),isWebGLImage:n.isWebGLImage})}for(let s of t)this.fire(new d4({id:s})),fe(`Image "${s}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return i}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this._renderCallbacksDispatchedThisFrame[t])continue;this._renderCallbacksDispatchedThisFrame[t]=!0;let r=this.getImage(t);r||fe(`Image with ID: "${t}" was not found`),jb(r)&&this.updateImage(t,r)}}cloneImages(){let e={};for(let t in this.images){let r=this.images[t];e[t]={...r,data:r.data?r.data.clone():null}}return e}},D4=class{constructor(e){this._imageManager=e,this._entries={},this._image=new be({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&(this._texture=(this._texture.destroy(),null)),this._entries={},this._image=new be({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:e,height:t}=this._image;return{width:e,height:t}}getPattern(e){let t=this._imageManager.getImage(e);if(!t)return null;let r=this._entries[e];if((r==null?void 0:r.image)!==t){let i={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:i,position:new Sh(i,t),image:t}}else if(r.position.version!==t.version)r.position.version=t.version;else return r.position;return this._update(),this._entries[e].position}bind(e){let t=e.gl;this._texture?this._dirty&&(this._dirty=(this._texture.update(this._image),!1)):(this._texture=new Ge(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let a in this._entries)this._imageManager.getImage(a)||delete this._entries[a];let e=[];for(let a in this._entries)e.push(this._entries[a].bin);let{w:t,h:r}=I2(e),i=this._image;i.resize({width:t||1,height:r||1});for(let a in this._entries){let{bin:s}=this._entries[a],n=s.x+1,o=s.y+1,l=this._entries[a].image.data,u=l.width,h=l.height;be.copy(l,i,{x:0,y:0},{x:n,y:o},{width:u,height:h}),be.copy(l,i,{x:0,y:h-1},{x:n,y:o-1},{width:u,height:1}),be.copy(l,i,{x:0,y:0},{x:n,y:o+h},{width:u,height:1}),be.copy(l,i,{x:u-1,y:0},{x:n-1,y:o},{width:1,height:h}),be.copy(l,i,{x:0,y:0},{x:n+u,y:o},{width:1,height:h})}this._dirty=!0}};const Mu=1114111,A4={start:0,end:Mu};let E4=0;function S4(e){let t=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t){let[,a,s]=t;return a.length+s.length>6?null:Xp(parseInt(`${a}${"0".repeat(s.length)}`,16),parseInt(`${a}${"f".repeat(s.length)}`,16))}let r=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!r)return null;let i=parseInt(r[1],16);return Xp(i,r[2]===void 0?i:parseInt(r[2],16))}function Xp(e,t){return e>t||e>Mu?null:{start:e,end:Math.min(t,Mu)}}function C4(e,t){return e.ranges.some(({start:r,end:i})=>t>=r&&t<=i)}var P4=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t,r]of Object.entries(e??{})){let i=Array.isArray(r)?r:[r];this._faces[t]=i.map(a=>this._declareFontFace(t,a)).filter(a=>a!==null)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t){for(let r of e.split(","))for(let i of this._faces[r.trim()]??[])if(C4(i,t)&&(i.loaded??(i.loaded=this._loadFontFace(i)),await i.loaded))return i.family;return null}_declareFontFace(e,t){let r=typeof t=="string"?{url:t}:t;if(typeof(r==null?void 0:r.url)!="string")return fe(`Ignoring the font face declared for "${e}": it has no URL.`),null;let i=`maplibre-gl-font-face-${E4++}`,a=r["unicode-range"];if(!(a!=null&&a.length))return{url:r.url,ranges:[A4],family:i};let s=[];for(let n of a){let o=S4(n);if(!o){fe(`Ignoring the unicode range "${n}" of the font face at ${r.url}: it is not a valid range.`);continue}s.push(o)}return s.length?{url:r.url,ranges:s,family:i}:null}async _loadFontFace(e){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return fe(`Ignoring the font face at ${e.url}: this environment has no CSS Font Loading API.`),!1;let t;try{return t=new FontFace(e.family,await this._downloadFontFile(e.url)),Object.values(this._faces).some(r=>r.includes(e))?(document.fonts.add(t),this._registered.add(t),await t.load(),!0):!1}catch(r){return t&&this._unregister(t),fe(`Ignoring the font face at ${e.url}: ${ht(r).message}`),!1}}async _downloadFontFile(e){let t=await this.requestManager.transformRequest(e,"Glyphs"),r=await o0(t,new AbortController);if(!(r!=null&&r.data))throw Error(`the response was empty for the font file at ${e}`);return r.data}_unregister(e){var t;(t=document.fonts)==null||t.delete(e),this._registered.delete(e)}_unregisterAll(){var e;for(let t of this._registered)(e=document.fonts)==null||e.delete(t);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const Fu=1e20,qh=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**.45454545454545453;qh[e]=t*Math.abs(t)}qh[255]=-1e20;var I4=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:i=.25,fontFamily:a="sans-serif",fontWeight:s="normal",fontStyle:n="normal",lang:o=null}={}){this.buffer=t,this.radius=r,this.cutoff=i,this.lang=o;let l=this.size=e+t*4,u=this._createCanvas(l),h=this.ctx=u.getContext("2d",{willReadFrequently:!0});h.font=`${n} ${s} ${e}px ${a}`,h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(e,e);let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:a,actualBoundingBoxRight:s}=this.ctx.measureText(e),n=Math.ceil(r),o=Math.floor(-a),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s)-o)),u=Math.max(0,Math.min(this.size-this.buffer,n+Math.ceil(i))),h=l+2*this.buffer,c=u+2*this.buffer,p=Math.max(h*c,0),d=new Uint8ClampedArray(p),f={data:d,width:h,height:c,glyphWidth:l,glyphHeight:u,glyphTop:n,glyphLeft:o,glyphAdvance:t};if(l===0||u===0)return f;let{ctx:m,buffer:g,gridInner:_,gridOuter:y}=this;this.lang&&(m.lang=this.lang),m.clearRect(g,g,l,u),m.fillText(e,g-o,g+n);let x=m.getImageData(g,g,l,u);y.fill(Fu,0,p),_.fill(0,0,p);let v=3;for(let C=0;C<u;C++){let E=(C+g)*h+g;for(let F=0;F<l;F++,v+=4,E++){let k=x.data[v];if(k===0)continue;let B=qh[k];y[E]=Math.max(0,B),_[E]=Math.max(0,-B)}}Yp(y,0,0,h,c,h,this.f,this.v,this.z);let w=Math.min(g,1);Yp(_,g-w,g-w,l+2*w,u+2*w,h,this.f,this.v,this.z);let b=255/this.radius,A=255*(1-this.cutoff);for(let C=0;C<p;C++){let E=Math.sqrt(y[C])-Math.sqrt(_[C]);d[C]=Math.round(A-b*E)}return f}};function Yp(e,t,r,i,a,s,n,o,l){for(let u=t;u<t+i;u++)Kp(e,r*s+u,s,a,n,o,l);for(let u=r;u<r+a;u++)Kp(e,u*s+t,1,i,n,o,l)}function Kp(e,t,r,i,a,s,n){s[0]=0,n[0]=-1e20,n[1]=Fu,a[0]=e[t];for(let o=1,l=0,u=0;o<i;o++){a[o]=e[t+o*r];let h=o*o;do{let c=s[l];u=(a[o]-a[c]+h-c*c)/(o-c)/2}while(u<=n[l]&&--l>-1);l++,s[l]=o,n[l]=u,n[l+1]=Fu}for(let o=0,l=0;o<i;o++){for(;n[l+1]<o;)l++;let u=s[l],h=o-u;e[t+o*r]=a[u]+h*h}}const M4=P.layout_symbol["text-font"].default.join(","),F4=(e,t)=>{let r=new I4(e);return r.buffer=t,r};var z4=class{constructor(e,t,r,i=F4){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=r,this.fontFaceManager=new P4(e),this.createRasterizer=i}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t=[];for(let a in e)for(let s of e[a])t.push(this._getAndCacheGlyphsPromise(a,s));let r=await Promise.all(t),i={};for(let{stack:a,id:s,glyph:n}of r)i[a]||(i[a]={}),i[a][s]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return i}async _getAndCacheGlyphsPromise(e,t){var n;(n=this.entries)[e]??(n[e]={glyphs:{},requests:{},ranges:{}});let r=this.entries[e],i=r.glyphs[t];if(i!==void 0)return{stack:e,id:t,glyph:i};let a=t.codePointAt(0),s=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,a):null;return s?(i=r.glyphs[t]=await this._drawGlyph(r,e,t,s),{stack:e,id:t,glyph:i}):wu(t)?(i=r.glyphs[t]=null,{stack:e,id:t,glyph:i}):!this.url||this._charUsesLocalIdeographFontFamily(a)?(i=r.glyphs[t]=await this._drawGlyph(r,e,t),{stack:e,id:t,glyph:i}):await this._downloadAndCacheRangePromise(e,t)}async _downloadAndCacheRangePromise(e,t){var s;let r=t.codePointAt(0),i=this.entries[e],a=Math.floor(r/256);if(i.ranges[a])return{stack:e,id:t,glyph:null};(s=i.requests)[a]||(s[a]=this._loadGlyphRange(e,a));try{let n=await i.requests[a];for(let o in n)i.glyphs[String.fromCodePoint(+o)]=n[+o];return i.ranges[a]=!0,{stack:e,id:t,glyph:n[r]||null}}catch(n){let o=i.glyphs[t]=await this._drawGlyph(i,e,t);return this._warnOnMissingGlyphRange(o,a,r,ht(n)),{stack:e,id:t,glyph:o}}}async _loadGlyphRange(e,t){let r=t*256,i=r+255,a=await this.requestManager.transformRequest(this.url.replace("{fontstack}",e).replace("{range}",`${r}-${i}`),"Glyphs"),s=await o0(a,new AbortController);if(!(s!=null&&s.data))throw Error(`Could not load glyph range. range: ${t}, ${r}-${i}`);let n={};for(let o of Vb(s.data))n[o.id]=o;return n}_warnOnMissingGlyphRange(e,t,r,i){let a=t*256,s=a+255,n=r.toString(16).padStart(4,"0").toUpperCase();fe(`Unable to load glyph range ${t}, ${a}-${s}. Rendering codepoint U+${n} locally instead. ${i}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&Py(e)}async _drawGlyph(e,t,r,i){let a=(await this._getTinySDF(e,t,r,i)).draw(r),s=new RegExp("^\\p{gc=Cf}+$","u").test(r);return{id:r.codePointAt(0),bitmap:new Th({width:a.width||60,height:a.height||60},a.data),metrics:{width:s?0:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:s?0:a.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(e,t,r,i){var n;if(i){let o=wu(r),l=o?"clusterTinySDFs":"fontFaceTinySDFs";return e[l]??(e[l]={}),(n=e[l])[i]||(n[i]=this._createTinySDF(i,!1,o?3:1)),e[l][i]}let a=t===M4&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(r.codePointAt(0)),s=a?"ideographTinySDF":"tinySDF";return e[s]||(e[s]=this._createTinySDF(a?this.localIdeographFontFamily:t)),e[s]}async _createTinySDF(e,t=!0,r=1){var o;let i=e?e.split(","):[];i.push("sans-serif");let a=i.map(l=>/[-\w]+/.test(l)?l:`'${CSS.escape(l)}'`).join(","),s=t?this._fontWeight(i[0]):void 0,n=t?this._fontStyle(i[0]):"normal";if(typeof document<"u"&&((o=document.fonts)!=null&&o.load))try{await document.fonts.load(`${n} ${s||"normal"} 48px ${a}`)}catch(l){fe(`Failed to load font "${a}": ${ht(l).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(r-1)/4)),radius:16,cutoff:.25,fontFamily:a,fontWeight:s,fontStyle:n,lang:this.lang},6)}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){let t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},r;for(let[i,a]of Object.entries(t))RegExp(`\\b${i}\\b`,"i").test(e)&&(r=`${a}`);return r}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.fontFaceTinySDFs={},t.glyphs={},t.requests={},t.ranges={}}this.entries={},this.fontFaceManager.destroy()}};let k4;const R4=()=>k4||(k4=new it({anchor:new O(P.light.anchor,"anchor"),position:new O(P.light.position,"position"),color:new O(P.light.color,"color"),intensity:new O(P.light.intensity,"intensity")}));var B4=class extends vt{constructor(e,t){super(),this._transitionable=new uo(R4(),"light",t),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return p1(this.properties.get("position"))}setLight(e,t={}){if(!this._validate(xt.light,e,t))for(let r in e){let i=e[r];r.endsWith("-transition")?this._transitionable.setTransition(r.slice(0,-_h.length),i):this._transitionable.setValue(r,i)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,r){return xs(this,e,{value:t},r)}};let L4;const $4=()=>L4||(L4=new it({"sky-color":new O(P.sky["sky-color"],"sky-color"),"horizon-color":new O(P.sky["horizon-color"],"horizon-color"),"fog-color":new O(P.sky["fog-color"],"fog-color"),"fog-ground-blend":new O(P.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new O(P.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new O(P.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new O(P.sky["atmosphere-blend"],"atmosphere-blend")}));var O4=class extends vt{constructor(e,t){super(),this._transitionable=new uo($4(),"sky",t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Ae(0))}setSky(e,t={}){if(!this._validate(xt.sky,e,t)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let r in e){let i=e[r];r.endsWith("-transition")?this._transitionable.setTransition(r.slice(0,-_h.length),i):this._transitionable.setValue(r,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,r={}){return xs(this,e,{value:t},r)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},V4=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){var i;let r=e.join(",")+String(t);return(i=this.dashEntry)[r]||(i[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,r){let i=e.length%2==1,a=[],s=i?-e[e.length-1]*r:0,n=e[0]*r,o=!0;a.push({left:s,right:n,isDash:o,zeroLength:e[0]===0});let l=e[0];for(let u=1;u<e.length;u++){o=!o;let h=e[u];s=l*r,l+=h,n=l*r,a.push({left:s,right:n,isDash:o,zeroLength:h===0})}return a}addRoundDash(e,t,r){let i=t/2;for(let a=-r;a<=r;a++){let s=this.nextRow+r+a,n=this.width*s,o=0,l=e[o];for(let u=0;u<this.width;u++){u/l.right>1&&(l=e[++o]);let h=Math.abs(u-l.left),c=Math.abs(u-l.right),p=Math.min(h,c),d,f=a/r*(i+1);if(l.isDash){let m=i-Math.abs(f);d=Math.sqrt(p*p+m*m)}else d=i-Math.sqrt(p*p+f*f);this.data[n+u]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let n=e.length-1;n>=0;--n){let o=e[n],l=e[n+1];o.zeroLength?e.splice(n,1):(l==null?void 0:l.isDash)===o.isDash&&(l.left=o.left,e.splice(n,1))}let t=e[0],r=e[e.length-1];t.isDash===r.isDash&&(t.left=r.left-this.width,r.right=t.right+this.width);let i=this.width*this.nextRow,a=0,s=e[a];for(let n=0;n<this.width;n++){n/s.right>1&&(s=e[++a]);let o=Math.abs(n-s.left),l=Math.abs(n-s.right),u=Math.min(o,l),h=s.isDash?u:-u;this.data[i+n]=Math.max(0,Math.min(255,h+128))}}addDash(e,t){let r=t?7:0,i=2*r+1;if(this.nextRow+i>this.height)return fe("LineAtlas out of space"),null;let a=0;for(let n of e)a+=n;if(a!==0){let n=this.width/a,o=this.getDashRanges(e,this.width,n);t?this.addRoundDash(o,n,r):this.addRegularDash(o)}let s={y:this.nextRow+r,height:2*r,width:a};return this.nextRow+=i,this.dirty=!0,s}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};function j4(e){if(!e)return!1;let t=globalThis.location;if(!t)return!1;try{return new URL(e,t.href).origin!==t.origin}catch{return!1}}function N4(){let e=import.meta.url;if(!/^https?:/.test(e))return"";let t=e.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs";return new URL(`./${t}`,e).href}function tl(e,t){if(t)try{return new Worker(e,{type:"module"})}catch(r){console.warn("Module worker not supported, falling back to classic worker",r)}return new Worker(e)}async function U4(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);let r=await t.text(),i=new Blob([r],{type:"text/javascript"});return URL.createObjectURL(i)}function q4(e){let t=new Blob([`import ${JSON.stringify(new URL(e,import.meta.url).href)}`],{type:"text/javascript"});return URL.createObjectURL(t)}async function G4(){let e=_i.WORKER_URL||N4(),t=!(e!=null&&e.endsWith(".cjs"));if(!j4(e))return tl(e,t);if(t){let i=q4(e);try{return tl(i,t)}finally{URL.revokeObjectURL(i)}}let r=await U4(e);try{return tl(r,t)}finally{URL.revokeObjectURL(r)}}const Z4="maplibre_preloaded_worker_pool";var fm=class mm{constructor(){this.active={},this.workersPromise=null}async acquire(t){if(this.active[t]=!0,!this.workersPromise){let r=[];for(;r.length<mm.workerCount;)r.push(G4());this.workersPromise=Promise.all(r)}return(await this.workersPromise).slice()}release(t){if(delete this.active[t],this.numActive()===0&&this.workersPromise){let r=this.workersPromise;this.workersPromise=null,r.then(i=>{for(let a of i)a.terminate()})}}isPreloaded(){return!!this.active[Z4]}numActive(){return Object.keys(this.active).length}};const W4=Math.floor(At.hardwareConcurrency/2);fm.workerCount=f1(globalThis)?Math.max(Math.min(W4,3),1):1;let Jp;function gm(){return Jp||(Jp=new fm),Jp}var _m=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t,this.removed=!1,this.actorsPromise=this.initActors(t)}async initActors(e){let t=await this.workerPool.acquire(e);if(this.removed)return[];if(this.actors=t.map((r,i)=>{let a=new c3(r,e);return a.name=`Worker ${i}`,a}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(e,t){let r=await this.actorsPromise;return Promise.all(r.map(i=>i.sendAsync({type:e,data:t})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){this.actors.length===0&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.removed=!0;for(let t of this.actors)t.remove();this.actors=[],e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let r=await this.actorsPromise;for(let i of r)i.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let r of t)r.unregisterMessageHandler(e)}};let qs;function H4(){return qs||(qs=new _m(gm(),Dl),qs.registerMessageHandler("GR",(e,t,r)=>Wn(t,r))),qs}function X4(e,t){let r=Zr();return Ve(r,r,[1,1,0]),nt(r,r,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?Ri(r,r,e.calculatePosMatrix(t.toUnwrapped())):r}function Y4(e,t,r){if(e)for(let i of e){let a=t[i];if((a==null?void 0:a.source)===r&&a.type==="fill-extrusion")return!0}else for(let i in t){let a=t[i];if(a.source===r&&a.type==="fill-extrusion")return!0}return!1}function K4(e,t,r,i,a,s,n){let o=Y4((a==null?void 0:a.layers)??null,t,e.id),l=s.maxPitchScaleFactor(),u=e.tilesIn(i,l,o);u.sort(ym);let h=[];for(let c of u)h.push({wrappedTileID:c.tileID.wrapped().key,queryResults:c.tile.queryRenderedFeatures(t,r,e.getState(),c.queryGeometry,c.cameraQueryGeometry,c.scale,a,s,l,X4(s,c.tileID),n?(p,d)=>n(c.tileID,p,d):void 0)});return tT(eT(h),e)}function J4(e,t,r,i,a,s,n){let o={},l=s.queryRenderedSymbols(i),u=[];for(let h of Object.keys(l).map(Number))u.push(n[h]);u.sort(ym);for(let h of u){let c=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],t,h.bucketIndex,h.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,e);for(let p in c){o[p]||(o[p]=[]);let d=c[p];d.sort((f,m)=>{let g=h.featureSortOrder;if(g){let _=g.indexOf(f.featureIndex);return g.indexOf(m.featureIndex)-_}return m.featureIndex-f.featureIndex});for(let f of d)o[p].push(f)}}return rT(o,e,r)}function Q4(e,t){let r=e.getRenderableIds().map(s=>e.getTileByID(s)),i=[],a={};for(let s of r){let n=s.tileID.canonical.key;a[n]||(a[n]=!0,s.querySourceFeatures(i,t))}return i}function ym(e,t){let r=e.tileID,i=t.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function eT(e){let t={},r={};for(let{queryResults:i,wrappedTileID:a}of e){r[a]||(r[a]={});let s=r[a];for(let n in i){let o=i[n];s[n]||(s[n]={});let l=s[n];t[n]||(t[n]=[]);for(let u of o)l[u.featureIndex]||(l[u.featureIndex]=!0,t[n].push(u))}}return t}function tT(e,t){for(let r in e)for(let i of e[r])vm(i,t);return e}function rT(e,t,r){for(let i in e)for(let a of e[i]){let s=r[t[i].source];vm(a,s)}return e}function vm(e,t){let r=e.feature,i=t.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i}async function xm(e,t,r,i){let a=e;if(e.url?a=(await Hn(await t.transformRequest(e.url,"Source"),r)).data:await At.frameAsync(r,i),!a)return null;let s=cs(q(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(s.vectorLayerIds=a.vector_layers.map(n=>n.id)),s}var cr=class _r{constructor(t,r){t&&(r?this.setSouthWest(t).setNorthEast(r):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof K?new K(t.lng,t.lat):K.convert(t),this}setSouthWest(t){return this._sw=t instanceof K?new K(t.lng,t.lat):K.convert(t),this}extend(t){let r=this._sw,i=this._ne,a,s;if(t instanceof K)a=t,s=t;else if(t instanceof _r){if(a=t._sw,s=t._ne,!a||!s)return this}else{if(Array.isArray(t)){if(t.length===4||t.every(Array.isArray)){let n=t;return this.extend(_r.convert(n))}{let n=t;return this.extend(K.convert(n))}}return t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(K.convert(t)):this}return!r&&!i?(this._sw=new K(a.lng,a.lat),this._ne=new K(s.lng,s.lat)):(r.lng=Math.min(a.lng,r.lng),r.lat=Math.min(a.lat,r.lat),i.lng=Math.max(s.lng,i.lng),i.lat=Math.max(s.lat,i.lat)),this}getCenter(){return new K((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new K(this.getWest(),this.getNorth())}getSouthEast(){return new K(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:r,lat:i}=K.convert(t),a=this._sw.lat<=i&&i<=this._ne.lat,s=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=r&&r>=this._ne.lng),a&&s}intersects(t){if(t=_r.convert(t),!(t.getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let r=Math.abs(this.getEast()-this.getWest()),i=Math.abs(t.getEast()-t.getWest());if(r>=360||i>=360)return!0;let a=Vt(this.getWest(),-180,180),s=Vt(this.getEast(),-180,180),n=Vt(t.getWest(),-180,180),o=Vt(t.getEast(),-180,180),l=a>s,u=n>o;return l&&u?!0:l?o>=a||n<=s:u?s>=n||a<=o:n<=s&&o>=a}static convert(t){return t instanceof _r||!t?t:new _r(t)}static fromLngLat(t,r=0){let i=360*r/40075017,a=i/Math.cos(Math.PI/180*t.lat);return new _r(new K(t.lng-a,t.lat-i),new K(t.lng+a,t.lat+i))}adjustAntiMeridian(){let t=new K(this._sw.lng,this._sw.lat),r=new K(this._ne.lng,this._ne.lat);return t.lng>r.lng?new _r(t,new K(r.lng+360,r.lat)):new _r(t,r)}},bm=class{constructor(e,t,r){this.bounds=cr.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=r||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=2**e.z,r={minX:Math.floor(oa(this.bounds.getWest())*t),minY:Math.floor(la(this.bounds.getNorth())*t),maxX:Math.ceil(oa(this.bounds.getEast())*t),maxY:Math.ceil(la(this.bounds.getSouth())*t)};return e.x>=r.minX&&e.x<r.maxX&&e.y>=r.minY&&e.y<r.maxY}},iT=class extends vt{constructor(e,t,r,i){if(super(),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,q(this,cs(t,["url","scheme","tileSize","promoteId","encoding"])),this._options=q({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(i)}async load(e=!1){this._loaded=!1,this.fire(new we("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await xm(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(q(this,t),t.bounds&&(this.tileBounds=new bm(t.bounds,this.minzoom,this.maxzoom)),this.fire(new we("data",{sourceDataType:"metadata"})),this.fire(new we("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,Nr(t)||this.fire(new H(ht(t)))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null))}serialize(){return q({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:await this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};r.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete();let i="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getReadyActor(),i="LT";else if(e.state==="loading")return new Promise((a,s)=>{e.reloadPromise={resolve:a,reject:s}});e.abortController=new AbortController;try{let a=await e.actor.sendAsync({type:i,data:r},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,a);let s={};return a!=null&&a.etagUnmodified&&(s.unmodified=!0),s}catch(a){if(delete e.abortController,e.aborted||Nr(a))return;if(a&&a.status!==404)throw a;this._afterTileLoadWorkerResponse(e,null)}}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,r=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:await this.map._requestManager.transformRequest(r,"Tile")}}_afterTileLoadWorkerResponse(e,t){if(t!=null&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t==null?void 0:t.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let r=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(r.resolve).catch(r.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},wm=class extends vt{constructor(e,t,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=q({type:"raster"},t),q(this,cs(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new we("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await xm(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(q(this,t),t.bounds&&(this.tileBounds=new bm(t.bounds,this.minzoom,this.maxzoom)),this.fire(new we("data",{sourceDataType:"metadata"})),this.fire(new we("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,Nr(t)||this.fire(new H(ht(t)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null))}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null)),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return q({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this._premultiplyAlpha,i=r?void 0:{premultiplyAlpha:"none"};e.abortController=new AbortController;try{let a=await lr.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,i);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(a!=null&&a.data){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let s=this.map.painter.context,n=s.gl,o=a.data;e.texture=this.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0,premultiply:r}):(e.texture=new Ge(s,o,n.RGBA,{useMipmap:!0,premultiply:r}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}},aT=class extends wm{constructor(e,t,r,i){super(e,t,r,i),this.type="raster-dem",this.maxzoom=22,this._options=q({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let r=await lr.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete e.abortController,e.aborted){e.state="unloaded";return}if(r!=null&&r.data){let i=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let a=ui(i)&&Yd()?i:await this.readImageNow(i),s={type:this.type,uid:e.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!=="expired"&&e.state!=="reloading")return;await this.dispatcher.waitForInitComplete(),(!e.actor||e.state==="expired")&&(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:"LDT",data:s}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state="loaded"}}catch(r){if(delete e.abortController,e.aborted)e.state="unloaded";else if(r)throw e.state="errored",r}}async readImageNow(e){if(typeof VideoFrame<"u"&&Mg()){let t=e.width+2,r=e.height+2;try{return new be({width:t,height:r},await y1(e,-1,-1,t,r))}catch{}}return At.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,r=2**t.z,i=(t.x-1+r)%r,a=t.x===0?e.wrap-1:e.wrap,s=(t.x+1+r)%r,n=t.x+1===r?e.wrap+1:e.wrap,o={};return o[new st(e.overscaledZ,a,t.z,i,t.y).key]={backfilled:!1},o[new st(e.overscaledZ,n,t.z,s,t.y).key]={backfilled:!1},t.y>0&&(o[new st(e.overscaledZ,a,t.z,i,t.y-1).key]={backfilled:!1},o[new st(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},o[new st(e.overscaledZ,n,t.z,s,t.y-1).key]={backfilled:!1}),t.y+1<r&&(o[new st(e.overscaledZ,a,t.z,i,t.y+1).key]={backfilled:!1},o[new st(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},o[new st(e.overscaledZ,n,t.z,s,t.y+1).key]={backfilled:!1}),o}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};function zu(e,t){return t?e.properties[t]:e.id}function sT(e,t){let r=new Map;if(e==null||e.type==null)return r;if(e.type==="Feature"){let i=zu(e,t);return i==null?void 0:(r.set(i,e),r)}if(e.type==="FeatureCollection"){let i=new Set;for(let a of e.features){let s=zu(a,t);if(s==null||i.has(s))return;i.add(s),r.set(s,a)}return r}}function nT(e,t,r){var a,s;let i=[];if(t.removeAll)e.clear();else if(t.remove)for(let n of t.remove){let o=e.get(n);o&&(i.push(o.geometry),e.delete(n))}if(t.add)for(let n of t.add){let o=zu(n,r);if(o==null)continue;let l=e.get(o);l&&i.push(l.geometry),i.push(n.geometry),e.set(o,n)}if(t.update)for(let n of t.update){let o=e.get(n.id);if(!o)continue;let l=!!n.newGeometry,u=n.removeAllProperties||((a=n.removeProperties)==null?void 0:a.length)>0||((s=n.addOrUpdateProperties)==null?void 0:s.length)>0;if(!l&&!u)continue;i.push(o.geometry);let h={...o};if(e.set(n.id,h),l&&(i.push(n.newGeometry),h.geometry=n.newGeometry),u){if(h.properties=n.removeAllProperties?{}:{...h.properties||{}},n.removeProperties)for(let c of n.removeProperties)delete h.properties[c];if(n.addOrUpdateProperties)for(let{key:c,value:p}of n.addOrUpdateProperties)h.properties[c]=p}}return i}function oT(e,t,r){if(!e)return t||{};if(!t)return e||{};let i=Qp(e),a=Qp(t);lT(i,a);let s={};if((i.removeAll||a.removeAll)&&(s.removeAll=!0),s.remove=new Set([...i.remove,...a.remove]),s.add=new Map([...i.add,...a.add]),s.update=new Map([...i.update,...a.update]),s.remove.size&&s.add.size)for(let o of s.add.keys())s.remove.delete(o);return hT(s)}function lT(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let r of t.remove)e.add.delete(r),e.update.delete(r);for(let[r,i]of t.update){let a=e.update.get(r);a&&(t.update.set(r,uT(a,i)),e.update.delete(r))}}function uT(e,t){let r={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let i of t.removeProperties){let a=e.addOrUpdateProperties.findIndex(s=>s.key===i);a>-1&&e.addOrUpdateProperties.splice(a,1)}return(e.removeAllProperties||t.removeAllProperties)&&(r.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(r.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(r.newGeometry=t.newGeometry||e.newGeometry),r}function Qp(e){var r,i;if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map((r=e.add)==null?void 0:r.map(a=>[a.id,a])),t.update=new Map((i=e.update)==null?void 0:i.map(a=>[a.id,a])),t}function hT(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}function Tm(e){return!e||e.length===0?[]:typeof e[0]=="number"?[e]:e.flatMap(t=>Tm(t))}function fn(e){return e.type==="GeometryCollection"?e.geometries.flatMap(t=>fn(t)):Tm(e.coordinates)}function ed(e){let t=new cr,r;switch(e.type){case"FeatureCollection":r=e.features.flatMap(i=>fn(i.geometry));break;case"Feature":r=fn(e.geometry);break;default:r=fn(e)}if(r.length===0)return t;for(let i of r){let[a,s]=i;t.extend([a,s])}return t}function cT({x:e,y:t,z:r},i=0){let a=xu((e-i)/2**r),s=ls((t+1+i)/2**r),n=xu((e+1+i)/2**r),o=ls((t-i)/2**r);return new cr([a,s],[n,o])}var pT=class extends vt{constructor(e,t,r,i){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:t.data},this.actorPromise=r.getActor(),this.setEventedParent(i),this._data=typeof t.data=="string"?{url:t.data}:{geojson:t.data},this._options=q({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&fe(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=q({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer===void 0?128:t.buffer),tolerance:this._pixelsToTileUnits(t.tolerance===void 0?.375:t.tolerance),extent:z,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1,promoteId:typeof t.promoteId=="string"?t.promoteId:void 0,cluster:t.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:z,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1}},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(z/this.tileSize)}_tileUnitsToPixels(e){return e/(z/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||fe(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t}"`),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=typeof e=="string"?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e},this._updateWorkerData()}updateData(e){return this._pendingWorkerUpdate.diff=oT(this._pendingWorkerUpdate.diff,e),this._updateWorkerData()}async getData(){return this._data.url&&await this.once("data"),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return ed(await this.getData())}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:e,clusterOptions:t}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t.maxZoom,clusterRadius:this._tileUnitsToPixels(t.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t,r){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:r}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate()){fe(`No pending worker updates for GeoJSONSource ${this.id}.`);return}let{data:e,diff:t,updateCluster:r}=this._pendingWorkerUpdate,i=this._getLoadGeoJSONParameters(e,t,r);e===void 0?t?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(i),await this._updatePromise}async _getLoadGeoJSONParameters(e,t,r){let i=q({type:this.type,source:this.id},this.workerOptions);if(typeof e=="string")return i.request=await this.map._requestManager.transformRequest(At.resolveURL(e),"Source"),i.request.collectResourceTiming=this._collectResourceTiming,i;if(e!==void 0)return i.data=e,i;if(t)return i.dataDiff=t,i;if(r)return i.updateCluster=!0,i}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=!0,this.fire(new we("dataloading"));try{let t=await e,r=await(await this.actorPromise).sendAsync({type:"LD",data:t});if(this._isUpdatingWorker=!1,this._removed||r.abandoned){this.fire(new we("dataabort"));return}r.data&&(this._data={geojson:r.data});let i=this._applyDiffToSource(t.dataDiff),a=this._getShouldReloadTileOptions(i),s={};this._applyResourceTiming(s,r),this.fire(new we("data",{...s,sourceDataType:"metadata"})),this.fire(new we("data",{...s,sourceDataType:"content",shouldReloadTileOptions:a}))}catch(t){if(this._isUpdatingWorker=!1,this._removed){this.fire(new we("dataabort"));return}this.fire(new H(ht(t)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t){var a;if(!this._collectResourceTiming)return;let r=(a=t.resourceTiming)==null?void 0:a[this.id];if(!r)return;let i=r.slice(0);i!=null&&i.length&&q(e,{resourceTiming:i})}_applyDiffToSource(e){if(!e)return;let t=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let i=sT(this._data.geojson,t);if(!i)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:i}}if(!this._data.updateable)return;let r=nT(this._data.updateable,e,t);if(!(e.removeAll||this._options.cluster))return r}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(t=>ed(t))}}shouldReloadTile(e,{affectedBounds:t}){if(e.state==="loading")return!0;if(e.state==="unloaded")return!1;let{buffer:r,extent:i}=this.workerOptions.geojsonVtOptions,a=cT(e.tileID.canonical,r/i);for(let s of t)if(a.intersects(s))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=await this.actorPromise;let r={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;try{let i=await(await this.actorPromise).sendAsync({type:t,data:r},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(i,this.map.painter,t==="RT")}catch(i){if(delete e.abortController,e.aborted||Nr(i))return;throw i}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(e=>e.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return q({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};const Xi=[0,0,1],dT=(e,t)=>({u_tl_parent:new Y(e,t.u_tl_parent),u_scale_parent:new L(e,t.u_scale_parent),u_buffer_scale:new L(e,t.u_buffer_scale),u_image_warp:new Dt(e,t.u_image_warp),u_fade_t:new L(e,t.u_fade_t),u_opacity:new L(e,t.u_opacity),u_image0:new W(e,t.u_image0),u_image1:new W(e,t.u_image1),u_brightness_low:new L(e,t.u_brightness_low),u_brightness_high:new L(e,t.u_brightness_high),u_saturation_factor:new L(e,t.u_saturation_factor),u_contrast_factor:new L(e,t.u_contrast_factor),u_spin_weights:new Dt(e,t.u_spin_weights),u_coords_top:new qr(e,t.u_coords_top),u_coords_bottom:new qr(e,t.u_coords_bottom)}),fT=(e,t,r,i,a,s)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:s,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:_T(i.paint.get("raster-saturation")),u_contrast_factor:gT(i.paint.get("raster-contrast")),u_spin_weights:mT(i.paint.get("raster-hue-rotate")),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y]});function mT(e){e*=Math.PI/180;let t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}function gT(e){return e>0?1/(1-e):1+e}function _T(e){return e>0?1-1/(1.001-e):-e}var As=class{constructor(e,t,r){this.vertexBuffer=e,this.indexBuffer=t,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const li=Ce([{name:"a_pos",type:"Int16",components:2}]),Gs=z/128;function Dm(e,t){let r=yT(t,"16bit"),i=$r.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),a=fr.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new As(e.createVertexBuffer(i,li.members),e.createIndexBuffer(a),De.simpleSegment(0,0,i.length,a.length))}function yT(e,t){let r=e.granularity===void 0?1:Math.max(e.granularity,1),i=r+(e.generateBorders?2:0),a=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),s=i+1,n=a+1,o=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=r+ +!!e.generateBorders,h=r+(e.generateBorders||e.extendToSouthPole?1:0),c=s*n,p=i*a*6,d=s*n>65536;if(d&&t==="16bit")throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=d||t==="32bit",m=new Int16Array(c*2),g=0;for(let x=l;x<=h;x++)for(let v=o;v<=u;v++){let w=v/r*z;v===-1&&(w=-Gs),v===r+1&&(w=z+Gs);let b=x/r*z;x===-1&&(b=e.extendToNorthPole?Ua:-Gs),x===r+1&&(b=e.extendToSouthPole?qa:z+Gs),m[g++]=w,m[g++]=b}let _=f?new Uint32Array(p):new Uint16Array(p),y=0;for(let x=0;x<a;x++)for(let v=0;v<i;v++){let w=v+x*s,b=v+1+x*s,A=v+(x+1)*s,C=v+1+(x+1)*s;_[y++]=w,_[y++]=A,_[y++]=b,_[y++]=b,_[y++]=A,_[y++]=C}return{vertices:m.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}var Es=class extends vt{constructor(e,t,r,i){super(),this.imageWarp=Xi,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=t}async load(e){if(this.options.url===void 0){this._loaded=!0,this._finishLoading();return}this._loaded=!1,this.fire(new we("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let t=await lr.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,t!=null&&t.data&&(this._setImage(t.data),e&&(this.coordinates=e),this._finishLoading())}catch(t){if(Nr(t))return;this._abortController=null,this._loaded=!0,this.fire(new H(ht(t)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&(this._abortController=(this._abortController.abort(),null)),"image"in e?(this._loaded=!0,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):e.url?(this.options.url=e.url,this.load(e.coordinates),this):this}_setImage(e){this.image=e,this._imageDirty=!0}getMesh(e,t){return!this._subdividedQuad||t?null:(this._subdividedMesh??(this._subdividedMesh=Dm(e,{granularity:16})),this._subdividedMesh)}_disposeTexture(){var e;(e=this.texture)==null||e.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new we("data",{sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){var e;this._abortController&&(this._abortController=(this._abortController.abort(),null)),this._disposeTexture(),(e=this._subdividedMesh)==null||e.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e?this:(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates),this)}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t=e.map(de.fromLngLat);return this.tileID=vT(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(r=>this.tileID.getTilePoint(r)._round()),this.imageWarp=bT(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!Am(this.tileCoords),this.flippedWindingOrder=xT(this.tileCoords),this.fire(new we("data",{sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)):(this.texture=new Ge(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let r=!1;for(let i in this.tiles){let a=this.tiles[i];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,r=!0)}r&&this.fire(new we("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){var t;(t=this.tileID)!=null&&t.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){let e={type:"image",coordinates:this.coordinates};return this.options.url!==void 0&&(e.url=this.options.url),e}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:r,maxX:i,maxY:a}=or.fromPoints(e),s={};for(let n=0;n<=25;n++){let o=2**n,l=Math.floor(t*o),u=Math.floor(r*o),h=Math.floor(i*o),c=Math.floor(a*o),p=(l%o+o)%o,d=h%o,f=Math.floor(l/o),m=Math.floor(h/o);s[n]={minWrap:f,maxWrap:m,minTileXWrapped:p,maxTileXWrapped:d,minTileY:u,maxTileY:c}}return s}};function vT(e){let t=or.fromPoints(e),r=t.width(),i=t.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(r,i))/Math.LN2)),s=2**a;return new _o(a,Math.floor((t.minX+t.maxX)/2*s),Math.floor((t.minY+t.maxY)/2*s))}function xT(e){let t=e[1].x-e[0].x,r=e[1].y-e[0].y,i=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-r*i<0}function bT(e,t){if(t==="flat"||Am(e))return Xi;let[r,i,a,s]=e,n=r.x-i.x+a.x-s.x,o=r.y-i.y+a.y-s.y,l=[i.x-a.x,i.y-a.y,s.x-a.x,s.y-a.y],[u,h,c,p]=l,d=n4(l),f=(n*p-c*o)/d,m=(u*o-n*h)/d,g=[1,1+f,1+f+m,1+m],_=Math.max(...g)/Math.min(...g),y=t==="perspective"?0:wT(_);return!(_>=1&&_<=512)||y>=1?Xi:[f,m,y]}function wT(e){let t=(1-4/e)/.9921875;return Math.max(0,t)}function Am(e){let[t,r,i,a]=e;return t.x+i.x===r.x+a.x&&t.y+i.y===r.y+a.y}var TT=class extends Es{constructor(e,t,r,i){super(e,t,r,i),this._onPlayingHandler=()=>{var a;(a=this.map)==null||a.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((await this.map._requestManager.transformRequest(t,"Source")).url);try{let t=await S1(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new H(ht(t)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new H(new R(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new Ge(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let r=!1;for(let i in this.tiles){let a=this.tiles[i];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,r=!0)}r&&this.fire(new we("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},DT=class extends Es{constructor(e,t,r,i){super(e,t,r,i),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(a=>!Array.isArray(a)||a.length!==2||a.some(s=>typeof s!="number")))&&this.fire(new H(new R(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new H(new R(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new H(new R(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new H(new R(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new H(new R(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}async load(){if(this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new H(Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this._playing=(this.prepare(),!1))},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,r=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new Ge(t,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let a in this.tiles){let s=this.tiles[a];s.state!=="loaded"&&(s.state="loaded",s.texture=this.texture,i=!0)}i&&this.fire(new we("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};const AT={},ET=(e,t,r,i)=>{let a=new(ST(t.type))(e,t,r,i);if(a.id!==e)throw Error(`Expected Source id to be ${e} instead of ${a.id}`);return a},ST=e=>{switch(e){case"geojson":return pT;case"image":return Es;case"raster":return wm;case"raster-dem":return aT;case"vector":return iT;case"video":return TT;case"canvas":return DT}return AT[e]};function CT(e,t){let r={};if(!t)return r;for(let i of e){let a=i.layerIds.map(s=>t.getLayer(s)).filter(Boolean);if(a.length!==0){i.layers=a,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(s=>a.filter(n=>n.id===s)[0]));for(let s of a)r[s.id]=i}}return r}const ku="RTLPluginLoaded";var PT=class extends vt{constructor(...e){super(...e),this.status="unavailable",this.url=null,this.dispatcher=H4()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=At.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status==="unavailable")if(t)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new ds(ku))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}};let td=null;function Ru(){return td||(td=new PT),td}var Em=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t0(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:r,fadeEndTime:i}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=r,this.fadeEndTime=i}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=ge(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t,r){return this.rttObjects[t]=e.acquireRTT(r)}releaseRTT(e){if(this.rttObjects.length!==0){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}loadVectorData(e,t,r){if((e==null?void 0:e.etagUnmodified)===!0){this.state="loaded";return}if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new $f;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=CT(e.buckets,t==null?void 0:t.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let a=this.buckets[i];if(a instanceof Zi)if(this.hasSymbolBuckets=!0,r)a.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let a=this.buckets[i];if(a instanceof Zi&&a.hasRTLText){this.hasRTLText=!0,Ru().lazyLoad();break}}this.queryPadding=0;for(let i in this.buckets){let a=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(i).queryRadius(a))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let r in this.buckets){let i=this.buckets[r];i.uploadPending()&&i.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ge(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasImage=(this.glyphAtlasTexture=new Ge(e,this.glyphAtlasImage,t.ALPHA),null))}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,r,i,a,s,n,o,l,u,h){var c;return(c=this.latestFeatureIndex)!=null&&c.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:a,scale:s,tileSize:this.tileSize,pixelPosMatrix:u,transform:o,params:n,queryPadding:this.queryPadding*l,getElevation:h},e,t,r):{}}querySourceFeatures(e,t){let r=this.latestFeatureIndex;if(!(r!=null&&r.rawTileData))return;let i=r.loadVTLayers(),a=t!=null&&t.sourceLayer?t.sourceLayer:"",s=i._geojsonTileLayer||i[a];if(!s)return;let n=Qa(t==null?void 0:t.filter,`querySourceFeatures[${a}].filter`,t==null?void 0:t.globalState),{z:o,x:l,y:u}=this.tileID.canonical,h={z:o,x:l,y:u};for(let c=0;c<s.length;c++){let p=s.feature(c);if(n.needGeometry){let m=Ei(p,!0);if(!n.filter(new Ae(this.tileID.overscaledZ),m,this.tileID.canonical))continue}else if(!n.filter(new Ae(this.tileID.overscaledZ),p))continue;let d=r.getId(p,a),f=new R2(p,o,l,u,d);f.tile=h,e.push(f)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let r=d1(e.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+r["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let r=Date.now(),i=!1;if(this.expirationTime>r)i=!1;else if(!t)i=!0;else if(this.expirationTime<t)i=!0;else{let a=this.expirationTime-t;a?this.expirationTime=r+Math.max(a,3e4):i=!0}i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),2**31-1)}setFeatureState(e,t,r){var a,s,n;if(!((a=this.latestFeatureIndex)!=null&&a.rawTileData)||Object.keys(e).length===0||this.featureStateRevision===r)return;this.featureStateRevision=r;let i=this.latestFeatureIndex.loadVTLayers();for(let o in this.buckets){if(!t.style.hasLayer(o))continue;let l=this.buckets[o],u=l.layers[0].sourceLayer||"_geojsonTileLayer",h=i[u],c=e[u];if(!h||!c||c.length===0)continue;l.update(c,h,((s=this.imageAtlas)==null?void 0:s.patternPositions)||{},this.dashPositions||{});let p=(n=t==null?void 0:t.style)==null?void 0:n.getLayer(o);p&&(this.queryPadding=Math.max(this.queryPadding,p.queryRadius(l)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ge()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=ge()+e}setDependencies(e,t){let r={};for(let i of t)r[i]=!0;this.dependencies[e]=r}hasDependency(e,t){for(let r of e){let i=this.dependencies[r];if(i){for(let a of t)if(i[a])return!0}}return!1}};function rd(e){let t=[];for(let r in e)t.push({id:r,state:e[r]});return t}var IT=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,r){var a,s,n,o,l;let i=String(t);if((a=this.stateChanges)[e]||(a[e]={}),(s=this.stateChanges[e])[i]||(s[i]={}),q(this.stateChanges[e][i],r),this.deletedStates[e]===null){this.deletedStates[e]={};for(let u in this.state[e])if(u===i){this.deletedStates[e][i]={};for(let h in this.state[e][u])r[h]===void 0&&(this.deletedStates[e][i][h]=null)}else this.deletedStates[e][u]=null}else if(((n=this.deletedStates[e])==null?void 0:n[i])===null){this.deletedStates[e][i]={};for(let u in this.state[e][i])r[u]===void 0&&(this.deletedStates[e][i][u]=null)}else for(let u in r)((l=(o=this.deletedStates[e])==null?void 0:o[i])==null?void 0:l[u])===null&&delete this.deletedStates[e][i][u]}removeFeatureState(e,t,r){var a,s,n;if(this.deletedStates[e]===null)return;let i=String(t);if((a=this.deletedStates)[e]||(a[e]={}),r&&t!==void 0)this.deletedStates[e][i]!==null&&((s=this.deletedStates[e])[i]||(s[i]={}),this.deletedStates[e][i][r]=null);else if(t!==void 0)if((n=this.stateChanges[e])!=null&&n[i])for(r in this.deletedStates[e][i]={},this.stateChanges[e][i])this.deletedStates[e][i][r]=null;else this.deletedStates[e][i]=null;else this.deletedStates[e]=null}getState(e,t){let r=String(t),i=this.state[e]||{},a=this.stateChanges[e]||{},s=q({},i[r],a[r]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let n=this.deletedStates[e][t];if(n===null)return{};for(let o in n)delete s[o]}return s}initializeTileState(e,t){let r={};for(let i in this.state)r[i]=rd(this.state[i]);e.setFeatureState(r,t,this.revision)}coalesceChanges(e,t){var a,s,n;let r={};for(let o in this.stateChanges){(a=this.state)[o]||(a[o]={}),r[o]||(r[o]={});for(let l in this.stateChanges[o])(s=this.state[o])[l]||(s[l]={}),q(this.state[o][l],this.stateChanges[o][l]),r[o][l]=this.state[o][l]}for(let o in this.deletedStates)if((n=this.state)[o]||(n[o]={}),r[o]||(r[o]={}),this.deletedStates[o]===null)for(let l in this.state[o])this.state[o][l]={},r[o][l]={};else for(let l in this.deletedStates[o]){if(this.deletedStates[o][l]===null)this.state[o][l]={};else for(let u of Object.keys(this.deletedStates[o][l]))delete this.state[o][l][u];r[o][l]=this.state[o][l]}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length===0)return;this.revision++;let i={};for(let o in r)i[o]=rd(r[o]);e.setFeatureState(i,t,this.revision)}};function MT(e,t,r){let i=t.intersectsFrustum(e);if(!r||i===0)return i;let a=t.intersectsPlane(r);return a===0?0:i===2&&a===2?2:1}function id(e,t,r){let i=0,a=(r-t)/10;for(let s=0;s<10;s++){let n=t+(s+.5)/10*(r-t);i+=a*Math.cos(n)**+e}return i}function Bu(e,t){return function(r,i,a,s,n){let o=2*((e-1)/ft(Math.cos(Be(pi-n))/Math.cos(Be(pi)))-1),l=Math.acos(a/s),u=2*id(o-1,0,Be(n/2)),h=Math.min(Be(pi),l+Be(n/2)),c=Math.min(h,l-Be(n/2)),p=id(o-1,c,h),d=Math.atan(i/a),f=Math.hypot(i,a),m=r;return m+=ft(s/f/Math.max(.5,Math.cos(Be(n/2)))),m+=o*ft(Math.cos(d))/2,m-=ft(Math.max(1,p/u/t))/2,m}}const FT=Bu(9.314,3);function Gh(e,t){let r=(t.roundZoom?Math.round:Math.floor)(e.zoom+ft(e.tileSize/t.tileSize));return Math.max(0,r)}function zT(e){let t=pi-e.pitch-e.fov/2,r=te((15-t)/15,0,1);return e.elevation+r*500}function da(e,t){let r=e.getCameraFrustum(),i=e.getClippingPlane(),a=T2(e),s=de.fromLngLat(e.center,e.elevation),n=zT(e),o=e.getCoveringTilesDetailsProvider(),l=o.allowVariableZoom(e,t),u=Gh(e,t),h=t.minzoom||0,c=t.maxzoom===void 0?e.maxZoom:t.maxzoom,p=Math.min(Math.max(0,u),c),d=2**p,f=[d*a.x,d*a.y,0],m=[d*s.x,d*s.y,0],g=Math.hypot(s.x-a.x,s.y-a.y),_=Math.abs(s.z-a.z),y=Math.hypot(g,_),x=b=>({zoom:0,x:0,y:0,wrap:b,fullyVisible:!1}),v=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let b=1;b<=3;b++)v.push(x(-b)),v.push(x(b));for(v.push(x(0));v.length>0;){let b=v.pop(),A=b.x,C=b.y,E=b.fullyVisible,F={x:A,y:C,z:b.zoom},k=o.getTileBoundingVolume(F,b.wrap,n,t);if(!E){let T=MT(r,k,i);if(T===0)continue;E=T===2}let B=o.distanceToTile2d(a.x,a.y,F,k),I=u;l&&(I=(t.calculateTileZoom||FT)(e.zoom+ft(e.tileSize/t.tileSize),B,_,y,e.fov)),I=(t.roundZoom?Math.round:Math.floor)(I),I=Math.max(0,I);let D=Math.min(I,c);if(b.wrap=o.getWrap(s,F,b.wrap),b.zoom>=D){if(b.zoom<h)continue;let T=p-b.zoom,S=f[0]-.5-(A<<T),j=f[1]-.5-(C<<T),N=t.reparseOverscaled?Math.max(b.zoom,I):b.zoom;w.push({tileID:new st(b.zoom===c?N:b.zoom,b.wrap,b.zoom,A,C),distanceSq:i1([m[0]-.5-A,m[1]-.5-C]),tileDistanceToCamera:Math.sqrt(S*S+j*j)});continue}for(let T=0;T<4;T++){let S=(A<<1)+T%2,j=(C<<1)+(T>>1),N=b.zoom+1;v.push({zoom:N,x:S,y:j,wrap:b.wrap,fullyVisible:E})}}return w.sort((b,A)=>b.distanceSq-A.distanceSq).map(b=>b.tileID)}function ad(e){return e==="raster"||e==="image"||e==="video"}function kT(e,t,r,i,a,s,n){let o=ge(),l=n1(t);for(let u of t){let h=e.getTileById(u.key);(h.fadingDirection===0||h.fadeOpacity===0)&&h.resetFadeLogic(),!RT(e,h,r,o,i,a,n)&&(BT(e,h,r,o,s,n)||LT(h,l,o,n)||h.resetFadeLogic())}}function RT(e,t,r,i,a,s,n){if(!t.hasData())return!1;let{tileID:o,fadingRole:l,fadingDirection:u,fadingParentID:h}=t;if(l===0&&u===1&&h)return r[h.key]=h,!0;let c=Math.max(o.overscaledZ-a,s);for(let p=o.overscaledZ-1;p>=c;p--){let d=o.scaledTo(p),f=e.getLoadedTile(d);if(f)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:f.tileID,fadeEndTime:i+n}),f.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:i+n}),r[d.key]=d,!0}return!1}function BT(e,t,r,i,a,s){if(!t.hasData())return!1;let n=t.tileID.children(a),o=sd(e,t,n,r,i,a,s);if(o)return!0;for(let l of n)sd(e,t,l.children(a),r,i,a,s)&&(o=!0);return o}function sd(e,t,r,i,a,s,n){if(r[0].overscaledZ>=s)return!1;let o=!1;for(let l of r){let u=e.getLoadedTile(l);if(!u)continue;let{fadingRole:h,fadingDirection:c,fadingParentID:p}=u;(h!==0||c!==0||!p)&&(u.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:a+n}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:a+n})),i[l.key]=l,o=!0}return o}function LT(e,t,r,i){let a=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(a)){let s=r+i;return e.setSelfFadeLogic(s),!0}return!1}function $T(e,t){if(t<=0)return!1;let r=ge();for(let i of e.getAllTiles())if(i.fadeEndTime>=r)return!0;return!1}function OT(e,t){var i,a,s;let r=t.getRenderableIds();for(let n of r){if(!((i=e.neighboringTiles)!=null&&i[n]))continue;let o=t.getTileById(n);e.neighboringTiles[n].backfilled||nd(e,o),!((s=(a=o.neighboringTiles)==null?void 0:a[e.tileID.key])!=null&&s.backfilled)&&nd(o,e)}}function nd(e,t){var n;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,i=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,s=t.tileID.key;(r!==0||i!==0)&&(Math.abs(i)>1||(Math.abs(r)>1&&(Math.abs(r+a)===1?r+=a:Math.abs(r-a)===1&&(r-=a)),!(!t.dem||!e.dem)&&(e.dem.backfillBorder(t.dem,r,i),(n=e.neighboringTiles)!=null&&n[s]&&(e.neighboringTiles[s].backfilled=!0))))}var od=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let r in this._tiles){let i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),t[i.tileID.key]=i}this._tiles=t}setFeatureState(e,t,r){for(let i in this._tiles)this._tiles[i].setFeatureState(e,t,r)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(t=>t.tileID).sort(Ep).map(t=>t.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t!=null&&t.hasData()?t:null}isIdRenderable(e,t=!1){var r;return(r=this.getTileById(e))==null?void 0:r.isRenderable(t)}getRenderableIds(e=0,t){let r=[];for(let i of this.getAllIds())this.isIdRenderable(i,t)&&r.push(this.getTileById(i));return t?r.sort((i,a)=>{let s=i.tileID,n=a.tileID,o=new M(s.canonical.x,s.canonical.y)._rotate(-e),l=new M(n.canonical.x,n.canonical.y)._rotate(-e);return s.overscaledZ-n.overscaledZ||l.y-o.y||l.x-o.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(Ep).map(i=>i.key)}},Ar,Lu=(Ar=class extends vt{constructor(t,r,i){super(),this.id=t,this.dispatcher=i,this.on("data",a=>{this._dataHandler(a)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=ET(t,r,i,this),this._inViewTiles=new od,this._outOfViewCache=new e4(0,a=>this._unloadTile(a)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new IT,this._didEmitContent=!1,this._updated=!1}onAdd(t){var r;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,(r=this._source)!=null&&r.onAdd&&this._source.onAdd(t)}onRemove(t){var r;for(let i of this._inViewTiles.getAllTiles())i.unloadVectorData();this.clearTiles(),(r=this._source)!=null&&r.onRemove&&this._source.onRemove(t),this._inViewTiles=new od}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,r,i,a){try{let s=await this._source.loadTile(t);this._tileLoaded(t,r,i,a,s)}catch(s){t.state="errored",s.status===404?this.update(this.transform,this.terrain):this._source.fire(new H(ht(s),{tile:t}))}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new we("dataabort",{tile:t,coord:t.tileID}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let r of this._inViewTiles.getAllTiles())r.upload(t),r.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var r;return this._inViewTiles.getRenderableIds((r=this.transform)==null?void 0:r.bearingInRadians,t)}hasRenderableParent(t){let r=t.overscaledZ-1;if(r>=this._source.minzoom){let i=this.getLoadedTile(t.scaledTo(r));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(t,r=void 0){if(this._paused){this._shouldReloadOnResume=!0;return}this._outOfViewCache.reset();for(let i of this._inViewTiles.getAllIds()){let a=this._inViewTiles.getTileById(i);r&&!this._source.shouldReloadTile(a,r)||(t?this._reloadTile(i,a.state==="errored"?"loading":"expired"):a.state!=="errored"&&this._reloadTile(i,"reloading"))}}async _reloadTile(t,r){let i=this._inViewTiles.getTileById(t);if(!i)return;let a=i.hasData();i.state!=="loading"&&(i.state=r),await this._loadTile(i,t,r,a)}_tileLoaded(t,r,i,a,s){a||(t.timeAdded=ge(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration)),i==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),!(s!=null&&s.unmodified)&&(this.getSource().type==="raster-dem"&&t.dem&&OT(t,this._inViewTiles),t.featureStateRevision=-1,this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new we("data",{tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,r){let i=this._getLoadedDescendents(r),a=new Set;for(let s of r){let n=i[s.key];if(!(n!=null&&n.length)){a.add(s);continue}let o=s.overscaledZ+Ar.maxOverzooming,l=n.filter(c=>c.tileID.overscaledZ<=o);if(!l.length){a.add(s);continue}let u=Math.min(...l.map(c=>c.tileID.overscaledZ)),h=l.filter(c=>c.tileID.overscaledZ===u).map(c=>c.tileID);for(let c of h)t[c.key]=c;this._areDescendentsComplete(h,u,s.overscaledZ)||a.add(s)}return a}_getLoadedDescendents(t){var i;let r={};for(let a of this._inViewTiles.getAllTiles().filter(s=>s.hasData()))for(let s of t)a.tileID.isChildOf(s)&&(r[i=s.key]||(r[i]=[]),r[s.key].push(a));return r}_areDescendentsComplete(t,r,i){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===r:4**(r-i)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let r=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),i=this._maxTileCacheZoomLevels===null?_i.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(r*i),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._outOfViewCache.setMaxSize(s)}handleWrapJump(t){let r=(t-(this._prevLng===void 0?t:this._prevLng))/360,i=Math.round(r);this._prevLng=t,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}update(t,r){if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=r,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng);let i;!this.used&&!this.usedForTerrain?i=[]:this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(l=>new st(l.canonical.z,l.wrap,l.canonical.z,l.canonical.x,l.canonical.y)):(i=da(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?Math.max(this._source.maxzoom,t.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(i=i.filter(l=>this._source.hasTile(l)))),this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));let a=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new we("data",{sourceDataType:"idle",sourceId:this.id}));let s=Gh(t,this._source),n=this._updateRetainedTiles(i,s),o=ad(this._source.type);o&&this._rasterFadeDuration>0&&!r&&kT(this._inViewTiles,i,n,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(n):this._cleanUpVectorTiles(n)}_cleanUpRasterTiles(t){for(let r of this._inViewTiles.getAllIds())t[r]||this._removeTile(r)}_cleanUpVectorTiles(t){for(let r of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(r);if(t[r]){i.clearSymbolFadeHold();continue}if(!i.hasSymbolBuckets){this._removeTile(r);continue}i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(r):i.setSymbolHoldDuration(this.map._fadeDuration)}}_addTerrainIdealTiles(t){let r=[];for(let i of t)if(i.canonical.z>this._source.minzoom){let a=i.scaledTo(i.canonical.z-1);r.push(a);let s=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));r.push(s)}return t.concat(r)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,r){var l;let i=new Set;for(let u of t)this._addTile(u).hasData()||i.add(u);let a=t.reduce((u,h)=>(u[h.key]=h,u),{}),s=this._retainLoadedChildren(a,i),n={},o=Math.max(r-Ar.maxUnderzooming,this._source.minzoom);for(let u of s){let h=this._inViewTiles.getTileById(u.key),c=h==null?void 0:h.wasRequested();for(let p=u.overscaledZ-1;p>=o;--p){let d=u.scaledTo(p);if(n[d.key])break;if(n[d.key]=!0,h=this.getTile(d),!h&&c&&(h=this._addTile(d)),h){let f=h.hasData();if((f||!((l=this.map)!=null&&l.cancelPendingTileRequestsWhileZooming)||c)&&(a[d.key]=d),c=h.wasRequested(),f)break}}}return a}_addTile(t){let r=this._inViewTiles.getTileById(t.key);if(r)return r;r=this._outOfViewCache.getAndRemove(t),r&&(r.resetFadeLogic(),this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null));let i=r;return r||(r=new Em(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(r,t.key,r.state,!1)),r.uses++,this._inViewTiles.setTile(t.key,r),i||this._source.fire(new we("dataloading",{tile:r,coord:r.tileID})),r}_setTileReloadTimer(t,r){this._clearTileReloadTimer(t);let i=r.getExpiryTimeout();if(i){let a=()=>{this._reloadTile(t,"expired"),delete this._timers[t]};this._timers[t]=setTimeout(a,i)}}_clearTileReloadTimer(t){let r=this._timers[t];r&&(clearTimeout(r),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,r)}}refreshTiles(t){for(let r of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(r);!this._inViewTiles.isIdRenderable(r)&&i.state!="errored"||t.some(a=>a.equals(i.tileID.canonical))&&this._reloadTile(r,"expired")}}_removeTile(t){let r=this._inViewTiles.getTileById(t);r&&(r.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),!(r.uses>0)&&(r.hasData()&&r.state!=="reloading"?this._outOfViewCache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}_dataHandler(t){if(t.dataType==="source"){if(t.sourceDataType==="metadata"){this._sourceLoaded=!0;return}t.sourceDataType!=="content"||!this._sourceLoaded||this._paused||(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,r,i){let a=[],s=this.transform;if(!s)return a;let n=s.getCoveringTilesDetailsProvider().allowWorldCopies(),o=i?s.getCameraQueryGeometry(t):t,l=d=>s.screenPointToMercatorCoordinate(d,this.terrain),u=this.transformBbox(t,l,!n),h=this.transformBbox(o,l,!n),c=this.getIds(),p=or.fromPoints(h);for(let d of c){let f=this._inViewTiles.getTileById(d);if(f.holdingForSymbolFade())continue;let m=n?[f.tileID]:[f.tileID.unwrapTo(-1),f.tileID.unwrapTo(0)],g=2**(s.zoom-f.tileID.overscaledZ),_=r*f.queryPadding*z/f.tileSize/g;for(let y of m){let x=p.map(v=>y.getTilePoint(new de(v.x,v.y)));if(x.expandBy(_),x.intersects(Ox)){let v=u.map(b=>y.getTilePoint(b)),w=h.map(b=>y.getTilePoint(b));a.push({tile:f,tileID:n?y:y.unwrapTo(0),queryGeometry:v,cameraQueryGeometry:w,scale:g})}}}return a}transformBbox(t,r,i){let a=t.map(r);if(i){let s=or.fromPoints(t);s.shrinkBy(Math.min(s.width(),s.height())*.001);let n=s.map(r);or.fromPoints(a).covers(n)||(a=a.map(o=>o.x>.5?new de(o.x-1,o.y,o.z):o))}return a}getVisibleCoordinates(t){let r=this.getRenderableIds(t).map(i=>this._inViewTiles.getTileById(i).tileID);return this.transform&&this.transform.populateCache(r),r}hasTransition(){return this._source.hasTransition()?!0:ad(this._source.type)&&$T(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,r,i){t||(t=pn),this._state.updateState(t,r,i)}removeFeatureState(t,r,i){t||(t=pn),this._state.removeFeatureState(t,r,i)}getFeatureState(t,r){return t||(t=pn),this._state.getState(t,r)}setDependencies(t,r,i){let a=this._inViewTiles.getTileById(t);a&&a.setDependencies(r,i)}reloadTilesForDependencies(t,r){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(t,r)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter(i=>!i.hasDependency(t,r))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}},Ar.maxUnderzooming=10,Ar.maxOverzooming=3,Ar),VT=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=te(e,0,1);let t=1,r=this._distances[t],i=e*this.paddedLength+this.padding;for(;r<i&&t<this._distances.length;)r=this._distances[++t];let a=t-1,s=this._distances[a],n=r-s,o=n>0?(i-s)/n:0;return this.points[a].mult(1-o).add(this.points[t].mult(o))}};function mn(e,t,r,i,a){return a?e?e(t,r)+i:i===0?void 0:i:i}function Zs(e,t){let r=!0;return e==="always"||(e==="never"||t==="never")&&(r=!1),r}var ld=class{constructor(e,t,r){let i=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/r);for(let s=0;s<this.xCellCount*this.yCellCount;s++)i.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,r,i,a){this._forEachCell(t,r,i,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(a)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,a,s){this.boxCells[a].push(s)}_insertCircleCell(e,t,r,i,a,s){this.circleCells[a].push(s)}_query(e,t,r,i,a,s,n){if(r<0||e>this.width||i<0||t>this.height)return[];let o=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(a)return[{key:null,x1:e,y1:t,x2:r,y2:i}];for(let l=0;l<this.boxKeys.length;l++)o.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});for(let l=0;l<this.circleKeys.length;l++){let u=this.circles[l*3],h=this.circles[l*3+1],c=this.circles[l*3+2];o.push({key:this.circleKeys[l],x1:u-c,y1:h-c,x2:u+c,y2:h+c})}}else{let l={hitTest:a,overlapMode:s,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,r,i,this._queryCell,o,l,n)}return o}query(e,t,r,i){return this._query(e,t,r,i,!1,null)}hitTest(e,t,r,i,a,s){return this._query(e,t,r,i,!0,a,s).length>0}hitTestCircle(e,t,r,i,a){let s=e-r,n=e+r,o=t-r,l=t+r;if(n<0||s>this.width||l<0||o>this.height)return!1;let u=[],h={hitTest:!0,overlapMode:i,circle:{x:e,y:t,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(s,o,n,l,this._queryCellCircle,u,h,a),u.length>0}_queryCell(e,t,r,i,a,s,n,o){let{seenUids:l,hitTest:u,overlapMode:h}=n,c=this.boxCells[a],p=1e-6;if(c!==null){let f=this.bboxes;for(let m of c)if(!l.box[m]){l.box[m]=!0;let g=m*4,_=this.boxKeys[m];if(e<=f[g+2]+p&&t<=f[g+3]+p&&r>=f[g+0]-p&&i>=f[g+1]-p&&(!o||o(_))&&(!u||!Zs(h,_.overlapMode))&&(s.push({key:_,x1:f[g],y1:f[g+1],x2:f[g+2],y2:f[g+3]}),u))return!0}}let d=this.circleCells[a];if(d!==null){let f=this.circles;for(let m of d)if(!l.circle[m]){l.circle[m]=!0;let g=m*3,_=this.circleKeys[m];if(this._circleAndRectCollide(f[g],f[g+1],f[g+2],e,t,r,i)&&(!o||o(_))&&(!u||!Zs(h,_.overlapMode))){let y=f[g],x=f[g+1],v=f[g+2];if(s.push({key:_,x1:y-v,y1:x-v,x2:y+v,y2:x+v}),u)return!0}}}return!1}_queryCellCircle(e,t,r,i,a,s,n,o){let{circle:l,seenUids:u,overlapMode:h}=n,c=this.boxCells[a];if(c!==null){let d=this.bboxes;for(let f of c)if(!u.box[f]){u.box[f]=!0;let m=f*4,g=this.boxKeys[f];if(this._circleAndRectCollide(l.x,l.y,l.radius,d[m+0],d[m+1],d[m+2],d[m+3])&&(!o||o(g))&&!Zs(h,g.overlapMode))return s.push(!0),!0}}let p=this.circleCells[a];if(p!==null){let d=this.circles;for(let f of p)if(!u.circle[f]){u.circle[f]=!0;let m=f*3,g=this.circleKeys[f];if(this._circlesCollide(d[m],d[m+1],d[m+2],l.x,l.y,l.radius)&&(!o||o(g))&&!Zs(h,g.overlapMode))return s.push(!0),!0}}}_forEachCell(e,t,r,i,a,s,n,o){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),h=this._convertToXCellCoord(r),c=this._convertToYCellCoord(i);for(let p=l;p<=h;p++)for(let d=u;d<=c;d++){let f=this.xCellCount*d+p;if(a.call(this,e,t,r,i,f,s,n,o))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,r,i,a,s){let n=i-e,o=a-t,l=r+s;return l*l>n*n+o*o}_circleAndRectCollide(e,t,r,i,a,s,n){let o=(s-i)/2,l=Math.abs(e-(i+o));if(l>o+r)return!1;let u=(n-a)/2,h=Math.abs(t-(a+u));if(h>u+r)return!1;if(l<=o||h<=u)return!0;let c=l-o,p=h-u;return c*c+p*p<=r*r}};function jT(e,t){let r=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),i=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),a=t[0]*r,s=t[4]*r,n=t[8]*i,o=t[1]*r,l=t[5]*r,u=t[9]*i,h=t[2]*r,c=t[6]*r,p=t[10]*i;e[0]=a,e[1]=s,e[2]=n,e[4]=o,e[5]=l,e[6]=u,e[8]=h,e[9]=c,e[10]=p;let d=t[12],f=t[13],m=t[14];return e[12]=-a*d-o*f-h*m,e[13]=-s*d-l*f-c*m,e[14]=-n*d-u*f-p*m,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}function NT(e,t){return e[0]=1/t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t[10]/t[14],e}function UT(e,t){let r=1/(t[0]*t[5]-t[1]*t[4]);return e[0]=t[5]*r,e[1]=-t[1]*r,e[2]=0,e[3]=0,e[4]=-t[4]*r,e[5]=t[0]*r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15],e}const qT=Zr();function Zh(e,t,r){let i=Zr();if(!e){let{vecSouth:a,vecEast:s}=Wh(t),n=cm();n[0]=s[0],n[1]=s[1],n[2]=a[0],n[3]=a[1],s4(n,n),i[0]=n[0],i[1]=n[1],i[4]=n[2],i[5]=n[3]}return nt(i,i,[1/r,1/r,1]),i}function GT(e,t,r,i){if(e){let a=Zr();if(!t){let{vecSouth:s,vecEast:n}=Wh(r);a[0]=n[0],a[1]=n[1],a[4]=s[0],a[5]=s[1]}return nt(a,a,[i,i,1]),a}return r.pixelsToClipSpaceMatrix}function Wh(e){let t=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),i=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),s=Math.sin(e.bearingInRadians),n=xl();n[0]=-a*i*r-s*t,n[1]=-s*i*r+a*t;let o=dc(n);o<1e-9?fc(n):pc(n,n,1/o);let l=xl();l[0]=a*i*t-s*r,l[1]=s*i*t+a*r;let u=dc(l);return u<1e-9?fc(l):pc(l,l,1/u),{vecEast:l,vecSouth:n}}function wi(e,t,r){return mn(e.getElevation,t,r,e.heightOffset??0,e.heightAnchorGround??!0)}function Hh(e,t,r,i){let a;i==null?(a=[e,t,0,1],Xh(a,a,r)):(a=[e,t,i,1],Xe(a,a,r));let s=a[3];return{point:new M(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function Sm(e,t){return .5+e/t*.5}function ZT(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function WT(e,t,r,i,a,s,n,o,l,u,h,c,p){let d=r?e.textSizeData:e.iconSizeData,f=go(d,t.transform.zoom),m=[256/t.width*2+1,256/t.height*2+1],g=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let _=e.lineVertexArray,y=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,x=t.transform.width/t.transform.height,v=!1;for(let w=0;w<y.length;w++){let b=y.get(w);if(b.hidden||b.writingMode===2&&!v){Yi(b.numGlyphs,g);continue}v=!1;let A=new M(b.anchorX,b.anchorY),C={getElevation:p,pitchedLabelPlaneMatrix:i,lineVertexArray:_,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:A,unwrappedTileID:l,width:u,height:h,translation:c},E=Im(b.anchorX,b.anchorY,C);if(!ZT(E.point,m)){Yi(b.numGlyphs,g);continue}let F=E.signedDistanceFromCamera,k=Sm(t.transform.cameraToCenterDistance,F),B=Ch(d,f,b),I=s?B*t.transform.getPitchedTextCorrection(b.anchorX,b.anchorY,l)/k:B*k,D=hd({projectionContext:C,pitchedLabelPlaneMatrixInverse:a,symbol:b,fontSize:I,flip:!1,keepUpright:n,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:x,rotateToLine:o});v=D.useVertical,(D.notEnoughRoom||v||D.needsFlipping&&hd({projectionContext:C,pitchedLabelPlaneMatrixInverse:a,symbol:b,fontSize:I,flip:!0,keepUpright:n,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:x,rotateToLine:o}).notEnoughRoom)&&Yi(b.numGlyphs,g)}r?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}function Cm(e,t,r,i,a,s,n,o){let l=s.glyphStartIndex+s.numGlyphs,u=s.lineStartIndex,h=s.lineStartIndex+s.lineLength,c=t.getoffsetX(s.glyphStartIndex),p=t.getoffsetX(l-1),d=Vn(e*c,r,i,a,s.segment,u,h,o,n);if(!d)return null;let f=Vn(e*p,r,i,a,s.segment,u,h,o,n);return!f||o.projectionCache.anyProjectionOccluded?null:{first:d,last:f}}function ud(e,t,r,i){return e===1&&Math.abs(r.y-t.y)>Math.abs(r.x-t.x)*i?{useVertical:!0}:(e===2?t.y<r.y:t.x>r.x)?{needsFlipping:!0}:null}function hd(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:r,symbol:i,fontSize:a,flip:s,keepUpright:n,glyphOffsetArray:o,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:h}=e,c=a/24,p=i.lineOffsetX*c,d=i.lineOffsetY*c,f;if(i.numGlyphs>1){let m=i.glyphStartIndex+i.numGlyphs,g=i.lineStartIndex,_=i.lineStartIndex+i.lineLength,y=Cm(c,o,p,d,s,i,h,t);if(!y)return{notEnoughRoom:!0};let x=Ws(y.first.point.x,y.first.point.y,t,r),v=Ws(y.last.point.x,y.last.point.y,t,r);if(n&&!s){let w=ud(i.writingMode,x,v,u);if(w)return w}f=[y.first];for(let w=i.glyphStartIndex+1;w<m-1;w++){let b=Vn(c*o.getoffsetX(w),p,d,s,i.segment,g,_,t,h);if(!b)return{notEnoughRoom:!0};f.push(b)}f.push(y.last)}else{if(n&&!s){let g=Ti(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,_=i.lineStartIndex+i.segment+1,y=new M(t.lineVertexArray.getx(_),t.lineVertexArray.gety(_)),x=Ti(y.x,y.y,t),v=x.signedDistanceFromCamera>0?x.point:Pm(t.tileAnchorPoint,y,g,1,t),w=Ws(g.x,g.y,t,r),b=Ws(v.x,v.y,t,r),A=ud(i.writingMode,w,b,u);if(A)return A}let m=Vn(c*o.getoffsetX(i.glyphStartIndex),p,d,s,i.segment,i.lineStartIndex,i.lineStartIndex+i.lineLength,t,h);if(!m||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[m]}for(let m of f)hs(l,m.point,m.angle);return{}}function Pm(e,t,r,i,a){let s=e.add(e.sub(t)._unit()),n=Ti(s.x,s.y,a).point,o=r.sub(n);return r.add(o._mult(i/o.mag()))}function $u(e,t,r){let i=t.projectionCache;if(i.projections[e])return i.projections[e];let a=new M(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),s=Ti(a.x,a.y,t);if(s.signedDistanceFromCamera>0)return i.projections[e]=s.point,i.anyProjectionOccluded||(i.anyProjectionOccluded=s.isOccluded),s.point;let n=e-r.direction,o=r.distanceFromAnchor===0?t.tileAnchorPoint:new M(t.lineVertexArray.getx(n),t.lineVertexArray.gety(n)),l=r.absOffsetX-r.distanceFromAnchor+1;return Pm(o,a,r.previousVertex,l,t)}function Ti(e,t,r){let i=e+r.translation[0],a=t+r.translation[1],s;return r.pitchWithMap?(s=Hh(i,a,r.pitchedLabelPlaneMatrix,wi(r,i,a)),s.isOccluded=!1):(s=r.transform.projectTileCoordinates(i,a,r.unwrappedTileID,wi(r,i,a)),s.point.x=(s.point.x*.5+.5)*r.width,s.point.y=(-s.point.y*.5+.5)*r.height),s}function Ws(e,t,r,i){if(r.pitchWithMap){let a=[e,t,0,1];Xe(a,a,i);let s=a[0]/a[3],n=a[1]/a[3];return r.transform.projectTileCoordinates(s,n,r.unwrappedTileID,wi(r,s,n)).point}return{x:e/r.width*2-1,y:1-t/r.height*2}}function Im(e,t,r){return r.transform.projectTileCoordinates(e,t,r.unwrappedTileID,wi(r,e,t))}function Ou(e,t,r){return e._unit()._perp()._mult(t*r)}function HT(e,t,r,i,a,s,n,o,l){if(o.projectionCache.offsets[e])return o.projectionCache.offsets[e];let u=r.add(t);if(e+l.direction<i||e+l.direction>=a)return o.projectionCache.offsets[e]=u,u;let h=$u(e+l.direction,o,l),c=Ou(h.sub(r),n,l.direction),p=r.add(c),d=h.add(c);return o.projectionCache.offsets[e]=c1(s,u,p,d)||u,o.projectionCache.offsets[e]}function Vn(e,t,r,i,a,s,n,o,l){let u=i?e-t:e+t,h=u>0?1:-1,c=0;i&&(h*=-1,c=Math.PI),h<0&&(c+=Math.PI);let p=h>0?s+a:s+a+1,d;o.projectionCache.cachedAnchorPoint?d=o.projectionCache.cachedAnchorPoint:(d=Ti(o.tileAnchorPoint.x,o.tileAnchorPoint.y,o).point,o.projectionCache.cachedAnchorPoint=d);let f=d,m=d,g,_,y=0,x=0,v=Math.abs(u),w=[],b;for(;y+x<=v;){if(p+=h,p<s||p>=n)return null;y+=x,m=f,_=g;let F={absOffsetX:v,direction:h,distanceFromAnchor:y,previousVertex:m};if(f=$u(p,o,F),r===0)w.push(m),b=f.sub(m);else{let k,B=f.sub(m);k=B.mag()===0?Ou($u(p+h,o,F).sub(f),r,h):Ou(B,r,h),_||(_=m.add(k)),g=HT(p,k,f,s,n,_,r,o,F),w.push(_),b=g.sub(_)}x=b.mag()}let A=(v-y)/x,C=b._mult(A)._add(_||m),E=c+Math.atan2(f.y-m.y,f.x-m.x);return w.push(C),{point:C,angle:l?E:0,path:w}}const XT=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Yi(e,t){for(let r=0;r<e;r++){let i=t.length;t.resize(i+4),t.float32.set(XT,i*3)}}function Xh(e,t,r){let i=t[0],a=t[1];return e[0]=r[0]*i+r[4]*a+r[12],e[1]=r[1]*i+r[5]*a+r[13],e[3]=r[3]*i+r[7]*a+r[15],e}function YT(e,t){let r=qT;return UT(r,t.pitchedLabelPlaneMatrix),e.map(i=>{let a=Hh(i.x,i.y,r,wi(t,i.x,i.y)),s=t.transform.projectTileCoordinates(a.point.x,a.point.y,t.unwrappedTileID,wi(t,a.point.x,a.point.y));return s.point.x=(s.point.x*.5+.5)*t.width,s.point.y=(-s.point.y*.5+.5)*t.height,s})}function KT(e){let t=0,r=0,i=0,a=0;for(let s=0;s<e.length;s++)e[s].isOccluded?(i=s+1,a=0):(a++,a>r&&(r=a,t=i));return e.slice(t,t+r)}var JT=class{constructor(e,t=new ld(e.width+200,e.height+200,25),r=new ld(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=r,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,r,i,a,s,n,o,l,u,h,c,p=0,d=!0){let f=e.anchorPointX+o[0],m=e.anchorPointY+o[1],g=this.projectAndGetPerspectiveRatio(f,m,a,mn(u,f,m,p,d),c),_=r*g.perspectiveRatio,y;if(!s&&!n){let E=g.x+(h?h.x*_:0),F=g.y+(h?h.y*_:0);y={allPointsOccluded:!1,box:[E+e.x1*_,F+e.y1*_,E+e.x2*_,F+e.y2*_]}}else y=this._projectCollisionBox(e,_,i,a,s,n,o,g,u,h,c,p,d);let[x,v,w,b]=y.box,A=s?y.allPointsOccluded:g.isOccluded,C=A;return C||(C=g.perspectiveRatio<this.perspectiveRatioCutoff),C||(C=!this.isInsideGrid(x,v,w,b)),C||t!=="always"&&this.grid.hitTest(x,v,w,b,t,l)?{box:[x,v,w,b],placeable:!1,offscreen:!1,occluded:A}:{box:[x,v,w,b],placeable:!0,offscreen:this.isOffscreen(x,v,w,b),occluded:A}}placeCollisionCircles(e,t,r,i,a,s,n,o,l,u,h,c,p,d){let f=[],m=new M(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(m.x,m.y,s,d==null?void 0:d(m.x,m.y)),_=(l?a*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,s)/g:a*g)/24,y={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},x=t.lineOffsetX*_,v=t.lineOffsetY*_,w={getElevation:d,pitchedLabelPlaneMatrix:n,lineVertexArray:r,pitchWithMap:l,projectionCache:y,transform:this.transform,tileAnchorPoint:m,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:p},b=Cm(_,i,x,v,!1,t,!1,w),A=!1,C=!1,E=!0;if(b){let F=h*.5*g+c,k=new M(-100,-100),B=new M(this.screenRightBoundary,this.screenBottomBoundary),I=new VT,D=b.first,T=b.last,S=[];for(let U=D.path.length-1;U>=1;U--)S.push(D.path[U]);for(let U=1;U<T.path.length;U++)S.push(T.path[U]);let j=F*2.5;if(l){let U=this.projectPathToScreenSpace(S,w);S=U.some(X=>X.signedDistanceFromCamera<=0)?[]:U.map(X=>X.point)}let N=[];if(S.length>0){let U=S[0].clone(),X=S[0].clone();for(let _e=1;_e<S.length;_e++)U.x=Math.min(U.x,S[_e].x),U.y=Math.min(U.y,S[_e].y),X.x=Math.max(X.x,S[_e].x),X.y=Math.max(X.y,S[_e].y);N=U.x>=k.x&&X.x<=B.x&&U.y>=k.y&&X.y<=B.y?[S]:X.x<k.x||U.x>B.x||X.y<k.y||U.y>B.y?[]:t4([S],k.x,k.y,B.x,B.y)}for(let U of N){I.reset(U,F*.25);let X=0;X=I.length<=.5*F?1:Math.ceil(I.paddedLength/j)+1;for(let _e=0;_e<X;_e++){let mt=_e/Math.max(X-1,1),ye=I.lerp(mt),Ke=ye.x+100,ze=ye.y+100;f.push(Ke,ze,F,0);let ct=Ke-F,Je=ze-F,Jt=Ke+F,mr=ze+F;if(E&&(E=this.isOffscreen(ct,Je,Jt,mr)),C||(C=this.isInsideGrid(ct,Je,Jt,mr)),e!=="always"&&this.grid.hitTestCircle(Ke,ze,F,e,u)&&(A=!0,!o))return{circles:[],offscreen:!1,collisionDetected:A}}}}return{circles:!o&&A||!C||g<this.perspectiveRatioCutoff?[]:f,offscreen:E,collisionDetected:A}}projectPathToScreenSpace(e,t){return KT(YT(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],r=new or;for(let h of e){let c=new M(h.x+100,h.y+100);r.extend(c),t.push(c)}let{minX:i,minY:a,maxX:s,maxY:n}=r,o=this.grid.query(i,a,s,n).concat(this.ignoredGrid.query(i,a,s,n)),l={},u={};for(let h of o){let c=h.key;if(l[c.bucketInstanceId]===void 0&&(l[c.bucketInstanceId]={}),l[c.bucketInstanceId][c.featureIndex])continue;let p=[new M(h.x1,h.y1),new M(h.x2,h.y1),new M(h.x2,h.y2),new M(h.x1,h.y2)];e2(t,p)&&(l[c.bucketInstanceId][c.featureIndex]=!0,u[c.bucketInstanceId]===void 0&&(u[c.bucketInstanceId]=[]),u[c.bucketInstanceId].push(c.featureIndex))}return u}insertCollisionBox(e,t,r,i,a,s){let n=r?this.ignoredGrid:this.grid,o={bucketInstanceId:i,featureIndex:a,collisionGroupID:s,overlapMode:t};n.insert(o,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,r,i,a,s){let n=r?this.ignoredGrid:this.grid,o={bucketInstanceId:i,featureIndex:a,collisionGroupID:s,overlapMode:t};for(let l=0;l<e.length;l+=4)n.insertCircle(o,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,t,r,i,a){if(a){let s;i==null?(s=[e,t,0,1],Xh(s,s,a)):(s=[e,t,i,1],Xe(s,s,a));let n=s[3];return{x:(s[0]/n+1)/2*this.transform.width+100,y:(-s[1]/n+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/n),isOccluded:!1,signedDistanceFromCamera:n}}{let s=this.transform.projectTileCoordinates(e,t,r,i);return{x:(s.point.x+1)/2*this.transform.width+100,y:(-s.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s.signedDistanceFromCamera),isOccluded:s.isOccluded,signedDistanceFromCamera:s.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,r,i){let a=this.transform.projectTileCoordinates(e,t,r,i);return .5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera)}isOffscreen(e,t,r,i){return r<100||e>=this.screenRightBoundary||i<100||t>this.screenBottomBoundary}isInsideGrid(e,t,r,i){return r>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=Xt([]);return Ve(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,r,i,a,s,n,o,l,u,h,c=0,p=!0){let d=1,f=0,m=0,g=1,_=e.anchorPointX+n[0],y=e.anchorPointY+n[1];if(s&&!a){let T=this.projectAndGetPerspectiveRatio(_+1,y,i,mn(l,_+1,y,c,p),h),S=T.x-o.x,j=T.y-o.y,N=Math.atan(j/S)+(S<0?Math.PI:0),U=Math.sin(N),X=Math.cos(N);d=X,f=U,m=-U,g=X}else if(!s&&a){let T=Wh(this.transform);d=T.vecEast[0],f=T.vecEast[1],m=T.vecSouth[0],g=T.vecSouth[1]}let x=o.x,v=o.y,w=t;if(a&&(x=_,v=y,w=2**-(this.transform.zoom-r.overscaledZ),w*=this.transform.getPitchedTextCorrection(_,y,i),!u)){let T=o.signedDistanceFromCamera/this.transform.cameraToCenterDistance,S=te(.5+.5*T,0,4);w*=S}u&&(x+=d*u.x*w+m*u.y*w,v+=f*u.x*w+g*u.y*w);let b=e.x1*w,A=e.x2*w,C=(b+A)/2,E=e.y1*w,F=e.y2*w,k=(E+F)/2,B=[{offsetX:b,offsetY:E},{offsetX:C,offsetY:E},{offsetX:A,offsetY:E},{offsetX:A,offsetY:k},{offsetX:A,offsetY:F},{offsetX:C,offsetY:F},{offsetX:b,offsetY:F},{offsetX:b,offsetY:k}],I=[];for(let{offsetX:T,offsetY:S}of B)I.push(new M(x+d*T+m*S,v+f*T+g*S));let D=!1;if(a){let T=I.map(S=>this.projectAndGetPerspectiveRatio(S.x,S.y,i,mn(l,S.x,S.y,c,p),h));D=T.some(S=>!S.isOccluded),I=T.map(S=>new M(S.x,S.y))}else D=!0;return{box:s1(I),allPointsOccluded:!D}}},cd=class{constructor(e,t,r,i){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):i&&r?1:0,this.placed=r}isHidden(){return this.opacity===0&&!this.placed}},Da=class{constructor(e,t,r,i,a){this.text=new cd(e?e.text:null,t,r,a),this.icon=new cd(e?e.icon:null,t,i,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},pd=class{constructor(e,t,r){this.text=e,this.icon=t,this.skipFade=r}},QT=class{constructor(e,t,r,i,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=a}},e6=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:r=>r.collisionGroupID===t}}return this.collisionGroups[e]}};function dd(e,t,r,i,a){let{horizontalAlign:s,verticalAlign:n}=F2(e),o=-(s-.5)*t,l=-(n-.5)*r;return new M(o+i[0]*a,l+i[1]*a)}var t6=class{constructor(e,t,r,i,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new JT(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new e6(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(r,i)=>t.getElevation(e,r,i)}getBucketParts(e,t,r,i){let a=r.getBucket(t),s=r.latestFeatureIndex;if(!a||!s||t.id!==a.layerIds[0])return;let n=r.collisionBoxArray,o=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/z,c=r.tileID.toUnwrapped(),p=o.get("text-rotation-alignment")==="map",d=It(r,1,this.transform.zoom),f=jr(this.collisionIndex.transform,r,l.get("text-translate"),l.get("text-translate-anchor")),m=jr(this.collisionIndex.transform,r,l.get("icon-translate"),l.get("icon-translate-anchor")),g=Zh(p,this.transform,d);this.retainedQueryData[a.bucketInstanceId]=new QT(a.bucketInstanceId,s,a.sourceLayerIndex,a.index,r.tileID);let _={bucket:a,layout:o,translationText:f,translationIcon:m,unwrappedTileID:c,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:go(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let y of a.sortKeyRanges){let{sortKey:x,symbolInstanceStart:v,symbolInstanceEnd:w}=y;e.push({sortKey:x,symbolInstanceStart:v,symbolInstanceEnd:w,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,t,r,i,a,s,n,o,l,u,h,c,p,d,f,m,g,_,y,x,v,w){var F,k,B;let b=jp[e.textAnchor],A=[e.textOffset0,e.textOffset1],C=dd(b,r,i,A,a),E=this.collisionIndex.placeCollisionBox(t,c,o,l,u,n,s,m,h.predicate,y,C,x,v,w);if(!(_&&!this.collisionIndex.placeCollisionBox(_,c,o,l,u,n,s,g,h.predicate,y,C,x,v,w).placeable)&&E.placeable){let I;if((F=this.prevPlacement)!=null&&F.variableOffsets[p.crossTileID]&&((B=(k=this.prevPlacement)==null?void 0:k.placements[p.crossTileID])!=null&&B.text)&&(I=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:A,width:r,height:i,anchor:b,textBoxScale:a,prevAnchor:I},this.markUsedJustification(d,b,p,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,p),this.placedOrientations[p.crossTileID]=f),{shift:C,placedGlyphBoxes:E}}}placeLayerBucketPart(e,t,r){let{bucket:i,layout:a,translationText:s,translationIcon:n,unwrappedTileID:o,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:h,collisionBoxArray:c,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=a.get("text-optional"),m=a.get("icon-optional"),g=Ln(a,"text-overlap","text-allow-overlap"),_=g==="always",y=Ln(a,"icon-overlap","icon-allow-overlap"),x=y==="always",v=a.get("text-rotation-alignment")==="map",w=a.get("text-pitch-alignment")==="map",b=a.get("icon-text-fit")!=="none",A=a.get("symbol-z-order")==="viewport-y",C=a.get("symbol-height-anchor")==="ground",E=_&&(x||!i.hasIconData()||m),F=x&&(_||!i.hasTextData()||f);!i.collisionArrays&&c&&i.deserializeCollisionBoxes(c);let k=this.retainedQueryData[i.bucketInstanceId].tileID,B=this._getTerrainElevationFunc(k),I=this.transform.getFastPathSimpleProjectionMatrix(k),D=(T,S,j)=>{var Mi,Yr;if(t[T.crossTileID])return;if(h){this.placements[T.crossTileID]=new pd(!1,!1,!1);return}let N=T.heightOffset,U=!1,X=!1,_e=!0,mt=null,ye={box:null,placeable:!1,offscreen:null,occluded:!1},Ke={placeable:!1},ze=null,ct=null,Je=null,Jt=0,mr=0,fa=0;S.textFeatureIndex?Jt=S.textFeatureIndex:T.useRuntimeCollisionCircles&&(Jt=T.featureIndex),S.verticalTextFeatureIndex&&(mr=S.verticalTextFeatureIndex);let Ir=S.textBox;if(Ir){let Qt=pt=>{let ke=1;if(i.allowVerticalPlacement&&!pt&&this.prevPlacement){let gt=this.prevPlacement.placedOrientations[T.crossTileID];gt&&(this.placedOrientations[T.crossTileID]=gt,ke=gt,this.markUsedOrientation(i,ke,T))}return ke},er=(pt,ke)=>{if(i.allowVerticalPlacement&&T.numVerticalGlyphVertices>0&&S.verticalTextBox){for(let gt of i.writingModes)if(gt===2?(ye=ke(),Ke=ye):ye=pt(),ye==null?void 0:ye.placeable)break}else ye=pt()},Kr=T.textAnchorOffsetStartIndex,Jr=T.textAnchorOffsetEndIndex;if(Jr===Kr){let pt=(ke,gt)=>{let Ze=this.collisionIndex.placeCollisionBox(ke,g,u,k,o,w,v,s,d.predicate,B,void 0,I,N,C);return Ze!=null&&Ze.placeable&&(this.markUsedOrientation(i,gt,T),this.placedOrientations[T.crossTileID]=gt),Ze};er(()=>pt(Ir,1),()=>{let ke=S.verticalTextBox;return i.allowVerticalPlacement&&T.numVerticalGlyphVertices>0&&ke?pt(ke,2):{box:null,offscreen:null}}),Qt(ye==null?void 0:ye.placeable)}else{let pt=jp[(Yr=(Mi=this.prevPlacement)==null?void 0:Mi.variableOffsets[T.crossTileID])==null?void 0:Yr.anchor],ke=(Ze,ga,yg)=>{let vg=Ze.x2-Ze.x1,xg=Ze.y2-Ze.y1,bg=T.textBoxScale,wg=b&&y==="never"?ga:null,Mr=null,rc=g==="never"?1:2,ic="never";pt&&rc++;for(let ac=0;ac<rc;ac++){for(let Co=Kr;Co<Jr;Co++){let sc=i.textAnchorOffsets.get(Co);if(pt&&sc.textAnchor!==pt)continue;let Po=this.attemptAnchorPlacement(sc,Ze,vg,xg,bg,v,w,u,k,o,d,ic,T,i,yg,s,n,wg,B,I,N,C);if(Po&&(Mr=Po.placedGlyphBoxes,Mr==null?void 0:Mr.placeable))return U=!0,mt=Po.shift,Mr}pt?pt=null:ic=g}return r&&!Mr&&(Mr={box:this.collisionIndex.placeCollisionBox(Ir,"always",u,k,o,w,v,s,d.predicate,B,void 0,I,N,C).box,offscreen:!1,placeable:!1,occluded:!1}),Mr};er(()=>ke(Ir,S.iconBox,1),()=>{let Ze=S.verticalTextBox,ga=ye==null?void 0:ye.placeable;return i.allowVerticalPlacement&&!ga&&T.numVerticalGlyphVertices>0&&Ze?ke(Ze,S.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),ye&&(U=ye.placeable,_e=ye.offscreen);let gt=Qt(ye==null?void 0:ye.placeable);if(!U&&this.prevPlacement){let Ze=this.prevPlacement.variableOffsets[T.crossTileID];Ze&&(this.variableOffsets[T.crossTileID]=Ze,this.markUsedJustification(i,Ze.anchor,T,gt))}}}if(ze=ye,U=ze==null?void 0:ze.placeable,_e=ze==null?void 0:ze.offscreen,T.useRuntimeCollisionCircles&&T.centerJustifiedTextSymbolIndex>=0){let Qt=i.text.placedSymbolArray.get(T.centerJustifiedTextSymbolIndex),er=Ch(i.textSizeData,p,Qt),Kr=a.get("text-padding"),Jr=T.collisionCircleDiameter;ct=this.collisionIndex.placeCollisionCircles(g,Qt,i.lineVertexArray,i.glyphOffsetArray,er,o,l,r,w,d.predicate,Jr,Kr,s,B),ct.circles.length&&ct.collisionDetected&&!r&&fe("Collisions detected, but collision boxes are not shown"),U=_||ct.circles.length>0&&!ct.collisionDetected,_e&&(_e=ct.offscreen)}if(S.iconFeatureIndex&&(fa=S.iconFeatureIndex),S.iconBox){let Qt=er=>this.collisionIndex.placeCollisionBox(er,y,u,k,o,w,v,n,d.predicate,B,b&&mt?mt:void 0,I,N,C);Ke&&Ke.placeable&&S.verticalIconBox?(Je=Qt(S.verticalIconBox),X=Je.placeable):(Je=Qt(S.iconBox),X=Je.placeable),_e&&(_e=Je.offscreen)}let Ii=f||T.numHorizontalGlyphVertices===0&&T.numVerticalGlyphVertices===0,Xr=m||T.numIconVertices===0;!Ii&&!Xr?X=U=X&&U:Xr?Ii||X&&(X=U):U=X&&U;let Ao=U&&ze.placeable,Eo=X&&Je.placeable;if(Ao&&(Ke&&Ke.placeable&&mr?this.collisionIndex.insertCollisionBox(ze.box,g,a.get("text-ignore-placement"),i.bucketInstanceId,mr,d.ID):this.collisionIndex.insertCollisionBox(ze.box,g,a.get("text-ignore-placement"),i.bucketInstanceId,Jt,d.ID)),Eo&&this.collisionIndex.insertCollisionBox(Je.box,y,a.get("icon-ignore-placement"),i.bucketInstanceId,fa,d.ID),ct&&U&&this.collisionIndex.insertCollisionCircles(ct.circles,g,a.get("text-ignore-placement"),i.bucketInstanceId,Jt,d.ID),r&&this.storeCollisionData(i.bucketInstanceId,j,S,ze,Je,ct),T.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");if(i.bucketInstanceId===0)throw Error("bucket.bucketInstanceId can't be 0");let So=(U||E)&&!(ze!=null&&ze.occluded),ma=(X||F)&&!(Je!=null&&Je.occluded);this.placements[T.crossTileID]=new pd(So,ma,_e||i.justReloaded),t[T.crossTileID]=!0};if(A){if(e.symbolInstanceStart!==0)throw Error("bucket.bucketInstanceId should be 0");let T=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let S=T.length-1;S>=0;--S){let j=T[S];D(i.symbolInstances.get(j),i.collisionArrays[j],j)}}else for(let T=e.symbolInstanceStart;T<e.symbolInstanceEnd;T++)D(i.symbolInstances.get(T),i.collisionArrays[T],T);i.justReloaded=!1}storeCollisionData(e,t,r,i,a,s){if(r.textBox||r.iconBox){let n;this.collisionBoxArrays.has(e)?n=this.collisionBoxArrays.get(e):(n=new Map,this.collisionBoxArrays.set(e,n));let o;n.has(t)?o=n.get(t):(o={text:null,icon:null},n.set(t,o)),r.textBox&&(o.text=i.box),r.iconBox&&(o.icon=a.box)}if(s){let n=this.collisionCircleArrays[e];n===void 0&&(n=this.collisionCircleArrays[e]=[]);for(let o=0;o<s.circles.length;o+=4)n.push(s.circles[o+0]-100),n.push(s.circles[o+1]-100),n.push(s.circles[o+2]),n.push(+!!s.collisionDetected)}}markUsedJustification(e,t,r,i){let a={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex},s;s=i===2?r.verticalPlacedTextSymbolIndex:a[i4(t)];let n=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let o of n)o>=0&&(s>=0&&o!==s?e.text.placedSymbolArray.get(o).crossTileID=0:e.text.placedSymbolArray.get(o).crossTileID=r.crossTileID)}markUsedOrientation(e,t,r){let i=t===1||t===3?t:0,a=t===2?t:0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let n of s)e.text.placedSymbolArray.get(n).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,r=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let i=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},s=t?t.variableOffsets:{},n=t?t.placedOrientations:{};for(let o in this.placements){let l=this.placements[o],u=a[o];u?(this.opacities[o]=new Da(u,i,l.text,l.icon),r||(r=l.text!==u.text.placed),r||(r=l.icon!==u.icon.placed)):(this.opacities[o]=new Da(null,i,l.text,l.icon,l.skipFade),r||(r=l.text||l.icon))}for(let o in a){let l=a[o];if(!this.opacities[o]){let u=new Da(l,i,!1,!1);u.isHidden()||(this.opacities[o]=u,r||(r=l.text.placed),r||(r=l.icon.placed))}}for(let o in s)!this.variableOffsets[o]&&this.opacities[o]&&!this.opacities[o].isHidden()&&(this.variableOffsets[o]=s[o]);for(let o in n)!this.placedOrientations[o]&&this.opacities[o]&&!this.opacities[o].isHidden()&&(this.placedOrientations[o]=n[o]);if(t&&t.lastPlacementChangeTime===void 0)throw Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let r={};for(let i of t){let a=i.getBucket(e);a&&i.latestFeatureIndex&&e.id===a.layerIds[0]&&this.updateBucketOpacities(a,i.tileID,r,i.collisionBoxArray)}}updateBucketOpacities(e,t,r,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],s=a.layout,n=new Da(null,0,!1,!1,!0),o=s.get("text-allow-overlap"),l=s.get("icon-allow-overlap"),u=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h=s.get("text-rotation-alignment")==="map",c=s.get("text-pitch-alignment")==="map",p=s.get("icon-text-fit")!=="none",d=new Da(null,0,o&&(l||!e.hasIconData()||s.get("icon-optional")),l&&(o||!e.hasTextData()||s.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let f=(g,_,y)=>{for(let x=0;x<_/4;x++)g.opacityVertexArray.emplaceBack(y);g.hasVisibleVertices||(g.hasVisibleVertices=y!==Aa)},m=this.collisionBoxArrays.get(e.bucketInstanceId);for(let g=0;g<e.symbolInstances.length;g++){let _=e.symbolInstances.get(g),{numHorizontalGlyphVertices:y,numVerticalGlyphVertices:x,crossTileID:v}=_,w=r[v],b=this.opacities[v];w?b=n:b||(b=d,this.opacities[v]=b),r[v]=!0;let A=y>0||x>0,C=_.numIconVertices>0,E=this.placedOrientations[_.crossTileID],F=E===2,k=E===1||E===3;if(A){let I=md(b.text),D=F?Aa:I;f(e.text,y,D);let T=k?Aa:I;f(e.text,x,T);let S=b.text.isHidden(),j=[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex];for(let X of j)X>=0&&(e.text.placedSymbolArray.get(X).hidden=S||F?1:0);_.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=S||k?1:0);let N=this.variableOffsets[_.crossTileID];N&&this.markUsedJustification(e,N.anchor,_,E);let U=this.placedOrientations[_.crossTileID];U&&(this.markUsedJustification(e,"left",_,U),this.markUsedOrientation(e,U,_))}if(C){let I=md(b.icon),D=!(p&&_.verticalPlacedIconSymbolIndex&&F);if(_.placedIconSymbolIndex>=0){let T=D?I:Aa;f(e.icon,_.numIconVertices,T),e.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=b.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let T=D?Aa:I;f(e.icon,_.numVerticalIconVertices,T),e.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=b.icon.isHidden()}}let B=m!=null&&m.has(g)?m.get(g):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let I=e.collisionArrays[g];if(I){let D=new M(0,0);if(I.textBox||I.verticalTextBox){let T=!0;if(u){let S=this.variableOffsets[v];S?(D=dd(S.anchor,S.width,S.height,S.textOffset,S.textBoxScale),h&&D._rotate(c?-this.transform.bearingInRadians:this.transform.bearingInRadians)):T=!1}if(I.textBox||I.verticalTextBox){let S;I.textBox&&(S=F),I.verticalTextBox&&(S=k),fd(e.textCollisionBox.collisionVertexArray,b.text.placed,!T||S,B.text,D.x,D.y)}}if(I.iconBox||I.verticalIconBox){let T=!!(!k&&I.verticalIconBox),S;I.iconBox&&(S=T),I.verticalIconBox&&(S=!T),fd(e.iconCollisionBox.collisionVertexArray,b.icon.placed,S,B.icon,p?D.x:0,p?D.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let r=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}};function fd(e,t,r,i,a,s){(!i||i.length===0)&&(i=[0,0,0,0]);let n=i[0]-100,o=i[1]-100,l=i[2]-100,u=i[3]-100;e.emplaceBack(+!!t,+!!r,a||0,s||0,n,o),e.emplaceBack(+!!t,+!!r,a||0,s||0,l,o),e.emplaceBack(+!!t,+!!r,a||0,s||0,l,u),e.emplaceBack(+!!t,+!!r,a||0,s||0,n,u)}const r6=2**25,i6=2**24,a6=2**17,s6=2**16;function md(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,r=Math.floor(e.opacity*127);return r*r6+t*i6+r*a6+t*s6+r*512+t*256+r*2+t}const Aa=0;var n6=class{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,r,i,a){let s=this._bucketParts;for(;this._currentTileIndex<e.length;){let n=e[this._currentTileIndex];if(t.getBucketParts(s,i,n,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort((n,o)=>n.sortKey-o.sortKey));this._currentPartIndex<s.length;){let n=s[this._currentPartIndex];if(t.placeLayerBucketPart(n,this._seenCrossTileIDs,r),this._currentPartIndex++,a())return!0}return!1}},o6=class{constructor(e,t,r,i,a,s,n,o){this.placement=new t6(e,t,s,n,o),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,r){let i=ge(),a=()=>!this._forceFullPlacement&&ge()-i>2;for(;this._currentPlacementIndex>=0;){let s=t[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if(k2(s)&&s.layout&&(!s.minzoom||s.minzoom<=n)&&(!s.maxzoom||s.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new n6(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};const gd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Se=new Uint32Array(96);var l6=class Mm{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(t,0,2);if(r!==219)throw Error("Data does not appear to be in a KDBush format.");let a=i>>4;if(a!==1)throw Error(`Got v${a} data when expected v1.`);let s=gd[i&15];if(!s)throw Error("Unrecognized array type.");let[n]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new Mm(o,n,s,void 0,t)}constructor(t,r=64,i=Float64Array,a=ArrayBuffer,s){if(isNaN(t)||t<0)throw Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let n=gd.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${i}.`);if(s)this.data=s,this.ids=new this.IndexArrayType(s,8,t),this.coords=new i(s,8+l+u,t*2),this._pos=t*2,this._finished=!0;else{let h=this.data=new a(8+o+l+u);this.ids=new this.IndexArrayType(h,8,t),this.coords=new i(h,8+l+u,t*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+n]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=t}}add(t,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=r,i}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return Vu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,i,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:s,coords:n,nodeSize:o}=this;Se[0]=0,Se[1]=s.length-1,Se[2]=0;let l=3,u=[];for(;l>0;){let h=Se[--l],c=Se[--l],p=Se[--l];if(c-p<=o){for(let g=p;g<=c;g++){let _=n[2*g],y=n[2*g+1];_>=t&&_<=i&&y>=r&&y<=a&&u.push(s[g])}continue}let d=p+c>>1,f=n[2*d],m=n[2*d+1];f>=t&&f<=i&&m>=r&&m<=a&&u.push(s[d]),(h===0?t<=f:r<=m)&&(Se[l++]=p,Se[l++]=d-1,Se[l++]=1-h),(h===0?i>=f:a>=m)&&(Se[l++]=d+1,Se[l++]=c,Se[l++]=1-h)}return u}within(t,r,i){let a=[];return this.withinInto(t,r,i,a),a}withinInto(t,r,i,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:s,coords:n,nodeSize:o}=this;Se[0]=0,Se[1]=s.length-1,Se[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=Se[--l],p=Se[--l],d=Se[--l];if(p-d<=o){for(let _=d;_<=p;_++)_d(n[2*_],n[2*_+1],t,r)<=h&&(a[u++]=s[_]);continue}let f=d+p>>1,m=n[2*f],g=n[2*f+1];_d(m,g,t,r)<=h&&(a[u++]=s[f]),(c===0?t-i<=m:r-i<=g)&&(Se[l++]=d,Se[l++]=f-1,Se[l++]=1-c),(c===0?t+i>=m:r+i>=g)&&(Se[l++]=f+1,Se[l++]=p,Se[l++]=1-c)}return u}};function Vu(e,t,r,i,a,s){if(a-i<=r)return;let n=i+a>>1;Fm(e,t,n,i,a,s),Vu(e,t,r,i,n-1,1-s),Vu(e,t,r,n+1,a,1-s)}function Fm(e,t,r,i,a,s){for(;a>i;){if(a-i>600){let u=a-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);Fm(e,t,r,Math.max(i,Math.floor(r-h*p/u+d)),Math.min(a,Math.floor(r+(u-h)*p/u+d)),s)}let n=t[2*r+s],o=i,l=a;for(Ea(e,t,i,r),t[2*a+s]>n&&Ea(e,t,i,a);o<l;){for(Ea(e,t,o,l),o++,l--;t[2*o+s]<n;)o++;for(;t[2*l+s]>n;)l--}t[2*i+s]===n?Ea(e,t,i,l):(l++,Ea(e,t,l,a)),l<=r&&(i=l+1),r<=l&&(a=l-1)}}function Ea(e,t,r,i){rl(e,r,i),rl(t,2*r,2*i),rl(t,2*r+1,2*i+1)}function rl(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function _d(e,t,r,i){let a=e-r,s=t-i;return a*a+s*s}const Sa=512/z/2;var u6=class{constructor(e,t,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let a=0;a<t.length;a++){let s=t.get(a),n=s.key,o=i.get(n);o?o.push(s):i.set(n,[s])}for(let[a,s]of i){let n={positions:s.map(o=>({x:Math.floor(o.anchorX*Sa),y:Math.floor(o.anchorY*Sa)})),crossTileIDs:s.map(o=>o.crossTileID)};if(n.positions.length>128){let o=new l6(n.positions.length,16,Uint16Array);for(let{x:l,y:u}of n.positions)o.add(l,u);o.finish(),delete n.positions,n.index=o}this._symbolsByKey[a]=n}}getScaledCoordinates(e,t){let{x:r,y:i,z:a}=this.tileID.canonical,{x:s,y:n,z:o}=t.canonical,l=o-a,u=Sa/2**l,h=(s*z+e.anchorX)*u,c=(n*z+e.anchorY)*u,p=r*z*Sa,d=i*z*Sa;return{x:Math.floor(h-p),y:Math.floor(c-d)}}findMatches(e,t,r){let i=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let s=e.get(a);if(s.crossTileID)continue;let n=this._symbolsByKey[s.key];if(!n)continue;let o=this.getScaledCoordinates(s,t);n.index?this.findMatchesForIndexedEntry(n,s,o,i,r):n.positions&&this.findMatchesForNonIndexedEntry(n,s,o,i,r)}}findMatchesForIndexedEntry(e,t,r,i,a){let s=e.index.range(r.x-i,r.y-i,r.x+i,r.y+i),n=1/0;for(let o of s)o<n&&!a[e.crossTileIDs[o]]&&(n=o);if(n!==1/0){let o=e.crossTileIDs[n];a[o]=!0,t.crossTileID=o}}findMatchesForNonIndexedEntry(e,t,r,i,a){for(let s=0;s<e.positions.length;s++){let n=e.positions[s],o=e.crossTileIDs[s];if(Math.abs(n.x-r.x)<=i&&Math.abs(n.y-r.y)<=i&&!a[o]){a[o]=!0,t.crossTileID=o;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},h6=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},c6=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let r in this.indexes){let i=this.indexes[r],a={};for(let s in i){let n=i[s];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),a[n.tileID.key]=n}this.indexes[r]=a}this.lng=e}addBucket(e,t,r){var a,s,n;if((a=this.indexes[e.overscaledZ])!=null&&a[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let o=0;o<t.symbolInstances.length;o++){let l=t.symbolInstances.get(o);l.crossTileID=0}(s=this.usedCrossTileIDs)[n=e.overscaledZ]||(s[n]={});let i=this.usedCrossTileIDs[e.overscaledZ];for(let o in this.indexes){let l=this.indexes[o];if(Number(o)>e.overscaledZ)for(let u in l){let h=l[u];h.tileID.isChildOf(e)&&h.findMatches(t.symbolInstances,e,i)}else{let u=l[e.scaledTo(Number(o)).key];u&&u.findMatches(t.symbolInstances,e,i)}}for(let o=0;o<t.symbolInstances.length;o++){let l=t.symbolInstances.get(o);l.crossTileID||(l.crossTileID=r.generate(),i[l.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new u6(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let r of t.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[e][i]}removeStaleBuckets(e){let t=!1;for(let r in this.indexes){let i=this.indexes[r];for(let a in i)e[i[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[a]),delete i[a],t=!0)}return t}},zm=class{constructor(){this.layerIndexes={},this.crossTileIDs=new h6,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,r){let i=this.layerIndexes[e.id];i===void 0&&(i=this.layerIndexes[e.id]=new c6);let a=!1,s={};i.handleWrapJump(r);for(let n of t){let o=n.getBucket(e);e.id===(o==null?void 0:o.layerIds[0])&&(o.bucketInstanceId||(o.bucketInstanceId=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId)),i.addBucket(n.tileID,o,this.crossTileIDs)&&(a=!0),s[o.bucketInstanceId]=!0)}return i.removeStaleBuckets(s)&&(a=!0),a}pruneUnusedLayers(e){let t={};for(let r of e)t[r]=!0;for(let r in this.layerIndexes)t[r]||delete this.layerIndexes[r]}},p6=`#ifdef GL_ES
|
|
9
|
+
precision mediump float;
|
|
10
|
+
#else
|
|
11
|
+
#if !defined(lowp)
|
|
12
|
+
#define lowp
|
|
13
|
+
#endif
|
|
14
|
+
#if !defined(mediump)
|
|
15
|
+
#define mediump
|
|
16
|
+
#endif
|
|
17
|
+
#if !defined(highp)
|
|
18
|
+
#define highp
|
|
19
|
+
#endif
|
|
20
|
+
#endif
|
|
21
|
+
out highp vec4 fragColor;`,d6=`#ifdef GL_ES
|
|
22
|
+
precision highp float;
|
|
23
|
+
#else
|
|
24
|
+
#if !defined(lowp)
|
|
25
|
+
#define lowp
|
|
26
|
+
#endif
|
|
27
|
+
#if !defined(mediump)
|
|
28
|
+
#define mediump
|
|
29
|
+
#endif
|
|
30
|
+
#if !defined(highp)
|
|
31
|
+
#define highp
|
|
32
|
+
#endif
|
|
33
|
+
#endif
|
|
34
|
+
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|
35
|
+
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
|
|
36
|
+
);}
|
|
37
|
+
#ifdef TERRAIN3D
|
|
38
|
+
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|
39
|
+
#endif
|
|
40
|
+
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
|
|
41
|
+
#ifdef TERRAIN3D
|
|
42
|
+
highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|
43
|
+
#else
|
|
44
|
+
return 1.0;
|
|
45
|
+
#endif
|
|
46
|
+
}float calculate_visibility(vec4 pos) {
|
|
47
|
+
#ifdef TERRAIN3D
|
|
48
|
+
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
|
|
49
|
+
#else
|
|
50
|
+
return 1.0;
|
|
51
|
+
#endif
|
|
52
|
+
}float ele(ivec2 pos) {
|
|
53
|
+
#ifdef TERRAIN3D
|
|
54
|
+
vec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|
55
|
+
#else
|
|
56
|
+
return 0.0;
|
|
57
|
+
#endif
|
|
58
|
+
}float get_elevation(vec2 pos) {
|
|
59
|
+
#ifdef TERRAIN3D
|
|
60
|
+
#ifdef GLOBE
|
|
61
|
+
if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
|
|
62
|
+
#endif
|
|
63
|
+
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
|
|
64
|
+
#else
|
|
65
|
+
return 0.0;
|
|
66
|
+
#endif
|
|
67
|
+
}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`,f6=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
|
|
68
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
69
|
+
fragColor=vec4(1.0);
|
|
70
|
+
#endif
|
|
71
|
+
}`,m6="layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",g6=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
72
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
73
|
+
fragColor=vec4(1.0);
|
|
74
|
+
#endif
|
|
75
|
+
}`,_6="uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",y6=`in vec3 v_data;flat in float v_visibility;
|
|
76
|
+
#pragma maplibre: define highp vec4 color
|
|
77
|
+
#pragma maplibre: define mediump float radius
|
|
78
|
+
#pragma maplibre: define lowp float blur
|
|
79
|
+
#pragma maplibre: define lowp float opacity
|
|
80
|
+
#pragma maplibre: define highp vec4 stroke_color
|
|
81
|
+
#pragma maplibre: define mediump float stroke_width
|
|
82
|
+
#pragma maplibre: define lowp float stroke_opacity
|
|
83
|
+
void main() {
|
|
84
|
+
#pragma maplibre: initialize highp vec4 color
|
|
85
|
+
#pragma maplibre: initialize mediump float radius
|
|
86
|
+
#pragma maplibre: initialize lowp float blur
|
|
87
|
+
#pragma maplibre: initialize lowp float opacity
|
|
88
|
+
#pragma maplibre: initialize highp vec4 stroke_color
|
|
89
|
+
#pragma maplibre: initialize mediump float stroke_width
|
|
90
|
+
#pragma maplibre: initialize lowp float stroke_opacity
|
|
91
|
+
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
|
|
92
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
93
|
+
fragColor=vec4(1.0);
|
|
94
|
+
#endif
|
|
95
|
+
}`,v6=`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility;
|
|
96
|
+
#pragma maplibre: define highp vec4 color
|
|
97
|
+
#pragma maplibre: define mediump float radius
|
|
98
|
+
#pragma maplibre: define lowp float blur
|
|
99
|
+
#pragma maplibre: define lowp float opacity
|
|
100
|
+
#pragma maplibre: define highp vec4 stroke_color
|
|
101
|
+
#pragma maplibre: define mediump float stroke_width
|
|
102
|
+
#pragma maplibre: define lowp float stroke_opacity
|
|
103
|
+
void main(void) {
|
|
104
|
+
#pragma maplibre: initialize highp vec4 color
|
|
105
|
+
#pragma maplibre: initialize mediump float radius
|
|
106
|
+
#pragma maplibre: initialize lowp float blur
|
|
107
|
+
#pragma maplibre: initialize lowp float opacity
|
|
108
|
+
#pragma maplibre: initialize highp vec4 stroke_color
|
|
109
|
+
#pragma maplibre: initialize mediump float stroke_width
|
|
110
|
+
#pragma maplibre: initialize lowp float stroke_opacity
|
|
111
|
+
ivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
|
|
112
|
+
#ifdef GLOBE
|
|
113
|
+
vec3 center_vector=projectToSphere(circle_center);
|
|
114
|
+
#endif
|
|
115
|
+
float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
|
|
116
|
+
#ifdef GLOBE
|
|
117
|
+
vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
|
|
118
|
+
#else
|
|
119
|
+
vec4 projected_center=projectTileWithElevation(circle_center,ele);
|
|
120
|
+
#endif
|
|
121
|
+
corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
|
|
122
|
+
#ifdef GLOBE
|
|
123
|
+
vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
|
|
124
|
+
#else
|
|
125
|
+
gl_Position=projectTileWithElevation(corner_position,ele);
|
|
126
|
+
#endif
|
|
127
|
+
} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,yd="void main() {fragColor=vec4(1.0);}";const sr={prelude:ne(p6,d6),projectionMercator:ne(`
|
|
128
|
+
void clipAntimeridian() {}`,"float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:ne("uniform bool u_projection_clip_antimeridian;in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}",`#define GLOBE_RADIUS 6371008.8
|
|
129
|
+
uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;out highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
|
|
130
|
+
);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy
|
|
131
|
+
);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:ne(f6,m6),backgroundPattern:ne(g6,_6),circle:ne(y6,v6),clippingMask:ne(yd,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:ne(`uniform highp float u_intensity;in vec2 v_extrude;
|
|
132
|
+
#pragma maplibre: define highp float weight
|
|
133
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
134
|
+
void main() {
|
|
135
|
+
#pragma maplibre: initialize highp float weight
|
|
136
|
+
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
|
|
137
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
138
|
+
fragColor=vec4(1.0);
|
|
139
|
+
#endif
|
|
140
|
+
}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;
|
|
141
|
+
#pragma maplibre: define highp float weight
|
|
142
|
+
#pragma maplibre: define mediump float radius
|
|
143
|
+
const highp float ZERO=1.0/255.0/16.0;
|
|
144
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
145
|
+
void main(void) {
|
|
146
|
+
#pragma maplibre: initialize highp float weight
|
|
147
|
+
#pragma maplibre: initialize mediump float radius
|
|
148
|
+
ivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3);
|
|
149
|
+
#ifdef GLOBE
|
|
150
|
+
vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
|
|
151
|
+
#else
|
|
152
|
+
gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
|
|
153
|
+
#endif
|
|
154
|
+
}`),heatmapTexture:ne(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
|
|
155
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
156
|
+
fragColor=vec4(0.0);
|
|
157
|
+
#endif
|
|
158
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_world;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:ne("flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ne("flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;uniform vec2 u_viewport_size;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:ne(`#ifdef GL_ES
|
|
159
|
+
precision highp float;
|
|
160
|
+
#endif
|
|
161
|
+
uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
|
|
162
|
+
{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
|
|
163
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
164
|
+
fragColor=vec4(1.0);
|
|
165
|
+
#endif
|
|
166
|
+
}`,"uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:ne("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:ne(yd,`layout(location=0) in vec2 a_pos;void main() {
|
|
167
|
+
#ifdef GLOBE
|
|
168
|
+
gl_Position=projectTileFor3D(a_pos,0.0);
|
|
169
|
+
#else
|
|
170
|
+
gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
|
|
171
|
+
#endif
|
|
172
|
+
}`),fill:ne(`#pragma maplibre: define highp vec4 color
|
|
173
|
+
#pragma maplibre: define lowp float opacity
|
|
174
|
+
void main() {
|
|
175
|
+
#pragma maplibre: initialize highp vec4 color
|
|
176
|
+
#pragma maplibre: initialize lowp float opacity
|
|
177
|
+
fragColor=color*opacity;
|
|
178
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
179
|
+
fragColor=vec4(1.0);
|
|
180
|
+
#endif
|
|
181
|
+
}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;
|
|
182
|
+
#pragma maplibre: define highp vec4 color
|
|
183
|
+
#pragma maplibre: define lowp float opacity
|
|
184
|
+
void main() {
|
|
185
|
+
#pragma maplibre: initialize highp vec4 color
|
|
186
|
+
#pragma maplibre: initialize lowp float opacity
|
|
187
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:ne(`in vec2 v_pos;
|
|
188
|
+
#ifdef GLOBE
|
|
189
|
+
in float v_depth;
|
|
190
|
+
#endif
|
|
191
|
+
#pragma maplibre: define highp vec4 outline_color
|
|
192
|
+
#pragma maplibre: define lowp float opacity
|
|
193
|
+
void main() {
|
|
194
|
+
#pragma maplibre: initialize highp vec4 outline_color
|
|
195
|
+
#pragma maplibre: initialize lowp float opacity
|
|
196
|
+
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
|
|
197
|
+
#ifdef GLOBE
|
|
198
|
+
if (v_depth > 1.0) {discard;}
|
|
199
|
+
#endif
|
|
200
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
201
|
+
fragColor=vec4(1.0);
|
|
202
|
+
#endif
|
|
203
|
+
}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;
|
|
204
|
+
#ifdef GLOBE
|
|
205
|
+
out float v_depth;
|
|
206
|
+
#endif
|
|
207
|
+
#pragma maplibre: define highp vec4 outline_color
|
|
208
|
+
#pragma maplibre: define lowp float opacity
|
|
209
|
+
void main() {
|
|
210
|
+
#pragma maplibre: initialize highp vec4 outline_color
|
|
211
|
+
#pragma maplibre: initialize lowp float opacity
|
|
212
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
|
213
|
+
#ifdef GLOBE
|
|
214
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
215
|
+
#endif
|
|
216
|
+
}`),fillOutlinePattern:ne(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
|
|
217
|
+
#ifdef GLOBE
|
|
218
|
+
in float v_depth;
|
|
219
|
+
#endif
|
|
220
|
+
#pragma maplibre: define lowp float opacity
|
|
221
|
+
#pragma maplibre: define lowp vec4 pattern_from
|
|
222
|
+
#pragma maplibre: define lowp vec4 pattern_to
|
|
223
|
+
void main() {
|
|
224
|
+
#pragma maplibre: initialize lowp float opacity
|
|
225
|
+
#pragma maplibre: initialize mediump vec4 pattern_from
|
|
226
|
+
#pragma maplibre: initialize mediump vec4 pattern_to
|
|
227
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
228
|
+
#ifdef GLOBE
|
|
229
|
+
if (v_depth > 1.0) {discard;}
|
|
230
|
+
#endif
|
|
231
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
232
|
+
fragColor=vec4(1.0);
|
|
233
|
+
#endif
|
|
234
|
+
}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
|
|
235
|
+
#ifdef GLOBE
|
|
236
|
+
out float v_depth;
|
|
237
|
+
#endif
|
|
238
|
+
#pragma maplibre: define lowp float opacity
|
|
239
|
+
#pragma maplibre: define lowp vec4 pattern_from
|
|
240
|
+
#pragma maplibre: define lowp vec4 pattern_to
|
|
241
|
+
#pragma maplibre: define lowp float pixel_ratio_from
|
|
242
|
+
#pragma maplibre: define lowp float pixel_ratio_to
|
|
243
|
+
void main() {
|
|
244
|
+
#pragma maplibre: initialize lowp float opacity
|
|
245
|
+
#pragma maplibre: initialize mediump vec4 pattern_from
|
|
246
|
+
#pragma maplibre: initialize mediump vec4 pattern_to
|
|
247
|
+
#pragma maplibre: initialize lowp float pixel_ratio_from
|
|
248
|
+
#pragma maplibre: initialize lowp float pixel_ratio_to
|
|
249
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
|
250
|
+
#ifdef GLOBE
|
|
251
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
252
|
+
#endif
|
|
253
|
+
}`),fillPattern:ne(`#ifdef GL_ES
|
|
254
|
+
precision highp float;
|
|
255
|
+
#endif
|
|
256
|
+
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
|
|
257
|
+
#pragma maplibre: define lowp float opacity
|
|
258
|
+
#pragma maplibre: define lowp vec4 pattern_from
|
|
259
|
+
#pragma maplibre: define lowp vec4 pattern_to
|
|
260
|
+
void main() {
|
|
261
|
+
#pragma maplibre: initialize lowp float opacity
|
|
262
|
+
#pragma maplibre: initialize mediump vec4 pattern_from
|
|
263
|
+
#pragma maplibre: initialize mediump vec4 pattern_to
|
|
264
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
|
|
265
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
266
|
+
fragColor=vec4(1.0);
|
|
267
|
+
#endif
|
|
268
|
+
}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
|
|
269
|
+
#pragma maplibre: define lowp float opacity
|
|
270
|
+
#pragma maplibre: define lowp vec4 pattern_from
|
|
271
|
+
#pragma maplibre: define lowp vec4 pattern_to
|
|
272
|
+
#pragma maplibre: define lowp float pixel_ratio_from
|
|
273
|
+
#pragma maplibre: define lowp float pixel_ratio_to
|
|
274
|
+
void main() {
|
|
275
|
+
#pragma maplibre: initialize lowp float opacity
|
|
276
|
+
#pragma maplibre: initialize mediump vec4 pattern_from
|
|
277
|
+
#pragma maplibre: initialize mediump vec4 pattern_to
|
|
278
|
+
#pragma maplibre: initialize lowp float pixel_ratio_from
|
|
279
|
+
#pragma maplibre: initialize lowp float pixel_ratio_to
|
|
280
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:ne(`in vec4 v_color;void main() {fragColor=v_color;
|
|
281
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
282
|
+
fragColor=vec4(1.0);
|
|
283
|
+
#endif
|
|
284
|
+
}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;
|
|
285
|
+
#ifdef TERRAIN3D
|
|
286
|
+
layout(location=2) in vec2 a_centroid;
|
|
287
|
+
#endif
|
|
288
|
+
out vec4 v_color;
|
|
289
|
+
#pragma maplibre: define highp float base
|
|
290
|
+
#pragma maplibre: define highp float height
|
|
291
|
+
#pragma maplibre: define highp vec4 color
|
|
292
|
+
void main() {
|
|
293
|
+
#pragma maplibre: initialize highp float base
|
|
294
|
+
#pragma maplibre: initialize highp float height
|
|
295
|
+
#pragma maplibre: initialize highp vec4 color
|
|
296
|
+
vec3 normal=vec3(a_normal_ed.xyz);
|
|
297
|
+
#ifdef TERRAIN3D
|
|
298
|
+
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
299
|
+
#else
|
|
300
|
+
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
301
|
+
#endif
|
|
302
|
+
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
|
|
303
|
+
#ifdef GLOBE
|
|
304
|
+
vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
|
|
305
|
+
#else
|
|
306
|
+
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
|
|
307
|
+
#endif
|
|
308
|
+
float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
|
|
309
|
+
#ifdef GLOBE
|
|
310
|
+
mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
|
|
311
|
+
#endif
|
|
312
|
+
directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:ne(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
|
|
313
|
+
#pragma maplibre: define lowp float base
|
|
314
|
+
#pragma maplibre: define lowp float height
|
|
315
|
+
#pragma maplibre: define lowp vec4 pattern_from
|
|
316
|
+
#pragma maplibre: define lowp vec4 pattern_to
|
|
317
|
+
#pragma maplibre: define lowp float pixel_ratio_from
|
|
318
|
+
#pragma maplibre: define lowp float pixel_ratio_to
|
|
319
|
+
void main() {
|
|
320
|
+
#pragma maplibre: initialize lowp float base
|
|
321
|
+
#pragma maplibre: initialize lowp float height
|
|
322
|
+
#pragma maplibre: initialize mediump vec4 pattern_from
|
|
323
|
+
#pragma maplibre: initialize mediump vec4 pattern_to
|
|
324
|
+
#pragma maplibre: initialize lowp float pixel_ratio_from
|
|
325
|
+
#pragma maplibre: initialize lowp float pixel_ratio_to
|
|
326
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
|
|
327
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
328
|
+
fragColor=vec4(1.0);
|
|
329
|
+
#endif
|
|
330
|
+
}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;
|
|
331
|
+
#ifdef TERRAIN3D
|
|
332
|
+
layout(location=2) in vec2 a_centroid;
|
|
333
|
+
#endif
|
|
334
|
+
#ifdef GLOBE
|
|
335
|
+
out vec3 v_sphere_pos;
|
|
336
|
+
#endif
|
|
337
|
+
out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
|
|
338
|
+
#pragma maplibre: define lowp float base
|
|
339
|
+
#pragma maplibre: define lowp float height
|
|
340
|
+
#pragma maplibre: define lowp vec4 pattern_from
|
|
341
|
+
#pragma maplibre: define lowp vec4 pattern_to
|
|
342
|
+
#pragma maplibre: define lowp float pixel_ratio_from
|
|
343
|
+
#pragma maplibre: define lowp float pixel_ratio_to
|
|
344
|
+
void main() {
|
|
345
|
+
#pragma maplibre: initialize lowp float base
|
|
346
|
+
#pragma maplibre: initialize lowp float height
|
|
347
|
+
#pragma maplibre: initialize mediump vec4 pattern_from
|
|
348
|
+
#pragma maplibre: initialize mediump vec4 pattern_to
|
|
349
|
+
#pragma maplibre: initialize lowp float pixel_ratio_from
|
|
350
|
+
#pragma maplibre: initialize lowp float pixel_ratio_to
|
|
351
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=vec3(a_normal_ed.xyz);float edgedistance=float(a_normal_ed.w);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
|
|
352
|
+
#ifdef TERRAIN3D
|
|
353
|
+
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
354
|
+
#else
|
|
355
|
+
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
356
|
+
#endif
|
|
357
|
+
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
|
|
358
|
+
#ifdef GLOBE
|
|
359
|
+
vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
|
|
360
|
+
#else
|
|
361
|
+
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
|
|
362
|
+
#endif
|
|
363
|
+
vec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384
|
|
364
|
+
? a_pos
|
|
365
|
+
: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:ne(`#ifdef GL_ES
|
|
366
|
+
precision highp float;
|
|
367
|
+
#endif
|
|
368
|
+
uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-2.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
|
|
369
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
370
|
+
fragColor=vec4(1.0);
|
|
371
|
+
#endif
|
|
372
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:ne(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
|
|
373
|
+
#define PI 3.141592653589793
|
|
374
|
+
#define STANDARD 0
|
|
375
|
+
#define COMBINED 1
|
|
376
|
+
#define IGOR 2
|
|
377
|
+
#define MULTIDIRECTIONAL 3
|
|
378
|
+
#define BASIC 4
|
|
379
|
+
float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
|
|
380
|
+
{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
|
|
381
|
+
{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
|
|
382
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
383
|
+
fragColor=vec4(1.0);
|
|
384
|
+
#endif
|
|
385
|
+
}`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:ne(`uniform lowp float u_device_pixel_ratio;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
|
|
386
|
+
#ifdef GLOBE
|
|
387
|
+
in float v_depth;
|
|
388
|
+
#endif
|
|
389
|
+
#pragma maplibre: define highp vec4 color
|
|
390
|
+
#pragma maplibre: define lowp float blur
|
|
391
|
+
#pragma maplibre: define lowp float opacity
|
|
392
|
+
void main() {
|
|
393
|
+
#pragma maplibre: initialize highp vec4 color
|
|
394
|
+
#pragma maplibre: initialize lowp float blur
|
|
395
|
+
#pragma maplibre: initialize lowp float opacity
|
|
396
|
+
clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
|
|
397
|
+
#ifdef GLOBE
|
|
398
|
+
if (v_depth > 1.0) {discard;}
|
|
399
|
+
#endif
|
|
400
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
401
|
+
fragColor=vec4(1.0);
|
|
402
|
+
#endif
|
|
403
|
+
}`,`
|
|
404
|
+
#define scale 0.015873016
|
|
405
|
+
layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
|
|
406
|
+
#ifdef GLOBE
|
|
407
|
+
out float v_depth;
|
|
408
|
+
#endif
|
|
409
|
+
#pragma maplibre: define highp vec4 color
|
|
410
|
+
#pragma maplibre: define lowp float blur
|
|
411
|
+
#pragma maplibre: define lowp float opacity
|
|
412
|
+
#pragma maplibre: define mediump float gapwidth
|
|
413
|
+
#pragma maplibre: define lowp float offset
|
|
414
|
+
#pragma maplibre: define mediump float width
|
|
415
|
+
void main() {
|
|
416
|
+
#pragma maplibre: initialize highp vec4 color
|
|
417
|
+
#pragma maplibre: initialize lowp float blur
|
|
418
|
+
#pragma maplibre: initialize lowp float opacity
|
|
419
|
+
#pragma maplibre: initialize mediump float gapwidth
|
|
420
|
+
#pragma maplibre: initialize lowp float offset
|
|
421
|
+
#pragma maplibre: initialize mediump float width
|
|
422
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
423
|
+
#ifdef GLOBE
|
|
424
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
425
|
+
#endif
|
|
426
|
+
#ifdef TERRAIN3D
|
|
427
|
+
v_gamma_scale=1.0;
|
|
428
|
+
#else
|
|
429
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
430
|
+
#endif
|
|
431
|
+
v_width2=vec2(outset,inset);}`),lineGradient:ne(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
|
|
432
|
+
#ifdef GLOBE
|
|
433
|
+
in float v_depth;
|
|
434
|
+
#endif
|
|
435
|
+
#pragma maplibre: define lowp float blur
|
|
436
|
+
#pragma maplibre: define lowp float opacity
|
|
437
|
+
void main() {
|
|
438
|
+
#pragma maplibre: initialize lowp float blur
|
|
439
|
+
#pragma maplibre: initialize lowp float opacity
|
|
440
|
+
clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
|
|
441
|
+
#ifdef GLOBE
|
|
442
|
+
if (v_depth > 1.0) {discard;}
|
|
443
|
+
#endif
|
|
444
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
445
|
+
fragColor=vec4(1.0);
|
|
446
|
+
#endif
|
|
447
|
+
}`,`
|
|
448
|
+
#define scale 0.015873016
|
|
449
|
+
layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
|
|
450
|
+
#ifdef GLOBE
|
|
451
|
+
out float v_depth;
|
|
452
|
+
#endif
|
|
453
|
+
#pragma maplibre: define lowp float blur
|
|
454
|
+
#pragma maplibre: define lowp float opacity
|
|
455
|
+
#pragma maplibre: define mediump float gapwidth
|
|
456
|
+
#pragma maplibre: define lowp float offset
|
|
457
|
+
#pragma maplibre: define mediump float width
|
|
458
|
+
void main() {
|
|
459
|
+
#pragma maplibre: initialize lowp float blur
|
|
460
|
+
#pragma maplibre: initialize lowp float opacity
|
|
461
|
+
#pragma maplibre: initialize mediump float gapwidth
|
|
462
|
+
#pragma maplibre: initialize lowp float offset
|
|
463
|
+
#pragma maplibre: initialize mediump float width
|
|
464
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
465
|
+
#ifdef GLOBE
|
|
466
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
467
|
+
#endif
|
|
468
|
+
#ifdef TERRAIN3D
|
|
469
|
+
v_gamma_scale=1.0;
|
|
470
|
+
#else
|
|
471
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
472
|
+
#endif
|
|
473
|
+
v_width2=vec2(outset,inset);}`),linePattern:ne(`#ifdef GL_ES
|
|
474
|
+
precision highp float;
|
|
475
|
+
#endif
|
|
476
|
+
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;
|
|
477
|
+
#ifdef GLOBE
|
|
478
|
+
in float v_depth;
|
|
479
|
+
#endif
|
|
480
|
+
#pragma maplibre: define lowp vec4 pattern_from
|
|
481
|
+
#pragma maplibre: define lowp vec4 pattern_to
|
|
482
|
+
#pragma maplibre: define lowp float pixel_ratio_from
|
|
483
|
+
#pragma maplibre: define lowp float pixel_ratio_to
|
|
484
|
+
#pragma maplibre: define lowp float blur
|
|
485
|
+
#pragma maplibre: define lowp float opacity
|
|
486
|
+
void main() {
|
|
487
|
+
#pragma maplibre: initialize mediump vec4 pattern_from
|
|
488
|
+
#pragma maplibre: initialize mediump vec4 pattern_to
|
|
489
|
+
#pragma maplibre: initialize lowp float pixel_ratio_from
|
|
490
|
+
#pragma maplibre: initialize lowp float pixel_ratio_to
|
|
491
|
+
#pragma maplibre: initialize lowp float blur
|
|
492
|
+
#pragma maplibre: initialize lowp float opacity
|
|
493
|
+
clipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
|
|
494
|
+
#ifdef GLOBE
|
|
495
|
+
if (v_depth > 1.0) {discard;}
|
|
496
|
+
#endif
|
|
497
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
498
|
+
fragColor=vec4(1.0);
|
|
499
|
+
#endif
|
|
500
|
+
}`,`
|
|
501
|
+
#define scale 0.015873016
|
|
502
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
503
|
+
layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;
|
|
504
|
+
#ifdef GLOBE
|
|
505
|
+
out float v_depth;
|
|
506
|
+
#endif
|
|
507
|
+
#pragma maplibre: define lowp float blur
|
|
508
|
+
#pragma maplibre: define lowp float opacity
|
|
509
|
+
#pragma maplibre: define lowp float offset
|
|
510
|
+
#pragma maplibre: define mediump float gapwidth
|
|
511
|
+
#pragma maplibre: define mediump float width
|
|
512
|
+
#pragma maplibre: define lowp float floorwidth
|
|
513
|
+
#pragma maplibre: define lowp vec4 pattern_from
|
|
514
|
+
#pragma maplibre: define lowp vec4 pattern_to
|
|
515
|
+
#pragma maplibre: define lowp float pixel_ratio_from
|
|
516
|
+
#pragma maplibre: define lowp float pixel_ratio_to
|
|
517
|
+
void main() {
|
|
518
|
+
#pragma maplibre: initialize lowp float blur
|
|
519
|
+
#pragma maplibre: initialize lowp float opacity
|
|
520
|
+
#pragma maplibre: initialize lowp float offset
|
|
521
|
+
#pragma maplibre: initialize mediump float gapwidth
|
|
522
|
+
#pragma maplibre: initialize mediump float width
|
|
523
|
+
#pragma maplibre: initialize lowp float floorwidth
|
|
524
|
+
#pragma maplibre: initialize mediump vec4 pattern_from
|
|
525
|
+
#pragma maplibre: initialize mediump vec4 pattern_to
|
|
526
|
+
#pragma maplibre: initialize lowp float pixel_ratio_from
|
|
527
|
+
#pragma maplibre: initialize lowp float pixel_ratio_to
|
|
528
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
529
|
+
#ifdef GLOBE
|
|
530
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
531
|
+
#endif
|
|
532
|
+
#ifdef TERRAIN3D
|
|
533
|
+
v_gamma_scale=1.0;
|
|
534
|
+
#else
|
|
535
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
536
|
+
#endif
|
|
537
|
+
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:ne(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
|
|
538
|
+
#ifdef GLOBE
|
|
539
|
+
in float v_depth;
|
|
540
|
+
#endif
|
|
541
|
+
#pragma maplibre: define highp vec4 color
|
|
542
|
+
#pragma maplibre: define lowp float blur
|
|
543
|
+
#pragma maplibre: define lowp float opacity
|
|
544
|
+
#pragma maplibre: define mediump float width
|
|
545
|
+
#pragma maplibre: define lowp float floorwidth
|
|
546
|
+
#pragma maplibre: define mediump vec4 dasharray_from
|
|
547
|
+
#pragma maplibre: define mediump vec4 dasharray_to
|
|
548
|
+
void main() {
|
|
549
|
+
#pragma maplibre: initialize highp vec4 color
|
|
550
|
+
#pragma maplibre: initialize lowp float blur
|
|
551
|
+
#pragma maplibre: initialize lowp float opacity
|
|
552
|
+
#pragma maplibre: initialize mediump float width
|
|
553
|
+
#pragma maplibre: initialize lowp float floorwidth
|
|
554
|
+
#pragma maplibre: initialize mediump vec4 dasharray_from
|
|
555
|
+
#pragma maplibre: initialize mediump vec4 dasharray_to
|
|
556
|
+
clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
|
|
557
|
+
#ifdef GLOBE
|
|
558
|
+
if (v_depth > 1.0) {discard;}
|
|
559
|
+
#endif
|
|
560
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
561
|
+
fragColor=vec4(1.0);
|
|
562
|
+
#endif
|
|
563
|
+
}`,`
|
|
564
|
+
#define scale 0.015873016
|
|
565
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
566
|
+
layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
|
|
567
|
+
#ifdef GLOBE
|
|
568
|
+
out float v_depth;
|
|
569
|
+
#endif
|
|
570
|
+
#pragma maplibre: define highp vec4 color
|
|
571
|
+
#pragma maplibre: define lowp float blur
|
|
572
|
+
#pragma maplibre: define lowp float opacity
|
|
573
|
+
#pragma maplibre: define mediump float gapwidth
|
|
574
|
+
#pragma maplibre: define lowp float offset
|
|
575
|
+
#pragma maplibre: define mediump float width
|
|
576
|
+
#pragma maplibre: define lowp float floorwidth
|
|
577
|
+
#pragma maplibre: define mediump vec4 dasharray_from
|
|
578
|
+
#pragma maplibre: define mediump vec4 dasharray_to
|
|
579
|
+
void main() {
|
|
580
|
+
#pragma maplibre: initialize highp vec4 color
|
|
581
|
+
#pragma maplibre: initialize lowp float blur
|
|
582
|
+
#pragma maplibre: initialize lowp float opacity
|
|
583
|
+
#pragma maplibre: initialize mediump float gapwidth
|
|
584
|
+
#pragma maplibre: initialize lowp float offset
|
|
585
|
+
#pragma maplibre: initialize mediump float width
|
|
586
|
+
#pragma maplibre: initialize lowp float floorwidth
|
|
587
|
+
#pragma maplibre: initialize mediump vec4 dasharray_from
|
|
588
|
+
#pragma maplibre: initialize mediump vec4 dasharray_to
|
|
589
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
590
|
+
#ifdef GLOBE
|
|
591
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
592
|
+
#endif
|
|
593
|
+
#ifdef TERRAIN3D
|
|
594
|
+
v_gamma_scale=1.0;
|
|
595
|
+
#else
|
|
596
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
597
|
+
#endif
|
|
598
|
+
float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:ne(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
|
|
599
|
+
#ifdef GLOBE
|
|
600
|
+
in float v_depth;
|
|
601
|
+
#endif
|
|
602
|
+
#pragma maplibre: define lowp float blur
|
|
603
|
+
#pragma maplibre: define lowp float opacity
|
|
604
|
+
#pragma maplibre: define mediump float width
|
|
605
|
+
#pragma maplibre: define lowp float floorwidth
|
|
606
|
+
#pragma maplibre: define mediump vec4 dasharray_from
|
|
607
|
+
#pragma maplibre: define mediump vec4 dasharray_to
|
|
608
|
+
void main() {
|
|
609
|
+
#pragma maplibre: initialize lowp float blur
|
|
610
|
+
#pragma maplibre: initialize lowp float opacity
|
|
611
|
+
#pragma maplibre: initialize mediump float width
|
|
612
|
+
#pragma maplibre: initialize lowp float floorwidth
|
|
613
|
+
#pragma maplibre: initialize mediump vec4 dasharray_from
|
|
614
|
+
#pragma maplibre: initialize mediump vec4 dasharray_to
|
|
615
|
+
clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
|
|
616
|
+
#ifdef GLOBE
|
|
617
|
+
if (v_depth > 1.0) {discard;}
|
|
618
|
+
#endif
|
|
619
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
620
|
+
fragColor=vec4(1.0);
|
|
621
|
+
#endif
|
|
622
|
+
}`,`
|
|
623
|
+
#define scale 0.015873016
|
|
624
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
625
|
+
layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
|
|
626
|
+
#ifdef GLOBE
|
|
627
|
+
out float v_depth;
|
|
628
|
+
#endif
|
|
629
|
+
#pragma maplibre: define lowp float blur
|
|
630
|
+
#pragma maplibre: define lowp float opacity
|
|
631
|
+
#pragma maplibre: define mediump float gapwidth
|
|
632
|
+
#pragma maplibre: define lowp float offset
|
|
633
|
+
#pragma maplibre: define mediump float width
|
|
634
|
+
#pragma maplibre: define lowp float floorwidth
|
|
635
|
+
#pragma maplibre: define mediump vec4 dasharray_from
|
|
636
|
+
#pragma maplibre: define mediump vec4 dasharray_to
|
|
637
|
+
void main() {
|
|
638
|
+
#pragma maplibre: initialize lowp float blur
|
|
639
|
+
#pragma maplibre: initialize lowp float opacity
|
|
640
|
+
#pragma maplibre: initialize mediump float gapwidth
|
|
641
|
+
#pragma maplibre: initialize lowp float offset
|
|
642
|
+
#pragma maplibre: initialize mediump float width
|
|
643
|
+
#pragma maplibre: initialize lowp float floorwidth
|
|
644
|
+
#pragma maplibre: initialize mediump vec4 dasharray_from
|
|
645
|
+
#pragma maplibre: initialize mediump vec4 dasharray_to
|
|
646
|
+
if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
647
|
+
#ifdef GLOBE
|
|
648
|
+
v_depth=gl_Position.z/gl_Position.w;
|
|
649
|
+
#endif
|
|
650
|
+
#ifdef TERRAIN3D
|
|
651
|
+
v_gamma_scale=1.0;
|
|
652
|
+
#else
|
|
653
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
654
|
+
#endif
|
|
655
|
+
float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),layerOpacity:ne(`uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;
|
|
656
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
657
|
+
fragColor=vec4(0.0);
|
|
658
|
+
#endif
|
|
659
|
+
}`,"layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:ne(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
660
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
661
|
+
fragColor=vec4(1.0);
|
|
662
|
+
#endif
|
|
663
|
+
}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;
|
|
664
|
+
#ifdef GLOBE
|
|
665
|
+
if (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}
|
|
666
|
+
#endif
|
|
667
|
+
float perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}`),symbolIcon:ne(`uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
|
|
668
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
669
|
+
fragColor=vec4(1.0);
|
|
670
|
+
#endif
|
|
671
|
+
}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity;
|
|
672
|
+
#pragma maplibre: define lowp float opacity
|
|
673
|
+
void main() {
|
|
674
|
+
#pragma maplibre: initialize lowp float opacity
|
|
675
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
676
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
677
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
678
|
+
#ifdef GLOBE
|
|
679
|
+
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
680
|
+
#endif
|
|
681
|
+
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:ne(`#define SDF_PX 8.0
|
|
682
|
+
uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
|
|
683
|
+
#pragma maplibre: define highp vec4 fill_color
|
|
684
|
+
#pragma maplibre: define highp vec4 halo_color
|
|
685
|
+
#pragma maplibre: define lowp float halo_width
|
|
686
|
+
#pragma maplibre: define lowp float halo_blur
|
|
687
|
+
void main() {
|
|
688
|
+
#pragma maplibre: initialize highp vec4 fill_color
|
|
689
|
+
#pragma maplibre: initialize highp vec4 halo_color
|
|
690
|
+
#pragma maplibre: initialize lowp float halo_width
|
|
691
|
+
#pragma maplibre: initialize lowp float halo_blur
|
|
692
|
+
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
|
|
693
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
694
|
+
fragColor=vec4(1.0);
|
|
695
|
+
#endif
|
|
696
|
+
}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;
|
|
697
|
+
#pragma maplibre: define highp vec4 fill_color
|
|
698
|
+
#pragma maplibre: define highp vec4 halo_color
|
|
699
|
+
#pragma maplibre: define lowp float opacity
|
|
700
|
+
#pragma maplibre: define lowp float halo_width
|
|
701
|
+
#pragma maplibre: define lowp float halo_blur
|
|
702
|
+
void main() {
|
|
703
|
+
#pragma maplibre: initialize highp vec4 fill_color
|
|
704
|
+
#pragma maplibre: initialize highp vec4 halo_color
|
|
705
|
+
#pragma maplibre: initialize lowp float opacity
|
|
706
|
+
#pragma maplibre: initialize lowp float halo_width
|
|
707
|
+
#pragma maplibre: initialize lowp float halo_blur
|
|
708
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
709
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
710
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
711
|
+
#ifdef GLOBE
|
|
712
|
+
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
713
|
+
#endif
|
|
714
|
+
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:ne(`#define SDF_PX 8.0
|
|
715
|
+
#define SDF 1.0
|
|
716
|
+
#define ICON 0.0
|
|
717
|
+
uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;
|
|
718
|
+
#pragma maplibre: define highp vec4 fill_color
|
|
719
|
+
#pragma maplibre: define highp vec4 halo_color
|
|
720
|
+
#pragma maplibre: define lowp float halo_width
|
|
721
|
+
#pragma maplibre: define lowp float halo_blur
|
|
722
|
+
void main() {
|
|
723
|
+
#pragma maplibre: initialize highp vec4 fill_color
|
|
724
|
+
#pragma maplibre: initialize highp vec4 halo_color
|
|
725
|
+
#pragma maplibre: initialize lowp float halo_width
|
|
726
|
+
#pragma maplibre: initialize lowp float halo_blur
|
|
727
|
+
float total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
|
|
728
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
729
|
+
fragColor=vec4(1.0);
|
|
730
|
+
#endif
|
|
731
|
+
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
|
|
732
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
733
|
+
fragColor=vec4(1.0);
|
|
734
|
+
#endif
|
|
735
|
+
}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;
|
|
736
|
+
#pragma maplibre: define highp vec4 fill_color
|
|
737
|
+
#pragma maplibre: define highp vec4 halo_color
|
|
738
|
+
#pragma maplibre: define lowp float opacity
|
|
739
|
+
#pragma maplibre: define lowp float halo_width
|
|
740
|
+
#pragma maplibre: define lowp float halo_blur
|
|
741
|
+
void main() {
|
|
742
|
+
#pragma maplibre: initialize highp vec4 fill_color
|
|
743
|
+
#pragma maplibre: initialize highp vec4 halo_color
|
|
744
|
+
#pragma maplibre: initialize lowp float opacity
|
|
745
|
+
#pragma maplibre: initialize lowp float halo_width
|
|
746
|
+
#pragma maplibre: initialize lowp float halo_blur
|
|
747
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
748
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
749
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
750
|
+
#ifdef GLOBE
|
|
751
|
+
if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
752
|
+
#endif
|
|
753
|
+
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}`),terrain:ne("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:ne("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),atmosphere:ne(`#ifdef GL_ES
|
|
754
|
+
precision highp float;
|
|
755
|
+
#endif
|
|
756
|
+
in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
|
|
757
|
+
);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:ne("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","layout(location=0) in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function ne(e,t){let r=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=t.match(/in ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=s?s.concat(a):a,o=i?i.length:0,l={};return e=e.replace(r,(u,h,c,p,d)=>(l[d]=!0,h==="define"?`
|
|
758
|
+
#ifndef HAS_UNIFORM_u_${d}
|
|
759
|
+
in ${c} ${p} ${d};
|
|
760
|
+
#else
|
|
761
|
+
uniform ${c} ${p} u_${d};
|
|
762
|
+
#endif
|
|
763
|
+
`:`
|
|
764
|
+
#ifdef HAS_UNIFORM_u_${d}
|
|
765
|
+
${c} ${p} ${d} = u_${d};
|
|
766
|
+
#endif
|
|
767
|
+
`)),t=t.replace(r,(u,h,c,p,d)=>{let f=p==="float"?"vec2":"vec4",m=d.match(/color/)?"color":f;return l[d]?h==="define"?`
|
|
768
|
+
#ifndef HAS_UNIFORM_u_${d}
|
|
769
|
+
uniform lowp float u_${d}_t;
|
|
770
|
+
layout(location = ${o++}) in ${c} ${f} a_${d};
|
|
771
|
+
out ${c} ${p} ${d};
|
|
772
|
+
#else
|
|
773
|
+
uniform ${c} ${p} u_${d};
|
|
774
|
+
#endif
|
|
775
|
+
`:m==="vec4"?`
|
|
776
|
+
#ifndef HAS_UNIFORM_u_${d}
|
|
777
|
+
${d} = a_${d};
|
|
778
|
+
#else
|
|
779
|
+
${c} ${p} ${d} = u_${d};
|
|
780
|
+
#endif
|
|
781
|
+
`:`
|
|
782
|
+
#ifndef HAS_UNIFORM_u_${d}
|
|
783
|
+
${d} = unpack_mix_${m}(a_${d}, u_${d}_t);
|
|
784
|
+
#else
|
|
785
|
+
${c} ${p} ${d} = u_${d};
|
|
786
|
+
#endif
|
|
787
|
+
`:h==="define"?`
|
|
788
|
+
#ifndef HAS_UNIFORM_u_${d}
|
|
789
|
+
uniform lowp float u_${d}_t;
|
|
790
|
+
layout(location = ${o++}) in ${c} ${f} a_${d};
|
|
791
|
+
#else
|
|
792
|
+
uniform ${c} ${p} u_${d};
|
|
793
|
+
#endif
|
|
794
|
+
`:m==="vec4"?`
|
|
795
|
+
#ifndef HAS_UNIFORM_u_${d}
|
|
796
|
+
${c} ${p} ${d} = a_${d};
|
|
797
|
+
#else
|
|
798
|
+
${c} ${p} ${d} = u_${d};
|
|
799
|
+
#endif
|
|
800
|
+
`:`
|
|
801
|
+
#ifndef HAS_UNIFORM_u_${d}
|
|
802
|
+
${c} ${p} ${d} = unpack_mix_${m}(a_${d}, u_${d}_t);
|
|
803
|
+
#else
|
|
804
|
+
${c} ${p} ${d} = u_${d};
|
|
805
|
+
#endif
|
|
806
|
+
`}),{fragmentSource:e,vertexSource:t,staticAttributes:i,staticUniforms:n}}const km="#define PROJECTION_MERCATOR",Rm="mercator";var ju=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Rm}get shaderDefine(){return km}get shaderPreludeCode(){return sr.projectionMercator}get vertexShaderPreludeCode(){return sr.projectionMercator.vertexSource}get subdivisionGranularity(){return Ah.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t,r,i,a){if(this._cachedMesh)return this._cachedMesh;let s=new $r;s.emplaceBack(0,0),s.emplaceBack(z,0),s.emplaceBack(0,z),s.emplaceBack(z,z);let n=e.createVertexBuffer(s,li.members),o=De.simpleSegment(0,0,4,2),l=new fr;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new As(n,u,o),this._cachedMesh}recalculate(){}hasTransition(){return!1}},vd=class Bm{constructor(t=0,r=0,i=0,a=0){if(isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=r,this.left=i,this.right=a}interpolate(t,r,i){return r.top!=null&&t.top!=null&&(this.top=Ne.number(t.top,r.top,i)),r.bottom!=null&&t.bottom!=null&&(this.bottom=Ne.number(t.bottom,r.bottom,i)),r.left!=null&&t.left!=null&&(this.left=Ne.number(t.left,r.left,i)),r.right!=null&&t.right!=null&&(this.right=Ne.number(t.right,r.right,i)),this}getCenter(t,r){let i=te((this.left+t-this.right)/2,0,t),a=te((this.top+r-this.bottom)/2,0,r);return new M(i,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Bm(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function jn(e,t){if(!e.renderWorldCopies||e.lngRange)return;let r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}function xd(e){return Math.max(0,Math.floor(e))}var Yh=class{constructor(e,t){this.applyConstrain=(r,i)=>this._constrainOverride===null?this._callbacks.defaultConstrain(r,i):this._constrainOverride(r,i),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=(t==null?void 0:t.renderWorldCopies)===void 0||!!(t!=null&&t.renderWorldCopies),this._minZoom=(t==null?void 0:t.minZoom)||0,this._maxZoom=(t==null?void 0:t.maxZoom)||22,this._minPitch=(t==null?void 0:t.minPitch)===void 0||(t==null?void 0:t.minPitch)===null?0:t==null?void 0:t.minPitch,this._maxPitch=(t==null?void 0:t.maxPitch)===void 0||(t==null?void 0:t.maxPitch)===null?60:t==null?void 0:t.maxPitch,this._constrainOverride=(t==null?void 0:t.constrainOverride)??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new K(0,0),this._elevation=0,this._zoom=0,this._tileZoom=xd(this._zoom),this._scale=yt(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new vd,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,r){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=xd(this._zoom),this._scale=yt(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new vd(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,t&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){if(this._minZoom===e)return;this._minZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get maxZoom(){return this._maxZoom}setMaxZoom(e){if(this._maxZoom===e)return;this._maxZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get minPitch(){return this._minPitch}setMinPitch(e){if(this._minPitch===e)return;this._minPitch=e;let t=this._unmodified;this.setPitch(Math.max(this.pitch,e)),this._unmodified=t}get maxPitch(){return this._maxPitch}setMaxPitch(e){if(this._maxPitch===e)return;this._maxPitch=e;let t=this._unmodified;this.setPitch(Math.min(this.pitch,e)),this._unmodified=t}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){e===void 0&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new M(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=Vt(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=cm(),o4(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=te(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Vi(this._fovInRadians)}setFov(e){e=te(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Be(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.applyConstrain(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=yt(t),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){(e.lat!==this._center.lat||e.lng!==this._center.lng)&&(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this.constrainInternal(),this._calcMatrices()}resize(e,t,r=!0){this._width=e,this._height=t,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var e,t;return((e=this._latRange)==null?void 0:e.length)!==2||((t=this._lngRange)==null?void 0:t.length)!==2?null:new cr([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-ur,ur])}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:r,minY:i,maxX:a,maxY:s}=or.fromPoints(t).extend(e);return[new M(r,i),new M(a,i),new M(a,s),new M(r,s),new M(r,i)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(r),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=Xt(new Float64Array(16));nt(e,e,[this._width/2,-this._height/2,1]),Ve(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=Xt(new Float64Array(16)),nt(e,e,[1,-1,1]),Ve(e,e,[-1,-1,0]),nt(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,r,i){let a=r===void 0?this.bearing:r,s=i=i===void 0?this.pitch:i,{distanceToCenter:n,clampedElevation:o}=this._distanceToCenterFromAltElevationPitch(t,this.elevation,s),{x:l,y:u}=bu(s,a),h=de.fromLngLat(e,t),c=v2(1,h.y),p,d,f=0;do{if(f+=1,f>10)break;d=n/c;let m=l*d,g=u*d;p=new de(h.x+m,h.y+g),c=1/p.meterInMercatorCoordinateUnits()}while(Math.abs(n-d*c)>1e-12);return{center:p.toLngLat(),elevation:o,zoom:ft(this.height/2/Math.tan(this.fovInRadians/2)/d/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=1/this.worldSize,r=bi(1,this.center.lat)*this.worldSize,i=de.fromLngLat(this.center,this.elevation),a=i.x/t,s=i.y/t,n=i.z/t,o=this.pitch,l=this.bearing,{x:u,y:h,z:c}=bu(o,l),p=this.cameraToCenterDistance,d=a+p*-u,f=s+p*-h,m=n+p*c,{distanceToCenter:g,clampedElevation:_}=this._distanceToCenterFromAltElevationPitch(m/r,e,o),y=g*r,x=d+u*y,v=f+h*y,w=new de(x*t,v*t,0).toLngLat(),b=bi(1,w.lat),A=ft(this.height/2/Math.tan(this.fovInRadians/2)/g/b/this.tileSize);this._elevation=_,this._center=w,this.setZoom(A)}_distanceToCenterFromAltElevationPitch(e,t,r){let i=-Math.cos(Be(r)),a=e-t,s,n=t;return i*a>=0||Math.abs(i)<.1?(s=1e4,n=e+s*i):s=-a/i,{distanceToCenter:s,clampedElevation:n}}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new M(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){return T2(this).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/t,e.canonical.y/t,1/t/z,1/t/z]}},Lm=class $m{constructor(t,r){this.min=t,this.max=r,this.center=Pe([],Ot([],this.min,this.max),.5)}quadrant(t){let r=[t%2==0,t<2],i=vl(this.min),a=vl(this.max);for(let s=0;s<r.length;s++)i[s]=r[s]?this.min[s]:this.center[s],a[s]=r[s]?this.center[s]:this.max[s];return a[2]=this.max[2],new $m(i,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let r=!0;for(let i of t.planes){let a=this.intersectsPlane(i);if(a===0)return 0;a===1&&(r=!1)}return r?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let r=t[3],i=t[3];for(let a=0;a<3;a++)t[a]>0?(r+=t[a]*this.min[a],i+=t[a]*this.max[a]):(i+=t[a]*this.min[a],r+=t[a]*this.max[a]);return r>=0?2:i<0?0:1}},x6=class{distanceToTile2d(e,t,r,i){let a=i,s=a.distanceX([e,t]),n=a.distanceY([e,t]);return Math.hypot(s,n)}getWrap(e,t,r){return r}getTileBoundingVolume(e,t,r,i){let a=Math.min(0,r),s=Math.max(0,r);if(i!=null&&i.terrain){let o=new st(e.z,t,e.z,e.x,e.y),l=i.terrain.getMinMaxElevation(o);a=l.minElevation??a,s=l.maxElevation??s}let n=1<<e.z;return new Lm([t+e.x/n,e.y/n,a],[t+(e.x+1)/n,(e.y+1)/n,s])}allowVariableZoom(e,t){let r=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,i=te(78.5-r/2,0,60);return!!t.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}},Om=class Vm{constructor(t,r,i){this.points=t,this.planes=r,this.aabb=i}static fromInvProjectionMatrix(t,r=1,i=0,a,s){let n=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],o=s?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=2**i,u=n.map(d=>b6(d,t,r,l));a&&w6(u,o[0],a,s);let h=o.map(d=>{let f=Er([],u[d[0]],u[d[1]]),m=Er([],u[d[2]],u[d[1]]),g=wt([],Tt([],f,m)),_=-Ue(g,u[d[1]]);return g.concat(_)}),c=[1/0,1/0,1/0],p=[-1/0,-1/0,-1/0];for(let d of u)for(let f=0;f<3;f++)c[f]=Math.min(c[f],d[f]),p[f]=Math.max(p[f],d[f]);return new Vm(u,h,new Lm(c,p))}};function b6(e,t,r,i){let a=Xe([],e,t),s=1/a[3]/r*i;return Kg(a,a,[s,s,1/a[3],s])}function w6(e,t,r,i){let a=i?4:0,s=i?0:4,n=0,o=[],l=[];for(let c=0;c<4;c++){let p=Er([],e[c+s],e[c+a]),d=mi(p);Pe(p,p,1/d),o.push(d),l.push(p)}for(let c=0;c<4;c++){let p=a1(e[c+a],l[c],r);n=p!==null&&p>=0?Math.max(n,p):Math.max(n,o[c])}let u=T6(e,t),h=D6(r,u);if(h!==null){let c=h/Ue(l[0],u);n=Math.min(n,c)}for(let c=0;c<4;c++){let p=Math.min(n,o[c]);e[c+s]=[e[c+a][0]+l[c][0]*p,e[c+a][1]+l[c][1]*p,e[c+a][2]+l[c][2]*p,1]}}function T6(e,t){let r=Er([],e[t[0]],e[t[1]]),i=Er([],e[t[2]],e[t[1]]),a=[0,0,0,0];return wt(a,Tt([],r,i)),a[3]=-Ue(a,e[t[0]]),a}function D6(e,t){let r=xn(e),i=Xg([],e,1/r),a=Er([],t,Pe([],i,Ue(t,i))),s=xn(a);if(s>0){let n=Math.sqrt(1-i[3]*i[3]),o=Pe([],i,-i[3]),l=Ot([],o,Pe([],a,n/s));return bl(t,l)}return null}const A6=Ce([{name:"a_pos3d",type:"Int16",components:3}]);var E6=class extends vt{constructor(e){super(),this._lastTilesetChange=ge(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,t){this.tileManager.update(e,t),this._renderableTilesKeys=[];let r={},i=!1;for(let a of da(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.tileManager._source.calculateTileZoom}))r[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),tr(a.terrainRttPosMatrix32f,0,z,z,0,0,1),this._tiles[a.key]=new Em(a,this.tileSize),this._lastTilesetChange=ge(),i=!0);for(let a in this._tiles)r[a]||(this._tiles[a].releaseRTT(this.tileManager.map.painter),delete this._tiles[a],i=!0);return i}releaseRTT(e){for(let t in this._tiles){let r=this._tiles[t];(r.tileID.equals(e)||r.tileID.isChildOf(e)||e.isChildOf(r.tileID))&&r.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID,a=e.clone(),s=si();if(i.canonical.equals(e.canonical))tr(s,0,z,z,0,0,1);else if(i.canonical.isChildOf(e.canonical)){let n=i.canonical.z-e.canonical.z,o=i.canonical.x-(i.canonical.x>>n<<n),l=i.canonical.y-(i.canonical.y>>n<<n),u=z>>n;tr(s,0,u,u,0,0,1),Ve(s,s,[-o*u,-l*u,0])}else if(e.canonical.isChildOf(i.canonical)){let n=e.canonical.z-i.canonical.z,o=e.canonical.x-(e.canonical.x>>n<<n),l=e.canonical.y-(e.canonical.y>>n<<n),u=z>>n;tr(s,0,z,z,0,0,1),Ve(s,s,[o*u,l*u,0]),nt(s,s,[1/2**n,1/2**n,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(s),t[r]=a}return t}_getTerrainCoordsForTileRanges(e,t){let r={};for(let i of this._renderableTilesKeys){let a=this._tiles[i].tileID;if(!this._isWithinTileRanges(a,t))continue;let s=e.clone(),n=si();if(a.canonical.z===e.canonical.z){let o=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),l=e.canonical.y-a.canonical.y;tr(n,0,z,z,0,0,1),Ve(n,n,[o*z,l*z,0])}else if(a.canonical.z>e.canonical.z){let o=a.canonical.z-e.canonical.z,l=a.canonical.x-(a.canonical.x>>o<<o)+e.wrap*(1<<a.canonical.z),u=a.canonical.y-(a.canonical.y>>o<<o),h=e.canonical.x-(a.canonical.x>>o),c=e.canonical.y-(a.canonical.y>>o),p=z>>o;tr(n,0,p,p,0,0,1),Ve(n,n,[-l*p+h*z,-u*p+c*z,0])}else{let o=e.canonical.z-a.canonical.z,l=e.canonical.x-(e.canonical.x>>o<<o)+e.wrap*(1<<e.canonical.z),u=e.canonical.y-(e.canonical.y>>o<<o),h=(e.canonical.x>>o)-a.canonical.x,c=(e.canonical.y>>o)-a.canonical.y,p=z<<o;tr(n,0,p,p,0,0,1),Ve(n,n,[l*z+h*p,u*z+c*p,0])}s.terrainRttPosMatrix32f=new Float32Array(n),r[i]=s}return r}getSourceTile(e,t){var s,n;let r=this.tileManager._source,i=e.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return;(s=this._sourceTileCache)[n=e.key]||(s[n]=e.scaledTo(i).key);let a=this.findTileInCaches(this._sourceTileCache[e.key]);if(!(a!=null&&a.dem)&&t)for(;i>=r.minzoom&&!(a!=null&&a.dem);)a=this.findTileInCaches(e.scaledTo(i--).key);return a}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=ge()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let r=t[e.canonical.z];return!!r&&(e.wrap>r.minWrap||e.wrap<r.maxWrap||e.canonical.x>=r.minTileXWrapped&&e.canonical.x<=r.maxTileXWrapped&&e.canonical.y>=r.minTileY&&e.canonical.y<=r.maxTileY)}};const bd=z*(1-1e-12);var S6=class{constructor(e,t,r,i="auto"){this._meshCache={},this.painter=e,this.tileManager=new E6(t),this.options=r,this.exaggeration=typeof r.exaggeration=="number"?r.exaggeration:1,this._terrainSkirtLength=i,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&(this._fbo=(this._fbo.destroy(),null)),this._fboDepthTexture&&(this._fboDepthTexture=(this._fboDepthTexture.destroy(),null)),this._emptyDemTexture&&(this._emptyDemTexture=(this._emptyDemTexture.destroy(),null)),this._emptyDepthTexture&&(this._emptyDepthTexture=(this._emptyDepthTexture.destroy(),null));for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t,r,i=z){let a=e.normalizeCoordinates(t,r,i);if(!a)return 0;let s=this.getElevationSampler(a.tileID);return s?s(a.x,a.y,i):0}getElevationForLngLatZoom(e,t){if(!Dp(t,e.wrap()))return 0;let{tileID:r,mercatorX:i,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(r,i%z,a%z,z)}getElevationForLngLat(e,t){let r=this.getCoverageIndex();if(r){let s=de.fromLngLat(e),n=Kh(r,this.exaggeration,s.x,s.y);if(n.demLoaded)return n.elevation}let i=da(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let s of i)s.canonical.z>a&&(a=Math.min(s.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,a)}getElevation(e,t,r,i=z){return this.getDEMElevation(e,t,r,i)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return this._coverageIndex===void 0&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let e=[],t=new Map,r=0,i=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:s,wrap:n}=a.tileID;e.includes(s.z)||e.push(s.z);let o=this.getElevationSampler(a.tileID);t.set(`${n}/${s.z}/${s.x}/${s.y}`,o);let{minElevation:l,maxElevation:u}=this.getMinMaxElevation(a.tileID);r=Math.min(r,l??0),i=Math.max(i,u??0)}return t.size===0?null:(e.sort((a,s)=>s-a),{zooms:e,samplerPerTile:t,minElevation:r-10,maxElevation:i+10})}getElevationSampler(e){let t=e.key,r=this._elevationSamplerCache.get(t);if(r)return r;let i=this.tileManager.getSourceTile(e,!0),a=i==null?void 0:i.dem;if(!i||!a)return null;let s=this._getDEMTileMatrix(e,i),n=s[0]*a.dim,o=s[5]*a.dim,l=s[12]*a.dim,u=s[13]*a.dim,h=(c,p,d)=>{let f=d===8192?1:z/d;return a.sampleBilinear(c*f*n+l,p*f*o+u)};return this._elevationSamplerCache.set(t,h),h}_getDEMTileMatrix(e,t){let r=`${t.tileID.key}/${e.key}`,i=this._demMatrixCache.get(r);if(i)return i;let a=this.tileManager.getSource().maxzoom,s=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=a?s=e.canonical.z-a:fe("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let n=e.canonical.x-(e.canonical.x>>s<<s),o=e.canonical.y-(e.canonical.y>>s<<s),l=Bg(new Float64Array(16),[1/(z<<s),1/(z<<s),0]);return Ve(l,l,[n*z,o*z,0]),this._demMatrixCache.set(r,l),l}getTerrainData(e){var i,a;if(!this._emptyDemTexture){let s=this.painter.context,n=new be({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ge(s,n,s.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ge(s,new be({width:1,height:1}),s.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=Xt([])}let t=this.tileManager.getSourceTile(e,!0);if(t!=null&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let s=this.painter.context;t.demTexture||(t.demTexture=this.painter.getTileTexture(t.dem.stride)),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new Ge(s,t.dem.getPixels(),s.gl.RGBA,{premultiply:!1}),t.demTexture.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let r=t?this._getDEMTileMatrix(e,t):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:((i=t==null?void 0:t.dem)==null?void 0:i.dim)||1,u_terrain_matrix:r,u_terrain_unpack:((a=t==null?void 0:t.dem)==null?void 0:a.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((t==null?void 0:t.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(){let e=this.painter,t=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t||this._fbo.height!==r)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new Ge(e.context,{width:t,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(t,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,r))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}depthAtPoint(e){let t=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer().framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){var p;let t=((p=this.painter.style.projection)==null?void 0:p.transitionState)>0,r=t&&e.canonical.y===0,i=t&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${r?"n":""}_${i?"s":""}`;if(this._meshCache[a])return this._meshCache[a];let s=this.painter.context,n=new Xy,o=new fr,l=this.meshSize,u=z/l,h=l*l;for(let d=0;d<=l;d++)for(let f=0;f<=l;f++)n.emplaceBack(f*u,d*u,0);for(let d=0;d<h;d+=l+1)for(let f=0;f<l;f++)o.emplaceBack(f+d,l+f+d+1,l+f+d+2),o.emplaceBack(f+d,l+f+d+2,f+d+1);this._terrainSkirtLength!=="none"&&this._buildSkirts(n,o,l,u,r,i);let c=new As(s.createVertexBuffer(n,A6.members),s.createIndexBuffer(o),De.simpleSegment(0,0,n.length,o.length));return this._meshCache[a]=c,c}getSkirtLength(e){return 2*Math.PI*Wt/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t){if(!Dp(t,e.wrap()))return 0;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(r).minElevation??0}getMinMaxElevation(e){let t=this.tileManager.getSourceTile(e,!0),r={minElevation:null,maxElevation:null};return t!=null&&t.dem&&(r.minElevation=t.dem.min*this.exaggeration,r.maxElevation=t.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(e,t){let r=de.fromLngLat(e.wrap()),i=(1<<t)*z,a=r.x*i,s=r.y*i,n=Math.floor(a/z),o=Math.floor(s/z);return{tileID:new st(t,0,t,n,o),mercatorX:a,mercatorY:s}}_buildSkirts(e,t,r,i,a,s){let n=e.length,o=n+(r+1),l=(r+1)*r,u=a?Ua:0,h=+!a,c=s?qa:z,p=+!s;for(let m=0;m<=r;m++)e.emplaceBack(m*i,u,h);for(let m=0;m<=r;m++)e.emplaceBack(m*i,c,p);for(let m=0;m<r;m++)t.emplaceBack(l+m,o+m,o+m+1),t.emplaceBack(l+m,o+m+1,l+m+1),t.emplaceBack(0+m,n+m+1,n+m),t.emplaceBack(0+m,0+m+1,n+m+1);let d=e.length,f=d+(r+1)*2;for(let m of[0,1])for(let g=0;g<=r;g++)for(let _ of[0,1])e.emplaceBack(m*z,g*i,_);for(let m=0;m<r*2;m+=2)t.emplaceBack(d+m,d+m+1,d+m+3),t.emplaceBack(d+m,d+m+3,d+m+2),t.emplaceBack(f+m,f+m+3,f+m+1),t.emplaceBack(f+m,f+m+2,f+m+3)}};const wd={covered:!1,demLoaded:!1,elevation:0};function Kh(e,t,r,i){if(i<0||i>=1)return wd;let a=Math.floor(r),s=r-a;for(let n of e.zooms){let o=1<<n,l=s*o,u=i*o,h=Math.floor(l),c=Math.floor(u),p=`${a}/${n}/${h}/${c}`;if(!e.samplerPerTile.has(p))continue;let d=e.samplerPerTile.get(p);return d?{covered:!0,demLoaded:!0,elevation:d(Math.min((l-h)*z,bd),Math.min((u-c)*z,bd),z)*t}:{covered:!0,demLoaded:!1,elevation:0}}return wd}function jm(e,t){return e.covered&&t<=e.elevation+1e-6}function Nm(e,t,r,i,a){for(let s=0;s<40&&i-r>a;s++){let n=(r+i)/2;t(e,n)?i=n:r=n}return{lo:r,hi:i}}var Nn=class Um{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(r,i)=>{i=te(+i,this.minZoom,this.maxZoom);let a={center:new K(r.lng,r.lat),zoom:i},s=this._helper._lngRange;!this._helper._renderWorldCopies&&s===null&&(s=[-179.9999999999,180-1e-10]);let n=this.tileSize*yt(a.zoom),o=0,l=n,u=0,h=n,c=0,p=0,{x:d,y:f}=this.size;if(this._helper._latRange){let v=this._helper._latRange;o=la(v[1])*n,l=la(v[0])*n,l-o<f&&(c=f/(l-o))}s&&(u=Vt(oa(s[0])*n,0,n),h=Vt(oa(s[1])*n,0,n),h<u&&(h+=n),h-u<d&&(p=d/(h-u)));let{x:m,y:g}=ar(n,r),_,y,x=Math.max(p||0,c||0);if(x){let v=new M(p?(h+u)/2:m,c?(l+o)/2:g);return a.center=us(n,v).wrap(),a.zoom+=ft(x),a}if(this._helper._latRange){let v=f/2;g-v<o&&(y=o+v),g+v>l&&(y=l-v)}if(s){let v=(u+h)/2,w=m;this._helper._renderWorldCopies&&(w=Vt(m,v-n/2,v+n/2));let b=d/2;w-b<u&&(_=u+b),w+b>h&&(_=h-b)}if(_!==void 0||y!==void 0){let v=new M(_??m,y??g);a.center=us(n,v).wrap()}return a},this.applyConstrain=(r,i)=>this._helper.applyConstrain(r,i),this._helper=new Yh({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,i)=>this.defaultConstrain(r,i)},t),this._coveringTilesDetailsProvider=new x6}clone(){let t=new Um;return t.apply(this,!1),t}apply(t,r,i){this._helper.apply(t,r,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let r=[new $n(0,t)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new M(0,0)),a=this.screenPointToMercatorCoordinate(new M(this._helper._width,0)),s=this.screenPointToMercatorCoordinate(new M(this._helper._width,this._helper._height)),n=this.screenPointToMercatorCoordinate(new M(0,this._helper._height)),o=Math.floor(Math.min(i.x,a.x,s.x,n.x)),l=Math.floor(Math.max(i.x,a.x,s.x,n.x));for(let u=o-1;u<=l+1;u++)u!==0&&r.push(new $n(u,t))}return r}getCameraFrustum(){return Om.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let r=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLat(r,this):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,r,i=this.elevation){let a=i-this.elevation,s=this.screenPointToMercatorCoordinateAtZ(r,a),n=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),o=de.fromLngLat(t),l=new de(o.x-(s.x-n.x),o.y-(s.y-n.y));this.setCenter(l==null?void 0:l.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(de.fromLngLat(t),r.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(de.fromLngLat(t))}screenPointToLocation(t,r){var i;return(i=this.screenPointToMercatorCoordinate(t,r))==null?void 0:i.toLngLat()}screenPointToLocationAtElevation(t,r){var i;return(i=this.screenPointToMercatorCoordinateAtZ(t,r-this.elevation))==null?void 0:i.toLngLat()}screenPointToMercatorCoordinate(t,r){if(r){let i=this.screenTerrainPointToMercatorCoordinate(t,r);if(i!=null)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenTerrainPointToMercatorCoordinate(t,r){let i=r.getCoverageIndex();if(!i)return null;let{near:a,far:s}=this.getRaySegmentFromPixel(t),n=this.worldSize,o=s[0]-a[0],l=s[1]-a[1],u=s[2]-a[2],h={index:i,exaggeration:r.exaggeration,near:a,dx:o,dy:l,dz:u,worldSize:n},c=0,p=1;if(u===0){if(a[2]>i.maxElevation||a[2]<i.minElevation)return null}else{let _=(i.maxElevation-a[2])/u,y=(i.minElevation-a[2])/u;if(c=Math.max(c,Math.min(_,y)),p=Math.min(p,Math.max(_,y)),c>p)return null}let d=Math.hypot(o,l),f=te(Math.ceil(d*(p-c)/4),1,512),m=0,g=!Hs(h,0);for(let _=0;_<=f;_++){let y=c+(p-c)*_/f;if(!g)g=!Hs(h,y);else if(Hs(h,y)){let{lo:x,hi:v}=Nm(h,Hs,m,y,.001/d),w=gn(h,x),b=gn(h,v),A=a[2]+x*u-w.elevation,C=a[2]+v*u-b.elevation,E=w.covered&&A>C?te(x+A*(v-x)/(A-C),x,v):v;return new de((a[0]+E*o)/n,(a[1]+E*l)/n,gn(h,E).elevation)}m=y}return null}getRaySegmentFromPixel(t){let r=[t.x,t.y,0,1],i=[t.x,t.y,1,1];Xe(r,r,this._pixelMatrixInverse),Xe(i,i,this._pixelMatrixInverse);let a=r[3],s=i[3],n=this.elevation;return{near:[r[0]/a,r[1]/a,r[2]/a+n],far:[i[0]/s,i[1]/s,i[2]/s+n]}}screenPointToMercatorCoordinateAtZ(t,r){let i=r||0,{near:a,far:s}=this.getRaySegmentFromPixel(t),n=a[2]===s[2]?0:(i+this.elevation-a[2])/(s[2]-a[2]);return new de(Ne.number(a[0],s[0],n)/this.worldSize,Ne.number(a[1],s[1],n)/this.worldSize,i)}coordinatePoint(t,r=0,i=this._pixelMatrix){let a=[t.x*this.worldSize,t.y*this.worldSize,r,1];return Xe(a,a,i),new M(a[0]/a[3],a[1]/a[3])}getBounds(){let t=Math.max(0,this._helper._height/2-Za(this));return new cr().extend(this.screenPointToLocation(new M(0,t))).extend(this.screenPointToLocation(new M(this._helper._width,t))).extend(this.screenPointToLocation(new M(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new M(0,this._helper._height)))}isPointOnMapSurface(t,r){return r?this.screenTerrainPointToMercatorCoordinate(t,r)!=null:t.y>this.height/2-Za(this)}calculatePosMatrix(t,r=!1,i=!1){let a=t.key??Wi(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),s=r?this._alignedPosMatrixCache:this._posMatrixCache;if(s.has(a)){let l=s.get(a);return i?l.f32:l.f64}let n=Zo(t,this.worldSize);Ri(n,r?this._alignedProjMatrix:this._viewProjMatrix,n);let o={f64:n,f32:new Float32Array(n)};return s.set(a,o),i?o.f32:o.f64}calculateFogMatrix(t){let r=t.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);let a=Zo(t,this.worldSize);return Ri(a,this._fogMatrix,a),i.set(r,new Float32Array(a)),i.get(r)}calculateCenterFromCameraLngLatAlt(t,r,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,a)}_calculateNearFarZIfNeeded(t,r,i){if(!this._helper.autoCalculateNearFarZ)return;let a=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),s=t-a*this._helper._pixelPerMeter/Math.cos(r),n=a<0?s:t,o=Math.PI/2+this.pitchInRadians,l=Be(this.fov)*(Math.abs(Math.cos(Be(this.roll)))*this.height+Math.abs(Math.sin(Be(this.roll)))*this.width)/this.height*(.5+i.y/this.height),u=Math.sin(l)*n/Math.sin(te(Math.PI-o-l,.01,Math.PI-.01)),h=Za(this),c=Math.atan(h/this._helper.cameraToCenterDistance),p=Be(90-pi),d=c>p?2*c*(.5+i.y/(h*2)):p,f=Math.sin(d)*n/Math.sin(te(Math.PI-o-d,.01,Math.PI-.01)),m=Math.min(u,f);this._helper._farZ=(Math.cos(Math.PI/2-r)*m+n)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,r=ar(this.worldSize,this.center),i=r.x,a=r.y;this._helper._pixelPerMeter=bi(1,this.center.lat)*this.worldSize;let s=Be(Math.min(this.pitch,pi)),n=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(s));this._calculateNearFarZIfNeeded(n,s,t);let o;o=new Float64Array(16),yl(o,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),NT(this._invProjMatrix,o),o[8]=-t.x*2/this._helper._width,o[9]=t.y*2/this._helper._height,this._projectionMatrix=_l(o),nt(o,o,[1,-1,1]),Ve(o,o,[0,0,-this._helper.cameraToCenterDistance]),Br(o,o,-this.rollInRadians),Ki(o,o,this.pitchInRadians),Br(o,o,-this.bearingInRadians),Ve(o,o,[-i,-a,0]),this._mercatorMatrix=nt([],o,[this.worldSize,this.worldSize,this.worldSize]),nt(o,o,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=Ri(new Float64Array(16),this.clipSpaceToPixelsMatrix,o),Ve(o,o,[0,0,-this.elevation]),this._viewProjMatrix=o,this._invViewProjMatrix=yn([],o);let l=[0,0,-1,1];Xe(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),yl(this._fogMatrix,this.fovInRadians,this.width/this.height,n,this._helper._farZ),this._fogMatrix[8]=-t.x*2/this.width,this._fogMatrix[9]=t.y*2/this.height,nt(this._fogMatrix,this._fogMatrix,[1,-1,1]),Ve(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),Br(this._fogMatrix,this._fogMatrix,-this.rollInRadians),Ki(this._fogMatrix,this._fogMatrix,this.pitchInRadians),Br(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),Ve(this._fogMatrix,this._fogMatrix,[-i,-a,0]),nt(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),Ve(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=Ri(new Float64Array(16),this.clipSpaceToPixelsMatrix,o);let u=this._helper._width%2/2,h=this._helper._height%2/2,c=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=i-Math.round(i)+c*u+p*h,f=a-Math.round(a)+c*h+p*u,m=new Float64Array(o);if(Ve(m,m,[d>.5?d-1:d,f>.5?f-1:f,0]),this._alignedProjMatrix=m,o=yn(new Float64Array(16),this._pixelMatrix),!o)throw Error("failed to invert matrix");this._pixelMatrixInverse=o,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new M(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return Xe(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=bi(1,this.center.lat)*this.worldSize,r=this._helper.cameraToCenterDistance/t;return w2(this.center,this.elevation,this.pitch,this.bearing,r).toLngLat()}lngLatToCameraDepth(t,r){let i=de.fromLngLat(t),a=[i.x*this.worldSize,i.y*this.worldSize,r,1];return Xe(a,a,this._viewProjMatrix),a[2]/a[3]}getProjectionData(t){let{overscaledTileID:r,aligned:i,applyTerrainMatrix:a}=t,s=this._helper.getMercatorTileCoordinates(r),n=r?this.calculatePosMatrix(r,i,!0):null,o;return o=r!=null&&r.terrainRttPosMatrix32f&&a?r.terrainRttPosMatrix32f:n||e0(),{mainMatrix:o,tileMercatorCoords:s,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o,clipAntimeridian:!1}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,r,i){return 1}transformLightDirection(t){return vl(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,r,i,a){let s=this.calculatePosMatrix(i),n;a==null?(n=[t,r,0,1],Xh(n,n,s)):(n=[t,r,a,1],Xe(n,n,s));let o=n[3];return{point:new M(n[0]/o,n[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}populateCache(t){for(let r of t)this.calculatePosMatrix(r)}getProjectionDataForCustomLayer(t=!0){let r=new st(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),a=Zo(r,this.worldSize);Ri(a,this._viewProjMatrix,a);let s=[z,z,this.worldSize/this._helper.pixelsPerMeter],n=si();return nt(n,a,s),{...i,tileMercatorCoords:[0,0,1,1],fallbackMatrix:n,mainMatrix:n}}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}};function gn(e,t){return Kh(e.index,e.exaggeration,(e.near[0]+t*e.dx)/e.worldSize,(e.near[1]+t*e.dy)/e.worldSize)}function Hs(e,t){return jm(gn(e,t),e.near[2]+t*e.dz)}function qm(){fe("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Gm(e){if(e.useSlerp)if(e.k<1){let t=_c(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=_c(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),i=new Float64Array(4);sn(i,t,r,e.k);let a=v1(i);e.tr.setRoll(a.roll),e.tr.setPitch(a.pitch),e.tr.setBearing(a.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(Ne.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(Ne.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(Ne.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Zm(e,t,r,i,a){let s=a.padding,n=ar(a.worldSize,r.getNorthWest()),o=ar(a.worldSize,r.getNorthEast()),l=ar(a.worldSize,r.getSouthEast()),u=ar(a.worldSize,r.getSouthWest()),h=Be(-i),c=n.rotate(h),p=o.rotate(h),d=l.rotate(h),f=u.rotate(h),m=new M(Math.max(c.x,p.x,f.x,d.x),Math.max(c.y,p.y,f.y,d.y)),g=new M(Math.min(c.x,p.x,f.x,d.x),Math.min(c.y,p.y,f.y,d.y)),_=m.sub(g),y=a.width-(s.left+s.right+t.left+t.right),x=a.height-(s.top+s.bottom+t.top+t.bottom),v=y/_.x,w=x/_.y;if(w<0||v<0){qm();return}let b=Math.min(ft(a.scale*Math.min(v,w)),e.maxZoom),A=M.convert(e.offset),C=(t.left-t.right)/2,E=(t.top-t.bottom)/2,F=new M(C,E).rotate(Be(i)),k=A.add(F).mult(a.scale/yt(b));return{center:us(a.worldSize,n.add(l).div(2).sub(k)),zoom:b,bearing:i}}var Un=class{get useGlobeControls(){return!1}handlePanInertia(e,t){let r=e.mag(),i=Math.abs(Za(t));return{easingOffset:e.mult(Math.min(i*.75/r,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,r){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(r,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,t,r,i,a){return Zm(e,t,r,i,a)}handleJumpToCenterZoom(e,t){let r=t.zoom===void 0?e.zoom:+t.zoom;e.zoom!==r&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(K.convert(t.center))}handleEaseTo(e,t){let r=e.zoom,i=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:t.roll===void 0?e.roll:t.roll,pitch:t.pitch===void 0?e.pitch:t.pitch,bearing:t.bearing===void 0?e.bearing:t.bearing},n=t.zoom!==void 0,o=!e.isPaddingEqual(t.padding),l=!1,u=n?+t.zoom:e.zoom,h=e.centerPoint.add(t.offsetAsPoint),c=e.screenPointToLocation(h),{center:p,zoom:d}=e.applyConstrain(K.convert(t.center||c),u??r);jn(e,p);let f=ar(e.worldSize,c),m=ar(e.worldSize,p).sub(f),g=yt(d-r);return l=d!==r,{easeFunc:_=>{if(l&&e.setZoom(Ne.number(r,d,_)),i0(a,s)||Gm({startEulerAngles:a,endEulerAngles:s,tr:e,k:_,useSlerp:a.roll!=s.roll}),o&&(e.interpolatePadding(i,t.padding,_),h=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let y=yt(e.zoom-r),x=(d>r?Math.min(2,g):Math.max(.5,g))**(1-_),v=us(e.worldSize,f.add(m.mult(_*x)).mult(y));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,h)}},isZooming:l,elevationCenter:p}}handleFlyTo(e,t){let r=t.zoom!==void 0,i=e.zoom,a=e.applyConstrain(K.convert(t.center||t.locationAtOffset),r?+t.zoom:i),s=a.center,n=a.zoom;jn(e,s);let o=e.worldSize,l=ar(o,t.locationAtOffset),u=ar(o,s).sub(l),h=u.mag(),c=yt(n-i),p=t.minZoom===void 0?e.minZoom:+t.minZoom,d=Math.max(p,e.minZoom),f=Math.min(d,i,n),m=e.applyConstrain(s,f).zoom;return{easeFunc:(g,_,y,x)=>{e.setZoom(g===1?n:i+ft(_));let v=g===1?s:us(o,l.add(u.mult(y)));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,x)},scaleOfZoom:c,targetCenter:s,scaleOfMinZoom:yt(m-i),pixelPathLength:h}}};let C6;const P6=()=>C6||(C6=new it({type:new O(P.projection.type,"type")})),il=new Ah({fill:new br(128,2),line:new br(512,0),tile:new br(128,32),stencil:new br(128,1),circle:3});var Wm=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return sr.projectionGlobe}get vertexShaderPreludeCode(){return sr.projectionMercator.vertexSource}get subdivisionGranularity(){return il}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,r,i,a){let s=(a==="stencil"?il.stencil:il.tile).getGranularityForZoomLevel(t.z),n=t.y===0&&i,o=t.y===(1<<t.z)-1&&i;return this._getMesh(e,{granularity:s,generateBorders:r,extendToNorthPole:n,extendToSouthPole:o})}_getMesh(e,t){let r=this._getMeshKey(t);if(r in this._tileMeshCache)return this._tileMeshCache[r];let i=Dm(e,t);return this._tileMeshCache[r]=i,i}recalculate(e){}hasTransition(){return!1}},Td=class extends vt{constructor(e,t){super(),this._transitionable=new uo(P6(),"projection",t),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Ae(0)),this._mercatorProjection=new ju,this._verticalPerspectiveProjection=new Wm}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof Hr){if(e.from===e.to)return e.from==="mercator"?0:1;if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(e,t,r,i,a){return this.currentProjection.getMeshFromTileID(e,t,r,i,a)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};function Hm(e){let t=xo(e.worldSize,e.center.lat);return 2*Math.PI*t}function I6(e,t,r){let i=tt(t),a=tt(r),s=Ue(i,a),n=Math.acos(s),o=Hm(e);return n/(2*Math.PI)*o}function M6(e,t){return[gi(e*Math.PI*2+Math.PI,Math.PI*2),2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5]}function F6(e,t){let r=Math.cos(t),i=new Float64Array(3);return i[0]=Math.sin(e)*r,i[1]=Math.sin(t),i[2]=Math.cos(e)*r,i}function zr(e,t,r,i,a){let s=1/(1<<a),n=e/z*s+r*s,o=t/z*s+i*s,l=gi(n*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-Math.PI*.5,h=Math.cos(u),c=new Float64Array(3);return c[0]=Math.sin(l)*h,c[1]=Math.sin(u),c[2]=Math.cos(l)*h,c}function tt(e){return F6(e.lng*Math.PI/180,e.lat*Math.PI/180)}function xo(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function qn(e){let t=Math.asin(e[1])/Math.PI*180,r=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(r>1e-6){let i=e[0]/r,a=e[2]/r,s=Math.acos(a),n=(i>0?s:-s)/Math.PI*180;return new K(Vt(n,-180,180),t)}return new K(0,t)}function z6(e,t){return Zu(ai(),-e.lng,-e.lat,t)}function k6(e){let t=e[0],r=e[1],i=e[2],a=e[3];return{lng:-Math.atan2(2*(a*t+r*i),1-2*(t*t+r*r))*180/Math.PI,lat:-Math.asin(te(2*(a*r-i*t),-1,1))*180/Math.PI,bearing:Math.atan2(2*(a*i+t*r),1-2*(r*r+i*i))*180/Math.PI}}const al=Math.PI*.98;function Dd(e,t){let r=e.cameraPosition,i=mi(r);if(i<=1)return e.screenPointToLocation(t);let a=ve();wt(a,r);let s=e.getRayDirectionFromPixel(t),n=-Ue(s,a),o=ve();vn(o,s,a,n);let l=mi(o);if(l<1e-9)return e.screenPointToLocation(t);let u=Math.atan2(l,n),h=Math.asin(1/i)*.9;if(u<h)return e.screenPointToLocation(t);let c=i*Math.sin(h),p=Math.asin(te(c,-1,1))-h,d=i*Math.cos(h)/Math.sqrt(Math.max(1-c*c,1e-12))-1,f=al-p,m=u-h,g=p+d*m*f/(f+d*m),_=ve();Pe(_,o,1/l);let y=ve();return Pe(y,a,Math.cos(te(g,0,al))),vn(y,y,_,Math.sin(te(g,0,al))),wt(y,y),qn(y)}function R6(e,t,r,i,a=!0){let s=Dd(e,r),n=t;if(i)n=Dd(e,r.sub(i));else if(!e.isPointOnMapSurface(r))return;let o=tt(s),l=tt(n),u=z6(e.center,e.bearing),h=Tt(ve(),l,o),c=Math.sqrt(Ue(h,h)),p=Math.acos(te(Ue(l,o),-1,1))/2,d=Math.sin(p),f=c?uc(h[1]/c*d,-h[0]/c*d,h[2]/c*d,Math.cos(p)):uc(0,0,0,1),{lng:m,lat:g,bearing:_}=k6(Qg(ai(),u,f)),y=e.center.lat,x=e.zoom,v=te(g,-90,90),w=a?B6(e,r,i,m):m;e.setCenter(new K(Vt(w,-180,180),v)),a||e.setBearing(_),e.setZoom(x+Qe(y,e.center.lat))}function B6(e,t,r,i){let a=e.center.lng,s=e.center.lat,n=s>=0?90:-90,o=e.locationToScreenPoint(new K(0,n)),l=t.x-o.x,u=t.y-o.y,h=l*l+u*u,c=te(1-(ur-Math.abs(s))/12,0,1),p=c*c*(3-2*c),d=gi(i-a+180,360)-180,f=0;if(p>0&&r){let m=(l*r.y-u*r.x)/Math.max(h,400);f=(n>0?1:-1)*m*180/Math.PI}return a+(1-p)*d+p*f}function L6(e){let t=ve();return t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3],{center:t,radius:Math.sqrt(1-e[3]*e[3])}}function $6(e,t,r){let i=ve();Er(i,r,e);let a=ve();return vn(a,e,i,t/xn(i)),a}function Gn(e){return Math.cos(e*Math.PI/180)}function Qe(e,t){let r=Gn(e),i=Gn(t);return ft(i/r)}function O6(e,t){return 360/Hm({worldSize:e,center:{lat:t}})}function V6(e,t){let r=e.rotate(t.bearingInRadians),i=t.zoom+Qe(t.center.lat,0),a=Ui(1/Gn(t.center.lat),1/Gn(Math.min(Math.abs(t.center.lat),60)),nn(i,7,3,0,1)),s=O6(t.worldSize,t.center.lat);return new K(t.center.lng-r.x*s*a,te(t.center.lat+r.y*s,-ur,ur))}function sl(e){let t=.5*e,r=Math.sin(t),i=Math.cos(t);return Math.log(r+i)-Math.log(i-r)}function Ad(e,t,r,i){let a=e.lat+r*i;if(Math.abs(r)>1){let s=e.lat+r,n=(Math.sign(s)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,o=Math.abs(e.lat+r)*Math.PI/180,l=sl(n+i*(o-n)),u=sl(n),h=sl(o),c=(l-u)/(h-u),p=e.lng+t*c;return new K(p,a)}{let s=e.lng+t*i;return new K(s,a)}}function Xs(e,t,r=1){let i=Ue(e,t),a=r*r,s=ve(),n=ve();Pe(n,t,i),Er(s,e,n);let o=a-Ue(s,s);if(o<0)return null;let l=Ue(e,e)-a,u=-i+(i<0?1:-1)*Math.sqrt(o),h=l/u,c=u;return{tMin:Math.min(h,c),tMax:Math.max(h,c)}}var j6=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,r,i){let a=`${e.z}_${e.x}_${e.y}_${i!=null&&i.terrain?"t":""}_${Math.round(r)}`,s=this._cache.get(a);if(s)return s;let n=this._cachePrevious.get(a);if(n)return this._cache.set(a,n),n;let o=this._boundingVolumeFactory(e,t,r,i);return this._cache.set(a,o),this._hadAnyChanges=!0,o}},nl=class Nu{constructor(t,r,i,a){this.min=i,this.max=a,this.points=t,this.planes=r}static fromAabb(t,r){let i=[];for(let a=0;a<8;a++)i.push([(a>>0&1)==1?r[0]:t[0],(a>>1&1)==1?r[1]:t[1],(a>>2&1)==1?r[2]:t[2]]);return new Nu(i,[[-1,0,0,r[0]],[1,0,0,-t[0]],[0,-1,0,r[1]],[0,1,0,-t[1]],[0,0,-1,r[2]],[0,0,1,-t[2]]],t,r)}static fromCenterSizeAngles(t,r,i){let a=Zu([],i[0],i[1],i[2]),s=Io([],[r[0],0,0],a),n=Io([],[0,r[1],0],a),o=Io([],[0,0,r[2]],a),l=[...t],u=[...t];for(let c=0;c<8;c++)for(let p=0;p<3;p++){let d=t[p]+s[p]*((c>>0&1)==1?1:-1)+n[p]*((c>>1&1)==1?1:-1)+o[p]*((c>>2&1)==1?1:-1);l[p]=Math.min(l[p],d),u[p]=Math.max(u[p],d)}let h=[];for(let c=0;c<8;c++){let p=[...t];Ot(p,p,Pe([],s,(c>>0&1)==1?1:-1)),Ot(p,p,Pe([],n,(c>>1&1)==1?1:-1)),Ot(p,p,Pe([],o,(c>>2&1)==1?1:-1)),h.push(p)}return new Nu(h,[[...s,-Ue(s,h[0])],[...n,-Ue(n,h[0])],[...o,-Ue(o,h[0])],[-s[0],-s[1],-s[2],-Ue(s,h[7])],[-n[0],-n[1],-n[2],-Ue(n,h[7])],[-o[0],-o[1],-o[2],-Ue(o,h[7])]],l,u)}intersectsFrustum(t){let r=!0,i=this.points.length,a=this.planes.length,s=t.planes.length,n=t.points.length;for(let o=0;o<s;o++){let l=t.planes[o],u=0;for(let h=0;h<i;h++){let c=this.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0;u<i&&(r=!1)}if(r)return 2;for(let o=0;o<a;o++){let l=this.planes[o],u=0;for(let h=0;h<n;h++){let c=t.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t){let r=this.points.length,i=0;for(let a=0;a<r;a++){let s=this.points[a];t[0]*s[0]+t[1]*s[1]+t[2]*s[2]+t[3]>=0&&i++}return i===r?2:i===0?0:1}};function _n(e,t,r){let i=e-t;return i<0?-i:Math.max(0,i-r)}function ol(e,t,r,i,a){let s=e-r,n;return n=s<0?Math.min(-s,1+s-a):s>a?Math.min(Math.max(s-a,0),1-s):0,Math.max(n,_n(t,i,a))}var N6=class{constructor(){this._boundingVolumeCache=new j6(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,r,i){let a=1<<r.z,s=1/a,n=r.x/a,o=r.y/a,l=.5,u=2;return u=Math.min(u,ol(e,t,n,o,s)),u=Math.min(u,ol(e,t,n+l,-o-s,s)),u=Math.min(u,ol(e,t,n+l,2-o-s,s)),u}getWrap(e,t,r){let i=1<<t.z,a=1/i,s=t.x/i,n=_n(e.x,s,a),o=_n(e.x,s-1,a),l=_n(e.x,s+1,a),u=Math.min(n,o,l);return u===l?1:u===o?-1:0}allowVariableZoom(e,t){return Gh(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,r,i){return this._boundingVolumeCache.getTileBoundingVolume(e,t,r,i)}_computeTileBoundingVolume(e,t,r,i){let a=Math.min(0,r),s=Math.max(0,r);if(i!=null&&i.terrain){let n=new st(e.z,t,e.z,e.x,e.y),o=i.terrain.getMinMaxElevation(n);a=o.minElevation??a,s=o.maxElevation??s}if(a/=Wt,s/=Wt,a+=1,s+=1,e.z<=0)return nl.fromAabb([-s,-s,-s],[s,s,s]);if(e.z===1)return nl.fromAabb([e.x===0?-s:0,e.y===0?0:-s,-s],[e.x===0?0:s,e.y===0?s:0,s]);{let n=[zr(0,0,e.x,e.y,e.z),zr(z,0,e.x,e.y,e.z),zr(z,z,e.x,e.y,e.z),zr(0,z,e.x,e.y,e.z)],o=[];for(let C of n)o.push(Pe([],C,s));if(s!==a)for(let C of n)o.push(Pe([],C,a));e.y===0&&o.push([0,1,0]),e.y===(1<<e.z)-1&&o.push([0,-1,0]);let l=[1,1,1],u=[-1,-1,-1];for(let C of o)for(let E=0;E<3;E++)l[E]=Math.min(l[E],C[E]),u[E]=Math.max(u[E],C[E]);let h=zr(z/2,z/2,e.x,e.y,e.z),c=Tt([],[0,1,0],h);wt(c,c);let p=Tt([],h,c);wt(p,p);let d=Tt([],n[2],n[1]);wt(d,d);let f=Tt([],n[0],n[3]);wt(f,f),o.push(Pe([],h,s)),e.y>=(1<<e.z)/2&&o.push(Pe([],zr(z/2,0,e.x,e.y,e.z),s)),e.y<(1<<e.z)/2&&o.push(Pe([],zr(z/2,z,e.x,e.y,e.z),s));let m=Ed(h,o),g=Ed(p,o),_=[-h[0],-h[1],-h[2],m.max],y=[h[0],h[1],h[2],-m.min],x=[-p[0],-p[1],-p[2],g.max],v=[p[0],p[1],p[2],-g.min],w=[...d,0],b=[...f,0],A=[];return e.y===0?A.push(Ft(b,w,_),Ft(b,w,y)):A.push(Ft(x,w,_),Ft(x,w,y),Ft(x,b,_),Ft(x,b,y)),e.y===(1<<e.z)-1?A.push(Ft(b,w,_),Ft(b,w,y)):A.push(Ft(v,w,_),Ft(v,w,y),Ft(v,b,_),Ft(v,b,y)),new nl(A,[_,y,x,v,w,b],l,u)}}};function Ed(e,t){let r=1/0,i=-1/0;for(let a of t){let s=Ue(e,a);r=Math.min(r,s),i=Math.max(i,s)}return{min:r,max:i}}var Xm=class Ym{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r){this._helper.resize(t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=ai(),this._projectionMatrix=Is(),this._globeViewProjMatrix32f=e0(),this._globeViewProjMatrixF64=Is(),this._globeViewProjMatrixF64Inverted=Is(),this._globeProjMatrixInverted=Is(),this._cameraPosition=ve(),this.defaultConstrain=(r,i)=>{let a=te(r.lat,-ur,ur),s=te(+i,this.minZoom+Qe(0,a),this.maxZoom);return{center:new K(r.lng,a),zoom:s}},this.applyConstrain=(r,i)=>this._helper.applyConstrain(r,i),this._helper=new Yh({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,i)=>this.defaultConstrain(r,i)},t),this._coveringTilesDetailsProvider=new N6}clone(){let t=new Ym;return t.apply(this,!1),t}apply(t,r){this._helper.apply(t,r)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=ve();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:r,applyGlobeMatrix:i}=t,a=this._helper.getMercatorTileCoordinates(r);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:a,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:(r==null?void 0:r.canonical.z)===0}}_computeClippingPlane(t){let r=this.pitchInRadians,i=this.cameraToCenterDistance/t,a=Math.sin(r)*i,s=Math.cos(r)*i+1,n=1/Math.sqrt(a*a+s*s)*1,o=-a,l=s,u=Math.sqrt(o*o+l*l);o/=u,l/=u;let h=[0,o,l];Mo(h,h,[0,0,0],-this.bearingInRadians),Ps(h,h,[0,0,0],-1*this.center.lat*Math.PI/180),_a(h,h,[0,0,0],this.center.lng*Math.PI/180);let c=1/mi(h);return Pe(h,h,c),[...h,-n*c]}isLocationOccluded(t){return!this.isSurfacePointVisible(tt(t))}transformLightDirection(t){let r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,a=Math.cos(i),s=[Math.sin(r)*a,Math.sin(i),Math.cos(r)*a],n=[s[2],0,-s[0]],o=[0,0,0];Tt(o,n,s),wt(n,n),wt(o,o);let l=[n[0]*t[0]+o[0]*t[1]+s[0]*t[2],n[1]*t[0]+o[1]*t[1]+s[1]*t[2],n[2]*t[0]+o[2]*t[1]+s[2]*t[2]],u=[0,0,0];return wt(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,i){let a=b2(t,r,i.canonical),s=M6(a.x,a.y);return this.getCircleRadiusCorrection()/Math.cos(s[1])}projectTileCoordinates(t,r,i,a){let s=i.canonical,n=zr(t,r,s.x,s.y,s.z),o=1+(a??0)/Wt,l=[n[0]*o,n[1]*o,n[2]*o,1];Xe(l,l,this._globeViewProjMatrixF64);let u=this._cachedClippingPlane,h=u[0]*n[0]+u[1]*n[1]+u[2]*n[2]+u[3]<0;return{point:new M(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=xo(this.worldSize,this.center.lat),r=si();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+t*2),yl(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;r[8]=-i.x*2/this._helper._width,r[9]=i.y*2/this._helper._height,this._projectionMatrix=_l(r),this._globeProjMatrixInverted=si(),yn(this._globeProjMatrixInverted,r),Ve(r,r,[0,0,-this.cameraToCenterDistance]),Br(r,r,this.rollInRadians),Ki(r,r,-this.pitchInRadians),Br(r,r,this.bearingInRadians),Ve(r,r,[0,0,-t]);let a=ve();a[0]=t,a[1]=t,a[2]=t,Ki(r,r,this.center.lat*Math.PI/180),Jd(r,r,-this.center.lng*Math.PI/180),nt(r,r,a),this._globeViewProjMatrixF64=r,this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixF64Inverted=si(),yn(this._globeViewProjMatrixF64Inverted,r);let s=ve();this._cameraPosition=ve(),this._cameraPosition[2]=this.cameraToCenterDistance/t,Mo(this._cameraPosition,this._cameraPosition,s,-this.rollInRadians),Ps(this._cameraPosition,this._cameraPosition,s,this.pitchInRadians),Mo(this._cameraPosition,this._cameraPosition,s,-this.bearingInRadians),Ot(this._cameraPosition,this._cameraPosition,[0,0,1]),Ps(this._cameraPosition,this._cameraPosition,s,-this.center.lat*Math.PI/180),_a(this._cameraPosition,this._cameraPosition,s,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let n=_l(this._globeViewProjMatrixF64Inverted);nt(n,n,[1,1,-1]),this._cachedFrustum=Om.fromInvProjectionMatrix(n,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){fe("calculateFogMatrix is not supported on globe projection.");let r=si();return Xt(r),r}getVisibleUnwrappedCoordinates(t){return[new $n(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){if(t){fe("terrain is not fully supported on vertical perspective projection.");return}this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){if(!this._globeViewProjMatrixF64)return 1;let i=tt(t);Pe(i,i,1+r/Wt);let a=ai();return Xe(a,[i[0],i[1],i[2],1],this._globeViewProjMatrixF64),a[2]/a[3]}populateCache(t){}getBounds(){let t=this.width*.5,r=this.height*.5,i=[new M(0,0),new M(t,0),new M(this.width,0),new M(this.width,r),new M(this.width,this.height),new M(t,this.height),new M(0,this.height),new M(0,r)],a=[];for(let c of i)a.push(this.unprojectScreenPoint(c));let s=0,n=0,o=0,l=0,u=this.center;for(let c of a){let p=St(u.lng,c.lng),d=St(u.lat,c.lat);p<n&&(n=p),p>s&&(s=p),d<l&&(l=d),d>o&&(o=d)}let h=[u.lng+n,u.lat+l,u.lng+s,u.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new cr(h)}calculateCenterFromCameraLngLatAlt(t,r,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,a)}setLocationAtPoint(t,r,i){let a=tt(this.unprojectScreenPoint(r)),s=tt(t),n=ve();Gg(n);let o=ve();_a(o,a,n,-this.center.lng*Math.PI/180),Ps(o,o,n,this.center.lat*Math.PI/180);let l=s[0]*s[0]+s[2]*s[2],u=o[0]*o[0];if(l<u)return;let h=Math.sqrt(l-u),c=-h,p=Ms(s[0],s[2],o[0],h),d=Ms(s[0],s[2],o[0],c),f=ve();_a(f,s,n,-p);let m=Ms(f[1],f[2],o[1],o[2]),g=ve();_a(g,s,n,-d);let _=Ms(g[1],g[2],o[1],o[2]),y=Math.PI*.5,x=m>=-y&&m<=y,v=_>=-y&&_<=y,w,b;if(x&&v){let F=this.center.lng*Math.PI/180,k=this.center.lat*Math.PI/180,B=Fs(p,F),I=Fs(m,k),D=Fs(d,F),T=Fs(_,k);B+I<D+T?(w=p,b=m):(w=d,b=_)}else if(x)w=p,b=m;else if(v)w=d,b=_;else return;let A=w/Math.PI*180,C=b/Math.PI*180,E=this.center.lat;this.setCenter(new K(A,te(C,-90,90))),this.setZoom(this.zoom+Qe(E,this.center.lat))}locationToScreenPoint(t,r){let i=tt(t);if(r){let a=r.getElevationForLngLatZoom(t,this._helper._tileZoom);Pe(i,i,1+a/Wt)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){let r=ai();return Xe(r,[...t,1],this._globeViewProjMatrixF64),r[0]/=r[3],r[1]/=r[3],new M((r[0]*.5+.5)*this.width,(-r[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){let i=this.screenTerrainPointToMercatorCoordinate(t,r);if(i)return i}return de.fromLngLat(this.unprojectScreenPoint(t))}screenTerrainPointToMercatorCoordinate(t,r){let i=r.getCoverageIndex();if(!i)return null;let a=this.cameraPosition,s=this.getRayDirectionFromPixel(t),n=Xs(a,s,1+i.maxElevation/Wt);if(!n)return null;let o=Xs(a,s,1+i.minElevation/Wt),l=Math.max(n.tMin,0),u=o?o.tMin:n.tMax;if(u<=l)return null;let h={index:i,exaggeration:r.exaggeration,origin:a,direction:s},c=0;for(let p=0;p<=256;p++){let d=l+(u-l)*p/256;if(Sd(h,d)){let{hi:f}=Nm(h,Sd,c,d,1e-12),{sample:m,mercator:g}=Km(h,f);return new de(g.x,g.y,m.elevation)}c=d}return null}screenPointToLocation(t,r){var i;return(i=this.screenPointToMercatorCoordinate(t,r))==null?void 0:i.toLngLat()}screenPointToLocationAtElevation(t,r){return this.screenPointToLocation(t)}isPointOnMapSurface(t,r){let i=this._cameraPosition;return!!Xs(i,this.getRayDirectionFromPixel(t))}getRayDirectionFromPixel(t){let r=ai();r[0]=t.x/this.width*2-1,r[1]=(t.y/this.height*2-1)*-1,r[2]=1,r[3]=1,Xe(r,r,this._globeViewProjMatrixF64Inverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];let i=ve();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];let a=ve();return wt(a,i),a}isSurfacePointVisible(t){let r=this._cachedClippingPlane;return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let r=ai();return Xe(r,[...t,1],this._globeViewProjMatrixF64),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}unprojectScreenPoint(t){let r=this._cameraPosition,i=this.getRayDirectionFromPixel(t),a=Xs(r,i);if(a){let h=ve();Ot(h,r,[i[0]*a.tMin,i[1]*a.tMin,i[2]*a.tMin]);let c=ve();return wt(c,h),qn(c)}let s=this._cachedClippingPlane,n=s[0]*i[0]+s[1]*i[1]+s[2]*i[2],o=-bl(s,r)/n,l=ve();if(o>0)Ot(l,r,[i[0]*o,i[1]*o,i[2]*o]);else{let h=ve();Ot(h,r,[i[0]*2,i[1]*2,i[2]*2]);let c=bl(this._cachedClippingPlane,h);Er(l,h,[this._cachedClippingPlane[0]*c,this._cachedClippingPlane[1]*c,this._cachedClippingPlane[2]*c])}let u=L6(s);return qn($6(u.center,u.radius,l))}getProjectionDataForCustomLayer(t=!0){let r=this.getProjectionData({overscaledTileID:new st(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}};function Km(e,t){let r=ve();vn(r,e.origin,e.direction,t);let i=mi(r),a=ve();Pe(a,r,1/i);let s=qn(a),n=de.fromLngLat(s),o=new de(n.x,te(n.y,0,.999999999)),l=Kh(e.index,e.exaggeration,o.x,o.y),u=Math.abs(s.lat)>85.051129?0:l.elevation;return{sample:{...l,elevation:u},radius:i,mercator:o}}function Sd(e,t){let{sample:r,radius:i}=Km(e,t);return jm(r,(i-1)*Wt)}var Cd=class Jm{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t){this._globeness=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeness=1,this.defaultConstrain=(r,i)=>this.currentTransform.defaultConstrain(r,i),this.applyConstrain=(r,i)=>this._helper.applyConstrain(r,i),this._helper=new Yh({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,i)=>this.defaultConstrain(r,i)},t),this._globeness=1,this._mercatorTransform=new Nn,this._verticalPerspectiveTransform=new Xm}clone(){let t=new Jm;return t._globeness=this._globeness,t.apply(this,!1),t}apply(t,r){this._helper.apply(t,r),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let r=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:r.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:r.fallbackMatrix,clipAntimeridian:i.clipAntimeridian}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return Ui(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return Ui(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,r,i){let a=this._mercatorTransform.getPitchedTextCorrection(t,r,i),s=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,i);return Ui(a,s,this._globeness)}projectTileCoordinates(t,r,i,a){return this.currentTransform.projectTileCoordinates(t,r,i,a)}_calcMatrices(){!this._helper._width||!this._helper._height||(this._verticalPerspectiveTransform.apply(this,!1),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this.currentTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){return this.currentTransform.lngLatToCameraDepth(t,r)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,r,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,a)}setLocationAtPoint(t,r,i){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(t,r,i),this.apply(this._mercatorTransform,!1);return}this._verticalPerspectiveTransform.setLocationAtPoint(t,r,i),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,r){return this.currentTransform.locationToScreenPoint(t,r)}screenPointToMercatorCoordinate(t,r){return this.currentTransform.screenPointToMercatorCoordinate(t,r)}screenTerrainPointToMercatorCoordinate(t,r){return this.currentTransform.screenTerrainPointToMercatorCoordinate(t,r)}screenPointToLocation(t,r){return this.currentTransform.screenPointToLocation(t,r)}screenPointToLocationAtElevation(t,r){return this.currentTransform.screenPointToLocationAtElevation(t,r)}isPointOnMapSurface(t,r){return this.currentTransform.isPointOnMapSurface(t,r)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getProjectionDataForCustomLayer(t=!0){let r=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return r;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=r.mainMatrix,i.projectionTransition=this._globeness,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},Qm=class yr{get useGlobeControls(){return!0}handlePanInertia(t,r){let i=V6(t,r);return Math.abs(i.lng-r.center.lng)>180&&(i.lng=r.center.lng+179.5*Math.sign(i.lng-r.center.lng)),{easingCenter:i,easingOffset:new M(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){let i=t.around,a=r.screenPointToLocation(i);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);let s=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);let n=r.zoom-s;if(n===0)return;let o=St(r.center.lng,a.lng),l=o/(Math.abs(o/180)+1),u=St(r.center.lat,a.lat),h=r.getRayDirectionFromPixel(i),c=r.cameraPosition,p=Ue(c,h)*-1,d=ve();Ot(d,c,[h[0]*p,h[1]*p,h[2]*p]);let f=mi(d),m=f-1,g=Math.exp(-Math.max(m-.3,0)*.5),_=nn(f,.95,.999,0,1),y=xo(r.worldSize,r.center.lat)/Math.min(r.width,r.height),x=nn(y,.9,.5,1,.25),v=Math.min(g,Ui(1,x,_)),w=(1-yt(-n))*v,b=r.center.lat,A=r.zoom,C=new K(r.center.lng+l*w,te(r.center.lat+u*w,-ur,ur));r.setLocationAtPoint(a,i);let E=r.center,F=nn(Math.abs(o),45,85,0,1),k=Math.max(F,_)**.25,B=St(E.lng,C.lng),I=St(E.lat,C.lat);r.setCenter(new K(E.lng+B*k,E.lat+I*k).wrap()),r.setZoom(A+Qe(b,r.center.lat))}handleMapControlsPan(t,r,i){t.panDelta&&R6(r,i,r.isPointOnMapSurface(t.around)?t.around:r.centerPoint,t.panDelta)}cameraForBoxAndBearing(t,r,i,a,s){let n=Zm(t,r,i,a,s),o=r.left/s.width*2-1,l=(s.width-r.right)/s.width*2-1,u=r.top/s.height*-2+1,h=(s.height-r.bottom)/s.height*-2+1,c=St(i.getWest(),i.getEast())<0,p=c?i.getEast():i.getWest(),d=c?i.getWest():i.getEast(),f=Math.max(i.getNorth(),i.getSouth()),m=Math.min(i.getNorth(),i.getSouth()),g=p+St(p,d)*.5,_=f+St(f,m)*.5,y=s.clone();y.setCenter(n.center),y.setBearing(n.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(n.zoom);let x=y.modelViewProjectionMatrix,v=[tt(i.getNorthWest()),tt(i.getNorthEast()),tt(i.getSouthWest()),tt(i.getSouthEast()),tt(new K(d,_)),tt(new K(p,_)),tt(new K(g,f)),tt(new K(g,m))],w=tt(n.center),b=1/0;for(let A of v)o<0&&(b=yr.getLesserNonNegativeNonNull(b,yr.solveVectorScale(A,w,x,"x",o))),l>0&&(b=yr.getLesserNonNegativeNonNull(b,yr.solveVectorScale(A,w,x,"x",l))),u>0&&(b=yr.getLesserNonNegativeNonNull(b,yr.solveVectorScale(A,w,x,"y",u))),h<0&&(b=yr.getLesserNonNegativeNonNull(b,yr.solveVectorScale(A,w,x,"y",h)));if(!Number.isFinite(b)||b===0){qm();return}return n.zoom=Math.min(y.zoom+ft(b),t.maxZoom),n}handleJumpToCenterZoom(t,r){let i=t.center.lat,a=t.applyConstrain(r.center?K.convert(r.center):t.center,t.zoom).center;t.setCenter(a.wrap());let s=r.zoom===void 0?t.zoom+Qe(i,a.lat):+r.zoom;t.zoom!==s&&t.setZoom(s)}handleEaseTo(t,r){let i=t.zoom,a=t.center,s=t.padding,n={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:r.roll===void 0?t.roll:r.roll,pitch:r.pitch===void 0?t.pitch:r.pitch,bearing:r.bearing===void 0?t.bearing:r.bearing},l=r.zoom!==void 0,u=!t.isPaddingEqual(r.padding),h=!1,c=r.center?K.convert(r.center):a,p=t.applyConstrain(c,i).center;jn(t,p);let d=t.clone();d.setCenter(p),d.setZoom(l?+r.zoom:i+Qe(a.lat,c.lat)),d.setBearing(r.bearing);let f=new M(te(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),te(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));d.setLocationAtPoint(p,f);let m=(r.offset&&r.offsetAsPoint.mag())>0?d.center:p,g=l?+r.zoom:i+Qe(a.lat,m.lat),_=i+Qe(a.lat,0),y=g+Qe(m.lat,0),x=St(a.lng,m.lng),v=St(a.lat,m.lat),w=yt(y-_);return h=g!==i,{easeFunc:b=>{if(i0(n,o)||Gm({startEulerAngles:n,endEulerAngles:o,tr:t,k:b,useSlerp:n.roll!=o.roll}),u&&t.interpolatePadding(s,r.padding,b),r.around)fe("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{let A=b*(y>_?Math.min(2,w):Math.max(.5,w))**(1-b),C=Ad(a,x,v,A);t.setCenter(C.wrap())}if(h){let A=Ne.number(_,y,b)+Qe(0,t.center.lat);t.setZoom(A)}},isZooming:h,elevationCenter:m}}handleFlyTo(t,r){let i=r.zoom!==void 0,a=t.center,s=t.zoom,n=t.padding,o=!t.isPaddingEqual(r.padding),l=t.applyConstrain(K.convert(r.center||r.locationAtOffset),s).center,u=i?+r.zoom:t.zoom+Qe(t.center.lat,l.lat),h=t.clone();h.setCenter(l),h.setZoom(u),h.setBearing(r.bearing);let c=new M(te(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),te(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(l,c);let p=h.center;jn(t,p);let d=I6(t,a,p),f=s+Qe(a.lat,0),m=u+Qe(p.lat,0),g=yt(m-f),_=typeof r.minZoom=="number"?+r.minZoom:t.minZoom,y=Math.max(_,t.minZoom)+Qe(p.lat,0),x=Math.min(y,f,m)+Qe(0,p.lat),v=t.applyConstrain(p,x).zoom+Qe(p.lat,0),w=yt(v-f),b=St(a.lng,p.lng),A=St(a.lat,p.lat);return{easeFunc:(C,E,F,k)=>{let B=Ad(a,b,A,F);o&&t.interpolatePadding(n,r.padding,C);let I=C===1?p:B;t.setCenter(I.wrap());let D=f+ft(E);t.setZoom(C===1?u:D+Qe(0,I.lat))},scaleOfZoom:g,targetCenter:p,scaleOfMinZoom:w,pixelPathLength:d}}static solveVectorScale(t,r,i,a,s){let n=s,o=a==="x"?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],l=[i[3],i[7],i[11],i[15]],u=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],h=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],c=r[0]*o[0]+r[1]*o[1]+r[2]*o[2],p=r[0]*l[0]+r[1]*l[1]+r[2]*l[2],d=(c+o[3]-n*p-n*l[3])/(c-u-n*p+n*h);return c+n*h===u+n*p||l[3]*(u-c)+o[3]*(p-h)+u*p===c*h?null:d}static getLesserNonNegativeNonNull(t,r){return r!==null&&r>=0&&r<t?r:t}},Pd=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new Un,this._verticalPerspectiveCameraHelper=new Qm}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,r){this.currentHelper.handleMapControlsPan(e,t,r)}cameraForBoxAndBearing(e,t,r,i,a){return this.currentHelper.cameraForBoxAndBearing(e,t,r,i,a)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};function U6(e,t,r){let i={constrainOverride:t};if(Array.isArray(e)){let a=new Td({type:e},r);return{projection:a,transform:new Cd(i),cameraHelper:new Pd(a)}}switch(e){case"mercator":return{projection:new ju,transform:new Nn(i),cameraHelper:new Un};case"globe":{let a=new Td({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:a,transform:new Cd(i),cameraHelper:new Pd(a)}}case"vertical-perspective":return{projection:new Wm,transform:new Xm(i),cameraHelper:new Qm};default:return fe(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new ju,transform:new Nn(i),cameraHelper:new Un}}}const q6=x4();var Id=class extends vt{constructor(e,t={}){var i,a;super(),this._rtlPluginLoaded=()=>{for(let s in this.tileManagers){let n=this.tileManagers[s].getSource().type;(n==="vector"||n==="geojson")&&this.tileManagers[s].reload()}},this.map=e,this.dispatcher=new _m(gm(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(s,n)=>this.getGlyphs(s,n)),this.dispatcher.registerMessageHandler("GI",(s,n)=>this.getImages(s,n)),this.dispatcher.registerMessageHandler("GDA",(s,n)=>this.getDashes(s,n)),this.imageManager=new T4,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new D4(this.imageManager);let r=((i=e._container)==null?void 0:i.lang)||typeof document<"u"&&((a=document.documentElement)==null?void 0:a.lang)||void 0;this.glyphManager=new z4(e._requestManager,t.localIdeographFontFamily,r),this.lineAtlas=new V4(256,512),this.crossTileSymbolIndex=new zm,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",Yu()),Ru().on(ku,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;let n=this.tileManagers[s.sourceId];if(!n)return;let o=n.getSource();if(o!=null&&o.vectorLayerIds)for(let l in this._layers){let u=this._layers[l];u.source===o.id&&this._validateLayer(u)}})}_setInitialValues(){var e;this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new $l,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(((e=this.crossTileSymbolIndex)==null?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t){var i,a;this._checkLoaded();let r=t===null?((a=(i=this.stylesheet.state)==null?void 0:i[e])==null?void 0:a.default)??null:t;if(rr(r,this._globalState[e]))return this;this._globalState[e]=r,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let r in e)rr(this._globalState[r],e[r].default)||(t.push(r),this._globalState[r]=e[r].default);this._applyGlobalStateChanges(t)}_applyGlobalStateChanges(e){if(e.length===0)return;let t=new Set,r={};for(let i of e){r[i]=this._globalState[i];for(let a in this._layers){let s=this._layers[a],n=s.getLayoutAffectingGlobalStateRefs(),o=s.getPaintAffectingGlobalStateRefs(),l=s.getVisibilityAffectingGlobalStateRefs();if(n.has(i)&&t.add(s.source),o.has(i))for(let{name:u,value:h}of o.get(i))this._updatePaintProperty(s,u,h);l!=null&&l.has(i)&&(s.recalculateVisibility(),this._updateLayer(s))}}this.dispatcher.broadcast("UGS",r);for(let i in this.tileManagers)t.has(i)&&(this._reloadSource(i),this._changed=!0)}async loadURL(e,t={},r){this.fire(new Zt("dataloading")),t.validate=typeof t.validate!="boolean"||t.validate,this._loadStyleRequest=new AbortController;let i=this._loadStyleRequest;try{let a=await this.map._requestManager.transformRequest(e,"Style");Xu(i.signal);let s=await Hn(a,i);this._loadStyleRequest===i&&(this._loadStyleRequest=null),this._load(s.data,t,r)}catch(a){this._loadStyleRequest===i&&(this._loadStyleRequest=null),a&&!i.signal.aborted&&this.fire(new H(ht(a)))}}loadJSON(e,t={},r){this.fire(new Zt("dataloading")),this._frameRequest=new AbortController,At.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,r)}).catch(()=>{})}loadEmpty(){this.fire(new Zt("dataloading")),this._load(q6,{validate:!1})}_load(e,t,r){var a;let i=t.transformStyle?t.transformStyle(r,e):e;if(!(t.validate&&Oc(this,i))){i={...i},this._loaded=!0,this.stylesheet=i;for(let s in i.sources)this.addSource(s,i.sources[s],{validate:!1});i.sprite?this._loadSprite(i.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(i.glyphs),this.glyphManager.setFontFaces(i["font-faces"]),this._createLayers(),this.light=new B4(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(((a=this.stylesheet.projection)==null?void 0:a.type)||"mercator"),this.sky=new O4(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new Zt("data")),this.fire(new Up)}}_createLayers(){var t;let e=Gp(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",e),this._order=e.map(r=>r.id),this._layers={},this._serializedLayers=null;for(let r of e){let i=Xo(r,this._globalState);if(i.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=i,Vl(i)&&this.tileManagers[i.source]){let a=((t=r.paint)==null?void 0:t["raster-fade-duration"])??i.paint.get("raster-fade-duration");this.tileManagers[i.source].setRasterFadeDuration(a)}}}async _loadSprite(e,t=!1,r=void 0){this.imageManager.setLoaded(!1);let i=new AbortController;this._spriteRequest=i;let a;try{let s=await b4(e,this.map._requestManager,this.map.getPixelRatio(),i);if(!s)return;for(let n in s){let{loaded:o,removed:l}=this.imageManager.setSpriteImages(n,s[n]);this._markImagesChanged(l),t&&this._markImagesChanged(o)}}catch(s){a=s,i.signal.aborted||this.fire(new H(a))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new Zt("data")),r==null||r(a)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new Zt("data"))}_validateLayer(e){let t=this.tileManagers[e.source];if(!t)return;let r=e.sourceLayer;if(!r)return;let i=t.getSource();(i.type==="geojson"||i.vectorLayerIds&&!i.vectorLayerIds.includes(r))&&this.fire(new H(Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?bt(r):r);let i=[];for(let a of e)if(r[a]){let s=t?bt(r[a]):r[a];i.push(s)}return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let r of t){let i=this._layers[r];i.type!=="custom"&&(e[r]=i.serialize())}return e}hasTransitions(){var e,t,r;if((e=this.light)!=null&&e.hasTransition()||(t=this.sky)!=null&&t.hasTransition()||(r=this.projection)!=null&&r.hasTransition())return!0;for(let i in this.tileManagers)if(this.tileManagers[i].hasTransition())return!0;for(let i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){this._imagesListDirty&&(this._imagesListDirty=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1));let a=Object.keys(this._updatedLayers),s=Object.keys(this._removedLayers);(a.length||s.length)&&this._updateWorkerLayers(a,s);for(let n in this._updatedSources){let o=this._updatedSources[n];if(o==="reload")this._reloadSource(n);else if(o==="clear")this._clearSource(n);else throw Error(`Invalid action ${o}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let n in this._updatedPaintProps)this._layers[n].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let r={};for(let a in this.tileManagers){let s=this.tileManagers[a];r[a]=s.used,s.used=!1}let i=this.imageManager.listImages();for(let a of this._order){let s=this._layers[a];s.recalculate(e,i),!s.isHidden(e.zoom)&&s.source&&(this.tileManagers[s.source].used=!0)}for(let a in r){let s=this.tileManagers[a];!!r[a]!=!!s.used&&s.fire(new we("data",{sourceDataType:"visibility",sourceId:a}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new Zt("data"))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let r=this.serialize();if(e=t.transformStyle?t.transformStyle(r,e):e,(t.validate??!0)&&Oc(this,e))return!1;e=bt(e),e.layers=Gp(e.layers);let i=v4(r,e),a=this._getOperationsToPerform(i);if(a.unimplemented.length>0)throw Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(a.operations.length===0)return!1;for(let s of a.operations)s();return this.stylesheet=e,this._serializedLayers=null,this.fire(new Up({style:this})),!0}_getOperationsToPerform(e){let t=[],r=[];for(let i of e)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,i.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,i.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,i.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,i.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,i.args));break;case"addSource":t.push(()=>this.addSource.apply(this,i.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,i.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case"setLight":t.push(()=>this.setLight.apply(this,i.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,i.args));break;case"setFontFaces":t.push(()=>this.setFontFaces.apply(this,i.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,i.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,i.args));break;case"setSky":t.push(()=>this.setSky.apply(this,i.args));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,i.args));break;case"setTransition":t.push(()=>{});break;default:r.push(i.command)}return{operations:t,unimplemented:r}}addImage(e,t){if(this.getImage(e)){this.fire(new H(Error(`An image named "${e}" already exists.`)));return}this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){if(!this.getImage(e)){this.fire(new H(Error(`An image named "${e}" does not exist.`)));return}this.imageManager.removeImage(e),this._afterImageUpdated(e)}_markImagesChanged(e){for(let t of e)this._changedImages[t]=!0}_afterImageUpdated(e){this._changedImages[e]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new Zt("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,r={}){var a;if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw Error(`Source "${e}" already exists.`);if(!t.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(", ")}.`);if(Cf.has(t.type)&&this._validate(xt.source,`sources.${e}`,t,null,r))return;(a=this.map)!=null&&a._collectResourceTiming&&(t.collectResourceTiming=!0);let i=this.tileManagers[e]=new Lu(e,t,this.dispatcher);i.style=this,i.setEventedParent(this,()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e})),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);for(let r in this._layers)if(this._layers[r].source===e)return this.fire(new H(Error(`Source "${e}" cannot be removed while layer "${r}" is using it.`)));let t=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t.fire(new we("data",{sourceDataType:"metadata",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);let r=this.tileManagers[e].getSource();if(r.type!=="geojson")throw Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(t),this._changed=!0}getSource(e){var t;return(t=this.tileManagers[e])==null?void 0:t.getSource()}addLayer(e,t,r={}){this._checkLoaded();let i=e.id;if(this.getLayer(i)){this.fire(new H(Error(`Layer "${i}" already exists on this map.`)));return}let a;if(e.type==="custom"){if(mh(this,n3(e)))return;a=Xo(e,this._globalState)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(i,e.source),e=bt(e),e=q(e,{source:i})),this._validate(xt.layer,`layers.${i}`,e,{arrayIndex:-1},r))return;a=Xo(e,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}})}let s=t?this._order.indexOf(t):this._order.length;if(t&&s===-1){this.fire(new H(Error(`Cannot add layer "${i}" before non-existing layer "${t}".`)));return}if(this._order.splice(s,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&a.type!=="custom"){let n=this._removedLayers[i];delete this._removedLayers[i],n.type===a.type?(this._updatedSources[a.source]="reload",this.tileManagers[a.source].pause()):this._updatedSources[a.source]="clear"}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new H(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));return}if(e===t)return;let r=this._order.indexOf(e);this._order.splice(r,1);let i=t?this._order.indexOf(t):this._order.length;if(t&&i===-1){this.fire(new H(Error(`Cannot move layer "${e}" before non-existing layer "${t}".`)));return}this._order.splice(i,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new H(Error(`Cannot remove non-existing layer "${e}".`)));return}t.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,r){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new H(Error(`Cannot set the zoom range of non-existing layer "${e}".`)));return}(i.minzoom!==t||i.maxzoom!==r)&&(t!=null&&(i.minzoom=t),r!=null&&(i.maxzoom=r),this._updateLayer(i))}setFilter(e,t,r={}){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new H(Error(`Cannot filter non-existing layer "${e}".`)));return}if(!rr(i.filter,t)){if(t==null){i.setFilter(void 0),this._updateLayer(i);return}this._validate(xt.filter,`layers.${i.id}.filter`,t,null,r)||(i.setFilter(bt(t)),this._updateLayer(i))}}getFilter(e){return bt(this.getLayer(e).filter)}setLayoutProperty(e,t,r,i={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new H(Error(`Cannot style non-existing layer "${e}".`)));return}rr(a.getLayoutProperty(t),r)||(a.setLayoutProperty(t,r,i),this._updateLayer(a))}getLayoutProperty(e,t){let r=this.getLayer(e);if(!r){this.fire(new H(Error(`Cannot get style of non-existing layer "${e}".`)));return}return r.getLayoutProperty(t)}setPaintProperty(e,t,r,i={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new H(Error(`Cannot style non-existing layer "${e}".`)));return}rr(a.getPaintProperty(t),r)||this._updatePaintProperty(a,t,r,i)}_updatePaintProperty(e,t,r,i={}){e.setPaintProperty(t,r,i)&&this._updateLayer(e),Vl(e)&&t==="raster-fade-duration"&&this.tileManagers[e.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[e.id]=!0,e.type==="symbol"&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let r=e.source,i=e.sourceLayer,a=this.tileManagers[r];if(a===void 0){this.fire(new H(Error(`The source '${r}' does not exist in the map's style.`)));return}let s=a.getSource().type;if(s==="geojson"&&i){this.fire(new H(Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!i){this.fire(new H(Error("The sourceLayer parameter must be provided for vector source types.")));return}if(e.id===void 0){this.fire(new H(Error("The feature id parameter must be provided.")));return}let n=["__proto__","constructor","prototype"];if(t&&Object.keys(t).some(o=>n.includes(o))){this.fire(new H(Error(`The feature state should not include one of the following keys: ${n}`)));return}a.setFeatureState(i,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let r=e.source,i=this.tileManagers[r];if(i===void 0){this.fire(new H(Error(`The source '${r}' does not exist in the map's style.`)));return}let a=i.getSource().type,s=a==="vector"?e.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new H(Error("The sourceLayer parameter must be provided for vector source types.")));return}if(t&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new H(Error("A feature id is required to remove its specific state property.")));return}i.removeFeatureState(s,e.id,t)}getFeatureState(e){this._checkLoaded();let t=e.source,r=e.sourceLayer,i=this.tileManagers[t];if(i===void 0){this.fire(new H(Error(`The source '${t}' does not exist in the map's style.`)));return}if(i.getSource().type==="vector"&&!r){this.fire(new H(Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new H(Error("The feature id parameter must be provided."))),i.getFeatureState(r,e.id)}getTransition(){var e;return q({duration:300,delay:0},(e=this.stylesheet)==null?void 0:e.transition)}serialize(){if(!this._loaded)return;let e=Hu(this.tileManagers,a=>a.serialize()),t=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,i=this.stylesheet;return r0({version:i.version,name:i.name,metadata:i.metadata,light:i.light,sky:i.sky,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,"font-faces":i["font-faces"],transition:i.transition,projection:i.projection,state:i.state,sources:e,layers:t,terrain:r},a=>a!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=s=>this._layers[s].type==="fill-extrusion",r={},i=[];for(let s=this._order.length-1;s>=0;s--){let n=this._order[s];if(t(n)){r[n]=s;for(let o of e){let l=o[n];if(l)for(let u of l)i.push(u)}}}i.sort((s,n)=>n.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let n=this._order[s];if(t(n))for(let o=i.length-1;o>=0;o--){let l=i[o].feature;if(r[l.layer.id]<s)break;a.push(l),i.pop()}else for(let o of e){let l=o[n];if(l)for(let u of l)a.push(u.feature)}}return a}queryRenderedFeatures(e,t,r){t!=null&&t.filter&&this._validate(xt.filter,"queryRenderedFeatures.filter",t.filter,null,t);let i={};if(t!=null&&t.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new H(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let l of t.layers){let u=this._layers[l];if(!u)return this.fire(new H(Error(`The layer '${l}' does not exist in the map's style and cannot be queried for features.`))),[];i[u.source]=!0}}let a=[];t.availableImages=this.imageManager.listImages();let s=this._serializedAllLayers(),n=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,o={...t,layers:n,globalState:this._globalState};for(let l in this.tileManagers)t.layers&&!i[l]||a.push(K4(this.tileManagers[l],this._layers,s,e,o,r,this.map.terrain?(u,h,c)=>this.map.terrain.getElevation(u,h,c):void 0));return this.placement&&a.push(J4(this._layers,s,this.tileManagers,e,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,t){t!=null&&t.filter&&this._validate(xt.filter,"querySourceFeatures.filter",t.filter,null,t);let r=this.tileManagers[e];return r?Q4(r,t?{...t,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let s in e)if(!rr(e[s],r[s])){i=!0;break}if(!i)return;let a={now:ge(),transition:q({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(a)}getProjection(){var e;return(e=this.stylesheet)==null?void 0:e.projection}setProjection(e){this._checkLoaded();let t=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){var e;return(e=this.stylesheet)==null?void 0:e.sky}setSky(e,t={}){this._checkLoaded();let r=this.getSky(),i=!1;if(!e&&!r)return;if(e&&!r)i=!0;else if(!e&&r)i=!0;else for(let s in e)if(!rr(e[s],r[s])){i=!0;break}if(!i)return;let a={now:ge(),transition:q({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(a)}_setProjectionInternal(e){var r;let t=U6(e,(r=this.map._camera)==null?void 0:r.transform.constrainOverride,this._globalState);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let i in this.tileManagers)this.tileManagers[i].reload()}_validate(e,t,r,i,a={}){return a.validate!==!1&&xs(this,e,{key:t,style:this.serialize(),value:r,...i},a)}_remove(e=!0){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null)),Ru().off(ku,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let r=this.tileManagers[t];r.setEventedParent(null),r.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(e,t,r){var a;let i=this.pauseablePlacement;return!i||this._symbolPlacementTriggered||this._placedProjectionTransition!==((a=this.projection)==null?void 0:a.transitionState)||i._showCollisionBoxes!==t||i.placement.collisionGroups.crossSourceCollisions!==r||i.placement.transform.renderWorldCopies!==e.renderWorldCopies||!Og(i.placement.transform.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,t,r,i,a=!1){var h,c;let s=!1,n=!1,o={};for(let p of this._order){let d=this._layers[p];if(d.type!=="symbol")continue;if(!o[d.source]){let m=this.tileManagers[d.source];o[d.source]=m.getRenderableIds(!0).map(g=>m.getTileByID(g)).sort((g,_)=>_.tileID.overscaledZ-g.tileID.overscaledZ||(g.tileID.isLessThan(_.tileID)?-1:1))}let f=this.crossTileSymbolIndex.addLayer(d,o[d.source],e.center.lng);s||(s=f)}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||(a=this._layerOrderChanged||r===0);let l=s||this._placementInputsChanged(e,t,i),u=((h=this.pauseablePlacement)==null?void 0:h.isDone())&&!this.placement.stillRecent(ge(),e.zoom);if((a||!this.pauseablePlacement||u&&(l||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=(c=this.projection)==null?void 0:c.transitionState,this.pauseablePlacement=new o6(e,this.map.terrain,this._order,a,t,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?l&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ge()),n=!0),s&&this.pauseablePlacement.placement.setStale()),n||s)for(let p of this._order){let d=this._layers[p];d.type==="symbol"&&this.placement.updateLayerOpacities(d,o[d.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ge())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t){let r=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let i=this.tileManagers[t.source];return i&&i.setDependencies(t.tileID.key,t.type,t.icons),r}async getGlyphs(e,t){let r=await this.glyphManager.getGlyphs(t.stacks),i=this.tileManagers[t.source];return i&&i.setDependencies(t.tileID.key,t.type,[""]),r}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),!(e&&this._validate(xt.glyphs,"glyphs",e,null,t))&&(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(e){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=e,this.glyphManager.setFontFaces(e)}async getDashes(e,t){let r={};for(let[i,a]of Object.entries(t.dashes))r[i]=this.lineAtlas.getDash(a.dasharray,a.round);return r}addSprite(e,t,r={},i){this._checkLoaded();let a=[{id:e,url:t}],s=[...dn(this.stylesheet.sprite),...a];this._validate(xt.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,i))}removeSprite(e){this._checkLoaded();let t=dn(this.stylesheet.sprite);if(!t.find(i=>i.id===e)){this.fire(new H(Error(`Sprite "${e}" doesn't exists on this map.`)));return}let r=this.imageManager.removeSpriteImages(e);this._markImagesChanged(r),t.splice(t.findIndex(i=>i.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new Zt("data"))}getSprite(){return dn(this.stylesheet.sprite)}setSprite(e,t={},r){this._checkLoaded(),!(e&&this._validate(xt.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null));for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}};const G6=Ce([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var Z6=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,r,i,a,s,n,o,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==i.length;for(let h=0;!u&&h<i.length;h++)this.boundPaintVertexBuffers[h]!==i[h]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==a||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==n||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,r,i,a,s,n,o,l):(e.bindVertexArray.set(this.vao),n&&n.bind(),a!=null&&a.dynamicDraw&&a.bind(),o&&o.bind(),l&&l.bind())}freshBind(e,t,r,i,a,s,n,o){let l=e.numAttributes,u=this.context,h=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=n,this.boundDynamicVertexBuffer3=o,t.enableAttributes(h,e);for(let c of r)c.enableAttributes(h,e);s&&s.enableAttributes(h,e),n&&n.enableAttributes(h,e),o&&o.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,a);for(let c of r)c.bind(),c.setVertexAttribPointers(h,e,a);s&&(s.bind(),s.setVertexAttribPointers(h,e,a)),i&&i.bind(),n&&(n.bind(),n.setVertexAttribPointers(h,e,a)),o&&(o.bind(),o.setVertexAttribPointers(h,e,a)),u.currentNumAttributes=l}destroy(){this.vao&&(this.vao=(this.context.deleteVertexArray(this.vao),null))}};const W6=(e,t)=>({u_depth:new W(e,t.u_depth),u_terrain:new W(e,t.u_terrain),u_terrain_dim:new L(e,t.u_terrain_dim),u_terrain_matrix:new Mt(e,t.u_terrain_matrix),u_terrain_unpack:new qr(e,t.u_terrain_unpack),u_terrain_exaggeration:new L(e,t.u_terrain_exaggeration)}),H6=(e,t)=>({u_texture:new W(e,t.u_texture),u_ele_delta:new L(e,t.u_ele_delta),u_fog_matrix:new Mt(e,t.u_fog_matrix),u_fog_color:new Gr(e,t.u_fog_color),u_fog_ground_blend:new L(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new L(e,t.u_fog_ground_blend_opacity),u_horizon_color:new Gr(e,t.u_horizon_color),u_horizon_fog_blend:new L(e,t.u_horizon_fog_blend),u_is_globe_mode:new L(e,t.u_is_globe_mode)}),X6=(e,t)=>({u_ele_delta:new L(e,t.u_ele_delta)}),Y6=(e,t,r,i,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:r?r.properties.get("fog-color"):J.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:r?r.calculateFogBlendOpacity(i):0,u_horizon_color:r?r.properties.get("horizon-color"):J.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!a}),K6=e=>({u_ele_delta:e}),J6=(e,t)=>({u_projection_matrix:new Mt(e,t.u_projection_matrix),u_projection_tile_mercator_coords:new qr(e,t.u_projection_tile_mercator_coords),u_projection_clipping_plane:new qr(e,t.u_projection_clipping_plane),u_projection_transition:new L(e,t.u_projection_transition),u_projection_fallback_matrix:new Mt(e,t.u_projection_fallback_matrix),u_projection_clip_antimeridian:new W(e,t.u_projection_clip_antimeridian)}),Q6=e=>({u_projection_matrix:e.mainMatrix,u_projection_tile_mercator_coords:e.tileMercatorCoords,u_projection_clipping_plane:e.clippingPlane,u_projection_transition:e.projectionTransition,u_projection_fallback_matrix:e.fallbackMatrix,u_projection_clip_antimeridian:+!!e.clipAntimeridian});function Ys(e){let t=[];for(let r of e){if(r===null)continue;let i=r.split(" ");t.push(i.pop())}return t}function eD(e,t){let r=new Set([e.INT,e.INT_VEC2,e.INT_VEC3,e.INT_VEC4,e.UNSIGNED_INT,e.UNSIGNED_INT_VEC2,e.UNSIGNED_INT_VEC3,e.UNSIGNED_INT_VEC4]),i=new Set,a=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let s=0;s<a;s++){let n=e.getActiveAttrib(t,s);n&&r.has(n.type)&&i.add(n.name)}return i}var tD=class{constructor(e,t,r,i,a,s,n,o,l=[]){let u=e.gl;this.program=u.createProgram();let h=Ys(t.staticAttributes),c=r?r.getBinderAttributes():[],p=h.concat(c),d=sr.prelude.staticUniforms?Ys(sr.prelude.staticUniforms):[],f=n.staticUniforms?Ys(n.staticUniforms):[],m=t.staticUniforms?Ys(t.staticUniforms):[],g=r?r.getBinderUniforms():[],_=d.concat(f).concat(m).concat(g),y=[];for(let F of _)y.includes(F)||y.push(F);let x=r?r.defines():[];x.unshift("#version 300 es"),a&&x.push("#define OVERDRAW_INSPECTOR;"),s&&x.push("#define TERRAIN3D;"),o&&x.push(o),l&&x.push(...l);let v=x.concat(sr.prelude.fragmentSource,n.fragmentSource,t.fragmentSource).join(`
|
|
807
|
+
`),w=x.concat(sr.prelude.vertexSource,n.vertexSource,t.vertexSource).join(`
|
|
808
|
+
`),b=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(b,v),u.compileShader(b),!u.getShaderParameter(b,u.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${u.getShaderInfoLog(b)}`);u.attachShader(this.program,b);let A=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(A,w),u.compileShader(A),!u.getShaderParameter(A,u.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${u.getShaderInfoLog(A)}`);u.attachShader(this.program,A),this.attributes={};let C={};if(this.numAttributes=p.length,u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);let E=eD(u,this.program);for(let F of p){if(!F)continue;let k=u.getAttribLocation(this.program,F);k>=0&&(this.attributes[F]={location:k,isInteger:E.has(F)})}u.deleteShader(A),u.deleteShader(b);for(let F of y)if(F&&!C[F]){let k=u.getUniformLocation(this.program,F);k&&(C[F]=k)}this.fixedUniforms=i(e,C),this.terrainUniforms=W6(e,C),this.projectionUniforms=J6(e,C),this.binderUniforms=r?r.getUniforms(e,C):[]}draw(e,t,r,i,a,s,n,o,l,u,h,c,p,d,f,m,g,_,y){var w;let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(r),e.setStencilMode(i),e.setColorMode(a),e.setCullFace(s),o){e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,o.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,o.texture);for(let b in this.terrainUniforms)this.terrainUniforms[b].set(o[b])}if(l){let b=Q6(l);for(let A in this.projectionUniforms)this.projectionUniforms[A].set(b[A])}if(n)for(let b in this.fixedUniforms)this.fixedUniforms[b].set(n[b]);m&&m.setUniforms(e,this.binderUniforms,d,{zoom:f});let v=0;switch(t){case x.LINES:v=2;break;case x.TRIANGLES:v=3;break;case x.LINE_STRIP:v=1}for(let b of p.get())b.vaos||(b.vaos={}),(w=b.vaos)[u]||(w[u]=new Z6),b.vaos[u].bind(e,this,h,m?m.getPaintVertexBuffers():[],c,b.vertexOffset,g,_,y),x.drawElements(t,b.primitiveLength*v,x.UNSIGNED_SHORT,b.primitiveOffset*v*2)}};function eg(e,t,r){let i=1/It(r,1,t.transform.tileZoom),a=2**r.tileID.overscaledZ,s=r.tileSize*2**t.transform.tileZoom/a,n=s*(r.tileID.canonical.x+r.tileID.wrap*a),o=s*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:[n>>16,o>>16],u_pixel_coord_lower:[n&65535,o&65535]}}function rD(e,t,r,i){let a=r.patternAtlas.getPattern(e.from.toString()),s=r.patternAtlas.getPattern(e.to.toString()),{width:n,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:s.tl,u_pattern_br_b:s.br,u_texsize:[n,o],u_mix:t.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/It(i,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[h&65535,c&65535]}}const iD=(e,t)=>({u_lightpos:new Dt(e,t.u_lightpos),u_lightpos_globe:new Dt(e,t.u_lightpos_globe),u_lightintensity:new L(e,t.u_lightintensity),u_lightcolor:new Dt(e,t.u_lightcolor),u_vertical_gradient:new L(e,t.u_vertical_gradient),u_opacity:new L(e,t.u_opacity),u_fill_translate:new Y(e,t.u_fill_translate)}),aD=(e,t)=>({u_lightpos:new Dt(e,t.u_lightpos),u_lightpos_globe:new Dt(e,t.u_lightpos_globe),u_lightintensity:new L(e,t.u_lightintensity),u_lightcolor:new Dt(e,t.u_lightcolor),u_vertical_gradient:new L(e,t.u_vertical_gradient),u_height_factor:new L(e,t.u_height_factor),u_opacity:new L(e,t.u_opacity),u_fill_translate:new Y(e,t.u_fill_translate),u_image:new W(e,t.u_image),u_texsize:new Y(e,t.u_texsize),u_pixel_coord_upper:new Y(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new Y(e,t.u_pixel_coord_lower),u_scale:new Dt(e,t.u_scale),u_fade:new L(e,t.u_fade)}),tg=(e,t,r,i)=>{let a=e.style.light,s=a.getCartesianPosition(),n=Kd();a.properties.get("anchor")==="viewport"&&zg(n,e.transform.bearingInRadians),qg(s,s,n);let o=e.transform.transformLightDirection(s),l=a.properties.get("color");return{u_lightpos:s,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}},sD=(e,t,r,i,a,s,n)=>q(tg(e,t,r,i),eg(s,e,n),{u_height_factor:-(2**a.overscaledZ)/n.tileSize/8}),nD=(e,t)=>({u_fill_translate:new Y(e,t.u_fill_translate)}),oD=(e,t)=>({u_image:new W(e,t.u_image),u_texsize:new Y(e,t.u_texsize),u_pixel_coord_upper:new Y(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new Y(e,t.u_pixel_coord_lower),u_scale:new Dt(e,t.u_scale),u_fade:new L(e,t.u_fade),u_fill_translate:new Y(e,t.u_fill_translate)}),lD=(e,t)=>({u_world:new Y(e,t.u_world),u_fill_translate:new Y(e,t.u_fill_translate)}),uD=(e,t)=>({u_world:new Y(e,t.u_world),u_image:new W(e,t.u_image),u_texsize:new Y(e,t.u_texsize),u_pixel_coord_upper:new Y(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new Y(e,t.u_pixel_coord_lower),u_scale:new Dt(e,t.u_scale),u_fade:new L(e,t.u_fade),u_fill_translate:new Y(e,t.u_fill_translate)}),rg=(e,t,r,i)=>q(eg(t,e,r),{u_fill_translate:i}),hD=e=>({u_fill_translate:e}),cD=(e,t)=>({u_world:e,u_fill_translate:t}),pD=(e,t,r,i,a)=>q(rg(e,t,r,a),{u_world:i}),dD=(e,t)=>({u_camera_to_center_distance:new L(e,t.u_camera_to_center_distance),u_scale_with_map:new W(e,t.u_scale_with_map),u_pitch_with_map:new W(e,t.u_pitch_with_map),u_extrude_scale:new Y(e,t.u_extrude_scale),u_device_pixel_ratio:new L(e,t.u_device_pixel_ratio),u_globe_extrude_scale:new L(e,t.u_globe_extrude_scale),u_translate:new Y(e,t.u_translate)}),fD=(e,t,r,i,a)=>{let s=e.transform,n,o,l=0;if(r.paint.get("circle-pitch-alignment")==="map"){let u=It(t,1,s.zoom);n=!0,o=[u,u],l=u/(z*2**t.tileID.overscaledZ)*2*Math.PI*a}else n=!1,o=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+(r.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+n,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:o,u_globe_extrude_scale:l,u_translate:i}},mD=(e,t)=>({u_pixel_extrude_scale:new Y(e,t.u_pixel_extrude_scale)}),gD=(e,t)=>({u_viewport_size:new Y(e,t.u_viewport_size)}),_D=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),yD=e=>({u_viewport_size:[e.width,e.height]}),vD=(e,t)=>({u_color:new Gr(e,t.u_color),u_overlay:new W(e,t.u_overlay),u_overlay_scale:new L(e,t.u_overlay_scale)}),Md=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),xD=(e,t)=>({u_extrude_scale:new L(e,t.u_extrude_scale),u_intensity:new L(e,t.u_intensity),u_globe_extrude_scale:new L(e,t.u_globe_extrude_scale)}),bD=(e,t)=>({u_matrix:new Mt(e,t.u_matrix),u_world:new Y(e,t.u_world),u_image:new W(e,t.u_image),u_color_ramp:new W(e,t.u_color_ramp),u_opacity:new L(e,t.u_opacity)}),ig=(e,t,r,i)=>{let a=It(e,1,t)/(z*2**e.tileID.overscaledZ)*2*Math.PI*i;return{u_extrude_scale:It(e,1,t),u_intensity:r,u_globe_extrude_scale:a}},ag=(e,t,r,i)=>{let a=Zr();tr(a,0,e.width,e.height,0,0,1);let s=e.context.gl;return{u_matrix:a,u_world:[s.drawingBufferWidth,s.drawingBufferHeight],u_image:r,u_color_ramp:i,u_opacity:t.paint.get("heatmap-opacity")}},wD=(e,t)=>({u_image:new W(e,t.u_image),u_latrange:new Y(e,t.u_latrange),u_exaggeration:new L(e,t.u_exaggeration),u_altitudes:new Jc(e,t.u_altitudes),u_azimuths:new Jc(e,t.u_azimuths),u_accent:new Gr(e,t.u_accent),u_method:new W(e,t.u_method),u_shadows:new Kc(e,t.u_shadows),u_highlights:new Kc(e,t.u_highlights)}),TD=(e,t)=>({u_matrix:new Mt(e,t.u_matrix),u_image:new W(e,t.u_image),u_dimension:new Y(e,t.u_dimension),u_zoom:new L(e,t.u_zoom),u_unpack:new qr(e,t.u_unpack)}),DD=(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 s=r.getIlluminationProperties();for(let n=0;n<s.directionRadians.length;n++)r.paint.get("hillshade-illumination-anchor")==="viewport"&&(s.directionRadians[n]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:ED(e,t.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:s.altitudeRadians,u_azimuths:s.directionRadians,u_accent:i,u_method:a,u_highlights:s.highlightColor,u_shadows:s.shadowColor}},AD=(e,t)=>{let r=t.stride,i=Zr();return tr(i,0,z,-z,0,0,1),Ve(i,i,[0,-z,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function ED(e,t){let r=2**t.canonical.z,i=t.canonical.y;return[new de(0,i/r).toLngLat().lat,new de(0,(i+1)/r).toLngLat().lat]}const SD=(e,t)=>({u_image:new W(e,t.u_image),u_unpack:new qr(e,t.u_unpack),u_dimension:new Y(e,t.u_dimension),u_elevation_stops:new W(e,t.u_elevation_stops),u_color_stops:new W(e,t.u_color_stops),u_color_ramp_size:new W(e,t.u_color_ramp_size),u_opacity:new L(e,t.u_opacity)}),CD=(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")}),PD=(e,t)=>({u_translation:new Y(e,t.u_translation),u_ratio:new L(e,t.u_ratio),u_device_pixel_ratio:new L(e,t.u_device_pixel_ratio),u_units_to_pixels:new Y(e,t.u_units_to_pixels)}),ID=(e,t)=>({u_translation:new Y(e,t.u_translation),u_ratio:new L(e,t.u_ratio),u_device_pixel_ratio:new L(e,t.u_device_pixel_ratio),u_units_to_pixels:new Y(e,t.u_units_to_pixels),u_image:new W(e,t.u_image),u_image_height:new L(e,t.u_image_height)}),MD=(e,t)=>({u_translation:new Y(e,t.u_translation),u_texsize:new Y(e,t.u_texsize),u_ratio:new L(e,t.u_ratio),u_device_pixel_ratio:new L(e,t.u_device_pixel_ratio),u_image:new W(e,t.u_image),u_units_to_pixels:new Y(e,t.u_units_to_pixels),u_scale:new Dt(e,t.u_scale),u_fade:new L(e,t.u_fade)}),FD=(e,t)=>({u_translation:new Y(e,t.u_translation),u_ratio:new L(e,t.u_ratio),u_device_pixel_ratio:new L(e,t.u_device_pixel_ratio),u_units_to_pixels:new Y(e,t.u_units_to_pixels),u_image:new W(e,t.u_image),u_mix:new L(e,t.u_mix),u_tileratio:new L(e,t.u_tileratio),u_crossfade_from:new L(e,t.u_crossfade_from),u_crossfade_to:new L(e,t.u_crossfade_to),u_lineatlas_width:new L(e,t.u_lineatlas_width),u_lineatlas_height:new L(e,t.u_lineatlas_height)}),zD=(e,t)=>({u_translation:new Y(e,t.u_translation),u_ratio:new L(e,t.u_ratio),u_device_pixel_ratio:new L(e,t.u_device_pixel_ratio),u_units_to_pixels:new Y(e,t.u_units_to_pixels),u_image:new W(e,t.u_image),u_image_height:new L(e,t.u_image_height),u_tileratio:new L(e,t.u_tileratio),u_crossfade_from:new L(e,t.u_crossfade_from),u_crossfade_to:new L(e,t.u_crossfade_to),u_image_dash:new W(e,t.u_image_dash),u_mix:new L(e,t.u_mix),u_lineatlas_width:new L(e,t.u_lineatlas_width),u_lineatlas_height:new L(e,t.u_lineatlas_height)}),bo=(e,t,r,i)=>{let a=e.transform;return{u_translation:sg(e,t,r),u_ratio:i/It(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},kD=(e,t,r,i,a)=>q(bo(e,t,r,i),{u_image:0,u_image_height:a}),RD=(e,t,r,i,a)=>{let s=e.transform,n=Jh(t,s);return{u_translation:sg(e,t,r),u_texsize:t.imageAtlasTexture.size,u_ratio:i/It(t,1,s.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[n,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},BD=(e,t,r,i,a)=>{let s=e.transform,n=Jh(t,s);return q(bo(e,t,r,i),{u_tileratio:n,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})},LD=(e,t,r,i,a,s)=>{let n=e.transform,o=Jh(t,n);return q(bo(e,t,r,i),{u_image:0,u_image_height:s,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 Jh(e,t){return 1/It(e,1,t.tileZoom)}function sg(e,t,r){return jr(e.transform,t,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const $D=(e,t)=>({u_image:new W(e,t.u_image),u_opacity:new L(e,t.u_opacity)}),OD=(e,t)=>({u_image:t,u_opacity:e}),VD=(e,t)=>({u_is_size_zoom_constant:new W(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new W(e,t.u_is_size_feature_constant),u_size_t:new L(e,t.u_size_t),u_size:new L(e,t.u_size),u_camera_to_center_distance:new L(e,t.u_camera_to_center_distance),u_pitch:new L(e,t.u_pitch),u_rotate_symbol:new W(e,t.u_rotate_symbol),u_aspect_ratio:new L(e,t.u_aspect_ratio),u_fade_change:new L(e,t.u_fade_change),u_label_plane_matrix:new Mt(e,t.u_label_plane_matrix),u_coord_matrix:new Mt(e,t.u_coord_matrix),u_is_text:new W(e,t.u_is_text),u_pitch_with_map:new W(e,t.u_pitch_with_map),u_is_along_line:new W(e,t.u_is_along_line),u_is_variable_anchor:new W(e,t.u_is_variable_anchor),u_texsize:new Y(e,t.u_texsize),u_texture:new W(e,t.u_texture),u_translation:new Y(e,t.u_translation),u_pitched_scale:new L(e,t.u_pitched_scale),u_is_offset:new W(e,t.u_is_offset),u_height_anchor_ground:new W(e,t.u_height_anchor_ground)}),jD=(e,t)=>({u_is_size_zoom_constant:new W(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new W(e,t.u_is_size_feature_constant),u_size_t:new L(e,t.u_size_t),u_size:new L(e,t.u_size),u_camera_to_center_distance:new L(e,t.u_camera_to_center_distance),u_pitch:new L(e,t.u_pitch),u_rotate_symbol:new W(e,t.u_rotate_symbol),u_aspect_ratio:new L(e,t.u_aspect_ratio),u_fade_change:new L(e,t.u_fade_change),u_label_plane_matrix:new Mt(e,t.u_label_plane_matrix),u_coord_matrix:new Mt(e,t.u_coord_matrix),u_is_text:new W(e,t.u_is_text),u_pitch_with_map:new W(e,t.u_pitch_with_map),u_is_along_line:new W(e,t.u_is_along_line),u_is_variable_anchor:new W(e,t.u_is_variable_anchor),u_texsize:new Y(e,t.u_texsize),u_texture:new W(e,t.u_texture),u_gamma_scale:new L(e,t.u_gamma_scale),u_device_pixel_ratio:new L(e,t.u_device_pixel_ratio),u_is_halo:new W(e,t.u_is_halo),u_is_plain:new W(e,t.u_is_plain),u_translation:new Y(e,t.u_translation),u_pitched_scale:new L(e,t.u_pitched_scale),u_is_offset:new W(e,t.u_is_offset),u_height_anchor_ground:new W(e,t.u_height_anchor_ground)}),ND=(e,t)=>({u_is_size_zoom_constant:new W(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new W(e,t.u_is_size_feature_constant),u_size_t:new L(e,t.u_size_t),u_size:new L(e,t.u_size),u_camera_to_center_distance:new L(e,t.u_camera_to_center_distance),u_pitch:new L(e,t.u_pitch),u_rotate_symbol:new W(e,t.u_rotate_symbol),u_aspect_ratio:new L(e,t.u_aspect_ratio),u_fade_change:new L(e,t.u_fade_change),u_label_plane_matrix:new Mt(e,t.u_label_plane_matrix),u_coord_matrix:new Mt(e,t.u_coord_matrix),u_is_text:new W(e,t.u_is_text),u_pitch_with_map:new W(e,t.u_pitch_with_map),u_is_along_line:new W(e,t.u_is_along_line),u_is_variable_anchor:new W(e,t.u_is_variable_anchor),u_texsize:new Y(e,t.u_texsize),u_texsize_icon:new Y(e,t.u_texsize_icon),u_texture:new W(e,t.u_texture),u_texture_icon:new W(e,t.u_texture_icon),u_gamma_scale:new L(e,t.u_gamma_scale),u_device_pixel_ratio:new L(e,t.u_device_pixel_ratio),u_is_halo:new W(e,t.u_is_halo),u_translation:new Y(e,t.u_translation),u_pitched_scale:new L(e,t.u_pitched_scale),u_is_offset:new W(e,t.u_is_offset),u_height_anchor_ground:new W(e,t.u_height_anchor_ground)}),ng=(e,t,r,i,a,s,n,o,l,u,h,c,p,d,f)=>{let m=n.transform;return{u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:m.cameraToCenterDistance,u_pitch:m.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:m.width/m.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,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:s,u_texsize:c,u_texture:0,u_translation:u,u_pitched_scale:p,u_is_offset:d,u_height_anchor_ground:+f}},og=(e,t,r,i,a,s,n,o,l,u,h,c,p,d,f,m)=>{let g=n.transform;return q(ng(e,t,r,i,a,s,n,o,l,u,h,c,d,f,m),{u_gamma_scale:i?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_device_pixel_ratio:n.pixelRatio,u_is_halo:+!!p,u_is_plain:1})},UD=(e,t,r,i,a,s,n,o,l,u,h,c,p,d,f)=>q(og(e,t,r,i,a,s,n,o,l,u,!0,h,!0,p,d,f),{u_texsize_icon:c,u_texture_icon:1}),qD=(e,t)=>({u_opacity:new L(e,t.u_opacity),u_color:new Gr(e,t.u_color)}),GD=(e,t)=>({u_opacity:new L(e,t.u_opacity),u_image:new W(e,t.u_image),u_pattern_tl_a:new Y(e,t.u_pattern_tl_a),u_pattern_br_a:new Y(e,t.u_pattern_br_a),u_pattern_tl_b:new Y(e,t.u_pattern_tl_b),u_pattern_br_b:new Y(e,t.u_pattern_br_b),u_texsize:new Y(e,t.u_texsize),u_mix:new L(e,t.u_mix),u_pattern_size_a:new Y(e,t.u_pattern_size_a),u_pattern_size_b:new Y(e,t.u_pattern_size_b),u_scale_a:new L(e,t.u_scale_a),u_scale_b:new L(e,t.u_scale_b),u_pixel_coord_upper:new Y(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new Y(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new L(e,t.u_tile_units_to_pixels)}),ZD=(e,t)=>({u_opacity:e,u_color:t}),WD=(e,t,r,i,a)=>q(rD(r,a,t,i),{u_opacity:e}),HD=(e,t)=>({u_sun_pos:new Dt(e,t.u_sun_pos),u_atmosphere_blend:new L(e,t.u_atmosphere_blend),u_globe_position:new Dt(e,t.u_globe_position),u_globe_radius:new L(e,t.u_globe_radius),u_inv_proj_matrix:new Mt(e,t.u_inv_proj_matrix)}),XD=(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}),YD=(e,t)=>({u_sky_color:new Gr(e,t.u_sky_color),u_horizon_color:new Gr(e,t.u_horizon_color),u_horizon:new Y(e,t.u_horizon),u_horizon_normal:new Y(e,t.u_horizon_normal),u_sky_horizon_blend:new L(e,t.u_sky_horizon_blend),u_sky_blend:new L(e,t.u_sky_blend)}),KD=(e,t,r)=>{let i=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),s=Za(t),n=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-s*a)*r,(t.height/2+s*i)*r],u_horizon_normal:[-a,i],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*r,u_sky_blend:n}},Fd=(e,t)=>{},JD={fillExtrusion:iD,fillExtrusionPattern:aD,fill:nD,fillPattern:oD,fillOutline:lD,fillOutlinePattern:uD,circle:dD,collisionBox:mD,collisionCircle:gD,debug:vD,depth:Fd,clippingMask:Fd,heatmap:xD,heatmapTexture:bD,hillshade:wD,hillshadePrepare:TD,colorRelief:SD,line:PD,lineGradient:ID,linePattern:MD,lineSDF:FD,lineGradientSDF:zD,layerOpacity:$D,raster:dT,symbolIcon:VD,symbolSDF:jD,symbolTextAndIcon:ND,background:qD,backgroundPattern:GD,terrain:H6,terrainDepth:X6,atmosphere:HD,sky:YD};var QD=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 zd={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var eA=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 s=i.offset+this.itemSize*(r||0);a.isInteger?e.vertexAttribIPointer(a.location,i.components,e[zd[i.type]],this.itemSize,s):e.vertexAttribPointer(a.location,i.components,e[zd[i.type]],!1,this.itemSize,s)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},me=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)}},tA=class extends me{getDefault(){return J.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)}},rA=class extends me{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},iA=class extends me{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},aA=class extends me{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)}},sA=class extends me{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},nA=class extends me{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},oA=class extends me{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)}},lA=class extends me{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)}},uA=class extends me{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}},hA=class extends me{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)}},cA=class extends me{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}},pA=class extends me{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},dA=class extends me{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}},fA=class extends me{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)}},mA=class extends me{getDefault(){return J.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)}},gA=class extends me{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},_A=class extends me{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}},yA=class extends me{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},vA=class extends me{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},xA=class extends me{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},bA=class extends me{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},wA=class extends me{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)}},TA=class extends me{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}},DA=class extends me{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}},AA=class extends me{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}},EA=class extends me{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}},SA=class extends me{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},CA=class extends me{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},PA=class extends me{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}},IA=class extends me{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}},MA=class extends me{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}},Qh=class extends me{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},FA=class extends Qh{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}},zA=class extends Qh{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}},kA=class extends Qh{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}},RA=class{constructor(e,t,r,i,a){this.context=e,this.width=t,this.height=r;let s=e.gl,n=this.framebuffer=s.createFramebuffer();if(this.colorAttachment=new FA(e,n),i)this.depthAttachment=a?new kA(e,n):new zA(e,n);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)}},Fe=class{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}};Fe.Replace=[1,0],Fe.disabled=new Fe(Fe.Replace,J.transparent,[!1,!1,!1,!1]),Fe.unblended=new Fe(Fe.Replace,J.transparent,[!0,!0,!0,!0]),Fe.alphaBlended=new Fe([1,771],J.transparent,[!0,!0,!0,!0]);var BA=class{constructor(e){this.gl=e,this.clearColor=new tA(this),this.clearDepth=new rA(this),this.clearStencil=new iA(this),this.colorMask=new aA(this),this.depthMask=new sA(this),this.stencilMask=new nA(this),this.stencilFunc=new oA(this),this.stencilOp=new lA(this),this.stencilTest=new uA(this),this.depthRange=new hA(this),this.depthTest=new cA(this),this.depthFunc=new pA(this),this.blend=new dA(this),this.blendFunc=new fA(this),this.blendColor=new mA(this),this.blendEquation=new gA(this),this.cullFace=new _A(this),this.cullFaceSide=new yA(this),this.frontFace=new vA(this),this.program=new xA(this),this.activeTexture=new bA(this),this.viewport=new wA(this),this.bindFramebuffer=new TA(this),this.bindRenderbuffer=new DA(this),this.bindTexture=new AA(this),this.bindVertexBuffer=new EA(this),this.bindElementBuffer=new SA(this),this.bindVertexArray=new CA(this),this.pixelStoreUnpack=new PA(this),this.pixelStoreUnpackPremultiplyAlpha=new IA(this),this.pixelStoreUnpackFlipY=new MA(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")}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}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new QD(this,e,t)}createVertexBuffer(e,t,r){return new eA(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 RA(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){rr(e.blendFunction,Fe.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)}},se=class{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}};se.ReadOnly=!1,se.ReadWrite=!0,se.disabled=new se(519,se.ReadOnly,[0,1]);const ll=7680;var ue=class{constructor(e,t,r,i,a,s){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=a,this.pass=s}};ue.disabled=new ue({func:519,mask:0},0,0,ll,ll,ll);const kd=1029,ul=2305;var le=class{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}};le.disabled=new le(!1,kd,ul),le.backCCW=new le(!0,kd,ul),le.frontCCW=new le(!0,1028,ul);let Ks;function Rd(e,t,r,i,a){var _,y;let s=e.context,n=e.transform,o=s.gl,l=e.useProgram("collisionBox"),u=[],h=0,c=0;for(let x of i){let v=t.getTile(x).getBucket(r);if(!v)continue;let w=a?v.textCollisionBox:v.iconCollisionBox,b=v.collisionCircleArray;b.length>0&&(u.push({circleArray:b,circleOffset:c,coord:x}),h+=b.length/4,c=h),w&&l.draw(s,o.LINES,se.disabled,ue.disabled,e.colorModeForRenderPass(),le.disabled,_D(e.transform),(_=e.style.map.terrain)==null?void 0:_.getTerrainData(x),n.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,e.transform.zoom,null,null,w.collisionVertexBuffer)}if(!a||!u.length)return;let p=e.useProgram("collisionCircle"),d=new sv;d.resize(h*4),d._trim();let f=0;for(let x of u)for(let v=0;v<x.circleArray.length/4;v++){let w=v*4,b=x.circleArray[w+0],A=x.circleArray[w+1],C=x.circleArray[w+2],E=x.circleArray[w+3];d.emplace(f++,b,A,C,E,0),d.emplace(f++,b,A,C,E,1),d.emplace(f++,b,A,C,E,2),d.emplace(f++,b,A,C,E,3)}(!Ks||Ks.length<h*2)&&(Ks=LA(h));let m=s.createIndexBuffer(Ks,!0),g=s.createVertexBuffer(d,Db.members,!0);for(let x of u){let v=yD(e.transform);p.draw(s,o.TRIANGLES,se.disabled,ue.disabled,e.colorModeForRenderPass(),le.disabled,v,(y=e.style.map.terrain)==null?void 0:y.getTerrainData(x.coord),null,r.id,g,m,De.simpleSegment(0,x.circleOffset*2,x.circleArray.length,x.circleArray.length/2),null,e.transform.zoom,null,null,null)}g.destroy(),m.destroy()}function LA(e){let t=e*2,r=new ov;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 $A=Xt(new Float32Array(16));function OA(e,t,r,i,a,s){if(e.renderPass!=="translucent")return;let{isRenderingToTexture:n}=s,o=ue.disabled,l=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&jA(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&&Bd(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"),o,l,n),r.paint.get("text-opacity").constantOr(1)!==0&&Bd(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"),o,l,n),t.map.showCollisionBoxes&&(Rd(e,t,r,i,!0),Rd(e,t,r,i,!1))}function VA(e,t,r,i,a,s){let{horizontalAlign:n,verticalAlign:o}=F2(e),l=-(n-.5)*t,u=-(o-.5)*r;return new M((l/a+i[0])*s,(u/a+i[1])*s)}function jA(e,t,r,i,a,s,n,o,l){var d;let u=t.transform,h=t.style.map.terrain,c=a==="map",p=s==="map";for(let f of e){let m=i.getTile(f),g=m.getBucket(r);if(!((d=g==null?void 0:g.text)!=null&&d.segments.get().length))continue;let _=g.textSizeData,y=go(_,u.zoom),x=It(m,1,t.transform.zoom),v=Zh(c,t.transform,x),w=r.layout.get("icon-text-fit")!=="none"&&g.hasIconData();if(y){let b=2**(u.zoom-m.tileID.overscaledZ),A=h?(C,E)=>h.getElevation(f,C,E):void 0;UA(g,c,p,l,u,v,b,y,w,jr(u,m,n,o),f.toUnwrapped(),A,r.layout.get("symbol-height-anchor")==="ground")}}}function NA(e,t,r,i,a,s){let n=t.tileAnchorPoint.add(new M(t.translation[0],t.translation[1]));if(t.pitchWithMap){let o=i.mult(s);r||(o=o.rotate(-a));let l=n.add(o);return Hh(l.x,l.y,t.pitchedLabelPlaneMatrix,wi(t,l.x,l.y)).point}if(r){let o=Ti(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 UA(e,t,r,i,a,s,n,o,l,u,h,c,p){let d=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let _=0;_<d.length;_++){let y=d.get(_),x=e.allowVerticalPlacement&&!y.placedOrientation,v=!y.hidden&&y.crossTileID&&!x?i[y.crossTileID]:null;if(!v)Yi(y.numGlyphs,f);else{let w=new M(y.anchorX,y.anchorY),b={getElevation:c,heightOffset:y.heightOffset,heightAnchorGround:p,width:a.width,height:a.height,pitchedLabelPlaneMatrix:s,pitchWithMap:r,transform:a,tileAnchorPoint:w,translation:u,unwrappedTileID:h},A=r?Im(w.x,w.y,b):Ti(w.x,w.y,b),C=Sm(a.cameraToCenterDistance,A.signedDistanceFromCamera),E=Ch(e.textSizeData,o,y)*C/24;r&&(E*=e.tilePixelRatio/n);let{width:F,height:k,anchor:B,textOffset:I,textBoxScale:D}=v,T=VA(B,F,k,I,D,E),S=a.getPitchedTextCorrection(w.x+u[0],w.y+u[1],h),j=NA(A.point,b,t,T,-a.bearingInRadians,S),N=e.allowVerticalPlacement&&y.placedOrientation===2?Math.PI/2:0;for(let U=0;U<y.numGlyphs;U++)hs(f,j,N);l&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:j,angle:N})}}if(l){m.clear();let _=e.icon.placedSymbolArray;for(let y=0;y<_.length;y++){let x=_.get(y);if(x.hidden)Yi(x.numGlyphs,m);else{let v=g[y];if(!v)Yi(x.numGlyphs,m);else for(let w=0;w<x.numGlyphs;w++)hs(m,v.shiftedAnchor,v.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function qA(e,t,r){return r.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Bd(e,t,r,i,a,s,n,o,l,u,h,c,p){var B;let d=e.context,f=d.gl,m=e.transform,g=o==="map",_=l==="map",y=o!=="viewport"&&r.layout.get("symbol-placement")!=="point",x=g&&!_&&!y,v=!r.layout.get("symbol-sort-key").isConstant(),w=!1,b=e.getDepthModeForSublayer(0,se.ReadOnly),A=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),C=[],E=m.getCircleRadiusCorrection();for(let I of i){let D=t.getTile(I),T=D.getBucket(r);if(!T)continue;let S=a?T.text:T.icon;if(!(S!=null&&S.segments.get().length)||!S.hasVisibleVertices)continue;let j=S.programConfigurations.get(r.id),N=a||T.sdfIcons,U=a?T.textSizeData:T.iconSizeData,X=_||m.pitch!==0,_e=e.useProgram(qA(N,a,T),j),mt=go(U,m.zoom),ye=(B=e.style.map.terrain)==null?void 0:B.getTerrainData(I),Ke,ze=[0,0],ct,Je,Jt=null,mr;if(a){if(ct=D.glyphAtlasTexture,Je=f.LINEAR,Ke=D.glyphAtlasTexture.size,T.iconsInText){ze=D.imageAtlasTexture.size,Jt=D.imageAtlasTexture;let ke=U.kind==="composite"||U.kind==="camera";mr=X||e.options.rotating||e.options.zooming||ke?f.LINEAR:f.NEAREST}}else{let ke=r.layout.get("icon-size").constantOr(0)!==1||T.iconsNeedLinear;ct=D.imageAtlasTexture,Je=N||e.options.rotating||e.options.zooming||ke||X?f.LINEAR:f.NEAREST,Ke=D.imageAtlasTexture.size}let fa=It(D,1,e.transform.zoom),Ir=Zh(g,e.transform,fa),Ii=GT(_,g,e.transform,fa),Xr=jr(m,D,s,n),Ao=m.getProjectionData({overscaledTileID:I,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),Eo=A&&T.hasTextData(),So=r.layout.get("icon-text-fit")!=="none"&&Eo&&T.hasIconData(),ma=r._unevaluatedLayout.hasValue("icon-offset"),Mi=r.layout.get("symbol-height-anchor")==="ground";if(y){let ke=Zr();jT(ke,Ir);let gt=e.style.map.terrain?(Ze,ga)=>e.style.map.terrain.getElevation(I,Ze,ga):void 0;WT(T,e,a,Ir,ke,_,u,r.layout.get("text-rotation-alignment")==="map",I.toUnwrapped(),m.width,m.height,Xr,gt)}let Yr=a&&A||So,Qt=_?Ir:e.transform.clipSpaceToPixelsMatrix,er=y||Yr?$A:Qt,Kr=N&&r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Jr;Jr=N?T.iconsInText?UD(U.kind,mt,x,_,y,Yr,e,er,Ii,Xr,Ke,ze,E,ma,Mi):og(U.kind,mt,x,_,y,Yr,e,er,Ii,Xr,a,Ke,Kr,E,ma,Mi):ng(U.kind,mt,x,_,y,Yr,e,er,Ii,Xr,a,Ke,E,ma,Mi);let pt={program:_e,buffers:S,uniformValues:Jr,projectionData:Ao,atlasTexture:ct,atlasTextureIcon:Jt,atlasInterpolation:Je,atlasInterpolationIcon:mr,isSDF:N,hasHalo:Kr};if(v&&T.canOverlap){w=!0;let ke=S.segments.get();for(let gt of ke)C.push({segments:new De([gt]),sortKey:gt.sortKey,state:pt,terrainData:ye})}else C.push({segments:S.segments,sortKey:0,state:pt,terrainData:ye})}w&&C.sort((I,D)=>I.sortKey-D.sortKey);let F=r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,k=r.layout.get("text-letter-spacing").constantOr(0)*24<0||F>1;for(let I of C){let D=I.state;d.activeTexture.set(f.TEXTURE0),D.atlasTexture.bind(D.atlasInterpolation,f.CLAMP_TO_EDGE),D.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),D.atlasTextureIcon&&D.atlasTextureIcon.bind(D.atlasInterpolationIcon,f.CLAMP_TO_EDGE));let T=D.isSDF&&D.hasHalo;if(T){let S=D.uniformValues;S.u_is_halo=1,k&&(S.u_is_plain=0,Ld(D.buffers,I.segments,r,e,D.program,b,h,c,S,D.projectionData,I.terrainData),S.u_is_halo=0,S.u_is_plain=1)}Ld(D.buffers,I.segments,r,e,D.program,b,h,c,D.uniformValues,D.projectionData,I.terrainData),T&&!k&&(D.uniformValues.u_is_halo=0)}}function Ld(e,t,r,i,a,s,n,o,l,u,h){let c=i.context,p=c.gl;a.draw(c,p.TRIANGLES,s,n,o,le.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 GA(e,t,r,i,a){var y;if(e.renderPass!=="translucent")return;let{isRenderingToTexture:s}=a,n=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),l=r.paint.get("circle-stroke-opacity"),u=!r.layout.get("circle-sort-key").isConstant();if(n.constantOr(1)===0&&(o.constantOr(1)===0||l.constantOr(1)===0))return;let h=e.context,c=h.gl,p=e.transform,d=e.getDepthModeForSublayer(0,se.ReadOnly),f=ue.disabled,m=e.colorModeForRenderPass(),g=[],_=p.getCircleRadiusCorrection();for(let x of i){let v=t.getTile(x),w=v.getBucket(r);if(!w)continue;let b=r.paint.get("circle-translate"),A=r.paint.get("circle-translate-anchor"),C=jr(p,v,b,A),E=w.programConfigurations.get(r.id),F=e.useProgram("circle",E),k=w.layoutVertexBuffer,B=w.indexBuffer,I=(y=e.style.map.terrain)==null?void 0:y.getTerrainData(x),D={programConfiguration:E,program:F,layoutVertexBuffer:k,indexBuffer:B,uniformValues:fD(e,v,r,C,_),terrainData:I,projectionData:p.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!s,applyTerrainMatrix:!0})};if(u){let T=w.segments.get();for(let S of T)g.push({segments:new De([S]),sortKey:S.sortKey,state:D})}else g.push({segments:w.segments,sortKey:0,state:D})}u&&g.sort((x,v)=>x.sortKey-v.sortKey);for(let x of g){let{programConfiguration:v,program:w,layoutVertexBuffer:b,indexBuffer:A,uniformValues:C,terrainData:E,projectionData:F}=x.state,k=x.segments;w.draw(h,c.TRIANGLES,d,f,m,le.backCCW,C,E,F,r.id,b,A,k,r.paint,e.transform.zoom,v)}}function ZA(e,t,r,i,a){if(r.paint.get("heatmap-opacity")===0)return;let s=e.context,{isRenderingToTexture:n,isRenderingGlobe:o}=a;if(e.style.map.terrain){for(let l of i){let u=t.getTile(l);t.hasRenderableParent(l)||(e.renderPass==="offscreen"?XA(e,u,r,l,o):e.renderPass==="translucent"&&YA(e,r,l,n,o))}s.viewport.set([0,0,e.width,e.height])}else e.renderPass==="offscreen"?WA(e,t,r,i):e.renderPass==="translucent"&&HA(e,r)}function WA(e,t,r,i){let a=e.context,s=a.gl,n=e.transform,o=ue.disabled,l=new Fe([s.ONE,s.ONE],J.transparent,[!0,!0,!0,!0]);KA(a,e,r),a.clear({color:J.transparent});for(let u of i){if(t.hasRenderableParent(u))continue;let h=t.getTile(u),c=h.getBucket(r);if(!c)continue;let p=c.programConfigurations.get(r.id),d=e.useProgram("heatmap",p),f=n.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),m=n.getCircleRadiusCorrection();d.draw(a,s.TRIANGLES,se.disabled,o,l,le.backCCW,ig(h,n.zoom,r.paint.get("heatmap-intensity"),m),null,f,r.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,r.paint,n.zoom,p)}a.viewport.set([0,0,e.width,e.height])}function HA(e,t){let r=e.context,i=r.gl;r.setColorMode(e.colorModeForRenderPass());let a=t.heatmapFbos.get(Fn);a&&(r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1),ug(r,t).bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,i.TRIANGLES,se.disabled,ue.disabled,e.colorModeForRenderPass(),le.disabled,ag(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function XA(e,t,r,i,a){let s=e.context,n=s.gl,o=ue.disabled,l=new Fe([n.ONE,n.ONE],J.transparent,[!0,!0,!0,!0]),u=t.getBucket(r);if(!u)return;let h=i.key,c=r.heatmapFbos.get(h);c||(c=lg(s,t.tileSize,t.tileSize),r.heatmapFbos.set(h,c)),s.bindFramebuffer.set(c.framebuffer),s.viewport.set([0,0,t.tileSize,t.tileSize]),s.clear({color:J.transparent});let p=u.programConfigurations.get(r.id),d=e.useProgram("heatmap",p,!a),f=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),m=e.style.map.terrain.getTerrainData(i);d.draw(s,n.TRIANGLES,se.disabled,o,l,le.disabled,ig(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,p)}function YA(e,t,r,i,a){let s=e.context,n=s.gl,o=e.transform;s.setColorMode(e.colorModeForRenderPass());let l=ug(s,t),u=r.key,h=t.heatmapFbos.get(u);if(!h)return;s.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,h.colorAttachment.get()),s.activeTexture.set(n.TEXTURE1),l.bind(n.LINEAR,n.CLAMP_TO_EDGE);let c=o.getProjectionData({overscaledTileID:r,applyTerrainMatrix:a,applyGlobeMatrix:!i});e.useProgram("heatmapTexture").draw(s,n.TRIANGLES,se.disabled,ue.disabled,e.colorModeForRenderPass(),le.disabled,ag(e,t,0,1),null,c,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,o.zoom),h.destroy(),t.heatmapFbos.delete(u)}function KA(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(Fn);a?(i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=lg(e,t.width/4,t.height/4),r.heatmapFbos.set(Fn,a))}function lg(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 s=e.createFramebuffer(t,r,!1,!1);return s.colorAttachment.set(a),s}function ug(e,t){return t.colorRampTexture||(t.colorRampTexture=new Ge(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function hg(e,t,r,i){let a=e.context,s=a.bindFramebuffer.get(),n=a.viewport.get(),[,,o,l]=n;return JA(e,o,l),a.viewport.set([0,0,o,l]),a.clear({color:J.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,r,i),{compositeTarget:s,compositeViewport:n}}function JA(e,t,r){let i=e.context.gl;if(!e.layerOpacityFbo){let s=e.context.createFramebuffer(t,r,!0,!0),n=i.createTexture();i.bindTexture(i.TEXTURE_2D,n),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),s.colorAttachment.set(n),s.depthAttachment.set(e.context.createRenderbuffer(i.DEPTH_STENCIL,t,r)),e.layerOpacityFbo=s,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 cg(e,t,r,i){let a=e.context,s=a.gl;a.bindFramebuffer.set(r.compositeTarget),a.viewport.set(r.compositeViewport),a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram("layerOpacity").draw(a,s.TRIANGLES,se.disabled,ue.disabled,e.colorModeForRenderPass(),le.disabled,OD(t,0),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom),e.currentStencilSource=void 0}function pg(e,t,r,i,a,s,n,o){let l=256;if(a.stepInterpolant){let u=t.getSource().maxzoom,h=n.canonical.z===u?Math.ceil(1<<e.transform.maxZoom-n.canonical.z):1,c=s.maxLineLength/z*1024*h;l=te(h1(c),256,r.maxTextureSize)}return o.gradient=o2({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:s.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new Ge(r,o.gradient,i.RGBA),o.version=a.gradientVersion,o.texture}function QA(e,t,r,i,a){e.activeTexture.set(t.TEXTURE0),r.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),i.updatePaintBuffers(a)}function eE(e,t,r,i,a,s){(a||e.lineAtlas.dirty)&&(t.activeTexture.set(r.TEXTURE0),e.lineAtlas.bind(t)),i.updatePaintBuffers(s)}function tE(e,t,r,i,a,s,n){let o=s.gradients[a.id],l=o.texture;a.gradientVersion!==o.version&&(l=pg(e,t,r,i,a,s,n,o)),r.activeTexture.set(i.TEXTURE0),l.bind(a.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE)}function rE(e,t,r,i,a,s,n,o,l){let u=s.gradients[a.id],h=u.texture;a.gradientVersion!==u.version&&(h=pg(e,t,r,i,a,s,n,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 iE(e,t,r,i,a){if(e.renderPass!=="translucent")return;let s=r.paint.get("line-opacity"),n=r.paint.get("line-width"),o=r.paint.get("line-layer-opacity");if(s.constantOr(1)===0||n.constantOr(1)===0||o===0)return;let l=!!e.style.map.terrain;if(o<1){let u=hg(e,r,i,l);$d(e,t,r,i,a,l),cg(e,o,u,r);return}$d(e,t,r,i,a,l)}function $d(e,t,r,i,a,s){let{isRenderingToTexture:n}=a,o=e.getDepthModeForSublayer(0,se.ReadOnly),l=e.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),h=u.constantOr(1),c=r.paint.get("line-pattern"),p=c.constantOr(1),d=r.paint.get("line-gradient"),f=r.getCrossfadeParameters(),m;m=p?"linePattern":h&&d?"lineGradientSDF":h?"lineSDF":d?"lineGradient":"line";let g=e.context,_=g.gl,y=e.transform,x=!0;for(let v of i){let w=t.getTile(v);if(p&&!w.patternsLoaded())continue;let b=w.getBucket(r);if(!b)continue;let A=b.programConfigurations.get(r.id),C=e.context.program.get(),E=e.useProgram(m,A),F=x||E.program!==C,k=s?e.getTerrainDataForTile(v,n):null,B=c.constantOr(null),I=u==null?void 0:u.constantOr(null);if(B&&w.imageAtlas){let N=w.imageAtlas,U=N.patternPositions[B.to.toString()],X=N.patternPositions[B.from.toString()];U&&X&&A.setConstantPatternPositions(U,X)}else if(I){let N=r.layout.get("line-cap").constantOr(null)==="round",U=e.lineAtlas.getDash(I.to,N),X=e.lineAtlas.getDash(I.from,N);A.setConstantDashPositions(U,X)}let D=y.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!n,applyTerrainMatrix:!0}),T=y.getPixelScale(),S;p?(S=RD(e,w,r,T,f),QA(g,_,w,A,f)):h&&d?(S=LD(e,w,r,T,f,b.lineClipsArray.length),rE(e,t,g,_,r,b,v,A,f)):h?(S=BD(e,w,r,T,f),eE(e,g,_,A,F,f)):d?(S=kD(e,w,r,T,b.lineClipsArray.length),tE(e,t,g,_,r,b,v)):S=bo(e,w,r,T);let j=e.stencilModeForClipping(v);E.draw(g,_.TRIANGLES,o,j,l,le.disabled,S,k,D,r.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,r.paint,e.transform.zoom,A,b.layoutVertexBuffer2),x=!1}}function dg(e,t,r,i,a){if(!r||!(i!=null&&i.imageAtlas))return;let s=i.imageAtlas.patternPositions,n=s[r.to.toString()],o=s[r.from.toString()];if(!n&&o&&(n=o),!o&&n&&(o=n),!n||!o){let l=a.getPaintProperty(t);n=s[l],o=s[l]}n&&o&&e.setConstantPatternPositions(n,o)}function aE(e,t,r,i,a){let s=r.paint.get("fill-color"),n=r.paint.get("fill-opacity"),o=r.paint.get("fill-layer-opacity");if(n.constantOr(1)===0||o===0)return;if(o<1){if(e.renderPass!=="translucent")return;let h=hg(e,r,i,!!e.style.map.terrain);Od(e,t,r,i,a),cg(e,o,h,r);return}let l=r.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&s.constantOr(J.transparent).a===1&&n.constantOr(0)===1;if(u&&e.renderPass==="opaque"){let{isRenderingToTexture:h}=a,c=e.colorModeForRenderPass();ec(e,t,r,i,e.getDepthModeForSublayer(1,se.ReadWrite),c,!1,h);return}if(u&&e.renderPass==="translucent"){fg(e,t,r,i,a);return}e.renderPass==="translucent"&&Od(e,t,r,i,a)}function Od(e,t,r,i,a){let{isRenderingToTexture:s}=a,n=e.colorModeForRenderPass();ec(e,t,r,i,e.getDepthModeForSublayer(1,se.ReadOnly),n,!1,s),fg(e,t,r,i,a)}function fg(e,t,r,i,a){if(!r.paint.get("fill-antialias"))return;let{isRenderingToTexture:s}=a,n=e.colorModeForRenderPass();ec(e,t,r,i,e.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,se.ReadOnly),n,!0,s)}function ec(e,t,r,i,a,s,n,o){let l=e.context.gl,u="fill-pattern",h=r.paint.get(u),c=h==null?void 0:h.constantOr(1),p=r.getCrossfadeParameters(),d,f,m,g,_,y=e.transform,x=r.paint.get("fill-translate"),v=r.paint.get("fill-translate-anchor");n?(f=c&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",d=l.LINES):(f=c?"fillPattern":"fill",d=l.TRIANGLES);let w=h.constantOr(null);for(let b of i){let A=t.getTile(b);if(c&&!A.patternsLoaded())continue;let C=A.getBucket(r);if(!C)continue;let E=C.programConfigurations.get(r.id),F=e.useProgram(f,E),k=e.getTerrainDataForTile(b,o);c&&(e.context.activeTexture.set(l.TEXTURE0),A.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),E.updatePaintBuffers(p)),dg(E,u,w,A,r);let B=y.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),I=jr(y,A,x,v);if(!n)g=C.indexBuffer,_=C.segments,m=c?rg(e,p,A,I):hD(I);else{g=C.indexBuffer2,_=C.segments2;let T=[l.drawingBufferWidth,l.drawingBufferHeight];m=f==="fillOutlinePattern"&&c?pD(e,p,A,T,I):cD(T,I)}let D=e.stencilModeForClipping(b);F.draw(e.context,d,a,D,s,le.backCCW,m,k,B,r.id,C.layoutVertexBuffer,g,_,r.paint,e.transform.zoom,E)}}function sE(e,t,r,i,a){let s=r.paint.get("fill-extrusion-opacity");if(s===0)return;let{isRenderingToTexture:n}=a;if(e.renderPass==="translucent"){let o=new se(e.context.gl.LEQUAL,se.ReadWrite,e.depthRangeFor3D);if(s===1&&!r.paint.get("fill-extrusion-pattern").constantOr(1)){let l=e.colorModeForRenderPass();hl(e,t,r,i,o,ue.disabled,l,n)}else hl(e,t,r,i,o,ue.disabled,Fe.disabled,n),hl(e,t,r,i,o,e.stencilModeFor3D(),e.colorModeForRenderPass(),n)}}function hl(e,t,r,i,a,s,n,o){var _;let l=e.context,u=l.gl,h="fill-extrusion-pattern",c=r.paint.get(h),p=c.constantOr(1),d=r.getCrossfadeParameters(),f=r.paint.get("fill-extrusion-opacity"),m=c.constantOr(null),g=e.transform;for(let y of i){let x=t.getTile(y),v=x.getBucket(r);if(!v)continue;let w=(_=e.style.map.terrain)==null?void 0:_.getTerrainData(y),b=v.programConfigurations.get(r.id),A=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",b);p&&(e.context.activeTexture.set(u.TEXTURE0),x.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),b.updatePaintBuffers(d));let C=g.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!o,applyTerrainMatrix:!0});dg(b,h,m,x,r);let E=jr(g,x,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),F=r.paint.get("fill-extrusion-vertical-gradient"),k=p?sD(e,F,f,E,y,d,x):tg(e,F,f,E);A.draw(l,l.gl.TRIANGLES,a,s,n,le.backCCW,k,w,C,r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,r.paint,e.transform.zoom,b,e.style.map.terrain&&v.centroidVertexBuffer)}}function nE(e,t,r,i,a){if(e.renderPass!=="offscreen"&&e.renderPass!=="translucent")return;let{isRenderingToTexture:s}=a,n=e.context,o=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,se.ReadOnly),u=e.colorModeForRenderPass();if(e.renderPass==="offscreen")oE(e,t,i,r,l,ue.disabled,u),n.viewport.set([0,0,e.width,e.height]);else if(e.renderPass==="translucent")if(o){let[h,c,p]=e.stencilConfigForOverlapTwoPass(i);cl(e,t,r,p,h,l,u,!1,s),cl(e,t,r,p,c,l,u,!0,s)}else{let[h,c]=e.getStencilConfigForOverlapAndUpdateStencilID(i);cl(e,t,r,c,h,l,u,!1,s)}}function cl(e,t,r,i,a,s,n,o,l){let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],f=e.useProgram("hillshade",null,!1,d),m=!e.options.moving;for(let g of i){let _=t.getTile(g),y=_.fbo;if(!y)continue;let x=u.getMeshFromTileID(h,g.canonical,o,!0,"raster"),v=e.getTerrainDataForTile(g,l);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,y.colorAttachment.get());let w=c.getProjectionData({overscaledTileID:g,aligned:m,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(h,p.TRIANGLES,s,a[g.overscaledZ],n,le.backCCW,DD(e,_,r),v,w,r.id,x.vertexBuffer,x.indexBuffer,x.segments)}}function oE(e,t,r,i,a,s,n){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),p=c.dem;if(!(p!=null&&p.data)||!c.needsHillshadePrepare)continue;let d=p.dim,f=p.stride,m=p.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 Ge(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 Ge(o,{width:d,height:d,data:null},l.RGBA);_.bind(u,l.CLAMP_TO_EDGE),g=c.fbo=o.createFramebuffer(d,d,!0,!1),g.colorAttachment.set(_.texture)}o.bindFramebuffer.set(g.framebuffer),o.viewport.set([0,0,d,d]),e.useProgram("hillshadePrepare").draw(o,l.TRIANGLES,a,s,n,le.disabled,AD(c.tileID,p),null,null,i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),c.needsHillshadePrepare=!1}}function lE(e,t,r,i,a){if(e.renderPass!=="translucent"||!i.length)return;let{isRenderingToTexture:s}=a,n=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,se.ReadOnly),l=e.colorModeForRenderPass();if(n){let[u,h,c]=e.stencilConfigForOverlapTwoPass(i);pl(e,t,r,c,u,o,l,!1,s),pl(e,t,r,c,h,o,l,!0,s)}else{let[u,h]=e.getStencilConfigForOverlapAndUpdateStencilID(i);pl(e,t,r,h,u,o,l,!1,s)}}let Vd=0;function pl(e,t,r,i,a,s,n,o,l){let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=e.useProgram("colorRelief"),f=!e.options.moving,m=r.paint.get("resampling")==="nearest"?p.NEAREST:p.LINEAR,g=!0,_=0;for(let y of i){let x=t.getTile(y),v=x.dem;if(g){Vd||(Vd=p.getParameter(p.MAX_TEXTURE_SIZE));let E=Vd,{elevationTexture:F,colorTexture:k}=r.getColorRampTextures(h,E,v.getUnpackVector());h.activeTexture.set(p.TEXTURE1),F.bind(p.NEAREST,p.CLAMP_TO_EDGE),h.activeTexture.set(p.TEXTURE4),k.bind(p.LINEAR,p.CLAMP_TO_EDGE),g=!1,_=F.size[0]}if(!(v!=null&&v.data))continue;let w=v.stride;h.activeTexture.set(p.TEXTURE0),(!x.demTexture||x.needsColorReliefPrepare)&&(h.pixelStoreUnpackPremultiplyAlpha.set(!1),x.demTexture||(x.demTexture=e.getTileTexture(w)??new Ge(h,{width:w,height:w,data:null},p.RGBA)),x.demTexture.update(v.getPixels(),{premultiply:!1}),x.needsColorReliefPrepare=!1),x.demTexture.bind(m,p.CLAMP_TO_EDGE);let b=u.getMeshFromTileID(h,y.canonical,o,!0,"raster"),A=e.getTerrainDataForTile(y,l),C=c.getProjectionData({overscaledTileID:y,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});d.draw(h,p.TRIANGLES,s,a[y.overscaledZ],n,le.backCCW,CD(r,x.dem,_),A,C,r.id,b.vertexBuffer,b.indexBuffer,b.segments)}}const dl=[new M(0,0),new M(z,0),new M(z,z),new M(0,z)];function uE(e,t,r,i,a){if(e.renderPass!=="translucent"||r.paint.get("raster-opacity")===0||!i.length)return;let{isRenderingToTexture:s}=a,n=t.getSource(),o=e.style.projection.useSubdivision;if(n instanceof Es)Js(e,t,r,i,null,!1,!1,n.tileCoords,n.imageWarp,n.flippedWindingOrder,s,n.getMesh(e.context,o));else if(o){let[l,u,h]=e.stencilConfigForOverlapTwoPass(i);Js(e,t,r,h,l,!1,!0,dl,Xi,!1,s),Js(e,t,r,h,u,!0,!0,dl,Xi,!1,s)}else{let[l,u]=e.getStencilConfigForOverlapAndUpdateStencilID(i);Js(e,t,r,u,l,!1,!0,dl,Xi,!1,s)}}function Js(e,t,r,i,a,s,n,o,l,u=!1,h=!1,c=null){let p=i[i.length-1].overscaledZ,d=e.context,f=d.gl,m=e.useProgram("raster"),g=e.transform,_=e.style.projection,y=e.colorModeForRenderPass(),x=!e.options.moving,v=r.paint.get("raster-opacity"),w=r.paint.get("resampling")==="nearest"||r.paint.get("raster-resampling")==="nearest"?f.NEAREST:f.LINEAR,b=r.paint.get("raster-fade-duration"),A=!!e.style.map.terrain;for(let C of i){let E=e.getDepthModeForSublayer(C.overscaledZ-p,v===1?se.ReadWrite:se.ReadOnly,f.LESS),F=t.getTile(C);d.activeTexture.set(f.TEXTURE0),F.texture.bind(w,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(f.TEXTURE1);let{parentTile:k,parentScaleBy:B,parentTopLeft:I,fadeValues:D}=hE(F,t,b,A);F.fadeOpacity=D.tileOpacity,k?(k.fadeOpacity=D.parentTileOpacity,k.texture.bind(w,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)):F.texture.bind(w,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),F.texture.useMipmap&&d.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&f.texParameterf(f.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax);let T=e.getTerrainDataForTile(C,h),S=g.getProjectionData({overscaledTileID:C,aligned:x,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),j=fT(I,B,D.fadeMix,r,o,l),N=c??_.getMeshFromTileID(d,C.canonical,s,n,"raster"),U=a?a[C.overscaledZ]:ue.disabled;m.draw(d,f.TRIANGLES,E,U,y,u?le.frontCCW:le.backCCW,j,T,S,r.id,N.vertexBuffer,N.indexBuffer,N.segments)}}function hE(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 s=t.getLoadedTile(e.fadingParentID);if(!s)return a;let n=2**(s.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:s,parentScaleBy:n,parentTopLeft:[e.tileID.canonical.x*n%1,e.tileID.canonical.y*n%1],fadeValues:cE(e,s,r)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:pE(e,r)}:a}function cE(e,t,r){let i=ge(),a=(i-e.timeAdded)/r,s=(i-t.timeAdded)/r,n=e.fadingDirection===1,o=te(a,0,1),l=te(1-s,0,1),u=n?o:l;return{tileOpacity:u,parentTileOpacity:n?l:o,fadeMix:{opacity:1,mix:1-u}}}function pE(e,t){let r=(ge()-e.timeAdded)/t,i=te(r,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}function dE(e,t,r,i,a){let s=r.paint.get("background-color"),n=r.paint.get("background-opacity");if(n===0)return;let{isRenderingToTexture:o}=a,l=e.context,u=l.gl,h=e.style.projection,c=e.transform,p=c.tileSize,d=r.paint.get("background-pattern");if(e.isPatternMissing(d))return;let f=!d&&s.a===1&&n===1&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==f)return;let m=ue.disabled,g=e.getDepthModeForSublayer(0,f==="opaque"?se.ReadWrite:se.ReadOnly),_=e.colorModeForRenderPass(),y=e.useProgram(d?"backgroundPattern":"background"),x=i||da(c,{tileSize:p,terrain:e.style.map.terrain});d&&(l.activeTexture.set(u.TEXTURE0),e.patternAtlas.bind(e.context));let v=r.getCrossfadeParameters();for(let w of x){let b=c.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),A=d?WD(n,e,d,{tileID:w,tileSize:p},v):ZD(n,s),C=e.getTerrainDataForTile(w,o),E=h.getMeshFromTileID(l,w.canonical,!1,!0,"raster");y.draw(l,u.TRIANGLES,g,m,_,le.backCCW,A,C,b,r.id,E.vertexBuffer,E.indexBuffer,E.segments)}}const fE=new J(1,0,0,1),mE=new J(0,1,0,1),gE=new J(0,0,1,1),_E=new J(1,0,1,1),yE=new J(0,1,1,1);function vE(e){let t=e.transform.padding;jd(e,e.transform.height-(t.top||0),3,fE),jd(e,t.bottom||0,3,mE),Nd(e,t.left||0,3,gE),Nd(e,e.transform.width-(t.right||0),3,_E);let r=e.transform.centerPoint;xE(e,r.x,e.transform.height-r.y,yE)}function xE(e,t,r,i){Zn(e,t-1,r-10,2,20,i),Zn(e,t-10,r-1,20,2,i)}function jd(e,t,r,i){Zn(e,0,t+r/2,e.transform.width,r,i)}function Nd(e,t,r,i){Zn(e,t-r/2,0,r,e.transform.height,i)}function Zn(e,t,r,i,a,s){let n=e.context,o=n.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio,a*e.pixelRatio),n.clear({color:s}),o.disable(o.SCISSOR_TEST)}function bE(e,t,r){for(let i of r)wE(e,t,i)}function wE(e,t,r){var _,y;let i=e.context,a=i.gl,s=e.useProgram("debug"),n=se.disabled,o=ue.disabled,l=e.colorModeForRenderPass(),u="$debug",h=(_=e.style.map.terrain)==null?void 0:_.getTerrainData(r);i.activeTexture.set(a.TEXTURE0);let c=((y=t.getTileByID(r.key).latestRawTileData)==null?void 0:y.byteLength)||0,p=Math.floor(c/1024),d=t.getTile(r).tileSize,f=512/Math.min(d,512)*(r.overscaledZ/e.transform.zoom)*.5,m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=` => ${r.overscaledZ}`),TE(e,`${m} ${p}kB`);let g=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});s.draw(i,a.TRIANGLES,n,o,Fe.alphaBlended,le.disabled,Md(J.transparent,f),null,g,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(i,a.LINE_STRIP,n,o,l,le.disabled,Md(J.red),h,g,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function TE(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 DE(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"),s=i.filter(o=>o.getSource().type!=="vector"),n=o=>{(!r||r.getSource().maxzoom<o.getSource().maxzoom)&&(r=o)};for(let o of a)n(o);if(!r)for(let o of s)n(o);return r}function AE(e,t,r,i){let{isRenderingGlobe:a}=i,s=e.context,n=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;
|
|
809
|
+
uniform mat4 u_projection_matrix;
|
|
810
|
+
${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:u,getProjectionData:p=>l.getProjectionData({overscaledTileID:new st(p.tileID.canonical.z,p.tileID.wrap??0,p.tileID.canonical.z,p.tileID.canonical.x,p.tileID.canonical.y),aligned:p.aligned,applyGlobeMatrix:p.applyGlobeMatrix,applyTerrainMatrix:p.applyTerrainMatrix})},c=n.renderingMode?n.renderingMode:"2d";if(e.renderPass==="offscreen"){let p=n.prerender;p&&(e.setCustomLayerDefaults(),s.setColorMode(e.colorModeForRenderPass()),p.call(n,s.gl,h),s.setDirty(),e.setBaseState())}else if(e.renderPass==="translucent"){e.setCustomLayerDefaults(),s.setColorMode(e.colorModeForRenderPass()),s.setStencilMode(ue.disabled);let p=c==="3d"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,se.ReadOnly);s.setDepthMode(p),n.render(s.gl,h),s.setDirty(),e.setBaseState(),s.bindFramebuffer.set(null)}}function EE(e,t){let r=e.context,i=r.gl,a=e.transform,s=Fe.unblended,n=new se(i.LEQUAL,se.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:J.white,depth:1});for(let u of o){let h=t.getTerrainMesh(u.tileID),c=t.getTerrainData(u.tileID),p=a.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d=K6(t.getSkirtLength(a.zoom));l.draw(r,i.TRIANGLES,n,ue.disabled,s,le.backCCW,d,c,p,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function SE(e,t,r,i){let{isRenderingGlobe:a}=i,s=e.context,n=s.gl,o=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram("terrain");s.bindFramebuffer.set(null),s.viewport.set([0,0,e.width,e.height]);for(let c of r){let p=t.getTerrainMesh(c.tileID),d=e.renderToTexture.getTexture(c),f=t.getTerrainData(c.tileID);s.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,d.texture);let m=t.getSkirtLength(o.zoom),g=o.calculateFogMatrix(c.tileID.toUnwrapped()),_=Y6(m,g,e.style.sky,o.pitch,a),y=o.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(s,n.TRIANGLES,u,ue.disabled,l,le.backCCW,_,f,y,"terrain",p.vertexBuffer,p.indexBuffer,p.segments)}}function mg(e,t){if(!t.mesh){let r=new $r;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let i=new fr;i.emplaceBack(0,1,2),i.emplaceBack(0,2,3),t.mesh=new As(e.createVertexBuffer(r,li.members),e.createIndexBuffer(i),De.simpleSegment(0,0,r.length,i.length))}return t.mesh}function CE(e,t){let r=e.context,i=r.gl,a=KD(t,e.transform,e.pixelRatio),s=new se(i.LEQUAL,se.ReadWrite,[0,1]),n=ue.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=mg(r,t);l.draw(r,i.TRIANGLES,s,n,o,le.disabled,a,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function PE(e,t){let r=e.getCartesianPosition();Ng(r,r);let i=Xt(new Float64Array(16));return e.properties.get("anchor")==="map"&&(Br(i,i,t.rollInRadians),Ki(i,i,-t.pitchInRadians),Br(i,i,t.bearingInRadians),Ki(i,i,t.center.lat*Math.PI/180),Jd(i,i,-t.center.lng*Math.PI/180)),Ug(r,r,i),r}function IE(e,t,r){let i=e.context,a=i.gl,s=e.useProgram("atmosphere"),n=new se(a.LEQUAL,se.ReadOnly,[0,1]),o=e.transform,l=PE(r,e.transform),u=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=t.properties.get("atmosphere-blend")*u.projectionTransition;if(h===0)return;let c=xo(o.worldSize,o.center.lat),p=o.inverseProjectionMatrix,d=new Float64Array(4);d[3]=1,Xe(d,d,o.modelViewProjectionMatrix),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1,Xe(d,d,p),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1;let f=[d[0],d[1],d[2]],m=XD(l,h,f,c,p),g=mg(i,t);s.draw(i,a.TRIANGLES,n,ue.disabled,Fe.alphaBlended,le.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}const ME={symbol:OA,circle:GA,heatmap:ZA,line:iE,fill:aE,fillExtrusion:sE,hillshade:nE,colorRelief:lE,raster:uE,background:dE,sky:CE,atmosphere:IE,custom:AE,debug:bE,debugPadding:vE,terrainDepth:EE};var fi,FE=(fi=class{constructor(t,r){this.drawFunctions=ME,this.context=new BA(t),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:Xt(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Lu.maxOverzooming+Lu.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new zm}resize(t,r,i){if(this.width=Math.floor(t*i),this.height=Math.floor(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 $r;r.emplaceBack(0,0),r.emplaceBack(z,0),r.emplaceBack(0,z),r.emplaceBack(z,z),this.tileExtentBuffer=t.createVertexBuffer(r,li.members),this.tileExtentSegments=De.simpleSegment(0,0,4,2);let i=new $r;i.emplaceBack(0,0),i.emplaceBack(z,0),i.emplaceBack(0,z),i.emplaceBack(z,z),this.debugBuffer=t.createVertexBuffer(i,li.members),this.debugSegments=De.simpleSegment(0,0,4,5);let a=new Yy;a.emplaceBack(0,0,0,0),a.emplaceBack(z,0,z,0),a.emplaceBack(0,z,0,z),a.emplaceBack(z,z,z,z),this.rasterBoundsBuffer=t.createVertexBuffer(a,G6.members),this.rasterBoundsSegments=De.simpleSegment(0,0,4,2);let s=new $r;s.emplaceBack(0,0),s.emplaceBack(z,0),s.emplaceBack(0,z),s.emplaceBack(z,z),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(s,li.members),this.rasterBoundsSegmentsPosOnly=De.simpleSegment(0,0,4,5);let n=new $r;n.emplaceBack(0,0),n.emplaceBack(1,0),n.emplaceBack(0,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,li.members),this.viewportSegments=De.simpleSegment(0,0,4,2);let o=new lv;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);let l=new fr;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new ue({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new As(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=Zr();tr(i,0,this.width,this.height,0,0,1),nt(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,se.disabled,this.stencilClearMode,Fe.disabled,le.disabled,null,null,a,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,r,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!(r!=null&&r.length))return;this.currentStencilSource=t.source,this.nextStencilID+r.length>256&&this.clearStencil();let a=this.context;a.setColorMode(Fe.disabled),a.setDepthMode(se.disabled);let s={};for(let n of r)s[n.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(s,r,i,!0),this._renderTileMasks(s,r,i,!1),this._tileClippingMaskIDs=s}_renderTileMasks(t,r,i,a){let s=this.context,n=s.gl,o=this.style.projection,l=this.transform,u=this.useProgram("clippingMask");for(let h of r){let c=t[h.key],p=this.getTerrainDataForTile(h,i),d=o.getMeshFromTileID(this.context,h.canonical,a,!0,"stencil"),f=l.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!i,applyTerrainMatrix:!0});u.draw(s,n.TRIANGLES,se.disabled,new ue({func:n.ALWAYS,mask:0},c,255,n.KEEP,n.KEEP,n.REPLACE),Fe.disabled,i?le.disabled:le.backCCW,null,p,f,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}getTerrainDataForTile(t,r){var i,a;return r&&((i=this.style.projection)==null?void 0:i.name)==="mercator"?null:((a=this.style.map.terrain)==null?void 0:a.getTerrainData(t))||null}_renderTilesDepthBuffer(){var l;let t=this.context,r=t.gl,i=this.style.projection,a=this.transform,s=this.useProgram("depth"),n=this.getDepthModeFor3D(),o=da(a,{tileSize:a.tileSize});for(let u of o){let h=(l=this.style.map.terrain)==null?void 0:l.getTerrainData(u),c=i.getMeshFromTileID(this.context,u.canonical,!0,!0,"raster"),p=a.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!0});s.draw(t,r.TRIANGLES,n,ue.disabled,Fe.disabled,le.backCCW,null,h,p,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,r=this.context.gl;return new ue({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){let r=this.context.gl;return new ue({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((n,o)=>o.overscaledZ-n.overscaledZ),a=i[i.length-1].overscaledZ,s=i[0].overscaledZ-a+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();let n={};for(let o=0;o<s;o++)n[o+a]=new ue({func:r.GEQUAL,mask:255},o+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=s,[n,i]}return[{[a]:ue.disabled},i]}stencilConfigForOverlapTwoPass(t){let r=this.context.gl,i=t.sort((n,o)=>o.overscaledZ-n.overscaledZ),a=i[i.length-1].overscaledZ,s=i[0].overscaledZ-a+1;if(this.clearStencil(),s>1){let n={},o={};for(let l=0;l<s;l++)n[l+a]=new ue({func:r.GREATER,mask:255},s+1+l,255,r.KEEP,r.KEEP,r.REPLACE),o[l+a]=new ue({func:r.GREATER,mask:255},1+l,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID=s*2+1,[n,o,i]}return this.nextStencilID=3,[{[a]:new ue({func:r.GREATER,mask:255},2,255,r.KEEP,r.KEEP,r.REPLACE)},{[a]:new ue({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 Fe([t.CONSTANT_COLOR,t.ONE],new J(r,r,r,0),[!0,!0,!0,!0])}return this.renderPass==="opaque"?Fe.unblended:Fe.alphaBlended}getDepthModeForSublayer(t,r,i){if(!this.opaquePassEnabledForLayer())return se.disabled;let a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new se(i||this.context.gl.LEQUAL,r,[a,a])}getDepthModeFor3D(){return new se(this.context.gl.LEQUAL,se.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,r){var h,c;this.style=t,this.options=r,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(ge()),this.imageManager.beginFrame();let i=this.style._order,a=this.style.tileManagers,s={},n={},o={},l={isRenderingToTexture:!1,isRenderingGlobe:((h=t.projection)==null?void 0:h.transitionState)>0};for(let p in a){let d=a[p];d.used&&d.prepare(this.context),s[p]=d.getVisibleCoordinates(!1),n[p]=s[p].slice().reverse(),o[p]=d.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let p=0;p<i.length;p++){let d=i[p];if(this.style._layers[d].is3D()){this.opaquePassCutoff=p;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let p of i){let d=this.style._layers[p];if(!d.hasOffscreenPass()||d.isHidden(this.transform.zoom))continue;let f=n[d.source];d.type!=="custom"&&!f.length||this.renderLayer(this,a[d.source],d,f,l)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?J.black:J.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){let p=this.style._layers[i[this.currentLayer]],d=a[p.source],f=s[p.source];this.renderTileClippingMasks(p,f,!1),this.renderLayer(this,d,p,f,l)}this.renderPass="translucent";let u=!1;for(this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let p=this.style._layers[i[this.currentLayer]],d=a[p.source];if((c=this.renderToTexture)!=null&&c.renderLayer(p,l))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=!0,l.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let f=(p.type==="symbol"?o:n)[p.source];this.renderTileClippingMasks(p,s[p.source],!!this.renderToTexture),this.renderLayer(this,d,p,f,l)}if(l.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let p=DE(this.style,this.transform.zoom);p&&this.drawFunctions.debug(this,p,p.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(){var a,s;if(!((s=(a=this.style)==null?void 0:a.map)!=null&&s.terrain))return;let t=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.depthDirty;i||(i=!Vg(t,r)),i||(i=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),i&&(Rg(t,r),this.terrainFacilitator.renderTime=ge(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t,r,i,a,s){if(i.isHidden(this.transform.zoom)||i.type!=="background"&&i.type!=="custom"&&!(a||[]).length)return;this.id=i.id;let n=this.drawFunctions;k2(i)?n.symbol(t,r,i,a,this.style.placement.variableOffsets,s):$v(i)?n.circle(t,r,i,a,s):Uv(i)?n.heatmap(t,r,i,a,s):vb(i)?n.line(t,r,i,a,s):kx(i)?n.fill(t,r,i,a,s):rb(i)?n.fillExtrusion(t,r,i,a,s):Hv(i)?n.hillshade(t,r,i,a,s):ex(i)?n.colorRelief(t,r,i,a,s):Vl(i)?n.raster(t,r,i,a,s):a3(i)?n.background(t,r,i,a,s):o3(i)&&n.custom(t,r,i,s)}saveTileTexture(t){let r=this._tileTextures[t.size[0]];r?r.length<fi.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&&(r.bindTexture(r.TEXTURE_2D,i.texture.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,t,0,r.RGBA,r.UNSIGNED_BYTE,null),i.texture.size=[t,t],i.size=t),i;let a=new Ge(this.context,{width:t,height:t,data:null},r.RGBA);return a.bind(r.LINEAR,r.CLAMP_TO_EDGE),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),s=this.context.createRenderbuffer(r.DEPTH_STENCIL,i,i);a.depthAttachment.set(s),this._rttSharedFbo={fbo:a,depthRenderbuffer:s,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)}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 s=!!this.style.map.terrain,n=this.style.projection,o=i?sr.projectionMercator:n.shaderPreludeCode,l=i?km:n.shaderDefine,u=`/${i?Rm:n.shaderVariantName}`,h=r?r.cacheKey:"",c=this._showOverdrawInspector?"/overdraw":"",p=s?"/terrain":"",d=a?`/${a.join("/")}`:"",f=t+h+u+c+p+d;return(m=this.cache)[f]||(m[f]=new tD(this.context,sr[t],r,JD[t],this._showOverdrawInspector,s,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 Ge(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){var t,r,i;if(this._tileTextures){for(let a in this._tileTextures){let s=this._tileTextures[a];if(s)for(let n of s)n.destroy()}this._tileTextures={}}for(let a of this._rttObjectRecyclePool)a.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let a=this.context.gl;a.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),a.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if((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(),this.cache){for(let a in this.cache){let s=this.cache[a];s!=null&&s.program&&this.context.gl.deleteProgram(s.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:r}=this.context.gl;return this.width!==t||this.height!==r}},fi.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,fi),zE=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 gg(e,t){let r=!1,i=null,a,s=()=>{i=null,r&&(r=(e(...a),i=setTimeout(s,t),!1))};return(...n)=>(r=!0,a=n,i||s(),i)}var kE=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 s=Array.from(t.keys());s.length>0&&t.delete(s[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=gg(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,s=Math.round(t.lat*i)/i,n=this._map.getBearing(),o=this._map.getPitch(),l="";if(l+=e?`/${a}/${s}/${r}`:`${r}/${s}/${a}`,(n||o)&&(l+=`/${Math.round(n*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 K(+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 Ss={linearity:.3,easing:Wu(0,0,.3,1)},RE=q({deceleration:2500,maxSpeed:1400},Ss),BE=q({deceleration:20,maxSpeed:1400},Ss),LE=q({deceleration:1e3,maxSpeed:360},Ss),$E=q({deceleration:1e3,maxSpeed:90},Ss),OE=q({deceleration:1e3,maxSpeed:360},Ss);var VE=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ge(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=ge();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=ge()-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:s}of t)s.around&&(r.around=s.around),s.pinchAround&&(r.pinchAround=s.pinchAround);for(let{settings:s}of t.slice(1))r.zoom+=s.zoomDelta||0,r.bearing+=s.bearingDelta||0,r.pitch+=s.pitchDelta||0,r.roll+=s.rollDelta||0,s.panDelta&&r.pan._add(s.panDelta);if(!r.pan.mag()&&!r.zoom&&!r.bearing&&!r.pitch&&!r.roll){this.clear();return}let i=ge()-t[0].time,a={};if(r.pan.mag()){let s=Pa(r.pan.mag(),i,q({},RE,e||{})),n=r.pan.mult(s.amount/r.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(n,this._map._camera.transform);a.center=o.easingCenter,a.offset=o.easingOffset,Ca(a,s)}if(r.zoom){let s=Pa(r.zoom,i,BE);a.zoom=Ct(this._map.getZoom()+s.amount,this._map.getZoomSnap(),s.amount),Ca(a,s)}if(r.bearing){let s=Pa(r.bearing,i,LE);a.bearing=this._map.getBearing()+te(s.amount,-179,179),Ca(a,s)}if(r.pitch){let s=Pa(r.pitch,i,$E);a.pitch=this._map.getPitch()+s.amount,Ca(a,s)}if(r.roll){let s=Pa(r.roll,i,OE);a.roll=this._map.getRoll()+te(s.amount,-179,179),Ca(a,s)}if(a.zoom||a.bearing){let s=r.pinchAround===void 0?r.around:r.pinchAround;a.around=s?this._map.unproject(s):this._map.getCenter()}return this.clear(),q(a,{noMoveStart:!0})}};function Ca(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Pa(e,t,r){let{maxSpeed:i,linearity:a,deceleration:s}=r,n=te(e*a/(t/1e3),-i,i),o=Math.abs(n)/(s*a);return{easing:r.easing,duration:o*1e3,amount:o/2*n}}var jE=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new h4(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new $t(e.type,this._map,e))}mouseup(e){this._map.fire(new $t(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new $t(e.type,this._map,e))}dblclick(e){return this._firePreventable(new $t(e.type,this._map,e))}mouseover(e){this._map.fire(new $t(e.type,this._map,e))}mouseout(e){this._map.fire(new $t(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ns(e.type,this._map,e))}touchmove(e){this._map.fire(new Ns(e.type,this._map,e))}touchend(e){this._map.fire(new Ns(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ns(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},NE=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new $t(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new $t("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new $t(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},UE=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&&(Oe.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=Oe.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let a=Math.min(i.x,r.x),s=Math.max(i.x,r.x),n=Math.min(i.y,r.y),o=Math.max(i.y,r.y);this._box.style.transform=`translate(${a}px,${n}px)`,this._box.style.width=`${s-a}px`,this._box.style.height=`${o-n}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let r=this._startPos,i=t;if(this.reset(),Oe.suppressClick(),r.x===i.x&&r.y===i.y)this._fireEvent("boxzoomcancel",e);else{if(this._map.fire(new qp("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)),Oe.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new qp(e,{originalEvent:t}))}};function Uu(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 qE(e){let t=new M(0,0);for(let r of e)t._add(r);return t.div(e.length)}var GE=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=qE(t),this.touches=Uu(r,t)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;let i=Uu(r,t);for(let a in this.touches){let s=this.touches[a],n=i[a];(!n||n.dist(s)>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}}},qu=class{constructor(e){this.singleTap=new GE(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,s=!this.lastTap||this.lastTap.dist(i)<30;if((!a||!s)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}},ZE=class{constructor(e,t){this._tr=t,this._zoomIn=new qu({numTouches:1,numTaps:2}),this._zoomOut=new qu({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),s=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:n=>n.easeTo({duration:300,zoom:Ct(s.zoom+1,n.getZoomSnap()),around:s.unproject(i)},{originalEvent:e})};if(a)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:n=>n.easeTo({duration:300,zoom:Ct(s.zoom-1,n.getZoomSnap()),around:s.unproject(a)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},wo=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&&Oe.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 WE={0:1,2:2};function HE(e,t){let r=WE[t];return e.buttons===void 0||(e.buttons&r)!==r}var To=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!HE(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}};const Do=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};function XE({enable:e,clickTolerance:t}){return new wo({clickTolerance:t,move:(r,i)=>({around:i,panDelta:i.sub(r)}),activateOnStart:!0,moveStateManager:new To({checkCorrectEvent:r=>r.button===0&&!r.ctrlKey}),enable:e,assignEvents:Do})}function YE({enable:e,clickTolerance:t,aroundCenter:r=!0,minPixelCenterThreshold:i=100,rotateSpeed:a=.8},s){return new wo({clickTolerance:t,move:(n,o)=>{let l=s();if(r&&Math.abs(l.y-n.y)>i)return{bearingDelta:x1(new M(n.x,o.y),o,l)};let u=(o.x-n.x)*a;return r&&o.y<l.y&&(u=-u),{bearingDelta:u}},moveStateManager:new To({checkCorrectEvent:n=>n.button===0&&n.ctrlKey||n.button===2&&!n.ctrlKey}),enable:e,assignEvents:Do})}function KE({enable:e,clickTolerance:t,pitchSpeed:r=-.5}){return new wo({clickTolerance:t,move:(i,a)=>({pitchDelta:(a.y-i.y)*r}),moveStateManager:new To({checkCorrectEvent:i=>i.button===0&&i.ctrlKey||i.button===2}),enable:e,assignEvents:Do})}function JE({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:r=.3},i){return new wo({clickTolerance:t,move:(a,s)=>{let n=i(),o=(s.x-a.x)*r;return s.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:new To({checkCorrectEvent:a=>a.button===2&&a.ctrlKey}),enable:e,assignEvents:Do})}var QE=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=Uu(r,t),a=new M(0,0),s=new M(0,0),n=0;for(let l in i){let u=i[l],h=this._touches[l];h&&(a._add(u),s._add(u.sub(h)),n++,i[l]=u)}if(this._touches=i,this._shouldBePrevented(n)||!s.mag())return;let o=s.div(n);if(this._sum._add(o),!(this._sum.mag()<this._clickTolerance))return{around:a.div(n),panDelta:o}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},tc=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,s=Qs(r,t,i),n=Qs(r,t,a);if(!s||!n)return;let o=this._aroundCenter?null:s.add(n).div(2);return this._move([s,n],o,e)}touchend(e,t,r){if(!this._firstTwoTouches)return;let[i,a]=this._firstTwoTouches,s=Qs(r,t,i),n=Qs(r,t,a);s&&n||(this._active&&Oe.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 Qs(e,t,r){for(let i=0;i<e.length;i++)if(e[i].identifier===r)return t[i]}const Ud=.1;function qd(e,t){return Math.log(e/t)/Math.LN2}var eS=class extends tc{constructor(){super(),this._zoomRate=1,this._zoomThreshold=Ud}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??Ud}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(qd(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:qd(this._distance,r)*this._zoomRate,pinchAround:t}}};function Gd(e,t){return e.angleWith(t)*180/Math.PI}var tS=class extends tc{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:Gd(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,r=Gd(e,this._startVector);return Math.abs(r)<t}};function fl(e){return Math.abs(e.y)>Math.abs(e.x)}var rS=class extends tc{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,fl(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 s=e.y>0==t.y>0;return fl(e)&&fl(t)&&s}};const iS={panStep:100,bearingStep:15,pitchStep:10};var aS=class{constructor(e,t){this._tr=t;let r=iS;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,s=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(),s=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:n=>{let o=this._tr;n.easeTo({duration:300,easeId:"keyboardHandler",easing:sS,zoom:t?Ct(o.zoom+t*(e.shiftKey?2:1),n.getZoomSnap()):o.zoom,bearing:o.bearing+r*this._bearingStep,pitch:o.pitch+i*this._pitchStep,offset:[-a*this._panStep,-s*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 sS(e){return e*(2-e)}const Zd=4.000244140625;var nS=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=ge(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,t!==0&&t%Zd==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=Oe.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(K.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 n=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=n),typeof this._targetZoom=="number"&&(this._targetZoom+=n)}if(this._delta!==0){let n=this._type==="wheel"&&Math.abs(this._delta)>Zd?this._wheelZoomRate:this._defaultZoomRate,o=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&o!==0&&(o=1/o);let l=typeof this._targetZoom=="number"?yt(this._targetZoom):e.scale,u=e.applyConstrain(e.getCameraLngLat(),ft(l*o)).zoom,h=this._map.getZoomSnap();if(this._type==="wheel"&&h>0){let c=Ct(e.zoom,h);this._targetZoom=Ct(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,s;if(this._type==="wheel"&&r&&i){let n=ge()-this._lastWheelEventTime,o=Math.min((n+5)/200,1),l=i(o);s=Ne.number(r,t,l),o<1?this._needsRerender=!0:a=!0}else s=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=s,{noInertia:!0,needsRenderFrame:!a,zoomDelta:s-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=wl;if(this._prevEase){let r=this._prevEase,i=(ge()-r.start)/r.duration,a=r.easing(i+.01)-r.easing(i),s=.27/Math.sqrt(a*a+1e-4)*.01,n=Math.sqrt(.0729-s*s);t=Wu(s,n,.25,1)}return this._prevEase={start:ge(),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)}},oS=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()}},lS=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:Ct(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},uS=class{constructor(){this._tap=new qu({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,s=this._tapPoint.dist(i)<30;!a||!s?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}},hS=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()}},cS=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()}},pS=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()}},dS=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=Oe.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 rt("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},fS=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 en=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var mS=class extends ds{};function ml(e){var t;return((t=e.panDelta)==null?void 0:t.mag())||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var gS=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._terrainGestureAnchorElevation=null,this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,s)=>{if(a.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let n=a.type==="renderFrame"?void 0:a,o={needsRenderFrame:!1},l={},u={};for(let{handlerName:p,handler:d,allowed:f}of this._handlers){if(!d.isEnabled())continue;let m;if(this._blockedByActive(u,f,p))d.reset();else if(d[s||a.type]){if(w1(a,s||a.type)){let g=Oe.mousePos(this._map.getCanvas(),a);m=d[s||a.type](a,g)}else if(b1(a,s||a.type)){let g=a.touches,_=this._getMapTouches(g),y=Oe.touchPos(this._map.getCanvas(),_);m=d[s||a.type](a,y,_)}else T1(s||a.type)||(m=d[s||a.type](a));this.mergeHandlerResult(o,l,m,p,n),m!=null&&m.needsRenderFrame&&this._triggerRenderFrame()}(m||d.isActive())&&(u[p]=d)}let h={};for(let p in this._previousActiveHandlers)u[p]||(h[p]=n);this._previousActiveHandlers=u,(Object.keys(h).length||ml(o))&&(this._changes.push([o,l,h]),this._triggerRenderFrame()),(Object.keys(u).length||ml(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 fS(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new VE(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,s,n]of this._listeners)a.addEventListener(s,a===this._ownerDocument?this.handleWindowEvent:this.handleEvent,n)}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 jE(t,e));let i=t.boxZoom=new UE(t,e,this._transformProvider);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let a=t.cooperativeGestures=new dS(t,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let s=new ZE(t,this._transformProvider),n=new lS(t,this._transformProvider);t.doubleClickZoom=new oS(n,s),this._add("tapZoom",s),this._add("clickZoom",n),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let o=new uS;this._add("tapDragZoom",o);let l=t.touchPitch=new rS(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>t.project(t.getCenter()),h=YE(e,u),c=KE(e),p=JE(e,u);t.dragRotate=new cS(e,h,c,p),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",p,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let d=XE(e),f=new QE(e,t);t.dragPan=new hS(r,d,f),this._add("mousePan",d),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let m=new tS,g=new eS;t.touchZoomRotate=new pS(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 NE(t));let _=t.scrollZoom=new nS(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let y=t.keyboard=new aS(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!!en(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;q(e,r);let s={handlerName:i,originalEvent:r.originalEvent||a};r.zoomDelta!==void 0&&(t.zoom=s),r.panDelta!==void 0&&(t.drag=s),r.rollDelta!==void 0&&(t.roll=s),r.pitchDelta!==void 0&&(t.pitch=s),r.bearingDelta!==void 0&&(t.rotate=s)}_applyChanges(){let e={},t={},r={};for(let[i,a,s]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),q(t,a),q(r,s);this._updateMapTransform(e,t,r),this._changes=[]}_updateMapTransform(e,t,r){let i=this._map,a=this._camera.getTransformForUpdate(),s=i.terrain;if(!ml(e)&&!(s&&this._terrainMovement)){this._fireEvents(t,r,!0);return}this._camera.stop(!0);let{panDelta:n,zoomDelta:o,bearingDelta:l,pitchDelta:u,rollDelta:h}=e,{around:c,aroundOnSurface:p}=this._resolveAround(e,s,a),d=s?this._terrainGestureElevation(s,c,p,a,t):void 0,f={panDelta:n,zoomDelta:o,rollDelta:h,pitchDelta:u,bearingDelta:l,around:c,aroundElevation:d};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(c)&&(c=a.centerPoint);let m=this._computePreZoomAroundLoc(a,c,n,d);this._handleMapControls({terrain:s,tr:a,deltasForHelper:f,preZoomAroundLoc:m,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._terrainMovement&&(a.drag||a.zoom)){let n=i.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGestureAnchorElevation=n?n.z:null}if(this._terrainGestureAnchorElevation===null)return;let s=this._terrainGestureAnchorElevation;if(!(t.distSqr(i.centerPoint)<.01)&&!(s-i.elevation>=.9*(i.getCameraAltitude()-i.elevation)))return s}_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:s}){let n=this._camera.cameraHelper;if(n.handleMapControlsRollPitchBearingZoom(r,t),!e){n.handleMapControlsPan(r,t,i);return}if(n.useGlobeControls){!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),n.handleMapControlsPan(r,t,i);return}if(!this._terrainMovement&&(a.drag||a.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,n.handleMapControlsPan(r,t,i);return}if(r.aroundElevation===void 0&&a.drag&&this._terrainMovement&&s){t.setCenter(t.screenPointToLocation(t.centerPoint.sub(s)));return}n.handleMapControlsPan(r,t,i)}_fireEvents(e,t,r){let i=en(this._eventsInProgress),a=en(e),s={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(s[`${h}start`]=c),this._eventsInProgress[h]=e[h]}!i&&a&&this._fireEvent("movestart",a.originalEvent);for(let h in s)this._fireEvent(h,s[h]);a&&this._fireEvent("move",a.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let n={},o;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:p}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],o=t[c]||p,n[`${h}end`]=o)}for(let h in n)this._fireEvent(h,n[h]);let l=en(this._eventsInProgress),u=(i||a)&&!l;if(u&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=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=p=>p!==0&&-this._bearingSnap<p&&p<this._bearingSnap;h&&(h.essential||!At.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:o})):(this._map.fire(new G("moveend",{originalEvent:o})),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new G(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new mS("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},_S=class extends vt{constructor(e){super(),this._renderFrameCallback=()=>{let t=Math.min((ge()-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 Nn,this.cameraHelper=new Un,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})}migrateProjection(e,t){e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t}getCenter(){return new K(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,q({offset:e},t),r)}panTo(e,t,r){return this.easeTo(q({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(q({zoom:e},t),r)}zoomIn(e,t){return this.zoomTo(Ct(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(Ct(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new G("movestart",t)).fire(new G("move",t)).fire(new G("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(q({bearing:e},t),r)}resetNorth(e,t){return this.rotateTo(0,q({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(q({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=cr.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=q({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 s=q(a,i.padding);i.padding=s;let n=this.transform,o=new cr(e,t),l=this.cameraHelper.cameraForBoxAndBearing(i,s,o,r,n);return l&&this._zoomSnap&&(l.zoom=Ct(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=q(e,t),delete t.padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}jumpTo(e,t){this.stop(),"zoom"in e&&this._zoomSnap&&(e.zoom=Ct(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=!1,a=!1,s=!1,n=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLat(e.center?K.convert(e.center):r.center,r)),this.cameraHelper.handleJumpToCenterZoom(r,e);let o=r.zoom!==n;return"elevation"in e&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),"bearing"in e&&r.bearing!==+e.bearing&&(i=!0,r.setBearing(+e.bearing)),"pitch"in e&&r.pitch!==+e.pitch&&(a=!0,r.setPitch(+e.pitch)),"roll"in e&&r.roll!==+e.roll&&(s=!0,r.setRoll(+e.roll)),e.padding!=null&&!r.isPaddingEqual(e.padding)&&r.setPadding(e.padding),this.applyUpdatedTransform(r),this.fire(new G("movestart",t)).fire(new G("move",t)),o&&this.fire(new G("zoomstart",t)).fire(new G("zoom",t)).fire(new G("zoomend",t)),i&&this.fire(new G("rotatestart",t)).fire(new G("rotate",t)).fire(new G("rotateend",t)),a&&this.fire(new G("pitchstart",t)).fire(new G("pitch",t)).fire(new G("pitchend",t)),s&&this.fire(new G("rollstart",t)).fire(new G("roll",t)).fire(new G("rollend",t)),this.fire(new G("moveend",t))}calculateCameraOptionsFromTo(e,t,r,i=0){let a=de.fromLngLat(e,t),s=de.fromLngLat(r,i),n=s.x-a.x,o=s.y-a.y,l=s.z-a.z,u=Math.hypot(n,o,l);if(u===0)throw Error("Can't calculate camera options with same From and To");let h=Math.hypot(n,o),c=ft(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=Math.atan2(n,-o)*180/Math.PI,d=Math.acos(h/u)*180/Math.PI;return d=l<0?90-d:90+d,{center:s.toLngLat(),elevation:i,zoom:c,pitch:d,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a){let s=this.transform.calculateCenterFromCameraLngLatAlt(e,t,r,i);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:r,pitch:i,roll:a}}easeTo(e,t){this._stop(!1,e.easeId),e=q({offset:[0,0],duration:500,easing:wl},e),"zoom"in e&&this._zoomSnap&&(e.zoom=Ct(e.zoom,this._zoomSnap)),(e.animate===!1||!e.essential&&At.prefersReducedMotion)&&(e.duration=0);let r=this.getTransformForUpdate(),i=this.getBearing(),a=r.pitch,s=r.roll,n="bearing"in e?this._normalizeBearing(e.bearing,i):i,o="pitch"in e?+e.pitch:a,l="roll"in e?this._normalizeBearing(e.roll,s):s,u="padding"in e?e.padding:r.padding,h=M.convert(e.offset),c,p;e.around&&(c=K.convert(e.around),p=r.locationToScreenPoint(c));let d={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(r,{bearing:n,pitch:o,roll:l,padding:u,around:c,aroundPoint:p,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||(this._rotating=i!==n),this._pitching||(this._pitching=o!==a),this._rolling||(this._rolling=l!==s),this._padding=!r.isPaddingEqual(u),this._zooming||(this._zooming=f.isZooming),this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,d),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(m=>{f.easeFunc(m),this.terrain&&!e.freezeElevation&&this._updateElevation(m),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},m=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,m)},e),this}_prepareEase(e,t,r={}){this._moving=!0,!t&&!r.moving&&this.fire(new G("movestart",e)),this._zooming&&!r.zooming&&this.fire(new G("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new G("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new G("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new G("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=!0}_updateElevation(e){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&t!==this._elevationTarget){let r=this._elevationTarget-this._elevationStart,i=(t-(r*e+this._elevationStart))/(1-e);this._elevationStart+=e*(r-i),this._elevationTarget=t}this.transform.setElevation(Ne.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){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=this.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:s,zoom:n,roll:o,pitch:l,bearing:u,elevation:h}=i(a);s&&a.setCenter(s),h!==void 0&&a.setElevation(h),n!==void 0&&a.setZoom(n),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)}_fireMoveEvents(e){this.fire(new G("move",e)),this._zooming&&this.fire(new G("zoom",e)),this._rotating&&this.fire(new G("rotate",e)),this._pitching&&this.fire(new G("pitch",e)),this._rolling&&this.fire(new G("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,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new G("zoomend",e)),i&&this.fire(new G("rotateend",e)),a&&this.fire(new G("pitchend",e)),s&&this.fire(new G("rollend",e)),this.fire(new G("moveend",e))}flyTo(e,t){if(!e.essential&&At.prefersReducedMotion){let I=cs(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(I,t)}this.stop(),e=q({offset:[0,0],speed:1.2,curve:1.42,easing:wl},e),"zoom"in e&&this._zoomSnap&&(e.zoom=Ct(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=r.bearing,a=r.pitch,s=r.roll,n=r.padding,o="bearing"in e?this._normalizeBearing(e.bearing,i):i,l="pitch"in e?+e.pitch:a,u="roll"in e?this._normalizeBearing(e.roll,s):s,h="padding"in e?e.padding:r.padding,c=M.convert(e.offset),p=r.centerPoint.add(c),d=r.screenPointToLocation(p),f=this.cameraHelper.handleFlyTo(r,{bearing:o,pitch:l,roll:u,padding:h,locationAtOffset:d,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,x=g/f.scaleOfMinZoom;m=Math.min(m,Math.sqrt(x/y*2));let v=m*m;function w(I){let D=(_*_-g*g+(I?-1:1)*v*v*y*y)/(2*(I?_:g)*v*y);return Math.log(Math.sqrt(D*D+1)-D)}function b(I){return(Math.exp(I)-Math.exp(-I))/2}function A(I){return(Math.exp(I)+Math.exp(-I))/2}function C(I){return b(I)/A(I)}let E=w(!1),F=function(I){return A(E)/A(E+m*I)},k=function(I){return g*((A(E)*C(E+m*I)-b(E))/v)/y},B=(w(!0)-E)/m;if(Math.abs(y)<2e-6||!isFinite(B)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t);let I=_<g?-1:1;B=Math.abs(Math.log(_/g))/m,k=()=>0,F=D=>Math.exp(I*m*D)}if("duration"in e)e.duration=+e.duration;else{let I="screenSpeed"in e?+e.screenSpeed/m:+e.speed;e.duration=1e3*B/I}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==o,this._pitching=l!==a,this._rolling=u!==s,this._padding=!r.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(I=>{let D=I*B,T=1/F(D),S=k(D);this._rotating&&r.setBearing(Ne.number(i,o,I)),this._pitching&&r.setPitch(Ne.number(a,l,I)),this._rolling&&r.setRoll(Ne.number(s,u,I)),this._padding&&(r.interpolatePadding(n,h,I),p=r.centerPoint.add(c)),f.easeFunc(I,T,S,p),this.terrain&&!e.freezeElevation&&this._updateElevation(I),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),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=ge(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=Vt(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 _g={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var yS=class{constructor(e=_g){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=Oe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=Oe.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Oe.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 s=a.getSource();s.attribution&&!e.includes(s.attribution)&&e.push(s.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,a)=>i.length-a.length),e=e.filter((i,a)=>{for(let s=a+1;s<e.length;s++)if(e[s].includes(i))return!1;return!0});let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=Oe.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},vS=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=Oe.create("div","maplibregl-ctrl");let t=Oe.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}},xS=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=[];for(let r of t)if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const ki={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var bS=class{constructor(e,t){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){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t));let r=new Set;for(let i of this._renderableLayerIds){let a=e._layers[i],s=a.source;s&&ki[a.type]&&r.add(s)}this._coordsAscending={},this._rttFingerprints={};for(let i of r){let a=e.tileManagers[i];if(!a)continue;this._coordsAscending[i]={};let s=this._coordsAscending[i],n=a.getSource(),o=n instanceof Es?n.terrainTileRanges:null;for(let h of a.getVisibleCoordinates()){let c=this.terrain.tileManager.getTerrainCoords(h,o);for(let p in c)s[p]||(s[p]=[]),s[p].push(c[p])}this._rttFingerprints[i]={};let l=this._rttFingerprints[i],u=a.getState().revision;for(let h in s)l[h]=`${s[h].map(c=>c.key).sort().join()}#${u}`}for(let i of this._renderableTiles)for(let a in this._rttFingerprints){let s=this._rttFingerprints[a][i.tileID.key];s&&s!==i.rttFingerprint[a]&&i.releaseRTT(this.painter)}}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let r={...t,isRenderingToTexture:!0},i=e.type,a=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ki[i]&&((!this._prevType||!ki[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!s))return!0;if(ki[this._prevType]||ki[i]&&s){this._prevType=i;let n=this._stacks.length-1,o=this._stacks[n]||[];for(let l of this._renderableTiles){if(this._rttTiles.push(l),l.getRTT(n))continue;let u=l.acquireRTT(a,n,this.rttSize);a.bindRTT(u),a.context.clear({color:J.transparent,stencil:0}),a.currentStencilSource=void 0;for(let h of o){let c=a.style._layers[h],p=c.source?this._coordsAscending[c.source][l.tileID.key]:[l.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(c,p,!0),a.renderLayer(a,a.style.tileManagers[c.source],c,p,r),c.source&&(l.rttFingerprint[c.source]=this._rttFingerprints[c.source][l.tileID.key])}}return SE(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],ki[i]}return!1}};const wS={"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"},TS=a4,Wd={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:_g,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:_i.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 DS=class extends vt{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,s,n;super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new xS,this._controls=[],this._mapId=t0(),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 el("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 el("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 H(l));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new el("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={...Wd,...e,canvasContextAttributes:{...Wd.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 _S({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={...wS,...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&&(At.prefersReducedMotion=t.reduceMotion),this._requestManager=new u4(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=lr.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.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new gS(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 kE(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,q({},t.fitBoundsOptions,{duration:0}))));let i=typeof t.style=="string"||((n=(s=t.style)==null?void 0:s.projection)==null?void 0:n.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 yS(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new vS,t.logoPosition),this.on("style.load",()=>{if(i||this._resizeTransform(),this._camera.transform.unmodified){let o=cs(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 Zt("styledata",o):new we("sourcedata",o))}),this.on("dataloading",o=>{this.fire(o.dataType==="style"?new Zt("styledataloading",o):new we("sourcedataloading",o))}),this.on("dataabort",o=>{this.fire(new we("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 H(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 H(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 da(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new K(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}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(K.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.calculateCameraOptionsFromTo(e,t,r,i)}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 G("movestart",e)).fire(new G("move",e))),this.fire(new rt("resize",e)),r&&this.fire(new G("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 s=this._getClampedPixelRatio(t,r);this._resizeCanvas(t,r,s),this.painter.resize(t,r,s)}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(),s=e*a,n=t*a,o=s>r?r/s:1,l=n>i?i/n:1;return Math.min(o,l)*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.transform.setMaxBounds(cr.convert(e)),this._update()}setMinZoom(e){if(e??(e=-2),e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMinZoom(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.zoom&&this.fire(new G("zoomstart")).fire(new G("zoom")).fire(new G("zoomend")).fire(new G("movestart")).fire(new G("move")).fire(new G("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,r=this._camera.getTransformForUpdate();return r.setMaxZoom(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.zoom&&this.fire(new G("zoomstart")).fire(new G("zoom")).fire(new G("zoomend")).fire(new G("movestart")).fire(new G("move")).fire(new G("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,r=this._camera.getTransformForUpdate();return r.setMinPitch(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.pitch&&this.fire(new G("pitchstart")).fire(new G("pitch")).fire(new G("pitchend")).fire(new G("movestart")).fire(new G("move")).fire(new G("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,r=this._camera.getTransformForUpdate();return r.setMaxPitch(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.pitch&&this.fire(new G("pitchstart")).fire(new G("pitch")).fire(new G("pitchend")).fire(new G("movestart")).fire(new G("move")).fire(new G("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.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(K.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}_createDelegatedListener(e,t,r){if(e==="mouseenter"||e==="mouseover"){let i=!1;return{layers:t,listener:r,delegates:{mousemove:a=>{let s=t.filter(o=>this.getLayer(o)),n=s.length===0?[]:this.queryRenderedFeatures(a.point,{layers:s});n.length?i||(i=!0,r.call(this,new $t(e,this,a.originalEvent,{features:n}))):i=!1},mouseout:()=>{i=!1}}}}if(e==="mouseleave"||e==="mouseout"){let i=!1;return{layers:t,listener:r,delegates:{mousemove:a=>{let s=t.filter(n=>this.getLayer(n));(s.length===0?[]:this.queryRenderedFeatures(a.point,{layers:s})).length?i=!0:i&&(i=!1,r.call(this,new $t(e,this,a.originalEvent)))},mouseout:a=>{i&&(i=!1,r.call(this,new $t(e,this,a.originalEvent)))}}}}{let i=a=>{let s=t.filter(o=>this.getLayer(o)),n=s.length===0?[]:this.queryRenderedFeatures(a.point,{layers:s});n.length&&(a.features=n,r.call(this,a),delete a.features)};return{layers:t,listener:r,delegates:{[e]:i}}}}_saveDelegatedListener(e,t){var r;this._delegatedListeners||(this._delegatedListeners={}),(r=this._delegatedListeners)[e]||(r[e]=[]),this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,r){var a;if(!((a=this._delegatedListeners)!=null&&a[e]))return;let i=this._delegatedListeners[e];for(let s=0;s<i.length;s++){let n=i[s];if(n.listener===r&&n.layers.length===t.length&&n.layers.every(o=>t.includes(o))){for(let o in n.delegates)this.off(o,n.delegates[o]);i.splice(s,1);return}}}on(e,t,r){if(r===void 0)return super.on(e,t);let i=typeof t=="string"?[t]:t,a=this._createDelegatedListener(e,i,r);this._saveDelegatedListener(e,a);for(let s in a.delegates)this.on(s,a.delegates[s]);return{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=this._createDelegatedListener(e,i,r);for(let s in a.delegates){let n=a.delegates[s];a.delegates[s]=(...o)=>{this._removeDelegatedListener(e,i,r),n(...o)}}this._saveDelegatedListener(e,a);for(let s in a.delegates)this.once(s,a.delegates[s]);return 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 s=M.convert(a[0]),n=M.convert(a[1]);r=[s,new M(n.x,s.y),n,new M(s.x,n.y),s]}return this.style.queryRenderedFeatures(r,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=q({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,a,s;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 Id(this,t||{});else return this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),(s=(a=this.style)==null?void 0:a.projection)==null||s.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 Id(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 s=await this._requestManager.transformRequest(i,"Style");if(a.signal.aborted){this._diffStyleRequest=null;return}let n=await Hn(s,a);this._diffStyleRequest=null,this._updateDiff(n.data,t)}catch(s){this._diffStyleRequest=null,Nr(s)||this.fire(new H(ht(s)))}}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){fe(`Unable to perform style diff: ${ht(r).message}. Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){fe("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 H(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&xs(this,xt.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._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);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&&fe("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&&fe("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 S6(this.painter,r,e,this._terrainSkirtLength),this.painter.renderToTexture=new bS(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=i=>this._handleTerrainDataEvent(i,e.source),this.style.on("data",this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new c4({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._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),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=Bu(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=Bu(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 _o(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:s,content:n,textFitWidth:o,textFitHeight:l}=t;if(e instanceof HTMLImageElement||ui(e)){let{width:u,height:h,data:c}=At.getImageData(e);return{data:new be({width:u,height:h},c),pixelRatio:r,stretchX:a,stretchY:s,content:n,textFitWidth:o,textFitHeight:l,sdf:i,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new H(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,p=e,d=Bn(p.data);return{data:d?new be({width:u,height:h}):new be({width:u,height:h},new Uint8Array(c)),pixelRatio:r,stretchX:a,stretchY:s,content:n,textFitWidth:o,textFitHeight:l,sdf:i,version:0,isWebGLImage:d,userImage:p}}}updateImage(e,t){let r=this.style.getImage(e);if(!r)return this.fire(new H(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:s}=t instanceof HTMLImageElement||ui(t)?At.getImageData(t):t;if(i===void 0||a===void 0)return this.fire(new H(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 H(Error("The width and height of the updated image must be that same as the previous version of the image")));if(r.isWebGLImage=Bn(s),r.isWebGLImage)r.userImage=t;else{let n=!(t instanceof HTMLImageElement||ui(t));r.data.replace(s,n)}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 H(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){return lr.getImage(await this._requestManager.transformRequest(e,"Image"),new AbortController)}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=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupResizeObserver(){let e=!1,t=gg(i=>{this._trackResize&&!this._removed&&(this.resize(i),this.redraw())},50),r=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new r(i=>{if(!e){e=!0;return}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._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=Oe.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=Oe.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);let a=this._controlContainer=Oe.create("div","maplibregl-control-container",e),s=this._controlPositions={};for(let n of["top-left","top-right","bottom-left","bottom-right"])s[n]=Oe.create("div",`maplibregl-ctrl-${n} `,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){this._canvas.width=Math.floor(r*e),this._canvas.height=Math.floor(r*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}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 zE(e,t);this.painter=new FE(r,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new p4({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 n,o,l,u;let t=this._idleTriggered?this._fadeDuration:0,r=((n=this.style.projection)==null?void 0:n.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 h=this._camera.transform.zoom,c=ge();this.style.zoomHistory.update(h,c);let p=new Ae(h,{now:c,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),d=p.crossFadingFactor();(d!==1||d!==this._crossFadingFactor)&&(i=!0,this._crossFadingFactor=d),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 rt("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new rt("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new rt("idle")),this._loaded&&!this._fullyLoaded&&!s&&(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),lr.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 rt("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,At.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(t){if(!Nr(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 TS}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};function AS(e){_i.WORKER_URL=e}const ES=""+new URL("maplibre-gl-worker-CJfwIrte.js",import.meta.url).href,SS='.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{position:absolute;left:0;top:0}.maplibregl-map:fullscreen{width:100%;height:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{position:absolute;pointer-events:none;z-index:2}.maplibregl-ctrl-top-left{top:0;left:0}.maplibregl-ctrl-top-right{top:0;right:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{right:0;bottom:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{margin:10px 0 0 10px;float:left}.maplibregl-ctrl-top-right .maplibregl-ctrl{margin:10px 10px 0 0;float:right}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{margin:0 0 10px 10px;float:left}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{margin:0 10px 10px 0;float:right}.maplibregl-ctrl-group{border-radius:4px;background:#fff}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{width:29px;height:29px;display:block;padding:0;outline:none;border:0;box-sizing:border-box;background-color:transparent;cursor:pointer}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{display:block;width:100%;height:100%;background-repeat:no-repeat;background-position:50%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M10%2013c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h9c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M14.5%208.5c-.75%200-1.5.75-1.5%201.5v3h-3c-.75%200-1.5.75-1.5%201.5S9.25%2016%2010%2016h3v3c0%20.75.75%201.5%201.5%201.5S16%2019.75%2016%2019v-3h3c.75%200%201.5-.75%201.5-1.5S19.75%2013%2019%2013h-3v-3c0-.75-.75-1.5-1.5-1.5%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M24%2016v5.5c0%201.75-.75%202.5-2.5%202.5H16v-1l3-1.5-4-5.5%201-1%205.5%204%201.5-3zM6%2016l1.5%203%205.5-4%201%201-4%205.5%203%201.5v1H7.5C5.75%2024%205%2023.25%205%2021.5V16zm7-11v1l-3%201.5%204%205.5-1%201-5.5-4L6%2013H5V7.5C5%205.75%205.75%205%207.5%205zm11%202.5c0-1.75-.75-2.5-2.5-2.5H16v1l3%201.5-4%205.5%201%201%205.5-4%201.5%203h1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22M18.5%2016c-1.75%200-2.5.75-2.5%202.5V24h1l1.5-3%205.5%204%201-1-4-5.5%203-1.5v-1zM13%2018.5c0-1.75-.75-2.5-2.5-2.5H5v1l3%201.5L4%2024l1%201%205.5-4%201.5%203h1zm3-8c0%201.75.75%202.5%202.5%202.5H24v-1l-3-1.5L25%205l-1-1-5.5%204L17%205h-1zM10.5%2013c1.75%200%202.5-.75%202.5-2.5V5h-1l-1.5%203L5%204%204%205l4%205.5L5%2012v1z%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2029%2029%22%3E%3Cpath%20d%3D%22m10.5%2014%204-8%204%208z%22%2F%3E%3Cpath%20fill%3D%22%23ccc%22%20d%3D%22m10.5%2016%204%208%204-8z%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22none%22%20stroke%3D%22%23333%22%20viewBox%3D%220%200%2022%2022%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228.5%22%2F%3E%3Cpath%20d%3D%22M17.5%2011c0%204.819-3.02%208.5-6.5%208.5S4.5%2015.819%204.5%2011%207.52%202.5%2011%202.5s6.5%203.681%206.5%208.5Z%22%2F%3E%3Cpath%20d%3D%22M13.5%2011c0%202.447-.331%204.64-.853%206.206-.262.785-.562%201.384-.872%201.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831%2015.64%208.5%2013.446%208.5%2011s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872%201.777.522%201.565.853%203.76.853%206.206Z%22%2F%3E%3Cpath%20d%3D%22M11%207.5c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138q.07-.058.224-.138c.299-.151.763-.302%201.379-.434C7.378%205.666%209.091%205.5%2011%205.5s3.622.166%204.845.428c.616.132%201.08.283%201.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm0%209c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138%201.3%201.3%200%200%201%20.224-.138c.299-.151.763-.302%201.379-.434C7.378%2014.666%209.091%2014.5%2011%2014.5s3.622.166%204.845.428c.616.132%201.08.283%201.379.434.105.053.177.1.224.138a1.3%201.3%200%200%201-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm0-4c-2.46%200-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5%201.5%200%200%201-.39-.272.3.3%200%200%201-.047-.064.3.3%200%200%201%20.048-.064c.066-.073.189-.167.389-.272.399-.21%201.009-.413%201.805-.59C6.328%209.722%208.54%209.5%2011%209.5s4.672.222%206.256.574c.795.177%201.405.38%201.804.59.2.105.323.2.39.272a.3.3%200%200%201%20.047.064.3.3%200%200%201-.048.064%201.4%201.4%200%200%201-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0%20.018v.002zm17.002.002v-.002zm0-.018v-.002z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22none%22%20stroke%3D%22%2333b5e5%22%20viewBox%3D%220%200%2022%2022%22%3E%3Ccircle%20cx%3D%2211%22%20cy%3D%2211%22%20r%3D%228.5%22%2F%3E%3Cpath%20d%3D%22M17.5%2011c0%204.819-3.02%208.5-6.5%208.5S4.5%2015.819%204.5%2011%207.52%202.5%2011%202.5s6.5%203.681%206.5%208.5Z%22%2F%3E%3Cpath%20d%3D%22M13.5%2011c0%202.447-.331%204.64-.853%206.206-.262.785-.562%201.384-.872%201.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831%2015.64%208.5%2013.446%208.5%2011s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872%201.777.522%201.565.853%203.76.853%206.206Z%22%2F%3E%3Cpath%20d%3D%22M11%207.5c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138q.07-.058.224-.138c.299-.151.763-.302%201.379-.434C7.378%205.666%209.091%205.5%2011%205.5s3.622.166%204.845.428c.616.132%201.08.283%201.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm0%209c-1.909%200-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3%201.3%200%200%201-.224-.138%201.3%201.3%200%200%201%20.224-.138c.299-.151.763-.302%201.379-.434C7.378%2014.666%209.091%2014.5%2011%2014.5s3.622.166%204.845.428c.616.132%201.08.283%201.379.434.105.053.177.1.224.138a1.3%201.3%200%200%201-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm0-4c-2.46%200-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5%201.5%200%200%201-.39-.272.3.3%200%200%201-.047-.064.3.3%200%200%201%20.048-.064c.066-.073.189-.167.389-.272.399-.21%201.009-.413%201.805-.59C6.328%209.722%208.54%209.5%2011%209.5s4.672.222%206.256.574c.795.177%201.405.38%201.804.59.2.105.323.2.39.272a.3.3%200%200%201%20.047.064.3.3%200%200%201-.048.064%201.4%201.4%200%200%201-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0%20.018v.002zm17.002.002v-.002zm0-.018v-.002z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2022%2022%22%3E%3Cpath%20d%3D%22m1.754%2013.406%204.453-4.851%203.09%203.09%203.281%203.277.969-.969-3.309-3.312%203.844-4.121%206.148%206.886h1.082v-.855l-7.207-8.07-4.84%205.187L6.169%206.57l-5.48%205.965v.871ZM.688%2016.844h20.625v1.375H.688Zm0%200%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2222%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2022%2022%22%3E%3Cpath%20d%3D%22m1.754%2013.406%204.453-4.851%203.09%203.09%203.281%203.277.969-.969-3.309-3.312%203.844-4.121%206.148%206.886h1.082v-.855l-7.207-8.07-4.84%205.187L6.169%206.57l-5.48%205.965v.871ZM.688%2016.844h20.625v1.375H.688Zm0%200%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23333%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23aaa%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e58978%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e54e33%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23999%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e58978%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%2333b5e5%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23e54e33%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3C%2Fsvg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2229%22%20height%3D%2229%22%20fill%3D%22%23666%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M10%204C9%204%209%205%209%205v.1A5%205%200%200%200%205.1%209H5s-1%200-1%201%201%201%201%201h.1A5%205%200%200%200%209%2014.9v.1s0%201%201%201%201-1%201-1v-.1a5%205%200%200%200%203.9-3.9h.1s1%200%201-1-1-1-1-1h-.1A5%205%200%200%200%2011%205.1V5s0-1-1-1m0%202.5a3.5%203.5%200%201%201%200%207%203.5%203.5%200%201%201%200-7%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20r%3D%222%22%2F%3E%3Cpath%20fill%3D%22red%22%20d%3D%22m14%205%201%201-9%209-1-1z%22%2F%3E%3C%2Fsvg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{width:88px;height:23px;margin:0 0 -4px -4px;display:block;background-repeat:no-repeat;cursor:pointer;overflow:hidden;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2288%22%20height%3D%2223%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22%23000%22%20fill-opacity%3D%22.4%22%20fill-rule%3D%22evenodd%22%20d%3D%22M17.408%2016.796h-1.827l2.501-12.095h.198l3.324%206.533.988%202.19.988-2.19%203.258-6.533h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.929%205.644h-.098l-2.914-5.644-.757-1.71-.345%201.71zm1.958-3.42-.726%203.663a1.255%201.255%200%200%201-1.232%201.011h-1.827a1.255%201.255%200%200%201-1.229-1.509l2.501-12.095a1.255%201.255%200%200%201%201.23-1.001h.197a1.25%201.25%200%200%201%201.12.685l3.19%206.273%203.125-6.263a1.25%201.25%200%200%201%201.123-.695h.181a1.255%201.255%200%200%201%201.227.991l1.443%206.71a5%205%200%200%201%20.314-.787l.009-.016a4.6%204.6%200%200%201%201.777-1.887c.782-.46%201.668-.667%202.611-.667a4.6%204.6%200%200%201%201.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255%201.255%200%200%201%201.212.925%201.255%201.255%200%200%201%201.212-.925h1.711c.284%200%20.545.094.755.252.613-.3%201.312-.45%202.075-.45%201.356%200%202.557.445%203.482%201.4q.47.48.763%201.064V4.701a1.255%201.255%200%200%201%201.255-1.255h1.86A1.255%201.255%200%200%201%2054.44%204.7v9.194h2.217c.19%200%20.37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42%202.42%200%200%201-.682-1.71c0-.665.267-1.253.735-1.7a2.45%202.45%200%200%201%201.722-.674%202.43%202.43%200%200%201%201.705.675q.318.302.504.683V4.7a1.255%201.255%200%200%201%201.255-1.255h1.744A1.255%201.255%200%200%201%2065.812%204.7v3.335a4.8%204.8%200%200%201%201.526-.246c.938%200%201.817.214%202.59.69a4.47%204.47%200%200%201%201.67%201.743v-.98a1.255%201.255%200%200%201%201.256-1.256h1.777c.233%200%20.451.064.639.174a3.4%203.4%200%200%201%201.567-.372c.346%200%20.861.02%201.285.232a1.25%201.25%200%200%201%20.689%201.004%204.7%204.7%200%200%201%20.853-.588c.795-.44%201.675-.647%202.61-.647%201.385%200%202.65.39%203.525%201.396.836.938%201.168%202.173%201.168%203.528q-.001.515-.056%201.051a1.255%201.255%200%200%201-.947%201.09l.408.952a1.255%201.255%200%200%201-.477%201.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06%200-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8%205.8%200%200%201-.548-2.512q0-.429.053-.843a1.3%201.3%200%200%201-.333-.086l-.166-.004c-.223%200-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255%201.255%200%200%201-1.256%201.256h-1.777a1.255%201.255%200%200%201-1.256-1.256V15.69l-.032.057a4.8%204.8%200%200%201-1.86%201.833%205.04%205.04%200%200%201-2.484.634%204.5%204.5%200%200%201-1.935-.424%201.25%201.25%200%200%201-.764.258h-1.71a1.255%201.255%200%200%201-1.256-1.255V7.687a2.4%202.4%200%200%201-.428.625c.253.23.412.561.412.93v7.553a1.255%201.255%200%200%201-1.256%201.255h-1.843a1.25%201.25%200%200%201-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255%201.255%200%200%201-1.256-1.255v-1.251l-.061.117a4.7%204.7%200%200%201-1.782%201.884%204.77%204.77%200%200%201-2.485.67%205.6%205.6%200%200%201-1.485-.188l.009%202.764a1.255%201.255%200%200%201-1.255%201.259h-1.729a1.255%201.255%200%200%201-1.255-1.255v-3.537a1.255%201.255%200%200%201-1.167.793h-1.679a1.25%201.25%200%200%201-.77-.263%204.5%204.5%200%200%201-1.945.429c-.885%200-1.724-.21-2.495-.632l-.017-.01a5%205%200%200%201-1.081-.836%201.255%201.255%200%200%201-1.254%201.312h-1.81a1.255%201.255%200%200%201-1.228-.99l-.782-3.625-2.044%203.939a1.25%201.25%200%200%201-1.115.676h-.098a1.25%201.25%200%200%201-1.116-.68l-2.061-3.994zM35.92%2016.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033%201.332h1.678V9.242h-1.694l-.033%201.267q-.133-.329-.526-.658l-.032-.028a3.2%203.2%200%200%200-.668-.428l-.27-.12a3.3%203.3%200%200%200-1.235-.23q-1.136-.001-1.974.493a3.36%203.36%200%200%200-1.3%201.382q-.445.89-.444%202.074%200%201.2.51%202.107a3.8%203.8%200%200%200%201.382%201.381%203.9%203.9%200%200%200%201.893.477q.795%200%201.455-.33zm-2.789-5.38q-.576.675-.575%201.762%200%201.102.559%201.794.576.675%201.645.675a2.25%202.25%200%200%200%20.934-.19%202.2%202.2%200%200%200%20.468-.29l.178-.161a2.2%202.2%200%200%200%20.397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2%202.2%200%200%200-.633-.709l-.13-.086-.047-.028a2.1%202.1%200%200%200-1.073-.285q-1.052%200-1.629.692zm2.316%202.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96%200%200%200-.353-.389.85.85%200%200%200-.464-.127c-.4%200-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945%200%20.506.122.801.27.99.097.11.266.224.68.224.303%200%20.504-.09.687-.269zm7.545%201.705a2.6%202.6%200%200%200%20.331.423q.319.33.755.548l.173.074q.65.255%201.49.255%201.02%200%201.844-.493a3.45%203.45%200%200%200%201.316-1.4q.493-.904.493-2.089%200-1.909-.988-2.913-.988-1.02-2.584-1.02-.898%200-1.575.347a3%203%200%200%200-.415.262l-.199.166a3.4%203.4%200%200%200-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296%201.119.297%201.07%200%201.645-.675.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.435%200-.835.16a2%202%200%200%200-.284.136%202%202%200%200%200-.363.254%202.2%202.2%200%200%200-.46.569l-.082.162a2.6%202.6%200%200%200-.213%201.072v.115q0%20.707.296%201.267l.135.211zm.964-.818a1.1%201.1%200%200%200%20.367.385.94.94%200%200%200%20.476.118c.423%200%20.59-.117.687-.23.159-.194.28-.478.28-.95%200-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1%201%200%200%200-.503.135l-.012.007a.86.86%200%200%200-.335.343c-.073.133-.132.324-.132.614v.115a1.4%201.4%200%200%200%20.14.66zm15.7-6.222q.347-.346.346-.856a1.05%201.05%200%200%200-.345-.79%201.18%201.18%200%200%200-.84-.329q-.51%200-.855.33a1.05%201.05%200%200%200-.346.79q0%20.51.346.855.345.346.856.346.51%200%20.839-.346zm4.337%209.314.033-1.332q.191.403.59.747l.098.081a4%204%200%200%200%20.316.224l.223.122a3.2%203.2%200%200%200%201.44.322%203.8%203.8%200%200%200%201.875-.477%203.5%203.5%200%200%200%201.382-1.366q.527-.89.526-2.09%200-1.184-.444-2.073a3.24%203.24%200%200%200-1.283-1.399q-.823-.51-1.942-.51a3.5%203.5%200%200%200-1.527.344l-.086.043-.165.09a3%203%200%200%200-.33.214q-.432.315-.656.707a2%202%200%200%200-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5%202.5%200%200%200%20.566.7q.117.098.245.18l.144.08a2.1%202.1%200%200%200%20.975.232q1.07%200%201.645-.675.576-.69.576-1.778%200-1.102-.576-1.777-.56-.691-1.645-.692a2.2%202.2%200%200%200-1.015.235q-.22.113-.415.282l-.15.142a2.1%202.1%200%200%200-.42.594q-.223.479-.223%201.1v.115q0%20.705.293%201.26zm2.616-.293c.157-.191.28-.479.28-.967%200-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87%200%200%200-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0%20.285.057.499.144.669a1.1%201.1%200%200%200%20.367.405c.137.082.28.123.455.123.423%200%20.59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493%200%20.642.099l.247-1.794q-.196-.099-.717-.099a2.3%202.3%200%200%200-.545.063%202%202%200%200%200-.411.148%202.2%202.2%200%200%200-.4.249%202.5%202.5%200%200%200-.485.499%202.7%202.7%200%200%200-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5%201.5%200%200%201%20.466-.636%202.5%202.5%200%200%201%20.399-.253%202%202%200%200%201%20.224-.099zm9.784%202.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46%203.46%200%200%200-1.4%201.382q-.493.906-.493%202.106%200%201.07.428%201.975.428.89%201.332%201.432.906.526%202.255.526.973%200%201.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954%200-1.497-.444a1.6%201.6%200%200%201-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1%201%200%200%200-.156-.176q-.46-.428-1.316-.428-.986%200-1.494.604-.379.45-.494%201.234zm-27.053%202.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z%22%2F%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22m19.63%2011.151-.757-1.71-.345%201.71-1.12%205.644h-1.827L18.083%204.7h.197l3.325%206.533.988%202.19.988-2.19L26.839%204.7h.181l2.6%2012.095h-1.81l-1.218-5.644-.362-1.71-.658%201.71-2.93%205.644h-.098l-2.913-5.644zm14.836%205.81q-1.02%200-1.893-.478a3.8%203.8%200%200%201-1.381-1.382q-.51-.906-.51-2.106%200-1.185.444-2.074a3.36%203.36%200%200%201%201.3-1.382q.839-.494%201.974-.494a3.3%203.3%200%200%201%201.234.231%203.3%203.3%200%200%201%20.97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02%201.053a3.17%203.17%200%200%201-1.662.444zm.296-1.482q.938%200%201.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2%202.2%200%200%200-.807-.872%202.1%202.1%200%200%200-1.119-.313q-1.053%200-1.629.692-.575.675-.575%201.76%200%201.103.559%201.795.577.675%201.645.675zm6.521-6.237h1.711v1.4q.906-1.597%202.83-1.597%201.596%200%202.584%201.02.988%201.005.988%202.914%200%201.185-.493%202.09a3.46%203.46%200%200%201-1.316%201.399%203.5%203.5%200%200%201-1.844.493q-.954%200-1.662-.329a2.67%202.67%200%200%201-1.086-.97l.017%205.134h-1.728zm4.048%206.22q1.07%200%201.645-.674.577-.69.576-1.762%200-1.119-.576-1.777-.558-.675-1.645-.675-.592%200-1.12.296-.51.28-.822.823-.296.527-.296%201.234v.115q0%20.708.296%201.267.313.543.823.855.51.296%201.119.297z%22%2F%3E%3Cpath%20fill%3D%22%23e1e3e9%22%20d%3D%22M51.325%204.7h1.86v10.45h3.473v1.646h-5.333zm7.12%204.542h1.843v7.553h-1.843zm.905-1.415a1.16%201.16%200%200%201-.856-.346%201.17%201.17%200%200%201-.346-.856%201.05%201.05%200%200%201%20.346-.79q.346-.329.856-.329.494%200%20.839.33a1.05%201.05%200%200%201%20.345.79%201.16%201.16%200%200%201-.345.855q-.33.346-.84.346zm7.875%209.133a3.17%203.17%200%200%201-1.662-.444q-.723-.46-1.004-1.053l-.033%201.332h-1.71V4.701h1.743v4.657l-.082%201.283q.279-.658%201.086-1.119a3.5%203.5%200%200%201%201.778-.477q1.119%200%201.942.51a3.24%203.24%200%200%201%201.283%201.4q.445.888.444%202.072%200%201.201-.526%202.09a3.5%203.5%200%200%201-1.382%201.366%203.8%203.8%200%200%201-1.876.477zm-.296-1.481q1.069%200%201.645-.675.577-.69.577-1.778%200-1.102-.577-1.776-.56-.691-1.645-.692a2.12%202.12%200%200%200-1.58.659q-.642.641-.642%201.694v.115q0%20.71.296%201.267a2.4%202.4%200%200%200%20.807.872%202.1%202.1%200%200%200%201.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14%202.14%200%200%201%201.349-.46q.527%200%20.724.098l-.247%201.794q-.149-.099-.642-.099-.774%200-1.416.494-.626.493-.626%201.58v3.883h-1.777V9.242zm9.534%207.718q-1.35%200-2.255-.526-.904-.543-1.332-1.432a4.6%204.6%200%200%201-.428-1.975q0-1.2.493-2.106a3.46%203.46%200%200%201%201.4-1.382q.889-.495%202.007-.494%201.744%200%202.584.97.855.956.856%202.7%200%20.444-.05.92h-5.43q.18%201.005.708%201.45.542.443%201.497.443.79%200%201.3-.131a4%204%200%200%200%20.938-.362l.542%201.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728%200-1.991%201.86z%22%2F%3E%3Cpath%20d%3D%22M5.074%2015.948a.484.657%200%200%200-.486.659v1.84a.484.657%200%200%200%20.486.659h4.101a.484.657%200%200%200%20.486-.659v-1.84a.484.657%200%200%200-.486-.659zm3.56%201.16H5.617v.838h3.017z%22%20style%3D%22fill%3A%23fff%3Bfill-rule%3Aevenodd%3Bstroke-width%3A1.03600001%22%2F%3E%3Cg%20style%3D%22stroke-width%3A1.12603545%22%3E%3Cpath%20d%3D%22M-9.408-1.416c-3.833-.025-7.056%202.912-7.08%206.615-.02%203.08%201.653%204.832%203.107%206.268.903.892%201.721%201.74%202.32%202.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87%201.87%200%200%200-.362%201.121l-.011%201.877c-.003.402.104.787.347%201.125.244.338.688.653%201.23.656l4.142.028c.542.003.99-.306%201.238-.641a1.87%201.87%200%200%200%20.363-1.121l.012-1.875a1.87%201.87%200%200%200-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145%201.425-1.983%202.348-2.87%201.473-1.414%203.18-3.149%203.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006%201.1v.002c3.274.02%205.92%202.532%205.9%205.6-.017%202.706-1.39%204.026-2.863%205.44-1.034.994-2.118%202.033-2.814%203.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34%200%200%201-.226.084.34.34%200%200%201-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067%202.7-5.545%205.975-5.523m-.02%202.826c-1.62-.01-2.944%201.315-2.955%202.96-.01%201.646%201.295%202.988%202.916%202.999h.002c1.621.01%202.943-1.316%202.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005%201.1c1.017.006%201.829.83%201.822%201.89s-.83%201.874-1.848%201.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874%201.848-1.868m-2.155%2011.857%204.14.025c.271.002.49.305.487.676l-.013%201.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668%22%20style%3D%22color%3A%23000%3Bfont-style%3Anormal%3Bfont-variant%3Anormal%3Bfont-weight%3A400%3Bfont-stretch%3Anormal%3Bfont-size%3Amedium%3Bline-height%3Anormal%3Bfont-family%3Asans-serif%3Bfont-variant-ligatures%3Anormal%3Bfont-variant-position%3Anormal%3Bfont-variant-caps%3Anormal%3Bfont-variant-numeric%3Anormal%3Bfont-variant-alternates%3Anormal%3Bfont-feature-settings%3Anormal%3Btext-indent%3A0%3Btext-align%3Astart%3Btext-decoration%3Anone%3Btext-decoration-line%3Anone%3Btext-decoration-style%3Asolid%3Btext-decoration-color%3A%23000%3Bletter-spacing%3Anormal%3Bword-spacing%3Anormal%3Btext-transform%3Anone%3Bwriting-mode%3Alr-tb%3Bdirection%3Altr%3Btext-orientation%3Amixed%3Bdominant-baseline%3Aauto%3Bbaseline-shift%3Abaseline%3Btext-anchor%3Astart%3Bwhite-space%3Anormal%3Bshape-padding%3A0%3Bclip-rule%3Aevenodd%3Bdisplay%3Ainline%3Boverflow%3Avisible%3Bvisibility%3Avisible%3Bopacity%3A1%3Bisolation%3Aauto%3Bmix-blend-mode%3Anormal%3Bcolor-interpolation%3AsRGB%3Bcolor-interpolation-filters%3AlinearRGB%3Bsolid-color%3A%23000%3Bsolid-opacity%3A1%3Bvector-effect%3Anone%3Bfill%3A%23000%3Bfill-opacity%3A.4%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-linecap%3Abutt%3Bstroke-linejoin%3Amiter%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-dashoffset%3A0%3Bstroke-opacity%3A1%3Bcolor-rendering%3Aauto%3Bimage-rendering%3Aauto%3Bshape-rendering%3Aauto%3Btext-rendering%3Aauto%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-9.415-.316C-12.69-.338-15.37%202.14-15.39%205.207c-.017%202.716%201.326%204.041%202.78%205.477%201.013%201%202.081%202.055%202.78%203.67l.092.076a.34.34%200%200%200%20.225.086.34.34%200%200%200%20.227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6%201.78-2.64%202.814-3.634%201.473-1.414%202.847-2.733%202.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057%208.784c1.621.011%202.944-1.315%202.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945%201.315-2.955%202.96s1.295%202.989%202.916%203%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23e1e3e9%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3Cpath%20d%3D%22M-11.594%2015.465c-.27-.002-.492.297-.494.668l-.012%201.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z%22%20style%3D%22clip-rule%3Aevenodd%3Bfill%3A%23fff%3Bfill-opacity%3A1%3Bfill-rule%3Aevenodd%3Bstroke%3Anone%3Bstroke-width%3A2.47727823%3Bstroke-miterlimit%3A4%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A.4%22%20transform%3D%22translate(15.553%202.85)scale(.88807)%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{padding:0 5px;background-color:hsla(0,0%,100%,.5);margin:0}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{min-height:20px;padding:2px 24px 2px 0;margin:10px;position:relative;background-color:#fff;color:#000;border-radius:12px;box-sizing:content-box}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 8px 2px 28px;border-radius:12px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{display:none;cursor:pointer;position:absolute;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E");background-color:hsla(0,0%,100%,.5);width:24px;height:24px;box-sizing:border-box;border-radius:12px;outline:none;top:0;right:0;border:0}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;right:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;left:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20fill-rule%3D%22evenodd%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20d%3D%22M4%2010a6%206%200%201%200%2012%200%206%206%200%201%200-12%200m5-3a1%201%200%201%200%202%200%201%201%200%201%200-2%200m0%203a1%201%200%201%201%202%200v3a1%201%200%201%201-2%200%22%2F%3E%3C%2Fsvg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);font-size:10px;white-space:nowrap;border-color:#333;border-style:none solid solid;border-width:medium 2px 2px;padding:0 5px;color:#333;box-sizing:border-box}.maplibregl-popup{position:absolute;top:0;left:0;display:flex;will-change:transform;pointer-events:none}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{width:0;height:0;border:10px solid transparent;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-top:none;border-bottom-color:#fff}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-top:none;border-left:none;border-bottom-color:#fff}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-top:none;border-right:none;border-bottom-color:#fff}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-right:none;border-left-color:#fff}[dir=rtl] .maplibregl-popup-anchor-left{flex-direction:row-reverse}[dir=rtl] .maplibregl-popup-anchor-right{flex-direction:row}[dir=rtl] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-start}[dir=rtl] .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-start}.maplibregl-popup-close-button{position:absolute;right:0;top:0;border:0;border-radius:0 3px 0 0;cursor:pointer;background-color:transparent}.maplibregl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.maplibregl-popup-content{position:relative;background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{position:absolute;top:0;left:0;will-change:transform;transition:opacity .2s}.maplibregl-marker-draggable{cursor:grab}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;width:15px;height:15px;border-radius:50%}.maplibregl-user-location-dot:before{content:"";position:absolute;animation:maplibregl-user-location-dot-pulse 2s infinite}.maplibregl-user-location-dot:after{border-radius:50%;border:2px solid #fff;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px;box-sizing:border-box;box-shadow:0 0 3px rgba(0,0,0,.35)}@media (prefers-reduced-motion:reduce){.maplibregl-user-location-dot:before{animation:none}}@keyframes maplibregl-user-location-dot-pulse{0%{transform:scale(1);opacity:1}70%{transform:scale(3);opacity:0}to{transform:scale(1);opacity:0}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;width:1px;height:1px;border-radius:100%}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{position:absolute;top:0;left:0;width:0;height:0;background:#fff;border:2px dotted #202020;opacity:.5}.maplibregl-cooperative-gesture-screen{background:rgba(0,0,0,.4);position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:#fff;padding:1rem;font-size:1.4em;line-height:1.2;opacity:0;pointer-events:none;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}',CS="#DD4B40",Ia="lecodes-user",tn="lecodes-user-halo",PS="lecodes-user-dot",IS="lecodes-user-heading",gl="lecodes-user-heading",rn={type:"FeatureCollection",features:[]};AS(ES);const MS=e=>{if(e.head.querySelector("style[data-maplibre-css]"))return;const t=e.createElement("style");t.setAttribute("data-maplibre-css",""),t.textContent=SS,e.head.appendChild(t)},an=e=>{if(!Array.isArray(e)||e.length<2)return null;const t=Number(e[0]),r=Number(e[1]);return!Number.isFinite(t)||!Number.isFinite(r)||r<-90||r>90?null:[t,r]},Hd=(e,t,r)=>{if(typeof e=="number")return{top:e,left:e,bottom:e,right:e};const i=e&&typeof e=="object"?e:{},a=(s,n)=>{const o=i[s];if(typeof o=="number")return o;if(typeof o=="string"&&o.endsWith("%")){const l=Number(o.slice(0,-1));return Number.isFinite(l)?n*l/100:0}return 0};return{top:a("top",r),left:a("left",t),bottom:a("bottom",r),right:a("right",t)}},FS=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:CS}}:t})},zS=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},kS=(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]]},G8=(e,t,r,i)=>{MS(i);const a=t.rotate!==!1,s=t.tilt===!0,n=an(t.center),o=(()=>{if(typeof t.styleJson=="string")try{return JSON.parse(t.styleJson)}catch{return null}return typeof t.style=="string"?t.style:null})();o||r.emit("error",{message:"MapView: `style` must be a URL or a style JSON"});const l=new DS({container:e,style:o??{version:8,sources:{},layers:[]},center:n??[0,0],zoom:typeof t.zoom=="number"?t.zoom:n?12:0,bearing:typeof t.bearing=="number"?t.bearing:0,pitch:typeof t.pitch=="number"?t.pitch:0,minZoom:typeof t.minZoom=="number"?t.minZoom:void 0,maxZoom:typeof t.maxZoom=="number"?t.maxZoom:void 0,attributionControl:!1,dragRotate:a,pitchWithRotate:s,touchPitch:s});a||l.touchZoomRotate.disableRotation();let u=!1,h=new Map,c={},p=null;const d=()=>[e.clientWidth,e.clientHeight],f=()=>{const D=l.getCenter();return{center:[D.lng,D.lat],zoom:l.getZoom(),bearing:l.getBearing(),pitch:l.getPitch()}},m=D=>{var T;return(((T=l.getStyle())==null?void 0:T.layers)??[]).filter(S=>S.source===D).map(S=>S.id)};l.on("load",()=>{h=new Map,p=null,u=!0,E(),r.emit("ready")}),l.on("error",D=>{var T;u||r.emit("error",{message:((T=D==null?void 0:D.error)==null?void 0:T.message)??"MapView: failed to load the style"})}),l.on("moveend",()=>{u&&r.emit("moveEnd",f())}),l.on("resize",()=>E());let g=null;l.on("dblclick",()=>{g&&(clearTimeout(g),g=null)}),l.on("click",D=>{g&&clearTimeout(g);const T=D.point,S=[D.lngLat.lng,D.lngLat.lat];g=setTimeout(()=>{g=null,_(T,S)},300)});const _=(D,T)=>{if(!u)return;const S={lngLat:T,point:[D.x,D.y]};for(const j of h.keys()){const N=m(j);if(N.length===0)continue;let U;try{U=l.queryRenderedFeatures([D.x,D.y],{layers:N})}catch{continue}const X=U[0];if(!X)continue;const _e=X.properties??{};if(_e.cluster===!0||_e.cluster==="true"){const mt=l.getSource(j),ye=X.geometry.type==="Point"?X.geometry.coordinates:T;mt==null||mt.getClusterExpansionZoom(Number(_e.cluster_id)).then(Ke=>l.easeTo({center:ye,zoom:Ke}),()=>{});return}S.feature={source:j,id:_e.id??X.id??null,properties:_e},r.emit("tap",S);return}r.emit("tap",S)},y=()=>new Error("the style hasn't loaded yet"),x=(D,T)=>{if(!u)throw y();const S=l.getSource(D);if(!S||S.type!=="geojson")throw new Error(`unknown GeoJSON source "${D}" — call ensureLayer / map.markers(name) first, or declare it in the style`);const j=h.get(D);S.setData((j==null?void 0:j.kind)==="markers"?FS(T):T)},v=(D,T,S)=>{if(!u)throw y();if(!h.has(D)){if(l.getSource(D)){h.set(D,{kind:"styleOwned"});return}if(T!=="markers"&&T!=="line")throw new Error('bad arguments — expected ensureLayer kind must be "markers" or "line"');h.set(D,{kind:T,layerIds:b(D,T,S)})}},w=D=>{var S;const T=h.get(D);if(T){if(h.delete(D),T.kind==="styleOwned"){(S=l.getSource(D))==null||S.setData(rn);return}for(const j of T.layerIds)l.getLayer(j)&&l.removeLayer(j);l.getSource(D)&&l.removeSource(D)}},b=(D,T,S)=>{const j=T==="markers"&&S.cluster===!0;l.addSource(D,{type:"geojson",data:rn,...j?{cluster:!0,clusterRadius:typeof S.clusterRadius=="number"?S.clusterRadius:50,...typeof S.clusterMaxZoom=="number"?{clusterMaxZoom:S.clusterMaxZoom}:{}}:{}});const N=[];if(T==="line")N.push({id:`${D}-line`,type:"line",source:D,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":typeof S.color=="string"?S.color:"rgb(255,64,51)","line-width":typeof S.width=="number"?S.width:4,"line-opacity":typeof S.opacity=="number"?S.opacity:1}});else{const X=j?[["!",["has","point_count"]]]:[];N.push({id:`${D}-dot`,type:"circle",source:D,...j?{filter:["!",["has","point_count"]]}:{},paint:{"circle-radius":8,"circle-color":["get","color"],"circle-stroke-color":"#fff","circle-stroke-width":2}}),N.push({id:`${D}-icon`,type:"symbol",source:D,filter:["all",...X,["has","icon"]],layout:{"icon-image":["get","icon"],"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),N.push({id:`${D}-label`,type:"symbol",source:D,filter:["all",...X,["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}}),j&&(N.push({id:`${D}-clusters`,type:"circle",source:D,filter:["has","point_count"],paint:{"circle-radius":18,"circle-color":"rgb(59,122,214)","circle-stroke-color":"#fff","circle-stroke-width":2}}),N.push({id:`${D}-cluster-count`,type:"symbol",source:D,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 U=p&&l.getLayer(tn)?tn:void 0;for(const X of N)l.addLayer(X,U);return N.map(X=>X.id)},A=(D,T,S)=>{const j={center:D,...typeof T.zoom=="number"?{zoom:T.zoom}:{},...typeof T.bearing=="number"?{bearing:T.bearing}:{},...typeof T.pitch=="number"?{pitch:T.pitch}:{}};S?l.flyTo({...j,duration:typeof T.duration=="number"?T.duration:600}):l.jumpTo(j)},C=(D,T)=>{const S=T.animate!==!1,[j,N]=d(),U=new cr(D[0],D[0]);for(const _e of D)U.extend(_e);const X=typeof T.maxZoom=="number"?T.maxZoom:D.length===1?16:void 0;l.fitBounds(U,{padding:Hd(T.padding,j,N),...X!==void 0?{maxZoom:X}:{},duration:S?600:0})},E=()=>{const[D,T]=d();D===0||T===0||l.setPadding(Hd(c,D,T))},F=()=>{if(p)return;l.addSource(Ia,{type:"geojson",data:rn});const D=zS(i);D&&!l.hasImage(gl)&&l.addImage(gl,D,{pixelRatio:2}),l.addLayer({id:tn,type:"circle",source:Ia,paint:{"circle-color":"rgba(26,128,255,0.18)","circle-radius":0,"circle-pitch-alignment":"map"}}),l.addLayer({id:IS,type:"symbol",source:Ia,filter:["has","heading"],layout:{"icon-image":gl,"icon-rotate":["get","heading"],"icon-rotation-alignment":"map","icon-allow-overlap":!0,"icon-ignore-placement":!0}}),l.addLayer({id:PS,type:"circle",source:Ia,paint:{"circle-radius":7,"circle-color":"rgb(26,128,255)","circle-stroke-color":"#fff","circle-stroke-width":2.5}}),p={accuracy:null,lat:0}},k=(D,T,S)=>{if(!u)return;F();const j=l.getSource(Ia);if(!(!j||!p)){if(!D){j.setData(rn);return}j.setData({type:"Feature",properties:S==null?{}:{heading:S},geometry:{type:"Point",coordinates:D}}),p.accuracy=T,p.lat=D[1],l.setPaintProperty(tn,"circle-radius",T!=null&&T>0?kS(T,D[1]):0)}};return{call:async(D,T)=>{switch(D){case"setData":{if(typeof T[0]!="string"||T[1]===void 0)throw new Error("bad arguments — expected setData(source, geojson)");x(T[0],T[1]);return}case"ensureLayer":{if(typeof T[0]!="string"||typeof T[1]!="string")throw new Error("bad arguments — expected ensureLayer(source, kind, options)");v(T[0],T[1],T[2]&&typeof T[2]=="object"?T[2]:{});return}case"removeLayer":{if(typeof T[0]!="string")throw new Error("bad arguments — expected removeLayer(source)");w(T[0]);return}case"flyTo":case"jumpTo":{const S=an(T[0]);if(!S)throw new Error(`bad arguments — expected ${D}([lng, lat], options)`);A(S,T[1]&&typeof T[1]=="object"?T[1]:{},D==="flyTo");return}case"fitPoints":{const S=(Array.isArray(T[0])?T[0]:[]).map(an).filter(j=>j!==null);if(S.length===0)throw new Error("bad arguments — expected fitPoints needs at least one [lng, lat]");C(S,T[1]&&typeof T[1]=="object"?T[1]:{});return}case"setPadding":{c=T[0]&&typeof T[0]=="object"?T[0]:{},E();return}case"getCamera":return f();case"setUserLocation":{const S=T[1]&&typeof T[1]=="object"?T[1]:{};k(an(T[0]),typeof S.accuracy=="number"?S.accuracy:null,typeof S.heading=="number"?S.heading:null);return}default:throw new Error(`Unknown method: ${D}`)}},destroy:()=>{g&&clearTimeout(g),l.remove()}}};export{G8 as createMap};
|