1!function(){try{var i="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},r=(new i.Error).stack;r&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[r]="c1b75e97-4c3a-4261-98fe-bc14d1e702a9",i._sentryDebugIdIdentifier="sentry-dbid-c1b75e97-4c3a-4261-98fe-bc14d1e702a9")}catch(i){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3602],{11324:function(i,r,a){i.exports=function(){"use strict";let i,r,n;function o(a,o){if(i)if(r){let a={};i(a),n=o(a);let s="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+i+")(sharedChunk); ("+r+")(undefined, sharedChunk); self.onerror = null;";"u">typeof window&&window&&window.URL&&window.URL.createObjectURL&&(n.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}else r=o;else i=o}return o(["exports"],function(i){let r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E,A,C,M,P,D,R,L,z,F,O,B,k,V,N,U,j,G,q,$,H;var Z="u">typeof Float32Array?Float32Array:Array;function W(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a*s-o*n;return l?(i[0]=s*(l=1/l),i[1]=-n*l,i[2]=-o*l,i[3]=a*l,i):null}function X(){var i=new Z(9);return Z!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function Y(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8];return i[0]=l*d-h*c,i[1]=o*c-n*d,i[2]=n*h-o*l,i[3]=h*u-s*d,i[4]=a*d-o*u,i[5]=o*s-a*h,i[6]=s*c-l*u,i[7]=n*u-a*c,i[8]=a*l-n*s,i}function K(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=a[0],m=a[1],_=a[2],g=a[3],y=a[4],x=a[5],v=a[6],b=a[7],w=a[8];return i[0]=f*n+m*l+_*c,i[1]=f*o+m*h+_*d,i[2]=f*s+m*u+_*p,i[3]=g*n+y*l+x*c,i[4]=g*o+y*h+x*d,i[5]=g*s+y*u+x*p,i[6]=v*n+b*l+w*c,i[7]=v*o+b*h+w*d,i[8]=v*s+b*u+w*p,i}function J(){var i=new Z(16);return Z!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i}function Q(i){var r=new Z(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r}function ee(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function et(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8],p=r[9],f=r[10],m=r[11],_=r[12],g=r[13],y=r[14],x=r[15],v=a*h-n*l,b=a*u-o*l,w=a*c-s*l,T=n*u-o*h,S=n*c-s*h,I=o*c-s*u,E=d*g-p*_,A=d*y-f*_,C=d*x-m*_,M=p*y-f*g,P=p*x-m*g,D=f*x-m*y,R=v*D-b*P+w*M+T*C-S*A+I*E;return R?(i[0]=(h*D-u*P+c*M)*(R=1/R),i[1]=(o*P-n*D-s*M)*R,i[2]=(g*I-y*S+x*T)*R,i[3]=(f*S-p*I-m*T)*R,i[4]=(u*C-l*D-c*A)*R,i[5]=(a*D-o*C+s*A)*R,i[6]=(y*w-_*I-x*b)*R,i[7]=(d*I-f*w+m*b)*R,i[8]=(l*P-h*C+c*E)*R,i[9]=(n*C-a*P-s*E)*R,i[10]=(_*S-g*w+x*v)*R,i[11]=(p*w-d*S-m*v)*R,i[12]=(h*A-l*M-u*E)*R,i[13]=(a*M-n*A+o*E)*R,i[14]=(g*b-_*T-y*v)*R,i[15]=(d*T-p*b+f*v)*R,i):null}function ei(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],g=r[12],y=r[13],x=r[14],v=r[15],b=a[0],w=a[1],T=a[2],S=a[3];return i[0]=b*n+w*h+T*p+S*g,i[1]=b*o+w*u+T*f+S*y,i[2]=b*s+w*c+T*m+S*x,i[3]=b*l+w*d+T*_+S*v,i[4]=(b=a[4])*n+(w=a[5])*h+(T=a[6])*p+(S=a[7])*g,i[5]=b*o+w*u+T*f+S*y,i[6]=b*s+w*c+T*m+S*x,i[7]=b*l+w*d+T*_+S*v,i[8]=(b=a[8])*n+(w=a[9])*h+(T=a[10])*p+(S=a[11])*g,i[9]=b*o+w*u+T*f+S*y,i[10]=b*s+w*c+T*m+S*x,i[11]=b*l+w*d+T*_+S*v,i[12]=(b=a[12])*n+(w=a[13])*h+(T=a[14])*p+(S=a[15])*g,i[13]=b*o+w*u+T*f+S*y,i[14]=b*s+w*c+T*m+S*x,i[15]=b*l+w*d+T*_+S*v,i}function er(i,r,a){var n,o,s,l,h,u,c,d,p,f,m,_,g=a[0],y=a[1],x=a[2];return r===i?(i[12]=r[0]*g+r[4]*y+r[8]*x+r[12],i[13]=r[1]*g+r[5]*y+r[9]*x+r[13],i[14]=r[2]*g+r[6]*y+r[10]*x+r[14],i[15]=r[3]*g+r[7]*y+r[11]*x+r[15]):(o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],i[0]=n=r[0],i[1]=o,i[2]=s,i[3]=l,i[4]=h,i[5]=u,i[6]=c,i[7]=d,i[8]=p,i[9]=f,i[10]=m,i[11]=_,i[12]=n*g+h*y+p*x+r[12],i[13]=o*g+u*y+f*x+r[13],i[14]=s*g+c*y+m*x+r[14],i[15]=l*g+d*y+_*x+r[15]),i}function ea(i,r,a){var n=a[0],o=a[1],s=a[2];return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i[3]=r[3]*n,i[4]=r[4]*o,i[5]=r[5]*o,i[6]=r[6]*o,i[7]=r[7]*o,i[8]=r[8]*s,i[9]=r[9]*s,i[10]=r[10]*s,i[11]=r[11]*s,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function en(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[4],l=r[5],h=r[6],u=r[7],c=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=s*o+c*n,i[5]=l*o+d*n,i[6]=h*o+p*n,i[7]=u*o+f*n,i[8]=c*o-s*n,i[9]=d*o-l*n,i[10]=p*o-h*n,i[11]=f*o-u*n,i}function eo(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[0],l=r[1],h=r[2],u=r[3],c=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o-c*n,i[1]=l*o-d*n,i[2]=h*o-p*n,i[3]=u*o-f*n,i[8]=s*n+c*o,i[9]=l*n+d*o,i[10]=h*n+p*o,i[11]=u*n+f*o,i}function es(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[0],l=r[1],h=r[2],u=r[3],c=r[4],d=r[5],p=r[6],f=r[7];return r!==i&&(i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o+c*n,i[1]=l*o+d*n,i[2]=h*o+p*n,i[3]=u*o+f*n,i[4]=c*o-s*n,i[5]=d*o-l*n,i[6]=p*o-h*n,i[7]=f*o-u*n,i}function el(i,r){return i[0]=r[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=r[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function eh(i,r,a){var n,o,s,l=a[0],h=a[1],u=a[2],c=Math.sqrt(l*l+h*h+u*u);return c<1e-6?null:(l*=c=1/c,h*=c,u*=c,n=Math.sin(r),o=Math.cos(r),i[0]=l*l*(s=1-o)+o,i[1]=h*l*s+u*n,i[2]=u*l*s-h*n,i[3]=0,i[4]=l*h*s-u*n,i[5]=h*h*s+o,i[6]=u*h*s+l*n,i[7]=0,i[8]=l*u*s+h*n,i[9]=h*u*s-l*n,i[10]=u*u*s+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i)}function eu(i,r){var a=r[0],n=r[1],o=r[2],s=r[4],l=r[5],h=r[6],u=r[8],c=r[9],d=r[10];return i[0]=Math.sqrt(a*a+n*n+o*o),i[1]=Math.sqrt(s*s+l*l+h*h),i[2]=Math.sqrt(u*u+c*c+d*d),i}function ec(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a+a,h=n+n,u=o+o,c=a*l,d=n*l,p=n*h,f=o*l,m=o*h,_=o*u,g=s*l,y=s*h,x=s*u;return i[0]=1-p-_,i[1]=d+x,i[2]=f-y,i[3]=0,i[4]=d-x,i[5]=1-c-_,i[6]=m+g,i[7]=0,i[8]=f+y,i[9]=m-g,i[10]=1-c-p,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function ed(){var i=new Z(3);return Z!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function ep(i){var r=new Z(3);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r}function ef(i){var r=i[0],a=i[1],n=i[2];return Math.sqrt(r*r+a*a+n*n)}function em(i,r,a){var n=new Z(3);return n[0]=i,n[1]=r,n[2]=a,n}function e_(i,r,a,n){return i[0]=r,i[1]=a,i[2]=n,i}function eg(i,r,a){return i[0]=r[0]+a[0],i[1]=r[1]+a[1],i[2]=r[2]+a[2],i}function ey(i,r,a){return i[0]=r[0]-a[0],i[1]=r[1]-a[1],i[2]=r[2]-a[2],i}function ex(i,r,a){return i[0]=r[0]*a[0],i[1]=r[1]*a[1],i[2]=r[2]*a[2],i}function ev(i,r,a){return i[0]=Math.min(r[0],a[0]),i[1]=Math.min(r[1],a[1]),i[2]=Math.min(r[2],a[2]),i}function eb(i,r,a){return i[0]=Math.max(r[0],a[0]),i[1]=Math.max(r[1],a[1]),i[2]=Math.max(r[2],a[2]),i}function ew(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i}function eT(i,r,a,n){return i[0]=r[0]+a[0]*n,i[1]=r[1]+a[1]*n,i[2]=r[2]+a[2]*n,i}function eS(i,r){var a=r[0]-i[0],n=r[1]-i[1],o=r[2]-i[2];return Math.sqrt(a*a+n*n+o*o)}function eI(i,r){var a=r[0]-i[0],n=r[1]-i[1],o=r[2]-i[2];return a*a+n*n+o*o}function eE(i){var r=i[0],a=i[1],n=i[2];return r*r+a*a+n*n}function eA(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i}function eC(i,r){var a=r[0],n=r[1],o=r[2],s=a*a+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),i[0]=r[0]*s,i[1]=r[1]*s,i[2]=r[2]*s,i}function eM(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function eP(i,r,a){var n=r[0],o=r[1],s=r[2],l=a[0],h=a[1],u=a[2];
1return i[0]=o*u-s*h,i[1]=s*l-n*u,i[2]=n*h-o*l,i}function eD(i,r,a,n){var o=r[0],s=r[1],l=r[2];return i[0]=o+n*(a[0]-o),i[1]=s+n*(a[1]-s),i[2]=l+n*(a[2]-l),i}function eR(i,r,a){var n=r[0],o=r[1],s=r[2],l=a[3]*n+a[7]*o+a[11]*s+a[15];return i[0]=(a[0]*n+a[4]*o+a[8]*s+a[12])/(l=l||1),i[1]=(a[1]*n+a[5]*o+a[9]*s+a[13])/l,i[2]=(a[2]*n+a[6]*o+a[10]*s+a[14])/l,i}function eL(i,r,a){var n=r[0],o=r[1],s=r[2];return i[0]=n*a[0]+o*a[3]+s*a[6],i[1]=n*a[1]+o*a[4]+s*a[7],i[2]=n*a[2]+o*a[5]+s*a[8],i}function ez(i,r,a){var n=a[0],o=a[1],s=a[2],l=a[3],h=r[0],u=r[1],c=r[2],d=o*c-s*u,p=s*h-n*c,f=n*u-o*h;return i[0]=h+l*(d+=d)+o*(f+=f)-s*(p+=p),i[1]=u+l*p+s*d-n*f,i[2]=c+l*f+n*p-o*d,i}function eF(i){return i[0]=0,i[1]=0,i[2]=0,i}function eO(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]}function eB(){var i=new Z(4);return Z!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0,i[3]=0),i}function ek(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i[3]=r[3]*a,i}function eV(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a*a+n*n+o*o+s*s;return l>0&&(l=1/Math.sqrt(l)),i[0]=a*l,i[1]=n*l,i[2]=o*l,i[3]=s*l,i}function eN(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3];return i[0]=a[0]*n+a[4]*o+a[8]*s+a[12]*l,i[1]=a[1]*n+a[5]*o+a[9]*s+a[13]*l,i[2]=a[2]*n+a[6]*o+a[10]*s+a[14]*l,i[3]=a[3]*n+a[7]*o+a[11]*s+a[15]*l,i}function eU(){var i=new Z(4);return Z!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function ej(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function eG(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u+l*h,i[1]=o*u+s*h,i[2]=s*u-o*h,i[3]=l*u-n*h,i}function eq(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u-s*h,i[1]=o*u+l*h,i[2]=s*u+n*h,i[3]=l*u-o*h,i}ed(),eB();var e$,eH,eZ,eW=(e$=ed(),eH=em(1,0,0),eZ=em(0,1,0),function(i,r,a){var n,o,s=eM(r,a);return s<-.999999?(eP(e$,eH,r),1e-6>ef(e$)&&eP(e$,eZ,r),eC(e$,e$),o=Math.sin(n=.5*Math.PI),i[0]=o*e$[0],i[1]=o*e$[1],i[2]=o*e$[2],i[3]=Math.cos(n),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(eP(e$,r,a),i[0]=e$[0],i[1]=e$[1],i[2]=e$[2],i[3]=1+s,eV(i,i))});function eX(){var i=new Z(2);return Z!=Float32Array&&(i[0]=0,i[1]=0),i}function eY(i,r){var a=new Z(2);return a[0]=i,a[1]=r,a}function eK(i,r,a){return i[0]=r[0]+a[0],i[1]=r[1]+a[1],i}function eJ(i,r,a){return i[0]=r[0]-a[0],i[1]=r[1]-a[1],i}function eQ(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i}function e0(i){var r=i[0],a=i[1];return Math.sqrt(r*r+a*a)}function e1(i,r){var a=r[0],n=r[1],o=a*a+n*n;return o>0&&(o=1/Math.sqrt(o)),i[0]=r[0]*o,i[1]=r[1]*o,i}function e2(i,r){return i[0]*r[0]+i[1]*r[1]}function e3(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}eU(),eU(),X(),eX();var e5=e3(function(){if(t8)return t6;function i(i,r,a,n){this.cx=3*i,this.bx=3*(a-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(n-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=r,this.p2x=a,this.p2y=n}return t8=1,t6=i,i.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,r){if(void 0===r&&(r=1e-6),i<0)return 0;if(i>1)return 1;for(var a=i,n=0;n<8;n++){var o=this.sampleCurveX(a)-i;if(Math.abs(o)<r)return a;var s=this.sampleCurveDerivativeX(a);if(1e-6>Math.abs(s))break;a-=o/s}var l=0,h=1;for(a=i,n=0;n<20&&!(Math.abs((o=this.sampleCurveX(a))-i)<r);n++)i>o?l=a:h=a,a=.5*(h-l)+l;return a},solve:function(i,r){return this.sampleCurveY(this.solveCurveX(i,r))}},t6}());function e4(i,r){this.x=i,this.y=r}function e6(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let a=0;a<i.length;a++)if(!e6(i[a],r[a]))return!1;return!0}if("object"==typeof i&&null!==i&&null!==r){if("object"!=typeof r||Object.keys(i).length!==Object.keys(r).length)return!1;for(let a in i)if(!e6(i[a],r[a]))return!1;return!0}return i===r}e4.prototype={clone(){return new e4(this.x,this.y)},add(i){return this.clone()._add(i)},sub(i){return this.clone()._sub(i)},multByPoint(i){return this.clone()._multByPoint(i)},divByPoint(i){return this.clone()._divByPoint(i)},mult(i){return this.clone()._mult(i)},div(i){return this.clone()._div(i)},rotate(i){return this.clone()._rotate(i)}
1,rotateAround(i,r){return this.clone()._rotateAround(i,r)},matMult(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist(i){return Math.sqrt(this.distSqr(i))},distSqr(i){let r=i.x-this.x,a=i.y-this.y;return r*r+a*a},angle(){return Math.atan2(this.y,this.x)},angleTo(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith(i){return this.angleWithSep(i.x,i.y)},angleWithSep(i,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult(i){let r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,this},_add(i){return this.x+=i.x,this.y+=i.y,this},_sub(i){return this.x-=i.x,this.y-=i.y,this},_mult(i){return this.x*=i,this.y*=i,this},_div(i){return this.x/=i,this.y/=i,this},_multByPoint(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint(i){return this.x/=i.x,this.y/=i.y,this},_unit(){return this._div(this.mag()),this},_perp(){let i=this.y;return this.y=this.x,this.x=-i,this},_rotate(i){let r=Math.cos(i),a=Math.sin(i),n=a*this.x+r*this.y;return this.x=r*this.x-a*this.y,this.y=n,this},_rotateAround(i,r){let a=Math.cos(i),n=Math.sin(i),o=r.y+n*(this.x-r.x)+a*(this.y-r.y);return this.x=r.x+a*(this.x-r.x)-n*(this.y-r.y),this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:e4},e4.convert=function(i){if(i instanceof e4)return i;if(Array.isArray(i))return new e4(+i[0],+i[1]);if(void 0!==i.x&&void 0!==i.y)return new e4(+i.x,+i.y);throw Error("Expected [x, y] or {x, y} point format")};let e8=Math.PI/180,e9=180/Math.PI,e7=[[0,0],[1,0],[1,1],[0,1]];function te(i){if(i<=0)return 0;if(i>=1)return 1;let r=i*i,a=r*i;return 4*(i<.5?a:3*(i-r)+a-.75)}function tt(i,r,a,n){let o=new e5(i,r,a,n);return function(i){return o.solve(i)}}let ti=tt(.25,.1,.25,1);function tr(i,r,a){return Math.min(a,Math.max(r,i))}function ta(i,r,a){return(a=tr((a-i)/(r-i),0,1))*a*(3-2*a)}function tn(i,r,a){let n=a-r,o=((i-r)%n+n)%n+r;return o===r?a:o}function to(i,r,a){if(!i.length)return a(null,[]);let n=i.length,o=Array(i.length),s=null;i.forEach((i,l)=>{r(i,(i,r)=>{i&&(s=i),o[l]=r,0==--n&&a(s,o)})})}let ts=1;function tl(){return ts++}function th(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log2(i)))}function tu(i,r){i.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function tc(i,r,a){let n={};for(let a in i)n[a]=r.call(this,i[a],a,i);return n}function td(i,r,a){let n={};for(let a in i)r.call(this,i[a],a,i)&&(n[a]=i[a]);return n}function tp(i){return Array.isArray(i)?i.map(tp):"object"==typeof i&&i?tc(i,tp):i}function tf(i,r){for(let a=0;a<i.length;a++)if(r.indexOf(i[a])>=0)return!0;return!1}let tm={};function t_(i){tm[i]||("u">typeof console&&console.warn(i),tm[i]=!0)}function tg(i,r,a){return(a.y-i.y)*(r.x-i.x)>(r.y-i.y)*(a.x-i.x)}function ty([i,r,a]){let n=(r+90)*e8,o=a*e8;return{x:i*Math.cos(n)*Math.sin(o),y:i*Math.sin(n)*Math.sin(o),z:i*Math.cos(o),azimuthal:r,polar:a}}function tx(i){return("u">typeof self||void 0!==i)&&"u">typeof WorkerGlobalScope&&(void 0!==i?i:self)instanceof WorkerGlobalScope}function tv(i){let r={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,a,n,o)=>{let s=n||o;return r[a]=!s||s.toLowerCase(),""}),r["max-age"]){let i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}let tb,tw=null;function tT(i,r){return[i[4*r],i[4*r+1],i[4*r+2],i[4*r+3]]}function tS(i,r,a,n){for(;r<a;){let o=r+a>>1;i[o]<n?r=o+1:a=o}return r}function tI(i,r,a,n){for(;r<a;){let o=r+a>>1;i[o]<=n?r=o+1:a=o}return r}function tE(i){return i>0?1/(1.001-i):1+i}function tA(i){return i>0?1-1/(1.001-i):-i}function tC(i,r,a){return(i-r.min)*(a.max-a.min)/(r.max-r.min)+a.min}let tM={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!tM.API_URL)return null;try{let i=new URL(tM.API_URL);return"api.mapbox.cn"===i.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===i.hostname?"https://events.mapbox.com/events/v2":null}catch(i){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MES
1HOPT_URL:"/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1",TILE_PROVIDER_URLS:Object.assign(Object.create(null),{pmtiles:"/mapbox-gl-js/mapbox-gl-pmtiles-provider-v0.0.1.js"})};function tP(){return new URL(tM.DRACO_URL,tM.API_URL).href}function tD(){if("object"!=typeof WebAssembly)throw Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(!function(){if(void 0===tb){if("object"!=typeof WebAssembly)return!1;let i=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);tb=WebAssembly.validate(i)}return tb}()?tM.MESHOPT_URL:tM.MESHOPT_SIMD_URL,tM.API_URL).href}function tR(){return new URL(tM.BUILDING_GEN_URL,tM.API_URL).href}function tL(i){return tM.API_URL_REGEX.test(i)}function tz(i){return tM.API_SPRITE_REGEX.test(i)}function tF(){return null==r&&(r=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),r}let tO={now:()=>void 0!==o?o:performance.now(),setNow(i){o=i},restoreNow(){o=void 0},frame(i){let r=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(r)}},getImageData(i,r=0){let{width:a,height:n}=i;s||(s=document.createElement("canvas"));let o=s.getContext("2d",{willReadFrequently:!0});if(!o)throw Error("failed to create canvas 2d context");return(a>s.width||n>s.height)&&(s.width=a,s.height=n),o.clearRect(-r,-r,a+2*r,n+2*r),o.drawImage(i,0,0,a,n),o.getImageData(-r,-r,a+2*r,n+2*r)},resolveURL:i=>(a||(a=document.createElement("a")),a.href=i,a.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==n&&(n=window.matchMedia("(prefers-reduced-motion: reduce)")),n.matches)},hasCanvasFingerprintNoise(){if(void 0!==l)return l;if(!tF())return l=!1,!1;let i=new OffscreenCanvas(85,1),r=i.getContext("2d",{willReadFrequently:!0}),a=0;for(let n=0;n<i.width;++n)r.fillStyle=`rgba(${a++},${a++},${a++}, 255)`,r.fillRect(n,0,1,1);let n=r.getImageData(0,0,i.width,i.height);a=0;for(let i=0;i<n.data.length;++i)if(i%4!=3&&a++!==n.data[i])return l=!0,!0;return l=!1,!1}};function tB(i,r){let a=i.indexOf("?");if(a<0)return`${i}?${new URLSearchParams(r).toString()}`;let n=new URLSearchParams(i.slice(a));for(let i in r)n.set(i,r[i]);return`${i.slice(0,a)}?${n.toString()}`}
1function tk(i,r={persistentParams:[]}){let a=i.indexOf("?");if(a<0)return i;let n=new URLSearchParams,o=new URLSearchParams(i.slice(a));for(let i of r.persistentParams){let r=o.get(i);r&&n.set(i,r)}let s=n.toString();return`${i.slice(0,a)}${s.length>0?`?${s}`:""}`}let tV="mapbox-tiles",tN=500,tU=50,tj=["language","worldview","jobid"];function tG(){try{return caches}catch(i){}}function tq(){let i=tG();i&&null==h&&(h=i.open(tV))}let t$=1/0,tH={supported:!1,testSupport:function(i){!tX&&tW&&(tY?tJ(i):tZ=i)}},tZ,tW,tX=!1,tY=!1,tK="u">typeof self?self:{};function tJ(i){let r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,tW),i.isContextLost())return;tH.supported=!0}catch(i){}i.deleteTexture(r),tX=!0}tK.document&&((tW=tK.document.createElement("img")).onload=function(){tZ&&tJ(tZ),tZ=null,tY=!0},tW.onerror=function(){tX=!0,tZ=null},tW.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let tQ={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(tQ);class t0 extends Error{constructor(i,r,a){401===r&&tL(a)&&(i+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(i),this.status=r,this.url=a}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function t1(i){return"object"==typeof i&&null!==i&&"status"in i&&404===i.status}let t2=tx()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,t3=function(i,r){var a,n;let o,s,l,u,c,d,p;return/^file:/.test(a=i.url)||/^file:/.test(t2())&&!/^\w+:/.test(a)?function(i,r){let a=new XMLHttpRequest;for(let r in a.open(i.method||"GET",i.url,!0),"arrayBuffer"===i.type&&(a.responseType="arraybuffer"),i.headers)a.setRequestHeader(r,i.headers[r]);return"json"===i.type&&(a.responseType="text",a.setRequestHeader("Accept","application/json")),a.withCredentials="include"===i.credentials,a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if((a.status>=200&&a.status<300||0===a.status)&&null!==a.response){let n=a.response;if("json"===i.type)try{n=JSON.parse(a.response)}catch(i){return r(i)}let o=new Headers;a.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(i=>{let r=i.split(": "),a=r.shift(),n=r.join(": ");o.append(a,n)}),r(null,n,o)}else r(new t0(a.statusText,a.status,i.url))},a.send(i.body),{cancel:()=>a.abort()}}(i,r):(o=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:t2(),referrerPolicy:i.referrerPolicy,signal:o.signal}),l=!1,u=!1,c=(n=s.url).indexOf("sku=")>0&&tL(n),"json"===i.type&&s.headers.set("Accept","application/json"),d=(a,n,o)=>{if(u)return;if(a&&"SecurityError"!==a.message&&t_(a.toString()),n&&o)return p(n);let l=Date.now();fetch(s).then(a=>{if(a.ok){let i=c?a.clone():null;return p(a,i,l)}return r(new t0(a.statusText,a.status,i.url))}).catch(a=>{"AbortError"!==a.name&&r(Error(`${a.message} ${i.url}`))})},p=(a,n,o)=>{("arrayBuffer"===i.type?a.arrayBuffer():"json"===i.type?a.json():a.text()).then(i=>{u||(n&&o&&function(i,r,a){var n;if(tq(),null==h)return;let o=tv(r.headers.get("cache-control")||"");if(o["no-store"])return;let s={status:r.status,statusText:r.statusText,headers:new Headers};r.headers.forEach((i,r)=>s.headers.set(r,i)),o["max-age"]&&s.headers.set("Expires",new Date(a+1e3*o["max-age"]).toUTCString());let l=s.headers.get("expires");if(!l||new Date(l).getTime()-a<42e4)return;
1let u=tk(i.url,{persistentParams:tj});if(206===r.status){let r=i.headers.get("Range");if(!r)return;s.status=200,u=tB(u,{range:r})}let c=new Response(200!==(n=r.status)&&404!==n&&[101,103,204,205,304].includes(n)?null:r.body,s);tq(),null!=h&&h.then(i=>i.put(u,c)).catch(i=>t_(i.message))}(s,n,o),l=!0,r(null,i,a.headers))}).catch(i=>{u||r(Error(i.message))})},c?function(i,r){if(tq(),null==h)return r(null);h.then(a=>{let n=tk(i.url,{persistentParams:tj}),o=i.headers.get("Range");o&&(n=tB(n,{range:o})),a.match(n).then(i=>{let o=function(i){if(!i)return!1;let r=new Date(i.headers.get("expires")||0),a=tv(i.headers.get("cache-control")||"");return Number(r)>Date.now()&&!a["no-cache"]}(i);a.delete(n).catch(r),o&&a.put(n,i.clone()).catch(r),r(null,i,o)}).catch(r)}).catch(r)}(s,d):d(null,null),{cancel:()=>{u=!0,l||o.abort()}})},t5=function(i,r){return t3(Object.assign(i,{type:"arrayBuffer"}),r)};u=[],c=0;let t4=function(i,r){if(tH.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),c>=tM.MAX_PARALLEL_IMAGE_REQUESTS){let a={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return u.push(a),a}c++;let a=!1,n=()=>{if(!a)for(a=!0,c--;u.length&&c<tM.MAX_PARALLEL_IMAGE_REQUESTS;){let i=u.shift(),{requestParameters:r,callback:a,cancelled:n}=i;n||(i.cancel=t4(r,a).cancel)}},o=t5(i,(i,a,o)=>{n(),i?r(i):a&&createImageBitmap(new Blob([new Uint8Array(a)],{type:"image/png"})).then(i=>{((i,a)=>r(i,a,o))(null,i)}).catch(i=>{((i,a)=>r(i,a,o))(Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})});return{cancel:()=>{o.cancel(),n()}}};var t6,t8,t9,t7,ie,it={exports:{}},ii={exports:{}},ir={exports:{}},ia=e3(function(){if(ie)return it.exports;ie=1;var i=(t9||(t9=1,ii.exports=function(i,r){var a,n,o,s,l,h;for(n=i.length-(a=3&i.length),o=r,h=0;h<n;)l=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24,++h,o=27492+(65535&(s=5*(65535&(o=(o^=l=(65535&(l=(l=(65535&l)*0xcc9e2d51+(((l>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|l>>>17))*0x1b873593+(((l>>>16)*0x1b873593&65535)<<16)|0)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)|0))+(((s>>>16)+58964&65535)<<16);switch(l=0,a){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:o^=l=(65535&(l=(l=(65535&(l^=255&i.charCodeAt(h)))*0xcc9e2d51+(((l>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|l>>>17))*0x1b873593+(((l>>>16)*0x1b873593&65535)<<16)|0}return o^=i.length,o=0x85ebca6b*(65535&(o^=o>>>16))+((0x85ebca6b*(o>>>16)&65535)<<16)|0,o=0xc2b2ae35*(65535&(o^=o>>>13))+((0xc2b2ae35*(o>>>16)&65535)<<16)|0,(o^=o>>>16)>>>0}
1),ii.exports),r=(t7||(t7=1,ir.exports=function(i,r){for(var a,n=i.length,o=r^n,s=0;n>=4;)a=0x5bd1e995*(65535&(a=255&i.charCodeAt(s)|(255&i.charCodeAt(++s))<<8|(255&i.charCodeAt(++s))<<16|(255&i.charCodeAt(++s))<<24))+((0x5bd1e995*(a>>>16)&65535)<<16),o=0x5bd1e995*(65535&o)+((0x5bd1e995*(o>>>16)&65535)<<16)^(a=0x5bd1e995*(65535&(a^=a>>>24))+((0x5bd1e995*(a>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:o^=(255&i.charCodeAt(s+2))<<16;case 2:o^=(255&i.charCodeAt(s+1))<<8;case 1:o=0x5bd1e995*(65535&(o^=255&i.charCodeAt(s)))+((0x5bd1e995*(o>>>16)&65535)<<16)}return o=0x5bd1e995*(65535&(o^=o>>>13))+((0x5bd1e995*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0}),ir.exports);return it.exports=i,it.exports.murmur3=i,it.exports.murmur2=r,it.exports}());class io{constructor(i,...r){Object.assign(this,r[0]||{}),this.type=i}}class is extends io{constructor(i,r={}){super("error",Object.assign({error:i},r))}}function il(i,r,a){a[i]&&-1!==a[i].indexOf(r)||(a[i]=a[i]||[],a[i].push(r))}function ih(i,r,a){if(a&&a[i]){let n=a[i].indexOf(r);-1!==n&&a[i].splice(n,1)}}class iu{on(i,r){return this._listeners=this._listeners||{},il(i,r,this._listeners),this}off(i,r){return ih(i,r,this._listeners),ih(i,r,this._oneTimeListeners),this}once(i,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},il(i,r,this._oneTimeListeners),this):new Promise(r=>{this.once(i,r)})}fire(i,r){let a="string"==typeof i?new io(i,r):i,n=a.type;if(this.listens(n)){for(let i of(a.target=this,this._listeners&&this._listeners[n]?this._listeners[n].slice():[]))i.call(this,a);for(let i of this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[])ih(n,i,this._oneTimeListeners),i.call(this,a);let i=this._eventedParent;i&&(Object.assign(a,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(a))}else a instanceof is&&console.error(a.error);return this}listens(i){return!!(this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i))}setEventedParent(i,r){return this._eventedParent=i,this._eventedParentData=r,this}}class ic{constructor(i){"string"==typeof i?this.name=i:(this.name=i.name,this.iconsetId=i.iconsetId)}static from(i){return new ic(i)}static toString(i){return i.iconsetId?`${i.name}�${i.iconsetId}`:i.name}static parse(i){let[r,a]=i.split("\x1f");return new ic({name:r,iconsetId:a})}static isEqual(i,r){return i.name===r.name&&i.iconsetId===r.iconsetId}toString(){return ic.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var id,ip={},im=function(){if(id)return ip;id=1;var i={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function r(i){return(i=Math.round(i))<0?0:i>255?255:i}function a(i){return r("%"===i[i.length-1]?parseFloat(i)/100*255:parseInt(i))}function n(i){var r;return(r="%"===i[i.length-1]?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r}function o(i,r,a){return a<0?a+=1:a>1&&(a-=1),6*a<1?i+(r-i)*a*6:2*a<1?r:3*a<2?i+(r-i)*(2/3-a)*6:i}try{ip.parseCSSColor=function(s){var l,h=s.replace(/ /g,"").toLowerCase();if(h in i)return i[h].slice();if("#"===h[0])return 4===h.length?(l=parseInt(h.substr(1),16))>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null:7===h.length&&(l=parseInt(h.substr(1),16))>=0&&l<=0xffffff?[(0xff0000&l)>>16,(65280&l)>>8,255&l,1]:null;var u=h.indexOf("("),c=h.indexOf(")");if(-1!==u&&c+1===h.length){var d=h.substr(0,u),p=h.substr(u+1,c-(u+1)).split(","),f=1;switch(d){case"rgba":if(4!==p.length)break;f=n(p.pop());case"rgb":return 3!==p.length?null:[a(p[0]),a(p[1]),a(p[2]),f];case"hsla":if(4!==p.length)break;f=n(p.pop());case"hsl":if(3!==p.length)break;
1var m=(parseFloat(p[0])%360+360)%360/360,_=n(p[1]),g=n(p[2]),y=g<=.5?g*(_+1):g+_-g*_,x=2*g-y;return[r(255*o(x,y,m+1/3)),r(255*o(x,y,m)),r(255*o(x,y,m-1/3)),f]}}return null}}catch(i){}return ip}();class i_{constructor(i,r,a,n=1){this.r=i,this.g=r,this.b=a,this.a=n}static parse(i){if(!i)return;if(i instanceof i_)return i;if("string"!=typeof i)return;let r=im.parseCSSColor(i);return r?new i_(r[0]/255,r[1]/255,r[2]/255,r[3]):void 0}toString(){let[i,r,a,n]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*i)},${Math.round(255*r)},${Math.round(255*a)},${n})`}toNonPremultipliedRenderColor(i){let{r:r,g:a,b:n,a:o}=this;return new iy(i,r,a,n,o)}toPremultipliedRenderColor(i){let{r:r,g:a,b:n,a:o}=this;return new ix(i,r*o,a*o,n*o,o)}clone(){return new i_(this.r,this.g,this.b,this.a)}}class ig{constructor(i,r,a,n,o,s=!1){if(this.premultiplied=!1,this.premultiplied=s,i){const s=i.image.height,l=s*s;this.premultiplied?(r=0===o?0:r/o*(s-1),a=0===o?0:a/o*(s-1),n=0===o?0:n/o*(s-1)):(r*=s-1,a*=s-1,n*=s-1),r=Math.max(0,Math.min(s-1,r)),a=Math.max(0,Math.min(s-1,a)),n=Math.max(0,Math.min(s-1,n));const h=Math.floor(r),u=Math.floor(a),c=Math.floor(n),d=Math.ceil(r),p=Math.ceil(a),f=Math.ceil(n),m=r-h,_=a-u,g=n-c,y=i.image.data,x=4*(h+u*l+c*s),v=4*(h+u*l+f*s),b=4*(h+p*l+c*s),w=4*(h+p*l+f*s),T=4*(d+u*l+c*s),S=4*(d+u*l+f*s),I=4*(d+p*l+c*s),E=4*(d+p*l+f*s);this.r=iv(iv(iv(y[x],y[v],g),iv(y[b],y[w],g),_),iv(iv(y[T],y[S],g),iv(y[I],y[E],g),_),m)/255*(this.premultiplied?o:1),this.g=iv(iv(iv(y[x+1],y[v+1],g),iv(y[b+1],y[w+1],g),_),iv(iv(y[T+1],y[S+1],g),iv(y[I+1],y[E+1],g),_),m)/255*(this.premultiplied?o:1),this.b=iv(iv(iv(y[x+2],y[v+2],g),iv(y[b+2],y[w+2],g),_),iv(iv(y[T+2],y[S+2],g),iv(y[I+2],y[E+2],g),_),m)/255*(this.premultiplied?o:1),this.a=o}else this.r=r,this.g=a,this.b=n,this.a=o}toArray(){let{r:i,g:r,b:a,a:n}=this;return[255*i,255*r,255*a,n]}toHslaArray(){let i,{r:r,g:a,b:n,a:o}=this;if(this.premultiplied){if(0===o)return[0,0,0,0];let i=1/o;r*=i,a*=i,n*=i}let s=Math.min(Math.max(r,0),1),l=Math.min(Math.max(a,0),1),h=Math.min(Math.max(n,0),1),u=Math.min(s,l,h),c=Math.max(s,l,h),d=c-u,p=.5*(u+c);if(0===d)return[0,0,100*p,o];switch(c){case s:i=60*((l-h)/d+6*(l<h));break;case l:i=60*((h-s)/d+2);break;default:i=60*((s-l)/d+4)}return[i,100*(p>.5?d/(2-c-u):d/(c+u)),100*p,o]}toArray01(){let{r:i,g:r,b:a,a:n}=this;return[i,r,a,n]}toArray01Scaled(i){let{r:r,g:a,b:n}=this;return[r*i,a*i,n*i]}toArray01Linear(){let{r:i,g:r,b:a,a:n}=this;return[Math.pow(i,2.2),Math.pow(r,2.2),Math.pow(a,2.2),n]}}class iy extends ig{constructor(i,r,a,n,o){super(i,r,a,n,o,!1)}}class ix extends ig{constructor(i,r,a,n,o){super(i,r,a,n,o,!0)}}function iv(i,r,a){return i*(1-a)+r*a}function ib(i,r,a){return i.map((i,n)=>iv(i,r[n],a))}i_.black=new i_(0,0,0,1),i_.white=new i_(1,1,1,1),i_.transparent=new i_(0,0,0,0),i_.red=new i_(1,0,0,1),i_.blue=new i_(0,0,1,1);var iw=Object.freeze({__proto__:null,array:ib,color:function(i,r,a){return new i_(iv(i.r,r.r,a),iv(i.g,r.g,a),iv(i.b,r.b,a),iv(i.a,r.a,a))},number:iv});class iT extends Error{constructor(i,r){super(r),this.message=r,this.key=i}}class iS{constructor(i,r=[]){for(const[a,n]of(this.parent=i,this.bindings={},r))this.bindings[a]=n}concat(i){return new iS(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}let iI={kind:"null"},iE={kind:"number"},iA={kind:"string"},iC={kind:"boolean"},iM={kind:"color"},iP={kind:"object"},iD={kind:"value"},iR={kind:"collator"},iL={kind:"formatted"},iz={kind:"resolvedImage"};function iF(i,r){return{kind:"array",itemType:i,N:r}}function iO(i){if("array"===i.kind){let r=iO(i.itemType);return"number"==typeof i.N?`array<${r}, ${i.N}>`:"value"===i.itemType.kind?"array":`array<${r}>`}return i.kind}let iB=[iI,iE,iA,iC,iM,iL,iP,iF(iD),iz];function ik(i,r){if("error"===r.kind)return null;if("array"===i.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!ik(i.itemType,r.itemType))&&("number"!=typeof i.N||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if("value"===i.kind){for(let i of iB)if(!ik(i,r))return null}}return`Expected ${iO(i)} but found ${iO(r)} instead.`}function iV(i,r){return r.some(r=>r.kind===i.kind)}function iN(i,r){return r.some(r=>"null"===r?null===i:"array"===r?Array.isArray(i):"object"===r?i&&!Array.isArray(i)&&"object"==typeof i:r===typeof i)}function iU(i,r){return"array"===i.kind&&"array"===r.kind?i.N===r.N&&iU(i.itemType,r.itemType):i.kind===r.kind}class ij{constructor(i,r,a){this.sensitivity=i?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,r){return this.collator.compare(i,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class iG{constructor(i,r,a,n,o){this.text=i.normalize?i.normalize():i,this.image=r,this.scale=a,this.fontStack=n,this.textColor=o}}class iq{constructor(i){this.sections=i}
1static fromString(i){return new iq([new iG(i,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(i=>0!==i.text.length||!!i.image&&i.image.hasPrimary())}static factory(i){return i instanceof iq?i:iq.fromString(i)}toString(){return 0===this.sections.length?"":this.sections.map(i=>i.text).join("")}serialize(){let i=["format"];for(let r of this.sections){if(r.image){let a=r.image.getPrimary().id.toString();i.push(["image",a]);continue}i.push(r.text);let a={};r.fontStack&&(a["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(a["font-scale"]=r.scale),r.textColor&&(a["text-color"]=["rgba"].concat(r.textColor.toNonPremultipliedRenderColor(null).toArray())),i.push(a)}return i}}class i${constructor(i,r={}){this.id=ic.from(i),this.params=r.params,this.sx=r.sx||1,this.sy=r.sy||1}toString(){return JSON.stringify(this)}static parse(i){let r,a,n,o;try{({id:r,params:a,sx:n,sy:o}=JSON.parse(i)||{})}catch(i){return null}return r?new i$(r,{params:a,sx:n,sy:o}):null}scaleSelf(i,r=i){return this.sx*=i,this.sy*=r,this}}class iH{constructor(i,r,a,n,o=!1){this.primaryId=ic.from(i),this.primaryOptions=r,a&&(this.secondaryId=ic.from(a)),this.secondaryOptions=n,this.available=o}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new i$(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new i$(this.secondaryId,this.secondaryOptions):null}static from(i){return"string"==typeof i?iH.build({name:i}):i}static build(i,r,a,n){return i&&("object"!=typeof i||"name"in i)?new iH(i,a,r,n):null}}function iZ(i,r,a,n){return"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof a&&a>=0&&a<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[i,r,a,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[i,r,a,n]:[i,r,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function iW(i){if(null===i||"string"==typeof i||"boolean"==typeof i||"number"==typeof i||i instanceof i_||i instanceof ij||i instanceof iq||i instanceof iH)return!0;if(Array.isArray(i)){for(let r of i)if(!iW(r))return!1;return!0}if("object"==typeof i){for(let r in i)if(!iW(i[r]))return!1;return!0}return!1}function iX(i){if(null===i)return iI;if("string"==typeof i)return iA;if("boolean"==typeof i)return iC;if("number"==typeof i)return iE;if(i instanceof i_)return iM;if(i instanceof ij)return iR;if(i instanceof iq)return iL;if(i instanceof iH)return iz;if(Array.isArray(i)){let r,a=i.length;for(let a of i){let i=iX(a);if(r){if(r===i)continue;r=iD;break}r=i}return iF(r||iD,a)}return iP}function iY(i){let r=typeof i;return null===i?"":"string"===r||"number"===r||"boolean"===r?String(i):i instanceof iq||i instanceof iH||i instanceof i_?i.toString():JSON.stringify(i)}class iK{constructor(i,r){this.type=i,this.value=r}static parse(i,r){if(2!==i.length)return r.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!iW(i[1]))return r.error("invalid value");let a=i[1],n=iX(a),o=r.expectedType;return"array"===n.kind&&0===n.N&&o&&"array"===o.kind&&("number"!=typeof o.N||0===o.N)&&(n=o),new iK(n,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof i_?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof iq?this.value.serialize():this.value}}class iJ{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}let iQ={string:iA,number:iE,boolean:iC,object:iP};class i0{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a,n=1,o=i[0];if("array"===o){let o,s;if(i.length>2){let a=i[1];if("string"!=typeof a||!(a in iQ)||"object"===a)return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=iQ[a],n++}else o=iD;if(i.length>3){if(null!==i[2]&&("number"!=typeof i[2]||i[2]<0||i[2]!==Math.floor(i[2])))return r.error('The length argument to "array" must be a positive integer literal',2);s=i[2],n++}a=iF(o,s)}else a=iQ[o];let s=[];for(;n<i.length;n++){let a=r.parse(i[n],n,iD);if(!a)return null;s.push(a)}return new i0(a,s)}evaluate(i){for(let r=0;r<this.args.length;r++){let a=this.args[r].evaluate(i);if(!ik(this.type,iX(a)))return a;
1if(r===this.args.length-1)throw new iJ(`The expression ${JSON.stringify(this.args[r].serialize())} evaluated to ${iO(iX(a))} but was expected to be of type ${iO(this.type)}.`)}return null}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=this.type,r=[i.kind];if("array"===i.kind){let a=i.itemType;if("string"===a.kind||"number"===a.kind||"boolean"===a.kind){r.push(a.kind);let n=i.N;("number"==typeof n||this.args.length>1)&&r.push(n)}}return r.concat(this.args.map(i=>i.serialize()))}}class i1{constructor(i){this.type=iL,this.sections=i}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a=i[1];if(!Array.isArray(a)&&"object"==typeof a)return r.error("First argument must be an image or text section.");let n=[],o=!1;for(let a=1;a<=i.length-1;++a){let s=i[a];if(o&&"object"==typeof s&&!Array.isArray(s)){o=!1;let i=null;if(s["font-scale"]&&!(i=r.parseObjectValue(s["font-scale"],a,"font-scale",iE)))return null;let l=null;if(s["text-font"]&&!(l=r.parseObjectValue(s["text-font"],a,"text-font",iF(iA))))return null;let h=null;if(s["text-color"]&&!(h=r.parseObjectValue(s["text-color"],a,"text-color",iM)))return null;let u=n[n.length-1];u.scale=i,u.font=l,u.textColor=h}else{let s=r.parse(i[a],a,iD);if(!s)return null;let l=s.type.kind;if("string"!==l&&"value"!==l&&"null"!==l&&"resolvedImage"!==l)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new i1(n)}evaluate(i){return new iq(this.sections.map(r=>{let a=r.content.evaluate(i);return iU(iX(a),iz)?new iG("",a,null,null,null):new iG(iY(a),null,r.scale?r.scale.evaluate(i):null,r.font?r.font.evaluate(i).join(","):null,r.textColor?r.textColor.evaluate(i):null)}))}eachChild(i){for(let r of this.sections)i(r.content),r.scale&&i(r.scale),r.font&&i(r.font),r.textColor&&i(r.textColor)}outputDefined(){return!1}serialize(){let i=["format"];for(let r of this.sections){i.push(r.content.serialize());let a={};r.scale&&(a["font-scale"]=r.scale.serialize()),r.font&&(a["text-font"]=r.font.serialize()),r.textColor&&(a["text-color"]=r.textColor.serialize()),i.push(a)}return i}}class i2{constructor(i,r,a,n){this._imageWarnHistory={},this.type=iz,this.namePrimary=i,this.nameSecondary=r,a&&(this.paramsPrimary=a.params,this.iconsetIdPrimary=a.iconset?a.iconset.id:void 0),n&&(this.paramsSecondary=n.params,this.iconsetIdSecondary=n.iconset?n.iconset.id:void 0)}static parse(i,r){if(i.length<2)return r.error("Expected two or more arguments.");let a=1,n=[];for(let o=0;o<2;o++)if(!function(){if(a<i.length){let o=r.parse(i[a],a++,iA);return o?(n.push({image:o,options:{}}),!0):(r.error(n.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}()||!function(){if(a<i.length){let o=i[a];if(null===o||"object"!=typeof o||Array.isArray(o))return!0;let s=o.params,l=o.iconset,h=r.concat(a);if(!s&&!l)return a++,!0;if(s){if("object"!=typeof s||s.constructor!==Object)return h.error('Image options "params" should be an object'),!1;let i={},r=h.concat(void 0,"params");for(let a in s){if(!a)return r.error("Image parameter name should be non-empty"),!1;let n=r.concat(void 0,a).parse(s[a],void 0,iM,void 0,{typeAnnotation:"coerce"});if(!n)return!1;i[a]=n}n[n.length-1].options.params=i}if(l){if("object"!=typeof l||l.constructor!==Object)return h.error('Image options "iconset" should be an object'),!1;if(!l.id)return h.error('Image options "iconset" should have an "id" property'),!1;n[n.length-1].options.iconset=l}return a++,!0}return!0}())return;return new i2(n[0].image,n[1]?n[1].image:void 0,n[0].options,n[1]?n[1].options:void 0)}evaluateParams(i,r){let a={};if(r){for(let n in r)if(r[n])try{a[n]=r[n].evaluate(i)}catch(i){continue}if(0!==Object.keys(a).length)return{params:a}}}evaluate(i){let r={name:this.namePrimary.evaluate(i),iconsetId:this.iconsetIdPrimary},a=this.nameSecondary?{name:this.nameSecondary.evaluate(i),iconsetId:this.iconsetIdSecondary}:void 0,n=iH.build(r,a,this.paramsPrimary?this.evaluateParams(i,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(i,this.paramsSecondary):void 0);if(n&&i.availableImages){let r=n.getPrimary().id;if(n.available=i.availableImages.some(i=>ic.isEqual(i,r)),n.available){let r=n.getSecondary()?n.getSecondary().id:null;r&&(n.available=i.availableImages.some(i=>ic.isEqual(i,r)))}}return n}eachChild(i){if(i(this.namePrimary),this.paramsPrimary)for(let r in this.paramsPrimary)this.paramsPrimary[r]&&i(this.paramsPrimary[r]);if(this.nameSecondary&&(i(this.nameSecondary),this.paramsSecondary))for(let r in this.paramsSecondary)this.paramsSecondary[r]&&i(this.paramsSecondary[r])}outputDefined(){return!1}serializeOptions(i,r){let a={};
1if(r&&(a.iconset={id:r}),i)for(let r in a.params={},i)i[r]&&(a.params[r]=i[r].serialize());return Object.keys(a).length>0?a:void 0}serialize(){let i=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){let r=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);r&&i.push(r)}if(this.nameSecondary&&(i.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){let r=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);r&&i.push(r)}return i}}function i3(i){return i4(i)?"string":i6(i)?"number":i8(i)?"boolean":Array.isArray(i)?"array":null===i?"null":i5(i)?"object":typeof i}function i5(i){return null!=i&&!Array.isArray(i)&&"function"!=typeof i&&!(i instanceof String||i instanceof Number||i instanceof Boolean)&&"object"==typeof i}function i4(i){return"string"==typeof i||i instanceof String}function i6(i){return"number"==typeof i||i instanceof Number}function i8(i){return"boolean"==typeof i||i instanceof Boolean}let i9={"to-boolean":iC,"to-color":iM,"to-number":iE,"to-string":iA};class i7{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a=i[0],n=[],o=iI;if("to-array"===a){if(!Array.isArray(i[1]))return null;let a=i[1].length;if(r.expectedType){if("array"!==r.expectedType.kind)return r.error(`Expected ${r.expectedType.kind} but found array.`);o=iF(r.expectedType.itemType,a)}else{if(!(a>0&&iW(i[1][0])))return null;o=iF(iX(i[1][0]),a)}for(let s=0;s<a;s++){let a,l=i[1][s];if(Array.isArray(l))a=r.parse(l,void 0,o.itemType);else{let i=i3(l);if(i!==o.itemType.kind)return r.error(`Expected ${o.itemType.kind} but found ${i}.`);a=r.registry.literal.parse(["literal",void 0===l?null:l],r)}if(!a)return null;n.push(a)}}else{if(("to-boolean"===a||"to-string"===a)&&2!==i.length)return r.error("Expected one argument.");o=i9[a];for(let a=1;a<i.length;a++){let o=r.parse(i[a],a,iD);if(!o)return null;n.push(o)}}return new i7(o,n)}evaluate(i){if("boolean"===this.type.kind)return!!this.args[0].evaluate(i);if("color"===this.type.kind){let r,a;for(let n of this.args){if(r=n.evaluate(i),a=null,r instanceof i_)return r;if("string"==typeof r){let a=i.parseColor(r);if(a)return a}else if(Array.isArray(r)&&!(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:iZ(r[0],r[1],r[2],r[3])))return new i_(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new iJ(a||`Could not parse color from value '${"string"==typeof r?r:String(JSON.stringify(r))}'`)}if("number"===this.type.kind){let r=null;for(let a of this.args){if(null===(r=a.evaluate(i)))return 0;let n=Number(r);if(!isNaN(n))return n}throw new iJ(`Could not convert ${JSON.stringify(r)} to number.`)}return"formatted"===this.type.kind?iq.fromString(iY(this.args[0].evaluate(i))):"resolvedImage"===this.type.kind?iH.build(iY(this.args[0].evaluate(i))):"array"===this.type.kind?this.args.map(r=>r.evaluate(i)):iY(this.args[0].evaluate(i))}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){if("formatted"===this.type.kind)return new i1([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new i2(this.args[0]).serialize();let i="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(r=>{i.push(r.serialize())}),i}}let re=["Unknown","Point","LineString","Polygon"];class rt{constructor(i,r,a){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=i,this.options=r,this.iconImageUseTheme=a}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?re[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||{}}measureLight(i){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:a,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(a*r-i[0])+this.featureDistanceData.bearing[1]*(n*r-i[1])}return 0}parseColor(i){let r=this._parseColorCache[i];return r||(r=this._parseColorCache[i]=i_.parse(i)),r}getConfig(i){return this.options?this.options.get(i):null}}class ri{constructor(i,r,a,n,o){this.name=i,this.type=r,this._evaluate=a,this.args=n,this._overloadIndex=o}evaluate(i){if(!this._evaluate){let i=ri.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(i,this.args)}
1eachChild(i){this.args.forEach(i)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(i=>i.serialize()))}static parse(i,r){let a=i[0],n=ri.definitions[a];if(!n)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,l=[],h=null,u=-1;for(let[n,c]of s){if(Array.isArray(n)&&n.length!==i.length-1)continue;l.push(n),u++,h=new r0(r.registry,r.path,null,r.scope,void 0,r._scope,r.options,r.iconImageUseTheme);let s=[],d=!1;for(let r=1;r<i.length;r++){let a=i[r],o=Array.isArray(n)?n[r-1]:n.type,l=h.parse(a,1+s.length,o);if(!l){d=!0;break}s.push(l)}if(!d)if(Array.isArray(n)&&n.length!==s.length)h.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else{for(let i=0;i<s.length;i++){let r=Array.isArray(n)?n[i]:n.type,a=s[i];h.concat(i+1).checkSubtype(r,a.type)}if(0===h.errors.length)return new ri(a,o,c,s,u)}}if(1===l.length)r.errors.push(...h.errors);else{let a=(l.length?l:s.map(([i])=>i)).map(rr).join(" | "),n=[];for(let a=1;a<i.length;a++){let o=r.parse(i[a],1+n.length);if(!o)return null;n.push(iO(o.type))}r.error(`Expected arguments of type ${a}, but found (${n.join(", ")}) instead.`)}return null}static register(i,r){for(let a in ri.definitions=r,r)i[a]=ri}}function rr(i){return Array.isArray(i)?`(${i.map(iO).join(", ")})`:`(${iO(i.type)}...)`}class ra{constructor(i,r,a){this.type=iR,this.locale=a,this.caseSensitive=i,this.diacriticSensitive=r}static parse(i,r){if(2!==i.length)return r.error("Expected one argument."),null;let a=i[1];if("object"!=typeof a||Array.isArray(a))return r.error("Collator options argument must be an object."),null;let n=void 0===a["case-sensitive"]?r.parse(!1,1,iC):r.parseObjectValue(a["case-sensitive"],1,"case-sensitive",iC);if(!n)return null;let o=void 0===a["diacritic-sensitive"]?r.parse(!1,1,iC):r.parseObjectValue(a["diacritic-sensitive"],1,"diacritic-sensitive",iC);if(!o)return null;let s=null;return!a.locale||(s=r.parseObjectValue(a.locale,1,"locale",iA))?new ra(n,o,s):null}evaluate(i){return new ij(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}serialize(){let i={};return i["case-sensitive"]=this.caseSensitive.serialize(),i["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(i.locale=this.locale.serialize()),["collator",i]}}function rn(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}function ro(i,r){i[0]=Math.min(i[0],r[0]),i[1]=Math.min(i[1],r[1]),i[2]=Math.max(i[2],r[0]),i[3]=Math.max(i[3],r[1])}function rs(i,r){return!(i[0]<=r[0]||i[2]>=r[2]||i[1]<=r[1]||i[3]>=r[3])}function rl(i,r,a=!1){let n=!1;for(let o=0,s=r.length;o<s;o++){let s=r[o];for(let r=0,o=s.length,l=o-1;r<o;l=r++){let o=s[l],h=s[r];if(function(i,r,a){let n=i[0]-r[0],o=i[1]-r[1],s=i[0]-a[0],l=i[1]-a[1];return n*l-s*o==0&&n*s<=0&&o*l<=0}(i,o,h))return a;o[1]>i[1]!=h[1]>i[1]&&i[0]<(h[0]-o[0])*(i[1]-o[1])/(h[1]-o[1])+o[0]&&(n=!n)}}return n}function rh(i,r,a,n){let o=n[0]-a[0],s=n[1]-a[1],l=(i[0]-a[0])*s-o*(i[1]-a[1]),h=(r[0]-a[0])*s-o*(r[1]-a[1]);return l>0&&h<0||l<0&&h>0}function ru(i,r,a,n){var o,s;return 0!=(o=[n[0]-a[0],n[1]-a[1]])[0]*(s=[r[0]-i[0],r[1]-i[1]])[1]-o[1]*s[0]&&!(!rh(i,r,a,n)||!rh(a,n,i,r))}function rc(i){let r=new e4(1/0,1/0),a=new e4(-1/0,-1/0);for(let n of i[0])r.x>n.x&&(r.x=n.x),r.y>n.y&&(r.y=n.y),a.x<n.x&&(a.x=n.x),a.y<n.y&&(a.y=n.y);return{min:r,max:a}}function rd(i,r){for(let a=0;a<i.length;++a)if(!rl(i[a],r))return!1;for(let a=0;a<i.length-1;++a)if(function(i,r,a){for(let n of a)for(let a=0,o=n.length,s=o-1;a<o;s=a++)if(ru(i,r,n[s],n[a]))return!0;return!1}(i[a],i[a+1],r))return!1;return!0}function rp(i,r,a){let n=[];for(let o=0;o<i.length;o++){let s=[];for(let n=0;n<i[o].length;n++){let l=function(i,r){let a=(180+i[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,r.z);return[Math.round(a*o*8192),Math.round(n*o*8192)]}(i[o][n],a);ro(r,l),s.push(l)}n.push(s)}return n}function rf(i,r,a){let n=[];for(let o=0;o<i.length;o++){let s=rp(i[o],r,a);n.push(s)}return n}function rm(i,r,a,n){if(i[0]<a[0]||i[0]>a[2]){let r=.5*n,o=i[0]-a[0]>r?-n:a[0]-i[0]>r?n:0;0===o&&(o=i[0]-a[2]>r?-n:a[2]-i[0]>r?n:0),i[0]+=o}ro(r,i)}function r_(i,r,a,n){let o=8192*Math.pow(2,n.z),s=[8192*n.x,8192*n.y],l=[];
1if(!i)return l;for(let n of i)for(let i of n){let n=[i.x+s[0],i.y+s[1]];rm(n,r,a,o),l.push(n)}return l}function rg(i,r,a,n){let o=8192*Math.pow(2,n.z),s=[8192*n.x,8192*n.y],l=[];if(!i)return l;for(let a of i){let i=[];for(let n of a){let a=[n.x+s[0],n.y+s[1]];ro(r,a),i.push(a)}l.push(i)}if(r[2]-r[0]<=o/2)for(let i of(r[0]=r[1]=1/0,r[2]=r[3]=-1/0,l))for(let n of i)rm(n,r,a,o);return l}class ry{constructor(i,r){this.type=iC,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(iW(i[1])){let r=i[1];if("FeatureCollection"===r.type)for(let i=0;i<r.features.length;++i){let a=r.features[i].geometry.type;if("Polygon"===a||"MultiPolygon"===a)return new ry(r,r.features[i].geometry)}else if("Feature"===r.type){let i=r.geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new ry(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new ry(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(null!=i.geometry()&&null!=i.canonicalID()){if("Point"===i.geometryType())return function(i,r){let a=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=rp(r.coordinates,n,o),l=r_(i.geometry(),a,n,o);if(!rs(a,n))return!1;for(let i of l)if(!rl(i,s))return!1}if("MultiPolygon"===r.type){let s=rf(r.coordinates,n,o),l=r_(i.geometry(),a,n,o);if(!rs(a,n))return!1;for(let i of l)if(!function(i,r){for(let a=0;a<r.length;a++)if(rl(i,r[a]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries);if("LineString"===i.geometryType())return function(i,r){let a=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=rp(r.coordinates,n,o),l=rg(i.geometry(),a,n,o);if(!rs(a,n))return!1;for(let i of l)if(!rd(i,s))return!1}if("MultiPolygon"===r.type){let s=rf(r.coordinates,n,o),l=rg(i.geometry(),a,n,o);if(!rs(a,n))return!1;for(let i of l)if(!function(i,r){for(let a=0;a<r.length;a++)if(rd(i,r[a]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}let rx={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},rv=1/298.257223563*(2-1/298.257223563),rb=Math.PI/180;class rw{static fromTile(i,r,a){let n=Math.PI*(1-2*(i+.5)/Math.pow(2,r));return new rw(Math.atan(.5*(Math.exp(n)-Math.exp(-n)))/rb,a)}static get units(){return rx}constructor(i,r){if(void 0===i)throw Error("No latitude given.");if(r&&!rx[r])throw Error(`Unknown unit ${r}. Use one of: ${Object.keys(rx).join(", ")}`);const a=6378.137*rb*(r?rx[r]:1),n=Math.cos(i*rb),o=1/(1-rv*(1-n*n)),s=Math.sqrt(o);this.kx=a*s*n,this.ky=a*s*o*(1-rv)}distance(i,r){let a=rI(i[0]-r[0])*this.kx,n=(i[1]-r[1])*this.ky;return Math.sqrt(a*a+n*n)}bearing(i,r){return Math.atan2(rI(r[0]-i[0])*this.kx,(r[1]-i[1])*this.ky)/rb}destination(i,r,a){let n=a*rb;return this.offset(i,Math.sin(n)*r,Math.cos(n)*r)}offset(i,r,a){return[i[0]+r/this.kx,i[1]+a/this.ky]}lineDistance(i){let r=0;for(let a=0;a<i.length-1;a++)r+=this.distance(i[a],i[a+1]);return r}area(i){let r=0;for(let a=0;a<i.length;a++){let n=i[a];for(let i=0,o=n.length,s=o-1;i<o;s=i++)r+=rI(n[i][0]-n[s][0])*(n[i][1]+n[s][1])*(a?-1:1)}return Math.abs(r)/2*this.kx*this.ky}along(i,r){let a=0;if(r<=0)return i[0];for(let n=0;n<i.length-1;n++){let o=i[n],s=i[n+1],l=this.distance(o,s);if((a+=l)>r)return rS(o,s,(r-(a-l))/l)}return i[i.length-1]}pointToSegmentDistance(i,r,a){let[n,o]=r,s=rI(a[0]-n)*this.kx,l=(a[1]-o)*this.ky;if(0!==s||0!==l){let r=(rI(i[0]-n)*this.kx*s+(i[1]-o)*this.ky*l)/(s*s+l*l);r>1?(n=a[0],o=a[1]):r>0&&(n+=s/this.kx*r,o+=l/this.ky*r)}return Math.sqrt((s=rI(i[0]-n)*this.kx)*s+(l=(i[1]-o)*this.ky)*l)}pointOnLine(i,r){let a=1/0,n=i[0][0],o=i[0][1],s=0,l=0;for(let h=0;h<i.length-1;h++){let u=i[h][0],c=i[h][1],d=rI(i[h+1][0]-u)*this.kx,p=(i[h+1][1]-c)*this.ky,f=0;0===d&&0===p||((f=(rI(r[0]-u)*this.kx*d+(r[1]-c)*this.ky*p)/(d*d+p*p))>1?(u=i[h+1][0],c=i[h+1][1]):f>0&&(u+=d/this.kx*f,c+=p/this.ky*f));let m=(d=rI(r[0]-u)*this.kx)*d+(p=(r[1]-c)*this.ky)*p;m<a&&(a=m,n=u,o=c,s=h,l=f)}return{point:[n,o],index:s,t:Math.max(0,Math.min(1,l))}}lineSlice(i,r,a){let n=this.pointOnLine(a,i),o=this.pointOnLine(a,r);if(n.index>o.index||n.index===o.index&&n.t>o.t){let i=n;n=o,o=i}let s=[n.point],l=n.index+1,h=o.index;!rT(a[l],s[0])&&l<=h&&s.push(a[l]);for(let i=l+1;i<=h;i++)s.push(a[i]);return rT(a[h],o.point)||s.push(o.point),s}lineSliceAlong(i,r,a){let n=0,o=[];for(let s=0;s<a.length-1;s++){let l=a[s],h=a[s+1],u=this.distance(l,h);if((n+=u)>i&&0===o.length&&o.push(rS(l,h,(i-(n-u))/u)),n>=r)return o.push(rS(l,h,(r-(n-u))/u)),o;n>i&&o.push(h)}return o}bufferPoint(i,r){let a=r/this.ky,n=r/this.kx;return[i[0]-n,i[1]-a,i[0]+n,i[1]+a]}bufferBBox(i,r){let a=r/this.ky,n=r/this.kx;return[i[0]-n,i[1]-a,i[2]+n,i[3]+a]}insideBBox(i,r){return rI(i[0]-r[0])>=0&&0>=rI(i[0]-r[2])&&i[1]>=r[1]&&i[1]<=r[3]}}function rT(i,r){return i[0]===r[0]&&i[1]===r[1]}function rS(i,r,a){let n=rI(r[0]-i[0]);return[i[0]+n*a,i[1]+(r[1]-i[1])*a]}function rI(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}class rE{constructor(i=[],r=(i,r)=>i<r?-1:+(i>r)){if(this.data=i,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(i){this.data.push(i),this._up(this.length++)}pop(){if(0===this.length)return;let i=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:r,compare:a}=this,n=r[i];for(;i>0;){let o=i-1>>1,s=r[o];if(a(n,s)>=0)break;r[i]=s,i=o}r[i]=n}_down(i){let{data:r,compare:a}=this,n=this.length>>1,o=r[i];for(;i<n;){let n=1+(i<<1),s=n+1;if(s<this.length&&0>a(r[s],r[n])&&(n=s),a(r[n],o)>=0)break;r[i]=r[n],i=n}r[i]=o}}function rA(i,r){return r.dist-i.dist}function rC(i){let r=[1/0,1/0,-1/0,-1/0];if(r.length!==i.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==i[a])return!1;return!0}function rM(i){return i[1]-i[0]+1}function rP(i,r){let a=i[1]>=i[0]&&i[1]<r;return a||console.warn("Distance Expression: Index is out of range"),a}function rD(i,r){if(i[0]>
1i[1])return[null,null];let a=rM(i);if(r){if(2===a)return[i,null];let r=Math.floor(a/2);return[[i[0],i[0]+r],[i[0]+r,i[1]]]}{if(1===a)return[i,null];let r=Math.floor(a/2)-1;return[[i[0],i[0]+r],[i[0]+r+1,i[1]]]}}function rR(i,r){let a=[1/0,1/0,-1/0,-1/0];if(!rP(r,i.length))return a;for(let n=r[0];n<=r[1];++n)ro(a,i[n]);return a}function rL(i){let r=[1/0,1/0,-1/0,-1/0];for(let a=0;a<i.length;++a)for(let n=0;n<i[a].length;++n)ro(r,i[a][n]);return r}function rz(i,r,a){if(rC(i)||rC(r))return NaN;let n=0,o=0;return i[2]<r[0]&&(n=r[0]-i[2]),i[0]>r[2]&&(n=i[0]-r[2]),i[1]>r[3]&&(o=i[1]-r[3]),i[3]<r[1]&&(o=r[1]-i[3]),a.distance([0,0],[n,o])}function rF(i,r,a=8192){let n=Math.pow(2,r.z),o=(i.y/a+r.y)/n;return[360*((i.x/a+r.x)/n)-180,360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180))-90]}function rO(i,r,a){let n=a.pointOnLine(r,i).point;return a.distance(i,n)}function rB(i,r,a,n,o){let s=a.slice(n[0],n[1]+1),l=1/0;for(let a=r[0];a<=r[1];++a)if(0===(l=Math.min(l,rO(i[a],s,o))))return 0;return l}function rk(i,r,a,n,o){return Math.min(Math.min(o.pointToSegmentDistance(i,a,n),o.pointToSegmentDistance(r,a,n)),Math.min(o.pointToSegmentDistance(a,i,r),o.pointToSegmentDistance(n,i,r)))}function rV(i,r){for(let a of i)for(let i=0;i<=a.length-1;++i)if(rl(a[i],r,!0))return!0;return!1}function rN(i,r,a,n,o,s,l){if(null===s||null===l)return;let h=rz(rR(n,s),rR(o,l),a);h<r&&i.push({dist:h,range1:s,range2:l})}function rU(i,r,a,n,o,s=1/0){let l=Math.min(s,o.distance(i[0],a[0]));if(0===l)return l;let h=new rE([{dist:0,range1:[0,i.length-1],range2:[0,a.length-1]}],rA),u=r?50:100,c=n?50:100;for(;h.length;){let s=h.pop();if(s.dist>=l)continue;let d=s.range1,p=s.range2;if(rM(d)<=u&&rM(p)<=c){if(!rP(d,i.length)||!rP(p,a.length))return NaN;if(r&&n?l=Math.min(l,function(i,r,a,n,o){if(!rP(r,i.length)||!rP(n,a.length))return NaN;let s=1/0;for(let l=r[0];l<r[1];++l)for(let r=n[0];r<n[1];++r){if(ru(i[l],i[l+1],a[r],a[r+1]))return 0;s=Math.min(s,rk(i[l],i[l+1],a[r],a[r+1],o))}return s}(i,d,a,p,o)):r||n?r&&!n?l=Math.min(l,rB(a,p,i,d,o)):!r&&n&&(l=Math.min(l,rB(i,d,a,p,o))):l=Math.min(l,function(i,r,a,n,o){if(!rP(r,i.length)||!rP(n,a.length))return NaN;let s=1/0;for(let l=r[0];l<=r[1];++l)for(let r=n[0];r<=n[1];++r)if(0===(s=Math.min(s,o.distance(i[l],a[r]))))return s;return s}(i,d,a,p,o)),0===l)break}else{let s=rD(d,r),u=rD(p,n);rN(h,l,o,i,a,s[0],u[0]),rN(h,l,o,i,a,s[0],u[1]),rN(h,l,o,i,a,s[1],u[0]),rN(h,l,o,i,a,s[1],u[1])}}return l}function rj(i,r,a,n,o=1/0){let s=o,l=rR(i,[0,i.length-1]);for(let o of a)if(!(s!==1/0&&rz(l,rR(o,[0,o.length-1]),n)>=s)&&0===(s=Math.min(s,rU(i,r,o,!0,n,s))))break;return s}function rG(i,r,a,n,o=1/0){let s=o,l=rR(i,[0,i.length-1]);for(let o of a){if(s!==1/0&&rz(l,rL(o),n)>=s)continue;let a=function(i,r,a,n,o=1/0){let s=Math.min(n.distance(i[0],a[0][0]),o);if(0===s)return s;let l=new rE([{dist:0,range1:[0,i.length-1],range2:[0,0]}],rA),h=r?50:100,u=rL(a);for(;l.length;){let o=l.pop();if(o.dist>=s)continue;let c=o.range1;if(rM(c)<=h){if(!rP(c,i.length))return NaN;if(r){if(0===(s=Math.min(s,function(i,r,a,n){if(!rP(r,i.length))return NaN;for(let n=r[0];n<=r[1];++n)if(rl(i[n],a,!0))return 0;let o=1/0;for(let s=r[0];s<r[1];++s)for(let r of a)for(let a=0,l=r.length,h=l-1;a<l;h=a++){if(ru(i[s],i[s+1],r[h],r[a]))return 0;o=Math.min(o,rk(i[s],i[s+1],r[h],r[a],n))}return o}(i,c,a,n))))break}else for(let r=c[0];r<=c[1];++r)if(0===(s=Math.min(s,function(i,r,a){if(rl(i,r,!0))return 0;let n=1/0;for(let o of r){let r=o.length;if(r<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(o[0]!==o[r-1]&&0===(n=Math.min(n,a.pointToSegmentDistance(i,o[r-1],o[0])))||0===(n=Math.min(n,rO(i,o,a))))break}return n}(i[r],a,n))))return s}else{let a=rD(c,r);if(null!==a[0]){let r=rz(rR(i,a[0]),u,n);r<s&&l.push({dist:r,range1:a[0],range2:[0,0]})}if(null!==a[1]){let r=rz(rR(i,a[1]),u,n);r<s&&l.push({dist:r,range1:a[1],range2:[0,0]})}}}return s}(i,r,o,n,s);if(isNaN(a))return a;if(0===(s=Math.min(s,a)))break}return s}function rq(i){return"Point"===i||"MultiPoint"===i||"LineString"===i||"MultiLineString"===i||"Polygon"===i||"MultiPolygon"===i}class r${constructor(i,r){this.type=iE,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'distance' expression requires either one argument, but found ' ${i.length-1} instead.`);if(iW(i[1])){let r=i[1];if("FeatureCollection"===r.type){for(let i=0;i<r.features.length;++i)if(rq(r.features[i].geometry.type))return new r$(r,r.features[i].geometry)}else if("Feature"===r.type){if(rq(r.geometry.type))return new r$(r,r.geometry)}else if(rq(r.type))return new r$(r,r)}return r.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(i){let r=i.geometry(),a=i.canonicalID();
1if(null!=r&&null!=a){if("Point"===i.geometryType()){var n=this.geometries;let i=[];for(let n of r)for(let r of n)i.push(rF(r,a));let o=new rw(i[0][1],"meters");return"Point"===n.type||"MultiPoint"===n.type||"LineString"===n.type?rU(i,!1,"Point"===n.type?[n.coordinates]:n.coordinates,"LineString"===n.type,o):"MultiLineString"===n.type?rj(i,!1,n.coordinates,o):"Polygon"===n.type||"MultiPolygon"===n.type?rG(i,!1,"Polygon"===n.type?[n.coordinates]:n.coordinates,o):null}if("LineString"===i.geometryType())return function(i,r,a){let n=[];for(let a of i){let i=[];for(let n of a)i.push(rF(n,r));n.push(i)}let o=new rw(n[0][0][1],"meters");if("Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type)return rj("Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n,o);if("MultiLineString"===a.type){let i=1/0;for(let r=0;r<a.coordinates.length;r++){let s=rj(a.coordinates[r],!0,n,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}if("Polygon"===a.type||"MultiPolygon"===a.type){let i=1/0;for(let r=0;r<n.length;r++){let s=rG(n[r],!0,"Polygon"===a.type?[a.coordinates]:a.coordinates,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}return null}(r,a,this.geometries);if("Polygon"===i.geometryType())return function(i,r,a){let n=[];for(let a of function(i){let r,a,n=i.length;if(n<=1)return[i];let o=[];for(let s=0;s<n;s++){let n=function(i){let r=0;for(let a,n,o=0,s=i.length,l=s-1;o<s;l=o++)a=i[o],r+=((n=i[l]).x-a.x)*(a.y+n.y);return r}(i[s]);0!==n&&(i[s].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[i[s]]):r.push(i[s]))}return r&&o.push(r),o}(i)){let i=[];for(let n=0;n<a.length;++n)i.push(function(i,r){let a=[];for(let n=0;n<i.length;++n)a.push(rF(i[n],r));return a}(a[n],r));n.push(i)}let o=new rw(n[0][0][0][1],"meters");if("Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type)return rG("Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n,o);if("MultiLineString"===a.type){let i=1/0;for(let r=0;r<a.coordinates.length;r++){let s=rG(a.coordinates[r],!0,n,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}return"Polygon"===a.type||"MultiPolygon"===a.type?function(i,r,a){let n=1/0;for(let o of i)for(let i of r){let r=function(i,r,a,n=1/0){let o=rL(i),s=rL(r);if(n!==1/0&&rz(o,s,a)>=n)return n;if(rs(o,s)){if(rV(i,r))return 0}else if(rV(r,i))return 0;let l=n;for(let n of i)for(let i=0,o=n.length,s=o-1;i<o;s=i++)for(let o of r)for(let r=0,h=o.length,u=h-1;r<h;u=r++){if(ru(n[s],n[i],o[u],o[r]))return 0;l=Math.min(l,rk(n[s],n[i],o[u],o[r],a))}return l}(o,i,a,n);if(isNaN(r))return r;if(0===(n=Math.min(n,r)))return n}return n}("Polygon"===a.type?[a.coordinates]:a.coordinates,n,o):null}(r,a,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requires valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function rH(i){if(i instanceof ri&&("get"===i.name&&1===i.args.length||"feature-state"===i.name||"has"===i.name&&1===i.args.length||"properties"===i.name||"geometry-type"===i.name||"id"===i.name||/^filter-/.test(i.name))||i instanceof ry||i instanceof r$)return!1;if(i instanceof rJ)return i.featureConstant;let r=!0;return i.eachChild(i=>{r&&!rH(i)&&(r=!1)}),r}function rZ(i){if(i instanceof ri&&"feature-state"===i.name)return!1;let r=!0;return i.eachChild(i=>{r&&!rZ(i)&&(r=!1)}),r}function rW(i,r){if(i instanceof ri&&r.indexOf(i.name)>=0)return!1;let a=!0;return i.eachChild(i=>{a&&!rW(i,r)&&(a=!1)}),a}function rX(i,r,a){return[i,r,a].filter(Boolean).join("\x1f")}function rY(i,r){switch(i){case"string":return iY(r);case"number":return+r;case"boolean":return!!r;case"color":return i_.parse(r);case"formatted":return iq.fromString(iY(r));case"resolvedImage":return iH.build(iY(r))}return r}function rK(i,r,a,n){return void 0!==n&&(i=n*Math.round(i/n)),void 0!==r&&i<r&&(i=r),void 0!==a&&i>a&&(i=a),i}class rJ{constructor(i,r,a,n=!1){this.type=i,this.key=r,this.scope=a,this.featureConstant=n}static parse(i,r){let a=r.expectedType;if(null==a&&(a=iD),i.length<2||i.length>3)return r.error("Invalid number of arguments for 'config' expression.");let n=r.parse(i[1],1);if(!(n instanceof iK))return r.error("Key name of 'config' expression must be a string literal.");let o,s=!0,l=iY(n.value);if(i.length>=3){let a=r.parse(i[2],2);if(!(a instanceof iK))return r.error("Scope of 'config' expression must be a string literal.");o=iY(a.value)}if(r.options){let i=rX(l,o,r._scope),a=r.options.get(i);a&&(s=rH(a.value||a.default))}return new rJ(a,l,o,s)}evaluate(i){let r=rX(this.key,this.scope,i.scope),a=i.getConfig(r);if(!a)return null;let{type:n,value:o,values:s,minValue:l,maxValue:h,stepValue:u}=a,c=a.default.evaluate(i),d=c;if(o){let r=i.scope;i.scope=(r||"").split("\x1f").slice(1).join("\x1f"),d=o.evaluate(i),i.scope=r}return n&&(d=rY(n,d)),void 0===d||void 0===l&&void 0===h&&void 0===u||("number"==typeof d?d=rK(d,l,h,u):Array.isArray(d)&&(d=d.map(i=>"number"==typeof i?rK(i,l,h,u):i))),void 0!==o&&void 0!==d&&s&&!s.includes(d)&&(d=c,n&&(d=rY(n,d))),(n&&n!==this.type||void 0!==d&&!iU(iX(d),this.type))&&(d=rY(this.t
1ype.kind,d)),d}eachChild(){}outputDefined(){return!1}serialize(){let i=["config",this.key];return this.scope&&i.concat(this.scope),i}}class rQ{constructor(i,r){this.type=r.type,this.name=i,this.boundExpression=r}static parse(i,r){if(2!==i.length||"string"!=typeof i[1])return r.error("'var' expression requires exactly one string literal argument.");let a=i[1];return r.scope.has(a)?new rQ(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class r0{constructor(i,r=[],a,n=new iS,o=[],s,l,h){this.registry=i,this.path=r,this.key=r.map(i=>"string"==typeof i?`['${i}']`:`[${i}]`).join(""),this.scope=n,this.errors=o,this.expectedType=a,this._scope=s,this.options=l,this.iconImageUseTheme=h}parse(i,r,a,n,o={}){return r||a?this.concat(r,null,a,n)._parse(i,o):this._parse(i,o)}parseObjectValue(i,r,a,n,o,s={}){return this.concat(r,a,n,o)._parse(i,s)}_parse(i,r){function a(i,r,a){return"assert"===a?new i0(r,[i]):"coerce"===a?new i7(r,[i]):i}if(null!==i&&"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i||(i=["literal",i]),Array.isArray(i)){if(0===i.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n="string"==typeof i[0]?this.registry[i[0]]:void 0;if(n){let o=n.parse(i,this);if(!o)return null;if(this.expectedType){let i=this.expectedType,n=o.type;if("string"!==i.kind&&"number"!==i.kind&&"boolean"!==i.kind&&"object"!==i.kind&&"array"!==i.kind||"value"!==n.kind)if("color"!==i.kind&&"formatted"!==i.kind&&"resolvedImage"!==i.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(i,n))return null}else o=a(o,i,r.typeAnnotation||"coerce");else o=a(o,i,r.typeAnnotation||"assert")}if(!(o instanceof iK)&&"resolvedImage"!==o.type.kind&&function i(r){if(r instanceof rQ)return i(r.boundExpression);if(r instanceof ri&&"error"===r.name||r instanceof ra||r instanceof ry||r instanceof r$||r instanceof rJ)return!1;let a=r instanceof i7||r instanceof i0,n=!0;return r.eachChild(r=>{n=a?n&&i(r):n&&r instanceof iK}),!!n&&rH(r)&&rW(r,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed","is-active-floor"])}(o)){let i=new rt(this._scope,this.options,this.iconImageUseTheme);try{o=new iK(o.type,o.evaluate(i))}catch(i){return this.error(i.message),null}}return o}return i7.parse(["to-array",i],this)}return this.error(void 0===i?"'undefined' value invalid. Use null instead.":"object"==typeof i?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,r,a,n){let o="number"==typeof i?this.path.concat(i):this.path;o="string"==typeof r?o.concat(r):o;let s=n?this.scope.concat(n):this.scope;return new r0(this.registry,o,a||null,s,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(i,...r){let a=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new iT(a,i))}checkSubtype(i,r){let a=ik(i,r);return a&&this.error(a),a}}function r1(i,r){let a=i.length-1,n,o,s=0,l=a,h=0;for(;s<=l;)if(n=i[h=Math.floor((s+l)/2)],o=i[h+1],n<=r){if(h===a||r<o)return h;s=h+1}else{if(!(n>r))throw new iJ("Input is not a number.");l=h-1}return 0}class r2{constructor(i,r,a){for(const[n,o]of(this.type=i,this.input=r,this.labels=[],this.outputs=[],a))this.labels.push(n),this.outputs.push(o)}static parse(i,r){if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");let a=r.parse(i[1],1,iE);if(!a)return null;let n=[],o=null;r.expectedType&&"value"!==r.expectedType.kind&&(o=r.expectedType);for(let a=1;a<i.length;a+=2){let s=1===a?-1/0:i[a],l=i[a+1],h=a,u=a+1;if("number"!=typeof s)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',h);if(n.length&&n[n.length-1][0]>=s)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);let c=r.parse(l,u,o);if(!c)return null;o=o||c.type,n.push([s,c])}return new r2(o,a,n)}evaluate(i){let r=this.labels,a=this.outputs;if(1===r.length)return a[0].evaluate(i);let n=this.input.evaluate(i);if(n<=r[0])return a[0].evaluate(i);let o=r.length;return n>=r[o-1]?a[o-1].evaluate(i):a[r1(r,n)].evaluate(i)}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&i.push(this.labels[r]),i.push(this.outputs[r].serialize());return i}}let r3=4/29,r5=6/29,r4=6/29*3*(6/29),r6=6/29*(6/29)*(6/29),r8=Math.PI/180,r9=180/Math.PI;function r7(i){return i>r6?Math.pow(i,1/3):i/r4+r3}function ae(i){return i>r5?i*i*i:r4*(i-r3)}function at(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function ai(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function ar(i){let r=ai(i.r),a=ai(i.g),n=ai(i.b),o=r7((.4124564*r+.3575761*a+.1804375*n)/.95047),s=r7((.2126729*r+.7151522*a+.072175*n)/1);return{l:116*s-16,a:500*(o-s),b:200*(s-r7((.0193339*r+.119192*a+.9503041*n)/1.08883)),alpha:i.a}}function aa(i){let r=(i.l+16)/116,a=isNaN(i.a)?r:r+i.a/500,n=isNaN(i.b)?r:r-i.b/200;return r=+ae(r),new i_(at(3.2404542*(a=.95047*ae(a))-1.5371385*r-.4985314*(n=1.08883*ae(n))),at(-.969266*a+1.8760108*r+.041556*n),at(.0556434*a-.2040259*r+1.0572252*n),i.alpha)}let an={forward:ar,reverse:aa,interpolate:function(i,r,a){return{l:iv(i.l,r.l,a),a:iv(i.a,r.a,a),b:iv(i.b,r.b,a),alpha:iv(i.alpha,r.alpha,a)}}},ao={forward:function(i){let{l:r,a:a,b:n}=ar(i),o=Math.atan2(n,a)*r9;return{h:o<0?o+360:o,c:Math.sqrt(a*a+n*n),l:r,alpha:i.a}},reverse:function(i){let r=i.h*r8,a=i.c;return aa({l:i.l,a:Math.cos(r)*a,b:Math.sin(r)*a,alpha:i.alpha})},interpolate:function(i,r,a){var n,o;let s;return{h:(n=i.h,o=r.h,s=o-n,n+a*(s>180||s<-180?s-360*Math.round(s/360):s)),c:iv(i.c,r.c,a),l:iv(i.l,r.l,a),alpha:iv(i.alpha,r.alpha,a)}}};var as=Object.freeze({__proto__:null,hcl:ao,lab:an});class al{constructor(i,r,a,n,o){for(const[s,l]of(this.type=i,this.operator=r,this.interpolation=a,this.input=n,this.labels=[],this.outputs=[],o))this.labels.push(s),this.outputs.push(l)}static interpolationFactor(i,r,a,n){let o=0;if("exponential"===i.name)o=ah(r,i.base,a,n);else if("linear"===i.name)o=ah(r,1,a,n);else if("cubic-bezier"===i.name){let s=i.controlPoints;o=new e5(s[0],s[1],s[2],s[3]).solve(ah(r,1,a,n))}return o}static parse(i,r){let[a,n,o,...s]=i;if(!Array.isArray(n)||0===n.length)return r.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){let i=n[1];if("number"!=typeof i)return r.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:i}}else{if("cubic-bezier"!==n[0])return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);{let i=n.slice(1);if(4!==i.length||i.some(i=>"number"!=typeof i||i<0||i>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:i}}}if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length-1>3&&(i.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(!(o=r.parse(o,2,iE)))return null;let l=[],h=null;"interpolate-hcl"===a||"interpolate-lab"===a?h=iM:r.expectedType&&"value"!==r.expectedType.kind&&(h=r.expectedType);for(let i=0;i<s.length;i+=2){let a=s[i],n=s[i+1],o=i+3,u=i+4;if("number"!=typeof a)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(l.length&&l[l.length-1][0]>=a)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);let c=r.parse(n,u,h);if(!c)return null;h=h||c.type,l.push([a,c])}return"number"===h.kind||"color"===h.kind||"array"===h.kind&&"number"===h.itemType.kind&&"number"==typeof h.N?new al(h,a,n,o,l):r.error(`Type ${iO(h)} is not interpolatable.`)}evaluate(i){let r=this.labels,a=this.outputs;if(1===r.length)return a[0].evaluate(i);let n=this.input.evaluate(i);if(n<=r[0])return a[0].evaluate(i);let o=r.length;if(n>=r[o-1])return a[o-1].evaluate(i);let s=r1(r,n),l=al.interpolationFactor(this.interpolation,n,r[s],r[s+1]),h=a[s].evaluate(i),u=a[s+1].evaluate(i);return"interpolate"===this.operator?iw[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?ao.reverse(ao.interpolate(ao.forward(h
1),ao.forward(u),l)):an.reverse(an.interpolate(an.forward(h),an.forward(u),l))}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i;i="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];let r=[this.operator,i,this.input.serialize()];for(let i=0;i<this.labels.length;i++)r.push(this.labels[i],this.outputs[i].serialize());return r}}function ah(i,r,a,n){let o=n-a,s=i-a;return 0===o?0:1===r?s/o:(Math.pow(r,s)-1)/(Math.pow(r,o)-1)}class au{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expectected at least one argument."),null;let a=null,n=r.expectedType;n&&"value"!==n.kind&&(a=n);let o=[];for(let n of i.slice(1)){let i=r.parse(n,1+o.length,a,void 0,{typeAnnotation:"omit"});if(!i)return null;a=a||i.type,o.push(i)}return new au(n&&o.some(i=>ik(n,i.type))?iD:a,o)}evaluate(i){let r,a=null,n=0;for(let o of this.args){if(n++,(a=o.evaluate(i))&&a instanceof iH&&!a.available&&(r||(r=a),a=null,n===this.args.length))return r;if(null!==a)break}return a}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=["coalesce"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class ac{constructor(i,r){this.type=r.type,this.bindings=[].concat(i),this.result=r}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(let r of this.bindings)i(r[1]);i(this.result)}static parse(i,r){if(i.length<4)return r.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);let a=[];for(let n=1;n<i.length-1;n+=2){let o=i[n];if("string"!=typeof o)return r.error(`Expected string, but found ${typeof o} instead.`,n);if(/[^a-zA-Z0-9_]/.test(o))return r.error("Variable names must contain only alphanumeric characters or '_'.",n);let s=r.parse(i[n+1],n+1);if(!s)return null;a.push([o,s])}let n=r.parse(i[i.length-1],i.length-1,r.expectedType,a);return n?new ac(a,n):null}outputDefined(){return this.result.outputDefined()}serialize(){let i=["let"];for(let[r,a]of this.bindings)i.push(r,a.serialize());return i.push(this.result.serialize()),i}}class ad{constructor(i,r,a){this.type=i,this.index=r,this.input=a}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iE),n=r.parse(i[2],2,iF(r.expectedType||iD));return a&&n?new ad(n.type.itemType,a,n):null}evaluate(i){let r=this.index.evaluate(i),a=this.input.evaluate(i);if(r<0)throw new iJ("Array index out of bounds: negative index");if(r>=a.length)throw new iJ("Array index out of bounds: index exceeds array size");if(r!==Math.floor(r))throw new iJ("Array index must be an integer. Use at-interpolated for fractional indices");return a[r]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class ap{constructor(i,r,a){this.type=i,this.index=r,this.input=a}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iE),n=r.parse(i[2],2,iF(r.expectedType||iD));return a&&n?new ap(n.type.itemType,a,n):null}evaluate(i){let r=this.index.evaluate(i),a=this.input.evaluate(i);if(r<0)throw new iJ(`Array index out of bounds: ${r} < 0.`);if(r>a.length-1)throw new iJ(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r===Math.floor(r))return a[r];let n=Math.floor(r),o=Math.ceil(r),s=a[n],l=a[o];if("number"!=typeof s||"number"!=typeof l)throw new iJ(`Cannot interpolate between non-number values at index ${r}.`);let h=r-n;return s*(1-h)+l*h}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class af{constructor(i,r){this.type=iC,this.needle=i,this.haystack=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`),null;let a=r.parse(i[1],1,iD),n=r.parse(i[2],2,iD);return a&&n?iV(a.type,[iC,iA,iE,iI,iD])?new af(a,n):(r.error(`Expected first argument to be of type boolean, string, number or null, but found ${iO(a.type)} instead`),null):null}evaluate(i){let r=this.needle.evaluate(i),a=this.haystack.evaluate(i);if(null==a)return!1;if(!iN(r,["boolean","string","number","null"]))throw new iJ(`Expected first argument to be of type boolean, string, number or null, but found ${iO(iX(r))} instead.`);if(!iN(a,["string","array"]))throw new iJ(`Expected second argument to be of type array or string, but found ${iO(iX(a))} instead.`);return a.indexOf(r)>=0}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class am{constructor(i,r,a){this.type=iE,this.needle=i,this.haystack=r,this.fromIndex=a}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`),null;let a=r.parse(i[1],1,iD),n=r.parse(i[2],2,iD);if(!a||!n)return null;if(!iV(a.type,[iC,iA,iE,iI,iD]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${iO(a.type)} instead`),null;if(4===i.length){let o=r.parse(i[3],3,iE);return o?new am(a,n,o):null}return new am(a,n)}evaluate(i){let r=this.needle.evaluate(i),a=this.haystack.evaluate(i);if(!iN(r,["boolean","string","number","null"]))throw new iJ(`Expected first argument to be of type boolean, string, number or null, but found ${iO(iX(r))} instead.`);if(!iN(a,["string","array"]))throw new iJ(`Expected second argument to be of type array or string, but found ${iO(iX(a))} instead.`);if(this.fromIndex){let n=this.fromIndex.evaluate(i);return a.indexOf(r,n)}return a.indexOf(r)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let i=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),i]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class a_{constructor(i,r,a,n,o,s){this.inputType=i,this.type=r,this.input=a,this.cases=n,this.outputs=o,this.otherwise=s}static parse(i,r){let a,n;if(i.length<5)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return r.error("Expected an even number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);let o={},s=[];for(let l=2;l<i.length-1;l+=2){let h=i[l],u=i[l+1];Array.isArray(h)||(h=[h]);let c=r.concat(l);
1if(0===h.length)return c.error("Expected at least one branch label.");for(let i of h){if("number"!=typeof i&&"string"!=typeof i)return c.error("Branch labels must be numbers or strings.");if("number"==typeof i&&Math.abs(i)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof i&&Math.floor(i)!==i)return c.error("Numeric branch labels must be integer values.");if(a){if(c.checkSubtype(a,iX(i)))return null}else a=iX(i);if(void 0!==o[String(i)])return c.error("Branch labels must be unique.");o[String(i)]=s.length}let d=r.parse(u,l,n);if(!d)return null;n=n||d.type,s.push(d)}let l=r.parse(i[1],1,iD);if(!l)return null;let h=r.parse(i[i.length-1],i.length-1,n);return h?"value"!==l.type.kind&&r.concat(1).checkSubtype(a,l.type)?null:new a_(a,n,l,o,s,h):null}evaluate(i){let r=this.input.evaluate(i);return(iU(iX(r),this.inputType)&&this.outputs[this.cases[r]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),a=[],n={};for(let i of r){let r=n[this.cases[i]];void 0===r?(n[this.cases[i]]=a.length,a.push([this.cases[i],[i]])):a[r][1].push(i)}let o=i=>"number"===this.inputType.kind?Number(i):i;for(let[r,n]of a)i.push(1===n.length?o(n[0]):n.map(o)),i.push(this.outputs[r].serialize());return i.push(this.otherwise.serialize()),i}}class ag{constructor(i,r,a){this.type=i,this.branches=r,this.otherwise=a}static parse(i,r){let a;if(i.length<4)return r.error(`Expected at least 3 arguments, but found only ${i.length-1}.`),null;if(i.length%2!=0)return r.error("Expected an odd number of arguments."),null;r.expectedType&&"value"!==r.expectedType.kind&&(a=r.expectedType);let n=[];for(let o=1;o<i.length-1;o+=2){let s=r.parse(i[o],o,iC);if(!s)return null;let l=r.parse(i[o+1],o+1,a);if(!l)return null;n.push([s,l]),a=a||l.type}let o=r.parse(i[i.length-1],i.length-1,a);return o?new ag(a,n,o):null}evaluate(i){for(let[r,a]of this.branches)if(r.evaluate(i))return a.evaluate(i);return this.otherwise.evaluate(i)}eachChild(i){for(let[r,a]of this.branches)i(r),i(a);i(this.otherwise)}outputDefined(){return this.branches.every(([i,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["case"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class ay{constructor(i,r,a,n){this.type=i,this.input=r,this.beginIndex=a,this.endIndex=n}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`),null;let a=r.parse(i[1],1,iD),n=r.parse(i[2],2,iE);if(!a||!n)return null;if(!iV(a.type,[iF(iD),iA,iD]))return r.error(`Expected first argument to be of type array or string, but found ${iO(a.type)} instead`),null;if(4===i.length){let o=r.parse(i[3],3,iE);return o?new ay(a.type,a,n,o):null}return new ay(a.type,a,n)}evaluate(i){let r=this.input.evaluate(i),a=this.beginIndex.evaluate(i);if(!iN(r,["string","array"]))throw new iJ(`Expected first argument to be of type array or string, but found ${iO(iX(r))} instead.`);if(this.endIndex){let n=this.endIndex.evaluate(i);return r.slice(a,n)}return r.slice(a)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let i=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),i]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class ax{constructor(i,r){this.type=iF(iA),this.str=i,this.delimiter=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iA),n=r.parse(i[2],2,iA);return a&&n?new ax(a,n):void 0}evaluate(i){let r=this.str.evaluate(i),a=this.delimiter.evaluate(i);return r.split(a)}eachChild(i){i(this.str),i(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function av(i,r){return"=="===i||"!="===i?"boolean"===r.kind||"string"===r.kind||"number"===r.kind||"null"===r.kind||"value"===r.kind:"string"===r.kind||"number"===r.kind||"value"===r.kind}function ab(i,r,a,n){return 0===n.compare(r,a)}function aw(i,r,a){let n="=="!==i&&"!="!==i;return class o{constructor(i,r,a){this.type=iC,this.lhs=i,this.rhs=r,this.collator=a,this.hasUntypedArgument="value"===i.type.kind||"value"===r.type.kind}static parse(i,r){if(3!==i.length&&4!==i.length)return r.error("Expected two or three arguments.");let a=i[0],s=r.parse(i[1],1,iD);if(!s)return null;if(!av(a,s.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${iO(s.type)}'.`);let l=r.parse(i[2],2,iD);if(!l)return null;if(!av(a,l.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${iO(l.type)}'.`);if(s.type.kind!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error(`Cannot compare types '${iO(s.type)}' and '${iO(l.type)}'.`);n&&("value"===s.type.kind&&"value"!==l.type.kind?s=new i0(l.type,[s]):"value"!==s.type.kind&&"value"===l.type.kind&&(l=new i0(s.type,[l])));let h=null;if(4===i.length){if("string"!==s.type.kind&&"string"!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error("Cannot use collator to compare non-string types.");if(!(h=r.parse(i[3],3,iR)))return null}return new o(s,l,h)}evaluate(o){let s=this.lhs.evaluate(o),l=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let r=iX(s),a=iX(l);if(r.kind!==a.kind||"string"!==r.kind&&"number"!==r.kind)throw new iJ(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${r.kind}, ${a.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let i=iX(s),a=iX(l);if("string"!==i.kind||"string"!==a.kind)return r(o,s,l)}return this.collator?a(o,s,l,this.collator.evaluate(o)):r(o,s,l)}eachChild(i){i(this.lhs),i(this.rhs),this.collator&&i(this.collator)}outputDefined(){return!0}serialize(){let r=[i];return this.eachChild(i=>{r.push(i.serialize())}),r}}}let aT=aw("==",function(i,r,a){return r===a},ab),aS=aw("!=",function(i,r,a){return r!==a},function(i,r,a,n){return!ab(0,r,a,n)}),aI=aw("<",function(i,r,a){return r<a},function(i,r,a,n){return 0>n.compare(r,a)}),aE=aw(">",function(i,r,a){return r>a},function(i,r,a,n){return n.compare(r,a)>0}),aA=aw("<=",function(i,r,a){return r<=a},function(i,r,a,n){return 0>=n.compare(r,a)}),aC=aw(">=",function(i,r,a){return r>=a},function(i,r,a,n){return n.compare(r,a)>=0});class aM{constructor(i,r,a,n,o,s){this.type=iA,this.number=i,this.locale=r,this.currency=a,this.unit=n,this.minFractionDigits=o,this.maxFractionDigits=s}static parse(i,r){if(3!==i.length)return r.error("Expected two arguments.");let a=r.parse(i[1],1,iE);if(!a)return null;let n=i[2];if("object"!=typeof n||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&!(o=r.parseObjectValue(n.locale,2,"locale",iA)))return null;let s=null;if(n.currency&&!(s=r.parseObjectValue(n.currency,2,"currency",iA)))return null;let l=null;if(n.unit&&!(l=r.parseObjectValue(n.unit,2,"unit",iA)))return null;let h=null;if(n["min-fraction-digits"]&&!(h=r.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",iE)))return null;let u=null;return!n["max-fraction-digits"]||(u=r.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",iE))?new aM(a,o,s,l,h,u):null}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(i):void 0,unit:this.unit?this.unit.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.unit&&i(this.unit),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let i={};return this.locale&&(i.locale=this.locale.serialize()),this.currency&&(i.currency=this.currency.serialize()),this.unit&&(i.unit=this.unit.serialize()),this.minFractionDigits&&(i["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(i["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),i]}}class aP{constructor(i){this.type=iE,this.input=i}static parse(i,r){if(2!==i.length)return r.error(`Expected 1 argument, but found ${i.length-1} instead.`),null;let a=r.parse(i[1],1);return a?"array"!==a.type.kind&&"string"!==a.type.kind&&"value"!==a.type.kind?(r.error(`Expected argument of type string or array, but found ${iO(a.type)} instead.`),null):new aP(a):null}evaluate(i){let r=this.input.evaluate(i);if("string"==typeof r||Array.isArray(r))return r.length;throw new iJ(`Expected value to be of type string or array, but found ${iO(iX(r))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){let i=["length"];return this.eachChild(r=>{i.push(r.serialize())}),i}}function aD(i){return function(){let r=Math.imul((i=0x6d2b79f5+(i|=0)|0)^i>>>15,1|i);return(((r=r+Math.imul(r^r>>>7,61|r)^r)^r>>>14)>>>0)/0x100000000}}let aR={"==":aT,"!=":aS,">":aE,"<":aI,">=":aC,"<=":aA,array:i0,at:ad,"at-interpolated":ap,boolean:i0,case:ag,coalesce:au,collator:ra,format:i1,image:i2,in:af,"index-of":am,interpolate:al,"interpolate-hcl":al,"interpolate-lab":al,length:aP,let:
1ac,literal:iK,match:a_,number:i0,"number-format":aM,object:i0,slice:ay,step:r2,string:i0,"to-boolean":i7,"to-color":i7,"to-number":i7,"to-string":i7,var:rQ,within:ry,distance:r$,config:rJ,split:ax};function aL(i,[r,a,n,o]){r=r.evaluate(i),a=a.evaluate(i),n=n.evaluate(i);let s=o?o.evaluate(i):1,l=iZ(r,a,n,s);if(l)throw new iJ(l);return new i_(r/255,a/255,n/255,s)}function az(i,[r,a,n,o]){var s,l,h;r=r.evaluate(i),a=a.evaluate(i),n=n.evaluate(i);let u=o?o.evaluate(i):1,c=(s=r,l=a,h=n,"number"==typeof s&&s>=0&&s<=360?"number"==typeof l&&l>=0&&l<=100&&"number"==typeof h&&h>=0&&h<=100?void 0===u||"number"==typeof u&&u>=0&&u<=1?null:`Invalid hsla value [${[s,l,h,u].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof u?[s,l,h,u]:[s,l,h]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof u?[s,l,h,u]:[s,l,h]).join(", ")}]: 'h' must be between 0 and 360.`);if(c)throw new iJ(c);let d=`hsla(${r}, ${a}%, ${n}%, ${u})`,p=i_.parse(d);if(!p)throw new iJ(`Failed to parse HSLA color: ${d}`);return p}function aF(i,r){let a=r[i];return void 0===a?null:a}function aO(i){return{type:i}}function aB(i){if(i instanceof rJ)return new Set([i.key]);let r=new Set;return i.eachChild(i=>{r=new Set([...r,...aB(i)])}),r}function ak(i){if(i instanceof ri&&"is-active-floor"===i.name)return!0;let r=!1;return i.eachChild(i=>{!r&&ak(i)&&(r=!0)}),r}function aV(i){return{result:"success",value:i}}function aN(i){return{result:"error",value:i}}function aU(i,r){return!!i&&!!i.parameters&&i.parameters.indexOf(r)>-1}function aj(i){return"data-driven"===i["property-type"]}function aG(i){return aU(i.expression,"measure-light")}function aq(i){return aU(i.expression,"zoom")}function a$(i){return!!i.expression&&i.expression.interpolated}function aH(i){return"object"==typeof i&&null!==i&&!Array.isArray(i)}function aZ(i){return i}function aW(i,r,a){return void 0!==i?i:void 0!==r?r:void 0!==a?a:void 0}function aX(i,r,a,n,o){return aW(typeof a===o?n[a]:void 0,i.default,r.default)}function aY(i,r,a){if(!i6(a))return aW(i.default,r.default);let n=i.stops.length;if(1===n||a<=i.stops[0][0])return i.stops[0][1];if(a>=i.stops[n-1][0])return i.stops[n-1][1];let o=r1(i.stops.map(i=>i[0]),a);return i.stops[o][1]}function aK(i,r,a){var n;let o,s,l=void 0!==i.base?i.base:1;if(!i6(a))return aW(i.default,r.default);let h=i.stops.length;if(1===h||a<=i.stops[0][0])return i.stops[0][1];if(a>=i.stops[h-1][0])return i.stops[h-1][1];let u=r1(i.stops.map(i=>i[0]),a),c=(n=i.stops[u][0],o=i.stops[u+1][0]-n,s=a-n,0===o?0:1===l?s/o:(Math.pow(l,s)-1)/(Math.pow(l,o)-1)),d=i.stops[u][1],p=i.stops[u+1][1],f=iw[r.type]||aZ;if(i.colorSpace&&"rgb"!==i.colorSpace){let r=as[i.colorSpace];f=(i,a)=>r.reverse(r.interpolate(r.forward(i),r.forward(a),c))}return"function"==typeof d.evaluate?{evaluate(...i){let r=d.evaluate.apply(void 0,i),a=p.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==a)return f(r,a,c)}}:f(d,p,c)}function aJ(i,r,a){return"color"===r.type?a=i_.parse(a):"formatted"===r.type?a=iq.fromString(a.toString()):"resolvedImage"===r.type?a=iH.build(a.toString()):i3(a)===r.type||"enum"===r.type&&r.values[a]||(a=void 0),aW(a,i.default,r.default)}ri.register(aR,{error:[{kind:"error"},[iA],(i,[r])=>{throw new iJ(r.evaluate(i))}],typeof:[iA,[iD],(i,[r])=>iO(iX(r.evaluate(i)))],"to-rgba":[iF(iE,4),[iM],(i,[r])=>r.evaluate(i).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[iF(iE,4),[iM],(i,[r])=>r.evaluate(i).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[iM,[iE,iE,iE],aL],rgba:[iM,[iE,iE,iE,iE],aL],hsl:[iM,[iE,iE,iE],az],hsla:[iM,[iE,iE,iE,iE],az],has:{type:iC,overloads:[[[iA],(i,[r])=>r.evaluate(i)in i.properties()],[[iA,iP],(i,[r,a])=>r.evaluate(i)in a.evaluate(i)]]},get:{type:iD,overloads:[[[iA],(i,[r])=>aF(r.evaluate(i),i.properties())],[[iA,iP],(i,[r,a])=>aF(r.evaluate(i),a.evaluate(i))]]},"feature-state":[iD,[iA],(i,[r])=>aF(r.evaluate(i),i.featureState||{})],properties:[iP,[],i=>i.properties()],"geometry-type":[iA,[],i=>i.geometryType()],worldview:[iA,[],i=>i.globals.worldview||""],"is-active-floor":[iC,aO(iA),(i,r)=>{if(!(i.globals&&i.globals.activeFloors&&i.globals.activeFloors.size>0))return!1;if(0===r.length)return!0;let a=i.globals.activeFloors;return r.some(r=>{let n=r.evaluate(i);return a.has(n)})}],id:[iD,[],i=>i.id()],zoom:[iE,[],i=>i.globals.zoom],pitch:[iE,[],i=>i.globals.pitch||0],"distance-from-center":[iE,[],i=>i.distanceFromCenter()],"measure-light":[iE,[iA],(i,[r])=>i.measureLight(r.evaluate(i))],"heatmap-density":[iE,[],i=>i.globals.heatmapDensity||0],"line-progress":[iE,[],i=>i.globals.lineProgress||0],"raster-value":[iE,[],i=>i.globals.rasterValue||0],"raster-particle-speed":[iE,[],i=>i.globals.rasterParticleSpeed||0],"sky-radial-progress":[iE,[],i=>i.globals.skyRadialProgress||0],accumulated:[iD,[],i=>void 0===i.globals.accumulated?null:i.globals.accumulated],"+":[iE,aO(iE),(i,r)=>{let a=0;for(let n of r)a+=n.evaluate(i);return a}],"*":[iE,aO(iE),(i,r)=>{let a=1;for(let n of r)a*=n.evaluate(i);return a}],"-":{type:iE,overloads:[[[iE,iE],(i,[r,a])=>r.evaluate(i)-a.evaluate(i)],[[iE],(i,[r])=>-r.evaluate(i)]]},"/":[iE,[iE,iE],(i,[r,a])=>r.evaluate(i)/a.evaluate(i)],"%":[iE,[iE,iE],(i,[r,a])=>r.evaluate(i)%a.evaluate(i)],ln2:[iE,[],()=>Math.LN2],pi:[iE,[],()=>Math.PI],e:[iE,[],()=>Math.E],"^":[iE,[iE,iE],(i,[r,a])=>Math.pow(r.evaluate(i),a.evaluate(i))],sqrt:[iE,[iE],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[iE,[iE],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[iE,[iE],(i,[r])=>Math.log(r.evaluate(i))],log2:[iE,[iE],(i,[r])=>Math.log2(r.evaluate(i))],sin:[iE,[iE],(i,[r])=>Math.sin(r.evaluate(i))],cos:[iE,[iE],(i,[r])=>Math.cos(r.evaluate(i))],tan:[iE,[iE],(i,[r])=>Math.tan(r.evaluate(i))],asin:[iE,[iE],(i,[r])=>Math.asin(r.evaluate(i))],acos:[iE,[iE],(i,[r])=>Math.acos(r.evaluate(i))],atan:[iE,[iE],(i,[r])=>Math.atan(r.evaluate(i))],min:[iE,aO(iE),(i,r)=>Math.min(...r.map(r=>r.evaluate(i)))],max:[iE,aO(iE),(i,r)=>Math.max(...r.map(r=>r.evaluate(i)))],abs:[iE,[iE],(i,[r])=>Math.abs(r.evaluate(i))],round:[iE,[iE],(i,[r])=>{let a=r.evaluate(i);return a<0?-Math.round(-a):Math.round(a)}],floor:[iE,[iE],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[iE,[iE],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[iC,[iA,iD],(i,[r,a])=>i.properties()[r.value]===a.value],"filter-id-==":[iC,[iD],(i,[r])=>i.id()===r.value],"filter-type-==":[iC,[iA],(i,[r])=>i.geometryType()===r.value],"filter-<":[iC,[iA,iD],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n<o}],"filter-id-<":[iC,[iD],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a<n}],"filter->":[iC,[iA,iD],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n>o}],"filter-id->":[iC,[iD],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a>n}],"filter-<=":[iC,[iA,iD],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[iC,[iD],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a<=n}],"filter->=":[iC,[iA,iD],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[iC,[iD],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a>=n}],"filter-has":[iC,[iD],(i,[r])=>r.value in i.properties()],"filter-has-id":[iC,[],i=>null!==i.id()&&void 0!==i.id()],"filter-type-in":[iC,[iF(iA)],(i,[r])=>r.value.indexOf(i.geometryType())>=0],"filter-id-in":[iC,[iF(iD)],(i,[r])=>r.value.indexOf(i.id())>=0],"filter-in-small":[iC,[iA,iF(iD)],(i,[r,a])=>a.value.indexOf(i.properties()[r.value])>=0],"filter-in-large":[iC,[iA,iF(iD)],(i,[r,a])=>(function(i,r,a,n){for(;a<=n;){let o=a+n>>1;
1if(r[o]===i)return!0;r[o]>i?n=o-1:a=o+1}return!1})(i.properties()[r.value],a.value,0,a.value.length-1)],all:{type:iC,overloads:[[[iC,iC],(i,[r,a])=>r.evaluate(i)&&a.evaluate(i)],[aO(iC),(i,r)=>{for(let a of r)if(!a.evaluate(i))return!1;return!0}]]},any:{type:iC,overloads:[[[iC,iC],(i,[r,a])=>r.evaluate(i)||a.evaluate(i)],[aO(iC),(i,r)=>{for(let a of r)if(a.evaluate(i))return!0;return!1}]]},"!":[iC,[iC],(i,[r])=>!r.evaluate(i)],"is-supported-script":[iC,[iA],(i,[r])=>{let a=i.globals&&i.globals.isSupportedScript;return!a||a(r.evaluate(i))}],upcase:[iA,[iA],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[iA,[iA],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[iA,aO(iD),(i,r)=>r.map(r=>iY(r.evaluate(i))).join("")],"resolved-locale":[iA,[iR],(i,[r])=>r.evaluate(i).resolvedLocale()],random:[iE,[iE,iE,iD],(i,r)=>{let a,[n,o,s]=r.map(r=>r.evaluate(i));if(n>o||n===o)return n;if("string"==typeof s)a=function(i){let r=0;if(0===i.length)return r;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a),r&=r;return r}(s);else{if("number"!=typeof s)throw new iJ(`Invalid seed input: ${s}`);a=s}return n+aD(a)()*(o-n)}]});class aQ{constructor(i,r,a,n,o){this.expression=i,this._warningHistory={},this._scope=a,this._options=n,this._iconImageUseTheme=o,this._evaluator=new rt(a,n,o),this._defaultValue=r?function(i){return"color"===i.type&&(aH(i.default)||Array.isArray(i.default))?new i_(0,0,0,0):"color"===i.type?i_.parse(i.default)||null:void 0===i.default?null:i.default}(r):null,this._enumValues=r&&"enum"===r.type?r.values:null,this.configDependencies=aB(i),this.isIndoorDependent=ak(i)}evaluateWithoutErrorHandling(i,r,a,n,o,s,l,h){return this._evaluator.globals=i,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=n||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(i,r,a,n,o,s,l,h,u){this._evaluator||(this._evaluator=new rt(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=i,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this._evaluator.iconImageUseTheme=u||null;try{let i=this.expression.evaluate(this._evaluator);if(null==i||"number"==typeof i&&i!=i)return this._defaultValue;if(this._enumValues&&!(i in this._enumValues))throw new iJ(`Expected value to be one of ${Object.keys(this._enumValues).map(i=>JSON.stringify(i)).join(", ")}, but found ${JSON.stringify(i)} instead.`);return i}catch(i){return this._warningHistory[i.message]||(this._warningHistory[i.message]=!0,"u">typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${i.message}`)),this._defaultValue}}}function a0(i){return Array.isArray(i)&&i.length>0&&"string"==typeof i[0]&&i[0]in aR}function a1(i,r,a,n,o){let s,l=new r0(aR,[],r?(s={color:iM,string:iA,number:iE,enum:iA,boolean:iC,formatted:iL,resolvedImage:iz},"array"===r.type?iF(s[r.value]||iD,r.length):s[r.type]):void 0,void 0,void 0,a,n,o),h=l.parse(i,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return h?aV(new aQ(h,r,a,n,o)):aN(l.errors)}class a2{constructor(i,r,a,n){this.kind=i,this._styleExpression=r,this.isLightConstant=a,this.isLineProgressConstant=n,this.isStateDependent="constant"!==i&&!rZ(r.expression),this.configDependencies=aB(r.expression),this.isIndoorDependent=ak(r.expression)}evaluateWithoutErrorHandling(i,r,a,n,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,a,n,o,s)}evaluate(i,r,a,n,o,s,l){return this._styleExpression.evaluate(i,r,a,n,o,s,void 0,void 0,l)}}class a3{constructor(i,r,a,n,o,s){this.kind=i,this.zoomStops=a,this._styleExpression=r,this.isStateDependent="camera"!==i&&!rZ(r.expression),this.isIndoorDependent=ak(r.expression),this.isLightConstant=o,this.isLineProgressConstant=s,this.configDependencies=aB(r.expression),this.interpolationType=n}evaluateWithoutErrorHandling(i,r,a,n,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,a,n,o,s)}evaluate(i,r,a,n,o,s){return this._styleExpression.evaluate(i,r,a,n,o,s)}interpolationFactor(i,r,a){return this.interpolationType?al.interpolationFactor(this.interpolationType,i,r,a):0}}function a5(i,r,a,n,o){if("error"===(i=a1(i,r,a,n,o)).result)return i;let s=i.value.expression,l=rH(s);if(!l&&!aj(r))return aN([new iT("","data expressions not supported")]);let h=rW(s,["zoom","pitch","distance-from-center"]);if(!h&&!aq(r))return aN([new iT("","zoom expressions not supported")]);let u=rW(s,["measure-light"]);if(!u&&!aG(r))return aN([new iT("","measure-light expression not supported")]);let c=rW(s,["line-progress"]);if(!c&&!aU(r.expression,"line-progress"))return aN([new iT("","line-progress expression not supported")]);let d=r.expression&&r.expression.relaxZoomRestriction,p=function i(r){let a=null;if(r instanceof ac)a=i(r.result);else if(r instanceof au){for(let n of r.args)if(a=i(n))break}else(r instanceof r2||r instanceof al)&&r.input instanceof ri&&"zoom"===r.input.name&&(a=r);return a instanceof iT||r.eachChild(r=>{let n=i(r);n instanceof iT?a=n:a&&n&&a!==n&&(a=new iT("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),a}(s);return p||h||d?p instanceof iT?aN([p]):p instanceof al&&!a$(r)?aN([new iT("",'"interpolate" expressions cannot be used with this property')]):aV(p?new a3(l&&c?"camera":"composite",i.value,p.labels,p instanceof al?p.interpolation:void 0,u,c):new a2(l&&c?"constant":"source",i.value,u,c)):aN([new iT("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class a4{constructor(i,r){this._parameters=i,this._specification=r,Object.assign(this,function i(r,a){let n,o,s,l="color"===a.type,h=r.stops&&"object"==typeof r.stops[0][0],u=h||
1!(h||void 0!==r.property),c=r.type||(a$(a)?"exponential":"interval");if(l&&((r=Object.assign({},r)).stops&&(r.stops=r.stops.map(i=>[i[0],i_.parse(i[1])])),r.default=i_.parse(r.default?r.default:a.default)),r.colorSpace&&"rgb"!==r.colorSpace&&!as[r.colorSpace])throw Error(`Unknown color space: ${r.colorSpace}`);if("exponential"===c)n=aK;else if("interval"===c)n=aY;else if("categorical"===c){for(let i of(n=aX,o=Object.create(null),r.stops))o[i[0]]=i[1];s=typeof r.stops[0][0]}else{if("identity"!==c)throw Error(`Unknown function type "${c}"`);n=aJ}if(h){let n={},o=[];for(let i=0;i<r.stops.length;i++){let a=r.stops[i],s=a[0].zoom;void 0===n[s]&&(n[s]={zoom:s,type:r.type,property:r.property,default:r.default,stops:[]},o.push(s)),n[s].stops.push([a[0].value,a[1]])}let s=[];for(let r of o)s.push([n[r].zoom,i(n[r],a)]);let l={name:"linear"};return{kind:"composite",interpolationType:l,interpolationFactor:al.interpolationFactor.bind(void 0,l),zoomStops:s.map(i=>i[0]),evaluate:({zoom:i},n)=>aK({stops:s,base:r.base},a,i).evaluate(i,n)}}if(u){let i="exponential"===c?{name:"exponential",base:void 0!==r.base?r.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:al.interpolationFactor.bind(void 0,i),zoomStops:r.stops.map(i=>i[0]),evaluate:({zoom:i})=>n(r,a,i,o,s)}}return{kind:"source",evaluate(i,l){let h=l&&l.properties?l.properties[r.property]:void 0;return void 0===h?aW(r.default,a.default):n(r,a,h,o,s)}}}(this._parameters,this._specification))}static deserialize(i){return new a4(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}var a6,a8,a9=e3(function(){if(a8)return a6;function i(i,r,a){var n=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var o=new Int32Array(this.arrayBuffer);i=o[0],this.d=(r=o[1])+2*(a=o[2]);for(var s=0;s<this.d*this.d;s++){var l=o[3+s],h=o[3+s+1];n.push(l===h?null:o.subarray(l,h))}var u=o[3+n.length+1];this.keys=o.subarray(o[3+n.length],u),this.bboxes=o.subarray(u),this.insert=this._insertReadonly}else{this.d=r+2*a;for(var c=0;c<this.d*this.d;c++)n.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=i,this.padding=a,this.scale=r/i,this.uid=0;var d=a/r*i;this.min=-d,this.max=i+d}return a8=1,a6=i,i.prototype.insert=function(i,r,a,n,o){this._forEachCell(r,a,n,o,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n),this.bboxes.push(o)},i.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},i.prototype._insertCell=function(i,r,a,n,o,s){this.cells[o].push(s)},i.prototype.query=function(i,r,a,n,o){var s=this.min,l=this.max;if(i<=s&&r<=s&&l<=a&&l<=n&&!o)return Array.prototype.slice.call(this.keys);var h=[];return this._forEachCell(i,r,a,n,this._queryCell,h,{},o),h},i.prototype._queryCell=function(i,r,a,n,o,s,l,h){var u=this.cells[o];if(null!==u)for(var c=this.keys,d=this.bboxes,p=0;p<u.length;p++){var f=u[p];if(void 0===l[f]){var m=4*f;(h?h(d[m+0],d[m+1],d[m+2],d[m+3]):i<=d[m+2]&&r<=d[m+3]&&a>=d[m+0]&&n>=d[m+1])?(l[f]=!0,s.push(c[f])):l[f]=!1}}},i.prototype._forEachCell=function(i,r,a,n,o,s,l,h){for(var u=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a),p=this._convertToCellCoord(n),f=u;f<=d;f++)for(var m=c;m<=p;m++){var _=this.d*m+f;if((!h||h(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&o.call(this,i,r,a,n,_,s,l,h))return}},i.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},i.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},i.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=3+this.cells.length+1+1,a=0,n=0;n<this.cells.length;n++)a+=this.cells[n].length;var o=new Int32Array(r+a+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;for(var s=r,l=0;l<i.length;l++){var h=i[l];o[3+l]=s,o.set(h,s),s+=h.length}return o[3+i.length]=s,o.set(this.keys,s),o[3+i.length+1]=s+=this.keys.length,o.set(this.bboxes,s),s+=this.bboxes.length,o.buffer},a6}());let a7={};function ne(i,r,a={}){Object.defineProperty(i,"_classRegistryKey",{value:r,writable:!1}),a7[r]={klass:i,omit:a.omit||[]}}for(let i in ne(Object,"Object"),a9.serialize=function(i,r){let a=i.toArrayBuffer();return r&&r.add(a),{buffer:a}},a9.deserialize=function(i){return new a9(i.buffer)},Object.defineProperty(a9,"name",{value:"Grid"}),ne(a9,"Grid"),delete e4.prototype.constructor,ne(i_,"Color"),ne(Error,"Error"),ne(iq,"Formatted"),ne(iG,"FormattedSection"),ne(t0,"AJAXError"),ne(iH,"ResolvedImage"),ne(a4,"StylePropertyFunction"),ne(aQ,"StyleExpression",{omit:["_evaluator"]}),ne(ic,"ImageId"),ne(i$,"ImageVariant"),ne(a3,"ZoomDependentExpression"),ne(a2,"ZoomConstantExpression"),ne(ri,"CompoundExpression",{omit:["_evaluate"]}),aR)a7[aR[i]._classRegistryKey]||ne(aR[i],`Expression${i}`);function nt(i){return i&&(i instanceof ArrayBuffer||i.constructor&&"ArrayBuffer"===i.constructor.name)}function ni(i,r){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp)return i;if(nt(i)||i instanceof ImageBitmap)return r&&r.add(i),i;if(ArrayBuffer.isView(i))return r&&r.add(i.buffer),i;if(i instanceof ImageData)return r&&r.add(i.data.buffer),i;if(Array.isArray(i)){let a=[];for(let n of i)a.push(ni(n,r));return a}if(i instanceof Map){let a={$name:"Map",entries:[]};
1for(let[n,o]of i.entries())a.entries.push(ni(n),ni(o,r));return a}if(i instanceof Set){let r={$name:"Set"},a=0;for(let n of i.values())r[++a]=ni(n);return r}if("bigint"==typeof i)return{$name:"BigInt",value:i.toString()};if("object"==typeof i){let a=i.constructor,n=a._classRegistryKey;if(!n)throw Error(`Can't serialize object of unregistered class "${a.name}".`);let o=a.serialize?a.serialize(i,r):{};if(!a.serialize){for(let a in i)i.hasOwnProperty(a)&&(a7[n].omit.indexOf(a)>=0||(o[a]=ni(i[a],r)));i instanceof Error&&(o.message=i.message)}if(o.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(o.$name=n),o}throw Error("can't serialize object of type "+typeof i)}function nr(i){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||nt(i)||i instanceof ImageBitmap||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(nr);if("object"==typeof i){let r=i.$name||"Object";if("Map"===r){let r=i.entries||[],a=new Map;for(let i=0;i<r.length;i+=2)a.set(nr(r[i]),nr(r[i+1]));return a}if("Set"===r){let r=new Set;for(let a of Object.keys(i))"$name"!==a&&r.add(nr(i[a]));return r}if("BigInt"===r)return BigInt(i.value);let{klass:a}=a7[r];if(!a)throw Error(`Can't deserialize unregistered class "${r}".`);if(a.deserialize)return a.deserialize(i);let n=Object.create(a.prototype);for(let r of Object.keys(i))"$name"!==r&&(n[r]=nr(i[r]));return n}throw Error("can't deserialize object of type "+typeof i)}let na=i=>i>=1536&&i<=1791,nn=i=>i>=1872&&i<=1919,no=i=>i>=2208&&i<=2303,ns=i=>i>=11904&&i<=12031,nl=i=>i>=12032&&i<=12255,nh=i=>i>=12272&&i<=12287,nu=i=>i>=12288&&i<=12351,nc=i=>i>=12352&&i<=12447,nd=i=>i>=12448&&i<=12543,np=i=>i>=12544&&i<=12591,nf=i=>i>=12704&&i<=12735,nm=i=>i>=12736&&i<=12783,n_=i=>i>=12784&&i<=12799,ng=i=>i>=12800&&i<=13055,ny=i=>i>=13056&&i<=13311,nx=i=>i>=13312&&i<=19903,nv=i=>i>=19968&&i<=40959,nb=i=>i>=40960&&i<=42127,nw=i=>i>=42128&&i<=42191,nT=i=>i>=44032&&i<=55215,nS=i=>i>=63744&&i<=64255,nI=i=>i>=64336&&i<=65023,nE=i=>i>=65040&&i<=65055,nA=i=>i>=65072&&i<=65103,nC=i=>i>=65104&&i<=65135,nM=i=>i>=65136&&i<=65279,nP=i=>i>=65280&&i<=65519;function nD(i){for(let r of i)if(nR(r.charCodeAt(0)))return!0;return!1}function nR(i){return!(746!==i&&747!==i&&(i<4352||!(nf(i)||np(i)||nA(i)&&!(i>=65097&&i<=65103)||nS(i)||ny(i)||ns(i)||nm(i)||!(!nu(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||nx(i)||nv(i)||ng(i)||i>=12592&&i<=12687||i>=43360&&i<=43391||i>=55216&&i<=55295||i>=4352&&i<=4607||nT(i)||nc(i)||nh(i)||i>=12688&&i<=12703||nl(i)||n_(i)||nd(i)&&12540!==i||!(!nP(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!nC(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||i>=5120&&i<=5759||i>=6320&&i<=6399||nE(i)||i>=19904&&i<=19967||nb(i)||nw(i))))}function nL(i){return!(nR(i)||i>=128&&i<=255&&(167===i||169===i||174===i||177===i||188===i||189===i||190===i||215===i||247===i)||i>=8192&&i<=8303&&(8214===i||8224===i||8225===i||8240===i||8241===i||8251===i||8252===i||8258===i||8263===i||8264===i||8265===i||8273===i)||i>=8448&&i<=8527||i>=8528&&i<=8591||i>=8960&&i<=9215&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||9003===i||i>=9085&&i<=9114||i>=9150&&i<=9165||9167===i||i>=9169&&i<=9179||i>=9186&&i<=9215)||i>=9216&&i<=9279&&9251!==i||i>=9280&&i<=9311||i>=9312&&i<=9471||i>=9632&&i<=9727||i>=9728&&i<=9983&&!(i>=9754&&i<=9759)||i>=11008&&i<=11263&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||nu(i)||nd(i)||i>=57344&&i<=63743||nA(i)||nC(i)||nP(i)||8734===i||8756===i||8757===i||i>=9984&&i<=10087||i>=10102&&i<=10131||65532===i||65533===i)}function nz(i){return i>=1424&&i<=2303||nI(i)||nM(i)}let nF={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"},nO=null,nB=nF.unavailable,nk=null,nV=function(i){i&&"string"==typeof i&&i.indexOf("NetworkError")>-1&&(nB=nF.error),nO&&nO(i)};function nN(){nU.fire(new io("pluginStateChange",{pluginStatus:nB,pluginURL:nk}))}let nU=new iu,nj=function(){return nB},nG=function(){if(nB!==nF.deferred||!nk)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");nB=nF.loading,nN(),nk&&t5({url:nk},i=>{i?nV(i):(nB=nF.loaded,nN())})},nq={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>nB===nF.loaded||null!=nq.applyArabicShaping,isLoading:()=>nB===nF.loading,setState(i){nB=i.pluginStatus,nk=i.pluginURL},isParsing:()=>nB===nF.parsing,isParsed:()=>nB===nF.parsed,getPluginURL:()=>nk},n$=function(){nq.isLoading()||nq.isLoaded()||"deferred"!==nj()||nG()};
1class nH{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.transition=r.transition,this.pitch=r.pitch,this.brightness=r.brightness,this.worldview=r.worldview,this.activeFloors=r.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(i){var r=nq.isLoaded();for(let a of i)if(!function(i,r){return!(!r&&nz(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||i>=6016&&i<=6143)}(a.charCodeAt(0),r))return!1;return!0}}class nZ{constructor(i,r,a,n,o){this.property=i,this.value=r,this.expression=function(i,r,a,n,o){if(aH(i))return new a4(i,r);if(a0(i)||Array.isArray(i)&&i.length>0){let s=a5(i,r,a,n,o);if("error"===s.result)throw Error(s.value.map(i=>`${i.key}: ${i.message}`).join(", "));return s.value}{let a=i;return"string"==typeof i&&"color"===r.type&&(a=i_.parse(i)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>a}}}(void 0===r?i.specification.default:r,i.specification,a,n,o)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,a,n){return this.property.possiblyEvaluate(this,i,r,a,n)}}class nW{constructor(i,r,a,n){this.property=i,this.value=new nZ(i,void 0,r,a,n)}transitioned(i,r){return new nY(this.property,this.value,r,Object.assign({},i.transition,this.transition),i.now)}untransitioned(){return new nY(this.property,this.value,null,{},0)}}class nX{constructor(i,r,a,n){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues),this._scope=r,this._options=a,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(i){return tp(this._values[i].value.value)}setValue(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nW(this._values[i].property,this._scope,this._options,this._iconImageUseTheme)),this._values[i].value=new nZ(this._values[i].property,null===r?void 0:tp(r),this._scope,this._options,this._iconImageUseTheme),this._values[i].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[i].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[i].value.isIndoorDependent())}setTransitionOrValue(i,r){r&&(this._options=r);let a=this._properties.properties;if(i)for(let r in i){let n=i[r];if(r.endsWith("-transition")){let i=r.slice(0,-11);a[i]&&this.setTransition(i,n)}else a.hasOwnProperty(r)&&this.setValue(r,n)}}getTransition(i){return tp(this._values[i].transition)}setTransition(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nW(this._values[i].property)),this._values[i].transition=tp(r)||void 0}serialize(){let i={};for(let r of Object.keys(this._values)){let a=this.getValue(r);void 0!==a&&(i[r]=a);let n=this.getTransition(r);void 0!==n&&(i[`${r}-transition`]=n)}return i}transitioned(i,r){let a=new nK(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].transitioned(i,r._values[n]);return a}untransitioned(){let i=new nK(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}isIndoorDependent(){return this._isIndoorDependent}}class nY{constructor(i,r,a,n,o){const s=n.delay||0,l=n.duration||0;o=o||0,this.property=i,this.value=r,this.begin=o+s,this.end=this.begin+l,i.specification.transition&&(n.delay||n.duration)&&(this.prior=a)}possiblyEvaluate(i,r,a){let n=i.now||0,o=this.value.possiblyEvaluate(i,r,a),s=this.prior;if(s){if(n>this.end||this.value.isDataDriven())return this.prior=null,o;if(n<this.begin)return s.possiblyEvaluate(i,r,a);{let l=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(i,r,a),o,te(l))}}return o}}class nK{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,r,a){let n=new n0(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(i,r,a);return n}hasTransition(){for(let i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class nJ{constructor(i,r,a,n){this._properties=i,this._values=Object.create(i.defaultPropertyValues),this._scope=r,this._options=a,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(i){return tp(this._values[i].value)}setValue(i,r){this._values[i]=new nZ(this._values[i].property,null===r?void 0:tp(r),this._scope,this._options,this._iconImageUseTheme),this._values[i].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[i].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[i].isIndoorDependent())}serialize(){let i={};for(let r of Object.keys(this._values)){let a=this.getValue(r);void 0!==a&&(i[r]=a)}return i}possiblyEvaluate(i,r,a,n){let o=new n0(this._properties);for(let s of Object.keys(this._values))o._values[s]=this._values[s].possiblyEvaluate(i,r,a,n);return o}isIndoorDependent(){return this._isIndoorDependent}}class nQ{constructor(i,r,a,n){this.property=i,this.value=r,this.parameters=a,this.iconImageUseTheme=n}isConstant(){return"constant"===this.value.kind}constantOr(i){return"constant"===this.value.kind?this.value.value:i}evaluate(i,r,a,n,o){return this.property.evaluate(this.value,this.parameters,i,r,a,n,this.iconImageUseTheme,o)}}class n0{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class n1{constructor(i){this.specification=i}possiblyEvaluate(i,r){return i.expression.evaluate(r)}interpolate(i,r,a){let n=iw[this.specification.type];return n?n(i,r,a):i}}class n2{constructor(i,r){this.specification=i,this.overrides=r}possiblyEvaluate(i,r,a,n,o){return"constant"===i.expression.kind||"camera"===i.expression.kind?new nQ(this,{kind:"constant",value:i.expression.evaluate(r,null,{},a,n,void 0,o)},r):new nQ(this,i.expression,r,o)}interpolate(i,r,a){if("constant"!==i.value.kind||"constant"!==r.value.kind)return i;if(void 0===i.value.value||void 0===r.value.value)return new nQ(this,{kind:"constant",value:void 0},i.parameters);let n=iw[this.specification.type];return n?new nQ(this,{kind:"constant",value:n(i.value.value,r.value.value,a)},i.parameters):i}evaluate(i,r,a,n,o,s,l,h){return"constant"===i.kind?i.value:i.evaluate(r,a,n,o,s,h,l)}}class n3{constructor(i){this.specification=i}possiblyEvaluate(i,r,a,n){return!!i.expression.evaluate(r,null,{},a,n)}interpolate(){return!1}}class n5{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const r=new nH(0,{});for(const a in i){const n=i[a],o=n.specification;o&&o.overridable&&this.overridableProperties.push(a);const s=this.defaultPropertyValues[a]=new nZ(n,void 0),l=this.defaultTransitionablePropertyValues[a]=new nW(n);this.defaultTransitioningPropertyValues[a]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=s.possiblyEvaluate(r)}}}ne(n2,"DataDrivenProperty"),ne(n1,"DataConstantProperty"),ne(n3,"ColorRampProperty");var n4=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}}
1,"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","line-progress"]},"transition":true,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
1ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"line-blend-mode":{"type":"enum","values":{"default":1,"multiply":1,"additive":1},"default":"default","expression":{"parameters":["zoom"]}}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"appearance":true,"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"appearance":true,"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1},"default":"sea","expression":{}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","fe
1ature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}},"model-ignore-line-cutout":{"type":"boolean","default":false,"expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function n6(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function n8(i){if(Array.isArray(i))return i.map(n8);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let r={};for(let a in i)r[a]=n8(i[a]);return r}return n6(i)}function n9(i){if(!0===i||!1===i)return!0;if(!Array.isArray(i)||0===i.length)return!1;switch(i[0]){case"has":return i.length>=2&&"$id"!==i[1]&&"$type"!==i[1];case"in":return i.length>=3&&("string"!=typeof i[1]||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==i.length||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let r of i.slice(1))if(!n9(r)&&"boolean"!=typeof r)return!1;return!0;default:return!0}}function n7(i,r="",a=null,n="fill"){if(null==i)return{filter:()=>!0,needGeometry:!1,needFeature:!1};n9(i)||(i=function i(r){if(!r)return!0;let a=r[0];return r.length<=1?"any"!==a:"=="===a?or(r[1],r[2],"=="):"!="===a?oo(or(r[1],r[2],"==")):"<"===a||">"===a||"<="===a||">="===a?or(r[1],r[2],a):"any"===a?["any"].concat(r.slice(1).map(i)):"all"===a?["all"].concat(r.slice(1).map(i)):"none"===a?["all"].concat(r.slice(1).map(i).map(oo)):"in"===a?oa(r[1],r.slice(2)):"!in"===a?oo(oa(r[1],r.slice(2))):"has"===a?on(r[1]):"!has"!==a||oo(on(r[1]))}(i));let o=i,s=!0;try{s=function(i){if(!oe(i))return i;let r=n8(i);return function i(r){let a=!1,n=[];if("case"===r[0]){for(let i=1;i<r.length-1;i+=2)a=a||oe(r[i]),n.push(r[i+1]);n.push(r[r.length-1])}else if("match"===r[0]){a=a||oe(r[1]);for(let i=2;i<r.length-1;i+=2)n.push(r[i+1]);n.push(r[r.length-1])}else if("step"===r[0]){a=a||oe(r[1]);for(let i=1;i<r.length-1;i+=2)n.push(r[i+1])}a&&(r.length=0,r.push("any",...n));for(let a=1;a<r.length;a++)i(r[a])}(r),r=function i(r){if(!Array.isArray(r))return r;let a=function(i){if(ot.has(i[0])){for(let r=1;r<i.length;r++)if(oe(i[r]))return!0}return i}(r);return!0===a?a:a.map(r=>i(r))}(r)}(o)}catch(i){console.warn(`Failed to extract static filter. Filter will c
1ontinue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(o,null,2)} 7 `)}let l=null,h=null;if("background"!==n&&"sky"!==n&&"slot"!==n){let i=a1(s,h=n4[`filter_${n}`],r,a);if("error"===i.result)throw Error(i.value.map(i=>`${i.key}: ${i.message}`).join(", "));l=(r,a,n)=>i.value.evaluate(r,a,{},n)}let u=null,c=null;if(s!==o){let i=a1(o,h,r,a);if("error"===i.result)throw Error(i.value.map(i=>`${i.key}: ${i.message}`).join(", "));u=(r,a,n,o,s)=>i.value.evaluate(r,a,{},n,void 0,void 0,o,s),c=!rH(i.value.expression)}return{filter:l,dynamicFilter:u||void 0,needGeometry:function i(r){if(!Array.isArray(r))return!1;if("within"===r[0]||"distance"===r[0])return!0;for(let a=1;a<r.length;a++)if(i(r[a]))return!0;return!1}(s),needFeature:!!c}}function oe(i){var r;if(!Array.isArray(i))return!1;if("pitch"===(r=i[0])||"distance-from-center"===r)return!0;for(let r=1;r<i.length;r++)if(oe(i[r]))return!0;return!1}let ot=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function oi(i,r){return i<r?-1:+(i>r)}function or(i,r,a){switch(i){case"$type":return[`filter-type-${a}`,r];case"$id":return[`filter-id-${a}`,r];default:return[`filter-${a}`,i,r]}}function oa(i,r){if(0===r.length)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(i=>typeof i!=typeof r[0])?["filter-in-large",i,["literal",r.sort(oi)]]:["filter-in-small",i,["literal",r]]}}function on(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function oo(i){return["!",i]}function os(i,r){return r?`${i}�${r}`:i}let ol=()=>d||(d=new n5({"icon-size":new n2(n4.layout_symbol["icon-size"]),"icon-image":new n2(n4.layout_symbol["icon-image"]),"icon-rotate":new n2(n4.layout_symbol["icon-rotate"]),"icon-offset":new n2(n4.layout_symbol["icon-offset"]),"text-size":new n2(n4.layout_symbol["text-size"]),"text-rotate":new n2(n4.layout_symbol["text-rotate"]),"text-offset":new n2(n4.layout_symbol["text-offset"])})),oh=()=>p||(p=new n5({"icon-opacity":new n2(n4.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new n2(n4.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new n2(n4.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new n2(n4.paint_symbol["text-emissive-strength"]),"icon-color":new n2(n4.paint_symbol["icon-color"]),"icon-halo-color":new n2(n4.paint_symbol["icon-halo-color"]),"icon-halo-width":new n2(n4.paint_symbol["icon-halo-width"]),"icon-halo-blur":new n2(n4.paint_symbol["icon-halo-blur"]),"icon-translate":new n2(n4.paint_symbol["icon-translate"]),"text-opacity":new n2(n4.paint_symbol["text-opacity"]),"text-occlusion-opacity":new n2(n4.paint_symbol["text-occlusion-opacity"]),"text-color":new n2(n4.paint_symbol["text-color"],{runtimeType:iM,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new n2(n4.paint_symbol["text-halo-color"]),"text-halo-width":new n2(n4.paint_symbol["text-halo-width"]),"text-halo-blur":new n2(n4.paint_symbol["text-halo-blur"]),"text-translate":new n2(n4.paint_symbol["text-translate"]),"symbol-z-offset":new n2(n4.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}));class ou{constructor(i,r,a,n,o,s){this._conditionSpec=i,this._propertiesSpec=a;const l=a1(i,n4.appearance.condition);if("success"===l.result&&(this.condition=l.value),this.name=r,a)for(const i in this.layoutProperties=new n0(ol()),this.unevaluatedLayout=new nJ(ol(),n,o,s),this.paintProperties=new n0(oh()),this.unevaluatedPaint=new nJ(oh(),n,o,""),a)i in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(i,a[i]):i in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(i,a[i])}
7isActive(i){return!(this.condition||!i.isHidden||"hidden"!==this.name)||this.condition.evaluate(i.globals,i.feature,i.featureState,i.canonical)}getCondition(){return this.condition}getName(){return this.name}getLayoutProperty(i){return this.layoutProperties.get(i)}getPaintProperty(i){return this.paintProperties.get(i)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(i){return this.unevaluatedLayout._values[i]}getUnevaluatedPaintProperty(i){return this.unevaluatedPaint._values[i]}recalculate(i,r,a){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(i,void 0,r,a)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(i,void 0,r,""))}serialize(){let i={};i.condition=this.condition.expression.serialize(),this.name&&(i.name=this.name);let r=Object.assign({},this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},this.unevaluatedPaint?this.unevaluatedPaint.serialize():{});return Object.keys(r).length>0&&(i.properties=r),i}hasIconLayoutProperties(){let i=this.hasLayoutProperty("icon-image"),r=this.hasLayoutProperty("icon-size"),a=this.hasLayoutProperty("icon-offset"),n=this.hasLayoutProperty("icon-rotate");return i||r||a||n}hasTextLayoutProperties(){let i=this.hasLayoutProperty("text-size"),r=this.hasLayoutProperty("text-offset"),a=this.hasLayoutProperty("text-rotate");return i||r||a}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(i=>!i.endsWith("-use-theme")).some(i=>(i.startsWith("icon-")||"symbol-z-offset"===i)&&this.hasPaintProperty(i))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(i=>!i.endsWith("-use-theme")).some(i=>(i.startsWith("text-")||"symbol-z-offset"===i)&&this.hasPaintProperty(i))}hasLayoutProperty(i){return this.unevaluatedLayout&&void 0!==this.unevaluatedLayout._values[i].value}hasPaintProperty(i){return this.unevaluatedPaint&&void 0!==this.unevaluatedPaint._values[i].value}}let oc="-transition",od=new Set(["fill","line","background","hillshade","raster"]);class op extends iu{constructor(i,r,a,n,o,s){if(super(),this.id=i.id,this.fqid=os(this.id,a),this.type=i.type,this.scope=a,this.lut=n,this.options=o,this.iconImageUseTheme=s,this.appearances=[],this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},"custom"!==i.type){if(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type&&"background"!==i.type&&"sky"!==i.type&&"slot"!==i.type){this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter;const r=a1(this.filter,n4[`filter_${i.type}`]);"error"!==r.result&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.value.isIndoorDependent)}if(i.slot&&(this.slot=i.slot),i.appearances&&this.setAppearances(i.appearances),r.layout&&(this._unevaluatedLayout=new nJ(r.layout,this.scope,o,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),r.paint){for(const a in this._transitionablePaint=new nX(r.paint,this.scope,o),i.paint)this.setPaintProperty(a,i.paint[a]);for(const r in i.layout)this.setLayoutProperty(r,i.layout[r]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new n0(r.paint)}}}onAdd(i){}onRemove(i){}isDraped(i){return!this.is3D(!0)&&od.has(this.type)}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r){if("custom"===this.type&&"visibility"===i)return void(this.visibility=r);let a=this._unevaluatedLayout;a._properties.properties[i]&&(a.setValue(i,r),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...a.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||a.isIndo
7orDependent(),"visibility"===i&&this.possiblyEvaluateVisibility())}setAppearances(i){this.appearances=[],i.forEach(i=>{this.appearances.push(new ou(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))}),this.appearancesVersion++}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(i){return i.endsWith(oc)?this._transitionablePaint.getTransition(i.slice(0,-11)):this._transitionablePaint.getValue(i)}isPaintProperty(i){return!!this._transitionablePaint._properties.properties[i]}setPaintProperty(i,r){let a=this._transitionablePaint,n=a._properties.properties;if(i.endsWith(oc)){let o=i.slice(0,-11);return n[o]&&a.setTransition(o,r||void 0),!1}if(!n[i])return!1;let o=a._values[i],s=o.value.isDataDriven(),l=o.value;a.setValue(i,r),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...a.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||a.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(i);let h=a._values[i].value,u=h.isDataDriven(),c=i.endsWith("pattern")||"line-dasharray"===i;return u||s||c||this._handleOverridablePaintPropertyUpdate(i,l,h)}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getDefaultProgramParams(i,r,a){return null}_handleOverridablePaintPropertyUpdate(i,r,a){return!1}isHidden(i){return!!(this.minzoom&&i<this.minzoom)||!!(this.maxzoom&&i>=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}
7serialize(){let i={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return 0!==this.appearances.length&&(i.appearances=this.appearances.map(i=>i.serialize())),td(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}is3D(i){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(let i in this.paint._values){let r=this.paint.get(i);if(r instanceof nQ&&aj(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}for(let i of this.appearances)if(!rZ(i.condition.expression))return!0;return!1}compileFilter(i){this._filterCompiled||(this._featureFilter=n7(this.filter,this.scope,i),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}dynamicFilterNeedsGeometry(){return this._featureFilter.needGeometry}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(i){this._stats&&("shadow"===i.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(i,r,a){return{}}queryRadius(i){}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){}}let of={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class om{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}let o_=new ArrayBuffer(0);class og{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(i,r){return i._trim(),r&&i.arrayBuffer&&r.add(i.arrayBuffer),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){let r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,i.arrayBuffer?r.capacity=i.arrayBuffer.byteLength/r.bytesPerElement:(r.capacity=0,r.arrayBuffer=o_),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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this._reallocCount++,this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}reserveForAdditional(i){this.reserve(this.length+i)}_refreshViews(){throw Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(){throw Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(){throw Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function oy(i,r=1){let a=0,n=0;return{members:i.map(i=>{let o=of[i.type].BYTES_PER_ELEMENT,s=a=ox(a,Math.max(r,o)),l=i.components||1;return n=Math.max(n,o),a+=o*l,{name:i.name,type:i.type,components:l,offset:s}}),size:ox(a,Math.max(n,r)),alignment:r}}function ox(i,r){return Math.ceil(i/r)*r}class ov extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.int16[n+0]=r,this.int16[n+1]=a,i}}ov.prototype.bytesPerElement=4,ne(ov,"StructArrayLayout2i4");class ob extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.int16[o+2]=n,i}}ob.prototype.bytesPerElement=6,ne(ob,"StructArrayLayout3i6");class ow extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.int16[s+0]=r,this.int16[s+1]=a,this.uint16[s+2]=n,this.uint16[s+3]=o,i}}ow.prototype.bytesPerElement=8,ne(ow,"StructArrayLayout2i2ui8");class oT extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[+i+0]=r,i}}
7oT.prototype.bytesPerElement=4,ne(oT,"StructArrayLayout1f4");class oS extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=4*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.float32[2*i+1]=n,i}}oS.prototype.bytesPerElement=8,ne(oS,"StructArrayLayout2i1f8");class oI extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=4*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.int16[o+2]=n,i}}oI.prototype.bytesPerElement=8,ne(oI,"StructArrayLayout3i8");class oE extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.int16[s+0]=r,this.int16[s+1]=a,this.int16[s+2]=n,this.int16[s+3]=o,i}}oE.prototype.bytesPerElement=8,ne(oE,"StructArrayLayout4i8");class oA extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=5*i;return this.int16[l+0]=r,this.int16[l+1]=a,this.int16[l+2]=n,this.int16[l+3]=o,this.int16[l+4]=s,i}}oA.prototype.bytesPerElement=10,ne(oA,"StructArrayLayout5i10");class oC extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=6*i,c=12*i;return this.int16[u+0]=r,this.int16[u+1]=a,this.uint8[c+4]=n,this.uint8[c+5]=o,this.uint8[c+6]=s,this.uint8[c+7]=l,this.float32[3*i+2]=h,i}}oC.prototype.bytesPerElement=12,ne(oC,"StructArrayLayout2i4ub1f12");class oM extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.float32[o+0]=r,this.float32[o+1]=a,this.float32[o+2]=n,i}}oM.prototype.bytesPerElement=12,ne(oM,"StructArrayLayout3f12");class oP extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=6*i;return this.uint16[l+0]=r,this.uint16[l+1]=a,this.uint16[l+2]=n,this.uint16[l+3]=o,this.float32[3*i+2]=s,i}}oP.prototype.bytesPerElement=12,ne(oP,"StructArrayLayout4ui1f12");class oD extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.uint16[s+0]=r,this.uint16[s+1]=a,this.uint16[s+2]=n,this.uint16[s+3]=o,i}}oD.prototype.bytesPerElement=8,ne(oD,"StructArrayLayout4ui8");class oR extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=6*i;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=n,this.int16[h+3]=o,this.int16[h+4]=s,this.int16[h+5]=l,i}}oR.prototype.bytesPerElement=12,ne(oR,"StructArrayLayout6i12");class oL extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,i,r,a,n,o,s,l,h,u,c,d,p)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=12*i;return this.int16[m+0]=r,this.int16[m+1]=a,this.int16[m+2]=n,this.int16[m+3]=o,this.uint16[m+4]=s,this.uint16[m+5]=l,this.uint16[m+6]=h,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=d,this.int16[m+10]=p,this.int16[m+11]=f,i}}oL.prototype.bytesPerElement=24,ne(oL,"StructArrayLayout4i4ui4i24");class oz extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=10*i,u=5*i;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,i}}oz.prototype.bytesPerElement=20,ne(oz,"StructArrayLayout3i3f20");class oF extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.float32[s+0]=r,this.float32[s+1]=a,this.float32[s+2]=n,this.float32[s+3]=o,i}}oF.prototype.bytesPerElement=16,ne(oF,"StructArrayLayout4f16");class oO extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[+i+0]=r,i}}
7oO.prototype.bytesPerElement=4,ne(oO,"StructArrayLayout1ul4");class oB extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.uint16[n+0]=r,this.uint16[n+1]=a,i}}oB.prototype.bytesPerElement=4,ne(oB,"StructArrayLayout2ui4");class ok extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=this.length;return this.resize(m+1),this.emplace(m,i,r,a,n,o,s,l,h,u,c,d,p,f)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f,m){let _=20*i,g=10*i;return this.int16[_+0]=r,this.int16[_+1]=a,this.int16[_+2]=n,this.int16[_+3]=o,this.int16[_+4]=s,this.float32[g+3]=l,this.float32[g+4]=h,this.float32[g+5]=u,this.float32[g+6]=c,this.int16[_+14]=d,this.uint32[g+8]=p,this.uint16[_+18]=f,this.uint16[_+19]=m,i}}ok.prototype.bytesPerElement=40,ne(ok,"StructArrayLayout5i4f1i1ul2ui40");class oV extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=8*i;return this.int16[u+0]=r,this.int16[u+1]=a,this.int16[u+2]=n,this.int16[u+4]=o,this.int16[u+5]=s,this.int16[u+6]=l,this.int16[u+7]=h,i}}oV.prototype.bytesPerElement=16,ne(oV,"StructArrayLayout3i2i2i16");class oN extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=4*i,h=8*i;return this.float32[l+0]=r,this.float32[l+1]=a,this.float32[l+2]=n,this.int16[h+6]=o,this.int16[h+7]=s,i}}oN.prototype.bytesPerElement=16,ne(oN,"StructArrayLayout2f1f2i16");class oU extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=20*i,u=5*i;return this.uint8[h+0]=r,this.uint8[h+1]=a,this.float32[u+1]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,i}}oU.prototype.bytesPerElement=20,ne(oU,"StructArrayLayout2ub4f20");class oj extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.uint16[o+0]=r,this.uint16[o+1]=a,this.uint16[o+2]=n,i}}oj.prototype.bytesPerElement=6,ne(oj,"StructArrayLayout3ui6");class oG extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=this.length;return this.resize(T+1),this.emplace(T,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T){let S=30*i,I=15*i,E=60*i;return this.int16[S+0]=r,this.int16[S+1]=a,this.int16[S+2]=n,this.float32[I+2]=o,this.float32[I+3]=s,this.uint16[S+8]=l,this.uint16[S+9]=h,this.uint32[I+5]=u,this.uint32[I+6]=c,this.uint32[I+7]=d,this.uint16[S+16]=p,this.uint16[S+17]=f,this.uint16[S+18]=m,this.float32[I+10]=_,this.float32[I+11]=g,this.uint8[E+48]=y,this.uint8[E+49]=x,this.uint8[E+50]=v,this.uint32[I+13]=b,this.int16[S+28]=w,this.uint8[E+58]=T,i}}oG.prototype.bytesPerElement=60,ne(oG,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class oq extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E,A,C,M,P,D,R,L,z){let F=this.length;return this.resize(F+1),this.emplace(F,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E,A,C,M,P,D,R,L,z)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E,A,C,M,P,D,R,L,z,F){let O=20*i,B=40*i;return this.float32[O+0]=r,this.float32[O+1]=a,this.int16[B+4]=n,this.int16[B+5]=o,this.int16[B+6]=s,this.int16[B+7]=l,this.int16[B+8]=h,this.int16[B+9]=u,this.int16[B+10]=c,this.int16[B+11]=d,this.int16[B+12]=p,this.uint16[B+13]=f,this.uint16[B+14]=m,this.uint16[B+15]=_,this.uint16[B+16]=g,this.uint16[B+17]=y,this.uint16[B+18]=x,this.uint16[B+19]=v,this.uint16[B+20]=b,this.uint16[B+21]=w,this.uint16[B+22]=T,this.uint16[B+23]=S,this.uint16[B+24]=I,this.uint16[B+25]=E,this.uint16[B+26]=A,this.uint16[B+27]=C,this.uint32[O+14]=M,this.float32[O+15]=P,this.float32[O+16]=D,this.float32[O+17]=R,this.float32[O+18]=L,this.uint8[80*i+76]=z,this.uint16[B+39]=F,i}}oq.prototype.bytesPerElement=80,ne(oq,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class o$ extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=6*i;return this.float32[h+0]=r,this.float32[h+1]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,this.float32[h+5]=l,i}}o$.prototype.bytesPerElement=24,ne(o$,"StructArrayLayout6f24");class oH extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=5*i;return this.float32[l+0]=r,this.float32[l+1]=a,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,i}}oH.prototype.bytesPerElement=20,ne(oH,"StructArrayLayout5f20");class oZ extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=7*i;return this.float32[u+0]=r,this.float32[u+1]=a,this.float32[u+2]=n,this.float32[u+3]=o,this.float32[u+4]=s,this.float32[u+5]=l,this.float32[u+6]=h,i}}oZ.prototype.bytesPerElement=28,ne(oZ,"StructArrayLayout7f28");class oW extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,i,r,a,n,o,s,l,h,u,c,d)}emplace(i,r,a,n,o,s,l,h,u,c,d,p){let f=11*i;return this.float32[f+0]=r,this.float32[f+1]=a,this.float32[f+2]=n,this.float32[f+3]=o,this.float32[f+4]=s,this.float32[f+5]=l,this.float32[f+6]=h,this.float32[f+7]=u,this.float32[f+8]=c,this.float32[f+9]=d,this.float32[f+10]=p,i}}oW.prototype.bytesPerElement=44,ne(oW,"StructArrayLayout11f44");class oX extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u){let c=this.length;return this.resize(c+1),this.emplace(c,i,r,a,n,o,s,l,h,u)}emplace(i,r,a,n,o,s,l,h,u,c){let d=9*i;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=n,this.float32[d+3]=o,this.float32[d+4]=s,this.float32[d+5]=l,this.float32[d+6]=h,this.float32[d+7]=u,this.float32[d+8]=c,i}}oX.prototype.bytesPerElement=36,ne(oX,"StructArrayLayout9f36");class oY extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.float32[n+0]=r,this.float32[n+1]=a,i}}oY.prototype.bytesPerElement=8,ne(oY,"StructArrayLayout2f8");class oK extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=6*i;return this.uint32[3*i+0]=r,this.uint16[s+2]=a,this.uint16[s+3]=n,this.uint16[s+4]=o,i}}oK.prototype.bytesPerElement=12,ne(oK,"StructArrayLayout1ul3ui12");class oJ extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[+i+0]=r,i}}oJ.prototype.bytesPerElement=2,ne(oJ,"StructArrayLayout1ui2");class oQ extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=this.length;return this.resize(y+1),this.emplace(y,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=16*i;return this.float32[x+0]=r,this.float32[x+1]=a,this.float32[x+2]=n,this.float32[x+3]=o,this.float32[x+4]=s,this.float32[x+5]=l,this.float32[x+6]=h,this.float32[x+7]=u,this.float32[x+8]=c,this.float32[x+9]=d,this.float32[x+10]=p,this.float32[x+11]=f,this.float32[x+12]=m,this.float32[x+13]=_,this.float32[x+14]=g,this.float32[x+15]=y,i}}oQ.prototype.bytesPerElement=64,ne(oQ,"StructArrayLayout16f64");class o0 extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=10*i,c=5*i;return this.uint16[u+0]=r,this.uint16[u+1]=a,this.uint16[u+2]=n,this.uint16[u+3]=o,this.float32[c+2]=s,this.float32[c+3]=l,this.float32[c+4]=h,i}}o0.prototype.bytesPerElement=20,ne(o0,"StructArrayLayout4ui3f20");class o1 extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.int16[+i+0]=r,i}}o1.prototype.bytesPerElement=2,ne(o1,"StructArrayLayout1i2");class o2 extends og{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint8[+i+0]=r,i}}o2.prototype.bytesPerElement=1,ne(o2,"StructArrayLayout1ub1");class o3 extends om{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}o3.prototype.size=40;class o5 extends ok{get(i){return new o3(this,i)}}ne(o5,"CollisionBoxArray");class o4 extends om{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}
7get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}o4.prototype.size=60;class o6 extends oG{get(i){return new o4(this,i)}}ne(o6,"PlacedSymbolArray");class o8 extends om{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(i){this._structArray.uint32[this._pos4+14]=i}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(i){this._structArray.float32[this._pos4+18]=i}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}o8.prototype.size=80;class o9 extends oq{get(i){return new o8(this,i)}}ne(o9,"SymbolInstanceArray");class o7 extends oT{getoffsetX(i){return this.float32[+i+0]}}ne(o7,"GlyphOffsetArray");class se extends ov{getx(i){return this.int16[2*i+0]}gety(i){return this.int16[2*i+1]}}ne(se,"SymbolLineVertexArray");class st extends om{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}st.prototype.size=12;class si extends oK{get(i){return new st(this,i)}}ne(si,"FeatureIndexArray");class sr extends oB{geta_centroid_pos0(i){return this.uint16[2*i+0]}geta_centroid_pos1(i){return this.uint16[2*i+1]}}ne(sr,"FillExtrusionCentroidArray");class sa extends om{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}sa.prototype.size=6;class sn extends ob{get(i){return new sa(this,i)}}ne(sn,"FillExtrusionWallArray");let so=oy([{name:"a_pos",components:2,type:"Int16"}],4),ss=oy([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),sl=oy([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class sh{constructor(i=[]){this.segments=i}_prepareSegment(i,r,a,n,o){let s=this.segments[this.segments.length-1];return i>sh.MAX_VERTEX_ARRAY_LENGTH&&t_(`Max vertices per segment is ${sh.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!s||s.vertexLength+i>sh.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==n||void 0!==o&&s&&void 0!==s.batchIndex&&s.batchIndex!==o)&&(s={vertexOffset:r,primitiveOffset:a,vertexLength:0,primitiveLength:0},void 0!==n&&(s.sortKey=n),void 0!==o&&(s.batchIndex=o),this.segments.push(s)),s}prepareSegment(i,r,a,n,o){return this._prepareSegment(i,r.length,a.length,n,o)}get(){return this.segments}destroy(){for(let i of this.segments)for(let r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,a,n){return new sh([{vertexOffset:i,primitiveOffset:r,vertexLength:a,primitiveLength:n,vaos:{},sortKey:0}])}}function su(i,r){return 256*(i=tr(Math.floor(i),0,255))+tr(Math.floor(r),0,255)}sh.MAX_VERTEX_ARRAY_LENGTH=65535,ne(sh,"SegmentVector");let sc=oy([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),sd=oy([{name:"a_pattern_b",components:4,type:"Uint16"}]),sp=oy([{name:"a_dash",components:4,type:"Uint16"}]);class sf{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
7add(i,r,a,n){this.ids.push(sm(i)),this.positions.push(r,a,n)}eachPosition(i,r){let a=sm(i),n=0,o=this.ids.length-1;for(;n<o;){let i=n+o>>1;this.ids[i]>=a?o=i:n=i+1}for(;this.ids[n]===a;)r(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++}static serialize(i,r){let a=new Float64Array(i.ids),n=new Uint32Array(i.positions);return function i(r,a,n,o){for(;n<o;){let s=r[n+o>>1],l=n-1,h=o+1;for(;;){do l++;while(r[l]<s);do h--;while(r[h]>s);if(l>=h)break;s_(r,l,h),s_(a,3*l,3*h),s_(a,3*l+1,3*h+1),s_(a,3*l+2,3*h+2)}h-n<o-h?(i(r,a,n,h),n=h+1):(i(r,a,h+1,o),o=h)}}(a,n,0,a.length-1),r&&(r.add(a.buffer),r.add(n.buffer)),{ids:a,positions:n}}static deserialize(i){let r,a=new sf;for(let n of(a.ids=i.ids,a.positions=i.positions,a.ids))n!==r&&a.uniqueIds.push(n),r=n;return a.indexed=!0,a}}function sm(i){let r=+i;return Number.isSafeInteger(r)?r:ia(String(i))}function s_(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}ne(sf,"FeaturePositionMap");class sg{constructor(i){this.gl=i.gl,this.initialized=!1}fetchUniformLocation(i,r){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(i,r),this.initialized=!0),!!this.location}set(i,r,a){throw Error("Uniform#set() must be implemented by each concrete Uniform")}}class sy extends sg{constructor(i){super(i),this.current=0}set(i,r,a){this.fetchUniformLocation(i,r)&&this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}}class sx extends sg{constructor(i){super(i),this.current=0}set(i,r,a){this.fetchUniformLocation(i,r)&&this.current!==a&&(this.current=a,this.gl.uniform1f(this.location,a))}}class sv extends sg{constructor(i){super(i),this.current=[0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1])))}}class sb extends sg{constructor(i){super(i),this.current=[0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2])))}}class sw extends sg{constructor(i){super(i),this.current=[0,0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]&&a[3]===this.current[3]||(this.current=a,this.gl.uniform4ui(this.location,a[0],a[1],a[2],a[3])))}}class sT extends sg{constructor(i){super(i),this.current=[0,0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]&&a[3]===this.current[3]||(this.current=a,this.gl.uniform4f(this.location,a[0],a[1],a[2],a[3])))}}class sS extends sg{constructor(i){super(i),this.current=i_.transparent.toPremultipliedRenderColor(null)}set(i,r,a){this.fetchUniformLocation(i,r)&&(a.r===this.current.r&&a.g===this.current.g&&a.b===this.current.b&&a.a===this.current.a||(this.current=a,this.gl.uniform4f(this.location,a.r,a.g,a.b,a.a)))}}let sI=new Float32Array(16);class sE extends sg{constructor(i){super(i),this.current=sI}set(i,r,a){if(this.fetchUniformLocation(i,r)){if(a[12]!==this.current[12]||a[0]!==this.current[0])return this.current=a,void this.gl.uniformMatrix4fv(this.location,!1,a);for(let i=1;i<16;i++)if(a[i]!==this.current[i]){this.current=a,this.gl.uniformMatrix4fv(this.location,!1,a);break}}}}let sA=new Float32Array(9),sC=new Float32Array(4);class sM extends sg{constructor(i){super(i),this.current=sC}set(i,r,a){if(this.fetchUniformLocation(i,r)){for(let i=0;i<4;i++)if(a[i]!==this.current[i]){this.current=a,this.gl.uniformMatrix2fv(this.location,!1,a);break}}}}function sP(i){return[su(255*i.r,255*i.g),su(255*i.b,255*i.a)]}function sD(i,r,a,n,o,s,l,h){return!!i&&("composite"===i.kind||"source"===i.kind?"none"===i.evaluate(new nH(0,{brightness:s,worldview:h}),r,a,o,n,l):"none"===i.value)}class sR{constructor(i,r,a,n){this.value=i,this.uniformNames=r.map(i=>`u_${i}`),this.type=a,this.context=n}setUniform(i,r,a,n,o){let s=n.constantOr(this.value);r.set(i,o,s instanceof i_?s.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):s)}getBinding(i,r){return"color"===this.type?new sS(i):new sx(i)}}class sL{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(i,r){this.pixelRatio=i.pixelRatio||1,this.pattern=i.tl.concat(i.br),this.patternTransition=r?r.tl.concat(r.br):this.pattern}setUniform(i,r,a,n,o){let s=null;"u_pattern"!==o&&"u_dash"!==o||(s=this.pattern),"u_pattern_b"===o&&(s=this.patternTransition),"u_pixel_ratio"===o&&(s=this.pixelRatio),s&&r.set(i,o,s)}getBinding(i,r){return"u_pattern"===r||"u_pattern_b"===r||"u_dash"===r?new sw(i):new sx(i)}}class sz{constructor(i,r,a,n){this.expression=i,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===a?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(i,r,a,n,o,s,l,h){let u=this.paintVertexArray.length,c="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new nH(0,{brightness:s,worldview:h}),r,{},o,n,l):"constant"===this.expression.kind&&this.expression.value,d=sD(this.lutExpression,r,{},n,o,s,l,h);this.paintVertexArray.resize(i),this._setPaintValue(u,i,c,d?null:this.context.lut)}updatePaintArray(i,r,a,n,o,s,l,h){let u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:l,worldview:h},a,n,void 0,o):"constant"===this.expression.kind&&this.expression.value,c=sD(this.lutExpression,a,n,o,void 0,l,void 0,h);this._setPaintValue(i,r,u,c?null:this.context.lut)}_setPaintValue(i,r,a,n){if("color"===this.type){let o=sP(a.toPremultipliedRenderColor(n));for(let a=i;a<r;a++)this.paintVertexArray.emplace(a,o[0],o[1])}else{for(let n=i;n<r;n++)this.paintVertexArray.emplace(n,a);
7this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&"constant"!==this.lutExpression.kind&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||"constant"!==this.expression.kind&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class sF{constructor(i,r,a,n,o,s){this.expression=i,this.uniformNames=r.map(i=>`u_${i}_t`),this.type=a,this.useIntegerZoom=n,this.context=o,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===a?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(i,r,a,n,o,s,l,h){let u=this.expression.evaluate(new nH(this.context.zoom,{brightness:s,worldview:h}),r,{},o,n,l),c=this.expression.evaluate(new nH(this.context.zoom+1,{brightness:s,worldview:h}),r,{},o,n,l),d=sD(this.lutExpression,r,{},n,o,s,l,h),p=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(p,i,u,c,d?null:this.context.lut)}updatePaintArray(i,r,a,n,o,s,l,h){let u=this.expression.evaluate({zoom:this.context.zoom,brightness:l,worldview:h},a,n,void 0,o),c=this.expression.evaluate({zoom:this.context.zoom+1,brightness:l,worldview:h},a,n,void 0,o),d=sD(this.lutExpression,a,n,o,void 0,l,void 0,h);this._setPaintValue(i,r,u,c,d?null:this.context.lut)}_setPaintValue(i,r,a,n,o){if("color"===this.type){let s=sP(a.toPremultipliedRenderColor(o)),l=sP(n.toPremultipliedRenderColor(o));for(let a=i;a<r;a++)this.paintVertexArray.emplace(a,s[0],s[1],l[0],l[1])}else{for(let o=i;o<r;o++)this.paintVertexArray.emplace(o,a,n);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(n))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(i,r,a,n,o){let s=this.useIntegerZoom?Math.floor(a.zoom):a.zoom,l=tr(this.expression.interpolationFactor(s,this.context.zoom,this.context.zoom+1),0,1);r.set(i,o,l)}getBinding(i,r){return new sx(i)}}class sO{constructor(i,r,a,n,o){this.expression=i,this.layerId=o,this.paintVertexAttributes=("array"===a?sp:sc).members;for(let i=0;i<r.length;++i);this.paintVertexArray=new n,this.paintTransitionVertexArray=new oD}populatePaintArray(i,r,a,n){let o=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValues(o,i,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(i,r,a,n,o,s,l){this._setPaintValues(i,r,a.patterns&&a.patterns[this.layerId],s)}_setPaintValues(i,r,a,n){if(!n||!a)return;let o=n[a[0]],s=n[a[1]];if(o){if(o){let{tl:a,br:n,pixelRatio:s}=o;for(let o=i;o<r;o++)this.paintVertexArray.emplace(o,a[0],a[1],n[0],n[1],s)}if(s){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);let{tl:a,br:n}=s;for(let o=i;o<r;o++)this.paintTransitionVertexArray.emplace(o,a[0],a[1],n[0],n[1])}}}upload(i){let r=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,r)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=i.createVertexBuffer(this.paintTransitionVertexArray,sd.members,r))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class sB{constructor(i,r,a=()=>!0){this.binders={},this._buffers=[],this.context=r;const n=[];for(const o in i.paint._values){const s=i.paint.get(o);if(o.endsWith("-use-theme")||!a(o)||!(s instanceof nQ&&aj(s.property.specification)))continue;const l=function(i,r){return sV[i]||[i.replace(`${r}
7-`,"").replace(/-/g,"_")]}(o,i.type),h=s.value,u=s.property.specification.type,c=!!s.property.useIntegerZoom,d="line-dasharray"===o||o.endsWith("pattern"),p=i.paint.get(`${o}-use-theme`),f="line-dasharray"===o&&"constant"!==i.layout.get("line-cap").value.kind||p&&"constant"!==p.value.kind;if("constant"!==h.kind||f)if("source"===h.kind||f||d){const r=sj(o,u,"source");this.binders[o]=d?new sO(h,l,u,r,i.id):new sz(h,l,u,r),n.push(`/a_${o}`)}else{const i=sj(o,u,"composite");this.binders[o]=new sF(h,l,u,c,r,i),n.push(`/z_${o}`)}else this.binders[o]=d?new sL(h.value,l):new sR(h.value,l,u,r),n.push(`/u_${o}`);p&&(this.binders[o].lutExpression=p.value)}this.cacheKey=n.sort().join("")}getMaxValue(i){let r=this.binders[i];return r instanceof sz||r instanceof sF?r.maxValue:0}populatePaintArrays(i,r,a,n,o,s,l,h){for(let u in this.binders){let c=this.binders[u];c.context=this.context,(c instanceof sz||c instanceof sF||c instanceof sO)&&c.populatePaintArray(i,r,a,n,o,s,l,h)}}setConstantPatternPositions(i,r){for(let a in this.binders){let n=this.binders[a];n instanceof sL&&n.setConstantPatternPositions(i,r)}}getPatternTransitionVertexBuffer(i){let r=this.binders[i];return r instanceof sO?r.paintTransitionVertexBuffer:null}updatePaintArrays(i,r,a,n,o,s,l,h,u,c){let d=!1,p=Object.keys(i),f=0!==p.length&&!h,m=f?p:r.uniqueIds;for(let h in this.context.lut=o.lut,this.binders){let p=this.binders[h];if(p.context=this.context,(p instanceof sz||p instanceof sF||p instanceof sO)&&p.expression&&p.expression.kind&&"constant"!==p.expression.kind&&(!0===p.expression.isStateDependent||!1===p.expression.isLightConstant)){for(let a of(p.expression=o.paint.get(h).value,m)){let o=i[a.toString()];r.eachPosition(a,(i,r,a)=>{let h=n.feature(i);p.updatePaintArray(r,a,h,o,s,l,u,c)})}if(!f)for(let r of a.uniqueIds){let o=i[r.toString()];a.eachPosition(r,(i,r,a)=>{let h=n.feature(i);p.updatePaintArray(r,a,h,o,s,l,u,c)})}d=!0}}return d}defines(){let i=[];for(let r in this.binders){let a=this.binders[r];(a instanceof sR||a instanceof sL)&&i.push(...a.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getPaintVertexBuffers(){return this._buffers}getUniforms(i){let r=[];for(let a in this.binders){let n=this.binders[a];if(n instanceof sR||n instanceof sL||n instanceof sF)for(let o of n.uniformNames)r.push({name:o,property:a,binding:n.getBinding(i,o)})}return r}setUniforms(i,r,a,n,o){for(let{name:r,property:s,binding:l}of a)this.binders[s].setUniform(i,l,o,n.get(s),r)}updatePaintBuffers(){for(let i in this._buffers=[],this.binders){let r=this.binders[i];(r instanceof sz||r instanceof sF||r instanceof sO)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer),r instanceof sO&&r.paintTransitionVertexBuffer&&this._buffers.push(r.paintTransitionVertexBuffer)}}upload(i){for(let r in this.binders){let a=this.binders[r];(a instanceof sz||a instanceof sF||a instanceof sO)&&a.upload(i)}this.updatePaintBuffers()}destroy(){for(let i in this.binders){let r=this.binders[i];(r instanceof sz||r instanceof sF||r instanceof sO)&&r.destroy()}}}class sk{constructor(i,r,a=()=>!0){for(const n of(this.programConfigurations={},i))this.programConfigurations[n.id]=new sB(n,r,a);this.needsUpload=!1,this._featureMap=new sf,this._featureMapWithoutIds=new sf,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(i,r,a,n,o,s,l,h,u){for(let a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(i,r,n,o,s,l,h,u);void 0!==r.id?this._featureMap.add(r.id,a,this._bufferOffset,i):(this._featureMapWithoutIds.add(this._idlessCounter,a,this._bufferOffset,i),this._idlessCounter+=1),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,a,n,o,s,l,h){for(let u of a)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(i,this._featureMap,this._featureMapWithoutIds,r,u,n,o,s,l||0,h)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(let i in this.programConfigurations)this.programConfigurations[i].destroy()}}let sV={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
7pwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]},sN={"line-pattern":{source:oP,composite:oP},"fill-pattern":{source:oP,composite:oP},"fill-extrusion-pattern":{source:oP,composite:oP},"line-dasharray":{source:oD,composite:oD}},sU={color:{source:oY,composite:oF},number:{source:oT,composite:oY}};function sj(i,r,a){let n=sN[i];return n&&n[a]||sU[r][a]}ne(sR,"ConstantBinder"),ne(sL,"PatternConstantBinder"),ne(sz,"SourceExpressionBinder"),ne(sO,"PatternCompositeBinder"),ne(sF,"CompositeExpressionBinder"),ne(sB,"ProgramConfiguration",{omit:["_buffers"]}),ne(sk,"ProgramConfigurationSet");let sG=8192/Math.PI/2,sq=[64,32,16],s$=-sG;function sH(i,r,a,n=sG){return[i*Math.sin(a*=e8)*n,-r*n,i*Math.cos(a)*n]}function sZ(i,r,a){return sH(Math.cos(i*e8),Math.sin(i*e8),r,a)}let sW=2*Math.PI*6371008.8;class sX{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sX(tn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){let r=Math.PI/180,a=this.lat*r,n=i.lat*r;return 6371008.8*Math.acos(Math.min(Math.sin(a)*Math.sin(n)+Math.cos(a)*Math.cos(n)*Math.cos((i.lng-this.lng)*r),1))}toBounds(i=0){let r=360*i/0x2637f09,a=r/Math.cos(Math.PI/180*this.lat);return new sY({lng:this.lng-a,lat:this.lat-r},{lng:this.lng+a,lat:this.lat+r})}toEcef(i){return sZ(this.lat,this.lng,sG+i*sG/6371008.8)}static convert(i){if(i instanceof sX)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new sX(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new sX(Number("lng"in i?i.lng:i.lon),Number(i.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>]")}}class sY{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):Array.isArray(i)&&4===i.length?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof sX?new sX(i.lng,i.lat):sX.convert(i),this}setSouthWest(i){return this._sw=i instanceof sX?new sX(i.lng,i.lat):sX.convert(i),this}extend(i){let r,a,n=this._sw,o=this._ne;if(i instanceof sX)r=i,a=i;else{if(!(i instanceof sY))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(sY.convert(i)):this.extend(sX.convert(i)):"object"==typeof i&&null!==i&&i.hasOwnProperty("lat")&&(i.hasOwnProperty("lon")||i.hasOwnProperty("lng"))?this.extend(sX.convert(i)):this;if(r=i._sw,a=i._ne,!r||!a)return this}return n||o?(n.lng=Math.min(r.lng,n.lng),n.lat=Math.min(r.lat,n.lat),o.lng=Math.max(a.lng,o.lng),o.lat=Math.max(a.lat,o.lat)):(this._sw=new sX(r.lng,r.lat),this._ne=new sX(a.lng,a.lat)),this}getCenter(){return new sX((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 sX(this.getWest(),this.getNorth())}getSouthEast(){return new sX(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(i){let{lng:r,lat:a}=sX.convert(i),n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&n}static convert(i){if(i)return i instanceof sY?i:new sY(i)}}function sK(i){return sW*Math.cos(i*Math.PI/180)}function sJ(i){return(180+i)/360}function sQ(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function s0(i){return 360*i-180}function s1(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180)
7)-90}function s2(i,r){return i*sK(s1(r))}function s3(i){return Math.cos(tr(i,-85.051129,85.051129)*e8)}function s5(i,r){let a=Math.pow(2,tr(r,0,25.5));return s3(i)*sW/(512*a)}function s4(i){return 1/Math.cos(i*Math.PI/180)}function s6(i,r=0){let a=Math.exp(Math.PI*(1-(i.y+r/8192)/(1<<i.z)*2));return 0x4c6fe12*a/(a*a+1)/8192/(1<<i.z)}class s8{constructor(i,r,a=0){this.x=+i,this.y=+r,this.z=+a}static fromLngLat(i,r=0){let a=sX.convert(i);return new s8(sJ(a.lng),sQ(a.lat),r/sK(a.lat))}toLngLat(){return new sX(s0(this.x),s1(this.y))}toAltitude(){return s2(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/sW*s4(s1(this.y))}}function s9(i,r,a){let n=i[0],o=n.x,s=n.y;r(n);let l=[n];for(let h=1;h<i.length;h++){let u=i[h],{x:c,y:d}=u;r(u),function i(r,a,n,o,s,l,h,u,c){var d,p,f,m,_,g;let y,x,v=(a+o)/2,b=(n+s)/2,w=new e4(v,b);u(w),(d=w.x,p=w.y,f=l.x,m=l.y,_=h.x,g=h.y,y=f-_,x=m-g,Math.abs((m-p)*y-(f-d)*x)/Math.hypot(y,x)>=c)?(i(r,a,n,v,b,l,w,u,c),i(r,v,b,o,s,w,h,u,c)):r.push(h)}(l,o,s,c,d,n,u,r,a),o=c,s=d,n=u}return l}let s7=-16383-1;function le(i,r,a){let n=i.loadGeometry(),o=i.extent,s=8192/o;if(r&&a&&a.projection.isReprojectedInTileSpace){let s=1<<r.z,{scale:l,x:h,y:u,projection:c}=a,d=i=>{let a=s0((r.x+i.x/o)/s),n=s1((r.y+i.y/o)/s),d=c.project(a,n);i.x=(d.x*l-h)*o,i.y=(d.y*l-u)*o};for(let r=0;r<n.length;r++)if(1!==i.type)n[r]=s9(n[r],d,1);else{let i=[];for(let a of n[r])a.x<0||a.x>=o||a.y<0||a.y>=o||(d(a),i.push(a));n[r]=i}}for(let i of n)for(let r of i)!function(i,r){let a=Math.round(i.x*r),n=Math.round(i.y*r);i.x=tr(a,s7,16383),i.y=tr(n,s7,16383),(a<i.x||a>i.x+1||n<i.y||n>i.y+1)&&t_("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(r,s);return n}function lt(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?le(i):[]}}class li{constructor(i,r,a,n,o){this.properties={},this.extent=a,this.type=0,this.id=void 0,this._pbf=i,this._geometry=-1,this._keys=n,this._values=o,i.readFields(lr,this,r)}loadGeometry(){let i=this._pbf;i.pos=this._geometry;let r=i.readVarint()+i.pos,a=[],n,o=1,s=0,l=0,h=0;for(;i.pos<r;){if(s<=0){let r=i.readVarint();o=7&r,s=r>>3}if(s--,1===o||2===o)l+=i.readSVarint(),h+=i.readSVarint(),1===o&&(n&&a.push(n),n=[]),n&&n.push(new e4(l,h));else{if(7!==o)throw Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&a.push(n),a}bbox(){let i=this._pbf;i.pos=this._geometry;let r=i.readVarint()+i.pos,a=1,n=0,o=0,s=0,l=1/0,h=-1/0,u=1/0,c=-1/0;for(;i.pos<r;){if(n<=0){let r=i.readVarint();a=7&r,n=r>>3}if(n--,1===a||2===a)o+=i.readSVarint(),s+=i.readSVarint(),o<l&&(l=o),o>h&&(h=o),s<u&&(u=s),s>c&&(c=s);else if(7!==a)throw Error(`unknown command ${a}`)}return[l,u,h,c]}toGeoJSON(i,r,a){let n,o=this.extent*Math.pow(2,a),s=this.extent*i,l=this.extent*r,h=this.loadGeometry();function u(i){return[360*(i.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(i.y+l)/o)*Math.PI))-90]}function c(i){return i.map(u)}if(1===this.type){let i=[];for(let r of h)i.push(r[0]);let r=c(i);n=1===i.length?{type:"Point",coordinates:r[0]}:{type:"MultiPoint",coordinates:r}}else if(2===this.type){let i=h.map(c);n=1===i.length?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i}}else{if(3!==this.type)throw Error("unknown feature type");{let i=function(i){let r,a,n=i.length;if(n<=1)return[i];let o=[];for(let s=0;s<n;s++){let n=function(i){let r=0;for(let a,n,o=0,s=i.length,l=s-1;o<s;l=o++)a=i[o],r+=((n=i[l]).x-a.x)*(a.y+n.y);return r}(i[s]);0!==n&&(void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[i[s]]):r&&r.push(i[s]))}return r&&o.push(r),o}(h),r=[];for(let a of i)r.push(a.map(c));n=1===r.length?{type:"Polygon",coordinates:r[0]}:{type:"MultiPolygon",coordinates:r}}}let d={type:"Feature",geometry:n,properties:this.properties};return null!=this.id&&(d.id=this.id),d}}function lr(i,r,a){1===i?r.id=a.readVarint():2===i?function(i,r){let a=i.readVarint()+i.pos;for(;i.pos<a;){let a=r._keys[i.readVarint()],n=r._values[i.readVarint()];r.properties[a]=n}}(a,r):3===i?r.type=a.readVarint():4===i&&(r._geometry=a.pos)}li.types=["Unknown","Point","LineString","Polygon"];class la{constructor(i,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(ln,this,r),this.length=this._features.length}feature(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];let r=this._pbf.readVarint()+this._pbf.pos;return new li(this._pbf,r,this.extent,this._keys,this._values)}}function ln(i,r,a){15===i?r.version=a.readVarint():1===i?r.name=a.readString():5===i?r.extent=a.readVarint():2===i?r._features.push(a.pos):3===i?r._keys.push(a.readString()):4===i&&r._values.push(function(i){let r=null,a=i.readVarint()+i.pos;for(;i.pos<a;){let a=i.readVarint()>>3;r=1===a?i.readString():2===a?i.readFloat():3===a?i.readDouble():4===a?i.readVarint64():5===a?i.readVarint():6===a?i.readSVarint():7===a?i.readBoolean():null}if(null==r)throw Error("unknown feature value");return r}(a))}class lo{constructor(i,r){this.layers=i.readFields(ls,{},r)}}function ls(i,r,a){if(3===i){let i=new la(a,a.readVarint()+a.pos);i.length&&(r[i.name]=i)}}let ll="3d_elevation_id",lh="level";
7class lu{constructor(){this._valid=!1}reset(i){return this.feature=i,this._valid=!0,this._geometry=i.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(i,r){return this._valid&&i(r(this._geometry)),this}require(i,r,a){return this.get(i,!0,r,a)}optional(i,r,a){return this.get(i,!1,r,a)}success(){return this._valid}get(i,r,a,n){let o=this.feature.properties.hasOwnProperty(i)?+this.feature.properties[i]:void 0;return this._valid&&void 0!==o&&!Number.isNaN(o)?a(n?n(o):o):r&&(this._valid=!1),this}}class lc{constructor(i,r){this.featureFunc=i,this.vertexFunc=r}parseFeature(i,r,a){return this.featureFunc(i,r,a)}parseVertex(i,r,a){return this.vertexFunc(i,r,a)}}let ld=new lc((i,r,a)=>i.reset(r).require(ll,i=>{a.id=i}).optional("fixed_height_relative",i=>{a.constantHeight=i},lf.decodeRelativeHeight).geometry(i=>{a.bounds=i},rc).success(),(i,r,a)=>i.reset(r).require(ll,i=>{a.id=i}).require("elevation_idx",i=>{a.idx=i}).require("extent",i=>{a.extent=i}).require("height_relative",i=>{a.height=i},lf.decodeRelativeHeight).geometry(i=>{a.position=i},lf.getPoint).success()),lp=new lc((i,r,a)=>i.reset(r).require(ll,i=>{a.id=i}).optional("fixed_height",i=>{a.constantHeight=i},lf.decodeMetricHeight).geometry(i=>{a.bounds=i},rc).success(),(i,r,a)=>i.reset(r).require(ll,i=>{a.id=i}).require("elevation_idx",i=>{a.idx=i}).require("extent",i=>{a.extent=i}).require("height",i=>{a.height=i},lf.decodeMetricHeight).geometry(i=>{a.position=i},lf.getPoint).success());class lf{static getPoint(i){return eY(i[0][0].x,i[0][0].y)}static decodeRelativeHeight(i){return 1e-4*i*5}static decodeMetricHeight(i){return 1e-4*i}static getVersionSchema(i){return i?"1.0.1"===i?lp:void 0:ld}static parse(i){let r=[],a=[],n=i.length,o=new lu;for(let s=0;s<n;s++){let n=i.feature(s),l=n.properties.version,h=lf.getVersionSchema(l);if(void 0===h){t_(`Unknown elevation feature version number ${l||"(unknown)"}`);continue}let u=n.properties.type;if(!u)continue;let c=li.types[n.type];if("Point"===c&&"curve_point"===u){let i={};h.parseVertex(o,n,i)&&r.push(i)}else if("Polygon"===c&&"curve_meta"===u){let i={};h.parseFeature(o,n,i)&&a.push(i)}}return{vertices:r,features:a}}}class lm{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,a){let n=e2(r,this.dir);if(1e-6>Math.abs(n))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1])/n;return a[0]=this.pos[0]+this.dir[0]*o,a[1]=this.pos[1]+this.dir[1]*o,!0}}class l_{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,a){let n=eM(r,this.dir);if(1e-6>Math.abs(n))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/n;return a[0]=this.pos[0]+this.dir[0]*o,a[1]=this.pos[1]+this.dir[1]*o,a[2]=this.pos[2]+this.dir[2]*o,!0}closestPointOnSphere(i,r,a){var n,o,s,l,h,u,c;if(n=this.pos,o=n[0],s=n[1],l=n[2],h=i[0],u=i[1],c=i[2],Math.abs(o-h)<=1e-6*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-u)<=1e-6*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(l-c)<=1e-6*Math.max(1,Math.abs(l),Math.abs(c))||0===r)return a[0]=a[1]=a[2]=0,!1;let[d,p,f]=this.dir,m=this.pos[0]-i[0],_=this.pos[1]-i[1],g=this.pos[2]-i[2],y=d*d+p*p+f*f,x=2*(m*d+_*p+g*f),v=x*x-4*y*(m*m+_*_+g*g-r*r);if(v<0){let i=Math.max(-x/2,0),n=m+d*i,o=_+p*i,s=g+f*i,l=Math.hypot(n,o,s);return a[0]=n*r/l,a[1]=o*r/l,a[2]=s*r/l,!1}{let i=(-x-Math.sqrt(v))/(2*y);if(i<0){let i=Math.hypot(m,_,g);return a[0]=m*r/i,a[1]=_*r/i,a[2]=g*r/i,!1}return a[0]=m+d*i,a[1]=_+p*i,a[2]=g+f*i,!0}}}class lg{constructor(i,r,a,n,o){this.TL=i,this.TR=r,this.BR=a,this.BL=n,this.horizon=o}static fromInvProjectionMatrix(i,r,a){let n=[-1,1,1],o=[1,1,1],s=[1,-1,1],l=[-1,-1,1];return new lg(eR(n,n,i),eR(o,o,i),eR(s,s,i),eR(l,l,i),r/a)}}function ly(i,r,a){let n=1/0,o=-1/0,s=[];for(let l of i){ey(s,l,r);let i=eM(s,a);n=Math.min(n,i),o=Math.max(o,i)}return[n,o]}function lx(i,r){let a=!0;for(let n=0;n<i.planes.length;n++){let o=i.planes[n],s=0;for(let i=0;i<r.length;i++)s+=+(eM(o,r[i])+o[3]>=0);if(0===s)return 0;s!==r.length&&(a=!1)}return a?2:1}function lv(i,r){for(let a of i.projections){let n=ly(r,i.points[0],a.axis);if(a.projection[1]<n[0]||a.projection[0]>n[1])return 0}return 1}function lb(i,r){let a=0,n=[0,0,0,0];for(let o=0;o<i.length;o++)n[0]=i[o][0],n[1]=i[o][1],n[2]=i[o][2],n[3]=1,n[0]*r[0]+n[1]*r[1]+n[2]*r[2]+n[3]*r[3]>=0&&a++;return a}class lw{constructor(i,r){for(const a of(this.points=i||Array(8).fill([0,0,0]),this.planes=r||Array(6).fill([
70,0,0,0]),this.bounds=lT.fromPoints(this.points),this.projections=[],this.frustumEdges=[ey([],this.points[2],this.points[3]),ey([],this.points[0],this.points[3]),ey([],this.points[4],this.points[0]),ey([],this.points[5],this.points[1]),ey([],this.points[6],this.points[2]),ey([],this.points[7],this.points[3])],this.frustumEdges)){const i=[0,-a[2],a[1]],r=[a[2],0,-a[0]];this.projections.push({axis:i,projection:ly(this.points,this.points[0],i)}),this.projections.push({axis:r,projection:ly(this.points,this.points[0],r)})}}static fromInvProjectionMatrix(i,r,a,n){let o=Math.pow(2,a),s=[[-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]].map(a=>{var s;let l=eN([],a,i),h=1/l[3]/r*o;return l[0]=l[0]*(s=[h,h,n?1/l[3]:h,h])[0],l[1]=l[1]*s[1],l[2]=l[2]*s[2],l[3]=l[3]*s[3],l}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(i=>{let r=eC([],eP([],ey([],s[i[0]],s[i[1]]),ey([],s[i[2]],s[i[1]]))),a=-eM(r,s[i[1]]);return r.concat(a)}),h=[];for(let i=0;i<s.length;i++)h.push([s[i][0],s[i][1],s[i][2]]);return new lw(h,l)}intersectsPrecise(i,r,a){for(let a=0;a<r.length;a++)if(!lb(i,r[a]))return 0;for(let r=0;r<this.planes.length;r++)if(!lb(i,this.planes[r]))return 0;for(let r of a)for(let a of this.frustumEdges){let n=eP([],r,a),o=ef(n);if(0===o)continue;ew(n,n,1/o);let s=ly(this.points,this.points[0],n),l=ly(i,this.points[0],n);if(s[0]>l[1]||l[0]>s[1])return 0}return 1}containsPoint(i){for(let r of this.planes){let a=r[3];if(eM([r[0],r[1],r[2]],i)+a<0)return!1}return!0}}class lT{static fromPoints(i){let r=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];for(let n of i)ev(r,r,n),eb(a,a,n);return new lT(r,a)}static fromTileIdAndHeight(i,r,a){let n=1<<i.canonical.z,o=i.canonical.x,s=i.canonical.y;return new lT([o/n,s/n,r],[(o+1)/n,(s+1)/n,a])}static applyTransform(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)eR(a[i],a[i],r);return lT.fromPoints(a)}static applyTransformFast(i,r){let a=[r[12],r[13],r[14]],n=[...a];for(let o=0;o<3;o++)for(let s=0;s<3;s++){let l=r[4*s+o],h=l*i.min[s],u=l*i.max[s];a[o]+=Math.min(h,u),n[o]+=Math.max(h,u)}return new lT(a,n)}static projectAabbCorners(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)eR(a[i],a[i],r);return a}constructor(i,r){this.min=i,this.max=r,this.center=ew([],eg([],this.min,this.max),.5)}quadrant(i){let r=[i%2==0,i<2],a=ep(this.min),n=ep(this.max);for(let i=0;i<r.length;i++)a[i]=r[i]?this.min[i]:this.center[i],n[i]=r[i]?this.center[i]:this.max[i];return n[2]=this.max[2],new lT(a,n)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}distanceZ(i){return Math.max(Math.min(this.max[2],i[2]),this.min[2])-i[2]}getCorners(){let i=this.min,r=this.max;return[[i[0],i[1],i[2]],[r[0],i[1],i[2]],[r[0],r[1],i[2]],[i[0],r[1],i[2]],[i[0],i[1],r[2]],[r[0],i[1],r[2]],[r[0],r[1],r[2]],[i[0],r[1],r[2]]]}intersects(i){return this.intersectsAabb(i.bounds)?lx(i,this.getCorners()):0}intersectsFlat(i){return this.intersectsAabb(i.bounds)?lx(i,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(i,r){return r||this.intersects(i)?lv(i,this.getCorners()):0}intersectsPreciseFlat(i,r){return r||this.intersectsFlat(i)?lv(i,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(i){for(let r=0;r<3;++r)if(this.min[r]>i.max[r]||i.min[r]>this.max[r])return!1;return!0}intersectsAabbXY(i){return!(this.min[0]>i.max[0]||i.min[0]>this.max[0]||this.min[1]>i.max[1]||i.min[1]>this.max[1])}encapsulate(i){for(let r=0;r<3;r++)this.min[r]=Math.min(this.min[r],i.min[r]),this.max[r]=Math.max(this.max[r],i.max[r])}encapsulatePoint(i){for(let r=0;r<3;r++)this.min[r]=Math.min(this.min[r],i[r]),this.max[r]=Math.max(this.max[r],i[r])}closestPoint(i){return[Math.max(Math.min(this.max[0],i[0]),this.min[0]),Math.max(Math.min(this.max[1],i[1]),this.min[1]),Math.max(Math.min(this.max[2],i[2]),this.min[2])]}}ne(lT,"Aabb");class lS{constructor(i,r){this.feature=i,this.metersToTile=r,this.index=0}get(){let i=this.feature.vertices[this.index],r=this.feature.vertexProps[this.index].dir,a=r[1],n=-r[0],o=(i.extent+1)*this.metersToTile;return[new e4(Math.trunc(i.position[0]+a*o),Math.trunc(i.position[1]+n*o)),new e4(Math.trunc(i.position[0]-a
7*o),Math.trunc(i.position[1]-n*o))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class lI{constructor(i,r,a,n,o,s){if(this.vertices=[],this.vertexProps=[],this.edges=[],this.edgeProps=[],this._tmpVec2=[eX(),eX(),eX(),eX(),eX(),eX(),eX()],this.id=i,this.heightRange={min:a,max:a},this.safeArea=r,this.constantHeight=a,null==this.constantHeight&&(null!=this.constantHeight||0!==n.length)){for(const i of(this.vertices=n,this.edges=o,this.edges=this.edges.filter(i=>{var r,a;return i.a<this.vertices.length&&i.b<this.vertices.length&&((r=this.vertices[i.a].position)[0]!==(a=this.vertices[i.b].position)[0]||r[1]!==a[1])}),this.heightRange={min:1/0,max:-1/0},this.vertices))this.vertexProps.push({dir:eY(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,i.height),this.heightRange.max=Math.max(this.heightRange.max,i.height);for(const i of this.edges){const r=this.vertices[i.a].position,a=this.vertices[i.b].position,n=eJ(eX(),a,r),o=e0(n),s=eQ(eX(),n,1/o);this.edgeProps.push({vec:n,dir:s,len:o});const l=this.vertexProps[i.a].dir,h=this.vertexProps[i.b].dir;eK(l,l,s),eK(h,h,s)}for(const i of this.vertexProps)0===i.dir[0]&&0===i.dir[1]||e1(i.dir,i.dir);this.tessellate(s)}}pointElevation(i){if(null!=this.constantHeight)return this.constantHeight;let r=this.getClosestEdge(i);if(null==r)return 0;let[a,n]=r;return iv(this.vertices[this.edges[a].a].height,this.vertices[this.edges[a].b].height,n)}computeSlopeNormal(i,r){let a=this.getClosestEdge(i);if(!a)return em(0,0,1);let n=a[0],o=this.edges[n],s=this.edgeProps[n].vec,l=em(s[0],s[1],(this.vertices[o.b].height-this.vertices[o.a].height)*r),h=em(l[1],-l[0],0);eP(h,h,l);let u=ef(h);return u>0?ew(h,h,1/u):e_(h,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(i){var r,a,n,o;if(0===this.edges.length)return;let s=0,l=1/0,h=0,[u,c,d,p,f,m,_]=this._tmpVec2;r=i.x,a=i.y,_[0]=r,_[1]=a;let g=new lm(_,null);for(let i=0;i<this.edges.length;i++){let r=this.edges[i],a=this.edgeProps[i].dir;g.dir=a;let y=this.vertices[r.a].position,x=this.vertices[r.b].position,v=g.intersectsPlane(y,this.vertexProps[r.a].dir,u),b=g.intersectsPlane(x,this.vertexProps[r.b].dir,c);if(!v||!b)continue;eJ(d,c,u),eJ(p,_,u);let w=e2(d,d),T=w>0?e2(p,d)/w:0,S=tr(T,0,1),I=Math.abs((T-S)*this.edgeProps[i].len);eJ(f,_,y),n=a[1],o=-a[0],m[0]=n,m[1]=o;let E=I+Math.abs(e2(f,m));E<l&&(s=i,l=E,h=S)}return[s,h]}tessellate(i){let r=ed(),a=ed(),n=ed(),o=ed();for(let s=this.edges.length-1;s>=0;--s){let l=this.edges[s].a,h=this.edges[s].b,{position:u,height:c,extent:d}=this.vertices[l],{position:p,height:f,extent:m}=this.vertices[h],_=this.vertexProps[l].dir,g=this.vertexProps[h].dir;if(e_(r,u[0]/i,u[1]/i,c),e_(a,p[0]/i,p[1]/i,f),e_(n,_[1],-_[0],0),ew(n,n,d),e_(o,g[1],-g[0],0),ew(o,o,m),.0025000000000000005>=this.distSqLines(em(r[0]+.5*n[0],r[1]+.5*n[1],r[2]+.5*n[2]),em(a[0]-.5*o[0],a[1]-.5*o[1],a[2]-.5*o[2]),em(r[0]-.5*n[0],r[1]-.5*n[1],r[2]-.5*n[2]),em(a[0]+.5*o[0],a[1]+.5*o[1],a[2]+.5*o[2])))continue;let y=this.vertices.length,x=eK(eX(),u,p);this.vertices.push({position:eQ(x,x,.5),height:.5*(c+f),extent:.5*(d+m)});let v=eK(eX(),_,g);this.vertexProps.push({dir:e1(v,v)}),this.edges.splice(s,1),this.edgeProps.splice(s,1),this.edges.push({a:l,b:y}),this.edges.push({a:y,b:h});let b=eJ(eX(),this.vertices[y].position,u),w=e0(b),T={vec:b,dir:eQ(eX(),b,1/w),len:w};this.edgeProps.push(T),this.edgeProps.push(T)}}distSqLines(i,r,a,n){let o=ey(ed(),r,i),s=ey(ed(),n,a),l=ey(ed(),i,a),h=eM(o,o),u=eM(o,s),c=eM(o,l),d=eM(s,s),p=eM(s,l),f=h*d-u*u;return 0===f?eI(eD(o,a,n,eM(l,s)/eM(s,s)),i):eI(eD(o,i,r,(u*p-c*d)/f),eD(s,a,n,(h*p-u*c)/f))}}class lE{static parseFrom(i,r){let a=lf.parse(i);if(!a)return[];let{vertices:n,features:o}=a,s=1/s6(r);o.sort((i,r)=>i.id-r.id),n.sort((i,r)=>i.id-r.id||i.idx-r.idx);let l=[],h=0,u=(n=n.filter((i,r,a)=>r===a.findIndex(r=>
7r.id===i.id&&r.idx===i.idx))).length;for(let i of o){if(i.constantHeight){l.push(new lI(i.id,i.bounds,i.constantHeight));continue}for(;h!==u&&n[h].id<i.id;)h++;if(h===u||n[h].id!==i.id)continue;let r=[],a=[],o=h;for(;h!==u&&n[h].id===i.id;){let i=n[h];if(r.push({position:i.position,height:i.height,extent:i.extent}),h!==o&&n[h-1].idx===i.idx-1){let i=h-o;a.push({a:i-1,b:i})}h++}l.push(new lI(i.id,i.bounds,void 0,r,a,s))}return l}static getElevationFeature(i,r){if(!r)return;let a=+i.properties[ll];return Number.isNaN(a)?void 0:r.find(i=>i.id===a)}}class lA{constructor(i,r){this.zScale=1,this.xOffset=0,this.yOffset=0,i.equals(r)||(this.zScale=Math.pow(2,r.z-i.z),this.xOffset=(i.x*this.zScale-r.x)*8192,this.yOffset=(i.y*this.zScale-r.y)*8192)}constantElevation(i,r){if(null!=i.constantHeight)return this.computeBiasedHeight(i.constantHeight,r)}pointElevation(i,r,a){let n=this.constantElevation(r,a);return null!=n?n:(i.x=i.x*this.zScale+this.xOffset,i.y=i.y*this.zScale+this.yOffset,this.computeBiasedHeight(r.pointElevation(i),a))}computeBiasedHeight(i,r){return r<=0?i:i+r*ta(0,r,i>=0?i:Math.abs(.5*i))}}ne(lI,"ElevationFeature");class lC{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.projection=i.projection,this.layoutVertexArray=new ov,this.indexArray=new oj,this.segments=new sh,this.programConfigurations=new sk(i.layers,{zoom:i.zoom,lut:i.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new oT),this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){let o=this.layers[0],s=[],l=null;for(let{feature:h,id:u,index:c,sourceLayerIndex:d}of("circle"===o.type&&(l=o.layout.get("circle-sort-key")),i)){let i=this.layers[0]._featureFilter.needGeometry,o=lt(h,i);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),o,a))continue;let p=l?l.evaluate(o,{},a):void 0,f={id:u,properties:h.properties,type:h.type,sourceLayerIndex:d,index:c,geometry:i?o.geometry:le(h,a,n),patterns:{},sortKey:p};s.push(f)}l&&s.sort((i,r)=>i.sortKey-r.sortKey);let h=null;for(let o of("globe"===n.projection.name&&(this.globeExtVertexArray=new oR,h=n.projection),s)){let{geometry:n,index:s,sourceLayerIndex:l}=o,u=i[s].feature;this.addFeature(o,n,s,r.availableImages,a,h,r.brightness,r.elevationFeatures),r.featureIndex.insert(u,n,s,l,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,so.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,sl.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=i.createVertexBuffer(this.elevatedLayoutVertexArray,ss.members))),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(i,r,a,n,o,s,l,h){let u;for(let a of("none"!==this.elevationMode&&(u=lE.getElevationFeature(i,h)),r))for(let r of a){let a=r.x,n=r.y;if(a<0||a>=8192||n<0||n>=8192)continue;if(s){let i=s.projectTilePoint(a,n,o),r=s.upVector(o,a,n);this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r)}let l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),h=l.vertexLength;if(this.addCircleVertex(a,n,-1,-1),this.addCircleVertex(a,n,1,-1),this.addCircleVertex(a,n,1,1),this.addCircleVertex(a,n,-1,1),"none"!==this.elevationMode){let i=u?u.pointElevation(new e4(a,n)):0;this.hasElevation=this.hasElevation||0!==i;for(let r=0;r<4;r++)this.elevatedLayoutVertexArray.emplaceBack(i)}this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+2,h+3),l.vertexLength+=4,l.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,{},n,o,l,void 0,this.worldview)}addCircleVertex(i,r,a,n){this.layoutVertexArray.emplaceBack(2*i+(a+1)/2,2*r+(n+1)/2)}addGlobeExtVertex(i,r){this.globeExtVertexArray.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}}function lM(i,r){for(let a=0;a<i.length;a++)if(lO(r,i[a]))return!0;for(let a=0;a<r.length;a++)if(lO(i,r[a]))return!0;return!!lD(i,r)}function lP(i,r){if(1===i.length)return lF(r,i[0]);for(let a=0;a<r.length;a++){let n=r[a];for(let r=0;r<n.length;r++)if(lO(i,n[r]))return!0}for(let a=0;a<i.length;a++)if(lF(r,i[a]))return!0;for(let a=0;a<r.length;a++)if(lD(i,r[a]))return!0;return!1}function lD(i,r){if(0===i.length||0===r.length)return!1;for(let l=0;l<i.length-1;l++){let h=i[l],u=i[l+1];for(let i=0;i<r.length-1;i++){var a,n,o,s;if(a=h,n=u,o=r[i],tg(a,o,s=r[i+1])!==tg(n,o,s)&&tg(a,n,o)!==tg(a,n,s))return!0}}return!1}function lR(i,r,a){return(i.x-a.x)*(r.y-a.y)-(i.y-a.y)*(r.x-a.x)}function lL(i,r,a){let n=a*a;if(1===r.length)return i.distSqr(r[0])<n;for(let a=1;a<r.length;a++)if(lz(i,r[a-1],r[a])<n)return!0;return!1}function lz(i,r,a){let n=r.distSqr(a);if(0===n)return i.distSqr(r);let o=((i.x-r.x)*(a.x-r.x)+(i.y-r.y)*(a.y-r.y))/n;return i.distSqr(o<0?r:o>1?a:a.sub(r)._mult(o)._add(r))}function lF(i,r){let a,n,o,s=!1;for(let l=0;l<i.length;l++){a=i[l];for(let i=0,l=a.length-1;i<a.length;l=i++)n=a[i],o=a[l],n.y>r.y!=o.y>r.y&&r.x<(o.x-n.x)*(r.y-n.y)/(o.y-n.y)+n.x&&(s=!s)}return s}function lO(i,r){let a=!1;for(let n=0,o=i.length-1;n<i.length;o=n++){let s=i[n],l=i[o];s.y>r.y!=l.y>r.y&&r.x<(l.x-s.x)*(r.y-s.y)/(l.y-s.y)+s.x&&(a=!a)}return a}function lB(i,r,a,n,o){for(let s of i)if(r<=s.x&&a<=s.y&&n>=s.x&&o>=s.y)return!0;let s=[new e4(r,a),new e4(r,o),new e4(n,o),new e4(n,a)];if(i.length>2){for(let r of s)if(lO(i,r))return!0}for(let r=0;r<i.length-1;r++)if(lk(i[r],i[r+1],s))return!0;return!1}function lk(i,r,a){let n=a[0],o=a[2];if(i.x<n.x&&r.x<n.x||i.x>o.x&&r.x>o.x||i.y<n.y&&r.y<n.y||i.y>o.y&&r.y>o.y)return!1;let s=tg(i,r,a[0]);return s!==tg(i,r,a[1])||s!==tg(i,r,a[2])||s!==tg(i,r,a[3])}function lV(i,r,a,n,o,s){let l=r.y-i.y,h=i.x-r.x;if(s=s||0){let i=l*l+h*h;if(0===i)return!0;let r=Math.sqrt(i);l/=r,h/=r}return!((a.x-i.x)*l+(a.y-i.y)*h-s<0||(n.x-i.x)*l+(n.y-i.y)*h-s<0||(o.x-i.x)*l+(o.y-i.y)*h-s<0)}function lN(i,r,a,n,o,s,l){return!(lV(i,r,n,o,s,l)||lV(r,a,n,o,s,l)||lV(a,i,n,o,s,l)||lV(n,o,i,r,a,l)||lV(o,s,i,r,a,l)||lV(s,n,i,r,a,l))}function lU(i,r,a){let n=r.paint.get(i).value;return"constant"===n.kind?n.value:a.programConfigurations.get(r.id).getMaxValue(i)}function lj(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function lG(i,r,a,n,o){if(!r[0]&&!r[1])return i;let s=e4.convert(r)._mult(o);"viewport"===a&&s._rotate(-n);let l=[];for(let r=0;r<i.length;r++)l.push(i[r].sub(s));return l}function lq(i,r,a,n){let o=e4.convert(i)._mult(n);return"viewport"===r&&o._rotate(-a),o}ne(lC,"CircleBucket",{omit:["layers"]});class l${constructor(i,r,a){this.z=i,this.x=r,this.y=a,this.key=lW(0,i,i,r,a)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}isChildOf(i){let r=this.z-i.z;return 0===i.z||i.z<this.z&&i.x===this.x>>r&&i.y===this.y>>r}url(i,r){var a,n,o;let s,l,h,u,c=(a=this.x,n=this.y,o=this.z,s=2**o,h=(l=2*Math.PI*6378137)*(a/s-.5),u=l*(.5-(n+1)/s),`${h},${u},${h+l/s},${u+l/s}`),d=function(i,r,a){let n,o="";for(let s=i;s>0;s--)o+=(r&(n=1<<s-1)?1:0)+(a&n?2:0);return o}(this.z,this.x,this.y);return i[(this.x+this.y)%i.length].replace("{prefix}",(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("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",d).replace("{bbox-epsg-3857}",c)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lH{constructor(i,r){this.wrap=i,this.canonical=r,this.key=lW(i,r.z,r.z,r.x,r.y)}}class lZ{constructor(i,r,a,n,o){this.overscaledZ=i,this.wrap=r,this.canonical=new l$(a,+n,+o),this.key=0===r&&i===a?this.canonical.key:lW(r,i,a,n,o)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){let r=this.canonical.z-i;return i>this.canonical.z?new lZ(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lZ(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return lW(this.wrap*r,i,this.canonical.z,this.canonical.x,this.canonical.y);{let a=this.canonical.z-i;return lW(this.wrap*r,i,i,this.canonical.x>>a,this.canonical.y>>a)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;let r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ<this.overscaledZ&&i.canonical.z<this.canonical.z&&i.canonical.x===this.canonical.x>>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new lZ(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,a=2*this.canonical.x,n=2*this.canonical.y;return[new lZ(r,this.wrap,r,a,n),new lZ(r,this.wrap,r,a+1,n),new lZ(r,this.wrap,r,a,n+1),new lZ(r,this.wrap,r,a+1,n+1)]}isLessThan(i){return this.wrap<i.wrap||!(this.wrap>i.wrap)&&(this.overscaledZ<i.overscaledZ||!(this.overscaledZ>
7i.overscaledZ)&&(this.canonical.x<i.canonical.x||!(this.canonical.x>i.canonical.x)&&this.canonical.y<i.canonical.y))}wrapped(){return new lZ(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(i){return new lZ(this.overscaledZ,i,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new lH(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function lW(i,r,a,n,o){let s=1<<Math.min(a,22),l=o%s*s+n%s;return i&&a<22&&(l+=s*s*((i<0?-2*i-1:2*i)%(1<<2*(22-a)))),16*(32*l+a)+(r-a)}let lX=[i=>{let r=i.canonical.x-1,a=i.wrap;return r<0&&(r=(1<<i.canonical.z)-1,a--),new lZ(i.overscaledZ,a,i.canonical.z,r,i.canonical.y)},i=>{let r=i.canonical.x+1,a=i.wrap;return r===1<<i.canonical.z&&(r=0,a++),new lZ(i.overscaledZ,a,i.canonical.z,r,i.canonical.y)},i=>new lZ(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,(0===i.canonical.y?1<<i.canonical.z:i.canonical.y)-1),i=>new lZ(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y===(1<<i.canonical.z)-1?0:i.canonical.y+1)];ne(l$,"CanonicalTileID"),ne(lZ,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});let{members:lY}=oy([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),lK=oy([{name:"a_pos_3",components:3,type:"Int16"}]);var lJ=oy([{name:"a_pos",type:"Int16",components:2}]);function lQ(i){return i*sG/6371008.8}let l0=[new lT([s$,s$,s$],[sG,sG,sG]),new lT([s$,s$,s$],[0,0,sG]),new lT([0,s$,s$],[sG,0,sG]),new lT([s$,0,s$],[0,sG,sG]),new lT([0,0,s$],[sG,sG,sG])];function l1(i,r,a,n=!0){let o,s=ew([],i._camera.position,i.worldSize),l=[r,a,1,1];eN(l,l,i.pixelMatrixInverse),ek(l,l,1/l[3]);let h=eC([],ey([],l,s)),u=i.globeMatrix,c=[u[12],u[13],u[14]],d=ey([],c,s),p=ef(d),f=eC([],d),m=i.worldSize/(2*Math.PI),_=eM(f,h),g=Math.asin(m/p);if(g<Math.acos(_)){if(!n)return null;let i=[],r=[];ew(i,h,p/_),eC(r,ey(r,i,d)),eC(h,eg(h,d,ew(h,r,Math.tan(g)*p)))}let y=[];new l_(s,h).closestPointOnSphere(c,m,y);let x=eC([],tT(u,0)),v=eC([],tT(u,1)),b=eC([],tT(u,2)),w=eM(x,y),T=eM(v,y),S=eM(b,y),I=Math.asin(-T/m)*e9,E=Math.atan2(w,S)*e9;return new s8(sJ(E=i.center.lng+((o=(E-i.center.lng+180)%360-180)<-180?o+360:o)),tr(sQ(I),0,1))}class l2{constructor(i,r,a){this.a=ey([],i,a),this.b=ey([],r,a),this.center=a;const n=eC([],this.a),o=eC([],this.b);this.angle=Math.acos(eM(n,o))}}function l3(i,r){var a,n,o,s;let l,h;return 0===i.angle?null:(l=0===i.a[r]?1/i.angle*.5*Math.PI:1/i.angle*Math.atan(i.b[r]/i.a[r]/Math.sin(i.angle)-1/Math.tan(i.angle)))<0||l>1?null:(a=i.a[r],n=i.b[r],o=i.angle,s=tr(l,0,1),h=Math.sin(o),Math.sin((1-s)*o)/h*a+Math.sin(s*o)/h*n+i.center[r])}function l5(i){if(i.z<=1)return l0[i.z+2*i.y+i.x];let r=he(l7(i));return lT.fromPoints(r)}function l4(i,r,a){return ew(i,i,1-a),eT(i,i,r,a)}function l6(i,r){let a=hh(r.zoom);if(0===a)return l5(i);let n=l7(i),o=he(n),s=sJ(n.getWest())*r.worldSize,l=sJ(n.getEast())*r.worldSize,h=sQ(n.getNorth())*r.worldSize,u=sQ(n.getSouth())*r.worldSize,c=[s,h,0],d=[l,h,0],p=[s,u,0],f=[l,u,0],m=et([],r.globeMatrix);return eR(c,c,m),eR(d,d,m),eR(p,p,m),eR(f,f,m),o[0]=l4(o[0],p,a),o[1]=l4(o[1],f,a),o[2]=l4(o[2],d,a),o[3]=l4(o[3],c,a),lT.fromPoints(o)}function l8(i,r,a){for(let n of i)eR(n,n,r),ew(n,n,a)}function l9(i,r,a,n){let o=r/i.worldSize,s=i.globeMatrix;if(a.z<=1){let i=l5(a).getCorners();return l8(i,s,o),lT.fromPoints(i)}let l=l7(a,n),h=he(l,sG+lQ(i._tileCoverLift));l8(h,s,o);let u=Number.MAX_VALUE,c=[-u,-u,-u],d=[u,u,u];if(l.contains(i.center)){for(let i of h)ev(d,d,i),eb(c,c,i);c[2]=0;let r=i.point,a=[r.x*o,r.y*o,0];return ev(d,d,a),eb(c,c,a),new lT(d,c)}if(i._tileCoverLift>0){for(let i of h)ev(d,d,i),eb(c,c,i);return new lT(d,c)}let p=[s[12]*o,s[13]*o,s[14]*o],f=l.getCenter(),m=tr(i.center.lat,-85.051129,85.051129),_=tr(f.lat,-85.051129,85.051129),g=sJ(i.center.lng),y=sQ(m),x=g-sJ(f.lng),v=y-sQ(_);x>.5?x-=1:x<-.5&&(x+=1);let b=0;Math.abs(x)>Math.abs(v)?b=x>=0?1:3:(b=v>=0?0:2,eT(p,p,[s[4]*o,s[5]*o,s[6]*o],-Math.sin((v>=0?l.getSouth():l.getNorth())*e8)*sG));let w=h[b],T=h[(b+1)%4],S=new l2(w,T,p),I=[l3(S,0)||w[0],l3(S,1)||w[1],l3(S,2)||w[2]],E=hh(i.zoom);if(E>0){let n=function({x:i,y:r,z:a},n,o,s,l){let h=1/(1<<a),u=i*h,c=u+h,d=r*h,p=d+h,f=0,m=(u+c)/2-s;return m>.5?f=-1:m<-.5&&(f=1),u=((u+f)*n-(s*=n))*o+s,c=((c+f)*n-s)*o+s,d=(d*n-(l*=n))*o+l,[[u,p=(p*n-l)*o+l,0],[c,p,0],[c,d,0],[u,d,0]]}(a,r,i._pixelsPerMercatorPixel,g,y);for(let i=0;i<h.length;i++)l4(h[i],n[i],E);let o=eg([],n[b],n[(b+1)%4]);ew(o,o,.5),l4(I,o,E)}for(let i of h)ev(d,d,i),eb(c,c,i);return d[2]=Math.min(w[2],T[2]),ev(d,d,I),eb(c,c,I),new lT(d,c)}function l7({x:i,y:r,z:a},n=!1){let o=1/(1<<a);return new sY(new sX(s0(i*o),r===(1<<a)-1&&n?-90:s1((r+1)*o)),new sX(s0((i+1)*o),0===r&&n?90:s1(r*o)))}function he(i,r=sG){let a=i.getNorth()*e8,n=i.getSouth()*e8,o=Math.cos(a),s=Math.cos(n),l=Math.sin(a),h=Math.sin(n),u=i.getWest(),c=i.getEast();
7return[sH(s,h,u,r),sH(s,h,c,r),sH(o,l,c,r),sH(o,l,u,r)]}function ht(i,r,a,n){let o=1<<a.z,s=(i/8192+a.x)/o;return sZ(s1((r/8192+a.y)/o),s0(s),n)}function hi({min:i,max:r}){return 16383/Math.max(r[0]-i[0],r[1]-i[1],r[2]-i[2])}let hr=new Float64Array(16);function ha(i){let r=hi(i),a=el(hr,[r,r,r]);return er(a,a,eA([],i.min))}function hn(i){var r;let a=(r=i.min,hr[0]=1,hr[1]=0,hr[2]=0,hr[3]=0,hr[4]=0,hr[5]=1,hr[6]=0,hr[7]=0,hr[8]=0,hr[9]=0,hr[10]=1,hr[11]=0,hr[12]=r[0],hr[13]=r[1],hr[14]=r[2],hr[15]=1,hr),n=1/hi(i);return ea(a,a,[n,n,n])}function ho(i){return i/(2*Math.PI)/(8192/(2*Math.PI))}function hs(i,r){return 8192/(512*Math.pow(2,i))*hi(l5(r))}function hl(i,r,a,n,o){let s=ho(a),l=[i,r,-a/(2*Math.PI)],h=ee(new Float64Array(16));return er(h,h,l),ea(h,h,[s,s,s]),en(h,h,-o*e8),eo(h,h,-n*e8),h}function hh(i){return ta(5,6,i)}function hu(i,r){var a,n,o,s,l,h,u,c;let d,p,f,m,_=sZ(r.lat,r.lng);return n=(a=ey([],(d=sZ(i._center.lat,i._center.lng),p=eP([],em(0,1,0),d),p=eR(p,p,f=eh([],-i.angle,d)),eh(f,-i._pitch,p),ew(m=eC([],d),m,lQ(i.cameraToCenterDistance/i.pixelsPerMeter)),eR(m,m,f),eg([],d,m)),_))[0],o=a[1],s=a[2],l=_[0],Math.acos(Math.min(Math.max((c=Math.sqrt((n*n+o*o+s*s)*(l*l+(h=_[1])*h+(u=_[2])*u)))&&eM(a,_)/c,-1),1))}function hc(i,r){return hu(i,r)>Math.PI/2*1.01}let hd=85*e8,hp=Math.cos(hd),hf=Math.sin(hd),hm=J(),h_=i=>{let r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r};function hg(i,r,a,n,o,s,l,h,u){if(s&&i.queryGeometry.isAboveHorizon)return!1;s&&(u*=i.pixelToTileUnitsFactor);let c=i.tileID.canonical,d=a.projection.upVectorScale(c,a.center.lat,a.worldSize).metersToTile;for(let f of r)for(let r of f){var p;let f=r.add(h),m=o&&a.elevation?a.elevation.exaggeration()*o.getElevationAt(f.x,f.y,!0):0,_=a.projection.projectTilePoint(f.x,f.y,c);if(m>0){let i=a.projection.upVector(c,f.x,f.y);_.x+=i[0]*d*m,_.y+=i[1]*d*m,_.z+=i[2]*d*m}let g=s?f:function(i,r,a,n){let o=eN([],[i,r,a,1],n);return new e4(o[0]/o[3],o[1]/o[3])}(_.x,_.y,_.z,n),y=s?i.tilespaceRays.map(i=>(function(i,r){let a=ed();return hy[2]=r,i.intersectsPlane(hy,hx,a),new e4(a[0],a[1])})(i,m)):i.queryGeometry.screenGeometry,x=eN([],[_.x,_.y,_.z,1],n);if(!l&&s?u*=x[3]/a.cameraToCenterDistance:l&&!s&&(u*=a.cameraToCenterDistance/x[3]),s){let i=s1((r.y/8192+c.y)/(1<<c.z));u/=a.projection.pixelsPerMeter(i,1)/(1/sK(i))}if(p=u,lO(y,g)||lL(g,y,p))return!0}return!1}let hy=em(0,0,0),hx=em(0,0,1);class hv extends lC{}function hb(i,{width:r,height:a},n,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==r*a*n)throw RangeError("mismatched image size")}else o=new Uint8Array(r*a*n);return i.width=r,i.height=a,i.data=o,i}function hw(i,r,a){let{width:n,height:o}=r;n===i.width&&o===i.height||(hT(i,r,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,n),height:Math.min(i.height,o)},a,null),i.width=n,i.height=o,i.data=r.data)}function hT(i,r,a,n,o,s,l,h){if(0===o.width||0===o.height)return r;if(o.width>i.width||o.height>i.height||a.x>i.width-o.width||a.y>i.height-o.height)throw RangeError("out of range source coordinates for image copy");if(o.width>r.width||o.height>r.height||n.x>r.width-o.width||n.y>r.height-o.height)throw RangeError("out of range destination coordinates for image copy");let u=i.data,c=r.data,d=4===s&&h;for(let h=0;h<o.height;h++){let p=((a.y+h)*i.width+a.x)*s,f=((n.y+h)*r.width+n.x)*s;if(d)for(let i=0;i<o.width;i++){let r=p+i*s+3,a=f+i*s;c[a+0]=255,c[a+1]=255,c[a+2]=255,c[a+3]=u[r]}else if(l)for(let i=0;i<o.width;i++){let r=p+i*s,a=f+i*s,n=new i_(u[r+0]/255,u[r+1]/255,u[r+2]/255,u[r+3]).toNonPremultipliedRenderColor(l).toArray();c[a+0]=n[0],c[a+1]=n[1],c[a+2]=n[2],c[a+3]=n[3]}else for(let i=0;i<o.width*s;i++)c[f+i]=u[p+i]}return r}ne(hv,"HeatmapBucket",{omit:["layers"]});class hS{constructor(i,r){hb(this,i,1,r)}resize(i){hw(this,new hS(i),1)}clone(){return new hS({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,a,n,o){hT(i,r,a,n,o,1,null)}}class hI{constructor(i,r){hb(this,i,4,r)}resize(i){hw(this,new hI(i),4)}replace(i,r){r?this.data.set(i):this.data=i instanceof Uint8ClampedArray?new Uint8Array(i.buffer):i}clone(){return new hI({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,a,n,o,s,l){hT(i,r,a,n,o,4,s,l)}}class hE{constructor(i,r){this.width=i.width,this.height=i.height,this.data=r instanceof Uint8Array?new Float32Array(r.buffer):r}}function hA(i){let r={},a=i.resolution||256,n=i.clips?i.clips.length:1,o=i.image||new hI({width:a,height:n}),s=(a,n,s)=>{r[i.evaluationKey]=s;let l=i.expression.evaluate(r),h=l?l.toNonPremultipliedRenderColor(null):null;h&&(o.data[a+n+0]=Math.floor(255*h.r),o.data[a+n+1]=Math.floor(255*h.g),o.data[a+n+2]=Math.floor(255*h.b),o.data[a+n+3]=Math.floor(255*h.a))};if(i.clips)for(let r=0,o=0;r<n;++r,o+=4*a)for(let n=0,l=0;n<a;n++,l+=4){let h=n/(a-1),{start:u,end:c}=i.clips[r];s(o,l,u*(1-h)+c*h)}else for(let i=0,r=0;i<a;i++,r+=4)s(0,r,i/(a-1));return o}ne(hS,"AlphaImage"),ne(hI,"RGBAImage");let hC=oy([{name:"a_pos",components:2,type:"Int16"}],4),hM=oy([{name:"a_road_z_offset",components:1,type:"Float32"}],4),hP=oy([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),hD=oy([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function hR(i,r,a=2){let n,o,s,l=r&&r.length,h=l?r[0]*a:i.length,u=hL(i,0,h,a,!0),c=[];if(!u||u.next===u.prev)return c;if(l&&(u=function(i,r,a,n){let o=[];for(let a=0,s=r.length;a<s;a++){let l=hL(i,r[a]*n,a<s-1?r[a+1]*n:i.length,n,!1);l===l.next&&(l.steiner=!0),o.push(function(i){let r=i,a=i;do(r.x<a.x||r.x===a.x&&r.y<a.y)&&(a=r),r=r.next;while(r!==i);return a}(l))}o.sort(hF);for(let i=0;i<o.length;i++)a=function(i,r){let a=function(i,r){let a=r,n=i.x,o=i.y,s,l=-1/0;if(hN(i,a))return a;do{if(hN(i,a.next))return a.next;if(o<=a.y&&o>=a.next.y&&a.next.y!==a.y){let i=a.x+(o-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(i<=n&&i>l&&(l=i,s=a.x<a.next.x?a:a.next,i===n))return s}a=a.next}while(a!==r);if(!s)return null;let h=s,u=s.x,c=s.y,d=1/0;a=s;do{if(n>=a.x&&a.x>=u&&n!==a.x&&hB(o<c?n:l,o,u,c,o<c?l:n,o,a.x,a.y)){var p,f;let r=Math.abs(o-a.y)/(n-a.x);hq(a,i)&&(r<d||r===d&&(a.x>s.x||a.x===s.x&&(p=s,f=a,0>hV(p.prev,p,f.prev)&&0>hV(f.next,p,p.next))))&&(s=a,d=r)}a=a.next}while(a!==h);return s}(i,r);if(!a)return r;let n=h$(a,i);return hz(n,n.next),hz(a,a.next)}(o[i],a);return a}(i,r,u,a)),i.length>80*a){n=i[0],o=i[1];let r=n,l=o;for(let s=a;
7s<h;s+=a){let a=i[s],h=i[s+1];a<n&&(n=a),h<o&&(o=h),a>r&&(r=a),h>l&&(l=h)}s=0!==(s=Math.max(r-n,l-o))?32767/s:0}return function i(r,a,n,o,s,l,h){if(!r)return;!h&&l&&function(i,r,a,n){let o=i;do 0===o.z&&(o.z=hO(o.x,o.y,r,a,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==i);o.prevZ.nextZ=null,o.prevZ=null,function(i){let r,a=1;do{let n,o=i;i=null;let s=null;for(r=0;o;){r++;let l=o,h=0;for(let i=0;i<a&&(h++,l=l.nextZ);i++);let u=a;for(;h>0||u>0&&l;)0!==h&&(0===u||!l||o.z<=l.z)?(n=o,o=o.nextZ,h--):(n=l,l=l.nextZ,u--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;o=l}s.nextZ=null,a*=2}while(r>1)}(o)}(r,o,s,l);let u=r;for(;r.prev!==r.next;){let c=r.prev,d=r.next;if(l?function(i,r,a,n){let o=i.prev,s=i.next;if(hV(o,i,s)>=0)return!1;let l=o.x,h=i.x,u=s.x,c=o.y,d=i.y,p=s.y,f=Math.min(l,h,u),m=Math.min(c,d,p),_=Math.max(l,h,u),g=Math.max(c,d,p),y=hO(f,m,r,a,n),x=hO(_,g,r,a,n),v=i.prevZ,b=i.nextZ;for(;v&&v.z>=y&&b&&b.z<=x;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&hk(l,c,h,d,u,p,v.x,v.y)&&hV(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&hk(l,c,h,d,u,p,b.x,b.y)&&hV(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&hk(l,c,h,d,u,p,v.x,v.y)&&hV(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&hk(l,c,h,d,u,p,b.x,b.y)&&hV(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(r,o,s,l):function(i){let r=i.prev,a=i.next;if(hV(r,i,a)>=0)return!1;let n=r.x,o=i.x,s=a.x,l=r.y,h=i.y,u=a.y,c=Math.min(n,o,s),d=Math.min(l,h,u),p=Math.max(n,o,s),f=Math.max(l,h,u),m=a.next;for(;m!==r;){if(m.x>=c&&m.x<=p&&m.y>=d&&m.y<=f&&hk(n,l,o,h,s,u,m.x,m.y)&&hV(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(r))a.push(c.i,r.i,d.i),hZ(r),r=d.next,u=d.next;else if((r=d)===u){h?1===h?i(r=function(i,r){let a=i;do{let n=a.prev,o=a.next.next;!hN(n,o)&&hU(n,a,a.next,o)&&hq(n,o)&&hq(o,n)&&(r.push(n.i,a.i,o.i),hZ(a),hZ(a.next),a=i=o),a=a.next}while(a!==i);return hz(a)}(hz(r),a),a,n,o,s,l,2):2===h&&function(r,a,n,o,s,l){let h=r;do{let r=h.next.next;for(;r!==h.prev;){var u,c;if(h.i!==r.i&&(u=h,c=r,u.next.i!==c.i&&u.prev.i!==c.i&&!function(i,r){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==r.i&&a.next.i!==r.i&&hU(a,a.next,i,r))return!0;a=a.next}while(a!==i);return!1}(u,c)&&(hq(u,c)&&hq(c,u)&&function(i,r){let a=i,n=!1,o=(i.x+r.x)/2,s=(i.y+r.y)/2;do a.y>s!=a.next.y>s&&a.next.y!==a.y&&o<(a.next.x-a.x)*(s-a.y)/(a.next.y-a.y)+a.x&&(n=!n),a=a.next;while(a!==i);return n}(u,c)&&(hV(u.prev,u,c.prev)||hV(u,c.prev,c))||hN(u,c)&&hV(u.prev,u,u.next)>0&&hV(c.prev,c,c.next)>0))){let u=h$(h,r);return h=hz(h,h.next),u=hz(u,u.next),i(h,a,n,o,s,l,0),void i(u,a,n,o,s,l,0)}r=r.next}h=h.next}while(h!==r)}(r,a,n,o,s,l):i(hz(r),a,n,o,s,l,1);break}}}(u,c,a,n,o,s,0),c}function hL(i,r,a,n,o){let s;if(o===function(i,r,a,n){let o=0;for(let s=r,l=a-n;s<a;s+=n)o+=(i[l]-i[s])*(i[s+1]+i[l+1]),l=s;return o}(i,r,a,n)>0)for(let o=r;o<a;o+=n)s=hH(o/n|0,i[o],i[o+1],s);else for(let o=a-n;o>=r;o-=n)s=hH(o/n|0,i[o],i[o+1],s);return s&&hN(s,s.next)&&(hZ(s),s=s.next),s}function hz(i,r){if(!i)return i;r||(r=i);let a,n=i;do if(a=!1,n.steiner||!hN(n,n.next)&&0!==hV(n.prev,n,n.next))n=n.next;else{if(hZ(n),(n=r=n.prev)===n.next)break;a=!0}while(a||n!==r);return r}function hF(i,r){let a=i.x-r.x;return 0===a&&0==(a=i.y-r.y)&&(a=(i.next.y-i.y)/(i.next.x-i.x)-(r.next.y-r.y
7)/(r.next.x-r.x)),a}function hO(i,r,a,n,o){return(i=0x55555555&((i=0x33333333&((i=0xf0f0f0f&((i=0xff00ff&((i=(i-a)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(r=0x55555555&((r=0x33333333&((r=0xf0f0f0f&((r=0xff00ff&((r=(r-n)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function hB(i,r,a,n,o,s,l,h){return(o-l)*(r-h)>=(i-l)*(s-h)&&(i-l)*(n-h)>=(a-l)*(r-h)&&(a-l)*(s-h)>=(o-l)*(n-h)}function hk(i,r,a,n,o,s,l,h){return(i!==l||r!==h)&&hB(i,r,a,n,o,s,l,h)}function hV(i,r,a){return(r.y-i.y)*(a.x-r.x)-(r.x-i.x)*(a.y-r.y)}function hN(i,r){return i.x===r.x&&i.y===r.y}function hU(i,r,a,n){let o=hG(hV(i,r,a)),s=hG(hV(i,r,n)),l=hG(hV(a,n,i)),h=hG(hV(a,n,r));return o!==s&&l!==h||!(0!==o||!hj(i,a,r))||!(0!==s||!hj(i,n,r))||!(0!==l||!hj(a,i,n))||!(0!==h||!hj(a,r,n))}function hj(i,r,a){return r.x<=Math.max(i.x,a.x)&&r.x>=Math.min(i.x,a.x)&&r.y<=Math.max(i.y,a.y)&&r.y>=Math.min(i.y,a.y)}function hG(i){return i>0?1:i<0?-1:0}function hq(i,r){return 0>hV(i.prev,i,i.next)?hV(i,r,i.next)>=0&&hV(i,i.prev,r)>=0:0>hV(i,r,i.prev)||0>hV(i,i.next,r)}function h$(i,r){let a=hW(i.i,i.x,i.y),n=hW(r.i,r.x,r.y),o=i.next,s=r.prev;return i.next=r,r.prev=i,a.next=o,o.prev=a,n.next=a,a.prev=n,s.next=n,n.prev=s,n}function hH(i,r,a,n){let o=hW(i,r,a);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function hZ(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function hW(i,r,a){return{i:i,x:r,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function hX(i,r){let a,n,o=i.length;if(o<=1)return[i];let s=[];for(let r=0;r<o;r++){let o=function(i){let r=0;for(let a,n,o=0,s=i.length,l=s-1;o<s;l=o++)a=i[o],r+=((n=i[l]).x-a.x)*(a.y+n.y);return r}(i[r]);0!==o&&(i[r].area=Math.abs(o),void 0===n&&(n=o<0),n===o<0?(a&&s.push(a),a=[i[r]]):a.push(i[r]))}if(a&&s.push(a),r>1)for(let i=0;i<s.length;i++)s[i].length<=r||(function i(r,a,n=0,o=r.length-1,s=function(i,r){return i<r?-1:+(i>r)}){for(;o>n;){if(o-n>600){let l=o-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);i(r,a,Math.max(n,Math.floor(a-h*c/l+d)),Math.min(o,Math.floor(a+(l-h)*c/l+d)),s)}let l=r[a],h=n,u=o;for(rn(r,n,a),s(r[o],l)>0&&rn(r,n,o);h<u;){for(rn(r,h,u),h++,u--;0>s(r[h],l);)h++;for(;s(r[u],l)>0;)u--}0===s(r[n],l)?rn(r,n,u):rn(r,++u,o),u<=a&&(n=u+1),a<=u&&(o=u-1)}}(s[i],r,1,s[i].length-1,hY),s[i]=s[i].slice(0,r));return s}function hY(i,r){return r.area-i.area}function hK(i,r,a=1){if(!i)return null;let n="string"==typeof i?iH.from(i).getPrimary():i.getPrimary(),o="string"==typeof i?null:i.getSecondary();for(let i of[n,o]){if(!i)continue;let n=i.id.toString();r.has(n)||r.set(n,[]),i.scaleSelf(a),r.get(n).push(i)}return{primary:n.toString(),secondary:o?o.toString():null}}function hJ(i,r,a,n){let o=n.patternDependencies,s=!1;for(let n of r){let r=n.paint.get(`${i}-pattern`);r.isConstant()||(s=!0),hK(r.constantOr(null),o,a)&&(s=!0)}return s}function hQ(i,r,a,n,o,s){let l=s.patternDependencies;for(let h of r){let r=h.paint.get(`${i}-pattern`).value;if("constant"!==r.kind){let i=hK(r.evaluate({zoom:n},a,{},void 0,s.availableImages),l,o);if(!i)continue;let{primary:u,secondary:c}=i;u&&(a.patterns[h.id]=[u,c].filter(Boolean))}}return a}class h0{constructor(){this.portals=[]}static isOnBorder(i,r){return i<=0&&r<=0||i>=8192&&r>=8192}static evaluate(i){if(0===i.length)return new h0;let r=[];for(let a of i)r.push(...a.portals);if(0===r.length)return new h0;for(let i of r){let r=i.va,a=i.vb;(h0.isOnBorder(r.x,a.x)||h0.isOnBorder(r.y,a.y))&&(i.type="border")}let a=r.filter(i=>"unevaluated"!==i.type),n=r.filter(i=>
7"unevaluated"===i.type);if(0===n.length)return new h0;n.sort((i,r)=>i.hash===r.hash?i.isTunnel===r.isTunnel?0:i.isTunnel?-1:1:i.hash<r.hash?1:-1),r=a.concat(n);let o=a.length,s=o,l=o;do if(++s===r.length||r[o].hash!==r[s].hash){if(s-o==2){l<o&&(r[l]=r[o],r[o]=null);let i=r[l],a=r[s-1];i.type=i.isTunnel!==a.isTunnel?"tunnel":"polygon",i.connection={a:i.connection.a,b:a.connection.a},l++}o=s}while(o!==r.length);return r.splice(l),r.sort((i,r)=>i.hash<r.hash?1:-1),{portals:r}}}ne(h0,"ElevationPortalGraph");class h1{constructor(i,r,a){this.outPositions=i,this.outNormals=r,this.outIndices=a,this.vertexLookup=new Map}addVertex(i,r,a){let n=i[2];null!=a&&(n*=a);let o=`${i[0]},${i[1]},${i[2]},${r[0]},${r[1]},${r[2]}`,s=this.vertexLookup.get(o);if(null!=s)return s;let l=this.outPositions.length;this.vertexLookup.set(o,l);let h=Math.trunc(16384*r[0]),u=Math.trunc(16384*r[1]),c=Math.trunc(16384*r[2]);return this.outPositions.emplaceBack(i[0],i[1],n),this.outNormals.emplaceBack(h,u,c),l}addTriangle(i,r,a){this.outIndices.emplaceBack(i,r,a)}addTriangles(i,r,a){if(0===i.length)return;let n=1===a.length,o=ed(),s=ed();for(let l=0;l<i.length;l+=3){let h=r[i[l+0]],u=r[i[l+1]],c=r[i[l+2]],d=n?a[0]:a[i[l+1]],p=n?a[0]:a[i[l+2]];e_(o,h.x,h.y,n?a[0]:a[i[l+0]]);let f=this.addVertex(o,s);e_(o,u.x,u.y,d);let m=this.addVertex(o,s);e_(o,c.x,c.y,p);let _=this.addVertex(o,s);this.outIndices.emplaceBack(f,m,_)}}addQuad(i,r,a,n,o,s){let l=this.addVertex(i,o,s),h=this.addVertex(r,o,s),u=this.addVertex(a,o,s),c=this.addVertex(n,o,s);this.addTriangle(l,h,u),this.addTriangle(u,c,l)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class h2{constructor(i,r,a,n){this.unevaluatedPortals=new h0,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new oS,this.vertexNormals=new oI,this.indexArray=new oj,this.tileToMeters=s6(i),this.bridgeProgramConfigurations=new sk(r,{zoom:a,lut:n},i=>"fill-tunnel-structure-color"!==i),this.tunnelProgramConfigurations=new sk(r,{zoom:a,lut:n},i=>"fill-bridge-guard-rail-color"!==i)}addVertices(i,r){let a=this.unevalVertices.length;for(let a=0;a<i.length;a++)this.unevalVertices.push(i[a]),this.unevalHeights.push(r[a]);return a}addTriangles(i,r,a){let n=a?this.unevalTunnelTriangles:this.unevalTriangles;for(let a of i)n.push(a+r)}addRenderableRing(i,r,a,n,o,s){let l=[new e4(o.min.x,o.min.y),new e4(o.max.x,o.min.y),new e4(o.max.x,o.max.y),new e4(o.min.x,o.max.y)];for(let h=0;h<a-1;h++){let a=r+h,u=a+1,c=this.unevalVertices[a],d=this.unevalVertices[u];if(!(c.x>=o.min.x&&c.x<=o.max.x&&c.y>=o.min.y&&c.y<=o.max.y||d.x>=o.min.x&&d.x<=o.max.x&&d.y>=o.min.y&&d.y<=o.max.y||lk(c,d,l))||this.isOnBorder(c.x,d.x)||this.isOnBorder(c.y,d.y))continue;let p=h2.computeEdgeHash(this.unevalVertices[a],this.unevalVertices[u]),f,m=this.vertexHashLookup.get(h2.computePosHash(c));f=null!=m?m.next:null!=(m=this.vertexHashLookup.get(h2.computePosHash(d)))?m.prev:p,this.unevalEdges.push({polygonIdx:i,a:a,b:u,hash:p,portalHash:f,isTunnel:n,type:"unevaluated",featureInfo:s})}}addPortalCandidates(i,r,a,n,o){if(0!==r.length)for(let o of(this.vertexHashLookup.clear(),r)){if(0===o.length)continue;let r=o[0],s=h2.computeEdgeHash(r[r.length-2],r[r.length-1]);for(let o=0;o<r.length-1;o++){let l=r[o+0],h=r[o+1],u=eY(h.x-l.x,h.y-l.y),c=e0(u);if(0===c)continue;let d="unevaluated",p=n.pointElevation(l),f=n.pointElevation(h);.01>Math.abs(p)&&.01>Math.abs(f)?d="entrance":(this.isOnBorder(l.x,h.x)||this.isOnBorder(l.y,h.y))&&(d="border");let m=h2.computeEdgeHash(l,h);this.unevaluatedPortals.portals.push({connection:{a:i,b:void 0},va:l,vb:h,vab:u,length:c,hash:m,isTunnel:a,type:d});let _=h2.computePosHash(l);this.vertexHashLookup.set(_,{prev:s,next:m}),s=m}}}construct(i){if(0===this.unevalVertices.length)return;let r=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),a=i=>{i.primitiveLength=this.indexArray.length-i.primitiveOffset},n=new h1(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(i.portals,this.unevalEdges);
7let o=r(),s=r(),l=r(),h=(i,r)=>{i.sort((i,a)=>i.type===r&&a.type!==r?-1:+(i.type!==r&&a.type===r));let a=i.findIndex(i=>i.type!==r);return a>=0?a:i.length},u=0;this.unevalEdges.length>0&&(u=h(this.unevalEdges,"none"),this.constructBridgeStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:u},this.tileToMeters)),a(l);let c=r(),d=r();if(this.unevalEdges.length>0){let i=this.unevalEdges.splice(u),r=h(i,"tunnel")+u;this.unevalEdges.push(...i),this.constructTunnelStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:u},{min:u,max:r})}a(c),n.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),a(d),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),a(s),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),a(o),this.maskSegments=sh.simpleSegment(0,d.primitiveOffset,0,d.primitiveLength),this.depthSegments=sh.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=sh.simpleSegment(0,l.primitiveOffset,0,l.primitiveLength),this.renderableTunnelSegments=sh.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.shadowCasterSegments=sh.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength)}update(i,r,a,n,o,s,l,h){this.bridgeProgramConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h),this.tunnelProgramConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h)}upload(i){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=i.createVertexBuffer(this.vertexPositions,hP.members),this.vertexBufferNormal=i.createVertexBuffer(this.vertexNormals,hD.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(i),this.tunnelProgramConfigurations.upload(i))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(i,r,a,n,o){let s=(s,l)=>{for(let h=0;h<l.length-1;h++){let u=l[h].featureIndex,c=l[h+1].vertexStart,d=i.feature(u);s.populatePaintArrays(c,d,u,{},a,r,n,void 0,o)}};s(this.bridgeProgramConfigurations,this.bridgeFeatureSections),s(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(i,r,a,n,o){let s=new Map;for(let l=n;l<o;l++){let n=a[l],o=n.a,h=n.b,u=h2.computePosHash(i[o]),c=h2.computePosHash(i[h]),d=s.get(u);d||(d={},s.set(u,d));let p=s.get(c);p||(p={},s.set(c,p)),r[o]<=0&&r[h]<=0||(d.to=h,p.from=o)}return s}isTerminalVertex(i,r){let a=h2.computePosHash(this.unevalVertices[i]),n=r.get(a);return!n||!n.from||!n.to}constructBridgeStructures(i,r,a,n,o,s){i.clearVertexLookup();let l=this.computeVertexConnections(r,a,n,o.min,o.max),h=1/s,u=.5*h,c=(i,n)=>e_(i,r[n].x,r[n].y,a[n]*h),d=ed(),p=ed(),f=ed(),m=ed(),_=ed(),g=(i,a)=>{let n=l.get(h2.computePosHash(r[a])),o=n.from,s=n.to;if(!o||!s)return;c(d,o),c(p,a),c(f,s),eF(m),eO(d,p)||(ey(_,p,d),eC(m,_)),eO(f,p)||(ey(_,f,p),eg(m,m,eC(_,_)));let h=ef(m);return h>0?ew(i,m,1/h):void 0},y=1/0;this.sortSubarray(n,o.min,o.max,(i,r)=>i.featureInfo.featureIndex-r.featureInfo.featureIndex);let x=ed(),v=ed(),b=ed(),w=ed(),T=ed(),S=ed(),I=ed(),E=ed(),A=ed(),C=[ed(),ed(),ed(),ed()],M=[ed(),ed(),ed(),ed()],P=[{coord:new e4(0,0),height:0},{coord:new e4(0,0),height:0}],D=(i,r)=>i>r;for(let c=o.min;c<o.max;c++){let o=n[c];if(!o.featureInfo.guardRailEnabled||!this.prepareEdgePoints(P,r,a,o,D))continue;let[d,p]=P;if(e_(x,d.coord.x,d.coord.y,h*d.height),e_(v,p.coord.x,p.coord.y,h*p.height),eO(x,v))continue;ey(b,v,x),eC(b,b);let f=g(E,o.a)||b,m=g(A,o.b)||b;e_(w,f[1],-f[0],0),eC(w,w),e_(T,m[1],-m[0],0),eC(T,T),eP(E,w,f),eC(S,E),eP(E,T,m),eC(I,E),eg(C[0],x,ew(E,ey(E,w,S),u)),eg(C[1],x,ew(E,eg(E,w,S),u)),eg(C[2],x,ew(E,S,u)),C[3]=x,eg(M[0],v,ew(E,ey(E,T,I),u)),eg(M[1],v,ew(E,eg(E,T,I),u)),eg(M[2],v,ew(E,I,u)),M[3]=v,y=this.addFeatureSection(o.featureInfo.featureIndex,y,this.bridgeFeatureSections,i);let _=i.addVertex(C[0],w,s),R=i.addVertex(C[1],w,s),L=i.addVertex(M[0],T,s),z=i.addVertex(M[1],T,s);i.addTriangle(_,R,L),i.addTriangle(R,z,L);let F=i.addVertex(C[1],S,s),O=i.addVertex(C[2],S,s),B=i.addVertex(M[1],I,s),k=i.addVertex(M[2],I,s);i.addTriangle(F,O,B),i.addTriangle(O,k,B),eA(w,w),eA(T,T);let V=i.addVertex(C[2],w,s),N=i.addVertex(C[3],w,s),U=i.addVertex(M[2],T,s),j=i.addVertex(M[3],T,s);i.addTriangle(V,N,U),i.addTriangle(N,j,U);let G=this.isTerminalVertex(o.a,l),q=this.isTerminalVertex(o.b,l);d.height<.01&&G&&i.addQuad(C[3],C[2],C[1],C[0],eA(f,f),s),p.height<.01&&q&&i.addQuad(M[0],M[1],M[2],M[3],m,s)}this.bridgeFeatureSections.push({featureIndex:1/0,vertexStart:i.getVertexCount()})}constructTunnelStructures(i,r,a,n,o,s){i.clearVertexLookup();let l=1/0,h=(i,r)=>i.featureInfo.featureIndex-r.featureInfo.featureIndex;this.sortSubarray(n,o.min,o.max,h),this.sortSubarray(n,s.min,s.max,h);let u=i=>eC(i,i),c=[{coord:new e4(0,0),height:0},{coord:new e4(0,0),height:0}],d=(i,r)=>i<r,p=ed(),f=ed(),m=ed(),_=ed(),g=ed();for(let s=o.min;s<o.max;s++){if(!this.prepareEdgePoints(c,r,a,n[s],d))continue;let[o,h]=c,y=u(e_(g,-(h.coord.y-o.coord.y),h.coord.x-o.coord.x,0));l=this.addFeatureSection(n[s].featureInfo.featureIndex,l,this.tunnelFeatureSections,i),i.addQuad(e_(p,o.coord.x,o.coord.y,o.height),e_(f,h.coord.x,h.coord.y,h.height),e_(m,h.coord.x,h.coord.y,n[s].isTunnel?-.1:0),e_(_,o.coord.x,o.coord.y,n[s].isTunnel?-.1:0),y)}for(let o=s.min;o<s.max;o++){let s=n[o];s.isTunnel&&([s.a,s.b]=[s.b,s.a]);let h=r[s.a],c=r[s.b],d=u(e_(g,-(c.y-h.y),c.x-h.x,0));l=this.addFeatureSection(s.featureInfo.featureIndex,l,this.tunnelFeatureSections,i),i.addQuad(e_(p,c.x,c.y,0),e_(f,h.x,h.y,0),e_(m,h.x,h.y,a[s.a]+4),e_(_,c.x,c.y,a[s.b]+4),d),i.addQuad(e_(p,h.x,h.y,0),e_(f,c.x,c.y,0),e_(m,c.x,c.y,a[s.b]+4),e_(_,h.x,h.y,a[s.a]+4),d)}this.tunnelFeatureSections.push({featureIndex:1/0,vertexStart:i.getVertexCount()})}setElevatedPoint(i,r,a,n){i.coord.x=r,i.coord.y=a,i.height=n}prepareEdgePoints(i,r,a,n,o){let s=r[n.a].x,l=r[n.a].y,h=r[n.b].x,u=r[n.b].y,c=a[n.a],d=a[n.b],p=o(c,0),f=o(d,0);if(p&&f)return this.setElevatedPoint(i[0],s,l,c),this.setElevatedPoint(i[1],h,u,d),!0;if(!p&&!f)return!1;if(p){if(!f){let i=d/(d-c);h=iv(h,s,i),u=iv(u,l,i),d=iv(d,c,i)}}else{let i=c/(c-d);s=iv(s,h,i),l=iv(l,u,i),c=iv(c,d,i)}return this.setElevatedPoint(i[0],s,l,c),this.setElevatedPoint(i[1],h,u,d),!0}prepareEdges(i,r){if(0===r.length)return;r.sort((i,r)=>i.hash===r.hash?r.polygonIdx-i.polygonIdx:r.hash>i.hash?1:-1);let a=0,n=0,o=0,s=r[0].polygonIdx;do(++n===r.length||r[a].hash!==r[n].hash)&&((1==n-a||r[n-1].polygonIdx!==s)&&(o<a&&(r[o]=r[a],r[a]=null),r[o].type="none",o++),(a=n)!==r.length&&(s=r[a].polygonIdx));while(a!==r.length);if(r.splice(o),0!==r.length&&0!==i.length){r.sort((i,r)=>i.portalHash<r.portalHash?1:-1);let a=0,n=0;for(;a!==r.length&&n!==i.length;){let o=r[a],s=i[n];o.portalHash>s.hash?a++:s.hash>o.portalHash?n++:(o.type=s.type,a++)}}}isOnBorder(i,r){return i<=0&&r<=0||i>=8192&&r>=8192}addFeatureSection(i,r,a,n){return i!==r&&(r=i,a.push({featureIndex:i,vertexStart:n.getVertexCount()}),n.clearVertexLookup()),r}sortSubarray(i,r,a,n){let o=i.slice(r,a);o.sort(n),i.splice(r,o.length,...o)}static computeEdgeHash(i,r){return(i.y===r.y&&i.x>r.x||i.y>r.y)&&([i,r]=[r,i]),BigInt(h2.computePosHash(i))<<32n|BigInt(h2.computePosHash(r))}static computePosHash(i){return((65535&i.x)<<16|65535&i.y)>>>0}}function h3(i,r){return i>r?1:i<r?-1:0}class h5{constructor(i=h3,r=!1){this._compare=i,this._root=null,this._size=0,this._noDuplicates=!!r}rotateLeft(i){var r=i.right;r&&(i.right=r.left,r.left&&(r.left.parent=i),r.parent=i.parent),i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.left=i),i.parent=r}rotateRight(i){var r=i.left;
7r&&(i.left=r.right,r.right&&(r.right.parent=i),r.parent=i.parent),i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.right=i),i.parent=r}_splay(i){for(;i.parent;){var r=i.parent;r.parent?r.left===i&&r.parent.left===r?(this.rotateRight(r.parent),this.rotateRight(r)):r.right===i&&r.parent.right===r?(this.rotateLeft(r.parent),this.rotateLeft(r)):r.left===i&&r.parent.right===r?(this.rotateRight(r),this.rotateLeft(r)):(this.rotateLeft(r),this.rotateRight(r)):r.left===i?this.rotateRight(r):this.rotateLeft(r)}}splay(i){for(var r,a,n,o,s;i.parent;)(a=(r=i.parent).parent)&&a.parent?((n=a.parent).left===a?n.left=i:n.right=i,i.parent=n):(i.parent=null,this._root=i),o=i.left,s=i.right,i===r.left?(a&&(a.left===r?(r.right?(a.left=r.right,a.left.parent=a):a.left=null,r.right=a,a.parent=r):(o?(a.right=o,o.parent=a):a.right=null,i.left=a,a.parent=i)),s?(r.left=s,s.parent=r):r.left=null,i.right=r):(a&&(a.right===r?(r.left?(a.right=r.left,a.right.parent=a):a.right=null,r.left=a,a.parent=r):(s?(a.left=s,s.parent=a):a.left=null,i.right=a,a.parent=i)),o?(r.right=o,o.parent=r):r.right=null,i.left=r),r.parent=i}replace(i,r){i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.parent=i.parent)}minNode(i=this._root){if(i)for(;i.left;)i=i.left;return i}maxNode(i=this._root){if(i)for(;i.right;)i=i.right;return i}insert(i,r){var a=this._root,n=null,o=this._compare;if(this._noDuplicates)for(;a;){if(n=a,0===o(a.key,i))return;a=0>o(a.key,i)?a.right:a.left}else for(;a;)n=a,a=0>o(a.key,i)?a.right:a.left;return a={key:i,data:r,left:null,right:null,parent:n},n?0>o(n.key,a.key)?n.right=a:n.left=a:this._root=a,this.splay(a),this._size++,a}find(i){for(var r=this._root,a=this._compare;r;){var n=a(r.key,i);if(n<0)r=r.right;else{if(!(n>0))return r;r=r.left}}return null}contains(i){for(var r=this._root,a=this._compare;r;){var n=a(i,r.key);if(0===n)return!0;r=n<0?r.left:r.right}return!1}remove(i){var r=this.find(i);if(!r)return!1;if(this.splay(r),r.left)if(r.right){var a=this.minNode(r.right);a.parent!==r&&(this.replace(a,a.right),a.right=r.right,a.right.parent=a),this.replace(r,a),a.left=r.left,a.left.parent=a}else this.replace(r,r.left);else this.replace(r,r.right);return this._size--,!0}removeNode(i){if(!i)return!1;if(this.splay(i),i.left)if(i.right){var r=this.minNode(i.right);r.parent!==i&&(this.replace(r,r.right),r.right=i.right,r.right.parent=r),this.replace(i,r),r.left=i.left,r.left.parent=r}else this.replace(i,i.left);else this.replace(i,i.right);return this._size--,!0}erase(i){var r=this.find(i);if(r){this.splay(r);var a=r.left,n=r.right,o=null;a&&(a.parent=null,o=this.maxNode(a),this.splay(o),this._root=o),n&&(a?o.right=n:this._root=n,n.parent=o),this._size--}}pop(){var i=this._root,r=null;if(i){for(;i.left;)i=i.left;r={key:i.key,data:i.data},this.remove(i.key)}return r}next(i){var r=i;if(r)if(r.right)for(r=r.right;r&&r.left;)r=r.left;else for(r=i.parent;r&&r.right===i;)i=r,r=r.parent;return r}prev(i){var r=i;if(r)if(r.left)for(r=r.left;r&&r.right;)r=r.right;else for(r=i.parent;r&&r.left===i;)i=r,r=r.parent;return r}forEach(i){for(var r=this._root,a=[],n=!1,o=0;!n;)r?(a.push(r),r=r.left):a.length>0?(i(r=a.pop(),o++),r=r.right):n=!0;return this}range(i,r,a,n){let o=[],s=this._compare,l=this._root;for(;0!==o.length||l;)if(l)o.push(l),l=l.left;else{if(s((l=o.pop()).key,r)>0)break;if(s(l.key,i)>=0&&a.call(n,l))return this;l=l.right}return this}keys(){for(var i=this._root,r=[],a=[],n=!1;!n;)i?(r.push(i),i=i.left):r.length>0?(a.push((i=r.pop()).key),i=i.right):n=!0;return a}values(){for(var i=this._root,r=[],a=[],n=!1;!n;)i?(r.push(i),i=i.left):r.length>0?(a.push((i=r.pop()).data),i=i.right):n=!0;return a}at(i){for(var r=this._root,a=[],n=!1,o=0;!n;)if(r)a.push(r),r=r.left;else if(a.length>0){if(r=a.pop(),o===i)return r;o++,r=r.right}else n=!0;return null}load(i=[],r=[],a=!1){if(0!==this._size)throw Error("bulk-load: tree is not empty");let n=i.length;return a&&function i(r,a,n,o,s){if(n>=o)return;let l=r[n+o>>1],h=n-1,u=o+1;for(;;){do h++;while(0>s(r[h],l));do u--;while(s(r[u],l)>0);if(h>=u)break;let i=r[h];r[h]=r[u],r[u]=i,i=a[h],a[h]=a[u],a[u]=i}i(r,a,n,u,s),i(r,a,u+1,o,s)}(i,r,0,n-1,this._compare),this._root=function i(r,a,n,o,s){let l=s-o;if(l>0){let h=o+Math.floor(l/2),u={key:a[h],data:n[h],parent:r};return u.left=i(u,a,n,o,h),u.right=i(u,a,n,h+1,s),u}return null}(null,i,r,0,n),this._size=n,this}min(){var i=this.minNode(this._root);return i?i.key:null}max(){var i=this.maxNode(this._root);return i?i.key:null}isEmpty(){return null===this._root}get size(){return this._size}static createTree(i,r,a,n,o){return new h5(a,o).load(i,r,n)}}let h4=(3+8881784197001252e-31)*11102230246251565e-32;function h6(i,r,a,n,o){let s,l,h,u,c=r[0],d=n[0],p=0,f=0;d>
7c==d>-c?(s=c,c=r[++p]):(s=d,d=n[++f]);let m=0;if(p<i&&f<a)for(d>c==d>-c?(l=c+s,h=s-(l-c),c=r[++p]):(l=d+s,h=s-(l-d),d=n[++f]),s=l,0!==h&&(o[m++]=h);p<i&&f<a;)d>c==d>-c?(u=(l=s+c)-s,h=s-(l-u)+(c-u),c=r[++p]):(u=(l=s+d)-s,h=s-(l-u)+(d-u),d=n[++f]),s=l,0!==h&&(o[m++]=h);for(;p<i;)u=(l=s+c)-s,h=s-(l-u)+(c-u),c=r[++p],s=l,0!==h&&(o[m++]=h);for(;f<a;)u=(l=s+d)-s,h=s-(l-u)+(d-u),d=n[++f],s=l,0!==h&&(o[m++]=h);return 0===s&&0!==m||(o[m++]=s),m}function h8(i){return new Float64Array(i)}let h9=h8(4),h7=h8(8),ue=h8(12),ut=h8(16),ui=h8(4);function ur(i,r,a){null===r?(i.inOut=!1,i.otherInOut=!0):(i.isSubject===r.isSubject?(i.inOut=!r.inOut,i.otherInOut=r.otherInOut):(i.inOut=!r.otherInOut,i.otherInOut=r.isVertical()?!r.inOut:r.inOut),r&&(i.prevInResult=!ua(r,a)||r.isVertical()?r.prevInResult:r)),i.resultTransition=ua(i,a)?function(i,r){let a,n=!i.inOut,o=!i.otherInOut;switch(r){case 0:a=n&&o;break;case 1:a=n||o;break;case 3:a=n!==o;break;case 2:a=i.isSubject?n&&!o:o&&!n}return a?1:-1}(i,a):0}function ua(i,r){switch(i.type){case 0:switch(r){case 0:return!i.otherInOut;case 1:return i.otherInOut;case 2:return i.isSubject&&i.otherInOut||!i.isSubject&&!i.otherInOut;case 3:return!0}break;case 2:return 0===r||1===r;case 3:return 2===r}return!1}class un{constructor(i,r,a,n,o){this.left=r,this.point=i,this.otherEvent=a,this.isSubject=n??!1,this.type=o||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(i){let r=this.point,a=this.otherEvent.point;return this.left?(r[0]-i[0])*(a[1]-i[1])-(a[0]-i[0])*(r[1]-i[1])>0:(a[0]-i[0])*(r[1]-i[1])-(r[0]-i[0])*(a[1]-i[1])>0}isAbove(i){return!this.isBelow(i)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return 0!==this.resultTransition}clone(){let i=new un(this.point,this.left,this.otherEvent,this.isSubject,this.type);return i.contourId=this.contourId,i.resultTransition=this.resultTransition,i.prevInResult=this.prevInResult,i.isExteriorRing=this.isExteriorRing,i.inOut=this.inOut,i.otherInOut=this.otherInOut,i}}function uo(i,r){return i[0]===r[0]&&i[1]===r[1]}function us(i,r,a){let n=function(i,r,a,n,o,s){let l=(r-s)*(a-o),h=(i-o)*(n-s),u=l-h;if(0===l||0===h||l>0!=h>0)return u;let c=Math.abs(l+h);return Math.abs(u)>=33306690738754716e-32*c?u:-function(i,r,a,n,o,s,l){let h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E,A=i-o,C=a-o,M=r-s,P=n-s;w=A*P,m=(f=0x8000001*A)-(f-A),_=A-m,g=(f=0x8000001*P)-(f-P),T=_*(y=P-g)-(w-m*g-_*g-m*y),S=M*C,m=(f=0x8000001*M)-(f-M),_=M-m,g=(f=0x8000001*C)-(f-C),x=T-(I=_*(y=C-g)-(S-m*g-_*g-m*y)),p=T-x,h9[0]=T-(x+p)+(p-I),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,h9[1]=b-(x+p)+(p-S),p=(E=v+x)-v,h9[2]=v-(E-p)+(x-p),h9[3]=E;let D=function(i){let r=i[0];for(let a=1;a<4;a++)r+=i[a];return r}(h9),R=22204460492503146e-32*l;if(D>=R||-D>=R||(p=i-A,h=i-(A+p)+(p-o),p=a-C,c=a-(C+p)+(p-o),p=r-M,u=r-(M+p)+(p-s),p=n-P,d=n-(P+p)+(p-s),0===h&&0===u&&0===c&&0===d)||(R=11093356479670487e-47*l+h4*Math.abs(D),(D+=A*d+P*h-(M*c+C*u))>=R||-D>=R))return D;w=h*P,m=(f=0x8000001*h)-(f-h),_=h-m,g=(f=0x8000001*P)-(f-P),T=_*(y=P-g)-(w-m*g-_*g-m*y),S=u*C,m=(f=0x8000001*u)-(f-u),_=u-m,g=(f=0x8000001*C)-(f-C),x=T-(I=_*(y=C-g)-(S-m*g-_*g-m*y)),p=T-x,ui[0]=T-(x+p)+(p-I),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,ui[1]=b-(x+p)+(p-S),p=(E=v+x)-v,ui[2]=v-(E-p)+(x-p),ui[3]=E;let L=h6(4,h9,4,ui,h7);w=A*d,m=(f=0x8000001*A)-(f-A),_=A-m,g=(f=0x8000001*d)-(f-d),T=_*(y=d-g)-(w-m*g-_*g-m*y),S=M*c,m=(f=0x8000001*M)-(f-M),_=M-m,g=(f=0x8000001*c)-(f-c),x=T-(I=_*(y=c-g)-(S-m*g-_*g-m*y)),p=T-x,ui[0]=T-(x+p)+(p-I),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,ui[1]=b-(x+p)+(p-S),p=(E=v+x)-v,ui[2]=v-(E-p)+(x-p),ui[3]=E;let z=h6(L,h7,4,ui,ue);w=h*d,m=(f=0x8000001*h)-(f-h),_=h-m,g=(f=0x8000001*d)-(f-d),T=_*(y=d-g)-(w-m*g-_*g-m*y),S=u*c,m=(f=0x8000001*u)-(f-u),_=u-m,g=(f=0x8000001*c)-(f-c),x=T-(I=_*(y=c-g)-(S-m*g-_*g-m*y)),p=T-x,ui[0]=T-(x+p)+(p-I),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,ui[1]=b-(x+p)+(p-S),p=(E=v+x)-v,ui[2]=v-(E-p)+(x-p),ui[3]=E;let F=h6(z,ue,4,ui,ut);return ut[F-1]}(i,r,a,n,o,s,c)}(i[0],i[1],r[0],r[1],a[0],a[1]);return n>0?-1:+(n<0)}
7function ul(i,r){let a=i.point,n=r.point;return a[0]>n[0]?1:a[0]<n[0]?-1:a[1]!==n[1]?a[1]>n[1]?1:-1:i.left!==r.left?i.left?1:-1:0!==us(a,i.otherEvent.point,r.otherEvent.point)?i.isBelow(r.otherEvent.point)?-1:1:!i.isSubject&&r.isSubject?1:-1}function uh(i,r,a){let n=new un(r,!1,i,i.isSubject),o=new un(r,!0,i.otherEvent,i.isSubject);return uo(i.point,i.otherEvent.point)&&console.warn("what is that, a collapsed segment?",i),n.contourId=o.contourId=i.contourId,ul(o,i.otherEvent)>0&&(i.otherEvent.left=!0,o.left=!1),i.otherEvent.otherEvent=o,i.otherEvent=n,a.push(o),a.push(n),a}function uu(i,r){return i[0]*r[1]-i[1]*r[0]}function uc(i,r){return i[0]*r[0]+i[1]*r[1]}function ud(i,r,a){let n=function(i,r,a,n){let o=[r[0]-i[0],r[1]-i[1]],s=[n[0]-a[0],n[1]-a[1]];function l(i,r,a){return[i[0]+r*a[0],i[1]+r*a[1]]}let h=[a[0]-i[0],a[1]-i[1]],u=uu(o,s),c=u*u,d=uc(o,o);if(c>0){let r=uu(h,s)/u;if(r<0||r>1)return null;let n=uu(h,o)/u;return n<0||n>1?null:0===r||1===r?[l(i,r,o)]:0===n||1===n?[l(a,n,s)]:[l(i,r,o)]}if((c=(u=uu(h,o))*u)>0)return null;let p=uc(o,h)/d,f=p+uc(o,s)/d,m=Math.min(p,f),_=Math.max(p,f);return m<=1&&_>=0?1===m?[l(i,m>0?m:0,o)]:0===_?[l(i,_<1?_:1,o)]:[l(i,m>0?m:0,o),l(i,_<1?_:1,o)]:null}(i.point,i.otherEvent.point,r.point,r.otherEvent.point),o=n?n.length:0;if(0===o||1===o&&(uo(i.point,r.point)||uo(i.otherEvent.point,r.otherEvent.point))||2===o&&i.isSubject===r.isSubject)return 0;
7if(1===o)return uo(i.point,n[0])||uo(i.otherEvent.point,n[0])||uh(i,n[0],a),uo(r.point,n[0])||uo(r.otherEvent.point,n[0])||uh(r,n[0],a),1;let s=[],l=!1,h=!1;return uo(i.point,r.point)?l=!0:1===ul(i,r)?s.push(r,i):s.push(i,r),uo(i.otherEvent.point,r.otherEvent.point)?h=!0:1===ul(i.otherEvent,r.otherEvent)?s.push(r.otherEvent,i.otherEvent):s.push(i.otherEvent,r.otherEvent),l&&h||l?(r.type=1,i.type=r.inOut===i.inOut?2:3,l&&!h&&uh(s[1].otherEvent,s[0].point,a),2):(h?uh(s[0],s[1].point,a):s[0]!==s[3].otherEvent?(uh(s[0],s[1].point,a),uh(s[1],s[2].point,a)):(uh(s[0],s[1].point,a),uh(s[3].otherEvent,s[2].point,a)),3)}function up(i,r){if(i===r)return 0;if(0!==us(i.point,i.otherEvent.point,r.point)||0!==us(i.point,i.otherEvent.point,r.otherEvent.point))return uo(i.point,r.point)?i.isBelow(r.otherEvent.point)?-1:1:i.point[0]===r.point[0]?i.point[1]<r.point[1]?-1:1:1===ul(i,r)?r.isAbove(i.point)?-1:1:i.isBelow(r.point)?-1:1;if(i.isSubject!==r.isSubject)return i.isSubject?-1:1;{let a=i.point,n=r.point;if(a[0]===n[0]&&a[1]===n[1])return a=i.otherEvent.point,n=r.otherEvent.point,a[0]===n[0]&&a[1]===n[1]?0:(i.contourId??0)>(r.contourId??0)?1:-1}return 1===ul(i,r)?1:-1}class uf{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}let um=Math.max,u_=Math.min,ug=0;function uy(i,r,a,n,o,s){let l,h,u,c,d,p;for(l=0,h=i.length-1;l<h;l++){if(u=i[l],c=i[l+1],d=new un(u,!1,void 0,r),p=new un(c,!1,d,r),d.otherEvent=p,u[0]===c[0]&&u[1]===c[1])continue;d.contourId=p.contourId=a,s||(d.isExteriorRing=!1,p.isExteriorRing=!1),ul(d,p)>0?p.left=!0:d.left=!0;let h=u[0],f=u[1];o[0]=u_(o[0],h),o[1]=u_(o[1],f),o[2]=um(o[2],h),o[3]=um(o[3],f),n.push(d),n.push(p)}}let ux=[];function uv(i,r,a){var n,o,s,l;let h,u,c=i,d=r;"number"==typeof i[0][0][0]&&(c=[i]),"number"==typeof r[0][0][0]&&(d=[r]);let p=(n=c,o=d,h=null,n.length*o.length==0&&(0===a?h=ux:2===a?h=n:(1===a||3===a)&&(h=0===n.length?o:n)),h);if(p)return p===ux?null:p;let f=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],_=function(i,r,a,n,o){let s,l,h,u,c,d,p=new rE(void 0,ul);for(h=0,u=i.length;h<u;h++)for(s=i[h],c=0,d=s.length;c<d;c++)(l=0===c)&&ug++,uy(s[c],!0,ug,p,a,l);for(h=0,u=r.length;h<u;h++)for(s=r[h],c=0,d=s.length;c<d;c++)l=0===c,2===o&&(l=!1),l&&ug++,uy(s[c],!1,ug,p,n,l);return p}(c,d,f,m,a);if(s=c,l=d,u=null,(f[0]>m[2]||m[0]>f[2]||f[1]>m[3]||m[1]>f[3])&&(0===a?u=ux:2===a?u=s:(1===a||3===a)&&(u=s.concat(l))),p=u)return p===ux?null:p;let g=function(i){let r,a,n=function(i){let r,a,n,o,s,l=[];for(a=0,n=i.length;a<n;a++)((r=i[a]).left&&r.inResult||!r.left&&r.otherEvent.inResult)&&l.push(r);let h=!1;for(;!h;)for(h=!0,a=0,n=l.length;a<n;a++)a+1<n&&1===ul(l[a],l[a+1])&&(o=l[a],l[a]=l[a+1],l[a+1]=o,h=!1);for(a=0,n=l.length;a<n;a++)(r=l[a]).otherPos=a;for(a=0,n=l.length;a<n;a++)(r=l[a]).left||(s=r.otherPos,r.otherPos=r.otherEvent.otherPos,r.otherEvent.otherPos=s);return l}(i),o={},s=[];for(r=0,a=n.length;r<a;r++){if(o[r])continue;let i=s.length,a=function(i,r,a){let n=new uf;if(null!=i.prevInResult){let o=i.prevInResult,s=o.outputContourId;if(o.resultTransition>0){let i=r[s];if(null!=i.holeOf){let o=i.holeOf;r[o].holeIds.push(a),n.holeOf=o,n.depth=r[s].depth}else r[s].holeIds.push(a),n.holeOf=s,n.depth=r[s].depth+1}else n.holeOf=null,n.depth=r[s].depth}else n.holeOf=null,n.depth=0;return n}(n[r],s,i),l=r=>{o[r]=!0,r<n.length&&n[r]&&(n[r].outputContourId=i)},h=r,u=r;for(a.points.push(n[r].point);l(h),l(h=n[h].otherPos),a.points.push(n[h].point),!((h=function(i,r,a,n){let o,s=i+1,l=r[i].point,h=r.length;for(s<h&&(o=r[s].point);s<h&&o[0]===l[0]&&o[1]===l[1];){if(!a[s])return s;++s<h&&(o=r[s].point)}for(s=i-1;a[s]&&s>n;)s--;return s}(h,n,o,u))==u||h>=n.length)&&n[h];);s.push(a)}return s}(function(i,r,a,n){let o,s,l,h=new h5(up),u=[],c=Math.min(r[2],a[2]);for(;0!==i.length;){let a=i.pop();if(u.push(a),0===n&&a.point[0]>c||2===n&&a.point[0]>r[2])break;if(a.left){s=o=h.insert(a),o=o!==(l=h.minNode())?h.prev(o):null,s=h.next(s);let r=o?o.key:null;if(ur(a,r,n),s&&2===ud(a,s.key,i)&&(ur(a,r,n),ur(s.key,a,n)),o&&2===ud(o.key,a,i)){let i=o;
7ur(r,(i=i!==l?h.prev(i):null)?i.key:null,n),ur(a,r,n)}}else a=a.otherEvent,s=o=h.find(a),o&&s&&(o=o!==l?h.prev(o):null,s=h.next(s),h.remove(a),s&&o&&ud(o.key,s.key,i))}return u}(_,f,m,a)),y=[];for(let i=0;i<g.length;i++){let r=g[i];if(r.isExterior()){let i=[r.points];for(let a=0;a<r.holeIds.length;a++)i.push(g[r.holeIds[a]].points);y.push(i)}}return y}function ub(i,r,a,n){let o=[],s=0===n?(i,r,a,n,o,s)=>{i.push(new e4(s,a+(s-r)/(n-r)*(o-a)))}:(i,r,a,n,o,s)=>{i.push(new e4(r+(s-a)/(o-a)*(n-r),s))};for(let l of i){let i=[];for(let o of l){if(o.length<=2)continue;let l=[];for(let i=0;i<o.length-1;i++){let h=o[i].x,u=o[i].y,c=o[i+1].x,d=o[i+1].y,p=0===n?h:u,f=0===n?c:d;p<r?f>r&&s(l,h,u,c,d,r):p>a?f<a&&s(l,h,u,c,d,a):l.push(o[i]),f<r&&p>=r&&s(l,h,u,c,d,r),f>a&&p<=a&&s(l,h,u,c,d,a)}let h=o[o.length-1],u=0===n?h.x:h.y;u>=r&&u<=a&&l.push(h),l.length&&(h=l[l.length-1],l[0].x===h.x&&l[0].y===h.y||l.push(l[0]),i.push(l))}i.length&&o.push(i)}return o}function uw(i,r=1){return[i.map(i=>i.map(i=>[i.x*r,i.y*r]))]}function uT(i,r=1,a){return i.map(i=>i.map((i,n)=>{let o=i.map(i=>{let n=i[0],o=i[1];return a&&(n=Math.round(n/a)*a,o=Math.round(o/a)*a),new e4(n*r,o*r)._round()});return n>0&&o.reverse(),o}))}class uS{constructor(i,r){this.layoutVertexArray=new ov,this.indexArray=new oj,this.lineIndexArray=new oB,this.triangleSegments=new sh,this.lineSegments=new sh,this.programConfigurations=new sk(i.layers,{zoom:i.zoom,lut:i.lut}),this.uploaded=!1,r&&(this.elevatedLayoutVertexArray=new oT)}update(i,r,a,n,o,s,l,h){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,hC.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.lineIndexBuffer=i.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=i.createVertexBuffer(this.elevatedLayoutVertexArray,hM.members))),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(i,r,a,n,o,s,l){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,r,a,n,o,s,void 0,l)}}class uI{constructor(i){this.zoom=i.zoom,this.pixelRatio=i.pixelRatio,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=i.lut,this.bufferData=new uS(i,!1),this.elevationBufferData=new uS(i,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=i.sourceLayerIndex,this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.hasPattern=hJ("fill",this.layers,this.pixelRatio,r);let o=this.layers[0].layout.get("fill-sort-key"),s=[];for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of i){let i=this.layers[0]._featureFilter.needGeometry,d=lt(l,i);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let p=o?o.evaluate(d,{},a,r.availableImages):void 0,f={id:h,properties:l.properties,type:l.type,sourceLayerIndex:c,index:u,geometry:i?d.geometry:le(l,a,n),patterns:{},sortKey:p};s.push(f)}for(let n of(o&&s.sort((i,r)=>i.sortKey-r.sortKey),s)){let{geometry:o,index:s,sourceLayerIndex:l}=n;if(this.hasPattern){let i=hQ("fill",this.layers,n,this.zoom,this.pixelRatio,r);this.patternFeatures.push(i)}else this.addFeature(n,o,s,a,{},r.availableImages,r.brightness,r.elevationFeatures);r.featureIndex.insert(i[s].feature,o,s,l,this.index)}}update(i,r,a,n,o,s,l){this.bufferData.update(i,r,a,n,o,s,l,this.worldview),this.elevationBufferData.update(i,r,a,n,o,s,l,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(i,r,a,n,o,s,l,this.worldview)}addFeatures(i,r,a,n,o,s){for(let o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a,n,s,i.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(i){this.bufferData.upload(i),this.elevationBufferData.upload(i),this.elevatedStructures&&this.elevatedStructures.upload(i)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}
7addFeature(i,r,a,n,o,s=[],l,h){let u=hX(r,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(i,u,n,a,h):this.addGeometry(u,this.bufferData),this.bufferData.populatePaintArrays(i,a,o,s,n,l,this.worldview),this.elevationBufferData.populatePaintArrays(i,a,o,s,n,l,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(i,r,a,n,o){this.elevatedStructures&&(this.elevatedStructures.construct(i),this.elevatedStructures.populatePaintArrays(r,a,n,o,this.worldview))}addElevatedRoadFeature(i,r,a,n,o){let s=[],l=lE.getElevationFeature(i,o);if(!l)return void this.addGeometry(r,this.bufferData);{let i=this.clipPolygonsToTile(r,1);i.length>0&&s.push({polygons:i,elevationFeature:l,elevationTileID:a})}let h={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(i,{},a),featureIndex:n};for(let r of s)if(r.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new h2(r.elevationTileID,this.layers,this.zoom,this.lut));let a=r.elevationFeature.isTunnel(),n=0;i.properties.hasOwnProperty(lh)&&(n=+i.properties[lh]),this.elevatedStructures.addPortalCandidates(r.elevationFeature.id,r.polygons,a,r.elevationFeature,n)}null==r.elevationFeature.constantHeight&&(r.polygons=this.prepareElevatedPolygons(r.polygons,r.elevationFeature,r.elevationTileID));let o=new lA(a,r.elevationTileID);this.addElevatedGeometry(r.polygons,o,r.elevationFeature,.05*("hd-road-base"!==this.elevationMode),n,h)}}addElevatedGeometry(i,r,a,n,o,s){let[l,h]=this.addGeometry(i,this.elevationBufferData,{elevation:a,elevationSampler:r,bias:n,index:o,featureInfo:s});null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:l,max:h}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,l),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,h))}addGeometry(i,r,a){let n=1/0,o=-1/0,s=null;a&&null!=(s=a.elevationSampler.constantElevation(a.elevation,a.bias))&&(n=s,o=s);let l=(i,l,h)=>{if(null!=a)if(l.push(i),null!=s)r.elevatedLayoutVertexArray.emplaceBack(s),h.push(s);else{let s=a.elevationSampler.pointElevation(i,a.elevation,a.bias);r.elevatedLayoutVertexArray.emplaceBack(s),h.push(s),n=Math.min(n,s),o=Math.max(o,s)}};for(let n of i){let i=0;for(let r of n)i+=r.length;let o=r.triangleSegments.prepareSegment(i,r.layoutVertexArray,r.indexArray),s=o.vertexLength,h=[],u=[],c=[],d=[],p=[],f=r.layoutVertexArray.length;for(let i of n){if(0===i.length)continue;i!==n[0]&&u.push(h.length/2);let o=r.lineSegments.prepareSegment(i.length,r.layoutVertexArray,r.lineIndexArray),s=o.vertexLength;a&&p.push(r.layoutVertexArray.length-f),l(i[0],c,d),r.layoutVertexArray.emplaceBack(i[0].x,i[0].y),r.lineIndexArray.emplaceBack(s+i.length-1,s),h.push(i[0].x),h.push(i[0].y);for(let a=1;a<i.length;a++)l(i[a],c,d),r.layoutVertexArray.emplaceBack(i[a].x,i[a].y),r.lineIndexArray.emplaceBack(s+a-1,s+a),h.push(i[a].x),h.push(i[a].y);o.vertexLength+=i.length,o.primitiveLength+=i.length}let m=hR(h,u);for(let i=0;i<m.length;i+=3)r.indexArray.emplaceBack(s+m[i],s+m[i+1],s+m[i+2]);if(m.length>0&&a&&"hd-road-base"===this.elevationMode){let i=a.elevation.isTunnel(),r=a.elevation.safeArea,n=this.elevatedStructures.addVertices(c,d);this.elevatedStructures.addTriangles(m,n,i);let o=p.length;if(o>0){for(let s=0;s<o-1;s++)this.elevatedStructures.addRenderableRing(a.index,p[s]+n,p[s+1]-p[s],i,r,a.featureInfo);this.elevatedStructures.addRenderableRing(a.index,p[o-1]+n,c.length-p[o-1],i,r,a.featureInfo)}}o.vertexLength+=i,o.primitiveLength+=m.length/3}return[n,o]}prepareElevatedPolygons(i,r,a){let n=1/s6(a),o=[];for(let a of i){let i=function(i,r,a=0){let n=uw(i,65536),o=[];for(;r.valid();r.next()){let[i,n]=r.get(),s=65536*i.x,l=65536*i.y,h=65536*n.x,u=65536*n.y,c=h-s,d=u-l,p=Math.hypot(c,d);if(0===p)continue;s-=c*a,l-=d*a,h+=c*a,u+=d*a;let f=Math.trunc(d/p*3),m=-Math.trunc(c/p*3);o.push([[[s,l],[h,u],[h+f,u+m],[s+f,l+m],[s,l]]])}return o.length>0&&(n=uv(n,o,2)),uT(n,152587890625e-16,128)}(a,new lS(r,n),.1);o.push(...i)}return o}clipPolygonsToTile(i,r){let a=-r,n=-r,o=8192+r,s=8192+r,l=0,h=[],u=[];for(;l<i.length;l++){let r=i[l],c=rc(r);(c.min.x>=a&&c.max.x<=o&&c.min.y>=n&&c.max.y<=s?h:u).push(r)}if(h.length===i.length)return i;let c=[new e4(a,n),new e4(o,n),new e4(o,s),new e4(a,s),new e4(a,n)];for(let i of u)h.push(...function(i,r){let a=uv(uw(i),uw([r]),0);return null==a?[]:uT(a)}(i,c));return h}}ne(uI,"FillBucket",{omit:["layers","patternFeatures"]}),ne(uS,"FillBufferData"),ne(h2,"ElevatedStructures");class uE{constructor(i,r,a,n){if(this.triangleCount=r.length/3,this.min=new e4(0,0),this.max=new e4(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===i.length)return;const[o,s]=[i[0].clone(),i[0].clone()];for(let r=1;r<i.length;++r){const a=i[r];o.x=Math.min(o.x,a.x),o.y=Math.min(o.y,a.y),s.x=Math.max(s.x,a.x),s.y=Math.max(s.y,a.y)}if(n&&(a=Math.max(a,Math.ceil(Math.max(s.x-o.x,s.y-o.y)/n))),0===a)return;this.min=o,this.max=s;const l=this.max.sub(this.min);l.x=Math.max(l.x,1),l.y=Math.max(l.y,1);const h=Math.max(l.x,l.y)/a;this.cellsX=Math.max(1,Math.ceil(l.x/h)),this.cellsY=Math.max(1,Math.ceil(l.y/h)),this.xScale=1/h,this.yScale=1/h;const u=[];for(let a=0;a<this.triangleCount;a++){const n=i[r[3*a+0]].sub(this.min),o=i[r[3*a+1]].sub(this.min),s=i[r[3*a+2]].sub(this.min),l=uA(M
7ath.floor(Math.min(n.x,o.x,s.x)),this.xScale,this.cellsX),c=uA(Math.floor(Math.max(n.x,o.x,s.x)),this.xScale,this.cellsX),d=uA(Math.floor(Math.min(n.y,o.y,s.y)),this.yScale,this.cellsY),p=uA(Math.floor(Math.max(n.y,o.y,s.y)),this.yScale,this.cellsY),f=new e4(0,0),m=new e4(0,0),_=new e4(0,0),g=new e4(0,0);for(let i=d;i<=p;++i){f.y=m.y=i*h,_.y=g.y=(i+1)*h;for(let r=l;r<=c;++r)f.x=_.x=r*h,m.x=g.x=(r+1)*h,(lN(n,o,s,f,m,g)||lN(n,o,s,f,g,_))&&u.push({cellIdx:i*this.cellsX+r,triIdx:a})}}if(0===u.length)return;u.sort((i,r)=>i.cellIdx-r.cellIdx||i.triIdx-r.triIdx);let c=0;for(;c<u.length;){const i=u[c].cellIdx,r={start:this.payload.length,len:0};for(;c<u.length&&u[c].cellIdx===i;)++r.len,this.payload.push(u[c++].triIdx);this.cells[i]=r}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(i,r){if(0===this.triangleCount||0===this.cells.length||i.x>this.max.x||this.min.x>i.x||i.y>this.max.y||this.min.y>i.y)return;let a=uA(i.x-this.min.x,this.xScale,this.cellsX),n=uA(i.y-this.min.y,this.yScale,this.cellsY),o=this.cells[n*this.cellsX+a];if(o){this._lazyInitLookup();for(let i=0;i<o.len;i++){let a=this.payload[o.start+i],n=Math.floor(a/8),s=1<<a%8;if(!(this.lookup[n]&s)&&(this.lookup[n]|=s,r.push(a),r.length===this.triangleCount))return}}}query(i,r,a){if(0===this.triangleCount||0===this.cells.length||i.x>this.max.x||this.min.x>r.x||i.y>this.max.y||this.min.y>r.y)return;this._lazyInitLookup();let n=uA(i.x-this.min.x,this.xScale,this.cellsX),o=uA(r.x-this.min.x,this.xScale,this.cellsX),s=uA(i.y-this.min.y,this.yScale,this.cellsY),l=uA(r.y-this.min.y,this.yScale,this.cellsY);for(let i=s;i<=l;i++)for(let r=n;r<=o;r++){let n=this.cells[i*this.cellsX+r];if(n)for(let i=0;i<n.len;i++){let r=this.payload[n.start+i],o=Math.floor(r/8),s=1<<r%8;if(!(this.lookup[o]&s)&&(this.lookup[o]|=s,a.push(r),a.length===this.triangleCount))return}}}}function uA(i,r,a){return Math.max(0,Math.min(a-1,Math.floor(i*r)))}ne(uE,"TriangleGridIndex");class uC{constructor(i){this.zoom=i.zoom,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){for(let a of this.footprints)r.push({footprint:a,id:i})}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){let o=[];for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of i){let i=this.layers[0]._featureFilter.needGeometry,c=lt(s,i);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),c,a))continue;let d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:u,index:h,geometry:i?c.geometry:le(s,a,n),patterns:{}};o.push(d)}for(let n of o){let{geometry:o,index:s,sourceLayerIndex:l}=n;this.addFeature(n,o,s,a,{},r.availableImages,r.brightness),r.featureIndex.insert(i[s].feature,o,s,l,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(i){}update(i,r,a,n,o,s,l){}destroy(){}addFeature(i,r,a,n,o,s=[],l){for(let i of hX(r,2)){let r=[],a=[],n=[],o=new e4(1/0,1/0),s=new e4(-1/0,-1/0);for(let l of i)if(0!==l.length){l!==i[0]&&n.push(a.length/2);for(let i=0;i<l.length;i++)a.push(l[i].x),a.push(l[i].y),r.push(l[i]),o.x=Math.min(o.x,l[i].x),o.y=Math.min(o.y,l[i].y),s.x=Math.max(s.x,l[i].x),s.y=Math.max(s.y,l[i].y)}let l=hR(a,n),h=new uE(r,l,8,256);this.footprints.push({vertices:r,indices:l,grid:h,min:o,max:s})}}}ne(uC,"ClipBucket",{omit:["layers"]});let uM=oy([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),uP=oy([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),uD=oy([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),uR=oy([{name:"a_centroid_pos",components:2,type:"Uint16"}]),uL=oy([{name:"a_join_normal_inside",components:3,type:"Int16"}]),uz=oy([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),uF=oy([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:uO}=uM,uB=Number.MAX_SAFE_INTEGER,uk=uB-1;function uV(i,r,a,n){var o;return i.order<r||i.order===uB||!(i.clipMask&a)||0!==(o=i.clipScope).length&&void 0===o.find(i=>i===n)}function uN(i,r){return i.x-r.x||i.y-r.y}function uU(i,r){return 0===uN(i.min,r.min)&&0===uN(i.max,r.max)}function uj(i,r){return!(i.min.x>r.max.x||i.max.x<r.min.x||i.min.y>r.max.y||i.max.y<r.min.y)}function uG(i,r){if(i.length!==r.length)return!1;for(let a=0;a<i.length;
7a++)if(i[a].sourceId!==r[a].sourceId||!uU(i[a],r[a])||i[a].order!==r[a].order||i[a].clipMask!==r[a].clipMask||!e6(i[a].clipScope,r[a].clipScope))return!1;return!0}function uq(i,r,a){let n=1/(1<<a.canonical.z),o=(1220703125e-13*r.x+a.canonical.x)*n+a.wrap,s=(1220703125e-13*r.y+a.canonical.y)*n;return{min:new e4((1220703125e-13*i.x+a.canonical.x)*n+a.wrap,(1220703125e-13*i.y+a.canonical.y)*n),max:new e4(o,s)}}function u$(i,r,a,n,o,s,l){let h=i.indices,u=i.vertices,c=[];for(let d=n;d<n+o;d+=3){let n=r[a[d+0]+s],o=r[a[d+1]+s],p=r[a[d+2]+s],f=Math.min(n.x,o.x,p.x),m=Math.max(n.x,o.x,p.x),_=Math.min(n.y,o.y,p.y),g=Math.max(n.y,o.y,p.y);c.length=0,i.grid.query(new e4(f,_),new e4(m,g),c);for(let i=0;i<c.length;i++){let r=c[i];if(lN(u[h[3*r+0]],u[h[3*r+1]],u[h[3*r+2]],n,o,p,l))return!0}}return!1}function uH(i,r,a,n){let o=Math.pow(2,n.z-a.z);return new e4((i+8192*a.x)*o-8192*n.x,(r+8192*a.y)*o-8192*n.y)}function uZ(i,r){let a=[];r.grid.queryPoint(i,a);let n=r.indices,o=r.vertices;for(let r=0;r<a.length;r++){let s=a[r];if(lO([o[n[3*s+0]],o[n[3*s+1]],o[n[3*s+2]]],i))return!0}return!1}let uW={None:0,Model:1,Symbol:2,FillExtrusion:4},uX=[new e4(0,0),new e4(8192,0),new e4(8192,8192),new e4(0,8192)];function uY(i,r){let a=[],n=[];if(!r||i.length<2)return[i];if(2===i.length)return lk(i[0],i[1],uX)?[i]:[];for(let r=0;r<i.length+2;r++){let o=i[r%i.length],s=i[(r+1)%i.length],l=lk(0===r?i[i.length-1]:i[(r-1)%i.length],o,uX),h=lk(o,s,uX),u=l||h;u&&n.push(o),u&&h||n.length>0&&(n.length>1&&a.push(n),n=[])}return n.length>1&&a.push(n),a}let uK=li.types,uJ=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],uQ=["fill-extrusion-flood-light-ground-radius"],u0=new e4(0,1);function u1(i,r,a,n,o,s,l,h){i.emplaceBack((r<<1)+l,(a<<1)+s,(Math.floor(8192*n)<<1)+o,Math.round(h))}function u2(i,r,a){i.emplaceBack(8192*r.x,8192*r.y,+!!a)}function u3(i,r,a,n,o,s){i.emplaceBack(r.x,r.y,(a.x<<1)+n,(a.y<<1)+o,s)}function u5(i,r,a){i.emplaceBack(r.x,r.y,r.z,16384*a[0],16384*a[1],16384*a[2])}class u4{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class u6{constructor(){this.centroidXY=new e4(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new e4(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new e4(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new e4(0,0)}span(){return new e4(this.max.x-this.min.x,this.max.y-this.min.y)}}class u8{constructor(){this.acc=new e4(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(i,r){i.min.x===Number.MAX_VALUE&&(i.min.x=i.max.x=r.x,i.min.y=i.max.y=r.y)}appendEdge(i,r,a){this.accCount++,this.acc._add(r);let n=!!this.borders;r.x<i.min.x?(i.min.x=r.x,n=!0):r.x>i.max.x&&(i.max.x=r.x,n=!0),r.y<i.min.y?(i.min.y=r.y,n=!0):r.y>i.max.y&&(i.max.y=r.y,n=!0),((0===r.x||8192===r.x)&&r.x===a.x)!=((0===r.y||8192===r.y)&&r.y===a.y)&&this.processBorderOverlap(r,a),n&&this.checkBorderIntersection(r,a)}checkBorderIntersection(i,r){r.x<0!=i.x<0&&this.addBorderIntersection(0,iv(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,iv(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,iv(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,iv(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,r){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);let a=this.borders[i];r<a[0]&&(a[0]=r),r>a[1]&&(a[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;let a=+(0!==i.x);this.addBorderIntersection(a,r.y),this.addBorderIntersection(a,i.y)}else{let a=0===i.y?2:3;this.addBorderIntersection(a,r.x),this.addBorderIntersection(a,i.x)}}centroid(){return 0===this.accCount?new e4(0,0):new e4(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0):0}}function u9(i,r){let a=i.add(r)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(tr(i.x*a.x+i.y*a.y,-1,1)))))/4*32767*(i.x*r.y-i.y*r.x<0?-1:1)}let u7=[i=>i.x<0,i=>i.x>8192,i=>i.y<0,i=>i.y>8192];class ce{constructor(i){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new oA,this.indexArray=new oj,this.programConfigurations=new sk(i.layers,{zoom:i.zoom,lut:i.lut},i=>uQ.includes(i)),this._segments=new sh,this.hiddenByLandmarkVertexArray=new o2,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new sh}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(i,r,a,n=!1){let o=i.length;if(o>2){let s,l=Math.max(0,this._segments.get().length-1),h=this._segments._prepareSegment(4*o,this.vertexArray.length,2*this._segmentToGroundQuads[l].length);l!==this._segments.get().length-1&&(l++,this._segmentToGroundQuads[l]=[],this._segmentToRegionTriCounts[l]=[0,0,0,0,0]);{let r=i[0],a=i[1];s=u9(r.sub(i[o-1])._perp()._unit(),a.sub(r)._perp()._unit())}for(let u=0;u<o;u++){let c=u===o-1?0:u+1,d=i[u],p=i[c],f=i[c===o-1?0:c+1],m=p.sub(d)._perp()._unit(),_=u9(m,f.sub(p)._perp()._unit()),g=s;if(ca(d,p,r)||n&&cn(d,r)&&cn(p,r)){s=_;continue}let y=h.vertexLength;for(let i of(u3(this.vertexArray,d,p,1,1,g),u3(this.vertexArray,d,p,1,0,g),u3(this.vertexArray,d,p,0,1,_),u3(this.vertexArray,d,p,0,0,_),h.vertexLength+=4,function(i,r,a,n){let o=[4];if(0===n)return o;a._mult(n);let s=i.sub(a),l=r.sub(a),h=[i,r,s,l];for(let i=0;i<4;i++)for(let r of h)if(u7[i](r)){o.push(i);break}return o}(d,p,m,a)))this._segmentToGroundQuads[l].push({id:y,region:i}),this._segmentToRegionTriCounts[l][i]+=2,h.primitiveLength+=2;s=_}}}prepareBorderSegments(){if(!this.hasData())return;let i=this._segments.get(),r=i.length;for(let i=0;i<r;i++)this._segmentToGroundQuads[i].sort((i,r)=>i.region-r.region);for(let a=0;a<r;a++){let r=this._segmentToGroundQuads[a],n=i[a],o=this._segmentToRegionTriCounts[a];o.reduce((i,r)=>i+r,0);let s=0;for(let i=0;i<=4;i++){let r=o[i];if(0!==r){let a=this.regionSegments[i];a||(a=this.regionSegments[i]=new sh);let o={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:r};a.get().push(o)}s+=r}for(let i=0;i<r.length;i++){let a=r[i].id;this.indexArray.emplaceBack(a,a+1,a+3),this.indexArray.emplaceBack(a,a+3,a+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(i,r,a,n,o,s,l){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,i,r,a,n,o,s,void 0,l)}upload(i){this.hasData()&&(this.vertexBuffer=i.createVertexBuffer(this.vertexArray,uP.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=i.createVertexBuffer(this.groundRadiusArray,uD.members)))}uploadPaintProperties(i){this.hasData()&&this.programConfigurations.upload(i)}update(i,r,a,n,o,s,l,h){this.hasData()&&this.programConfigurations.updatePaintArrays(i,r,a,n,o,s,l,h)}updateHiddenByLandmark(i){this.updateHiddenByLandmarkRange(i.groundVertexArrayOffset,i.groundVertexCount,!!(0x80000000&i.flags||0x40000000&i.flags))}updateHiddenByLandmarkRange(i,r,a){if(!this.hasData())return;let n=r+i;if(0!==r){for(let r=i;r<n;++r)this.hiddenByLandmarkVertexArray.emplace(r,+!!a);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(i){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=i.createVertexBuffer(this.hiddenByLandmarkVertexArray,uz.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let i=0;i<=4;i++){let r=this.regionSegments[i];r&&r.destroy()}}}}class ct{constructor(i){this.zoom=i.zoom,this.canonical=i.canonical,this.overscaling=i.overscaling,this.layers=i.layers,this.pixelRatio=i.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=i.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new oj,this.footprintVertices=new ov,this.footprintSegments=[],this.layoutVertexArray=new oE,this.centroidVertexArray=new sr,this.wallVertexArray=new sn,this.indexArray=new oj,this.programConfigurations=new sk(i.layers,{zoom:i.zoom,lut:i.lut},i=>uJ.includes(i)),this.segments=new sh,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new ce(i),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of(this.features=[],this.hasPattern=hJ("fill-extrusion",this.layers,this.pixelRatio,r),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=s6(a),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1),i)){let i=this.layers[0]._featureFilter.needGeometry,u=lt(o,i);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),u,a))continue;let c={id:s,sourceLayerIndex:h,index:l,geometry:i?u.geometry:le(o,a,n),properties:o.properties,type:o.type,patterns:{}},d=this.layoutVertexArray.length,p="Polygon"===uK[c.type];if(this.hasPattern)this.features.push({featureId:o.id,feature:hQ("fill-extrusion",this.layers,c,this.zoom,this.pixelRatio,r)});else if(this.wallMode)for(let i of c.geometry)for(let s of uY(i,p))this.addFeature(o.id,c,[s],l,a,{},r.availableImages,n,r.brightness);else this.addFeature(o.id,c,c.geometry,l,a,{},r.availableImages,n,r.brightness);r.featureIndex.insert(o,c.geometry,l,h,this.index,d)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(i,r,a,n,o,s){for(let{featureId:i,feature:l}of this.features){let h="Polygon"===uK[l.type],{geometry:u}=l;
7if(this.wallMode)for(let c of u)for(let u of uY(c,h))this.addFeature(i,l,[u],l.index,r,a,n,o,s);else this.addFeature(i,l,u,l.index,r,a,n,o,s)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),this.groundEffect.update(i,r,o,a,n,s,l,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,uO),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.wallVertexBuffer=i.createVertexBuffer(this.wallVertexArray,uL.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=i.createVertexBuffer(this.layoutVertexExtArray,uF.members,!0)),this.groundEffect.upload(i)),this.groundEffect.uploadPaintProperties(i),this.programConfigurations.upload(i),this.uploaded=!0}uploadCentroid(i){this.groundEffect.uploadHiddenByLandmark(i),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,uR.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,r,a,n,o,s,l,h,u){let c,d,p=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(r,{})/this.tileToMeter,f=[new e4(0,0),new e4(8192,8192)],m=h.projection,_="globe"===m.name,g=this.wallMode||"Polygon"===uK[r.type],y=new u8;y.centroidDataIndex=this.centroidData.length;let x=new u6;x.buildingId=i,r.properties&&r.properties.hasOwnProperty("building_id")&&(x.buildingId=Number(r.properties.building_id)),y.buildingId=x.buildingId;let v=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(r,{},o),b=this.layers[0].paint.get("fill-extrusion-height").evaluate(r,{},o);if(x.height=b,x.vertexArrayOffset=this.layoutVertexArray.length,x.groundVertexArrayOffset=this.groundEffect.vertexArray.length,_&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new oR),this.wallMode){if(_)return void t_("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==a.length)return;a=[(c=function(i){let r=i[0].x===i[i.length-1].x&&i[0].y===i[i.length-1].y;(function(i){let r=0,a=i.length;for(let n=0;n<a;n++)r+=(i[(n+1)%a].x-i[n].x)*(i[(n+1)%a].y+i[n].y);return r>=0})(i)||(i=i.reverse());let a={geometry:[],joinNormals:[],indices:[]},n=[],o=[],s=[],l=i.length;for(;l>=2&&i[l-1].equals(i[l-2]);)l--;if(l<(r?3:2))return a;let h,u,c,d,p,f=0;for(;f<l-1&&i[f].equals(i[f+1]);)f++;r&&(h=i[l-2],p=i[f].sub(h)._unit()._perp());for(let a=f;a<l;a++){if((c=a===l-1?r?i[f+1]:void 0:i[a+1])&&i[a].equals(c))continue;p&&(d=p),h&&(u=h),h=i[a],p=c?c.sub(h)._unit()._perp():d;let m=(d=d||p).add(p);0===m.x&&0===m.y||m._unit();let _=m.x*p.x+m.y*p.y,g=0!==_?1/_:1/0,y=d.x*p.y-d.y*p.x>0,x="miter";"miter"===x&&g>2&&(x="bevel"),"bevel"===x&&(g>100&&(x="flipbevel"),g<2&&(x="miter"));let v=(i,r,a,l)=>{let h=new e4(i.x,i.y),u=new e4(i.x,i.y);h.x+=r.x*l,h.y+=r.y*l,u.x-=r.x*Math.max(a,1),u.y-=r.y*Math.max(a,1),s.push(r),n.push(h),o.push(u)};if("miter"===x)m._mult(g),v(h,m,0,0);else if("flipbevel"===x)v(h,m=p.mult(-1),0,0),v(h,m.mult(-1),0,0);else{let i=-Math.sqrt(g*g-1),r=y?i:0,a=y?0:i;u&&v(h,d,r,a),c&&v(h,p,r,a)}}a.geometry=[...n,...o.reverse(),n[0]],a.joinNormals=[...s,...s.reverse(),s[s.length-1]];let m=a.geometry.length-1;for(let i=0;i<m/2;i++)if(i+1<m/2){let r=i,n=i+1,o=m-1-i,s=m-2-i;r=0===r?m-1:r-1,n=0===n?m-1:n-1,o=0===o?m-1:o-1,s=0===s?m-1:s-1,a.indices.push(o),a.indices.push(n),a.indices.push(r),a.indices.push(o),a.indices.push(s),a.indices.push(n)}return a}(a[0])).geometry]}let w=(i,r)=>i<(r.length-1)/2||i===r.length-1,T=this.wallMode?[a]:hX(a,500);for(let i=T.length-1;i>=0;i--){var S;let r=T[i];(0===r.length||(S=r[0]).every(i=>i.x<=0)||S.every(i=>i.x>=8192)||S.every(i=>i.y<=0)||S.every(i=>i.y>=8192))&&T.splice(i,1)}if(_)d=ch(T,f,o);else for(let i of(d=[],T))d.push({polygon:i,bounds:f});let I=g?this.edgeRadius:0,E=I>0&&this.zoom<17,A=(i,r)=>{if(0===i.length)return!1;let a=i[i.length-1];return r.x===a.x&&r.y===a.y};for(let{polygon:i,bounds:r}of d){let a=0,n=0;for(let r of i)g&&!r[0].equals(r[r.length-1])&&r.push(r[0]),n+=g?r.length-1:r.length;let s=this.segments.prepareSegment((g?5:4)*n,this.layoutVertexArray,this.indexArray);x.footprintSegIdx<0&&(x.footprintSegIdx=this.footprintSegments.length),x.polygonSegIdx<0&&(x.polygonSegIdx=this.polygonSegments.length);let l={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},h=new u4;if(h.vertexOffset=this.footprintVertices.length,h.indexOffset=3*this.footprintIndices.length,h.ringIndices=[],g){let n=[],l=[];a=s.vertexLength;for(let a=0;a<i.length;a++){let u,d,f=i[a];f.length&&0!==a&&l.push(n.length/2);let g=[];u=f[1].sub(f[0])._perp()._unit(),h.ringIndices.push(f.length-1);for(let i=1;i<f.length;i++){let r=f[i],a=f[i===f.length-1?1:i+1],l=r.clone();if(I){d=a.sub(r)._perp()._unit();let i=u.add(d)._unit(),n=I*Math.min(4,1/(u.x*i.x+u.y*i.y));l.x+=n*i.x,l.y+=n*i.y,l.x=Math.round(l.x),l.y=Math.round(l.y),u=d}if(!v||0!==I&&!E||A(g,l)||g.push(l),u1(this.layoutVertexArray,l.x,l.y,0,0,1,1,0),this.wallMode){let r=w(i,f);u2(this.wallVertexArray,c.joinNormals[i],!r)}s.vertexLength++,this.footprintVertices.emplaceBack(r.x,r.y),n.push(r.x,r.y),_&&u5(this.layoutVertexExtArray,m.projectTilePoint(l.x,l.y,o),m.upVector(o,l.x,l.y))}v&&(0===I||E)&&(0!==g.length&&A(g,g[0])&&g.pop(),this.groundEffect.addData(g,r,p))}let u=this.wallMode?c.indices:hR(n,l);for(let i=0;i<u.length;i+=3)this.footprintIndices.emplaceBack(h.vertexOffset+u[i+0],h.vertexOffset+u[i+1],h.vertexOffset+u[i+2]),this.indexArray.emplaceBack(a+u[i],a+u[i+2],a+u[
7i+1]),s.primitiveLength++;h.indexCount+=u.length,h.vertexCount+=this.footprintVertices.length-h.vertexOffset}for(let n=0;n<i.length;n++){let l,h,u,d=i[n];y.startRing(x,d[0]);let f=d.length>4&&co(d[d.length-2],d[0],d[1]),b=I?function(i,r,a,n){let o=r.sub(i)._perp()._unit(),s=a.sub(r)._perp()._unit();return cr(i,r,a,ci(o,s),n)}(d[d.length-2],d[0],d[1],I):0,T=[];h=d[1].sub(d[0])._perp()._unit();let S=!0;for(let i=1,n=0;i<d.length;i++){let p=d[i-1],g=d[i],E=d[i===d.length-1?1:i+1];if(y.appendEdge(x,g,p),ca(g,p,r)){I&&(h=E.sub(g)._perp()._unit(),S=!S);continue}let C=g.sub(p)._perp(),M=C.x/(Math.abs(C.x)+Math.abs(C.y)),P=+(C.y>0),D=p.dist(g);if(n+D>32768&&(n=0),I){u=E.sub(g)._perp()._unit();let i=cr(p,g,E,ci(h,u),I);isNaN(i)&&(i=0);let r=g.sub(p)._unit();p=p.add(r.mult(b))._round(),g=g.add(r.mult(-i))._round(),b=i,h=u,v&&this.zoom>=17&&(A(T,p)||T.push(p),A(T,g)||T.push(g))}let R=s.vertexLength,L=d.length>4&&co(p,g,E),z=cs(n,f,S);if(u1(this.layoutVertexArray,p.x,p.y,M,P,0,0,z),u1(this.layoutVertexArray,p.x,p.y,M,P,0,1,z),this.wallMode){let r=w(i-1,d),a=c.joinNormals[i-1];u2(this.wallVertexArray,a,r),u2(this.wallVertexArray,a,r)}if(n+=D,z=cs(n,L,!S),f=L,u1(this.layoutVertexArray,g.x,g.y,M,P,0,0,z),u1(this.layoutVertexArray,g.x,g.y,M,P,0,1,z),this.wallMode){let r=w(i,d),a=c.joinNormals[i];u2(this.wallVertexArray,a,r),u2(this.wallVertexArray,a,r)}if(s.vertexLength+=4,this.indexArray.emplaceBack(R+0,R+1,R+2),this.indexArray.emplaceBack(R+1,R+3,R+2),s.primitiveLength+=2,I){let n=a+(1===i?d.length-2:i-2),o=1===i?a:n+1;if(this.indexArray.emplaceBack(R+1,n,R+3),this.indexArray.emplaceBack(n,o,R+3),s.primitiveLength+=2,void 0===l&&(l=R),!ca(E,d[i],r)){let r=i===d.length-1?l:s.vertexLength;this.indexArray.emplaceBack(R+2,R+3,r),this.indexArray.emplaceBack(R+3,r+1,r),this.indexArray.emplaceBack(R+3,o,r+1),s.primitiveLength+=3}S=!S}if(_){let i=this.layoutVertexExtArray,r=m.projectTilePoint(p.x,p.y,o),a=m.projectTilePoint(g.x,g.y,o),n=m.upVector(o,p.x,p.y),s=m.upVector(o,g.x,g.y);u5(i,r,n),u5(i,r,n),u5(i,a,s),u5(i,a,s)}}g&&(a+=d.length-1),v&&I&&this.zoom>=17&&(0!==T.length&&A(T,T[0])&&T.pop(),this.groundEffect.addData(T,r,p,I>0))}this.footprintSegments.push(h),l.triangleCount=this.indexArray.length-l.triangleArrayOffset,this.polygonSegments.push(l),++x.footprintSegLen,++x.polygonSegLen}if(x.vertexCount=this.layoutVertexArray.length-x.vertexArrayOffset,x.groundVertexCount=this.groundEffect.vertexArray.length-x.groundVertexArrayOffset,0!==x.vertexCount){if(x.centroidXY=y.borders?u0:this.encodeCentroid(y,x),r.properties&&r.properties.hasOwnProperty("building_id")){let i=x.buildingId,r=this.buildingGroups.get(i);r||(r={accX:0,accY:0,accCount:0,mergedMin:new e4(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new e4(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(i,r)),r.accX+=y.acc.x,r.accY+=y.acc.y,r.accCount+=y.accCount,r.mergedMin.x=Math.min(r.mergedMin.x,x.min.x),r.mergedMin.y=Math.min(r.mergedMin.y,x.min.y),r.mergedMax.x=Math.max(r.mergedMax.x,x.max.x),r.mergedMax.y=Math.max(r.mergedMax.y,x.max.y),r.partIndices.push(this.centroidData.length)}if(this.centroidData.push(x),y.borders){this.featuresOnBorder.push(y);let i=this.featuresOnBorder.length-1;for(let r=0;r<y.borders.length;r++)y.borders[r][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[r].push(i)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,n,s,l,o,u,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(r,n,s,l,o,u,this.worldview),this.maxHeight=Math.max(this.maxHeight,b)}}_finalizeBuildingGroups(){for(let[,i]of this.buildingGroups){if(0===i.partIndices.length)continue;let r=new u8;r.acc=new e4(i.accX,i.accY),r.accCount=i.accCount;let a=new u6;a.min=i.mergedMin,a.max=i.mergedMax;let n=this.encodeCentroid(r,a),o=r.centroid();for(let r of i.partIndices){let a=this.centroidData[r];a.centroidXY.x===u0.x&&a.centroidXY.y===u0.y||(a.centroidXY=n),a.min=i.mergedMin,a.max=i.mergedMax,a.groupCentroidPos=o}}this.buildingGroups.clear()}sortBorders(){for(let i=0;i<this.borderFeatureIndices.length;i++)this.borderFeatureIndices[i].sort((r,a)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[a].borders[i][0])}splitToSubtiles(){let i=[];for(let r=0;r<this.centroidData.length;r++){let a=this.centroidData[r],n=+(a.min.y+a.max.y>8192),o=2*n+(a.min.x+a.max.x>8192^n);for(let n=0;n<a.polygonSegLen;n++){let s=a.polygonSegIdx+n;
7i.push({centroidIdx:r,subtile:o,polygonSegmentIdx:s,triangleSegmentIdx:this.polygonSegments[s].triangleSegIdx})}}let r=new oj;i.sort((i,r)=>i.triangleSegmentIdx===r.triangleSegmentIdx?i.subtile-r.subtile:i.triangleSegmentIdx-r.triangleSegmentIdx);let a=0,n=0,o=0;for(let r of i){if(r.triangleSegmentIdx!==a)break;o++}let s=i.length;for(;n!==i.length;){a=i[n].triangleSegmentIdx;let l=0,h=n,u=n;for(let r=h;r<o&&i[r].subtile===l;r++)u++;for(;h!==o;){let n=i[h];l=n.subtile;let s=this.centroidData[n.centroidIdx].min.clone(),c=this.centroidData[n.centroidIdx].max.clone(),d={vertexOffset:this.segments.segments[a].vertexOffset,primitiveOffset:r.length,vertexLength:this.segments.segments[a].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let a=h;a<u;a++){let n=i[a],o=this.polygonSegments[n.polygonSegmentIdx],l=this.centroidData[n.centroidIdx].min,h=this.centroidData[n.centroidIdx].max,u=this.indexArray.uint16;for(let i=o.triangleArrayOffset;i<o.triangleArrayOffset+o.triangleCount;i++)r.emplaceBack(u[3*i],u[3*i+1],u[3*i+2]);d.primitiveLength+=o.triangleCount,s.x=Math.min(s.x,l.x),s.y=Math.min(s.y,l.y),c.x=Math.max(c.x,h.x),c.y=Math.max(c.y,h.y)}d.primitiveLength>0&&this.triangleSubSegments.push({segment:d,min:s,max:c}),h=u;for(let r=h;r<o&&i[r].subtile===i[h].subtile;r++)u++}n=o;for(let r=n;r<s&&i[r].triangleSegmentIdx===i[n].triangleSegmentIdx;r++)o++}r._trim(),this.indexArray=r}getVisibleSegments(i,r,a){let n,o=new sh;if(this.wallMode){for(let i of this.triangleSubSegments)o.segments.push(i.segment);return o}let s=0,l=0,h=1<<i.canonical.z;if(r){let a=r.getMinMaxForTile(i);a&&(s=a.min,l=a.max)}l+=this.maxHeight;let u=i.toUnwrapped(),c=[u.canonical.x/h+u.wrap,u.canonical.y/h],d=[(u.canonical.x+1)/h+u.wrap,(u.canonical.y+1)/h],p=(i,r,a)=>[i[0]*(1-a[0])+r[0]*a[0],i[1]*(1-a[1])+r[1]*a[1]],f=[],m=[];for(let i of this.triangleSubSegments){f[0]=i.min.x/8192,f[1]=i.min.y/8192,m[0]=i.max.x/8192,m[1]=i.max.y/8192;let r=p(c,d,f),h=p(c,d,m);if(0===new lT([r[0],r[1],s],[h[0],h[1],l]).intersectsPrecise(a)){n&&(o.segments.push(n),n=void 0);continue}let u=i.segment;n&&n.vertexOffset!==u.vertexOffset&&(o.segments.push(n),n=void 0),n?(n.vertexLength+=u.vertexLength,n.primitiveLength+=u.primitiveLength):n={vertexOffset:u.vertexOffset,primitiveLength:u.primitiveLength,vertexLength:u.vertexLength,primitiveOffset:u.primitiveOffset,sortKey:void 0,vaos:{}}}return n&&o.segments.push(n),o}encodeCentroid(i,r){let a=i.centroid(),n=r.span(),o=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(6,Math.round(n.y*this.tileToMeter/10));return new e4(tr(a.x,1,8191)<<3|o,tr(a.y,1,8191)<<3|s)}encodeBorderCentroid(i){if(!i.borders)return new e4(0,0);let r=i.borders,a=Number.MAX_VALUE;if(r[0][0]!==a||r[1][0]!==a){let i=+(r[0][0]===a);return new e4(6|65528*(r[0][0]===a),(r[i][0]+r[i][1])/2<<3|6)}{let i=r[2][0]!==a?2:3;return new e4((r[i][0]+r[i][1])/2<<3|6,6|65528*(r[2][0]===a))}}showCentroid(i){let r=this.centroidData[i.centroidDataIndex];if(r.flags&=0x80000000,0!==r.groupCentroidPos.x||0!==r.groupCentroidPos.y){let i=r.span(),a=Math.min(7,Math.round(i.x*this.tileToMeter/10)),n=Math.min(6,Math.round(i.y*this.tileToMeter/10));r.centroidXY=new e4(tr(r.groupCentroidPos.x,1,8191)<<3|a,tr(r.groupCentroidPos.y,1,8191)<<3|n)}else r.centroidXY=new e4(0,0);this.writeCentroidToBuffer(r)}writeCentroidToBuffer(i){this.groundEffect.updateHiddenByLandmark(i);let r=i.vertexArrayOffset,a=i.vertexCount+i.vertexArrayOffset,n=-0x40000000&i.flags?u0:i.centroidXY,o=this.centroidVertexArray.geta_centroid_pos0(r);if(this.centroidVertexArray.geta_centroid_pos1(r)!==n.y||o!==n.x){for(let i=r;i<a;++i)this.centroidVertexArray.emplace(i,n.x,n.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){for(let i of(this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.centroidData))this.writeCentroidToBuffer(i)}updateReplacement(i,r,a){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let n=r.getReplacementRegionsForTile(i.toUnwrapped());if(uG(this.activeReplacements,n))return;if(this.activeReplacements=n,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(let i of this.centroidData)i.flags&=0x3fffffff;let o=[];for(let r of this.activeReplacements){if(r.order<a)continue;let n=Math.max(1,Math.pow(2,r.footprintTileId.canonical.z-i.canonical.z));if(r.footprint.buildingIds)for(let i of this.centroidData)0x80000000&i.flags||0x40000000&i.flags||r.min.x>i.max.x||i.min.x>r.max.x||r.min.y>i.max.y||i.min.y>r.max.y||r.footprint.buildingIds.has(i.buildingId)&&(i.flags|=r.clipMask!==uW.None?-0x40000000:0x80000000);else for(let a of this.centroidData)if(!(0x80000000&a.flags||0x40000000&a.flags||r.min.x>a.max.x||a.min.x>r.max.x||r.min.y>a.max.y||a.min.y>r.max.y))for(let s=0;s<a.footprintSegLen;s++){let l=this.footprintSegments[a.footprintSegIdx+s];if(o.length=0,function(i,r,a,n,o,s){let l=Math.pow(2,n.z-o.z);for(let h=0;h<a;h++){let a=i.int16[2*(h+r)+0],u=i.int16[2*(h+r)+1];a=(a+8192*o.x)*l-8192*n.x,u=(u+8192*o.y)*l-8192*n.y,s.push(new e4(a,u))}}(this.footprintVertices,l.vertexOffset,l.vertexCount,r.footprintTileId.canonical,i.canonical,o),u$(r.footprint,o,this.footprintIndices.uint16,l.indexOffset,l.indexCount,-l.vertexOffset,
7-n)){a.flags|=r.clipMask!==uW.None?-0x40000000:0x80000000;break}}}for(let i of this.centroidData)this.writeCentroidToBuffer(i);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(i,r,a){let n=!1;for(let o=0;o<a.footprintSegLen;o++){let s=this.footprintSegments[a.footprintSegIdx+o],l=0;for(let a of s.ringIndices){for(let o=l,h=a+l-1;o<a+l;h=o++){let a=this.footprintVertices.int16[2*(o+s.vertexOffset)+0],l=this.footprintVertices.int16[2*(o+s.vertexOffset)+1],u=this.footprintVertices.int16[2*(h+s.vertexOffset)+1];l>r!=u>r&&i<(this.footprintVertices.int16[2*(h+s.vertexOffset)+0]-a)*(r-l)/(u-l)+a&&(n=!n)}l=a}}return n}getHeightAtTileCoord(i,r){let a=-1/0,n=!0,o=4*(i+8192)*8192+(r+8192);if(this.partLookup.hasOwnProperty(o)){let i=this.partLookup[o];return i?{height:i.height,hidden:!!(0x80000000&i.flags)}:void 0}for(let s of this.centroidData)i>s.max.x||s.min.x>i||r>s.max.y||s.min.y>r||s.height<=a||this.footprintContainsPoint(i,r,s)&&(a=s.height,this.partLookup[o]=s,n=!!(0x80000000&s.flags));if(a!==-1/0)return{height:a,hidden:n};this.partLookup[o]=void 0}}function ci(i,r){let a=i.add(r)._unit();return i.x*a.x+i.y*a.y}function cr(i,r,a,n,o){let s=Math.sqrt(1-n*n);return Math.min(i.dist(r)/3,r.dist(a)/3,o*s/n)}function ca(i,r,a){return i.x<a[0].x&&r.x<a[0].x||i.x>a[1].x&&r.x>a[1].x||i.y<a[0].y&&r.y<a[0].y||i.y>a[1].y&&r.y>a[1].y}function cn(i,r){return i.x<r[0].x||i.x>r[1].x||i.y<r[0].y||i.y>r[1].y}function co(i,r,a){if(i.x<0||i.x>=8192||r.x<0||r.x>=8192||a.x<0||a.x>=8192)return!1;let n=a.sub(r),o=n.perp(),s=i.sub(r);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&o.x*s.x+o.y*s.y<0}function cs(i,r,a){let n=r?2|i:-3&i;return a?1|n:-2&n}function cl(){let i=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*i*i)-6371008.8}function ch(i,r,a){let n=1<<a.z,o=s0(a.x/n);return function(i,r,a,n,o=0,s){let l=[];if(!i.length||!a||!n)return l;let h=(i,r)=>{for(let a of i)l.push({polygon:a,bounds:r})},u=Math.ceil(Math.log2(a)),c=Math.ceil(Math.log2(n)),d=u-c,p=[];for(let i=0;i<Math.abs(d);i++)p.push(d>0?0:1);for(let i=0;i<Math.min(u,c);i++)p.push(0),p.push(1);let f=i;if(f=ub(f,r[0].y-o,r[1].y+o,1),!(f=ub(f,r[0].x-o,r[1].x+o,0)).length)return l;let m=[];for(p.length?m.push({polygons:f,bounds:r,depth:0}):h(f,r);m.length;){let i=m.pop(),r=i.depth,a=p[r],n=i.bounds[0],l=i.bounds[1],u=0===a?n.x:n.y,c=0===a?l.x:l.y,d=s?s(a,u,c):.5*(u+c),f=ub(i.polygons,u-o,d+o,a),_=ub(i.polygons,d-o,c+o,a);if(f.length){let i=[n,new e4(0===a?d:l.x,1===a?d:l.y)];p.length>r+1?m.push({polygons:f,bounds:i,depth:r+1}):h(f,i)}if(_.length){let i=[new e4(0===a?d:n.x,1===a?d:n.y),l];p.length>r+1?m.push({polygons:_,bounds:i,depth:r+1}):h(_,i)}}return l}(i,r,Math.ceil((s0((a.x+1)/n)-o)/11.25),Math.ceil((s1(a.y/n)-s1((a.y+1)/n))/11.25),1,(i,r,o)=>{if(0===i)return .5*(r+o);{let i=s1((a.y+r/8192)/n);return(sQ(.5*(s1((a.y+o/8192)/n)+i))*n-a.y)*8192}})}ne(ct,"FillExtrusionBucket",{omit:["layers","features"]}),ne(u6,"PartData"),ne(u4,"FootprintSegment"),ne(u8,"BorderCentroidData"),ne(ce,"GroundEffect");class cu extends e4{constructor(i,r,a){super(i,r),this.z=a}}class cc extends cu{constructor(i,r,a,n){super(i,r,a),this.w=n}}function cd(i,r,a,n){let o="x"===a?"y":"x",s=(n-i[a])/(r[a]-i[a]);i[o]=Math.round(i[o]+(r[o]-i[o])*s),i[a]=n,i.hasOwnProperty("z")&&(i.z=iv(i.z,r.z,s)),i.hasOwnProperty("w")&&(i.w=iv(i.w,r.w,s))}function cp(i,r,a,n){for(let o of["x","y"]){let s=i,l=r;s[o]>=l[o]&&(s=r,l=i),s[o]<a&&l[o]>a&&cd(s,l,o,a),s[o]<n&&l[o]>n&&cd(l,s,o,n)}}function cf(i,r,a,n,o,s){let l=[];for(let h=0;h<i.length;h++){let u,c=i[h],d=l.length,p=0;for(let i=0;i<c.length-1;i++){let d,f,m=c[i],_=c[i+1],g=0,y=p;s&&(p+=g=Math.hypot(_.x-m.x,_.y-m.y),d=m,f=_),m.x<r&&_.x<r||(m.x<r?m=new e4(r,m.y+(r-m.x)/(_.x-m.x)*(_.y-m.y))._round():_.x<r&&(_=new e4(r,m.y+(r-m.x)/(_.x-m.x)*(_.y-m.y))._round()),m.y<a&&_.y<a||(m.y<a?m=new e4(m.x+(a-m.y)/(_.y-m.
7y)*(_.x-m.x),a)._round():_.y<a&&(_=new e4(m.x+(a-m.y)/(_.y-m.y)*(_.x-m.x),a)._round()),m.x>=n&&_.x>=n||(m.x>=n?m=new e4(n,m.y+(n-m.x)/(_.x-m.x)*(_.y-m.y))._round():_.x>=n&&(_=new e4(n,m.y+(n-m.x)/(_.x-m.x)*(_.y-m.y))._round()),m.y>=o&&_.y>=o||(m.y>=o?m=new e4(m.x+(o-m.y)/(_.y-m.y)*(_.x-m.x),o)._round():_.y>=o&&(_=new e4(m.x+(o-m.y)/(_.y-m.y)*(_.x-m.x),o)._round()),u&&m.equals(u[u.length-1])||(u=[m],l.push(u),s&&s.push({progress:{min:y+cm(d,f,m)*g,max:1},parentIndex:h,prevPoint:d,nextPoint:f})),u.push(_),s&&(s[s.length-1].progress.max=y+cm(d,f,_)*g,s[s.length-1].nextPoint=f)))))}if(s&&p>0)for(let i=d;i<l.length;i++)s[i].progress.min/=p,s[i].progress.max/=p}return l}function cm(i,r,a){return i.x!==r.x?(a.x-i.x)/(r.x-i.x):i.y!==r.y?(a.y-i.y)/(r.y-i.y):0}function c_(i,r){return i.x*r.x+i.y*r.y}function cg(i,r){if(1===i.length){let a,n=0,o=r[n++];for(;!a||o.equals(a);)if(!(a=r[n++]))return 1/0;for(;n<r.length;n++){let s=r[n],l=i[0],h=a.sub(o),u=s.sub(o),c=l.sub(o),d=c_(h,h),p=c_(h,u),f=c_(u,u),m=c_(c,h),_=c_(c,u),g=d*f-p*p,y=(f*m-p*_)/g,x=(d*_-p*m)/g,v=o.z*(1-y-x)+a.z*y+s.z*x;if(isFinite(v))return v}return 1/0}{let i=1/0;for(let a of r)i=Math.min(i,a.z);return i}}function cy(i,r,a){let n=1/0;lP(a,r)&&(n=cg(a,r[0]));for(let o=0;o<r.length;o++){let s=r[o],l=i[o];for(let i=0;i<s.length-1;i++){let r=s[i],o=[r,s[i+1],l[i+1],l[i],r];lM(a,o)&&(n=Math.min(n,cg(a,o)))}}return n!==1/0&&n}function cx(i,r,a,n,o,s,l,h,u,c,d){return"globe"===i.projection.name?function(i,r,a,n,o,s,l,h,u,c,d){let p=[],f=[],m=i.projection.upVectorScale(d,i.center.lat,i.worldSize).metersToTile,_=[0,0,0,1],g=[0,0,0,1],y=(i,r,a,n)=>{i[0]=r,i[1]=a,i[2]=n,i[3]=1},x=cl();for(let v of(a>0&&(a+=x),n+=x,r)){let r=[],x=[];for(let p of v){let f=p.x+o.x,v=p.y+o.y,b=i.projection.projectTilePoint(f,v,d),w=i.projection.upVector(d,p.x,p.y),T=a,S=n;if(l){let i=cv(f,v,a,n,l,h,u,c);T+=i.base,S+=i.top}0!==a?y(_,b.x+w[0]*m*T,b.y+w[1]*m*T,b.z+w[2]*m*T):y(_,b.x,b.y,b.z),y(g,b.x+w[0]*m*S,b.y+w[1]*m*S,b.z+w[2]*m*S),eR(_,_,s),eR(g,g,s),r.push(new cu(_[0],_[1],_[2])),x.push(new cu(g[0],g[1],g[2]))}p.push(r),f.push(x)}return[p,f]}(i,r,a,n,o,s,l,h,u,c,d):l?function(i,r,a,n,o,s,l,h,u){let c=[],d=[],p=[0,0,0,1];for(let f of i){let i=[],m=[];for(let c of f){let d=c.x+n.x,f=c.y+n.y,_=cv(d,f,r,a,s,l,h,u);p[0]=d,p[1]=f,p[2]=_.base,p[3]=1,eN(p,p,o),p[3]=Math.max(p[3],1e-5);let g=new cu(p[0]/p[3],p[1]/p[3],p[2]/p[3]);p[0]=d,p[1]=f,p[2]=_.top,p[3]=1,eN(p,p,o),p[3]=Math.max(p[3],1e-5);let y=new cu(p[0]/p[3],p[1]/p[3],p[2]/p[3]);i.push(g),m.push(y)}c.push(i),d.push(m)}return[c,d]}(r,a,n,o,s,l,h,u,c):function(i,r,a,n,o){let s=[],l=[],h=o[8]*r,u=o[9]*r,c=o[10]*r,d=o[11]*r,p=o[8]*a,f=o[9]*a,m=o[10]*a,_=o[11]*a;for(let r of i){let i=[],a=[];for(let s of r){let r=s.x+n.x,l=s.y+n.y,g=o[0]*r+o[4]*l+o[12],y=o[1]*r+o[5]*l+o[13],x=o[2]*r+o[6]*l+o[14],v=o[3]*r+o[7]*l+o[15],b=g+h,w=y+u,T=x+c,S=Math.max(v+d,1e-5),I=g+p,E=y+f,A=x+m,C=Math.max(v+_,1e-5);i.push(new cu(b/S,w/S,T/S)),a.push(new cu(I/C,E/C,A/C))}s.push(i),l.push(a)}return[s,l]}(r,a,n,o,s)}function cv(i,r,a,n,o,s,l,h){var u,c;let d,p,f,m,_,g,y,x,v,b,w,T,S,I,E=l*o.getElevationAt(i,r,!0,!0),A=0!==s[0],C=A?0===s[1]?l*(s[0]/7-450):l*(d=Math.floor(s[0]/8),p=Math.floor(s[1]/8),f=10*(s[0]-8*d),m=10*(s[1]-8*p),_=o.getElevationAt(d,p,!0,!0),y=Math.floor(.5*(f*(g=o.getMeterToDEM(h))-1)),x=Math.floor(.5*(m*g-1)),v=o.tileCoordToPixel(d,p),b=2*y+1,w=2*x+1,u=v.x-y,c=v.y-x,S=Math.abs((T=[o.getElevationAtPixel(u,c,!0),o.getElevationAtPixel(u+w,c,!0),o.getElevationAtPixel(u,c+w,!0),o.getElevationAtPixel(u+b,c+w,!0)])[0]-T[1]),I=Math.abs(T[2]-T[3]),_+Math.max(Math.min(.25,.5*g*(S+I)/b)*f,Math.min(.25,.5*g*(Math.abs(T[0]-T[2])+Math.abs(T[1]-T[3]))/w)*m)):E;return{base:E+(0===a?-1:a),top:A?Math.max(C+n,E+a+2):E+n}}class cb{constructor(i){this.module=i,this.memoryStack=this.module.malloc(4096),this.memoryStackNextFree=this.memoryStack}createIntArray(i){let r=this.memoryStackNextFree;return this.memoryStackNextFree+=i.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>4096?-1:(new Int32Array(this.module.heap32.buffer,r,i.length).set(i),r)}createFloatArray(i){let r=this.memoryStackNextFree;return this.memoryStackNextFree+=i.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>4096?-1:(new Float32Array(this.module.heapF32.buffer,r,i.length).set(i),r)}readStringBuffer(i){let r="";for(;0!==this.module.heapU8[i];)r+=String.fromCharCode(this.module.heapU8[i]),++i;return r}setStyle(i){let r=i.normalScale;this.module.setStyle(r[0],r[1],r[2],i.tileToMeters)}setAOOptions(i,r){this.module.setAOOptions(+!!i,r)}setMetricOptions(i,r){this.module.setMetricOptions(+!!i,r)}setStructuralOptions(i){this.module.setStructuralOptions(+!!i)}setFacadeOptions(i,r){this.module.setFacadeOptions(i,+!!r)}setFauxFacadeOptions(i,r,a){this.module.setFauxFacadeOptions(+!!i,+!!r,a)}setFacadeClassifierOptions(i){this.module.setFacadeClassifierOptions(i)}generateMesh(i,r){for(let r of(this.memoryStackNextFree=this.memoryStack,i)){let i=this.createIntArray(r.ringIndices),a=this.createFloatArray(r.coordinates);if(-1===i||-1===a)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(r.id,r.sourceId,r.minHeight,r.height,r.roofType,a,i,r.ringIndices.length-1)}for(let i of r){let r;r=i.entrances?JSON.parse(i.entrances):[];let a=this.createFloatArray(r),n=this.createFloatArray(i.coordinates);if(-1===a||-1===n)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(i.sourceId,i.crossPerc,i.distanceToRoad,a,r.length,n,i.coordinates.length)}if(!this.module.generateMesh()){let i=this.module.getLastError();return this.readStringBuffer(i)}
7let a=this.module.getMeshCount(),n=Array(a);for(let i=0;i<a;i++){let r=this.module.getPositionsPtr(i),a=this.module.getPositionsLength(i),o=new Float32Array(this.module.heapF32.buffer,r,a),s=this.module.getNormalsPtr(i),l=this.module.getNormalsLength(i),h=new Float32Array(this.module.heapF32.buffer,s,l),u=this.module.getAOPtr(i),c=this.module.getAOLength(i),d=new Float32Array(this.module.heapF32.buffer,u,c),p=this.module.getUVPtr(i),f=this.module.getUVLength(i),m=new Float32Array(this.module.heapF32.buffer,p,f),_=this.module.getFauxFacadePtr(i),g=this.module.getFauxFacadeLength(i),y=new Uint8Array(this.module.heapU8.buffer,_,g),x=this.module.getIndicesPtr(i),v=this.module.getIndicesLength(i),b=new Int16Array(this.module.heap16.buffer,x,v),w=this.module.getBuildingPart(i);n[i]={positions:o,normals:h,ao:d,uv:m,isFauxFacade:y,indices:b,buildingPart:w}}let o=this.module.getRingCount(),s=[];for(let i=0;i<o;i++){let r=this.module.getRingPtr(i),a=this.module.getRingLength(i),n=new Float32Array(this.module.heapF32.buffer,r,a);s.push(n)}return{meshes:n,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:s}}}let cw,cT=null,cS=null,cI=null,cE=null,cA=null,cC={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},cM={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},cP={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function cD(i,r,a){let n=a.json.bufferViews.length,o=a.buffers.length;r.bufferView=n,a.json.bufferViews[n]={buffer:o,byteLength:i.byteLength},a.buffers[o]=i}let cR="KHR_draco_mesh_compression",cL="EXT_meshopt_compression",cz=new TextDecoder("utf8");function cF(i,r){return new URL(i,r).href}async function cO(i,r,a,n,o){let s=await fetch(cF(i.uri,n),{signal:o}),l=await s.arrayBuffer();r.buffers[a]=l}function cB(i,r){let a=i.json.bufferViews[r];return new Uint8Array(i.buffers[a.buffer],a.byteOffset||0,a.byteLength)}async function ck(i,r,a,n,o){if(i.uri){let s=cF(i.uri,n),l=await fetch(s,{signal:o}),h=await l.blob(),u=await createImageBitmap(h);r.images[a]=u}else if(void 0!==i.bufferView){let n=new Blob([cB(r,i.bufferView)],{type:i.mimeType}),o=await createImageBitmap(n);r.images[a]=o}}async function cV(i,r=0,a,n){let o={json:null,images:[],buffers:[]};if(0x46546c67===new Uint32Array(i,r,1)[0]){let a=new Uint32Array(i,r),n=2,s=(a[n++]>>2)-3,l=a[n++]>>2;if(n++,o.json=JSON.parse(cz.decode(a.subarray(n,n+l))),(n+=l)<s){let s=a[n++],l=r+(++n<<2);o.buffers[0]=i.slice(l,l+s)}}else o.json=JSON.parse(cz.decode(new Uint8Array(i,r)));let{buffers:s,images:l,meshes:h,extensionsUsed:u,bufferViews:c}=o.json;if(s){let i=[];for(let r=0;r<s.length;r++){let l=s[r];l.uri?i.push(cO(l,o,r,a,n)):o.buffers[r]||(o.buffers[r]=null)}await Promise.all(i)}if(n&&n.aborted)throw new DOMException("Aborted","AbortError");let d=[],p=u&&u.includes(cR),f=u&&u.includes(cL);if(p&&d.push(function(){if(!cT)return null!=cw?cw:(cw=function(i){let r,a=null;function n(){r=new Uint8Array(a.buffer)}function o(){throw Error("Unexpected Draco error.")}let s={a:{a:o,d:function(i,a,n){return r.copyWithin(i,a,a+n)},c:function(i){let o=r.length,s=Math.ceil((Math.max(i>>>0,Math.ceil(1.2*o))-o)/65536);try{return a.grow(s),n(),!0}catch(i){return!1}},b:o}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,s):i.then(i=>i.arrayBuffer()).then(i=>WebAssembly.instantiate(i,s))).then(i=>{let o,s,l,h,{Rb:u,Qb:c,P:d,T:p,X:f,Ja:m,La:_,Qa:g,Va:y,Wa:x,eb:v,jb:b,f:w,e:T,yb:S,zb:I,Ab:E,Bb:A,Db:C,Gb:M}=i.instance.exports;a=T;let P=(o=0,s=0,l=0,h=0,i=>{l&&(u(h),u(o),s+=l,l=o=0),o||(s+=128,o=c(s));let a=i.length+7&-8,n=o;a>=s&&(l=a,n=h=c(a));for(let a=0;a<i.length;a++)r[n+a]=i[a];return n});return n(),w(),{memory:T,_free:u,_malloc:c,Mesh:class{constructor(){this.ptr=d()}destroy(){p(this.ptr)}},Decoder:class{constructor(){this.ptr=m()}destroy(){b(this.ptr)}DecodeArrayToMesh(i,r,a){let n=P(i);return!!f(_(this.ptr,n,r,a.ptr))}GetAttributeByUniqueId(i,r){return{ptr:g(this.ptr,i.ptr,r)}}GetTrianglesUInt16Array(i,r,a){y(this.ptr,i.ptr,r,a)}GetTrianglesUInt32Array(i,r,a){x(this.ptr,i.ptr,r,a)}GetAttributeDataArrayForAllPoints(i,r,a,n,o){v(this.ptr,i.ptr,r.ptr,a,n,o)}},DT_INT8:S(),DT_UINT8:I(),DT_INT16:E(),DT_UINT16:A(),DT_UINT32:C(),DT_FLOAT32:M()}})}(fetch(tP()))).then(i=>{cT=i,cw=void 0})}()),f&&d.push(function(){var i;let r,a,n,o;if(cS)return;let s=(i=fetch(tD()),a=WebAssembly.instantiateStreaming(i,{}).then(i=>{(r=i.instance).exports.__wasm_call_ctors()}),n={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},o={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},{ready:a,supported:!0,decodeGltfBuffer(i,a,s,l,h,u){!function(i,r,a,n,o,s,l){let h=i.exports.sbrk,u=n+3&-4,c=h(u*o),d=h(s.length),p=new Uint8Array(i.exports.memory.buffer);p.set(s,d);let f=r(c,n,o,d,s.length);if(0===f&&l&&l(c,u,o),a.set(p.subarray(c,c+n*o)),h(c-h(0)),0!==f)throw Error(`Malformed buffer data: ${f}`)}(r,r.exports[o[h]],i,a,s,l,r.exports[n[u]])}});return s.ready.then(()=>{cS=s})}()),l)for(let i=0;i<l.length;i++)d.push(ck(l[i],o,i,a,n));if(d.length&&await Promise.all(d),n&&n.aborted)throw new DOMException("Aborted","AbortError");
7if(p&&h)for(let{primitives:i}of h)for(let r of i)!function(i,r){let a=i.extensions&&i.extensions[cR];if(!a)return;let n=new cT.Decoder,o=cB(r,a.bufferView),s=new cT.Mesh;if(!n.DecodeArrayToMesh(o,o.byteLength,s))throw Error("Failed to decode Draco mesh");let l=r.json.accessors[i.indices],h=cC[l.componentType],u=l.count*h.BYTES_PER_ELEMENT,c=cT._malloc(u);for(let o of(h===Uint16Array?n.GetTrianglesUInt16Array(s,u,c):n.GetTrianglesUInt32Array(s,u,c),cD(cT.memory.buffer.slice(c,c+u),l,r),cT._free(c),Object.keys(a.attributes))){let l=n.GetAttributeByUniqueId(s,a.attributes[o]),h=r.json.accessors[i.attributes[o]],u=cM[h.componentType],c=h.count*cP[h.type]*cC[h.componentType].BYTES_PER_ELEMENT,d=cT._malloc(c);n.GetAttributeDataArrayForAllPoints(s,l,cT[u],c,d),cD(cT.memory.buffer.slice(d,d+c),h,r),cT._free(d)}n.destroy(),s.destroy(),delete i.extensions[cR]}(r,o);if(f&&h&&c)for(let i of c)!function(i,r){if(!i.extensions||!i.extensions[cL])return;let a=i.extensions[cL],n=new Uint8Array(r.buffers[a.buffer],a.byteOffset||0,a.byteLength||0),o=new Uint8Array(a.count*a.byteStride);cS.decodeGltfBuffer(o,a.count,a.byteStride,n,a.mode,a.filter),i.buffer=r.buffers.length,i.byteOffset=0,r.buffers[i.buffer]=o.buffer,delete i.extensions[cL]}(i,o);return o}async function cN(i,r){return cV(await async function(i,r){if(r&&r.aborted)throw new DOMException("Aborted","AbortError");return new Promise((a,n)=>{let o=t3(i,(i,r)=>{i?n(i):a(r)});r&&r.addEventListener("abort",()=>{o.cancel(),n(new DOMException("Aborted","AbortError"))},{once:!0})})}({url:i,type:"arrayBuffer"},r),0,i,r)}function cU(i){switch(i){case WebGL2RenderingContext.RGBA8:case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function cj(i){switch(i){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.HALF_FLOAT;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class cG{constructor(i,r,a,n){this.context=i,this.format=a,this.useMipmap=n&&n.useMipmap,this.texture=i.gl.createTexture(),this.update(r,{premultiply:n&&n.premultiply})}update(i,r){let a=i&&i instanceof HTMLVideoElement&&0===i.width?i.videoWidth:i.width,n=i&&i instanceof HTMLVideoElement&&0===i.height?i.videoHeight:i.height,{context:o}=this,{gl:s}=o,{x:l,y:h}=r&&r.position?r.position:{x:0,y:0},u=l+a,c=h+n;this.size&&(this.size[0]!==u||this.size[1]!==c)&&(!r||void 0===r.recreateWhenResize||r.recreateWhenResize)&&(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!r||!1!==r.premultiply));let d=i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||ImageBitmap&&i instanceof ImageBitmap;if(!this.size&&u>0&&c>0){let i=this.useMipmap?Math.floor(Math.log2(Math.max(u,c)))+1:1;s.texStorage2D(s.TEXTURE_2D,i,this.format,u,c),this.size=[u,c]}this.size&&(d?s.texSubImage2D(s.TEXTURE_2D,0,l,h,cU(this.format),cj(this.format),i):"data"in i&&i.data&&s.texSubImage2D(s.TEXTURE_2D,0,l,h,a,n,cU(this.format),cj(this.format),i.data)),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(i,r,a=!1){let{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),i!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap&&!a?i===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:i),this.minFilter=i),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrapS=r)}bindExtraParam(i,r,a,n,o){let{context:s}=this,{gl:l}=s;l.bindTexture(l.TEXTURE_2D,this.texture),r!==this.magFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,r),this.magFilter=r),i!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap?i===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:i),this.minFilter=i),a!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,a),this.wrapS=a),n!==this.wrapT&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,n),this.wrapT=n),o!==this.compareMode&&(o?(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_MODE,l.COMPARE_REF_TO_TEXTURE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_FUNC,o)):l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_MODE,l.NONE),this.compareMode=o)}destroy(){let{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}}class cq{constructor(i,r){this.context=i,this.texture=r}
7bind(i,r){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_2D,this.texture),i!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i),this.minFilter=i),r!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,r),this.wrapS=r)}}let c$=oy([{name:"a_pos_3f",components:3,type:"Float32"}]),cH=oy([{name:"a_color_3f",components:3,type:"Float32"}]),cZ=oy([{name:"a_color_4f",components:4,type:"Float32"}]),cW=oy([{name:"a_uv_2f",components:2,type:"Float32"}]),cX=oy([{name:"a_normal_3f",components:3,type:"Float32"}]),cY=oy([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),cK=oy([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function cJ(i,r){var a,n;let o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I=c0(i.projection,i.zoom,i.width,i.height),E=(a=i.projection,n=i.center,o=new sX(n.lng-180*c1,n.lat),s=new sX(n.lng+180*c1,n.lat),l=a.project(o.lng,o.lat),u=-Math.atan2((h=a.project(s.lng,s.lat)).y-l.y,h.x-l.x),(c=s8.fromLngLat(n)).y=tr(c.y,-1+c1,1-c1),d=c.toLngLat(),p=a.project(d.lng,d.lat),f=s8.fromLngLat(d),f.x+=c1,m=f.toLngLat(),g=c3((_=a.project(m.lng,m.lat)).x-p.x,_.y-p.y,u),y=s8.fromLngLat(d),y.y+=c1,x=y.toLngLat(),b=c3((v=a.project(x.lng,x.lat)).x-p.x,v.y-p.y,u),w=Math.abs(g.x)/Math.abs(b.y),es(T=ee([]),T,-u*(1-(r?0:I))),ea(S=ee([]),S,[1,1-(1-w)*I,1]),S[4]=-b.x/b.y*I,es(S,S,u),ei(S,T,S),S),A=cQ(i);return ea(E,E,[A,A,1]),E}function cQ(i){let r=i.projection,a=c0(i.projection,i.zoom,i.width,i.height);return Math.pow(2,c2(r,i.center)*a+(1-a)*c2(r,sX.convert(r.center)))}function c0(i,r,a,n,o=1/0){let s=i.range;if(!s)return 0;let l=Math.log2(Math.min(o,Math.max(a,n))/1024);return ta(s[0]+l,s[1]+l,r)}let c1=1/4e4;function c2(i,r){let a=tr(r.lat,-85.051129,85.051129),n=new sX(r.lng-180*c1,a),o=new sX(r.lng+180*c1,a),s=i.project(n.lng,a),l=i.project(o.lng,a),h=s8.fromLngLat(n),u=s8.fromLngLat(o),c=l.x-s.x,d=l.y-s.y,p=u.x-h.x,f=u.y-h.y;return Math.log2(Math.sqrt((p*p+f*f)/(c*c+d*d)))}function c3(i,r,a){let n=Math.cos(a),o=Math.sin(a);return{x:i*n-r*o,y:i*o+r*n}}function c5(i,r,a){ee(i),es(i,i,r[2]*e8),en(i,i,r[0]*e8),eo(i,i,r[1]*e8),ea(i,i,a),ei(i,i,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function c4(i,r,a,n,o,s,l,h){let u=[a[0]-r[0],a[1]-r[1],0],c=[n[0]-r[0],n[1]-r[1],0];if(1e-12>ef(u)||1e-12>ef(c))return ej(i);let d=eP([],u,c);return eC(d,d),ey(c,n,r),u[2]=(s-o)*h,c[2]=(l-o)*h,eP(u,u,c),eC(u,u),eW(i,d,u)}function c6(i,r,a=!1){let n=hh(r.zoom),o=function(i,r,a){let n,o,s,l=r.worldSize,h=[i[12],i[13],i[14]],u=s1(h[1]/l),c=s0(h[0]/l),d=ee([]),p=1/sK(u)*l,f=1/sK(0)*l*s5(u,r.zoom),m=1/ho(l),_=f*m;if(a){let i=c0(r.projection,r.zoom,r.width,r.height,1024);_=m*r.projection.pixelSpaceConversion(r.center.lat,l,i)}let g=sZ(u,c);eg(g,g,ew([],eC([],g),p*_*h[2]));let y=(s=eP([],o=[0,1,0],n=[g[0],g[1],g[2]]),eP(o,n,s),0===eE(o)&&eP(s,n,o=[0,1,0]),eC(s,s),eC(o,o),eC(n,n),[s[0],s[1],s[2],0,o[0],o[1],o[2],0,n[0],n[1],n[2],0,g[0],g[1],g[2],1]);ea(d,d,[_,_,_*p]),er(d,d,[-h[0],-h[1],-h[2]]);let x=ei([],r.globeMatrix,y);return ei(x,x,d),ei(x,x,i),x}(i,r,a);if(n>0){let a,s,l,h,u,c,d,p,f,m,_=(a=r.worldSize,s=1/sK(0)*a*s5(r.center.lat,r.zoom)/ho(a),l=1/sK(r.center.lat)*a,eo(h=ee([]),h,r.center.lng*e8),en(h,h,r.center.lat*e8),er(h,h,[0,0,sG]),ea(h,h,[s,s,s*l]),er(h,h,[-(u=r.point).x,-u.y,0]),ei(h,h,i),ei(h,r.globeMatrix,h));return d=(c=(i,r,a)=>{let n=ef(i),o=ef(r),s=l4(i,r,a);return ew(s,s,1/ef(s)*iv(n,o,a))})([o[0],o[1],o[2]],[_[0],_[1],_[2]],n),p=c([o[4],o[5],o[6]],[_[4],_[5],_[6]],n),f=c([o[8],o[9],o[10]],[_[8],_[9],_[10]],n),m=l4([o[12],o[13],o[14]],[_[12],_[13],_[14]],n),[d[0],d[1],d[2],0,p[0],p[1],p[2],0,f[0],f[1],f[2],0,m[0],m[1],m[2],1]}return o}function c8(i,r,a,n){let o=lT.projectAabbCorners(n,a),s=Number.MAX_VALUE;for(let i=0;i<o.length;++i){let a=o[i];a[0]=(.5*a[0]+.5)*r.width,a[1]=(.5-.5*a[1])*r.height,a[2]<s&&(s=a[2])}if(lM(i,function(i){let r=[],a=0;for(let r=1;r<i.length;r++)(i[r][0]<i[a][0]||i[r][0]===i[a][0]&&i[r][1]<i[a][1])&&(a=r);let n,o=a,s=new Uint8Array(i.length);do{if(s[o])break;r.push(new e4(i[o][0],i[o][1])),s[o]=1,n=(o+1)%i.length;for(let r=0;r<i.length;r++){if(i[r][0]===i[n][0]&&i[r][1]===i[n][1]||i[r][0]===i[o][0]&&i[r][1]===i[o][1])continue;let a=[i[r][0]-i[o][0],i[r][1]-i[o][1]],s=[i[n][0]-i[o][0],i[n][1]-i[o][1]],l=a[0]*s[1]-a[1]*s[0];(l>0||0===l&&a[0]*s[0]+a[1]*s[1]>=0&&a[0]*a[0]+a[1]*a[1]>s[0]*s[0]+s[1]*s[1])&&(n=r)}o=n}while(o!==a);return r.length>0&&r.push(r[0]),r}(o)))return s}
7let c9={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function c7(i,r,a,n,o,s,l,h,u,c=!1){let d=a.zoom,p=a.project(n),f=s5(n.lat,d),m=1/f;ee(i),er(i,i,[p.x+l[0]*m,p.y+l[1]*m,l[2]]);let _=1,g=1,y=a.worldSize;if(c){if("mercator"===a.projection.name){let i=0;a.elevation&&(i=a.elevation.getAtPointOrZero(new s8(p.x/y,p.y/y),0));let r=eN([],[p.x,p.y,i,1],a.projMatrix)[3]/a.cameraToCenterDistance;_=r,g=r*s5(a.center.lat,d)}else if("globe"===a.projection.name){let r=c6(i,a),o=[0,0,0,1];eN(o,o,ei([],a.projMatrix,r));let s=o[3]/a.cameraToCenterDistance,l=hh(d),h=a.projection.pixelsPerMeter(n.lat,y)*s5(n.lat,d),u=a.projection.pixelsPerMeter(a.center.lat,y)*s5(a.center.lat,d);_=s/iv(h,s3(a.center.lat),l),g=s*f/h,_*=u,g*=u}}else _=m;ea(i,i,[_,_,g]);let x=[...i],v=r.orientation,b=[];if(c5(b,[v[0]+(o?o[0]:0),v[1]+(o?o[1]:0),v[2]+(o?o[2]:0)],s),ei(i,x,b),h&&a.elevation){let o=0,s=[];if(u&&a.elevation){o=function(i,r,a,n,o){let s=r.elevation;if(!s)return 0;let l=lT.projectAabbCorners(a,n),h=1/sK(o.lat)*r.worldSize,u=function(i,r){let a=[0,0,1],n=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(let o of n){let n=i[o.corners[0]],s=i[o.corners[1]],l=i[o.corners[2]],h=[s[0]-n[0],s[1]-n[1],r*(s[2]-n[2])],u=eP(h,h,[l[0]-n[0],l[1]-n[1],r*(l[2]-n[2])]);eC(u,u),o.dotProductWithUp=eM(u,a)}return n.sort((i,r)=>i.dotProductWithUp-r.dotProductWithUp),n[0].corners}(l,h),c=l[u[0]],d=l[u[1]],p=l[u[2]],f=l[u[3]],m=s.getAtPointOrZero(new s8(c[0]/r.worldSize,c[1]/r.worldSize),0),_=s.getAtPointOrZero(new s8(d[0]/r.worldSize,d[1]/r.worldSize),0),g=s.getAtPointOrZero(new s8(p[0]/r.worldSize,p[1]/r.worldSize),0),y=s.getAtPointOrZero(new s8(f[0]/r.worldSize,f[1]/r.worldSize),0),x=(m+y)/2,v=(_+g)/2;return x>v?_<g?c4(i,d,f,c,_,y,m,h):c4(i,p,c,f,g,m,y,h):m<y?c4(i,c,d,p,m,_,g,h):c4(i,f,p,d,y,g,_,h),Math.max(x,v)}(s,a,r.aabb,i,n);let l=ei([],ec([],s),b);ei(i,x,l)}else o=a.elevation.getAtPointOrZero(new s8(p.x/y,p.y/y),0);0!==o&&(i[14]+=o)}}class de{constructor(i,r,a,n,o){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=i,this.uri=r,this.position=null!=a?new sX(a[0],a[1]):new sX(0,0),this.orientation=null!=n?n:[0,0,0],this.nodes=o,this.uploaded=!1,this.aabb=new lT([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(i,r){var a;ei(i.globalMatrix,r,i.localMatrix);let n=this.nodeOverrides.get(i.name);if(void 0!==n){let r=[];a=n.orientation,ee(r),eo(r,r,a[1]*e8),es(r,r,a[2]*e8),en(r,r,a[0]*e8),ei(i.globalMatrix,i.globalMatrix,r)}if(i.meshes)for(let r of i.meshes){let a=lT.applyTransformFast(r.aabb,i.globalMatrix);this.aabb.encapsulate(a)}if(i.children)for(let r of i.children)this._applyTransformations(r,i.globalMatrix)}computeBoundsAndApplyParent(){let i=ee([]);for(let r of(this.aabb=new lT([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.nodes))this._applyTransformations(r,i)}computeModelMatrix(i,r,a,n,o,s,l=!1){c7(this.matrix,this,i.transform,this.position,r,a,n,o,s,l)}upload(i){if(!this.uploaded){for(let r of this.nodes)di(r,i);for(let i of this.nodes)dr(i);this.uploaded=!0}}destroy(){for(let i of this.nodes)da(i)}}function dt(i,r,a=!1){i.uploaded||(i.gfxTexture=new cG(r,i.image,a?r.gl.R8:r.gl.RGBA8,{useMipmap:i.sampler.minFilter>=r.gl.NEAREST_MIPMAP_NEAREST}),i.uploaded=!0,i.image=null)}function di(i,r,a){if(i.meshes)for(let n of i.meshes)!function(i,r,a){i.indexBuffer=r.createIndexBuffer(i.indexArray,!1,!0),i.vertexBuffer=r.createVertexBuffer(i.vertexArray,c$.members,!1,!0),i.normalArray&&(i.normalBuffer=r.createVertexBuffer(i.normalArray,cX.members,!1,!0)),i.texcoordArray&&(i.texcoordBuffer=r.createVertexBuffer(i.texcoordArray,cW.members,!1,!0)),i.colorArray&&(i.colorBuffer=r.createVertexBuffer(i.colorArray,(12===i.colorArray.bytesPerElement?cH:cZ).members,!1,!0)),i.featureArray&&(i.pbrBuffer=r.createVertexBuffer(i.featureArray,cK.members,!0)),i.segments=sh.simpleSegment(0,0,i.vertexArray.length,i.indexArray.length);let n=i.material;n.pbrMetallicRoughness.baseColorTexture&&dt(n.pbrMetallicRoughness.baseColorTexture,r),n.pbrMetallicRoughness.metallicRoughnessTexture&&dt(n.pbrMetallicRoughness.metallicRoughnessTexture,r),n.normalTexture&&dt(n.normalTexture,r),n.occlusionTexture&&dt(n.occlusionTexture,r,a),n.emissionTexture&&dt(n.emissionTexture,r)}(n,r,a);if(i.children)for(let n of i.children)di(n,r,a)}function dr(i){if(i.meshes)for(let r of i.meshes)r.indexArray.destroy(),r.vertexArray.destroy(),r.colorArray&&r.colorArray.destroy(),r.normalArray&&r.normalArray.destroy(),r.texcoordArray&&r.texcoordArray.destroy(),r.featureArray&&r.featureArray.destroy();if(i.children)for(let r of i.children)dr(r)}function da(i){if(i.meshes)for(let a of i.meshes){var r;a.vertexBuffer&&(a.vertexBuffer.destroy(),a.indexBuffer.destroy(),a.normalBuffer&&a.normalBuffer.destroy(),a.texcoordBuffer&&a.texcoordBuffer.destroy(),a.colorBuffer&&a.colorBuffer.destroy(),a.pbrBuffer&&a.pbrBuffer.destroy(),a.segments.destroy(),a.material&&((r=a.material).pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),r.pbrMetallicRoughness.metallicRoughnessTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),r.normalTexture&&r.normalTexture.gfxTexture&&r.normalTexture.gfxTexture.destroy(),r.emissionTexture&&r.emissionTexture.gfxTexture&&r.emissionTexture.gfxTexture.destroy(),r.occlusionTexture&&r.occlusionTexture.gfxTexture&&r.occlusionTexture.gfxTexture.destroy()))}if(i.footprintDebugMesh&&(i.footprintDebugMesh.vertexBuffer.destroy(),i.footprintDebugMesh.indexBuffer.destroy(),i.footprintDebugMesh.segments.destroy()),i.children)for(let r of i.children)da(r)}function dn(i,r){let a=i.json.bufferViews[r.bufferView],n=cC[r.componentType];return new n(i.buffers[a.buffer],(r.byteOffset||0)+(a.byteOffset||0),r.count*(a.byteStride&&a.byteStride!==cP[r.type]*n.BYTES_PER_ELEMENT?a.byteStride/n.BYTES_PER_ELEMENT:cP[r.type]))}function ds(i,r,a,n){let o=cC[r.componentType],s=function(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(o),l=i.json.bufferViews[r.bufferView],h=l.byteStride?l.byteStride/o.BYTES_PER_ELEMENT:cP[r.type],u=a.float32,c=u.length/a.capacity;for(let i=0,a=0;i<r.count*h;i+=h,a+=c)for(let r=0;r<c;r++)u[a+r]=n[i+r]*s;a._trim()}
7function dl(i){let r=function(i,r){let a=[],n=WebGL2RenderingContext;if(i.json.textures)for(let o of i.json.textures){let s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==o.sampler&&Object.assign(s,i.json.samplers[o.sampler]),a.push({image:r[o.source],sampler:s,uploaded:!1})}return a}(i,i.images),a=function(i,r){let a=[];for(let n of i.json.meshes){let o=[];for(let a of n.primitives)o.push(function(i,r,a){let n=i.indices,o=i.attributes,s={};s.indexArray=new oj;let l=r.json.accessors[n],h=l.count/3;s.indexArray.reserve(h);let u=dn(r,l);for(let i=0;i<h;i++)s.indexArray.emplaceBack(u[3*i],u[3*i+1],u[3*i+2]);s.indexArray._trim(),s.vertexArray=new oM;let c=r.json.accessors[o.POSITION];s.vertexArray.reserve(c.count);let d=dn(r,c);for(let i=0;i<c.count;i++)s.vertexArray.emplaceBack(d[3*i],d[3*i+1],d[3*i+2]);if(s.vertexArray._trim(),s.aabb=new lT(c.min,c.max),s.centroid=function(i,r){let a=[0,0,0],n=i.length;if(n>0){for(let o=0;o<n;o++){let n=3*i[o];a[0]+=r[n],a[1]+=r[n+1],a[2]+=r[n+2]}a[0]/=n,a[1]/=n,a[2]/=n}return a}(u,d),void 0!==o.COLOR_0){let i=r.json.accessors[o.COLOR_0],a=cP[i.type],n=dn(r,i);s.colorArray=3===a?new oM:new oF,s.colorArray.resize(i.count),ds(r,i,s.colorArray,n)}if(void 0!==o.NORMAL){s.normalArray=new oM;let i=r.json.accessors[o.NORMAL];s.normalArray.resize(i.count);let a=dn(r,i);ds(r,i,s.normalArray,a)}if(void 0!==o.TEXCOORD_0&&a.length>0){s.texcoordArray=new oY;let i=r.json.accessors[o.TEXCOORD_0];s.texcoordArray.resize(i.count);let a=dn(r,i);ds(r,i,s.texcoordArray,a)}if(void 0!==o._FEATURE_ID_RGBA4444){let i=r.json.accessors[o._FEATURE_ID_RGBA4444];r.json.extensionsUsed&&r.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=dn(r,i))}void 0!==o._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(dn(r,r.json.accessors[o._FEATURE_RGBA4444]).buffer));let p=i.material;return s.material=function(i,r){let{emissiveFactor:a=[0,0,0],alphaMode:n="OPAQUE",alphaCutoff:o=.5,normalTexture:s,occlusionTexture:l,emissiveTexture:h,doubleSided:u,name:c}=i,{baseColorFactor:d=[1,1,1,1],metallicFactor:p=1,roughnessFactor:f=1,baseColorTexture:m,metallicRoughnessTexture:_}=i.pbrMetallicRoughness||{},g=l?r[l.index]:void 0;if(l&&l.extensions&&l.extensions.KHR_texture_transform&&g){let i=l.extensions.KHR_texture_transform;g.offsetScale=[i.offset[0],i.offset[1],i.scale[0],i.scale[1]]}return{name:c,pbrMetallicRoughness:{baseColorFactor:new i_(...d),metallicFactor:p,roughnessFactor:f,baseColorTexture:m?r[m.index]:void 0,metallicRoughnessTexture:_?r[_.index]:void 0},doubleSided:u,emissiveFactor:new i_(...a),alphaMode:n,alphaCutoff:o,normalTexture:s?r[s.index]:void 0,occlusionTexture:g,emissionTexture:h?r[h.index]:void 0,defined:void 0===i.defined}}(void 0!==p?r.json.materials[p]:{defined:!1},a),s}(a,i,r));a.push(o)}return a}(i,r),{scenes:n,scene:o,nodes:s}=i.json,l=n?n[o||0].nodes:[...s.keys()],h=[];for(let r of l)h.push(function i(r,a,n){var o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E,A,C;let{matrix:M,rotation:P,translation:D,scale:R,mesh:L,extras:z,children:F,name:O}=r,B={};if(B.name=O,B.localMatrix=M||(o=[],s=P||[0,0,0,1],l=D||[0,0,0],h=R||[1,1,1],u=s[0],c=s[1],d=s[2],p=s[3],f=u+u,m=c+c,_=d+d,g=u*f,y=u*m,x=u*_,v=c*m,b=c*_,w=d*_,T=p*f,S=p*m,I=p*_,E=h[0],A=h[1],C=h[2],o[0]=(1-(v+w))*E,o[1]=(y+I)*E,o[2]=(x-S)*E,o[3]=0,o[4]=(y-I)*A,o[5]=(1-(g+w))*A,o[6]=(b+T)*A,o[7]=0,o[8]=(x+S)*C,o[9]=(b-T)*C,o[10]=(1-(g+v))*C,o[11]=0,o[12]=l[0],o[13]=l[1],o[14]=l[2],o[15]=1,o),B.globalMatrix=Q(B.localMatrix),void 0!==L){B.meshes=n[L];let i=B.anchor=[0,0];for(let r of B.meshes){let{min:a,max:n}=r.aabb;i[0]+=a[0]+n[0],i[1]+=a[1]+n[1]}i[0]=Math.floor(i[0]/B.meshes.length/2),i[1]=Math.floor(i[1]/B.meshes.length/2)}if(z&&(z.id&&(B.id=z.id),z.lights&&(B.lights=function(i){if(!i.length)return[];let r=function(i){let r=atob(i),a=new Uint8Array(r.length);for(let i=0;i<r.length;i++)a[i]=r.codePointAt(i);return a}(i),a=[],n=r.length/24,o=new Uint16Array(r.buffer),s=new Float32Array(r.buffer);for(let i=0;i<n;i++){let r=o[2*i*6]/30,n=o[2*i*6+1]/30,l=o[2*i*6+10]/100,h=s[6*i+1],u=s[6*i+2],c=s[6*i+3],d=s[6*i+4],p=c-h,f=d-u,m=Math.hypot(p,f);a.push({pos:[h+.5*p,u+.5*f,n],normal:[f/m,-p/m,0],width:m,height:r,depth:l,points:[h,u,c,d]})}return a}(z.lights)),z.MAPBOX_geometry_bloom&&(B.isGeometryBloom=z.MAPBOX_geometry_bloom)),F){let r=[];for(let o of F)r.push(i(a.json.nodes[o],a,n));B.children=r}return B}(s[r],i,a));return function(i,r,a){let n={},o=new Set;for(let s=0;s<i.length;s++){let i=a[r[s]];if(!i.extras)continue;let l=i.extras["mapbox:footprint:version"],h=i.extras["mapbox:footprint:id"];(l||h)&&o.add(s),"1.0.0"===l&&h&&(n[h]=s)}for(let s=0;s<i.length;s++){if(o.has(s))continue;let l=i[s],h=a[r[s]];if(!h.extras)continue;let u=null;l.id in n&&(u=function(i,r){let a=[],n=[],o=0,s=[];for(let l of i){o=a.length;let i=l.vertexArray.float32,h=l.indexArray.uint16;for(let n=0;n<l.vertexArray.length;n++)s[0]=i[3*n+0],s[1]=i[3*n+1],s[2]=i[3*n+2],eR(s,s,r),a.push(new e4(s[0],s[1]));for(let i=0;i<3*l.indexArray.length;i++)n.push(h[i]+o)}if(n.length%3!=0)return null;for(let i=0;i<n.length;i+=3){let r=a[n[i+0]],o=a[n[i+1]],s=a[n[i+2]];(r.x-o.x)*(s.y-o.y)-(s.x-o.x)*(r.y-o.y)>0&&([n[i+1],n[i+2]]=[n[i+2],n[i+1]])}return{vertices:a,indices:n}}(i[n[l.id]].meshes,l.localMatrix)),u||(u=function(i){if(!i.extras||!i.extras.ground)return null;let r=i.extras.ground;if(!r||!Array.isArray(r)||0===r.length)return null;let a=r[0];if(!a||!Array.isArray(a)||0===a.length)return null;let n=[];for(let i of a){if(!Array.isArray(i)||2!==i.length)continue;let r=i[0],a=i[1];"number"==typeof r&&"number"==typeof a&&n.push(new e4(r,a))}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let o=0;for(let i=0;i<n.length;i++){let r=n[i],a=n[(i+1)%n.length],s=n[(i+2)%n.length];o+=(r.x-a.x)*(s.y-a.y)-(s.x-a.x)*(r.y-a.y)}o>0&&n.reverse();let s=hR(n.flatMap(i=>[i.x,i.y]),[]);return 0===s.length?null:{vertices:n,indices:s}}(h)),u&&(l.footprint=function(i){if(0===i.vertices.length||0===i.indices.length)return null;let r=new uE(i.vertices,i.indices,8,256),[a,n]=[r.min.clone(),r.max.clone()];return{vertices:i.vertices,indices:i.indices,grid:r,min:a,max:n}}(u))}if(o.size>0){let r=Array.from(o.values()).sort((i,r)=>i-r);for(let a=r.length-1;a>=0;a--)i.splice(r[a],1)}}(h,l,i.json.nodes),h}function dh(i,r,a,n,o){a.reserve(a.length+4*i.length),n.reserve(n.length+10*i.length),o.reserve(o.length+10*i.length);let s=n.length;for(let l of i){let i=Math.min(10,Math.max(4,1.3*l.height))*r,h=[-l.normal[1],l.normal[0],0],u=
7Math.min(.29,.1*l.width/l.depth),c=l.width-2*l.depth*r*(u+.01),d=eT([],l.pos,h,c/2),p=eT([],l.pos,h,-c/2),f=[d[0],d[1],d[2]+l.height],m=[p[0],p[1],p[2]+l.height],_=eT([],l.normal,h,u);ew(_,_,i);let g=eT([],l.normal,h,-u);ew(g,g,i),eg(_,d,_),eg(g,p,g),d[2]+=.1,p[2]+=.1,n.emplaceBack(_[0],_[1],_[2]),n.emplaceBack(g[0],g[1],g[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(_[0],_[1],_[2]),n.emplaceBack(g[0],g[1],g[2]);let y=c/i/2;o.emplaceBack(-y-u,-1,y,.8),o.emplaceBack(y+u,-1,y,.8),o.emplaceBack(-y,0,y,1.3),o.emplaceBack(y,0,y,1.3),o.emplaceBack(y+u,-.8,y,.7),o.emplaceBack(y+u,-.8,y,.7),o.emplaceBack(0,0,y,1.3),o.emplaceBack(0,0,y,1.3),o.emplaceBack(y+u,-1.2,y,.8),o.emplaceBack(y+u,-1.2,y,.8),a.emplaceBack(6+s,4+s,8+s),a.emplaceBack(7+s,9+s,5+s),a.emplaceBack(0+s,1+s,2+s),a.emplaceBack(1+s,3+s,2+s),s+=10}}let du=oy([{name:"a_pos_3f",components:3,type:"Float32"}]),dc=oy([{name:"a_normal_3",components:3,type:"Int16"}]),dd=oy([{name:"a_centroid_3",components:3,type:"Int16"}]),dp=oy([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),df=oy([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),dm=oy([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),d_=oy([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),dg=oy([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),dy=oy([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),dx=li.types;class dv{constructor(){this.layoutVertexArray=new oM,this.layoutAttenuationArray=new oF,this.layoutColorArray=new oB,this.indexArray=new oj,this.indexArrayForConflation=new oj,this.segmentsBucket=new sh}}class db{constructor(i){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new sh,this.entranceBloom=new dv,this.layoutVertexArray=new oM,this.layoutVertexArray.reserve(66560),this.layoutNormalArray=new ob,this.layoutNormalArray.reserve(66560),this.layoutCentroidArray=new ob,this.layoutCentroidArray.reserve(66560),this.layoutColorArray=new oB,this.layoutColorArray.reserve(66560),this.layoutFloodLightDataArray=new o1,this.layoutFloodLightDataArray.reserve(66560),this.layoutAOArray=new o2,this.layoutAOArray.reserve(66560),this.indexArray=new oj,this.indexArray.reserve(66560),this.indexArrayForConflation=new oj,this.segmentsBucket=new sh,this.entranceBloom=new dv,i&&(this.layoutFacadePaintArray=new oB,this.layoutFacadeDataArray=new oD,this.layoutFacadeVerticalRangeArray=new oB)}reserve(i,r,a){this.layoutVertexArray.reserveForAdditional(i),this.layoutCentroidArray.reserveForAdditional(i),this.layoutFloodLightDataArray.reserveForAdditional(i),this.layoutNormalArray.reserveForAdditional(i),this.layoutAOArray.reserveForAdditional(i),this.layoutColorArray.reserveForAdditional(i),this.indexArray.reserveForAdditional(r),a&&(this.layoutFacadePaintArray.reserveForAdditional(i),this.layoutFacadeDataArray.reserveForAdditional(i),this.layoutFacadeVerticalRangeArray.reserveForAdditional(i))}}class dw{constructor(i){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new oY,this.footprintsIndices=new oJ,this.footprintsMin=new e4(1/0,1/0),this.footprintsMax=new e4(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new db(!1),this.buildingWithFacade=new db(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=i.zoom,this.canonical=i.canonical,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.worldview=i.worldview,this.lut=i.lut,this.programConfigurations=new sk(i.layers,{zoom:i.zoom,lut:i.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection,this.groundEffect=new ce(i),this.groundEffect.groundRadiusArray=new oT,this.hasAppearances=null}updateFootprints(i,r){let a=new uE([],[],1),n={vertices:[],indices:new Uint32Array(0),grid:a,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};r.push({footprint:n,id:i})}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}prepare(){return null!=cI||null!=cE?null:null!=cA?cA:cA=(function(i){let r,a,n,o,s;function l(){r=new Uint8Array(s.buffer),a=new Int16Array(s.buffer),n=new Int32Array(s.buffer),o=new Float32Array(s.buffer)}function h(){throw Error("Unexpected BuildingGen error.")}let u=()=>{},c={a:{a:h,f:function(i){let a=r.length,n=Math.ceil((Math.max(i>>>0,Math.ceil(1.2*a))-a)/65536);try{return s.grow(n),l(),!0}catch(i){return!1}},g:h,b:u,c:u,d:u,e:u}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,c):i.then(i=>i.arrayBuffer()).then(i=>WebAssembly.instantiate(i,c))).then(i=>{let h=i.instance.exports;return(0,h.g)(),s=h.f,l(),new cb({setStyle:h.h,setAOOptions:h.i,setMetricOptions:h.j,setStructuralOptions:h.k,setFacadeOptions:h.l,setFauxFacadeOptions:h.m,setFacadeClassifierOptions:h.n,addFeature:h.o,addFacade:h.p,generateMesh:h.q,getLastError:h.r,getOuterRingLength:h.s,getMeshCount:h.t,getPositionsPtr:h.u,getPositionsLength:h.v,getNormalsPtr:h.w,getNormalsLength:h.x,getAOPtr:h.y,getAOLength:h.z,getUVPtr:h.A,getUVLength:h.B,getFauxFacadePtr:h.C,getFauxFacadeLength:h.D,getIndicesPtr:h.E,getIndicesLength:h.F,getBuildingPart:h.G,getRingCount:h.H,getRingPtr:h.I,getRingLength:h.J,malloc:h.K,free:h.L,heapU8:r,heap16:a,heap32:n,heapF32:o})})})(fetch(tR())).then(i=>(cA=null,cI=i)).catch(i=>{t_("Could not load building-gen"),cA=null,cE=i instanceof Error?i:Error("Unknown error")})}populate(i,r,a,n){let o=cI;if(!o)return;let s=s6(a);this.tileToMeter=s,this.brightness=r.brightness,o.setStyle({normalScale:[1,-1,s],tileToMeters:s}),o.setAOOptions(!1,.3),o.setMetricOptions(!1,16),o.setStructuralOptions(!0),o.setFacadeClassifierOptions(3);let l=new Map,h=new Map,u=0;for(let{feature:r}of i){if("LineString"!==dx[r.type]){l.set(r.id,r.properties.source_id);continue}let i=this.layers[0]._featureFilter.needGeometry;if(i&&!this.layers[0]._featureFilter.filter(new nH(this.zoom),r,a))continue;let o=lt(r,i);if(!i&&!this.layers[0]._featureFilter.filter(new nH(this.zoom),o,a))continue;let s=i?o.geometry:le(r,a,n),c=[];for(let i of s)for(let r of i)c.push(r.x),c.push(r.y);let d={coordinates:c,crossPerc:r.properties.cross_perc,distanceToRoad:r.properties.distance_to_road,entrances:r.properties.entrances,sourceId:0},p=r.properties.source_id,f=h.get(p);f||(f=[],h.set(p,f)),f.push(d),++u}this.maxHeight=0;let c=[],d=new Set,p=i=>
7{null!=i&&d.add(i)},f=(i,r)=>{null!=i&&c.push({buildingId:i,footprintIndex:r})},m=64*(i.length-u),_=m/2;for(let{feature:c,id:g,index:y,sourceLayerIndex:x}of(this.buildingWithFacade.reserve(m,_,!0),this.buildingWithoutFacade.reserve(2*m,2*_,!1),this.footprintsIndices.reserve(16*(i.length-u)),this.footprintsVertices.reserve(8*(i.length-u)),i)){if("LineString"===dx[c.type])continue;let i=this.layers[0]._featureFilter.needGeometry;if(i&&!this.layers[0]._featureFilter.filter(new nH(this.zoom),c,a))continue;let u=null;if(c.properties&&c.properties.hasOwnProperty("building_id")&&(u=Number(c.properties.building_id),d.has(u)))continue;let m=lt(c,i);if(!i&&!this.layers[0]._featureFilter.filter(new nH(this.zoom),m,a))continue;let _=i?m.geometry:le(c,a,n),v=hX(_,500),b=!1;for(let i of v)if(1!==i.length){b=!0;break}if(b||!function(i){for(let r of i)for(let i of r)if(i.x<-163||i.x>8355||i.y<-163||i.y>8355)return!1;return!0}(_)){p(u);continue}let w=this.layers[0],T=function(i){switch(i){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw Error(`Unknown roof shape: ${i}`)}}(w.layout.get("building-roof-shape").evaluate(c,{},a)),S=w.layout.get("building-base").evaluate(c,{},a),I=w.layout.get("building-height").evaluate(c,{},a),E=w.layout.get("building-flood-light-ground-radius").evaluate(c,{},a),A=w.paint.get("building-ambient-occlusion-intensity"),C=E/this.tileToMeter;c.properties["building-part"]="roof";let M=w.paint.get("building-color").evaluate(c,{},this.canonical).toPremultipliedRenderColor(this.lut),P=w.paint.get("building-emissive-strength").evaluate(c,{},this.canonical);c.properties["building-part"]="wall";let D=w.paint.get("building-color").evaluate(c,{},this.canonical).toPremultipliedRenderColor(this.lut),R=w.paint.get("building-emissive-strength").evaluate(c,{},this.canonical);c.properties["building-part"]="window";let L=w.paint.get("building-color").evaluate(c,{},this.canonical).toPremultipliedRenderColor(this.lut),z=w.paint.get("building-emissive-strength").evaluate(c,{},this.canonical);c.properties["building-part"]="door";let F=w.paint.get("building-color").evaluate(c,{},this.canonical).toPremultipliedRenderColor(this.lut),O=w.paint.get("building-emissive-strength").evaluate(c,{},this.canonical),B=w.layout.get("building-flood-light-wall-radius").evaluate(c,{},a),k=(B=tr(B,0,2048))/2048*32767,V=l.get(g),N=h.get(V)||[],U=0!==N.length&&w.layout.get("building-facade").evaluate(c,{},a);o.setFacadeOptions(4,!0),o.setFauxFacadeOptions(U,!1,1);let j=0,G=0,q=0,$=0,H=0,Z=0,W=0,X=0,Y=0,K=0,J=0;if(U){let i=Math.round(w.layout.get("building-facade-floors").evaluate(c,{},a));if(0===S){i=Math.max(1,i-(N.length>0));let r=4;if(I>100){let i=[10,13,15];r=i[c.id?c.id%i.length:0]}else I<=10&&(r=3);o.setFacadeOptions(r,!0),H=(I<15?1.3:1.61803)*r/s}else H=S/s;H=Math.min(H,Z=I/s),q=w.layout.get("building-facade-unit-width").evaluate(c,{},a)/s,$=(Z-H)/i,o.setFauxFacadeOptions(!0,!0,q);let r=w.layout.get("building-facade-window").evaluate(c,{},a);j=r[0],G=r[1],W=Math.floor(65535*Math.min(1,H/8192)),X=Math.floor(65535*Math.min(1,Z/8192)),Y=Math.floor(255*j)<<8|Math.floor(255*G),K=Math.floor(65535*Math.min(1,q/8192)),J=Math.floor(65535*Math.min(1,$/8192))}let Q=Array(v.length),ee={x:1/0,y:1/0},et={x:-1/0,y:-1/0},ei={x:0,y:0},er=0;for(let i=0;i<v.length;i++){let r=v[i];if(r.length>0){let a=[],n=Array(r.length+1);n[0]=0;for(let i=0;i<r.length;i++){let o=r[i];for(let i=0;i<o.length;i++){let r=o[o.length-i-1];ee.x=Math.min(ee.x,r.x),ee.y=Math.min(ee.y,r.y),et.x=Math.max(et.x,r.x),et.y=Math.max(et.y,r.y),ei.x+=r.x,ei.y+=r.y,er++,a.push(r.x),a.push(r.y)}n[i+1]=a.length}Q[i]={id:c.id?c.id:0,height:I,minHeight:S,sourceId:0,roofType:T,coordinates:a,ringIndices:n}}}ei.x/=er||1,ei.y/=er||1;let ea=o.generateMesh(Q,N);if("string"==typeof ea){t_(`Unable to generate building ${c.id}: ${ea}`),p(u);continue}if(0===ea.meshes.length||0===ea.modifiedPolygonRings.length){p(u);continue}let en=U?this.buildingWithFacade:this.buildingWithoutFacade,eo=0;for(let i of ea.meshes)eo+=i.positions.length/3;let es=en.segmentsBucket.prepareSegment(eo,en.layoutVertexArray,en.indexArray),el=[],eh=null,eu=0,ec=-1,ed=en.layoutVertexArray.length,ep=ed+eo;en.layoutVertexArray.resize(ep),en.layoutCentroidArray.resize(ep),en.layoutNormalArray.resize(ep),en.layoutAOArray.resize(ep),en.layoutColorArray.resize(ep),en.layoutFloodLightDataArray.resize(ep),U&&(en.layoutFacadePaintArray.resize(ep),en.layoutFacadeDataArray.resize(ep),en.layoutFacadeVerticalRangeArray.resize(ep));let ef=en.indexArray.length,em=0,e_=ed;for(let i of ea.meshes){let r,a;
7if(1===i.buildingPart)r=M,a=P;else if(0===i.buildingPart)r=D,a=R;else if(2===i.buildingPart)r=L,a=z;else{if(3!==i.buildingPart)continue;r=F,a=O}if(a=tr(a,0,1),3===i.buildingPart){let r=[];for(let a=0;a<i.positions.length;a+=12){let n=i.positions[a+0],o=i.positions[a+1],s=i.positions[a+3],l=i.positions[a+4],h=i.positions[a+2],u=i.positions[a+8]-h,c=s-n,d=l-o,p=Math.hypot(c,d);r.push({pos:[n+.5*c,o+.5*d,h],normal:[d/p,-c/p,0],width:p,height:u,depth:1,points:[n,o,s,l]})}let a=en.entranceBloom.segmentsBucket.prepareSegment(10*r.length,en.entranceBloom.layoutVertexArray,en.entranceBloom.indexArray),n=en.entranceBloom.layoutVertexArray.length;eu=en.entranceBloom.indexArray.length,dh(r,.5/this.tileToMeter,en.entranceBloom.indexArray,en.entranceBloom.layoutVertexArray,en.entranceBloom.layoutAttenuationArray);let o=en.entranceBloom.layoutVertexArray.length-n;ec=en.entranceBloom.indexArray.length-eu;for(let i=0;i<o;i++)en.entranceBloom.layoutColorArray.emplaceBack(255*F.r<<8|255*F.g,255*F.b<<8|51*O);a.vertexLength+=o,a.primitiveLength+=ec,eh={part:i.buildingPart,vertexOffset:n,vertexLength:o}}en.layoutVertexArray.float32.set(i.positions,3*e_);let n=i.positions.length/3;for(let o=0;o<n;++o){let n=3*o;em=Math.max(em,i.positions[n+2]);let s=32767*i.normals[n+1],l=32767*i.normals[n+2],h=3*(e_+o);en.layoutNormalArray.int16[h]=32767*i.normals[n],en.layoutNormalArray.int16[h+1]=s,en.layoutNormalArray.int16[h+2]=l;let u=i.ao[o];en.layoutAOArray.uint8[e_+o]=255*u;let c=1+(u-1)*A,d=255*r.b*c<<8|255*a;en.layoutColorArray.uint16[2*(e_+o)]=255*r.r*c<<8|255*r.g*c,en.layoutColorArray.uint16[2*(e_+o)+1]=d}let o=Math.min(8191,Math.max(0,Math.floor(ei.x))),s=Math.min(8191,Math.max(0,Math.floor(ei.y))),l=Math.floor(I),h=4*o+Math.min(3,Math.round((et.x-ee.x)*this.tileToMeter/20)),u=4*s+Math.min(3,Math.round((et.y-ee.y)*this.tileToMeter/20));for(let i=0;i<n;++i){let r=3*(e_+i);en.layoutCentroidArray.int16[r]=h,en.layoutCentroidArray.int16[r+1]=u,en.layoutCentroidArray.int16[r+2]=l}if(en.layoutFloodLightDataArray.int16.fill(0===i.buildingPart?k:0,e_,e_+n),U){let r=255*L.r<<8|255*L.g,a=255*L.b<<8|255*z;for(let i=0;i<n;++i){let n=2*(e_+i);en.layoutFacadePaintArray.uint16[n]=r,en.layoutFacadePaintArray.uint16[n+1]=a}for(let r=0;r<n;++r)if(i.isFauxFacade[r]){let a=Math.min(65535,Math.floor(i.uv[2*r]*ea.outerRingLength));en.layoutFacadeDataArray.emplace(e_+r,1|a,Y,K,J),en.layoutFacadeVerticalRangeArray.emplace(e_+r,W,X)}else en.layoutFacadeDataArray.emplace(e_+r,0,0,0,0),en.layoutFacadeVerticalRangeArray.emplace(e_+r,0,0)}let c=es.vertexLength,d=i.indices.length/3,p=en.indexArray.length;en.indexArray.resize(p+d);for(let r=0;r<d;++r){let a=3*r,n=3*p+a;en.indexArray.uint16[n]=c+i.indices[a],en.indexArray.uint16[n+1]=c+i.indices[a+1],en.indexArray.uint16[n+2]=c+i.indices[a+2]}1!==i.buildingPart&&0!==i.buildingPart&&2!==i.buildingPart&&3!==i.buildingPart||el.push({part:i.buildingPart,vertexOffset:e_,vertexLength:i.positions.length/3}),e_+=n,es.vertexLength+=n,es.primitiveLength+=i.indices.length/3}this.maxHeight=Math.max(this.maxHeight,em);let eg=en.indexArray.length-ef,ey=this.footprintsIndices.length,ex=this.footprintsVertices.length,ev=[],eb=new e4(1/0,1/0),ew=new e4(-1/0,-1/0),eT=this.groundEffect.vertexArray.length;for(let i of ea.modifiedPolygonRings){let r=[],a=new e4(1/0,1/0),n=new e4(-1/0,-1/0);for(let o=0;o<i.length;o+=2){let s=i.length-o-2;a.x=Math.min(a.x,i[s]),a.y=Math.min(a.y,i[s+1]),n.x=Math.max(n.x,i[s]),n.y=Math.max(n.y,i[s+1]);let l=new e4(i[s],i[s+1]);r.push(l),ev.push(l.x,l.y),this.footprintsVertices.emplaceBack(l.x,l.y)}eb.x=Math.min(eb.x,a.x),eb.y=Math.min(eb.y,a.y),ew.x=Math.max(ew.x,n.x),ew.y=Math.max(ew.y,n.y),this.groundEffect.addData(r,[a,n],C)}let eS=this.groundEffect.vertexArray.length-eT;this.groundEffect.groundRadiusArray.reserveForAdditional(eS);for(let i=0;i<eS;i++)this.groundEffect.groundRadiusArray.emplaceBack(E);(ee.x<0||et.x>8192||ee.y<0||et.y>8192)&&this.featuresOnBorder.push({featureId:c.id,footprintIndex:this.footprints.length});{let i=hR(ev,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+i.length),this.footprintsIndices.uint16.set(i,ey),this.buildingIds.add(null!=u?u:c.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,eb.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,eb.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ew.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ew.y);let r={footprintVertexOffset:ex,footprintVertexLength:this.footprintsVertices.length-ex,footprintIndexOffset:ey,footprintIndexLength:this.footprintsIndices.length-ey,min:eb,max:ew,hiddenFlags:0,indicesOffset:ef,indicesLength:eg,bloomIndicesOffset:eu,bloomIndicesLength:ec,groundEffectVertexOffset:eT,groundEffectVertexLength:eS,hasFauxFacade:U,height:em,promoteId:g,feature:m,parts:el,buildingBloom:eh},a=this.footprints.length;void 0!==c.id&&this.featureFootprintLookup.set(c.id,a),f(u,a),this.footprints.push(r)}this.programConfigurations.populatePaintArrays(en.layoutVertexArray.length,c,y,{},r.availableImages,a,r.brightness),this.groundEffect.addPaintPropertiesData(c,y,{},r.availableImages,a,r.brightness),r.featureIndex.insert(c,_,y,x,this.index,ed)}c.forEach(({buildingId:i,footprintIndex:r})=>{d.has(i)&&(this.footprints[r].hiddenFlags|=4)});let g=new Set;this.buildingIds.forEach((i,r,a)=>{d.has(i)||g.add(i)}),this.buildingIds=g,this.groundEffect.prepareBorderSegments()}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l),this.groundEffect.update(i,r,o,a,n,s,l),this.evaluate(this.layers[0],i),this.colorBufferUploaded=!1}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(i){let r=r=>{r.layoutVertexBuffer=i.createVertexBuffer(r.layoutVertexArray,du.members),r.layoutNormalBuffer=i.createVertexBuffer(r.layoutNormalArray,dc.members),r.layoutCentroidBuffer=i.createVertexBuffer(r.layoutCentroidArray,dd.members),r.layoutFloodLightDataBuffer=i.createVertexBuffer(r.layoutFloodLightDataArray,dy.members),r.layoutFacadeDataArray&&r.layoutFacadeDataArray.length&&(r.layoutFacadeDataBuffer=i.createVertexBuffer(r.layoutFacadeDataArray,dm.members)),r.layoutFacadeVerticalRangeArray&&r.layoutFacadeVerticalRangeArray.length&&(r.layoutFacadeVerticalRangeBuffer=i.createVertexBuffer(r.layoutFacadeVerticalRangeArray,d_.members)),r.entranceBloom.layoutVertexArray.length&&(r.entranceBloom.layoutVertexBuffer=i.createVertexBuffer(r.entranceBloom.layoutVertexArray,du.members),r.entranceBloom.layoutAttenuationBuffer=i.createVertexBuffer(r.entranceBloom.layoutAttenuationArray,dg.members)),this.uploadUpdatedColorBuffer(i),this.uploadUpdatedIndexBuffer(i)};this.uploaded||(r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.groundEffect.upload(i)),this.groundEffect.uploadPaintProperties(i),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){let i=i=>{i.layoutVertexBuffer&&(i.layoutVertexBuffer.destroy(),i.layoutNormalBuffer.destroy(),i.layoutColorBuffer.destroy(),i.segmentsBucket.destroy(),i.indexBuffer&&i.indexBuffer.destroy(),i.entranceBloom.layoutVertexBuffer&&(i.entranceBloom.layoutVertexBuffer.destroy(),i.entranceBloom.layoutColorBuffer.destroy(),i.entranceBloom.layoutAttenuationBuffer.destroy(),i.entranceBloom.indexBuffer.destroy(),i.entranceBloom.segmentsBucket.destroy()))};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}
7updateFootprintHiddenFlags(i,r,a=!0){let n=!1,o=a?r:0,s=0|(a?-1:~r);for(let r of(0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),i)){let i=this.footprints[r],a=i.hiddenFlags&s|o;i.hiddenFlags!==a&&(i.hiddenFlags=a,n=!0,this.groundEffect.updateHiddenByLandmarkRange(i.groundEffectVertexOffset,i.groundEffectVertexLength,0!==i.hiddenFlags))}return n&&(this.indexArrayForConflationUploaded=!1),n}uploadUpdatedIndexBuffer(i){if(this.groundEffect.uploadHiddenByLandmark(i),this.indexArrayForConflationUploaded)return;let r=i=>{0!==i.indexArray.length&&(i.indexArrayForConflation.resize(i.indexArray.length),i.indexArrayForConflation.uint16.set(i.indexArray.uint16),i.entranceBloom.indexArrayForConflation.resize(i.entranceBloom.indexArray.length),i.entranceBloom.indexArrayForConflation.uint16.set(i.entranceBloom.indexArray.uint16))};for(let i of(r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.footprints)){let r=i.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,a=i.indicesOffset+i.indicesLength;if(0!==i.hiddenFlags){for(let n=i.indicesOffset;n<a;n++)r.indexArrayForConflation.uint16[3*n+0]=0,r.indexArrayForConflation.uint16[3*n+1]=0,r.indexArrayForConflation.uint16[3*n+2]=0;let n=i.bloomIndicesOffset+i.bloomIndicesLength;for(let a=i.bloomIndicesOffset;a<n;a++)r.entranceBloom.indexArrayForConflation.uint16[3*a+0]=0,r.entranceBloom.indexArrayForConflation.uint16[3*a+1]=0,r.entranceBloom.indexArrayForConflation.uint16[3*a+2]=0}}let a=r=>{0!==r.indexArray.length&&(r.indexBuffer?r.indexBuffer.updateData(r.indexArrayForConflation):r.indexBuffer=i.createIndexBuffer(r.
7indexArrayForConflation,!0),r.entranceBloom.indexBuffer?r.entranceBloom.indexBuffer.updateData(r.entranceBloom.indexArrayForConflation):r.entranceBloom.indexBuffer=i.createIndexBuffer(r.entranceBloom.indexArrayForConflation,!0))};a(this.buildingWithoutFacade),a(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(i){let r=r=>{r.layoutColorBuffer?r.layoutColorBuffer.updateData(r.layoutColorArray):r.layoutColorBuffer=i.createVertexBuffer(r.layoutColorArray,dp.members,!0),r.layoutFacadePaintArray&&(r.layoutFacadePaintBuffer?r.layoutFacadePaintBuffer.updateData(r.layoutFacadePaintArray):r.layoutFacadePaintBuffer=i.createVertexBuffer(r.layoutFacadePaintArray,df.members,!0)),r.entranceBloom.layoutColorBuffer?r.entranceBloom.layoutColorBuffer.updateData(r.entranceBloom.layoutColorArray):r.entranceBloom.layoutColorBuffer=i.createVertexBuffer(r.entranceBloom.layoutColorArray,dp.members,!0)};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(i,r){let a=i.paint.get("building-ambient-occlusion-intensity");for(let n of this.footprints){if(4&n.hiddenFlags)continue;let o=r[n.promoteId],s=n.feature;s.properties["building-part"]="roof";let l=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),h=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="wall";let u=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),c=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="window";let d=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),p=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="door";let f=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),m=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical),_=n.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(let i of n.parts){let r,o=l;1===i.part?(o=l,r=h):0===i.part?(o=u,r=c):2===i.part?(o=d,r=p):3===i.part&&(o=f,r=m),r=tr(r,0,1);for(let s=0;s<i.vertexLength;s++){let l=i.vertexOffset+s,h=1+(_.layoutAOArray.uint8[l]/255-1)*a;_.layoutColorArray.emplace(l,o.r*h*255<<8|o.g*h*255,o.b*h*255<<8|255*r),n.hasFauxFacade&&_.layoutFacadePaintArray.emplace(l,255*d.r<<8|255*d.g,255*d.b<<8|255*p)}}let g=n.buildingBloom;if(g)for(let i=0;i<g.vertexLength;i++)_.entranceBloom.layoutColorArray.emplace(g.vertexOffset+i,255*f.r<<8|255*f.g,255*f.b<<8|51*m)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(i,r,a){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let n=r.getReplacementRegionsForTile(i.toUnwrapped());if(uG(this.activeReplacements,n))return;for(let i of(this.activeReplacements=n,this.footprints))i.hiddenFlags&=-2;let o=[];for(let r of this.activeReplacements){if(r.order<a)continue;let n=Math.max(1,Math.pow(2,r.footprintTileId.canonical.z-i.canonical.z));for(let a of this.footprints)a.min.x>r.max.x||a.max.x<r.min.x||a.min.y>r.max.y||a.max.y<r.min.y||(o.length=0,function(i,r,a,n,o,s){let l=Math.pow(2,n.z-o.z);for(let h=0;h<a;h++){let a=i.float32[2*(h+r)+0],u=i.float32[2*(h+r)+1];a=(a+8192*o.x)*l-8192*n.x,u=(u+8192*o.y)*l-8192*n.y,s.push(new e4(a,u))}}(this.footprintsVertices,a.footprintVertexOffset,a.footprintVertexLength,r.footprintTileId.canonical,i.canonical,o),u$(r.footprint,o,this.footprintsIndices.uint16,a.footprintIndexOffset,a.footprintIndexLength,0,-n)&&(a.hiddenFlags|=1))}for(let i of(0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.footprints))this.groundEffect.updateHiddenByLandmarkRange(i.groundEffectVertexOffset,i.groundEffectVertexLength,0!==i.hiddenFlags);this.indexArrayForConflationUploaded=!1}getFootprint(i){if(void 0!==i.id){let r=this.featureFootprintLookup.get(i.id);return this.footprints[r]}return null}getHeightAtTileCoord(i,r){let a=-1/0,n=!0,o=4*(i+8192)*8192+(r+8192);if(this.footprintLookup.hasOwnProperty(o)){let i=this.footprintLookup[o];return i?{height:i.height,hidden:0!==i.hiddenFlags}:void 0}let s=new e4(i,r);for(let l of this.footprints)i>l.max.x||l.min.x>i||r>l.max.y||l.min.y>r||l.height<=a||function(i,r,a){for(let n=0;n<a.length;n+=3){let o=a[n],s=a[n+1],l=a[n+2],h=r[2*o+0],u=r[2*o+1],c=r[2*s+0],d=r[2*s+1],p=r[2*l+0],f=r[2*l+1],m=(h-p)*(i.y-f)-(u-f)*(i.x-p),_=(c-h)*(i.y-u)-(d-u)*(i.x-h);if(m<0!=_<0&&0!==m&&0!==_)continue;
7let g=(p-c)*(i.y-d)-(f-d)*(i.x-c);if(0===g||g<0==m+_<=0)return!0}return!1}(s,this.footprintsVertices.float32.subarray(2*l.footprintVertexOffset,2*(l.footprintVertexOffset+l.footprintVertexLength)),this.footprintsIndices.uint16.subarray(l.footprintIndexOffset,l.footprintIndexOffset+l.footprintIndexLength))&&(a=l.height,this.footprintLookup[o]=l,n=0!==l.hiddenFlags);if(a!==-1/0)return{height:a,hidden:n};this.footprintLookup[o]=void 0}}ne(dw,"BuildingBucket",{omit:["layers"]}),ne(db,"BuildingGeometry"),ne(dv,"BuildingBloomGeometry");let dT=oy([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),dS=oy([{name:"a_z_offset_width",components:3,type:"Float32"}],4),dI=oy([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:dE}=dT,{members:dA}=oy([{name:"a_packed",components:3,type:"Float32"}]),{members:dC}=oy([{name:"a_pattern_data",components:3,type:"Float32"}]);class dM{constructor(i,r){this.width=i,this.height=r,this.nextRow=0,this.image=new hS({width:i,height:r}),this.positions={},this.uploaded=!1}getDash(i,r){let a=this.getKey(i,r);return this.positions[a]}trim(){let i=this.width,r=this.height=th(this.nextRow);this.image.resize({width:i,height:r})}getKey(i,r){return i.join(",")+r}getDashRanges(i,r,a){let n=[],o=i.length%2==1?-i[i.length-1]*a:0,s=i[0]*a,l=!0;n.push({left:o,right:s,isDash:l,zeroLength:0===i[0]});let h=i[0];for(let r=1;r<i.length;r++){l=!l;let u=i[r];o=h*a,h+=u,s=h*a,n.push({left:o,right:s,isDash:l,zeroLength:0===u})}return n}addRoundDash(i,r,a){let n=r/2;for(let r=-a;r<=a;r++){let o=this.width*(this.nextRow+a+r),s=0,l=i[0];for(let h=0;h<this.width;h++){let u;h/l.right>1&&(l=i[++s]);let c=Math.min(Math.abs(h-l.left),Math.abs(h-l.right)),d=r/a*(n+1);if(l.isDash){let i=n-Math.abs(d);u=Math.sqrt(c*c+i*i)}else u=n-Math.sqrt(c*c+d*d);this.image.data[o+h]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(i,r){for(let r=i.length-1;r>=0;--r){let a=i[r],n=i[r+1];a.zeroLength?i.splice(r,1):n&&n.isDash===a.isDash&&(n.left=a.left,i.splice(r,1))}let a=i[0],n=i[i.length-1];a.isDash===n.isDash&&(a.left=n.left-this.width,n.right=a.right+this.width);let o=this.width*this.nextRow,s=0,l=i[0];for(let a=0;a<this.width;a++){a/l.right>1&&(l=i[++s]);let n=Math.min(Math.abs(a-l.left),Math.abs(a-l.right));this.image.data[o+a]=Math.max(0,Math.min(255,(l.isDash?n:-n)+r+128))}}addDash(i,r){let a=this.getKey(i,r);if(this.positions[a])return this.positions[a];let n="round"===r,o=7*!!n,s=2*o+1;if(this.nextRow+s>this.height)return t_("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let r=0;r<i.length;r++)i[r]<0&&(t_("Negative value is found in line dasharray, replacing values with 0"),i[r]=0),l+=i[r];if(0!==l){let a=this.width/l,s=this.getDashRanges(i,this.width,a);n?this.addRoundDash(s,a,o):this.addRegularDash(s,"square"===r?.5*a:0)}let h=this.nextRow+o;this.nextRow+=s;let u=Math.floor(l),c={tl:[h,o],br:[u,Math.round(65535*(l-u))]};return this.positions[a]=c,c}}ne(dM,"LineAtlas");let dP=li.types,dD=Math.cos(Math.PI/180*37.5),dR=Math.cos(Math.PI/180*5);class dL{constructor(i){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.zoom=i.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=i.overscaling,this.pixelRatio=i.pixelRatio,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.projection=i.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new oC,this.layoutVertexArray2=new oM,this.patternVertexArray=new oM,this.indexArray=new oj,this.programConfigurations=new sk(i.layers,{zoom:i.zoom,lut:i.lut}),this.segments=new sh,this.maxLineLength=0,this.zOffsetVertexArray=new oM,this.elevationGroundScaleVertexArray=new oT,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=i.tessellationStep?i.tessellationStep:128,this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.hasPattern=hJ("line",this.layers,this.pixelRatio,r);let o=this.layers[0].layout.get("line-sort-key");this.tileToMeter=s6(a);let s=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===s)this.elevationType="road";else{let i=this.layers[0].layout.get("line-z-offset"),r=i.isConstant()&&!i.constantOr(0);this.elevationType="sea"!==s&&"ground"!==s&&r?"none":"offset","offset"===this.elevationType&&"none"===s&&t_(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference="sea"===s}let l=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==l;let h=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of i){let i=this.layers[0]._featureFilter.needGeometry,d=lt(s,i);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let p=o?o.evaluate(d,{},a):void 0,f={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:i?d.geometry:le(s,a,n),patterns:{},sortKey:p};h.push(f)}o&&h.sort((i,r)=>i.sortKey-r.sortKey);let{lineAtlas:u,featureIndex:c}=r,d=this.addConstantDashes(u);for(let n of h){let{geometry:o,index:s,sourceLayerIndex:l}=n;if(d&&this.addFeatureDashes(n,u),this.hasPattern){let i=hQ("line",this.layers,n,this.zoom,this.pixelRatio,r);this.patternFeatures.push(i)}else this.addFeature(n,o,s,a,u.positions,r.availableImages,r.brightness,r.elevationFeatures);c.insert(i[s].feature,o,s,l,this.index)}}addConstantDashes(i){let r=!1;for(let a of this.layers){let n=a.paint.get("line-dasharray").value,o=a.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==o.kind)r=!0;else{let r=o.value,a=n.value;if(!a)continue;i.addDash(a,r)}}return r}addFeatureDashes(i,r){let a=this.zoom;for(let n of this.layers){let o,s,l=n.paint.get("line-dasharray").value,h=n.layout.get("line-cap").value;if("constant"!==l.kind||"constant"!==h.kind){if("constant"===l.kind){if(!(o=l.value))continue}else o=l.evaluate({zoom:a},i);s="constant"===h.kind?h.value:h.evaluate({zoom:a},i),r.addDash(o,s),i.patterns[n.id]=[r.getKey(o,s)]}}}update(i,r,a,n,o,s,l,h,u){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,u)}addFeatures(i,r,a,n,o,s){for(let o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a,n,s,i.elevationFeatures)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,dA)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=i.createVertexBuffer(this.patternVertexArray,dC)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=i.createVertexBuffer(this.zOffsetVertexArray,dS.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=i.createVertexBuffer(this.elevationGroundScaleVertexArray,dI.members,!0)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,dE),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i,r){let a,n;if(r&&r>0?(a=`mapbox_clip_start_${r}`,n=`mapbox_clip_end_${r}`):(a="mapbox_clip_start",n="mapbox_clip_end"),i.properties&&i.properties.hasOwnProperty(a)&&i.properties.hasOwnProperty(n))return{start:+i.properties[a],end:+i.properties[n]}}addFeature(i,r,a,n,o,s,l,h){let u=this.layers[0].layout,c=u.get("line-join").evaluate(i,{}),d=u.get("line-cap").evaluate(i,{}),p=u.get("line-miter-limit"),f=u.get("line-round-limit");this.lineClips=this.lineFeatureClips(i),this.lineFeature=i;let m=!(!i.properties||!i.properties.hasOwnProperty("mapbox_line_metrics"))&&i.properties.mapbox_line_metrics;this.zOffsetValue=u.get("line-z-offset").value;let _=this.layers[0].paint.get("line-width").value;if("constant"!==_.kind&&!1===_.isLineProgressConstant&&(this.variableWidthValue=_),this.isSeaLevelReference){let i=u.get("line-elevation-ground-scale").value;"constant"===i.kind&&0===i.value||(this.elevationGroundScaleValue=i)}if("road"===this.elevationType){let a=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(i,r,n,h,c,d,p,f)){let[o,s]=this.clipRuntimeLinesToTile(r,1);for(let r=0;r<o.length;r++){let a=o[r],l=s[r],h={progress:{min:l.progress.min,max:l.progress.max},nextDir:this.computeSegNextDir(l,a),prevDir:this.computeSegPrevDir(l,a)};this.addLine(a,i,n,c,d,p,f,h,m&&l.parentIndex>0?l.parentIndex:null)}this.fillNonElevatedRoadSegment(a)}}else for(let a=0;a<r.length;a++)this.addLine(r[a],i,n,c,d,p,f,void 0,m&&a>0?a:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,o,s,n,l,void 0,this.worldview)}computeSegNextDir(i,r){return i.nextPoint.sub(r.at(-2)).unit()}computeSegPrevDir(i,r){return r[1].sub(i.prevPoint).unit()}clipLinesToTile(i,r){return cf(i,-r,-r,8192+r,8192+r)}clipRuntimeLinesToTile(i,r){let a=[];return[cf(i,-r,-r,8192+r,8192+r,a),a]}addElevatedRoadFeature(i,r,a,n,o,s,l,h){let u=[],c=lE.getElevationFeature(i,n);if(c){let i=this.clipLinesToTile(r,1);for(let r of this.prepareElevatedLines(i,c,a))u.push({geometry:r,elevation:c,elevationTileID:a,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(0===u.length)return!1;for(let r of u){let n=this.layoutVertexArray.length;this.addLine(r.geometry,i,a,o,s,l,h);let u=new lA(a,r.elevationTileID);if(r.elevation)for(let i=n;i<this.layoutVertexArray.length;i++){let a=new e4(this.layoutVertexArray.int16[6*i]>>1,this.layoutVertexArray.int16[6*i+1]>>1),n=u.pointElevation(a,r.elevation,.05);this.updateHeightRange(n),this.zOffsetVertexArray.emplaceBack(n,0,0)}else this.fillNonElevatedRoadSegment(n)}return!0}prepareElevatedLines(i,r,a){if(null!=r.constantHeight)return i;let n=[],o=1/s6(a);for(let a of i)!function(i,r,a){if(i.length<2)return a.push(i);let n=[];for(;r.valid();){let[a,o]=r.get();for(let r=0;r<i.length-1;r++){let s=i[r],l=i[r+1],h=function(i,r,a,n){let o=lR(i,r,n),s=lR(i,r,a);
7if(Math.sign(o)===Math.sign(s))return;let l=lR(a,n,i),h=l+s-o;return Math.sign(l)!==Math.sign(h)?[l/(l-h),s/(s-o)]:void 0}(s,l,a,o);if(h){let[i]=h,a=new e4(iv(s.x,l.x,i),iv(s.y,l.y,i));n.push({t:r+i,distance:0,point:a})}}r.next()}if(0===n.length)return a.push(i);n.sort((i,r)=>i.t-r.t);let o=0,s=0,l=[];for(a.push(l);o!==i.length;){if(s===n.length){for(;o!==i.length;)0!==l.length&&l[l.length-1].equals(i[o])||l.push(i[o]),o++;break}n[s].t<=o?(0!==l.length&&l[l.length-1].equals(n[s].point)||l.push(n[s].point),n[s].t,s++):(0!==l.length&&l[l.length-1].equals(i[o])||l.push(i[o]),o++)}}(a,new lS(r,o),n);return n}fillNonElevatedRoadSegment(i){for(let r=i;r<this.layoutVertexArray.length;r++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(i){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,i),this.heightRange.max=Math.max(this.heightRange.max,i)):this.heightRange={min:i,max:i}}addLine(i,r,a,n,o,s,l,h,u){let c,d,p,f,m,_,g,y;this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=u?this.lineFeatureClips(r,u):this.lineClips;let x="none"===n;this.patternJoinNone=this.hasPattern&&x,this.currentLineJoinType=n,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];let v=h&&h.progress.min>0,b=h&&h.progress.max<1;if(this.lineClips){let a={min:this.lineClips.start,max:this.lineClips.end},n=1;if(h){var w,T,S;let i=this.lineClips.end-this.lineClips.start;w=h.progress,T={min:0,max:1},S=a,a={min:tC(w.min,T,S),max:tC(w.max,T,S)},i>0&&(n=(a.max-a.min)/i)}let o=+r.properties.mapbox_clip_feature_len,s=+r.properties.mapbox_clip_seg_len;if(Number.isNaN(o)||Number.isNaN(s)){for(let r=0;r<i.length-1;r++)this.totalDistance+=i[r].dist(i[r+1]);let r=this.totalDistance/(a.max-a.min);this.totalFeatureLength=Number.isFinite(r)?r:0,this.lineClips.start=a.min,this.lineClips.end=a.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=o,this.distance=s*n,this.lineClips.start=a.min,this.lineClips.end=a.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}let I="Polygon"===dP[r.type],E=i.length;for(;E>=2&&i[E-1].equals(i[E-2]);)E--;let A=0;for(;A<E-1&&i[A].equals(i[A+1]);)A++;if(E<(I?3:2))return;"bevel"===n&&(s=1.05);let C=this.segments.prepareSegment(10*E,this.layoutVertexArray,this.indexArray);h&&h.prevDir&&(_=h.prevDir.perp()),h&&h.nextDir&&(g=h.nextDir.perp()),this.e1=this.e2=-1,I&&(c=i[E-2],m=i[A].sub(c)._unit()._perp());for(let r=A;r<E;r++){if((p=r===E-1?I?i[A+1]:void 0:i[r+1])&&i[r].equals(p))continue;m&&(f=m),c&&(d=c),c=i[r],y=this.evaluateLineProgressFeatures(d?d.dist(c):0),m=p?p.sub(c)._unit()._perp():f,f=f||m;let a=d&&p,h=a?n:I||x?"butt":o,u=f.x*m.x+f.y*m.y;if(x){let i=function(i){if(i.patternJoinNone){let r=i.segmentPoints.length/2,a=i.lineSoFar-i.segmentStart;for(let n=0;n<r;++n){let r=i.segmentPoints[2*n+1],o=Math.round(i.segmentPoints[2*n])+.5+.25*r;i.patternVertexArray.emplaceBack(o,a,i.segmentStart),i.patternVertexArray.emplaceBack(o,a,i.segmentStart)}i.segmentPoints.length=0}i.e1=i.e2=-1};if(a&&u<dR){this.updateDistance(d,c),this.addCurrentVertex(c,f,1,1,C,y),i(this),this.addCurrentVertex(c,m,-1,-1,C,y);continue}if(d){if(!p){this.updateDistance(d,c),this.addCurrentVertex(c,f,1,1,C,y),i(this);continue}h="miter"}}let w=f.add(m);0===w.x&&0===w.y||w._unit();let T=w.x*m.x+w.y*m.y,S=0!==T?1/T:1/0,M=2*Math.sqrt(2-2*T),P=T<dD&&d&&p,D=f.x*m.y-f.y*m.x>0,R=this.overscaling<=16?122880/(512*this.overscaling):0;if(a&&"round"===h){if(S<l)h="miter";else if(S<=2){let i=dz(c,-10,8202);h="offset"===this.elevationType&&(i||this.hasCrossSlope)?"miter":"fakeround"}}if("miter"===h&&S>s&&(h="bevel"),"bevel"===h&&(S>2&&(h="flipbevel"),S<s&&(h="miter")),d&&!("miter"===h&&P)&&this.updateDistance(d,c),"miter"
7===h)if(P){let i=c.dist(d);if(i>2*R){let r=c.sub(c.sub(d)._mult(R/i)._round());this.updateDistance(d,r),this.addCurrentVertex(r,f,0,0,C,y),d=r}this.updateDistance(d,c),w._mult(S),this.addCurrentVertex(c,w,0,0,C,y);let r=c.dist(p);if(r>2*R){let i=c.add(p.sub(c)._mult(R/r)._round());this.updateDistance(c,i),this.addCurrentVertex(i,m,0,0,C,y),c=i}}else w._mult(S),this.addCurrentVertex(c,w,0,0,C,y);else if("flipbevel"===h){if(S>100)w=m.mult(-1);else{let i=S*f.add(m).mag()/f.sub(m).mag();w._perp()._mult(i*(D?-1:1))}this.addCurrentVertex(c,w,0,0,C,y),this.addCurrentVertex(c,w.mult(-1),0,0,C,y)}else if("bevel"===h||"fakeround"===h){let i=c.dist(d),r=1;if("offset"===this.elevationType&&"bevel"===h&&"round"!==this.currentLineJoinType&&!this.patternJoinNone&&null!=y&&d&&p){let a=4*R;i<a&&(r=Math.max(0,i/a))}null!=y&&d&&this.addCurrentVertex(c,g||f,-r,-r,C,y);let a=i<=2*R&&"bevel"!==h,n=w.mult(D?1:-1);n._mult(S);let o=m.mult(D?-1:1),s=f.mult(D?-1:1),l=this.evaluateLineProgressFeatures(this.distance);if(null==y&&(this.addHalfVertex(c,n.x,n.y,!1,!D,0,C,l),a||this.addHalfVertex(c,n.x+2*s.x,n.y+2*s.y,!1,D,0,C,l)),"fakeround"===h){let i=Math.round(180*M/Math.PI/20);this.addHalfVertex(c,s.x,s.y,!1,D,0,C,l);for(let r=0;r<i;r++){let a=r/i;if(.5!==a){let i=a-.5;a+=a*i*(a-1)*((1.0904+u*(u*(3.55645-1.43519*u)-3.2452))*i*i+(.848013+u*(.215638*u-1.06021)))}let n=o.sub(s)._mult(a)._add(s)._unit();this.addHalfVertex(c,n.x,n.y,!1,D,0,C,l)}this.addHalfVertex(c,o.x,o.y,!1,D,0,C,l)}a||null!=y||this.addHalfVertex(c,n.x+2*o.x,n.y+2*o.y,!1,D,0,C,l),null!=y&&p&&this.addCurrentVertex(c,_||m,r,r,C,y)}else if("butt"===h)this.addCurrentVertex(c,w,0,0,C,y);else if("square"===h){if(!d){let i=v?0:-1;this.addCurrentVertex(c,w,i,i,C,y)}if(this.addCurrentVertex(c,w,0,0,C,y),d){let i=+!b;this.addCurrentVertex(c,w,i,i,C,y)}}else if("round"===h){if(d){let i=!a&&g?g:f;this.addCurrentVertex(c,i,0,0,C,y),!a&&b||this.addCurrentVertex(c,i,1,1,C,y,!0)}if(p){let i=!a&&_?_:m;!a&&v||this.addCurrentVertex(c,i,-1,-1,C,y,!0),this.addCurrentVertex(c,i,0,0,C,y)}}}}addVerticesTo(i,r,a,n,o,s,l,h,u,c){let d=(r.w-i.w)/this.tessellationStep|0,p=0,f=this.scaledDistance;if(d>1){this.lineSoFar=i.w;let a=(r.x-i.x)/d,n=(r.y-i.y)/d,o=(r.z-i.z)/d,s=(r.w-i.w)/d,l=r.x-i.x,h=r.y-i.y,f=Math.sqrt(l*l+h*h);if(0===f)return;let m=-h/f,_=l/f,g=-m,y=-_;for(let r=1;r<d;++r){i.x+=a,i.y+=n,i.z+=o,this.lineSoFar+=s,p+=s;let r=this.evaluateLineProgressFeatures(this.prevDistance+p);this.scaledDistance=(this.prevDistance+p)/this.totalDistance,this.addHalfVertex(i,m,_,c,!1,0,u,r),this.addHalfVertex(i,g,y,c,!0,0,u,r)}}this.lineSoFar=r.w,this.scaledDistance=f;let m=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(r,a,n,c,!1,l,u,m),this.addHalfVertex(r,o,s,c,!0,-h,u,m)}evaluateLineProgressFeatures(i){if(!this.variableWidthValue&&"offset"!==this.elevationType)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+i)/this.totalFeatureLength):t_(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let r=0;this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(r=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);let a=this.evaluateElevationGroundScale();return"offset"!==this.elevationType?{zOffset:0,variableWidth:r,elevationGroundScale:a}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:r,elevationGroundScale:a}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:r,elevationGroundScale:a}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?"constant"===this.elevationGroundScaleValue.kind?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(i,r,a,n,o,s,l=!1){let h=r.x+r.y*a,u=r.y-r.x*a,c=r.y*n-r.x,d=-r.y-r.x*n;if(null!=s){let r="offset"===this.elevationType,p="offset"===this.elevationType?2:10,f=-p,m=8192+p,_=s.zOffset,g=new cc(i.x,i.y,_,this.lineS
7oFar),y=!!r&&dz(i,f,m),x=this.lineSoFar,v=this.distance;if(this.currentVertex)if(y){let r=this.currentVertexIsOutside,s=this.currentVertex,p=new cc(i.x,i.y,_,this.lineSoFar);if(cp(s,p,f,m),!dz(p,f,m)){if(r){this.e1=this.e2=-1,this.distance-=s.dist(g),this.lineSoFar=s.w;let i=this.evaluateLineProgressFeatures(s.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(s,h,u,l,!1,a,o,i),this.addHalfVertex(s,c,d,l,!0,-n,o,i),this.prevDistance=this.distance}this.distance=this.prevDistance+s.dist(p),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(s,p,h,u,c,d,a,n,o,l),this.distance=v,this.scaledDistance=this.distance/this.totalDistance}}else{let i=this.currentVertex;if(this.currentVertexIsOutside){cp(i,g,f,m),this.e1=this.e2=-1,this.distance-=i.dist(g),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i.w;let r=this.evaluateLineProgressFeatures(i.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(i,h,u,l,!1,a,o,r),this.addHalfVertex(i,c,d,l,!0,-n,o,r),this.prevDistance=this.distance,this.distance=v,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(i,g,h,u,c,d,a,n,o,l)}else y||(this.addHalfVertex(i,h,u,l,!1,a,o,s),this.addHalfVertex(i,c,d,l,!0,-n,o,s));this.currentVertex=g,this.currentVertexIsOutside=y,this.lineSoFar=x}else this.addHalfVertex(i,h,u,l,!1,a,o,s),this.addHalfVertex(i,c,d,l,!0,-n,o,s)}addHalfVertex({x:i,y:r},a,n,o,s,l,h,u){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),s||this.segmentPoints.push(this.lineSoFar-this.segmentStart,l)),this.layoutVertexArray.emplaceBack((i<<1)+ +!!o,(r<<1)+ +!!s,Math.round(63*a)+128,Math.round(63*n)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){let i=iv(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,i)}let c=h.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),h.primitiveLength++),s?this.e2=c:this.e1=c,null!=u&&this.zOffsetVertexArray.emplaceBack(u.zOffset,u.variableWidth,u.variableWidth),this.elevationGroundScaleValue){let i=u?u.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(i)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(i,r){this.prevDistance=this.distance,this.distance+=i.dist(r),this.updateScaledDistance()}}function dz(i,r,a){return i.x<r||i.x>a||i.y<r||i.y>a}function dF(i,r,a){return r*(8192/(i.tileSize*Math.pow(2,a-i.tileID.overscaledZ)))}ne(dL,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let dO=(i,r,a)=>(1-a)*i+a*r;function dB(i,r){return 1/dF(i,1,r.tileZoom)}function dk(i,r,a,n){return i.translatePosMatrix(n||r.tileID.projMatrix,r,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}let dV=i=>{let r=[];dN(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT"),"multiply"===i.paint.get("line-blend-mode")&&r.push("LINE_BLEND_MULTIPLY");let a=i.paint.get("line-trim-offset");0===a[0]&&0===a[1]||r.push("RENDER_LINE_TRIM_OFFSET"),0!==i.paint.get("line-border-width").constantOr(1)&&r.push("RENDER_LINE_BORDER");let n="none"===i.layout.get("line-join").constantOr("miter"),o=!!i.paint.get("line-pattern").constantOr(1);return n&&o&&r.push("LINE_JOIN_NONE"),r};function dN(i){let r=i.paint.get("line-dasharray").value;return"constant"!==r.kind||r.value}let dU=()=>P||(P={layout:C||(C=new n5({"line-cap":new n2(n4.layout_line["line-cap"]),"line-join":new n2(n4.layout_line["line-join"]),"line-miter-limit":new n1(n4.layout_line["line-miter-limit"]),"line-round-limit":new n1(n4.layout_line["line-round-limit"]),"line-sort-key":new n2(n4.layout_line["line-sort-key"]),"line-z-offset":new n2(n4.layout_line["line-z-offset"]),"line-elevation-reference":new n1(n4.layout_line["line-elevation-reference"]),"line-cross-slope":new n1(n4.layout_line["line-cross-slope"]),visibility:new n1(n4.layout_line.visibility),"line-width-unit":new n1(n4.layout_line["line-width-unit"]),"line-elevation-ground-scale":new n2(n4.layout_line["line-elevation-ground-scale"])})),paint:M||(M=new n5({"line-opacity":new n2(n4.paint_line["line-opacity"]),"line-color":new n2(n4.paint_line["line-color"]),"line-translate":new n1(n4.paint_line["line-translate"]),"line-translate-anchor":new n1(n4.paint_line["line-translate-anchor"]),"line-width":new n2(n4.paint_line["line-width"]),"line-gap-width":new n2(n4.paint_line["line-gap-width"]),"line-offset":new n2(n4.paint_line["line-offset"]),"line-blur"
7:new n2(n4.paint_line["line-blur"]),"line-dasharray":new n2(n4.paint_line["line-dasharray"]),"line-pattern":new n2(n4.paint_line["line-pattern"]),"line-pattern-cross-fade":new n1(n4.paint_line["line-pattern-cross-fade"]),"line-gradient":new n3(n4.paint_line["line-gradient"]),"line-trim-offset":new n1(n4.paint_line["line-trim-offset"]),"line-trim-fade-range":new n1(n4.paint_line["line-trim-fade-range"]),"line-trim-color":new n1(n4.paint_line["line-trim-color"]),"line-emissive-strength":new n2(n4.paint_line["line-emissive-strength"]),"line-border-width":new n2(n4.paint_line["line-border-width"]),"line-border-color":new n2(n4.paint_line["line-border-color"]),"line-occlusion-opacity":new n1(n4.paint_line["line-occlusion-opacity"]),"line-blend-mode":new n1(n4.paint_line["line-blend-mode"]),"line-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))});class dj extends n2{possiblyEvaluate(i,r){return r=new nH(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,transition:r.transition,worldview:r.worldview}),super.possiblyEvaluate(i,r)}evaluate(i,r,a,n){return r=Object.assign({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,a,n)}}let dG=oy([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),dq=oy([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),d$=oy([{name:"a_projected_pos",components:4,type:"Float32"}],4);oy([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let dH=oy([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),dZ=oy([{name:"a_feature_index",components:1,type:"Float32"}],4),dW=oy([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),dX=oy([{name:"a_texb",components:2,type:"Uint16"}]),dY=oy([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),dK=oy([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);oy([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let dJ=oy([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),dQ=oy([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);oy([{name:"triangle",components:3,type:"Uint16"}]),oy([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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:"Uint8",name:"flipState"}]),oy([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
7]),oy([{type:"Float32",name:"offsetX"}]),oy([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);let d0=class i{constructor(r=null,a=0,n=4096){this.batchIndex=a,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=r||null,this.propsDwords=n,this.totalBytes=4*this.propsDwords,this.headerData=new Uint32Array(i.HEADER_DWORDS),this.propertiesData=new Float32Array(this.propsDwords),this.blockIndicesData=new Uint32Array(this.propsDwords);for(let i=0;i<this.propsDwords;i++)this.blockIndicesData[i]=i;r&&this._initBuffers(r)}_initBuffers(r){let a=r.gl;if(this.totalBytes>r.maxUniformBlockSize)throw Error(`UBO size ${this.totalBytes} exceeds device limit ${r.maxUniformBlockSize}`);if(this.headerBuffer=a.createBuffer(),!this.headerBuffer)throw Error("Failed to create header UBO buffer");if(a.bindBuffer(a.UNIFORM_BUFFER,this.headerBuffer),a.bufferData(a.UNIFORM_BUFFER,i.HEADER_BYTES,a.DYNAMIC_DRAW),this.propertiesBuffer=a.createBuffer(),!this.propertiesBuffer)throw Error("Failed to create properties UBO buffer");if(a.bindBuffer(a.UNIFORM_BUFFER,this.propertiesBuffer),a.bufferData(a.UNIFORM_BUFFER,this.totalBytes,a.DYNAMIC_DRAW),this.blockIndicesBuffer=a.createBuffer(),!this.blockIndicesBuffer)throw Error("Failed to create block-indices UBO buffer");a.bindBuffer(a.UNIFORM_BUFFER,this.blockIndicesBuffer),a.bufferData(a.UNIFORM_BUFFER,this.totalBytes,a.DYNAMIC_DRAW),a.bindBuffer(a.UNIFORM_BUFFER,null)}writeHeader(i){let r=this.headerData;r[0]=i.dataDrivenMask,r[1]=i.zoomDependentMask,r[2]=i.dataDrivenBlockSizeVec4,r[3]=i.offsets[0],r[4]=i.offsets[1],r[5]=i.offsets[2],r[6]=i.offsets[3],r[7]=i.offsets[4],r[8]=i.offsets[5],r[9]=i.offsets[6],r[10]=i.offsets[7],r[11]=i.offsets[8]}writeDataDrivenBlock(i,r,a){let n=4*a.dataDrivenBlockSizeVec4;if(0===n)return;let o=r*n;if(o+n>this.propertiesData.length)throw Error(`UBO write out of bounds: feature index ${r} exceeds propertiesData capacity`);for(let r=0;r<9;r++)a.dataDrivenMask&1<<r&&null!=i[r]&&this._writeProperty(o+a.offsets[r],r,i[r],a.zoomDependentMask)}static getMaxFeatureCount(r,a=4096-i.HEADER_DWORDS){let n=4*r.dataDrivenBlockSizeVec4;return 0===n?1/0:Math.floor(a/n)}_writeProperty(i,r,a,n){let o=this.propertiesData,s=8===r,l=!!(n&1<<r);r<2||s&&l?(o[i]=a[0],o[i+1]=a[1],o[i+2]=a[2],o[i+3]=a[3]):s||l?(o[i]=a[0],o[i+1]=a[1]):o[i]=a}upload(i){this.context||(this.context=i);let r=i.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(i),r.bindBuffer(r.UNIFORM_BUFFER,this.headerBuffer),r.bufferSubData(r.UNIFORM_BUFFER,0,this.headerData),r.bindBuffer(r.UNIFORM_BUFFER,this.propertiesBuffer),r.bufferSubData(r.UNIFORM_BUFFER,0,this.propertiesData),r.bindBuffer(r.UNIFORM_BUFFER,this.blockIndicesBuffer),r.bufferSubData(r.UNIFORM_BUFFER,0,this.blockIndicesData),r.bindBuffer(r.UNIFORM_BUFFER,null)}bind(i,r){let a=i.gl,n=(i,n,o)=>{if(!n)return;let s=a.getUniformBlockIndex(r,i);s!==a.INVALID_INDEX&&(a.uniformBlockBinding(r,s,o),a.bindBufferBase(a.UNIFORM_BUFFER,o,n))},o=3*this.batchIndex;n("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,o),n("SymbolPaintPropertiesUniform",this.propertiesBuffer,o+1),n("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,o+2)}destroy(){if(this.context){let i=this.context.gl;this.headerBuffer&&(i.deleteBuffer(this.headerBuffer),this.headerBuffer=null),this.propertiesBuffer&&(i.deleteBuffer(this.propertiesBuffer),this.propertiesBuffer=null),this.blockIndicesBuffer&&(i.deleteBuffer(this.blockIndicesBuffer),this.blockIndicesBuffer=null)}}};function d1(i,r,a,n){return[su(255*i,255*r),su(255*a,255*n)]}function d2(i,r,a,n,o,s,l,h){return!!i&&("constant"===i.kind?"none"===i.value:"composite"===i.kind||"source"===i.kind?"none"===i.evaluate({zoom:0,brightness:s,worldview:h},r,a,o,n,l):"string"==typeof i&&"none"===i)}d0.HEADER_DWORDS=12,d0.HEADER_BYTES=48,ne(d0,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});class d3{constructor(i,r,a,n,o="",s,l){this.layer=i,this.zoom=r,this.lut=a,this.isText=n,this.propDefs=this._getPropDefs(),this.worldview=o,this.maxUniformBufferBindings=s||24,this.uboSizeDwords=l||4096,this.featureVertexRangesFromId=new Map,this.allFeatures=[],this.ubos=[],this.featureCount=0,this.cachedHeader=null,this.maxFeaturesPerBatch=0,this.propertyHashToUBOIndex=new Map,this.canDeduplicate=this._checkIfAllPropertiesAreConstant(i,n),this.cachedParams=null,this.cachedParamsNext=null,this.cachedBrightness=void 0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.activeAppearanceByVtIndex=new Map}_getPropDefs(){let i=this.isText?"text":"icon";return[{name:`${i}-color`,useThemeName:`${i}-color-use-theme`,isColor:!0},{name:`${i}-halo-color`,useThemeName:`${i}-halo-color-use-theme`,isColor:!0},{name:`${i}-opacity`,useThemeName:null,isColor:!1},{name:`${i}-halo-width`,useThemeName:null,isColor:!1},{name:`${i}-halo-blur`,useThemeName:null,isColor:!1},{name:`${i}-emissive-strength`,useThemeName:null,isColor:!1},{name:`${i}-occlusion-opacity`,useThemeName:null,isColor:!1},{name:"symbol-z-offset",useThemeName:null,isColor:!1},{name:`${i}-translate`,useThemeName:null,isColor:!1,isVec2:!0}]}buildHeader(){let i=this.layer.paint,r=this.propDefs,a=0,n=0,o=0,s=0,l=[0,0,0,0,0,0,0,0,0];for(let h=0;h<9;h++){let{name:u,isColor:c,isVec2:d}=r[h],p=i.get(u),f=!(!p||"function"!=typeof p.isConstant||p.isConstant()),m=this._appearancesHavePaintProperties(u),_=f||m,g=!(!p||!p.value||"composite"!==p.value.kind),y=this.layer._transitionablePaint._values[u],x=!_&&"camera"===(y&&y.value&&y.value.expression&&y.value.expression.kind);_?(a|=1<<h,g&&(n|=1<<h),c?(s%4!=0&&(s=s+3&-4),l[h]=s,s+=4):d?g?(s%4!=0&&(s=s+3&-4),l[h]=s,s+=4):(s%4==3&&s++,l[h]=s,s+=2):(l[h]=s,s+=g?2:1)):x&&(o|=1<<h)}return{dataDrivenMask:a,zoomDependentMask:n,cameraMask:o,dataDrivenBlockSizeVec4:(0===s?0:s+3&-4)/4,offsets:l}}get hasCameraExpression(){return!(!this.cachedHeader||!this.cachedHeader.cameraMask)}evaluateAllProperties(i,r,a,n,o,s,l){let{params:h,paramsNext:u}=this._getCachedParams(o),c={feature:i,featureState:r,canonical:a,availableImages:n,params:h,paramsNext:u,formattedSection:s},d=this.cachedHeader,p=this.propDefs,f=Array(9).fill(null);for(let i=0;i<9;i++){let{name:r,useThemeName:a,isColor:n,isVec2:s}=p[i],h=!!(d&&d.zoomDependentMask&1<<i);f[i]=n?this._evaluateColorValue(r,a,c,o,h,l):s?this._evaluateTranslateValue(r,h,c,l):this._evaluateFloatValue(r,h,c,l)}return f}_evaluateColorValue(i,r,a,n,o,s){let l,h,u=this.layer.paint,c=s&&s.hasPaintProperty(i)?s.paintProperties.get(i):u.get(i),d=r&&s&&s.hasPaintProperty(r)?s.paintProperties.get(r):r?u.get(r):void 0;if(!c)return[0,0,0,1];let p=d2(d&&"string"!=typeof d?d.value:void 0,a.feature,a.featureState,a.availableImages,a.canonical,n,a.formattedSection,this.worldview)?null:this.lut;c.isConstant()?l=h=c.constantOr(i_.transparent):(l=c.property.evaluate(c.value,a.params,a.feature,a.featureState,a.canonical,a.availableImages,c.iconImageUseTheme,a.formattedSection),h=o?c.property.evaluate(c.value,a.paramsNext,a.feature,a.featureState,a.canonical,a.availableImages,c.iconImageUseTheme,a.formattedSection):l);let f=(l||i_.transparent).toNonPremultipliedRenderColor(p),m=(h||i_.transparent).toNonPremultipliedRenderColor(p);if(o){let[i,r]=d1(f.r,f.g,f.b,f.a),[a,n]=d1(m.r,m.g,m.b,m.a);return[i,r,a,n]}let[_,g]=d1(f.r,f.g,f.b,f.a);return[_,g,0,0]}_evaluateFloatValue(i,r,a,n){let o=this.layer.paint,s=+!!i.endsWith("opacity"),l=n&&n.hasPaintProperty(i)?n.paintProperties.get(i):o.get(i);if(!l)return s;if(l.isConstant())return l.constantOr(s);let h=l.property.evaluate(l.value,a.params,a.feature,a.featureState,a.canonical,a.availableImages,l.iconImageUseTheme,a.formattedSection),u=null!=h?h:s;if(r){let i=l.property.evaluate(l.value,a.paramsNext,a.feature,a.featureState,a.canonical,a.availableImages,l.iconImageUseTheme,a.formattedSection);return[u,null!=i?i:s]}return u}_evaluateTranslateValue(i,r,a,n){let o=this.layer.paint,s=n&&n.hasPaintProperty(i)?n.paintProperties.get(i):o.get(i);if(!s)return[0,0];if("function"!=typeof s.isConstant)return s||[0,0];if(s.isConstant())return s.constantOr([0,0]);let l=s.property.evaluate(s.value,a.params,a.feature,a.featureState,a.canonical,a.availableImages,s.iconImageUseTheme,a.formattedSection)||[0,0];if(r){let i=s.property.evaluate(s.value,a.paramsNext,a.feature,a.featureState,a.canonical,a.availableImages,s.iconImageUseTheme,a.formattedSection)||[0,0];return[l[0],l[1],i[0],i[1]]}return l}_getCachedParams(i){return this.cachedParams&&this.cachedParamsNext&&this.cachedBrightness===i||(this.cachedParams=new nH(this.zoom,{brightness:i,worldview:this.worldview}),this.cachedParamsNext=new nH(this.zoom+1,{brightness:i,worldview:this.worldview}),this.cachedBrightness=i),{params:this.cachedParams,paramsNext:this.cachedParamsNext}}_appearancesHavePaintProperties(i){return this.layer.getAppearances().some(void 0!==i?r=>r.hasPaintProperty(i):this.isText?i=>i.hasTextPaintProperties():i=>i.hasIconPaintProperties())}
7_checkIfAllPropertiesAreConstant(i,r){let a=i.paint,n=r?"text":"icon";for(let i of[`${n}-color`,`${n}-halo-color`,`${n}-opacity`,`${n}-halo-width`,`${n}-halo-blur`,`${n}-emissive-strength`,`${n}-occlusion-opacity`,"symbol-z-offset",`${n}-translate`]){let r=a.get(i);if(r&&"object"==typeof r&&"isConstant"in r&&!r.isConstant())return!1}return!this._appearancesHavePaintProperties()}_hashDataDrivenValues(i,r){if(0===r.dataDrivenMask)return"";let a=[];for(let n=0;n<9;n++){if(!(r.dataDrivenMask&1<<n))continue;let o=i[n];null==o?a.push("null"):Array.isArray(o)?a.push(o.join(",")):a.push(String(o))}return a.join("|")}getCurrentBatchIndex(){return this.cachedHeader&&0!==this.maxFeaturesPerBatch?Math.floor(this.featureCount/this.maxFeaturesPerBatch):0}populateUBO(i,r,a,n,o,s,l){let h=i.id;if(!this.cachedHeader){this.cachedHeader=this.buildHeader();let i=d0.getMaxFeatureCount(this.cachedHeader,this.uboSizeDwords);this.maxFeaturesPerBatch=isFinite(i)?i:Number.MAX_SAFE_INTEGER}let u=this.cachedHeader,c=this.evaluateAllProperties(i,{},a,n,o,s);if(this.canDeduplicate){let i=this._hashDataDrivenValues(c,u),a=this.propertyHashToUBOIndex.get(i);if(void 0!==a){let i=isFinite(this.maxFeaturesPerBatch)?Math.floor(a/this.maxFeaturesPerBatch):0,n=isFinite(this.maxFeaturesPerBatch)?a%this.maxFeaturesPerBatch:a,o={batchIndex:i,localFeatureIndex:n,vtFeatureIndex:r,featureId:h};return this.allFeatures.push(o),null!=h&&(this.featureVertexRangesFromId.has(h)||this.featureVertexRangesFromId.set(h,[]),this.featureVertexRangesFromId.get(h).push(o)),n}this.propertyHashToUBOIndex.set(i,this.featureCount)}let d=this.featureCount++,p=isFinite(this.maxFeaturesPerBatch)?Math.floor(d/this.maxFeaturesPerBatch):0,f=isFinite(this.maxFeaturesPerBatch)?d%this.maxFeaturesPerBatch:d,m=l?l.maxUniformBufferBindings:this.maxUniformBufferBindings;if(3*p+2>=m){t_(`Too many symbol features: batch ${p} requires binding points up to ${3*p+2}, device limit ${m}. Some features will render incorrectly.`);let i={batchIndex:0,localFeatureIndex:0,vtFeatureIndex:r,featureId:h};return this.allFeatures.push(i),null!=h&&(this.featureVertexRangesFromId.has(h)||this.featureVertexRangesFromId.set(h,[]),this.featureVertexRangesFromId.get(h).push(i)),0}this.ubos[p]||(this.ubos[p]=new d0(l,p,this.uboSizeDwords),this.ubos[p].writeHeader(u)),this.ubos[p].writeDataDrivenBlock(c,f,u);let _={batchIndex:p,localFeatureIndex:f,vtFeatureIndex:r,featureId:h};return this.allFeatures.push(_),null!=h&&(this.featureVertexRangesFromId.has(h)||this.featureVertexRangesFromId.set(h,[]),this.featureVertexRangesFromId.get(h).push(_)),f}updateFeatures(i,r,a,n,o,s,l){if(this.layer=r,this.cachedConstantUniforms=null,!this.cachedHeader)return;let h=this.cachedHeader;for(let r of i){let i=this.featureVertexRangesFromId.get(r);if(!i)continue;let u=s[r]||{};for(let s of i){if(!a)continue;let i=a.feature(s.vtFeatureIndex);if(!i)continue;let c={type:i.type,id:r,properties:i.properties||{},geometry:[]},d=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(s.vtFeatureIndex):void 0,p=this.evaluateAllProperties(c,u,n,o,l,void 0,d);this.ubos[s.batchIndex]&&this.ubos[s.batchIndex].writeDataDrivenBlock(p,s.localFeatureIndex,h)}}}updateDynamicExpressions(i,r,a,n,o,s){if(this.layer=i,this.cachedConstantUniforms=null,!this.cachedHeader)return;let l=this.cachedHeader;for(let i of this.allFeatures){if(!r)continue;let h=r.feature(i.vtFeatureIndex);if(!h)continue;let u=null!=i.featureId&&o[i.featureId]||{},c={type:h.type,id:i.featureId,properties:h.properties||{},geometry:[]},d=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(i.vtFeatureIndex):void 0,p=this.evaluateAllProperties(c,u,a,n,s,void 0,d);this.ubos[i.batchIndex]&&this.ubos[i.batchIndex].writeDataDrivenBlock(p,i.localFeatureIndex,l)}}updateFeaturePaintForAppearance(i,r,a,n,o,s,l){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(i,l||null),!this.cachedHeader))return!1;let h=this.cachedHeader;if(0===h.dataDrivenMask)return!1;let u=!1;for(let c of this.allFeatures){if(c.vtFeatureIndex!==i)continue;let d=this.evaluateAllProperties(r,a,n,o,s,void 0,l);this.ubos[c.batchIndex]&&(this.ubos[c.batchIndex].writeDataDrivenBlock(d,c.localFeatureIndex,h),u=!0)}return u}getConstantUniformValues(i,r){let a=this.cachedHeader,n=!(!a||!a.cameraMask);if(this.cachedConstantUniforms&&this.cachedConstantBrightness===r&&(!n||this.cachedConstantRenderZoom===i))return this.cachedConstantUniforms;let o=this.layer.paint,s=this.propDefs,l=n?new nH(i,{brightness:r,worldview:this.worldview}):null,h={type:1,id:void 0,properties:{},geometry:[]},u=i=>{let n=s[i],u=o.get(n.name);if(!u)return[0,0,0,1];let c=n.useThemeName?o.get(n.useThemeName):void 0,d=d2(c&&"string"!=typeof c?c.value:void 0,h,{},[],void 0,r,void 0,this.worldview)?null:this.lut,p=((a&&a.cameraMask&1<<i&&l?u.property.evaluate(u.value,l,h,{},void 0,[]):u.constantOr(i_.transparent))||i_.transparent).toNonPremultipliedRenderColor(d);return[p.r,p.g,p.b,p.a]},c=(i,r)=>{let n=o.get(s[i].name);if(!n)return r;if(a&&a.cameraMask&1<<i&&l){let i=n.property.evaluate(n.value,l,h,{},void 0,[]);return null!=i?i:r}return n.constantOr(r)},d={fill_np_color:u(0),halo_np_color:u(1),opacity:c(2,1),halo_width:c(3,0),halo_blur:c(4,0),emissive_strength:c(5,0),occlusion_opacity:c(6,1),z_offset:c(7,0)};return this.cachedConstantUniforms=d,this.cachedConstantRenderZoom=i,this.cachedConstantBrightness=r,d}upload(i){for(let r of this.ubos)r.upload(i)}bind(i,r,a=0){this.ubos[a]&&this.ubos[a].bind(i,r)}destroy(){for(let i of this.ubos)i.destroy();this.ubos=[],this.featureVertexRangesFromId.clear(),this.allFeatures=[],this.featureCount=0,this.cachedHeader=null,this.maxFeaturesPerBatch=0,this.propertyHashToUBOIndex&&this.propertyHashToUBOIndex.clear()}}ne(d3,"SymbolPropertyBinderUBO",{omit:["layer","cachedParams","cachedParamsNext","cachedBrightness","propertyHashToUBOIndex","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","activeAppearanceByVtIndex"]});let d5={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"},d4="u"<typeof TextDecoder?null:new TextDecoder("utf-8"),d6=class{constructor(i=new Uint8Array(16)){this.buf=ArrayBuffer.isView(i)?i:new Uint8Array(i),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(i,r,a=this.length){for(;this.pos<a;){let a=this.readVarint(),n=a>>3,o=this.pos;this.type=7&a,i(n,r,this),this.pos===o&&this.skip(a)}return r}readMessage(i,r){return this.readFields(i,r,this.readVarint()+this.pos)}readFixed32(){let i=this.dataView.getUint32(this.pos,!0);return this.pos+=4,i}readSFixed32(){let i=this.dataView.getInt32(this.pos,!0);return this.pos+=4,i}readFixed64(){let i=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,i}readSFixed64(){let i=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,i}readFloat(){let i=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,i}readDouble(){let i=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,i}readVarint(i){let r,a,n=this.buf;return r=127&(a=n[this.pos++]),a<128?r:(r|=(127&(a=n[this.pos++]))<<7,a<128?r:(r|=(127&(a=n[this.pos++]))<<14,a<128?r:(r|=(127&(a=n[this.pos++]))<<21,a<128?r:function(i,r,a){let n,o,s=a.buf;if(n=(112&(o=s[a.pos++]))>>4,o<128||(n|=(127&(o=s[a.pos++]))<<3,o<128)||(n|=(127&(o=s[a.pos++]))<<10,o<128)||(n|=(127&(o=s[a.pos++]))<<17,o<128)||(n|=(127&(o=s[a.pos++]))<<24,o<128)||(n|=(1&(o=s[a.pos++]))<<31,o<128))return function(i,r,a){return a?0x100000000*r+(i>>>0):0x100000000*(r>>>0)+(i>>>0)}(i,n,r);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(a=n[this.pos]))<<28,i,this))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let i=this.readVarint();return i%2==1?-((i+1)/2):i/2}readBoolean(){return!!this.readVarint()}readString(){let i=this.readVarint()+this.pos,r=this.pos;return this.pos=i,i-r>=12&&d4?d4.decode(this.buf.subarray(r,i)):function(i,r,a){let n="",o=r;for(;o<a;){let r=i[o],s,l,h,u=null,c=r>239?4:r>223?3:r>191?2:1;if(o+c>a)break;1===c?r<128&&(u=r):2===c?128==(192&(s=i[o+1]))&&(u=(31&r)<<6|63&s)<=127&&(u=null):3===c?(s=i[o+1],l=i[o+2],128==(192&s)&&128==(192&l)&&((u=(15&r)<<12|(63&s)<<6|63&l)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=i[o+1],l=i[o+2],h=i[o+3],128==(192&s)&&128==(192&l)&&128==(192&h)&&((u=(15&r)<<18|(63&s)<<12|(63&l)<<6|63&h)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),o+=c}return n}(this.buf,r,i)}readBytes(){let i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r}readPackedVarint(i=[],r){let a=this.readPackedEnd();for(;this.pos<a;)i.push(this.readVarint(r));return i}readPackedSVarint(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSVarint());return i}readPackedBoolean(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readBoolean());return i}readPackedFloat(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFloat());return i}readPackedDouble(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readDouble());return i}readPackedFixed32(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFixed32());return i}readPackedSFixed32(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSFixed32());return i}readPackedFixed64(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFixed64());return i}readPackedSFixed64(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSFixed64());return i}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(i){let r=7&i;if(0===r)for(;this.buf[this.pos++]>127;);else if(2===r)this.pos=this.readVarint()+this.pos;else if(5===r)this.pos+=4;else{if(1!==r)throw Error(`Unimplemented type: ${r}`);this.pos+=8}}writeTag(i,r){this.writeVarint(i<<3|r)}realloc(i){let r=this.length||16;for(;r<this.pos+i;)r*=2;if(r!==this.length){let i=new Uint8Array(r);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=r}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(i){this.realloc(4),this.dataView.setInt32(this.pos,i,!0),this.pos+=4}writeSFixed32(i){this.realloc(4),this.dataView.setInt32(this.pos,i,!0),this.pos+=4}
7writeFixed64(i){this.realloc(8),this.dataView.setInt32(this.pos,-1&i,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*i),!0),this.pos+=8}writeSFixed64(i){this.realloc(8),this.dataView.setInt32(this.pos,-1&i,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*i),!0),this.pos+=8}writeVarint(i){(i=+i||0)>0xfffffff||i<0?function(i,r){var a,n;let o,s,l;if(i>=0?(o=i%0x100000000|0,s=i/0x100000000|0):(o=~(-i%0x100000000),s=~(-i/0x100000000),0xffffffff^o?o=o+1|0:(o=0,s=s+1|0)),i>=0xffffffffffffffff||i<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),a=o,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,r.buf[r.pos]=127&(a>>>=7),l=(7&(n=s))<<4,r.buf[r.pos++]|=l|128*!!(n>>>=3),n&&(r.buf[r.pos++]=127&n|128*!!(n>>>=7),n&&(r.buf[r.pos++]=127&n|128*!!(n>>>=7),n&&(r.buf[r.pos++]=127&n|128*!!(n>>>=7),n&&(r.buf[r.pos++]=127&n|128*!!(n>>>=7),n&&(r.buf[r.pos++]=127&n)))))}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|128*(i>127),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|128*(i>127),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|128*(i>127),i<=127||(this.buf[this.pos++]=i>>>7&127))))}writeSVarint(i){this.writeVarint(i<0?-(2*i)-1:2*i)}writeBoolean(i){this.writeVarint(+i)}writeString(i){i=String(i),this.realloc(4*i.length),this.pos++;let r=this.pos;this.pos=function(i,r,a){for(let n,o,s=0;s<r.length;s++){if((n=r.charCodeAt(s))>55295&&n<57344){if(!o){n>56319||s+1===r.length?(i[a++]=239,i[a++]=191,i[a++]=189):o=n;continue}if(n<56320){i[a++]=239,i[a++]=191,i[a++]=189,o=n;continue}n=o-55296<<10|n-56320|65536,o=null}else o&&(i[a++]=239,i[a++]=191,i[a++]=189,o=null);n<128?i[a++]=n:(n<2048?i[a++]=n>>6|192:(n<65536?i[a++]=n>>12|224:(i[a++]=n>>18|240,i[a++]=n>>12&63|128),i[a++]=n>>6&63|128),i[a++]=63&n|128)}return a}(this.buf,i,this.pos);let a=this.pos-r;a>=128&&d8(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a}writeFloat(i){this.realloc(4),this.dataView.setFloat32(this.pos,i,!0),this.pos+=4}writeDouble(i){this.realloc(8),this.dataView.setFloat64(this.pos,i,!0),this.pos+=8}writeBytes(i){let r=i.length;this.writeVarint(r),this.realloc(r);for(let a=0;a<r;a++)this.buf[this.pos++]=i[a]}writeRawMessage(i,r){this.pos++;let a=this.pos;i(r,this);let n=this.pos-a;n>=128&&d8(a,n,this),this.pos=a-1,this.writeVarint(n),this.pos+=n}writeMessage(i,r,a){this.writeTag(i,2),this.writeRawMessage(r,a)}writePackedVarint(i,r){r.length&&this.writeMessage(i,d9,r)}writePackedSVarint(i,r){r.length&&this.writeMessage(i,d7,r)}writePackedBoolean(i,r){r.length&&this.writeMessage(i,pi,r)}writePackedFloat(i,r){r.length&&this.writeMessage(i,pe,r)}writePackedDouble(i,r){r.length&&this.writeMessage(i,pt,r)}writePackedFixed32(i,r){r.length&&this.writeMessage(i,pr,r)}writePackedSFixed32(i,r){r.length&&this.writeMessage(i,pa,r)}writePackedFixed64(i,r){r.length&&this.writeMessage(i,pn,r)}writePackedSFixed64(i,r){r.length&&this.writeMessage(i,po,r)}writeBytesField(i,r){this.writeTag(i,2),this.writeBytes(r)}writeFixed32Field(i,r){this.writeTag(i,5),this.writeFixed32(r)}writeSFixed32Field(i,r){this.writeTag(i,5),this.writeSFixed32(r)}writeFixed64Field(i,r){this.writeTag(i,1),this.writeFixed64(r)}writeSFixed64Field(i,r){this.writeTag(i,1),this.writeSFixed64(r)}writeVarintField(i,r){this.writeTag(i,0),this.writeVarint(r)}writeSVarintField(i,r){this.writeTag(i,0),this.writeSVarint(r)}writeStringField(i,r){this.writeTag(i,2),this.writeString(r)}writeFloatField(i,r){this.writeTag(i,5),this.writeFloat(r)}writeDoubleField(i,r){this.writeTag(i,1),this.writeDouble(r)}writeBooleanField(i,r){this.writeVarintField(i,+r)}};function d8(i,r,a){let n=r<=16383?1:r<=2097151?2:r<=0xfffffff?3:Math.floor(Math.log(r)/(7*Math.LN2));a.realloc(n);for(let r=a.pos-1;r>=i;r--)a.buf[r+n]=a.buf[r]}function d9(i,r){for(let a=0;a<i.length;a++)r.writeVarint(i[a])}function d7(i,r){for(let a=0;a<i.length;a++)r.writeSVarint(i[a])}function pe(i,r){for(let a=0;a<i.length;a++)r.writeFloat(i[a])}function pt(i,r){for(let a=0;a<i.length;a++)r.writeDouble(i[a])}function pi(i,r){for(let a=0;a<i.length;a++)r.writeBoolean(i[a])}function pr(i,r){for(let a=0;a<i.length;a++)r.writeFixed32(i[a])}function pa(i,r){for(let a=0;a<i.length;a++)r.writeSFixed32(i[a])}function pn(i,r){for(let a=0;a<i.length;
7a++)r.writeFixed64(i[a])}function po(i,r){for(let a=0;a<i.length;a++)r.writeSFixed64(i[a])}function ps(i,r,a){r.glyphs=[],1===i&&a.readMessage(pl,r)}function pl(i,r,a){if(3===i){let{id:i,bitmap:n,width:o,height:s,left:l,top:h,advance:u}=a.readMessage(ph,{});r.glyphs.push({id:i,bitmap:new hS({width:o+6,height:s+6},n),metrics:{width:o,height:s,left:l,top:h,advance:u}})}else 4===i?r.ascender=a.readSVarint():5===i&&(r.descender=a.readSVarint())}function ph(i,r,a){1===i?r.id=a.readVarint():2===i?r.bitmap=a.readBytes():3===i?r.width=a.readVarint():4===i?r.height=a.readVarint():5===i?r.left=a.readSVarint():6===i?r.top=a.readSVarint():7===i&&(r.advance=a.readVarint())}let pu={horizontal:1,vertical:2,horizontalOnly:3};class pc{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(i,r){let a=new pc;return a.scale=i||1,a.fontStack=r,a}static forImage(i){let r=new pc;return r.image=i,r}}class pd{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r,a,n=1){let o=new pd;for(let s=0;s<i.sections.length;s++){let l=i.sections[s];l.image?o.addImageSection(l,a,n):o.addTextSection(l,r)}return o}length(){return this.text.length}getSection(i){return this.sections[this.sectionIndex[i]]}getSections(){return this.sections}getSectionIndex(i){return this.sectionIndex[i]}getCodePoint(i){return this.text.codePointAt(i)}verticalizePunctuation(i){this.text=function(i,r){let a="";for(let n=0;n<i.length;n++){let o=i.charCodeAt(n+1)||null,s=i.charCodeAt(n-1)||null;a+=!r&&(o&&nL(o)&&!d5[i[n+1]]||s&&nL(s)&&!d5[i[n-1]])||!d5[i[n]]?i[n]:d5[i[n]]}return a}(this.text,i)}trim(){let i=0;for(let r=0;r<this.text.length&&pf[this.text.charCodeAt(r)];r++)i++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=i&&pf[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(i,r),this.sectionIndex=this.sectionIndex.slice(i,r)}substring(i,r){let a=new pd;return a.text=this.text.substring(i,r),a.sectionIndex=this.sectionIndex.slice(i,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(pc.forText(i.scale,i.fontStack||r));let a=this.sections.length-1;for(let r=0;r<i.text.length;++r)this.sectionIndex.push(a)}addImageSection(i,r,a=1){let n=i.image?i.image.getPrimary():null;if(!n)return void t_("Can't add FormattedSection with an empty image.");n.scaleSelf(r*a);let o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCodePoint(o),this.sections.push(pc.forImage(n)),this.sectionIndex.push(this.sections.length-1)):t_("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function pp(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g=1,y=1){let x=pd.fromFeature(i,o,g,y);p===pu.vertical&&x.verticalizePunctuation(f);let v=[],b=function(i,r,a,n,o,s,l=1){if(!i)return[];let h=[],u=function(i,r,a,n,o,s,l=1){let h=0;for(let a=0;a<i.length();a++){let u=i.getSection(a);h+=p_(i.getCodePoint(a),u,n,o,r,s,l)}return h/Math.max(1,Math.ceil(h/a))}(i,r,a,n,o,s,l),c=i.text.indexOf("â")>=0,d=0;for(let a=0;a<i.length();a++){let p=i.getSection(a),f=i.getCodePoint(a);if(pf[f]||(d+=p_(f,p,n,o,r,s,l)),a<i.length()-1){let r=!(f<11904||!(nf(f)||np(f)||nA(f)||nS(f)||ny(f)||ns(f)||nm(f)||nu(f)||nx(f)||nv(f)||ng(f)||nP(f)||nc(f)||nh(f)||nl(f)||n_(f)||nd(f)||nE(f)||nw(f)||nb(f)));(pm[f]||r||p.image)&&h.push(py(a+1,d,u,h,function(i,r,a){let n=0;return 10===i&&(n-=1e4),a&&(n+=150),40!==i&&65288!==i||(n+=50),41!==r&&65289!==r||(n+=50),n}(f,i.getCodePoint(a+1),r&&c),!1))}}return function i(r){return r?i(r.priorBreak).concat(r.index):[]}(py(i.length(),d,u,h,0,!0))}(x,c,s,r,n,m,y),{processBidirectionalText:w,processStyledBidirectionalText:T}=nq;if(w&&1===x.sections.length)for(let i of w(x.toString(),b)){let r=new pd;r.text=i,r.sections=x.sections;for(let a=0;a<i.length;a++)r.sectionIndex.push(0);v.push(r)}else if(T)for(let i of T(x.text,x.sectionIndex,b)){let r=new pd;r.text=i[0],r.sectionIndex=i[1],r.sections=x.sections,v.push(r)}else v=function(i,r){let a=[],n=i.text,o=0;for(let n of r)a.push(i.substring(o,n)),o=n;return o<n.length&&a.push(i.substring(o,n.length)),a}(x,b);
7let S=[],I={positionedLines:S,text:x.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:p,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(i,r,a,n,o,s,l,h,u,c,d,p,f=1){let m=0,_=0,g=0,y="right"===h?1:.5*("left"!==h),x=!1;for(let i of o){for(let a of i.getSections()){if(a.image)continue;let i=r[a.fontStack];if(i&&!(x=void 0!==i.ascender&&void 0!==i.descender))break}if(!x)break}let v=0;for(let l of o){l.trim();let o=l.getMaxScale(),h=(o-1)*24,w={positionedGlyphs:[],lineOffset:0};i.positionedLines[v]=w;let T=w.positionedGlyphs,S=0;if(!l.length()){_+=s,++v;continue}let I=0,E=0;for(let s=0;s<l.length();s++){var b;let h=l.getSection(s),g=l.getSectionIndex(s),y=l.getCodePoint(s),v=h.scale,w=null,A=null,C=null,M=24,P=0,D=u;D===pu.vertical&&(12312===y||12313===y||12316===y||12540===y||12448===y)&&(D=pu.horizontal);let R=!(D===pu.horizontal||!d&&!nR(y)||d&&(pf[y]||na(b=y)||nn(b)||no(b)||nI(b)||nM(b)));if(h.image){let r=n.get(h.image.toString());if(!r)continue;C=h.image,i.iconsInText=i.iconsInText||!0,A=r.paddedRect;let a=r.displaySize,s=a[0]*f,l=a[1]*f;v=24*v/p,w={width:s,height:l,left:0,top:-3,advance:R?l:s,localGlyph:!1},P=x?-w.height*v:24*o-17-l*v,M=w.advance;let u=(R?s:l)*v-24*o;u>0&&u>S&&(S=u)}else{let i=a[h.fontStack];if(!i)continue;i[y]&&(A=i[y]);let n=r[h.fontStack];if(!n)continue;let s=n.glyphs[y];if(!s)continue;if(w=s.metrics,M=24*(8203!==y),x){let i=void 0!==n.ascender?Math.abs(n.ascender):0,r=void 0!==n.descender?Math.abs(n.descender):0,a=(i+r)*v;I<a&&(I=a,E=(i-r)/2*v),P=-i*v}else P=(o-v)*24-17}R?(i.verticalizable=!0,T.push({glyph:y,image:C,x:m,y:_+P,vertical:R,scale:v,localGlyph:w.localGlyph,fontStack:h.fontStack,sectionIndex:g,metrics:w,rect:A}),m+=M*v+c):(T.push({glyph:y,image:C,x:m,y:_+P,vertical:R,scale:v,localGlyph:w.localGlyph,fontStack:h.fontStack,sectionIndex:g,metrics:w,rect:A}),m+=w.advance*v+c)}0!==T.length&&(g=Math.max(m-c,g),x?pv(T,y,S,E,s*o/2):pv(T,y,S,0,s/2)),m=0;let A=s*o+S;w.lineOffset=Math.max(S,h),_+=A,++v}let w=_,{horizontalAlign:T,verticalAlign:S}=px(l);(function(i,r,a,n,o,s){let l=(r-a)*o,h=-s*n;for(let r of i)for(let i of r.positionedGlyphs)i.x+=l,i.y+=h}
7)(i.positionedLines,y,T,S,g,w),i.top+=-S*w,i.bottom=i.top+w,i.left+=-T*g,i.right=i.left+g,i.hasBaseline=x}(I,r,a,n,v,l,h,u,p,c,f,_,y),!function(i){for(let r of i)if(0!==r.positionedGlyphs.length)return!1;return!0}(S))return I}let pf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},pm={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function p_(i,r,a,n,o,s,l=1){if(r.image){let i=n.get(r.image.toString());return i?i.displaySize[0]*l*r.scale*24/s+o:0}{let n=a[r.fontStack],s=n&&n.glyphs[i];return s?s.metrics.advance*r.scale+o:0}}function pg(i,r,a,n){let o=Math.pow(i-r,2);return n?i<r?o/2:2*o:o+Math.abs(a)*a}function py(i,r,a,n,o,s){let l=null,h=pg(r,a,o,s);for(let i of n){let n=pg(r-i.x,a,o,s)+i.badness;n<=h&&(l=i,h=n)}return{index:i,x:r,priorBreak:l,badness:h}}function px(i){let r=.5,a=.5;switch(i){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":a=1;break;case"top":case"top-right":case"top-left":a=0}return{horizontalAlign:r,verticalAlign:a}}function pv(i,r,a,n,o){if(!(r||a||n||o))return;let s=i.length-1,l=i[s],h=(l.x+l.metrics.advance*l.scale)*r;for(let r=0;r<=s;r++)i[r].x-=h,i[r].y+=a+n+o}function pb(i){return void 0!==i.imagePrimary&&void 0!==i.top&&void 0!==i.bottom&&void 0!==i.left&&void 0!==i.right}function pw(i,r,a,n){let{horizontalAlign:o,verticalAlign:s}=px(n),l=a[0]-i.displaySize[0]*o,h=a[1]-i.displaySize[1]*s;return{imagePrimary:i,imageSecondary:r,top:h,bottom:h+i.displaySize[1],left:l,right:l+i.displaySize[0]}}function pT(i,r,a,n,o,s){let l,h,u,c,d,p=i.imagePrimary;if(p.content){let i=p.content,r=p.pixelRatio||1;l=[i[0]/r,i[1]/r,p.displaySize[0]-i[2]/r,p.displaySize[1]-i[3]/r]}let f=r.left*s,m=r.right*s;"width"===a||"both"===a?(d=o[0]+f-n[3],u=o[0]+m+n[1]):u=(d=o[0]+(f+m-p.displaySize[0])/2)+p.displaySize[0];let _=r.top*s,g=r.bottom*s;return"height"===a||"both"===a?(h=o[1]+_-n[0],c=o[1]+g+n[2]):c=(h=o[1]+(_+g-p.displaySize[1])/2)+p.displaySize[1],{imagePrimary:p,imageSecondary:void 0,top:h,right:u,bottom:c,left:d,collisionPadding:l}}function pS(i){return!i.imagePrimary.stretchX}function pI(i){return!i.imagePrimary.stretchY}function pE(i){return{width:i.right-i.left,height:i.bottom-i.top}}function pA(i,r,a,n){let{expression:o}=r;if("constant"===o.kind)return{kind:"constant",layoutSize:o.evaluate(new nH(i+1,{worldview:a}),void 0,void 0,void 0,n)};if("source"===o.kind)return{kind:"source"};{let{zoomStops:r,interpolationType:s}=o,l=0;for(;l<r.length&&r[l]<=i;)l++;let h=l=Math.max(0,l-1);for(;h<r.length&&r[h]<i+1;)h++;h=Math.min(r.length-1,h);let u=r[l],c=r[h];return"composite"===o.kind?{kind:"composite",minZoom:u,maxZoom:c,interpolationType:s}:{kind:"camera",minZoom:u,maxZoom:c,minSize:o.evaluate(new nH(u,{worldview:a}),void 0,void 0,void 0,n),maxSize:o.evaluate(new nH(c,{worldview:a}),void 0,void 0,void 0,n),interpolationType:s}}}function pC(i,{uSize:r,uSizeT:a},{lowerSize:n,upperSize:o}){return"source"===i.kind?n/128:"composite"===i.kind?iv(n/128,o/128,a):r}function pM(i,r,a=1){let n=0,o=0;if("constant"===i.kind)o=i.layoutSize*a;else if("source"!==i.kind){let{interpolationType:s,minZoom:l,maxZoom:h}=i,u=s?tr(al.interpolationFactor(s,r,l,h),0,1):0;"camera"===i.kind?o=iv(i.minSize,i.maxSize,u)*a:n=u*a}return{uSizeT:n,uSize:o}}class pP extends e4{constructor(i,r,a,n,o){super(i,r),this.angle=n,this.z=a,void 0!==o&&(this.segment=o)}clone(){return new pP(this.x,this.y,this.z,this.angle,this.segment)}}function pD(i,r,a,n,o){if(void 0===r.segment)return!0;let s=r,l=r.segment+1,h=0;for(;h>-a/2;){if(--l<0)return!1;h-=i[l].dist(s),s=i[l]}h+=i[l].dist(i[l+1]),l++;let u=[],c=0;for(;h<a/2;){let r=i[l],a=i[l+1];if(!a)return!1;let s=i[l-1].angleTo(r)-r.angleTo(a);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:h,angleDelta:s}),c+=s;h-u[0].distance>n;)c-=u.shift().angleDelta;if(c>o)return!1;l++,h+=r.dist(a)}return!0}function pR(i){let r=0;for(let a=0;a<i.length-1;a++)r+=i[a].dist(i[a+1]);return r}function pL(i,r){return Math.max(i?i.right-i.left:0,r?r.right-r.left:0)}function pz(i){let r=0,a=0;for(let n of i)r+=n.w*n.h,a=Math.max(a,n.w);i.sort((i,r)=>r.h-i.h);let n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),a),h:1/0}],o=0,s=0;for(let r of i)for(let i=n.length-1;i>=0;i--){let a=n[i];if(!(r.w>a.w||r.h>a.h)){if(r.x=a.x,r.y=a.y,s=Math.max(s,r.y+r.h),o=Math.max(o,r.x+r.w),r.w===a.w&&r.h===a.h){let r=n.pop();r&&i<n.length&&(n[i]=r)}else r.h===a.h?(a.x+=r.w,a.w-=r.w):(r.w===a.w||n.push({x:a.x+r.w,y:a.y,w:a.w-r.w,h:r.h}),a.y+=r.h,a.h-=r.h);break}}return{w:o,h:s,fill:r/(o*s)||0}}function pF(i,r){return i.id<r.id?-1:i.id>r.id?1:i.version<r.version?-1:i.version>r.version?1:i.sx<r.sx?-1:i.sx>r.sx?1:i.sy<r.sy?-1:+(i.sy>r.sy)}function pO(i){let r=0;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a),r&=r;return r}function pB(i,r){return(i<<5)-i+r}function pk(i,r,a,n){for(let[o]of i.entries()){let i=n&&n.get(o)||i$.parse(o),s=i.id.toString(),l=r.get(s)||0;a.push({id:o,version:l,sx:i.sx,sy:i.sy})}}ne(pP,"Anchor");class pV{constructor(i,r,a,n,o){this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=r.size>0,pk(i,a,this.iconDescriptors,o),pk(r,a,this.patternDescriptors,o),this.iconDescriptors.sort(pF),this.patternDescriptors.sort(pF);let s=0;const l=n?n.data:"";for(const i of(l&&(s=pB(s,pO(l))),s=pB(s,1),this.iconDescriptors))s=pB(s,pO(i.id)),s=pB(s,i.version),s=pB(s,i.sx),s=pB(s,i.sy);for(const i of(s=pB(s,1),this.patternDescriptors))s=pB(s,pO(i.id)),s=pB(s,i.version),s=pB(s,i.sx),s=pB(s,i.sy);this.hash=s}subsetOf(i){return this.isSubsetArray(this.iconDescriptors,i.iconDescriptors,pF)&&this.isSubsetArray(this.patternDescriptors,i.patternDescriptors,pF)}isSubsetArray(i,r,a){let n=0,o=0;if(i.length>r.length)return!1;for(;n<i.length&&o<r.length;){let s=a(i[n],r[o]);if(0===s)n++,o++;else{if(s<0)return!1;o++}}return n===i.length}}ne(pV,"AtlasContentDescriptor");class pN{static getImagePositionScale(i,r,a){if(r&&i){let{sx:r,sy:a}=i;return{x:r,y:a}}return{x:a,y:a}}constructor(i,r,a,n){this.paddedRect=i;const{pixelRatio:o,version:s,stretchX:l,stretchY:h,content:u,sdf:c,usvg:d}=r;this.pixelRatio=o,this.stretchX=l,this.stretchY=h,this.content=u,this.version=s,this.padding=a,this.sdf=c,this.usvg=d,this.scale=pN.getImagePositionScale(n,d,o)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function pU(i,r,a){let n=i$.parse(i),o=function(i,r,a=[1,1]){return{x:0,y:0,w:(i.data?i.data.width:i.width*a[0])+2*r,h:(i.data?i.data.height:i.height*a[1])+2*r}}(r,a,[n.sx,n.sy]);return{bin:o,imagePosition:new pN(o,r,a,n),imageVariant:n}}function pj(i,r){let a=[];for(let[n,o]of i.entries()){let i=i$.parse(n);i&&(a.push({key:n,value:o,variant:i}),r&&r.set(n,i))}a.sort((i,r)=>{let a=i.variant.id.toString().localeCompare(r.variant.id.toString());return 0!==a?a:i.variant.sx!==r.variant.sx?i.variant.sx-r.variant.sx:i.variant.sy!==r.variant.sy?i.variant.sy-r.variant.sy:0});let n=new Map;for(let i of a)n.set(i.key,i.value);return n}class pG{constructor(i){this.sourceAtlasHash=i}}class pq{constructor(i,r,a,n){const o=new Map,s=new Map;this.haveRenderCallbacks=[];const l=[],h=void 0!==n,u=h?new Map:void 0,c=h?pj(i,u):i,d=h?pj(r,u):r;this.addImages(c,o,1,l),this.addImages(d,s,2,l);const{w:p,h:f}=pz(l),m=new hI({width:p||1,height:f||1});for(const[i,r]of c.entries()){const a=o.get(i).paddedRect;hI.copy(r.data,m,{x:0,y:0},{x:a.x+1,y:a.y+1},r.data,null,r.sdf)}for(const[i,r]of d.entries()){const n=s.get(i),o=n.paddedRect;let l=n.padding;const h=o.x+l,u=o.y+l,c=r.data.width,d=r.data.height;l=l>1?l-1:l,hI.copy(r.data,m,{x:0,y:0},{x:h,y:u},r.data,a),hI.copy(r.data,m,{x:0,y:d-l},{x:h,y:u-l},{width:c,height:l},a),hI.copy(r.data,m,{x:0,y:0},{x:h,y:u+d},{width:c,height:l},a),hI.copy(r.data,m,{x:c-l,y:0},{x:h-l,y:u},{width:l,height:d},a),hI.copy(r.data,m,{x:0,y:0},{x:h+c,y:u},{width:l,height:d},a),hI.copy(r.data,m,{x:c-l,y:d-l},{x:h-l,y:u-l},{width:l,height:l},a),hI.copy(r.data,m,{x:0,y:d-l},{x:h+c,y:u-l},{width:l,height:l},a),hI.copy(r.data,m,{x:0,y:0},{x:h+c,y:u+d},{width:l,height:l},a),hI.copy(r.data,m,{x:c-l,y:0},{x:h-l,y:u+d},{width:l,height:l},a)}this.lut=a,this.image=m,this.iconPositions=o,this.patternPositions=s,h&&(this.contentDescriptor=new pV(c,d,n,a,u))}
7addImages(i,r,a,n){for(let[o,s]of i.entries()){let{bin:i,imagePosition:l,imageVariant:h}=pU(o,s,a);r.set(o,l),n.push(i),s.hasRenderCallback&&this.haveRenderCallbacks.push(h.id)}}patchUpdatedImages(i,r,a,n){for(let o of(this.haveRenderCallbacks=this.haveRenderCallbacks.filter(r=>i.hasImage(r,a)),i.dispatchRenderCallbacks(this.haveRenderCallbacks,a),i.getUpdatedImages(a))){for(let n of this.iconPositions.keys()){let s=i$.parse(n);if(ic.isEqual(s.id,o)){let s=i.getImage(o,a);this.patchUpdatedImage(this.iconPositions.get(n),s,r,null)}}for(let s of this.patternPositions.keys()){let l=i$.parse(s);if(ic.isEqual(l.id,o)){let l=i.getImage(o,a);this.patchUpdatedImage(this.patternPositions.get(s),l,r,n||this.lut)}}}}patchUpdatedImage(i,r,a,n=null){if(!i||!r||i.version===r.version)return;i.version=r.version;let[o,s]=i.tl,l=i.sdf;if(this.lut||l){let i={width:r.data.width,height:r.data.height},h=new hI(i);hI.copy(r.data,h,{x:0,y:0},{x:0,y:0},i,n,l),a.update(h,{position:{x:o,y:s},recreateWhenResize:!1})}else a.update(r.data,{position:{x:o,y:s},recreateWhenResize:!1})}}function p$(i,r,a,n,o,s,l,h,u){for(let c=r;c<r+n;c++)pH(i,a*s+c,s,o,l,h,u);for(let c=a;c<a+o;c++)pH(i,c*s+r,1,n,l,h,u)}function pH(i,r,a,n,o,s,l){s[0]=0,l[0]=-1e20,l[1]=1e20,o[0]=i[r];for(let h=1,u=0,c=0;h<n;h++){o[h]=i[r+h*a];let n=h*h;do{let i=s[u];c=(o[h]-o[i]+n-i*i)/(h-i)/2}while(c<=l[u]&&--u>-1);s[++u]=h,l[u]=c,l[u+1]=1e20}for(let h=0,u=0;h<n;h++){for(;l[u+1]<h;)u++;let n=s[u],c=h-n;i[r+h*a]=o[n]+c*c}}ne(pN,"ImagePosition"),ne(pq,"ImageAtlas",{omit:["lut"]}),ne(pG,"ImageAtlasReference");let pZ={none:0,ideographs:1,all:2};class pW{constructor(i,r,a){this.requestManager=i,this.localGlyphMode=r,this.localFontFamily=a,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(i){this.url=i}prefetchRange(i,r){let a=this.url||tM.GLYPHS_URL;if(!a)return;let n=this.entries[i];n||(n=this.entries[i]={glyphs:{},requests:{},ranges:{}}),n.ranges[r]||n.requests[r]||(n.requests[r]=[],pW.loadGlyphRange(i,r,a,this.requestManager,(i,a)=>{if(a){for(let i in n.ascender=a.ascender,n.descender=a.descender,a.glyphs)this._doesCharSupportLocalGlyph(+i)||(n.glyphs[+i]=a.glyphs[+i]);n.ranges[r]=!0}for(let o of n.requests[r]||[])o(i,a);delete n.requests[r]}))}getGlyphs(i,r){let a=[],n=this.url||tM.GLYPHS_URL;for(let r in i)for(let n of i[r])a.push({stack:r,id:n});to(a,({stack:i,id:r},a)=>{let o=this.entries[i];o||(o=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=o.glyphs[r];if(void 0!==s)return void a(null,{stack:i,id:r,glyph:s});if(s=this._tinySDF(o,i,r))return o.glyphs[r]=s,void a(null,{stack:i,id:r,glyph:s});let l=Math.floor(r/256);if(256*l>65535)return t_("glyphs > 65535 not supported"),void a(null,{stack:i,id:r,glyph:s});if(o.ranges[l])return void a(null,{stack:i,id:r,glyph:s});let h=o.requests[l];h||(h=o.requests[l]=[],pW.loadGlyphRange(i,l,n,this.requestManager,(i,r)=>{if(r){for(let i in o.ascender=r.ascender,o.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+i)||(o.glyphs[+i]=r.glyphs[+i]);o.ranges[l]=!0}for(let a of h)a(i,r);delete o.requests[l]})),h.push((n,o)=>{n?a(n):o&&a(null,{stack:i,id:r,glyph:o.glyphs[r]||null})})},(i,a)=>{if(i)r(i);else if(a){let i={};for(let{stack:r,id:n,glyph:o}of a)void 0===i[r]&&(i[r]={}),void 0===i[r].glyphs&&(i[r].glyphs={}),i[r].glyphs[n]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics},i[r].ascender=this.entries[r].ascender,i[r].descender=this.entries[r].descender;r(null,i)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==pZ.none&&(this.localGlyphMode===pZ.all?!!this.localFontFamily:!!this.localFontFamily&&(nv(i)||nT(i)||nc(i)||nd(i)||nu(i)||nx(i)||i>=131072&&i<=173791||i>=66736&&i<=66815))}_tinySDF(i,r,a){let n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(a))return;let o=i.tinySDF;if(!o){let a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),(o=i.tinySDF=new pW.TinySDF({fontFamily:n,fontWeight:a,fontSize:48,buffer:6,radius:16})).fontWeight=a}let s=o.fontWeight;if(this.localGlyphs[s][a])return this.localGlyphs[s][a];let l=String.fromCodePoint(a),{data:h,width:u,height:c,glyphWidth:d,glyphHeight:p,glyphLeft:f,glyphTop:m,glyphAdvance:_}=o.draw(l);return this.localGlyphs[s][a]={id:a,bitmap:new hS({width:u,height:c},h),metrics:{width:d/2,height:p/2,left:f/2,top:m/2-27,advance:_/2,localGlyph:!0}}}}function pX(i,r){return i+r[1]-r[0]}function pY(i,r,a,n,o=1){let s=[],l=i.imagePrimary,h=l.pixelRatio,u=l.paddedRect.w-2,c=l.paddedRect.h-2,d=(i.right-i.left)*o,p=(i.bottom-i.top)*o,f=l.stretchX||[[0,u]],m=l.stretchY||[[0,c]],_=f.reduce(pX,0),g=m.reduce(pX,0),y=u-_,x=c-g,v=0,b=_,w=0,T=g,S=0,I=y,E=0,A=x;if(l.content&&n){let i=l.content;v=pK(f,0,i[0]),w=pK(m,0,i[1]),b=pK(f,i[0],i[2]),T=pK(m,i[1],i[3]),S=i[0]-v,E=i[1]-w,I=i[2]-i[0]-b,A=i[3]-i[1]-T}let C=(n,s,u,c)=>{var f,m,y,x,C,M,P,D,R,L,z,F,O,B,k,V;let N=(f=n.stretch-v,f/b*d+i.left*o),U=(m=n.fixed-S,y=I,x=n.stretch,m-y*x/_),j=(C=s.stretch-w,C/T*p+i.top*
7o),G=(M=s.fixed-E,P=A,D=s.stretch,M-P*D/g),q=(R=u.stretch-v,R/b*d+i.left*o),$=(L=u.fixed-S,z=I,F=u.stretch,L-z*F/_),H=(O=c.stretch-w,O/T*p+i.top*o),Z=(B=c.fixed-E,k=A,V=c.stretch,B-k*V/g),W=new e4(N,j),X=new e4(q,j),Y=new e4(q,H),K=new e4(N,H),J=new e4(U/h,G/h),Q=new e4($/h,Z/h),ee=r*Math.PI/180;if(ee){let i=Math.sin(ee),r=Math.cos(ee),a=[r,-i,i,r];W._matMult(a),X._matMult(a),K._matMult(a),Y._matMult(a)}let et=n.stretch+n.fixed,ei=u.stretch+u.fixed,er=s.stretch+s.fixed,ea=c.stretch+c.fixed,en=i.imageSecondary;return{tl:W,tr:X,bl:K,br:Y,texPrimary:{x:l.paddedRect.x+1+et,y:l.paddedRect.y+1+er,w:ei-et,h:ea-er},texSecondary:en?{x:en.paddedRect.x+1+et,y:en.paddedRect.y+1+er,w:ei-et,h:ea-er}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:J,pixelOffsetBR:Q,minFontScaleX:I/h/d,minFontScaleY:A/h/p,isSDF:a}};if(l.stretchX||l.stretchY){let i=pJ(f,y,_),r=pJ(m,x,g);for(let a=0;a<i.length-1;a++){let n=i[a],o=i[a+1];for(let i=0;i<r.length-1;i++)s.push(C(n,r[i],o,r[i+1]))}}else s.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:u+1},{fixed:0,stretch:c+1}));return s}function pK(i,r,a){let n=0;for(let o of i)n+=Math.max(r,Math.min(a,o[1]))-Math.max(r,Math.min(a,o[0]));return n}function pJ(i,r,a){let n=[{fixed:-1,stretch:0}];for(let[r,a]of i){let i=n[n.length-1];n.push({fixed:r-i.stretch,stretch:i.stretch}),n.push({fixed:r-i.stretch,stretch:i.stretch+(a-r)})}return n.push({fixed:r+1,stretch:a}),n}function pQ(i){return 2*i.length+1}function p0(i,r,a,n,o,s,l,h,u,c=1){let d,p,f,m=[];if(0===r.positionedLines.length)return m;let _=(void 0!==u?u:n.layout.get("text-rotate").evaluate(s,{}))*Math.PI/180,g=(d=a[0],(f=d*(p=a[1]))>0?[d,-p]:f<0?[-d,p]:0===d?[p,d]:[p,-d]),y=Math.abs(r.top-r.bottom);for(let i of r.positionedLines)y-=i.lineOffset;let x=r.positionedLines.length,v=y/x,b=r.top-a[1];for(let i=0;i<x;++i){let n=r.positionedLines[i];for(let s of(b=function(i,r,a,n){let o=r+i.positionedLines[n].lineOffset;return 0===n?a+o/2:a+(o+(r+i.positionedLines[n-1].lineOffset))/2}(r,v,b,i),n.positionedGlyphs)){let i,n,u,d;if(!s.rect)continue;let p=s.rect||{},f=4,y=!0,x=1,v=0;if(s.image){let i=l.get(s.image.toString());if(!i)continue;if(i.sdf){t_("SDF images are not supported in formatted text and will be ignored.");continue}y=!1,f=1/(x=i.pixelRatio),i.usvg||(x/=c)}let w=(o||h)&&s.vertical,T=s.metrics.advance*s.scale/2,S=s.metrics,I=s.rect;if(null===I)continue;h&&r.verticalizable&&(v=s.image?T-s.metrics.width*s.scale/2:0);let E=o?[s.x+T,s.y]:[0,0],A=[0,0],C=[0,0],M=!1;o||(w?(C=[s.x+T+g[0],s.y+g[1]-v],M=!0):A=[s.x+T+a[0],s.y+a[1]-v]);let P=I.w*s.scale/(x*(s.localGlyph?2:1)),D=I.h*s.scale/(x*(s.localGlyph?2:1));if(w){let r=s.y-b,a=new e4(-T,T-r),o=-Math.PI/2,l=new e4(...C);(i=new e4(-T+A[0],A[1]))._rotateAround(o,a)._add(l),i.x+=-r+T,i.y-=(S.left-f)*s.scale;let h=s.image?S.advance*s.scale:24*s.scale,c=String.fromCodePoint(s.glyph);"︶"===c||"ï¹"===c||"︸"===c||"ï¹"===c||"ï¹"===c||"︾"===c||"︼"===c||"︺"===c||"ï¸"===c||"ï¹"===c||"ï¸"===c||"ï¸"===c||"ï¸"===c||"ï½"===c||"ï¿£"===c||"ï¸"===c||"ï¸"===c?i.x+=(1-f)*s.scale:"︵"===c||"ï¹"===c||"︷"===c||"ï¹"===c||"ï¹"===c||"︽"===c||"︻"===c||"︹"===c||"ï¸"===c||"︿"===c?i.x+=h-S.height*s.scale+(-f-1)*s.scale:i.x+=s.image||S.width+2*f===I.w&&S.height+2*f===I.h?(h-D)/2:(h-(S.height+2*f)*s.scale)/2,n=new e4(i.x,i.y-P),u=new e4(i.x+D,i.y),d=new e4(i.x+D,i.y-P)}else{let r=(S.left-f)*s.scale-T+A[0],a=(-S.top-f)*s.scale+A[1],o=r+P,l=a+D;i=new e4(r,a),n=new e4(o,a),u=new e4(r,l),d=new e4(o,l)}if(_){let r;r=o?new e4(0,0):M?new e4(g[0],g[1]):new e4(a[0],a[1]),i._rotateAround(_,r),n._rotateAround(_,r),u._rotateAround(_,r),d._rotateAround(_,r)}let R=new e4(0,0),L=new e4(0,0);m.push({tl:i,tr:n,bl:u,br:d,texPrimary:p,texSecondary:void 0,writingMode:r.writingMode,glyphOffset:E,sectionIndex:s.sectionIndex,isSDF:y,pixelOffsetTL:R,pixelOffsetBR:L,minFontScaleX:0,minFontScaleY:0})}}return m}function p1(i,r){return r.max-i.max}pW.loadGlyphRange=function(i,r,a,n,o){let s=256*r;t5(n.transformRequest(n.normalizeGlyphsURL(a).replace("{fontstack}",i).replace("{range}",`${s}-${s+255}`),tQ.Glyphs),(i,r)=>{if(i)o(i);else if(r){let i={},a=new d6(r).readFields(ps,{});for(let r of a.glyphs)i[r.id]=r;
7o(null,{glyphs:i,ascender:a.ascender,descender:a.descender})}})},pW.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:a=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:l="normal",lang:h=null}={}){this.buffer=r,this.cutoff=n,this.radius=a,this.lang=h;const u=this.size=i+4*r,c=this._createCanvas(u),d=this.ctx=c.getContext("2d",{willReadFrequently:!0});d.font=`${l} ${s} ${i}px ${o}`,d.textBaseline="alphabetic",d.textAlign="left",d.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(i){let r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){let{width:r,actualBoundingBoxAscent:a,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(i),l=Math.ceil(a),h=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-o))),u=Math.min(this.size-this.buffer,l+Math.ceil(n)),c=h+2*this.buffer,d=u+2*this.buffer,p=Math.max(c*d,0),f=new Uint8ClampedArray(p),m={data:f,width:c,height:d,glyphWidth:h,glyphHeight:u,glyphTop:l,glyphLeft:0,glyphAdvance:r};if(0===h||0===u)return m;let{ctx:_,buffer:g,gridInner:y,gridOuter:x}=this;this.lang&&(_.lang=this.lang),_.clearRect(g,g,h,u),_.fillText(i,g,g+l);let v=_.getImageData(g,g,h,u);x.fill(1e20,0,p),y.fill(0,0,p);for(let i=0;i<u;i++)for(let r=0;r<h;r++){let a=v.data[4*(i*h+r)+3]/255;if(0===a)continue;let n=(i+g)*c+r+g;if(1===a)x[n]=0,y[n]=1e20;else{let i=.5-a;x[n]=i>0?i*i:0,y[n]=i<0?i*i:0}}p$(x,0,0,c,d,c,this.f,this.v,this.z),p$(y,g,g,h,u,c,this.f,this.v,this.z);for(let i=0;i<p;i++){let r=Math.sqrt(x[i])-Math.sqrt(y[i]);f[i]=Math.round(255-255*(r/this.radius+this.cutoff))}return m}};class p2{constructor(i,r,a,n){this.p=new e4(i,r),this.h=a,this.d=function(i,r){let a=!1,n=1/0;for(let o=0;o<r.length;o++){let s=r[o];for(let r=0,o=s.length,l=o-1;r<o;l=r++){let o=s[r],h=s[l];o.y>i.y!=h.y>i.y&&i.x<(h.x-o.x)*(i.y-o.y)/(h.y-o.y)+o.x&&(a=!a),n=Math.min(n,lz(i,o,h))}}return(a?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}let p3=Object.keys,p5=1/0,p4=Math.sqrt(2);function p6(i,r,a,n,o,s){let l=pb(i)&&i.collisionPadding?i.collisionPadding:[0,0,0,0],h={top:i.top-l[1],bottom:i.bottom+l[3],left:i.left-l[0],right:i.right+l[2],scaled:!1};return void 0!==n&&(h.top*=n,h.bottom*=n,h.left*=n,h.right*=n,h.scaled=!0),s&&(h.left+=s[0],h.right+=s[0],h.top+=s[1],h.bottom+=s[1]),a&&function(i,r,a){if(!r)return;let n=r*e8,o=new e4(a?a[0]:0,a?a[1]:0),s=new e4(i.left,i.top),l=new e4(i.right,i.top),h=new e4(i.left,i.bottom),u=new e4(i.right,i.bottom);s._rotateAround(n,o),l._rotateAround(n,o),h._rotateAround(n,o),u._rotateAround(n,o),i.left=Math.min(s.x,l.x,h.x,u.x),i.right=Math.max(s.x,l.x,h.x,u.x),i.top=Math.min(s.y,l.y,h.y,u.y),i.bottom=Math.max(s.y,l.y,h.y,u.y)}(h,a,o),r?{top:Math.min(r.top,h.top),bottom:Math.max(r.bottom,h.bottom),left:Math.min(r.left,h.left),right:Math.max(r.right,h.right),scaled:r.scaled||h.scaled}:h}function p8(i,[r,a]){let n=0,o=0;if(a===p5){r<0&&(r=0);let a=r/p4;switch(i){case"top-right":case"top-left":o=a-7;break;case"bottom-right":case"bottom-left":o=7-a;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(i){case"top-right":case"bottom-right":n=-a;break;case"top-left":case"bottom-left":n=a;break;case"left":n=r;break;case"right":n=-r}}else{switch(r=Math.abs(r),a=Math.abs(a),i){case"top-right":case"top-left":case"top":o=a-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-a}switch(i){case"top-right":case"bottom-right":case"right":n=-r;break;case"top-left":case"bottom-left":case"left":n=r}}return[n,o]}function p9(i,r,a,n,o,s,l,h){let u=i.hasLayoutProperty("icon-offset")?r.getAppearanceValueAndResolveTokens(i,"icon-offset",a,n,[]):null,c=u&&Array.isArray(u)?u:o,d=i.hasLayoutProperty("icon-rotate")?r.getAppearanceValueAndResolveTokens(i,"icon-rotate",a,n,[]):null,p=i.hasLayoutProperty("icon-size")?r.getAppearanceValueAndResolveTokens(i,"icon-size",a,n,[]):null;return{appearanceIconOffset:c,appearanceIconRotate:"number"==typeof d?d:s,appearanceIconSize:"number"==typeof p?p*h:l}}function p7(i,r,a,n,o,s,l){let h=i.hasLayoutProperty("text-offset")?r.getAppearanceValueAndResolveTokens(i,"text-offset",a,n,[]):null,u=h&&Array.isArray(h)?[24*h[0],24*h[1]]:o,c=i.hasLayoutProperty("text-rotate")?r.getAppearanceValueAndResolveTokens(i,"text-rotate",a,n,[]):null,d=i.hasLayoutProperty("text-size")?r.getAppearanceValueAndResolveTokens(i,"text-size",a,n,[]):null;return{appearanceTextOffset:u,appearanceTextRotate:"number"==typeof c?c:s,appearanceTextSize:"number"==typeof d?d:l}}function fe(i,r,a,n,o,s,l,h,u){if(!r||!r.usvg)return;let c=pE(n),d=pE(o),p=("both"===s||"width"===s)&&pS(n)?d.width/c.width:1,f=("both"===s||"height"===s)&&pI(n)?d.height/c.height:1;a.scaleSelf(p,f);let m=a.toString();l.set(m,a),h.set(m,r);let{imagePosition:_}=pU(m,r,1);u.set(m,_)}function ft(i,r,a,n,o,s,l,h,u,c){var d,p,f,m,_,g,y;if(!i)return;let x=(d=r,p=a,f=n,m=o,_=s,g=u,y=c,"camera"===d.kind?d.maxSize:"composite"===d.kind?Math.max(p.possiblyEvaluate(new nH(d.maxZoom,{worldview:g}),f,y).evaluate(_,{},f,y),p.possiblyEvaluate(new nH(d.minZoom,{worldview:g}),f,y).evaluate(_,{},f,y)):p.possiblyEvaluate(new nH(m,{worldview:g}),f,y).evaluate(_,{},f,y));return i.scaleSelf(x*h*l)}function fi(i,r,a,n,o,s,l,h,u,c){return{iconPrimary:ft(i.getPrimary(),r,a,n,o,s,l,h,u,c),iconSecondary:ft(i.getSecondary(),r,a,n,o,s,l,h,u,c)}}function fr(i,r,a,n){if(!i)return;let o=r.get(a.toString());o&&(i.imagePrimary=o),n&&(i.imageSecondary=r.get(n.toString()))}function fa(i,r){if(i){for(let a of i.positionedLines)for(let i of a.positionedGlyphs)if(null!==i.image){let a=i.image.toString();i.rect=r.get(a).paddedRect}}}function fn(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function fo(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=p0(0,n,u,s,l,h,o,i.allowVerticalPlacement,void 0,_.textScaleFactor),w=s.layout.get("text-size").evaluate(h,{},y),T=_.compositeTextSizes?_.compositeTextSizes[0].evaluate(h,{},y):0,S=_.compositeTextSizes?_.compositeTextSizes[1].evaluate(h,{},y):0,I=fs(i.layerIds[0],i.textSizeData,w,_.textScaleFactor,T,S);for(let n of(i.addSymbols(i.text,b,I,u,l,h,d,r,a,c.lineStartIndex,c.lineLength,m,g,y,v,!1,x,b.length),p))f[n]=i.text.placedSymbolArray.length-1;return 4*b.length}function fs(i,r,a,n,o,s){let l=null;return"source"===r.kind?(l=[128*a*n])[0]>32640&&t_(`${i}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===r.kind&&((l=[128*o*n,128*s*n])[0]>32640||l[1]>32640)&&t_(`${i}: Value for "text-size" is >= 255. Reduce your "text-size".`),l}function fl(i){for(let r in i)return i[r];return null}function fh(i,r,a,n,o,s,l,h,u,c,d){let p,f,m,_;if(p=d?d.top:l.top,f=d?d.bottom:l.bottom,m=d?d.left:l.left,_=d?d.right:l.right,pb(l)&&l.collisionPadding){let i=l.collisionPadding;m-=i[0],p-=i[1],_+=i[2],f+=i[3]}if(u){let i=new e4(m,p),r=new e4(_,p),a=new e4(m,f),n=new e4(_,f),o=u*e8,s=new e4(0,0);
7c&&(s=new e4(c[0],c[1])),i._rotateAround(o,s),r._rotateAround(o,s),a._rotateAround(o,s),n._rotateAround(o,s),m=Math.min(i.x,r.x,a.x,n.x),_=Math.max(i.x,r.x,a.x,n.x),p=Math.min(i.y,r.y,a.y,n.y),f=Math.max(i.y,r.y,a.y,n.y)}return i.emplaceBack(r.x,r.y,r.z,a.x,a.y,m,p,_,f,h,n,o,s),i.length-1}function fu(i){pb(i)&&i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);let r=i.bottom-i.top;return r>0?Math.max(10,r):null}function fc(i,r){let a=i.fovAboveCenter,n=Math.min(i.elevation?i.elevation.getMinElevationBelowMSL()*r:0,i.isOrthographic?-10*r:0),o=(i._camera.position[2]*i.worldSize-n)/Math.cos(i._pitch),s=Math.sin(a)*o/Math.sin(Math.max(Math.PI/2-i._pitch-a,.01)),l=Math.sin(i._pitch)*s+o,h=o*(1/i._horizonShift);if(!i.elevation||0===i.elevation.exaggeration()){let r=Math.max(i.zoom-17,0);i.isOrthographic&&(r/=10),l*=1+r}return Math.min(1.01*l,h)}function fd(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<<i.z,x:i.x,y:i.y,x2:i.x+1,y2:i.y+1,projection:r};let a=Math.pow(2,-i.z),n=i.x*a,o=(i.x+1)*a,s=i.y*a,l=(i.y+1)*a,h=s0(n),u=s0(o),c=s1(s),d=s1(l),p=r.project(h,c),f=r.project(u,c),m=r.project(u,d),_=r.project(h,d),g=Math.min(p.x,f.x,m.x,_.x),y=Math.min(p.y,f.y,m.y,_.y),x=Math.max(p.x,f.x,m.x,_.x),v=Math.max(p.y,f.y,m.y,_.y),b=a/16;function w(i,a,n,o,s,l){let h=(n+s)/2,u=(o+l)/2,c=r.project(s0(h),s1(u)),d=Math.max(0,g-c.x,y-c.y,c.x-x,c.y-v);g=Math.min(g,c.x),x=Math.max(x,c.x),y=Math.min(y,c.y),v=Math.max(v,c.y),d>b&&(w(i,c,n,o,h,u),w(c,a,h,u,s,l))}w(p,f,n,s,o,s),w(f,m,o,s,o,l),w(m,_,o,l,n,l),w(_,p,n,l,n,s),g-=b,y-=b,x+=b,v+=b;let T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}function fp(i,{x:r,y:a},n=0){return new e4(((r-n)*i.scale-i.x)*8192,(a*i.scale-i.y)*8192)}let ff=ee(new Float32Array(16));class fm{constructor(i){this.spec=i,this.name=i.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(i,r){return{x:0,y:0,z:0}}unproject(i,r){return new sX(0,0)}projectTilePoint(i,r,a){return{x:i,y:r,z:0}}locationPoint(i,r,a,n=!0){return i._coordinatePoint(i.locationCoordinate(r,a),n)}pixelsPerMeter(i,r){return 1/sK(i)*r}pixelSpaceConversion(i,r,a){return 1}farthestPixelDistance(i){return fc(i,i.pixelsPerMeter)}pointCoordinate(i,r,a,n){let o=new e4(r,Math.max(i.horizonLineFromTop(!1),a));return i.rayIntersectionCoordinate(i.pointRayIntersection(o,n))}pointCoordinate3D(i,r,a){let n=new e4(r,a);if(i.elevation)return i.elevation.pointCoordinate(n);{let r=this.pointCoordinate(i,n.x,n.y,0);return[r.x,r.y,r.z]}}isPointAboveHorizon(i,r){if(i.elevation&&i.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(i,r.x,r.y);let a=i.horizonLineFromTop();return r.y<a}createInversionMatrix(i,r){return ff}createTileMatrix(i,r,a){let n,o,s,l=a.canonical,h=ee(new Float64Array(16));if(this.isReprojectedInTileSpace){let u=fd(l,this);n=1,o=u.x+a.wrap*u.scale,s=u.y,ea(h,h,[n/u.scale,n/u.scale,i.pixelsPerMeter/r])}else n=r/i.zoomScale(l.z),o=(l.x+Math.pow(2,l.z)*a.wrap)*n,s=l.y*n;return er(h,h,[o,s,0]),ea(h,h,[n/8192,n/8192,1]),h}upVector(i,r,a){return[0,0,1]}upVectorScale(i,r,a){return{metersToTile:1}}}class f_ extends fm{constructor(i){super(i),this.range=[4,7],this.center=i.center||[-96,37.5];const[r,a]=this.parallels=i.parallels||[29.5,45.5],n=Math.sin(r*e8);this.n=(n+Math.sin(a*e8))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n}project(i,r){let{n:a,c:n,r0:o}=this,s=(i-this.center[0])*e8,l=Math.sqrt(n-2*a*Math.sin(r*e8))/a;return{x:l*Math.sin(s*a),y:l*Math.cos(s*a)-o,z:0}}unproject(i,r){let{n:a,c:n,r0:o}=this,s=o+r,l=Math.atan2(i,Math.abs(s))*Math.sign(s);s*a<0&&(l-=Math.PI*Math.sign(i)*Math.sign(s));let h=this.center[0]*e8*a,u=tr((l=tn(l,-Math.PI-h,Math.PI-h))/a*e9+this.center[0],-180,180),c=Math.asin(tr((n-(i*i+s*s)*a*a)/(2*a),-1,1));return new sX(u,tr(c*e9,-85.051129,85.051129))}}let fg=Math.sqrt(3)/2;class fy extends fm{project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;let a=Math.asin(fg*Math.sin(r)),n=a*a,o=n*n*n;return{x:.5*(i*Math.cos(a)/(fg*(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))
7)/Math.PI+.5),y:1-.5*(a*(1.340264+-.081106*n+o*(893e-6+.003796*n))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let a=r=(2*(1-r)-1)*Math.PI,n=a*a,o=n*n*n;for(let i,s,l=0;l<12&&(s=a*(1.340264+-.081106*n+o*(893e-6+.003796*n))-r,o=(n=(a=tr(a-(i=s/(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))),-Math.PI/3,Math.PI/3))*a)*n*n,!(1e-12>Math.abs(i)));++l);let s=fg*i*(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))/Math.cos(a),l=Math.asin(Math.sin(a)/fg);return new sX(tr(180*s/Math.PI,-180,180),tr(180*l/Math.PI,-85.051129,85.051129))}}class fx extends fm{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){return{x:.5+i/360,y:.5-r/360,z:0}}unproject(i,r){return new sX(360*(i-.5),tr(360*(.5-r),-85.051129,85.051129))}}let fv=Math.PI/2;function fb(i){return Math.tan((fv+i)/2)}class fw extends fm{constructor(i){super(i),this.center=i.center||[0,30];const[r,a]=this.parallels=i.parallels||[30,30];let n=r*e8,o=a*e8;this.southernCenter=n+o<0,this.southernCenter&&(n=-n,o=-o);const s=Math.cos(n),l=fb(n);this.n=n===o?Math.sin(n):Math.log(s/Math.cos(o))/Math.log(fb(o)/l),this.f=s*Math.pow(fb(n),this.n)/this.n}project(i,r){r*=e8,this.southernCenter&&(r=-r),i=(i-this.center[0])*e8;let{n:a,f:n}=this;n>0?r<-fv+1e-6&&(r=-fv+1e-6):r>fv-1e-6&&(r=fv-1e-6);let o=n/Math.pow(fb(r),a),s=o*Math.sin(a*i),l=n-o*Math.cos(a*i);return s=.5*(s/Math.PI+.5),l=.5*(l/Math.PI+.5),{x:s,y:this.southernCenter?l:1-l,z:0}}unproject(i,r){i=(2*i-.5)*Math.PI,this.southernCenter&&(r=1-r);let{n:a,f:n}=this,o=n-(r=(2*(1-r)-.5)*Math.PI),s=Math.sign(o),l=Math.sign(a)*Math.sqrt(i*i+o*o),h=Math.atan2(i,Math.abs(o))*s;o*a<0&&(h-=Math.PI*Math.sign(i)*s);let u=tr(h/a*e9+this.center[0],-180,180),c=tr((2*Math.atan(Math.pow(n/l,1/a))-fv)*e9,-85.051129,85.051129);return new sX(u,this.southernCenter?-c:c)}}class fT extends fm{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(i,r){return{x:sJ(i),y:sQ(r),z:0}}unproject(i,r){return new sX(s0(i),s1(r))}}let fS=85.051129*e8;class fI extends fm{project(i,r){let a=(r*=e8)*r,n=a*a;return{x:.5*((i*=e8)*(.8707-.131979*a+n*(n*(.003971*a-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+a*(.015085+n*(.028874*a-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let a=r=(2*(1-r)-1)*Math.PI,n=25,o=0,s=a*a;do{let i=(s=a*a)*s;o=(a*(1.007226+s*(.015085+i*(.028874*s-.044475-.005916*i)))-r)/(1.007226+s*(.045255+i*(.259866*s-.311325-.005916*11*i))),a=tr(a-o,-fS,fS)}while(Math.abs(o)>1e-6&&--n>0);return new sX(tr(i/(.8707+(s=a*a)*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))*e9,-180,180),a*e9)}}let fE=85.051129*e8;class fA extends fm{project(i,r){r*=e8,i*=e8;let a=Math.cos(r),n=Math.acos(a*Math.cos(i/2)),o=Math.sin(n)/n;return{x:.5*((.5*(2/Math.PI*i+2*a*Math.sin(i/2)/o)||0)/Math.PI+.5),y:1-.5*((.5*(r+Math.sin(r)/o)||0)/Math.PI+1),z:0}}unproject(i,r){let a=i=(2*i-.5)*Math.PI,n=r=(2*(1-r)-1)*Math.PI,o=25,s=0,l=0;do{let o=Math.cos(n),h=Math.sin(n),u=2*h*o,c=h*h,d=o*o,p=Math.cos(a/2),f=Math.sin(a/2),m=2*p*f,_=f*f,g=1-d*p*p,y=g?1/g:0,x=g?Math.acos(o*p)*Math.sqrt(1/g):0,v=.5*(2*x*o*f+2*a/Math.PI)-i,b=.5*(x*h+n)-r,w=.5*y*(d*_+x*o*p*c)+1/Math.PI,T=y*(m*u/4-x*h*f),S=.125*y*(u*f-x*h*d*m),I=.5*y*(c*p+x*_*o)+.5,E=T*S-I*w;s=(b*T-v*I)/E,l=(v*S-b*w)/E,a=tr(a-s,-Math.PI,Math.PI),n=tr(n-l,-fE,fE)}while((Math.abs(s)>1e-6||Math.abs(l)>1e-6)&&--o>0);return new sX(a*e9,n*e9)}}class fC extends fm{constructor(i){super(i),this.center=i.center||[0,0],this.parallels=i.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*e8)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){let{scale:a,cosPhi:n}=this;return{x:i*e8*n*a+.5,y:-Math.sin(r*e8)/n*a+.5,z:0}}unproject(i,r){let{scale:a,cosPhi:n}=this,o=tr((i-.5)/a*e9/n,-180,180),s=Math.asin(tr(-(r-.5)/a*n,-1,1));return new sX(o,tr(s*e9,-85.051129,85.051129))}}class fM extends fT{constructor(i){super(i),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(i,r,a){let n=ht(i,r,a);return eR(n,n,ha(l5(a))),{x:n[0],y:n[1],z:n[2]}}locationPoint(i,r,a){let n=sZ(r.lat,r.lng),o=eC([],n),s=a?i._centerAltitude+a:i.elevation?i.elevation.getAtPointOrZero(i.locationCoordinate(r),i._centerAltitude):i._centerAltitude;eT(n,n,o,1/sK(0)*8192*s);let l=ee(new Float64Array(16));return ei(l,i.pixelMatrix,i.globeMatrix),eR(n,n,l),new e4(n[0],n[1])}pixelsPerMeter(i,r){return 1/sK(0)*r}pixelSpaceConversion(i,r,a){let n=1/sK(i)*r,o=iv(1/sK(45)*r,n,a);return this.pixelsPerMeter(i,r)/o}createTileMatrix(i,r,a){let n=hn(l5(a.canonical));return ei(new Float64Array(16),i.globeMatrix,n)}createInversionMatrix(i,r){let{center:a}=i,n=ha(l5(r));return eo(n,n,a.lng*e8),en(n,n,a.lat*e8),ea(n,n,[i._pixelsPerMercatorPixel,i._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(i,r,a,n){return l1(i,r,a,!0)||new s8(0,0)}pointCoordinate3D(i,r,a){let n=this.pointCoordinate(i,r,a,0);return[n.x,n.y,n.z]}isPointAboveHorizon(i,r){return!l1(i,r.x,r.y,!1)}farthestPixelDistance(i){let r=function(i,r){let a,n=i.cameraToCenterDistance,o=i._centerAltitude*r,s=i._camera,l=i._camera.forward(),h=eg([],ew([],l,-n),[0,0,o]),u=i.worldSize/(2*Math.PI),c=[0,0,-u],d=i.width/i.height,p=Math.tan(i.fovAboveCenter),f=ew([],s.up(),p),m=ew([],s.right(),p*d),_=eC([],eg([],eg([],l,f),m)),g=[];if(new l_(h,_).closestPointOnSphere(c,u,g)){let r=ey([],eg([],g,c),h);a=Math.cos(i.fovAboveCenter)*ef(r)}else{let i=ey([],h,c),r=ey([],c,h);eC(r,r);let n=ef(i)-u,o=Math.acos((a=Math.sqrt(n*(n+2*u)))/(u+n))-Math.acos(eM(l,r));a*=Math.cos(o)}return 1.01*a}(i,this.pixelsPerMeter(i.center.lat,i.worldSize)),a=hh(i.zoom);return a>
70?iv(r,fc(i,1/sK(i.center.lat)*i.worldSize)+i.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(i.width,i.height)/i.worldSize*Math.PI)),Math.pow(a,10)):r}upVector(i,r,a){return ht(r,a,i,1)}upVectorScale(i){return{metersToTile:lQ(hi(l5(i)))}}}function fP(i){let r=i.parallels,a=!!r&&.01>Math.abs(r[0]+r[1]);switch(i.name){case"mercator":return new fT(i);case"equirectangular":return new fx(i);case"naturalEarth":return new fI(i);case"equalEarth":return new fy(i);case"winkelTripel":return new fA(i);case"albers":return a?new fC(i):new f_(i);case"lambertConformalConic":return a?new fC(i):new fw(i);case"globe":return new fM(i)}throw Error(`Invalid projection name: ${i.name}`)}class fD{constructor(i,r){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=r,this.appearances=i;const a=i.map(i=>(function(i){if(!i.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};let r=i.condition.expression;return{featureDependent:!rH(r),stateDependent:!rZ(r),zoomDependent:!rW(r,["zoom"]),pitchDependent:!rW(r,["pitch"]),brightnessDependent:!rW(r,["brightness","measure-light"]),worldviewDependent:!rW(r,["worldview"])}})(i));this.anyFeatureDependent=a.some(i=>i.featureDependent),this.anyStateDependent=a.some(i=>i.stateDependent)}update(i,r){let a=this.lastParams,n=!a||a.zoom!==i.zoom||a.pitch!==(i.pitch||0)||a.brightness!==(i.brightness||0)||a.worldview!==i.worldview;this.lastParams={zoom:i.zoom,pitch:i.pitch||0,brightness:i.brightness||0,worldview:i.worldview};let o=r&&this.anyStateDependent;if(!n&&!o&&-2!==this.lastAllFeaturesIndex)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!o){let r=this.evaluateAllFeatures(i);return r===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=r,{kind:"all-features",appearanceIndex:r})}return{kind:"per-feature"}}evaluateAllFeatures(i){for(let r=0;r<this.appearances.length;r++){let a=this.appearances[r];if(a.condition&&a.condition.evaluate(i,void 0,void 0,void 0))return r}return -1}}let fR=li.types,fL=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function fz(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=h?Math.min(32640,Math.round(h[0])):0,_=h?Math.min(32640,Math.round(h[1])):0;i.emplaceBack(r,a,Math.round(32*n),Math.round(32*o),s,l,(m<<1)+ +!!u,0+(_<<1),16*c,16*d,256*p,256*f)}function fF(i,r,a){i.emplaceBack(r,a)}function fO(i,r,a,n,o,s,l){i.emplaceBack(r,a,n,o,s,l)}let fB=(i,r,a,n)=>{for(let o=0;o<r;o++)i.emplaceBack(a[0],a[1],a[2],n[0],n[1],n[2])};function fk(i,r,a,n,o){i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o)}class fV{constructor(i){this.layoutVertexArray=new oL,this.indexArray=new oj,this.programConfigurations=i,this.segments=new sh,this.dynamicLayoutVertexArray=new oF,this.opacityVertexArray=new oO,this.placedSymbolArray=new o6,this.iconTransitioningVertexArray=new oB,this.globeExtVertexArray=new oz,this.zOffsetVertexArray=new oT,this.orientationVertexArray=new o$,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new oT,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}getBatchGrouping(i){let r=i.get().length===this.segments.get().length;if(r&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};let a=new Map;for(let r of i.get()){let i=void 0!==r.batchIndex?r.batchIndex:0;a.has(i)||a.set(i,[]),a.get(i).push(r)}let n=Array.from(a.keys()).sort((i,r)=>i-r),o=new Map;for(let i of n){let r=a.get(i);o.set(i,new sh(r))}return r&&(this.cachedBatchIndices=n,this.cachedBatchSegments=o),{batchIndices:n,batchSegments:o}}snapshotSymbolVertexData(i,r){let a=12*i;return this.layoutVertexArray.uint16.slice(a,a+12*r)}restoreSymbolVertexData(i,r){this.layoutVertexArray.uint16.set(r,12*i)}updateSymbolVertexData(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=this.layoutVertexArray.uint16,_=12*i;m[_]=r,m[_+1]=a,m[_+2]=n,m[_+3]=o,m[_+4]=s,m[_+5]=l,m[_+6]=h,m[_+7]=u,m[_+8]=c,m[_+9]=d,m[_+10]=p,m[_+11]=f}upload(i,r,a,n,o,s){this.isEmpty()||(a&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,dG.members,!!s),this.indexBuffer=i.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,d$.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,fL,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=i.createVertexBuffer(this.iconTransitioningVertexArray,dX.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,dq.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||o)&&(this.zOffsetVertexBuffer=i.createVertexBuffer(this.zOffsetVertexArray,dH.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=i.createVertexBuffer(this.orientationVertexArray,dW.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray&&this.featureIdArray.length>0&&(this.featureIdBuffer=i.createVertexBuffer(this.featureIdArray,dZ.members,!1))),(a||n)&&(this.programConfigurations.upload(i),this.uboBinder&&this.uboBinder.upload(i)))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy(),this.featureIdBuffer&&this.featureIdBuffer.destroy(),this.uboBinder&&this.uboBinder.destroy())}}ne(fV,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class fN{constructor(i,r,a){this.layoutVertexArray=new i,this.layoutAttributes=r,this.indexArray=new a,this.segments=new sh,this.collisionVertexArray=new oU,this.collisionVertexArrayExt=new oF}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,dY.members,!0),this.collisionVertexBufferExt=i.createVertexBuffer(this.collisionVertexArrayExt,dK.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}ne(fN,"CollisionBuffers");class fU{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ee([]),this.placementViewportMatrix=ee([]);const r=this.layers[0]._unevaluatedLayout._values;this.worldview=i.worldview,this.localizable=i.localizable,this.maxUniformBufferBindings=i.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=i.maxUniformBlockSizeDwords,this.disableSymbolUBO=i.disableSymbolUBO,this.textSizeData=pA(this.zoom,r["text-size"],this.worldview,i.availableImages),this.iconSizeData=pA(this.zoom,r["icon-size"],this.worldview,i.availableImages);const a=this.layers[0].layout,n=a.get("symbol-sort-key"),o=a.get("symbol-z-order");this.lut=i.lut,this.canOverlap=a.get("text-allow-overlap")||a.get("icon-allow-overlap")||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=a.get("text-writing-mode").map(i=>pu[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID,this.projection=i.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.featureAppearances=null,this.featureAppearanceData=new Map}hasAnyAppearanceLayoutProperty(i){let r=this.layers[0].getAppearances();if(!r||0===r.length)return!1;let a=Array.isArray(i)?i:[i];return r.some(i=>a.some(r=>i.hasLayoutProperty(r)))}getAppearanceFeatureData(i){return this.featureAppearanceData.get(i)}createArrays(){this.text=new fV(new sk(this.layers,{zoom:this.zoom,lut:this.lut},i=>i.startsWith("text")||i.startsWith("symbol"))),this.icon=new fV(new sk(this.layers,{zoom:this.zoom,lut:this.lut},i=>i.startsWith("icon")||i.startsWith("symbol"))),this.disableSymbolUBO||(this.text.uboBinder=new d3(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new d3(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords)),this.glyphOffsetArray=new o7,this.lineVertexArray=new se,this.symbolInstances=new o9}calculateGlyphDependencies(i,r,a,n,o){for(let a of i){let i=a.codePointAt(0);if(void 0===i)break;if(r[i]=!0,n&&o&&i<=65535){let i=d5[a];i&&(r[i.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(i,r,a,n,o,s,l){if(!i.hasLayoutProperty("icon-size"))return l*s;let h=1,u=i.getUnevaluatedLayoutProperty("icon-size"),c=pA(this.zoom,u,this.worldview,o),d=pM(c,r);if("constant"!==c.kind&&"camera"!==c.kind||(h=d.uSize),"composite"===c.kind){let{minZoom:i,maxZoom:r}=c,s=u.possiblyEvaluate(new nH(i,{worldview:this.worldview}),n),l=u.possiblyEvaluate(new nH(r,{worldview:this.worldview}),n),p=s.evaluate(a,{},n,o);h=p+(l.evaluate(a,{},n,o)-p)*d.uSizeT}return"source"===c.kind&&(h=u.possiblyEvaluate(new nH(this.zoom,{worldview:this.worldview}),n).evaluate(a,{},n,o)),h*s}updateFootprints(i,r){}updateReplacement(i,r){if(r.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=r.updateTime;let a=r.getReplacementRegionsForTile(i.toUnwrapped(),!0);return!uG(this.activeReplacements,a)&&(this.activeReplacements=a,!0)}getResolvedImageFromTokens(i){return"string"==typeof i?iH.build(i):i}populate(i,r,a,n){let o=this.layers[0],s=o.layout,l="globe"===this.projection.name,h=s.get("text-font"),u=s.get("text-field"),c=s.get("icon-image"),[d,p]=s.get("icon-size-scale-range"),f=tr(r.scaleFactor||1,d,p),[m,_]=s.get("text-size-scale-range"),g=tr(r.scaleFactor||1,m,_),y=("constant"!==u.value.kind||u.value.value instanceof iq&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==h.value.kind||h.value.value.length>0),x="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,v=this.hasAnyAppearanceLayoutProperty("icon-image"),b=s.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!y&&!x&&!v)return;let w=r.iconDependencies,T=r.glyphDependencies,S=r.availableImages,I=new nH(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),E=i=>{let r=i.id.toString();w.has(r)?w.get(r).push(i):w.set(r,[i])};for(let r of i){let i,u,{feature:c,id:d,index:p,sourceLayerIndex:m}=r,_=o._featureFilter.needGeometry,A=lt(c,_);if(!o._featureFilter.filter(I,A,a))continue;if(_||(A.geometry=le(c,a,n)),l&&1!==c.type&&a.z<=5){let i=A.geometry,r=(i,r)=>.98078528056>eM(ht(i.x,i.y,a,1),ht(r.x,r.y,a,1));for(let a=0;a<i.length;a++)i[a]=function(i,r){let a=i[0],n=[a];for(let o=1;o<i.length;o++){let s=i[o];
7(function i(r,a,n,o){if(o(a,n)){let s=a.add(n)._mult(.5);i(r,a,s,o),i(r,s,n,o)}else r.push(n)})(n,a,s,r),a=s}return n}(i[a],r)}if(y){let r=o.getValueAndResolveTokens("text-field",A,a,S),n=iq.factory(r);(function(i){for(let r of i.sections)if(function(i){for(let r of i)if(nz(r.charCodeAt(0)))return!0;return!1}(r.text))return!0;return!1})(n)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nj()||this.hasRTLText&&nq.isParsed())&&(i=function(i,r,a){return i.sections.forEach(i=>{var n;let o;n=i.text,"uppercase"===(o=r.layout.get("text-transform").evaluate(a,{}))?n=n.toLocaleUpperCase():"lowercase"===o&&(n=n.toLocaleLowerCase()),nq.applyArabicShaping&&(n=nq.applyArabicShaping(n)),i.text=n}),i}(n,o,A))}if(x){let i=o.getValueAndResolveTokens("icon-image",A,a,S);u=this.getResolvedImageFromTokens(i)}let C=this.layers[0],M=!1;if(!u&&v){for(let i of C.getAppearances())if(i.getLayoutProperty("icon-image")){let r=C.getAppearanceValueAndResolveTokens(i,"icon-image",A,a,S);if(r){u=this.getResolvedImageFromTokens(r),M=!0;break}}}if(!i&&!u)continue;let P=this.sortFeaturesByKey?b.evaluate(A,{},a):void 0,D={id:d,text:i,icon:u,index:p,sourceLayerIndex:m,geometry:A.geometry,properties:c.properties,type:fR[c.type],sortKey:P};if(this.features.push(D),this.featureAppearanceData.set(p,{id:d,properties:c.properties,usesAppearanceIconAsPlaceholder:M,isUsingAppearanceIconVertexData:!1,isUsingAppearanceTextVertexData:!1,layoutBasedIconVertexData:new Uint16Array(0),layoutBasedTextVertexData:new Uint16Array(0),activeAppearanceIndex:-2}),u){let i=C._unevaluatedLayout._values,{iconPrimary:r,iconSecondary:n}=fi(u,this.iconSizeData,i["icon-size"],a,this.zoom,D,this.pixelRatio,f,this.worldview,S);E(r),n&&(this.hasAnySecondaryIcon=!0,E(n))}let R=C.getAppearances();if(0!==R.length&&R.forEach(i=>{if(!i.getLayoutProperty("icon-image"))return;let r=this.getCombinedIconPrimary(i,C,A,a,S,D,f);r&&E(r)}),i){let r=h.evaluate(A,{},a).join(","),n="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let a of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(pu.vertical)>=0,i.sections))if(a.image){let i=a.image.getPrimary().scaleSelf(this.pixelRatio*g),r=i.id.toString(),n=w.get(r)||[];n.push(i),w.set(r,n)}else{let o=nD(i.toString()),s=a.fontStack||r,l=T[s]=T[s]||{};this.calculateGlyphDependencies(a.text,l,n,this.allowVerticalPlacement,o)}}}if("line"===s.get("symbol-placement")&&(this.features=function(i){let r={},a={},n=[],o=0;function s(r){n.push(i[r]),o++}function l(i,r,o){let s=a[i];return delete a[i],a[r]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(o[0]),s}function h(i,a,o){let s=r[a];return delete r[a],r[i]=s,n[s].geometry[0].shift(),n[s].geometry[0]=o[0].concat(n[s].geometry[0]),s}function u(i,r,a){let n=a?r[0][r[0].length-1]:r[0][0];return`${i}:${n.x}:${n.y}`}for(let c=0;c<i.length;c++){let d=i[c],p=d.geometry,f=d.text?d.text.toString():null;if(!f){s(c);continue}let m=u(f,p),_=u(f,p,!0);if(m in a&&_ in r&&a[m]!==r[_]){let i=h(m,_,p),o=l(m,_,n[i].geometry);delete r[m],delete a[_],a[u(f,n[o].geometry,!0)]=o,n[i].geometry=null}else m in a?l(m,_,p):_ in r?h(m,_,p):(s(c),r[m]=o-1,a[_]=o-1)}return n.filter(i=>i.geometry)}(this.features)),"hd-road-markup"===s.get("symbol-elevation-reference")){if(this.elevationType="road",r.elevationFeatures)for(let i of(!this.elevationFeatures&&r.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map),r.elevationFeatures))this.elevationFeatureIdToIndex.set(i.id,this.elevationFeatures.length),this.elevationFeatures.push(i)}else s.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}getCombinedIconPrimary(i,r,a,n,o,s,l){let h,u;if(i.hasLayoutProperty("icon-image")){let s=r.getAppearanceValueAndResolveTokens(i,"icon-image",a,n,o);h=this.getResolvedImageFromTokens(s)}else{let i=r.getValueAndResolveTokens("icon-image",a,n,o);h=this.getResolvedImageFromTokens(i)}if(h){let a=i.hasLayoutProperty("icon-size")?i.getUnevaluatedLayoutProperty("icon-size"):r._unevaluatedLayout._values["icon-size"];u=fi(h,pA(this.zoom,a,this.worldview,o),a,n,this.zoom,s,this.pixelRatio,l,this.worldview,o).iconPrimary}return u}updateSymbolInstanceIconVertices(i,r,a,n,o,s){let{canonical:l,availableImages:h,globalProperties:u,layer:c,iconScaleFactor:d,featureState:p,layoutIconOffset:f,layoutIconSize:m,layoutIconRotate:_}=s;if(i.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(r.activeAppearanceIndex===a)return{vertexOffsetDelta:i.numIconVertices,hasChanges:!1};let g=a>=0?c.appearances[a]:null;if(g){let a=this.getCombinedIconPrimary(g,c,n,l,h,{sortKey:void 0,text:void 0,icon:null,index:i.featureIndex,sourceLayerIndex:i.featureIndex,geometry:[],properties:r.properties,type:"Point",id:r.id},d);if(!a)return{vertexOffsetDelta:0,hasChanges:!1};let s=a.toString(),y=this.iconAtlasPositions&&this.iconAtlasPositions.get(s);if(y){let{appearanceIconOffset:a,appearanceIconRotate:s}=p9(g,c,n,l,f,_,m,d),x=pw(y,void 0,a,c.layout.get("icon-anchor").evaluate(n,p,l)),v=y.sdf,b=c.layout.get("icon-text-fit").constantOr("none");"none"!==b&&r.textShaping&&r.iconTextFitPadding&&r.fontScale&&(x=pT(x,r.textShaping,b,r.iconTextFitPadding,a,r.fontScale));
7let w=1+(Math.min(32640,Math.round(128*this.calculateEffectiveAppearanceIconSize(g,u.zoom,n,l,h,d,m)))<<1),T=pY(x,s,v,"none"!==b,d);r.isUsingAppearanceIconVertexData||(r.isUsingAppearanceIconVertexData=!0,r.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(o,i.numIconVertices));let S=Math.floor(i.numIconVertices/4),I=Math.min(T.length,S),E=o;for(let a=0;a<I;++a){let n=T[a],o=r.layoutBasedIconVertexData[0]||i.tileAnchorX,s=r.layoutBasedIconVertexData[1]||i.tileAnchorY,l=16*n.pixelOffsetTL.x,h=16*n.pixelOffsetTL.y,u=16*n.pixelOffsetBR.x,c=16*n.pixelOffsetBR.y,d=16*n.minFontScaleX,p=16*n.minFontScaleY;this.icon.updateSymbolVertexData(E,o,s,Math.round(32*n.tl.x),Math.round(32*n.tl.y),n.texPrimary.x,n.texPrimary.y,0,w,l,h,d,p),this.icon.updateSymbolVertexData(E+1,o,s,Math.round(32*n.tr.x),Math.round(32*n.tr.y),n.texPrimary.x+n.texPrimary.w,n.texPrimary.y,0,w,u,h,d,p),this.icon.updateSymbolVertexData(E+2,o,s,Math.round(32*n.bl.x),Math.round(32*n.bl.y),n.texPrimary.x,n.texPrimary.y+n.texPrimary.h,0,w,l,c,d,p),this.icon.updateSymbolVertexData(E+3,o,s,Math.round(32*n.br.x),Math.round(32*n.br.y),n.texPrimary.x+n.texPrimary.w,n.texPrimary.y+n.texPrimary.h,0,w,u,c,d,p),E+=4}let A=i.numIconVertices-4*I;for(let i=0;i<A;++i)this.icon.updateSymbolVertexData(E+i,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:i.numIconVertices,hasChanges:!0}}}else{if(r.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(o,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:i.numIconVertices,hasChanges:!0};if(r.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(o,r.layoutBasedIconVertexData),r.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:r.layoutBasedIconVertexData.length/12,hasChanges:!0}}return{vertexOffsetDelta:i.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(i,r,a,n,o,s){let{canonical:l,layer:h,textScaleFactor:u,imageMap:c,featureState:d,layoutTextOffset:p,layoutTextSize:f,layoutTextRotate:m,layoutMinZoomSize:_,layoutMaxZoomSize:g,layoutTextSizeMinZoom:y,layoutTextSizeMaxZoom:x,availableImages:v}=s,b=i.numHorizontalGlyphVertices>0||i.numVerticalGlyphVertices>0;if(!b)return{vertexOffsetDelta:b?i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices:0,hasChanges:!1};if(r.activeAppearanceIndex===a)return{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!1};let w=a>=0?h.appearances[a]:null;if(w&&r.textShaping){let{appearanceTextOffset:a,appearanceTextRotate:s,appearanceTextSize:b}=p7(w,h,n,l,p,m,f);r.fontScale=b*r.textScaleFactor/24;let T=w.getUnevaluatedLayoutProperty("text-size"),S=this.textSizeData,I=y,E=x;w.hasLayoutProperty("text-size")&&(S=pA(this.zoom,T,this.worldview,v),I="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,E="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0);let A=r.textShaping.bottom-p[1],C=r.textShaping.left-p[0],M=r.textShaping.right-p[0];r.textShaping.top=a[1]+(r.textShaping.top-p[1]),r.textShaping.bottom=a[1]+A,r.textShaping.left=a[0]+C,r.textShaping.right=a[0]+M;let P=p0(0,r.textShaping,a,h,!1,n,c,this.allowVerticalPlacement,s),D=b&&"composite"===S.kind?T.possiblyEvaluate(new nH(I,{}),l).evaluate(n,d,l):_,R=b&&"composite"===S.kind?T.possiblyEvaluate(new nH(E,{}),l).evaluate(n,d,l):g,L=fs(w.name,S,b,u,D,R),z=1+(Math.min(32640,Math.round((Array.isArray(L)?L[1]:b)*128))<<1);r.isUsingAppearanceTextVertexData||(r.isUsingAppearanceTextVertexData=!0,r.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(o,i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices));for(let r=0;r<P.length&&r<(i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices)/4;++r){let a=P[r],n=a.glyphOffset[1],s=i.tileAnchorX,l=i.tileAnchorY,h=o+4*r;this.text.updateSymbolVertexData(h,s,l,Math.round(32*a.tl.x),Math.round(32*(n+a.tl.y)),a.texPrimary.x,a.texPrimary.y,0,z,a.pixelOffsetTL.x,a.pixelOffsetTL.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+1,s,l,Math.round(32*a.tr.x),Math.round(32*(n+a.tr.y)),a.texPrimary.x+a.texPrimary.w,a.texPrimary.y,0,z,a.pixelOffsetBR.x,a.pixelOffsetTL.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+2,s,l,Math.round(32*a.bl.x),Math.round(32*(n+a.bl.y)),a.texPrimary.x,a.texPrimary.y+a.texPrimary.h,0,z,a.pixelOffsetTL.x,a.pixelOffsetBR.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+3,s,l,Math.round(32*a.br.x),Math.round(32*(n+a.br.y)),a.texPrimary.x+a.texPrimary.w,a.texPrimary.y+a.texPrimary.h,0,z,a.pixelOffsetBR.x,a.pixelOffsetBR.y,a.minFontScaleX,a.minFontScaleY)}return{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!0}}return r.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(o,r.layoutBasedTextVertexData),r.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:r.layoutBasedTextVertexData.length/12,hasChanges:!0}):{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!1}}update(i,r,a,n,o,s,l,h){if(this.text.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),this.icon.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),h){if(s)this.text.uboBinder&&this.text.uboBinder.updateDynamicExpressions(o[0],r,h,a,i,l),this.icon.uboBinder&&this.icon.uboBinder.updateDynamicExpressions(o[0],r,h,a,i,l);else if(Object.keys(i).length>0){let n=new Set(Object.keys(i).map(i=>{let r=Number(i);return!isNaN(r)&&Number.isSafeInteger(r)&&String(r)===i?r:i}));this.text.uboBinder&&this.text.uboBinder.updateFeatures(n,o[0],r,h,a,i,l),this.icon.uboBinder&&this.icon.uboBinder.updateFeatures(n,o[0],r,h,a,i,l)}}}updateRoadElevation(i){if("road"!==this.elevationType||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let r=!1,a=s6(i),n=1/a,o=!1,s=!1;for(let i=0;i<this.symbolInstances.length;i++){let l=this.symbolInstances.get(i),h=em(1,0,0),u=em(0,1,0),{numHorizontalGlyphVertices:c,numVerticalGlyphVertices:d,numIconVertices:p,numVerticalIconVertices:f}=l,m=c>0||d>0,_=p>0,g=this.elevationFeatures[l.elevationFeatureIndex];if(g){let i=new e4(l.tileAnchorX,l.tileAnchorY),c=.075+g.pointElevation(i);l.zOffset!==c&&(r=!0,l.zOffset=c),0!==c&&(this.hasAnyZOffset=!0);let d=g.computeSlopeNormal(i,n),p=eW(eU(),em(0,0,1),d);ez(h,h,p),ez(u,u,p),h[2]*=a,u[2]*=a,1===h[0]&&0===h[1]&&0===h[2]&&0===u[0]&&1===u[1]&&0===u[2]||(o=o||m,s=s||_)}if(m&&(fB(this.text.orientationVertexArray,c,h,u),fB(this.text.orientationVertexArray,d,h,u)),_){let{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:r}=l;i>=0&&fB(this.icon.orientationVertexArray,p,h,u),r>=0&&fB(this.icon.orientationVertexArray,f,h,u)}}o||(this.text.orientationVertexArray=void 0),s||(this.icon.orientationVertexArray=void 0),r&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){let i=(i,r,n)=>{(a+=r)>i.length&&i.resize(a);for(let o=-r;o<0;o++)i.emplace(o+a,n)},r=(i,r,a)=>{(n+=r)>i.length&&i.resize(n);for(let o=-r;o<0;o++)i.emplace(o+n,a)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let a=0,n=0;for(let a=0;a<this.symbolInstances.length;a++){let n=this.symbolInstances.get(a),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,numIconVertices:l}=n,h=n.zOffset,u=l>0;if((o>0||s>0)&&(i(this.text.zOffsetVertexArray,o,h),i(this.text.zOffsetVertexArray,s,h)),u){let{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:a}=n;i>=0&&r(this.icon.zOffsetVertexArray,l,h),a>=0&&r(this.icon.zOffsetVertexArray,n.numVerticalIconVertices,h)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i,r,a,n,o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),null===this.hasAppearances&&(this.hasAppearances=this.layers.some(i=>i.appearances&&i.appearances.length>0)),this.icon.upload(i,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(i,r,a,n,o,s=!1){let l={hasLayoutChanges:!1,hasUboChanges:!1};if(!i||!a||!this.featureAppearanceData)return l;let h=r||{},u=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,c=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!u&&!c)return l;let d=this.layers[0],p=d.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===d.appearancesVersion||(this.featureAppearances=new fD(d.appearances,d.appearancesVersion));let f=this.featureAppearances.update(n,s);if("no-changes"===f.kind)return l;let m=1,_=0,g=!1,y=!1;if(u){let[i,r]=p.get("icon-size-scale-range");m=tr(1,i,r)}let x=1,v=0,b=!1;
7if(c){let[i,r]=p.get("text-size-scale-range");x=tr(1,i,r)}let w=new Map;if(o&&a)for(let i of a){let r=o.getImage(i,d.scope);if(r){let a=new i$(i.toString());w.set(a.toString(),r)}}for(let r=0;r<this.symbolInstances.length;r++){let o,s=this.symbolInstances.get(r),l=this.getAppearanceFeatureData(s.featureIndex);if(!l)continue;let T=l.id,S=void 0!==T?h[String(T)]:void 0,I={type:"Point",id:l.id,properties:l.properties,geometry:[]};if("all-features"===f.kind)o=f.appearanceIndex;else{let r=d.appearances?d.appearances.findIndex(r=>r.isActive({globals:n,feature:I,canonical:i,featureState:S})):-1;o=r>=0?r:-1}let E=l.activeAppearanceIndex!==o;if(c){let r=p.get("text-size"),n="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,h="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0,u={canonical:i,layer:d,featureState:S,availableImages:a,textScaleFactor:x,imageMap:w,layoutTextOffset:p.get("text-offset").evaluate(I,S,i).map(i=>24*i),layoutTextSize:r.evaluate(I,S,i),layoutTextRotate:p.get("text-rotate").evaluate(I,S,i),layoutMinZoomSize:r.evaluate(I,{zoom:n},i),layoutMaxZoomSize:r.evaluate(I,{zoom:h},i),layoutTextSizeMinZoom:n,layoutTextSizeMaxZoom:h},c=this.updateSymbolInstanceTextVertices(s,l,o,I,v,u);v+=c.vertexOffsetDelta,b=b||c.hasChanges}if(u){let r={canonical:i,layer:d,featureState:S,availableImages:a,globalProperties:n,iconScaleFactor:m,layoutIconOffset:p.get("icon-offset").evaluate(I,S,i),layoutIconSize:p.get("icon-size").evaluate(I,S,i,a),layoutIconRotate:p.get("icon-rotate").evaluate(I,S,i)},h=this.updateSymbolInstanceIconVertices(s,l,o,I,_,r);_+=h.vertexOffsetDelta,g=g||h.hasChanges}if(E){let r=s.featureIndex,l=n?n.brightness:null,h=S||{},u=o>=0?d.appearances[o]:null;this.text.uboBinder&&(this.text.uboBinder.layer=d,y=this.text.uboBinder.updateFeaturePaintForAppearance(r,I,h,i,a,l,u)||y),this.icon.uboBinder&&(this.icon.uboBinder.layer=d,y=this.icon.uboBinder.updateFeaturePaintForAppearance(r,I,h,i,a,l,u)||y)}l.activeAppearanceIndex=o}return g&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),b&&this.text.layoutVertexBuffer&&null!==this.text.layoutVertexArray.arrayBuffer&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:g||b,hasUboChanges:y}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=fP(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(i,r){let a=this.lineVertexArray.length;if(void 0!==i.segment)for(let{x:i,y:a}of r)this.lineVertexArray.emplaceBack(i,a);return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x){let v=i.indexArray,b=i.layoutVertexArray,w=i.globeExtVertexArray,T=i.uboBinder?i.uboBinder.getCurrentBatchIndex():void 0,S=i.segments.prepareSegment(4*x,b,v,this.canOverlap?s.sortKey:void 0,T),I=this.glyphOffsetArray.length,E=S.vertexLength,A=this.allowVerticalPlacement&&l===pu.vertical?Math.PI/2:0,C=s.text&&s.text.sections,M=b.length,P=-1;for(let n=0;n<r.length;n++){let{tl:o,tr:l,bl:c,br:d,texPrimary:p,texSecondary:y,pixelOffsetTL:x,pixelOffsetBR:T,minFontScaleX:I,minFontScaleY:E,glyphOffset:D,isSDF:R,sectionIndex:L}=r[n],z=S.vertexLength,F=D[1];if(fz(b,u.x,u.y,o.x,F+o.y,p.x,p.y,a,R,x.x,x.y,I,E),fz(b,u.x,u.y,l.x,F+l.y,p.x+p.w,p.y,a,R,T.x,x.y,I,E),fz(b,u.x,u.y,c.x,F+c.y,p.x,p.y+p.h,a,R,x.x,T.y,I,E),fz(b,u.x,u.y,d.x,F+d.y,p.x+p.w,p.y+p.h,a,R,T.x,T.y,I,E),h){let{x:r,y:a,z:n}=h.anchor,[o,s,l]=h.up;fO(w,r,a,n,o,s,l),fO(w,r,a,n,o,s,l),fO(w,r,a,n,o,s,l),fO(w,r,a,n,o,s,l),fk(i.dynamicLayoutVertexArray,r,a,n,A)}else fk(i.dynamicLayoutVertexArray,u.x,u.y,u.z,A);if(g){let r=y||p;fF(i.iconTransitioningVertexArray,r.x,r.y),fF(i.iconTransitioningVertexArray,r.x+r.w,r.y),fF(i.iconTransitioningVertexArray,r.x,r.y+r.h),fF(i.iconTransitioningVertexArray,r.x+r.w,r.y+r.h)}if(v.emplaceBack(z,z+1,z+2),v.emplaceBack(z+1,z+2,z+3),S.vertexLength+=4,S.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),(n===r.length-1||L!==r[n+1].sectionIndex)&&(i.programConfigurations.populatePaintArrays(b.length,s,s.index,{},f,m,_,C&&C[L],this.worldview),i.uboBinder&&i.featureIdArray)){let r=i.uboBinder.populateUBO(s,s.index,m,f,_,C&&C[L],void 0);P=r;let a=b.length-M;for(let n=0;n<a;n++)i.featureIdArray.emplaceBack(r);M=b.length}}let D=x-r.length;if(0!==D&&(this._addNullVertices(D,b,a,h,w,i,g,S,v),i.uboBinder&&i.featureIdArray&&P>=0)){let r=4*D;for(let a=0;a<r;a++)i.featureIdArray.emplaceBack(P)}
7let R=h?h.anchor:u;i.placedSymbolArray.emplaceBack(R.x,R.y,R.z,u.x,u.y,I,this.glyphOffsetArray.length-I,E,c,d,u.segment,a?a[0]:0,a?a[1]:0,n[0],n[1],l,0,0,0,p,0),i.symbolInstanceIndices.push(y)}_addNullVertices(i,r,a,n,o,s,l,h,u){for(let c=0;c<i;c++){for(let i=0;i<4;i++)fz(r,0,0,0,0,0,0,a,!1,0,0,0,0),n&&fO(o,0,0,0,0,0,0),fk(s.dynamicLayoutVertexArray,0,0,0,0),l&&fF(s.iconTransitioningVertexArray,0,0);let i=h.vertexLength;u.emplaceBack(i,i+1,i+2),u.emplaceBack(i+1,i+2,i+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(i,r,a,n,o,s,l){i.emplaceBack(r,a,n,o,s,Math.round(l.x),Math.round(l.y))}_addCollisionDebugVertices(i,r,a,n,o,s,l){let h=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),u=h.vertexLength,c=l.tileAnchorX,d=l.tileAnchorY;for(let i=0;i<4;i++)a.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(a.collisionVertexArrayExt,r,i.padding,l.zOffset),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new e4(i.x1,i.y1)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new e4(i.x2,i.y1)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new e4(i.x2,i.y2)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new e4(i.x1,i.y2)),h.vertexLength+=4;let p=a.indexArray;p.emplaceBack(u,u+1),p.emplaceBack(u+1,u+2),p.emplaceBack(u+2,u+3),p.emplaceBack(u+3,u),h.primitiveLength+=4}_addTextDebugCollisionBoxes(i,r,a,n,o,s){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._addCollisionDebugVertices(n,o,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(i,r,a,n,o,s){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceIconSize(i,r,s.placedIconSymbolIndex);this._addCollisionDebugVertices(n,o,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(i,r,a){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new fN(oV,dJ.members,oB),this.iconCollisionBox=new fN(oV,dJ.members,oB);let n=pM(this.iconSizeData,i),o=pM(this.textSizeData,i,a);for(let a=0;a<this.symbolInstances.length;a++){let s=this.symbolInstances.get(a);this._addTextDebugCollisionBoxes(o,i,r,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(o,i,r,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(i,r,a,n){let o=this.text.placedSymbolArray.get(r.rightJustifiedTextSymbolIndex>=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:n),s=pC(this.textSizeData,i,o)/24;return this.tilePixelRatio*s}getSymbolInstanceIconSize(i,r,a){let n=this.icon.placedSymbolArray.get(a),o=pC(this.iconSizeData,i,n);return this.tilePixelRatio*o}_commitDebugCollisionVertexUpdate(i,r,a,n){i.emplaceBack(r,-a,-a,n),i.emplaceBack(r,a,-a,n),i.emplaceBack(r,a,a,n),i.emplaceBack(r,-a,a,n)}_updateTextDebugCollisionBoxes(i,r,a,n,o,s,l){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,o,n.padding,s.zOffset)}}_updateIconDebugCollisionBoxes(i,r,a,n,o,s,l){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceIconSize(i,r,s.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,o,n.padding,s.zOffset)}}updateCollisionDebugBuffers(i,r,a,n){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let o=pM(this.iconSizeData,i,n),s=pM(this.textSizeData,i,a);for(let l=0;l<this.symbolInstances.length;l++){let h=this.symbolInstances.get(l);this._updateTextDebugCollisionBoxes(s,i,r,h.textBoxStartIndex,h.textBoxEndIndex,h,a),this._updateTextDebugCollisionBoxes(s,i,r,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,a),this._updateIconDebugCollisionBoxes(o,i,r,h.iconBoxStartIndex,h.iconBoxEndIndex,h,n),this._updateIconDebugCollisionBoxes(o,i,r,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,n)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(i,r,a,n,o,s,l,h,u){let c={};if(r<a){let{x1:a,y1:n,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(r);c.textBox={x1:a,y1:n,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.textFeatureIndex=m}if(n<o){let{x1:r,y1:a,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(n);c.verticalTextBox={x1:r,y1:a,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.verticalTextFeatureIndex=m}if(s<l){let{x1:r,y1:a,x2:n,y2:o,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(s);c.iconBox={x1:r,y1:a,x2:n,y2:o,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.iconFeatureIndex=m}if(h<u){let{x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(h);c.verticalIconBox={x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.verticalIconFeatureIndex=m}return c}deserializeCollisionBoxes(i){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(i,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(i,r){let a=i.placedSymbolArray.get(r),n=a.vertexStartIndex+4*a.numGlyphs;for(let r=a.vertexStartIndex;r<n;r+=4)i.indexArray.emplaceBack(r,r+1,r+2),i.indexArray.emplaceBack(r+1,r+2,r+3)}
7getSortedSymbolIndexes(i){if(this.sortedAngle===i&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let r=Math.sin(i),a=Math.cos(i),n=[],o=[],s=[];for(let i=0;i<this.symbolInstances.length;++i){s.push(i);let l=this.symbolInstances.get(i);n.push(0|Math.round(r*l.tileAnchorX+a*l.tileAnchorY)),o.push(l.featureIndex)}return s.sort((i,r)=>n[i]-n[r]||o[r]-o[i]),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let i=0;i<this.symbolInstances.length;++i)this.symbolInstanceIndexesSortedZOffset.push(i)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((i,r)=>this.symbolInstances.get(r).zOffset-this.symbolInstances.get(i).zOffset)}addToSortKeyRanges(i,r){let a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesWithinSegments();else{for(let r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let i=this.symbolInstances.get(r);this.featureSortOrder.push(i.featureIndex);let{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:l,verticalPlacedIconSymbolIndex:h}=i;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&o!==n&&o!==a&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l),h>=0&&this.addIndicesForPlacedSymbol(this.icon,h)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getOrCreateSortedSymbolsByBatch(i,r){let a=(this.text.uboBinder&&this.text.uboBinder.maxFeaturesPerBatch>0?this.text.uboBinder:this.icon.uboBinder&&this.icon.uboBinder.maxFeaturesPerBatch>0?this.icon.uboBinder:null).maxFeaturesPerBatch;if(this.symbolsByBatch)for(let a of this.symbolsByBatch.values())for(let n of a){let a=this.symbolInstances.get(n.index);n.rotatedY=0|Math.round(i*a.tileAnchorX+r*a.tileAnchorY)}else{this.symbolsByBatch=new Map;for(let n=0;n<this.symbolInstances.length;n++){let o=this.symbolInstances.get(n),s=Math.floor(n/a),l=0|Math.round(i*o.tileAnchorX+r*o.tileAnchorY);this.symbolsByBatch.has(s)||this.symbolsByBatch.set(s,[]),this.symbolsByBatch.get(s).push({index:n,rotatedY:l,featureIndex:o.featureIndex})}}for(let i of this.symbolsByBatch.values())i.sort((i,r)=>i.rotatedY-r.rotatedY||r.featureIndex-i.featureIndex);return this.symbolsByBatch}rebuildTextSegmentIndices(i,r){for(let a of i){let i=a.batchIndex;if(void 0===i)continue;let n=r.get(i);if(!n){a.primitiveOffset=this.text.indexArray.length,a.primitiveLength=0;continue}a.primitiveOffset=this.text.indexArray.length;let o=this.text.indexArray.length;for(let{index:i}of n){let{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o}=this.symbolInstances.get(i);r>=0&&this.addIndicesForPlacedSymbol(this.text,r),a>=0&&a!==r&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o)}a.primitiveLength=this.text.indexArray.length-o}}rebuildIconSegmentIndices(i,r){for(let a of i){let i=a.batchIndex;if(void 0===i)continue;let n=r.get(i);if(!n){a.primitiveOffset=this.icon.indexArray.length,a.primitiveLength=0;continue}a.primitiveOffset=this.icon.indexArray.length;let o=this.icon.indexArray.length;for(let{index:i}of n){let{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=this.symbolInstances.get(i);r>=0&&this.addIndicesForPlacedSymbol(this.icon,r),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}a.primitiveLength=this.icon.indexArray.length-o}}sortFeaturesWithinSegments(){this.featureSortOrder=[];let i=Math.sin(this.sortedAngle),r=Math.cos(this.sortedAngle),a=this.getOrCreateSortedSymbolsByBatch(i,r);for(let i of Array.from(a.keys()).sort((i,r)=>i-r))for(let{index:r}of a.get(i)){let i=this.symbolInstances.get(r);this.featureSortOrder.push(i.featureIndex)}this.text.indexArray.clear(),this.icon.indexArray.clear(),this.rebuildTextSegmentIndices(this.text.segments.get(),a),this.rebuildIconSegmentIndices(this.icon.segments.get(),a),this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}getElevationFeatureForText(i){let r,a=this.symbolInstances.get(this.text.symbolInstanceIndices[i]).elevationFeatureIndex;return this.elevationFeatures&&a<this.elevationFeatures.length&&(r=this.elevationFeatures[a]),r}}function fj(i,r){return r.replace(/{([^{}]+)}/g,(r,a)=>
vendor: 6,323 bytes, line 7
7a in i?String(i[a]):"")}ne(fU,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),fU.addDynamicAttributes=fk;class fG{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:iI,this.defaultValue=i}evaluate(i){if(i.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ne(fG,"FormatSectionOverride",{omit:["defaultValue"]});let fq=()=>z||(z={layout:R||(R=new n5({"symbol-placement":new n1(n4.layout_symbol["symbol-placement"]),"symbol-spacing":new n1(n4.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new n1(n4.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new n2(n4.layout_symbol["symbol-sort-key"]),"symbol-z-order":new n1(n4.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new n1(n4.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new n1(n4.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new n1(n4.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new n1(n4.layout_symbol["icon-ignore-placement"]),"icon-optional":new n1(n4.layout_symbol["icon-optional"]),"icon-rotation-alignment":new n1(n4.layout_symbol["icon-rotation-alignment"]),"icon-size":new n2(n4.layout_symbol["icon-size"]),"icon-size-scale-range":new n1(n4.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new n2(n4.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new n2(n4.layout_symbol["icon-text-fit-padding"]),"icon-image":new n2(n4.layout_symbol["icon-image"]),"icon-image-use-theme":new n1({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new n2(n4.layout_symbol["icon-rotate"]),"icon-padding":new n1(n4.layout_symbol["icon-padding"]),"icon-keep-upright":new n1(n4.layout_symbol["icon-keep-upright"]),"icon-offset":new n2(n4.layout_symbol["icon-offset"]),"icon-anchor":new n2(n4.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new n1(n4.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new n1(n4.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new n1(n4.layout_symbol["text-rotation-alignment"]),"text-field":new n2(n4.layout_symbol["text-field"]),"text-font":new n2(n4.layout_symbol["text-font"]),"text-size":new n2(n4.layout_symbol["text-size"]),"text-size-scale-range":new n1(n4.layout_symbol["text-size-scale-range"]),"text-max-width":new n2(n4.layout_symbol["text-max-width"]),"text-line-height":new n2(n4.layout_symbol["text-line-height"]),"text-letter-spacing":new n2(n4.layout_symbol["text-letter-spacing"]),"text-justify":new n2(n4.layout_symbol["text-justify"]),"text-radial-offset":new n2(n4.layout_symbol["text-radial-offset"]),"text-variable-anchor":new n1(n4.layout_symbol["text-variable-anchor"]),"text-anchor":new n2(n4.layout_symbol["text-anchor"]),"text-max-angle":new n1(n4.layout_symbol["text-max-angle"]),"text-writing-mode":new n1(n4.layout_symbol["text-writing-mode"]),"text-rotate":new n2(n4.layout_symbol["text-rotate"]),"text-padding":new n1(n4.layout_symbol["text-padding"]),"text-keep-upright":new n1(n4.layout_symbol["text-keep-upright"]),"text-transform":new n2(n4.layout_symbol["text-transform"]),"text-offset":new n2(n4.layout_symbol["text-offset"]),"text-allow-overlap":new n1(n4.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new n1(n4.layout_symbol["text-ignore-placement"]),"text-optional":new n1(n4.layout_symbol["text-optional"]),visibility:new n1(n4.layout_symbol.visibility)})),paint:L||(L=new n5({"icon-opacity":new n2(n4.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new n2(n4.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new n2(n4.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new n2(n4.paint_symbol["text-emissive-strength"]),"icon-color":new n2(n4.paint_symbol["icon-color"]),"icon-halo-color":new n2(n4.paint_symbol["icon-halo-color"]),"icon-halo-width":new n2(n4.paint_symbol["icon-halo-width"]),"icon-halo-blur":new n2(n4.paint_symbol["icon-halo-blur"]),"icon-translate":new n1(n4.paint_symbol["icon-translate"]),"icon-translate-anchor":new n1(n4.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new n1(n4.paint_symbol["icon-image-cross-fade"]),"text-opacity":new n2(n4.paint_symbol["text-opacity"]),"text-occlusion-opacity":new n2(n4.paint_symbol["text-occlusion-opacity"]),"text-color":new n2(n4.paint_symbol["text-color"],{runtimeType:iM,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new n2(n4.paint_symbol["text-halo-color"]),"text-halo-width":new n2(n4.paint_symbol["text-halo-width"]),"text-halo-blur":new n2(n4.paint_symbol["text-halo-blur"]),"text-translate":new n1(n4.paint_symbol["text-translate"]),"text-translate-anchor":new n1(n4.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new n1(n4.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new n1(n4.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new n1(n4.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new n1(n4.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new n2(n4.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))});class f$ extends op{constructor(i,r,a,n){super(i,fq(),r,a,n,i.layout?i.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=ee([]),this.hasOcclusionOpacityProperties=void 0!==i.paint&&("icon-occlusion-opacity"in i.paint||"text-occlusion-opacity"in i.paint)}_handleSpecialPaintPropertyUpdate(i){"icon-occlusion-opacity"!==i&&"text-occlusion-opacity"!==i||(this.hasOcclusionOpacityProperties=!0)}recalculate(i,r){super.recalculate(i,r),this.appearances&&this.appearances.forEac
7h(a=>{a.recalculate(i,r,this.iconImageUseTheme)}),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));let a=this.layout.get("text-writing-mode");if(a){let i=[];for(let r of a)0>i.indexOf(r)&&i.push(r);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(i,r,a,n){var o,s;let l,h,u,c,d;return this._saturation===i&&this._contrast===r&&this._brightnessMin===a&&this._brightnessMax===n||(this._colorAdjustmentMatrix=(o=i,s=r,o=tA(o),s=tE(s),l=J(),u=1-2*(h=o/3),c=.5-.5*s,ei(l,[d=n-a,0,0,0,0,d,0,0,0,0,d,0,a,a,a,1],[s,0,0,0,0,s,0,0,0,0,s,0,c,c,c,1]),ei(l,l,[u,h,h,0,h,u,h,0,h,h,u,0,0,0,0,1]),l),this._saturation=i,this._contrast=r,this._brightnessMin=a,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(i,r,a,n){let o=this.layout.get(i).evaluate(r,{},a,n),s=this._unevaluatedLayout._values[i];return s.isDataDriven()||a0(s.value)||!o?o:fj(r.properties,o)}getAppearanceValueAndResolveTokens(i,r,a,n,o){let s=i.getLayoutProperty(r);if(!s)return;let l=s.evaluate(a,{},n,o),h=i.getUnevaluatedLayoutProperties()._values[r];return h.isDataDriven()||a0(h.value)||!l||"string"!=typeof l?l:fj(a.properties,l)}createBucket(i){return new fU(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let i of fq().paint.overridableProperties){if(!f$.hasPaintOverride(this.layout,i))continue;let r=this.paint.get(i),a=new aQ(new fG(r),r.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme")),n=null;n="constant"===r.value.kind||"source"===r.value.kind?new a2("source",a):new a3("composite",a,r.value.zoomStops,r.value.interpolationType),this.paint._values[i]=new nQ(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&f$.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){let a=i.get("text-field"),n=fq().paint.properties[r],o=!1,s=i=>{for(let r of i)if(n.overrides&&n.overrides.hasOverride(r))return void(o=!0)};if("constant"===a.value.kind&&a.value.value instanceof iq)s(a.value.value.sections);else if("source"===a.value.kind){let i=r=>{o||(r instanceof iK&&iX(r.value)===iL?s(r.value.sections):r instanceof i1?s(r.sections):r.eachChild(i))},r=a.value;r._styleExpression&&i(r._styleExpression.expression)}return o}getProgramIds(){return["symbol"]}getDefaultProgramParams(i,r,a){return{config:new sB(this,{zoom:r,lut:a}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}}var fH=oy([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);function fZ(i,r,a,n,o,s,l,h){let u=[i,r,1,a,n,1,o,s,1],c=[l,h,1],[d,p,f]=eL(c,c,Y([],u));return K(u,u,[d,0,0,0,p,0,0,0,f])}function fW(i,r,a,n,o,s,l,h){let u,c,d=(u=fZ(0,0,1,0,1,1,0,1),K(c=fZ(i,r,a,n,o,s,l,h),c,Y([],u)));return[d[2]/d[8]/8192,d[5]/d[8]/8192]}function fX(i){return[i[0],Math.min(Math.max(i[1],-85.051129),85.051129)]}class fY extends iu{constructor(i,r,a,n){super(),this.id=i,this.dispatcher=a,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(n),this.options=r,this._dirty=!1}load(i,r){(this._loaded=r||!1,this.fire(new io("dataloading",{dataType:"source"})),this.url=this.options.url,this.url)?this._imageRequest=t4(this.map._requestManager.transformRequest(this.url,tQ.Image),(r,a)=>{this._imageRequest=null,this._loaded=!0,r?this.fire(new is(r)):a&&(this.image=a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,i&&(this.coordinates=i),this._finishLoading())}):(i&&(this.coordinates=i),this._loaded=!0,this._finishLoading())}loaded(){return this._loaded}updateImage(i){return i.url&&(this._imageRequest&&i.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=i.url,this.load(i.coordinates,this._loaded)),this}setTexture(i){if(!(i.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new cq(this.map.painter.context,i.handle),this.width=i.dimensions[0],this.height=i.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new io("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(i){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof cq||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(i){if(this.coordinates=i,this._boundsArray=void 0,this._unsupportedCoords=!1,!i.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let r=i[0][1],a=i[0][1];for(let n of i)n[1]>a&&(a=n[1]),n[1]<r&&(r=n[1]);let n=(a+r)/2;if(n>85.051129?this.onNorthPole=!0:n<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){let r=i.map(s8.fromLngLat);this.tileID=function(i){let r=1/0,a=1/0,n=-1/0,o=-1/0;for(let s of i)r=Math.min(r,s.x),a=Math.min(a,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);let s=Math.max(0,Math.floor(-Math.log2(Math.max(n-r,o-a)))),l=Math.pow(2,s),h=Math.floor((r+n)/2*l);return h>1&&(h-=1),new l$(s,h,Math.floor((a+o)/2*l))}(r),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new io("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof cq||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(i){var r,a,n,o,s,l,h,u,c;let d,p,f,m,_,g,y,x,v,b,w,T;for(let i in this.tiles){let r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;let S=fd(new l$(0,0,0),this.map.transform.projection),I=[S.projection.project(this.coordinates[0][0],this.coordinates[0][1]),S.projection.project(this.coordinates[1][0],this.coordinates[1][1]),S.projection.project(this.coordinates[2][0],this.coordinates[2][1]),S.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(d=I[1].x-I[0].x,p=I[1].y-I[0].y,f=I[2].x-I[1].x,m=I[2].y-I[1].y,_=I[3].x-I[2].x,g=I[3].y-I[2].y,y=I[0].x-I[3].x,x=I[0].y-I[3].y,v=d*m-f*p,b=f*g-_*m,w=_*x-y*g,T=y*p-d*x,(!(v>0)||!(b>0)||!(w>0)||!(T>0))&&(!(v<0)||!(b<0)||!(w<0)||!(T<0)))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let E=fd(this.tileID,this.map.transform.projection),[A,C,M,P]=this.coordinates.map(i=>{let r=E.projection.project(i[0],i[1]);return fp(E,r)._round()});this.perspectiveTransform=fW(A.x,A.y,C.x,C.y,M.x,M.y,P.x,P.y);let D=this._boundsArray=new ow;D.emplaceBack(A.x,A.y,0,0),D.emplaceBack(C.x,C.y,8192,0),D.emplaceBack(P.x,P.y,0,8192),D.emplaceBack(M.x,M.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=i.createVertexBuffer(D,fH.members),this.boundsSegments=sh.simpleSegment(0,0,4,2);let R=[],[L,z,F,O]=function(i){let r=i[0][0],a=r,n=i[0][1],o=n;for(let s=1;s<i.length;s++)i[s][0]<r?r=i[s][0]:i[s][0]>a&&(a=i[s][0]),i[s][1]<n?n=i[s][1]:i[s][1]>o&&(o=i[s][1]);return[r,n,a-r,o-n]}([fX((r=this.coordinates)[0]),fX(r[1]),fX(r[2]),fX(r[3])]);{let r,d=new ow,[p,f,m,_]=function(i){let r=i[0].x,a=r,n=i[0].y,o=n;for(let s=1;s<i.length;s++)i[s].x<r?r=i[s].x:i[s].x>a&&(a=i[s].x),i[s].y<n?n=i[s].y:i[s].y>o&&(o=i[s].y);return[r,n,a-r,o-n]}(I),g=i=>[(i.x-p)/m,(i.y-f)/_],[y,x,v,b]=I.map(g),w=(a=y[0],n=y[1],o=x[0],s=x[1],l=v[0],h=v[1],u=b[0],c=b[1],K(r=fZ(0,0,1,0,1,1,0,1),r,Y([],fZ(a,n,o,s,l,h,u,c))));this.elevatedGlobePerspectiveTransform=fW(y[0],y[1],x[0],x[1],v[0],v[1],b[0],b[1]);let T=(i,r)=>{R.push(i.lng);let a=Math.round((i.lng-L)/F*8192),n=Math.round((i.lat-z)/O*8192),o=g(r),s=eL([],[o[0],o[1],1],w),l=Math.round(s[0]/s[2]*8192),h=Math.round(s[1]/s[2]*8192);d.emplaceBack(a,n,l,h)},E=I[3].x-I[0].x,A=I[3].y-I[0].y,C=I[2].x-I[1].x,M=I[2].y-I[1].y;for(let i=0;i<65;i++){let r=i/64,a=[I[0].x+r*E,I[0].y+r*A],n=[I[1].x+r*C,I[1].y+r*M],o=n[0]-a[0],s=n[1]-a[1];for(let i=0;i<65;i++){let r=i/64,n={x:a[0]+o*r,y:a[1]+s*r};T(S.projection.unproject(n.x,n.y),n)}}this.elevatedGlobeVertexBuffer=i.createVertexBuffer(d,fH.members)}{this.maxLongitudeTriangleSize=0;let r=[],a=new oj,n=(i,n,o)=>{a.emplaceBack(i,n,o);let s=R[i],l=R[n],h=R[o],u=Math.min(Math.min(s,l),h),c=Math.max(Math.max(s,l),h)-u;c>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=c),r.push(u+c/2)};for(let i=0;i<64;i++)for(let r=0;r<64;r++){let a=65*i+r,o=a+1,s=a+65,l=s+1;n(a,s,o),n(o,s,l)}[r,a]=function(i,r){let a=Array.from({length:i.length},(i,r)=>r);a.sort((r,a)=>i[r]-i[a]);let n=[],o=new oj;for(let s=0;s<a.length;s++){let l=a[s];n.push(i[l]);let h=3*l,u=h+1;o.emplaceBack(r.uint16[h],r.uint16[u],r.uint16[u+1])}return[n,o]}(r,a),this.elevatedGlobeTrianglesCenterLongitudes=r,this.elevatedGlobeIndexBuffer=i.createIndexBuffer(a)}this.elevatedGlobeSegments=sh.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,F/8192,0,O/8192,0,0,z,L,0])}prepare(){let i=0!==Object.keys(this.tiles).length;if(this.tileID&&!i)return;let r=this.map.painter.context,a=r.gl;!this._dirty||this.texture instanceof cq||(this.texture?this.texture.update(this.image):(this.texture=new cG(r,this.image,a.RGBA8),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE)),this._dirty=!1),i&&this._prepareData(r)}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={}):i.state="errored",r(null)}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(i){var r;let a=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!a)return null;let n=this.elevatedGlobeTrianglesCenterLongitudes,o=(r=i+180)+360*Math.round((n[0]-r)/360),s=new sh,l=(i,r)=>{s.segments.push({vertexOffset:0,primitiveOffset:i,vertexLength:a.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}})},h=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-o)<=h){let i=tI(n,0,n.length,o+h);return i===n.length||l(i,tS(n,i+1,n.length,o+360-h)-i),s}o<n[0]&&(o+=360);let u=tS(n,0,n.length,o-h);if(u===n.length)return l(0,n.length),s;l(0,u-0);let c=tI(n,u+1,n.length,o+h);return c!==n.length&&l(c,n.length-c),s}}class fK extends op{constructor(i,r,a,n){super(i,{layout:B||(B=new n5({visibility:new n1(n4.layout_raster.visibility)})),paint:k||(k=new n5({"raster-opacity":new n1(n4.paint_raster["raster-opacity"]),"raster-color":new n3(n4.paint_raster["raster-color"]),"raster-color-mix":ne
7w n1(n4.paint_raster["raster-color-mix"]),"raster-color-range":new n1(n4.paint_raster["raster-color-range"]),"raster-hue-rotate":new n1(n4.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new n1(n4.paint_raster["raster-brightness-min"]),"raster-brightness-max":new n1(n4.paint_raster["raster-brightness-max"]),"raster-saturation":new n1(n4.paint_raster["raster-saturation"]),"raster-contrast":new n1(n4.paint_raster["raster-contrast"]),"raster-resampling":new n1(n4.paint_raster["raster-resampling"]),"raster-fade-duration":new n1(n4.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new n1(n4.paint_raster["raster-emissive-strength"]),"raster-array-band":new n1(n4.paint_raster["raster-array-band"]),"raster-elevation":new n1(n4.paint_raster["raster-elevation"]),"raster-elevation-reference":new n1(n4.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(i){return!(i&&i._source instanceof fY&&(i._source.onNorthPole||i._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(i){"raster-color"!==i&&"raster-color-range"!==i||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(i){if(!this.hasColorMap()||!this._curRampRange)return;let r=this._transitionablePaint._values["raster-color"].value.expression,[a,n]=i||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(a)&&isNaN(n)||a===this._curRampRange[0]&&n===this._curRampRange[1]||(this.colorRamp=hA({expression:r,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:a,end:n}],resolution:1024}),this.colorRampTexture=null,this._curRampRange=[a,n])}is3D(i){return this.paint.get("raster-elevation")>0}}class fJ extends op{constructor(i,r,a,n){super(i,{layout:V||(V=new n5({visibility:new n1(n4["layout_raster-particle"].visibility)})),paint:N||(N=new n5({"raster-particle-array-band":new n1(n4["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new n1(n4["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new n3(n4["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new n1(n4["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new n1(n4["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new n1(n4["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new n1(n4["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new n1(n4["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp(),this.lastInvalidatedAt=tO.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(i){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(i){return!1}_handleSpecialPaintPropertyUpdate(i){"raster-particle-color"!==i&&"raster-particle-max-speed"!==i||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===i&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;let i=this._transitionablePaint._values["raster-particle-color"].value.expression,r=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=hA({expression:i,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:r}],resolution:256}),this.colorRampTexture=null}
7_invalidateAnimationState(){this.lastInvalidatedAt=tO.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class fQ extends op{constructor(i,r){super(i,{},r,null),this.implementation=i,i.slot&&(this.slot=i.slot)}is3D(i){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(i){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}function f0(i,r,a){let n=[0,0,1],o=ej([]);return eq(o,o,a?-(i*e8)+Math.PI:i*e8),eG(o,o,-(r*e8)),ez(n,n,o),eC(n,n)}class f1{constructor(i,r,a,n){this.message=(i?`${i}: `:"")+a,n&&(this.identifier=n),null!=r&&r.__line__&&(this.line=r.__line__)}}function f2(i,r){let a=-1===i.indexOf("://");try{return new URL(i,a&&r?"http://example.com":void 0),!0}catch(i){return!1}}class f3{constructor(i,r){this.feature=i,this.instancedDataOffset=r,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class f5{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new oQ,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(i){let r=16*i,a=this.instancedDataArray.float32,n=Math.floor(a[r+2]),o=1.05*(a[r+2]-n);return n/=100,[a[r]%1*1.05,a[r+1]%1*1.05,o,n]}tileCoordinatesForInstance(i){let r=16*i,a=this.instancedDataArray.float32,n=a[r+0];return new e4(Math.trunc(n=n>8192?n-8192:n),Math.trunc(a[r+1]))}translationForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+4],a[r+5],a[r+6]]}rotationScaleForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+7],a[r+8],a[r+9],a[r+10],a[r+11],a[r+12],a[r+13],a[r+14],a[r+15]]}transformForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+7],a[r+8],a[r+9],a[r+4],a[r+10],a[r+11],a[r+12],a[r+5],a[r+13],a[r+14],a[r+15],a[r+6],0,0,0,1]}}class f4{constructor(i){this.zoom=i.zoom,this.canonical=i.canonical,this.overscaledZ=this.canonical.z+Math.log2(i.overscaling),this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=i.projection,this.index=i.index,this.worldview=i.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=i.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.tileToMeter=s6(a);let o=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);let s="hd-road-markup"===this.layers[0].paint.get("model-elevation-reference")?r.elevationFeatures:void 0;for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of i){let i=null!=h?h:l.properties&&l.properties.hasOwnProperty("id")?l.properties.id:void 0,d=lt(l,o);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let p={id:i,sourceLayerIndex:c,index:u,geometry:o?d.geometry:le(l,a,n),properties:l.properties,type:l.type,patterns:{}},f=this.addFeature(p,p.geometry,d,s,a);f&&r.featureIndex.insert(l,p.geometry,u,c,this.index,this.instancesPerModel[f].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){let i=this.layers[0].modelManager,r=this.layers[0].scope,a=0;for(let n of this.modelUris){let o=i.getModel(n,r);if(!o)continue;let s=this.instancesPerModel[n];s&&(a=Math.max(Math.min(8192,Math.max((.5*eS(o.aabb.max,o.aabb.min)*s.maxScale+s.maxXYTranslationDistance)/this.tileToMeter,256)),a))}return a}update(i,r,a,n){for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];for(let r in i)a.idToFeaturesIndex.hasOwnProperty(r)&&(this.evaluate(a.features[a.idToFeaturesIndex[r]],i[r],a,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let i=!1;for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];for(let r of a.features){let n=this.layers[0],o=r.feature,s=this.canonical,l=n.paint.get("model-rotation").evaluate(o,{},s),h=n.paint.get("model-scale").evaluate(o,{},s),u=n.paint.get("model-translation").evaluate(o,{},s);eO(r.rotation,l)&&eO(r.scale,h)&&eO(r.translation,u)||(this.evaluate(r,r.featureStates,a,!0),i=!0)}}return i}updateReplacement(i,r,a,n){if(r.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=r.updateTime;let o=r.getReplacementRegionsForTile(i.toUnwrapped(),!0);if(uG(this.activeReplacements,o))return!1;this.activeReplacements=o;let s=!1;for(let r in this.instancesPerModel){let o=this.instancesPerModel[r],l=o.instancedDataArray;for(let r of o.features){let o=r.instancedDataOffset,h=r.instancedDataCount;for(let r=0;r<h;r++){let h=16*(r+o),u=l.float32[h+0],c=u>8192,d=Math.floor(u=c?u-8192:u),p=Math.floor(l.float32[h+1]),f=!1;for(let r of this.activeReplacements)if(!uV(r,a,uW.Model,n)&&!(r.min.x>d||d>r.max.x||r.min.y>p||p>r.max.y)&&(f=uZ(uH(d,p,i.canonical,r.footprintTileId.canonical),r.footprint)))break;l.float32[h]=f?u+8192:u,s=s||f!==c}}}return s}isEmpty(){for(let i in this.instancesPerModel)if(0!==this.instancesPerModel[i].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(i){if(!this.uploaded)for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];a.instancedDataArray.length<0||0===a.instancedDataArray.length||(a.instancedDataBuffer?a.instancedDataBuffer.updateData(a.instancedDataArray):a.instancedDataBuffer=i.createVertexBuffer(a.instancedDataArray,cY.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(i){for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];0!==r.instancedDataArray.length&&r.instancedDataBuffer&&r.instancedDataBuffer.destroy()}let r=this.layers[0].modelManager;if(i&&r&&this.modelUris&&this.modelsRequested)for(let i of this.modelUris)r.removeModel(i,"",!0)}addFeature(i,r,a,n,o){let s,l=this.layers[0],h=l.layout.get("model-id"),u=l.layout.get("model-allow-density-reduction"),c=h.evaluate(a,{},this.canonical);if(!c)return t_(`modelId is not evaluated for layer ${l.id} and it is not going to get rendered.`),c;(f2(c,!1)||void 0!==this.styleDefinedModelURLs[c])&&(this.modelUris.includes(c)||this.modelUris.push(c)),this.instancesPerModel[c]||(this.instancesPerModel[c]=new f5);let d=this.instancesPerModel[c],p=d.instancedDataArray,f=new f3(a,p.length);for(let a of(n&&(s=lE.getElevationFeature(i,n)),r))for(let i of a){if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)continue;if(0!==this.lookupDim&&u){let r=(this.lookupDim-1)/8192,a=this.lookupDim*(i.y*r|0)+i.x*r|0;if(this.lookup){if(0!==this.lookup[a])continue;this.lookup[a]=1}}this.instanceCount++;let r=p.length;if(p.resize(r+1),n){d.instancesRoadElevation||(d.instancesRoadElevation=[]);let r=s?s.pointElevation(new e4(i.x,i.y)):0;d.instancesRoadElevation.push(r)}d.instancesEvaluatedElevation.push(0),p.float32[16*r]=i.x,p.float32[16*r+1]=i.y}return f.instancedDataCount=d.instancedDataArray.length-f.instancedDataOffset,f.instancedDataCount>0&&(i.id&&(d.idToFeaturesIndex[i.id]=d.features.length),d.features.push(f),this.evaluate(f,{},d,!1)),c}getModelUris(){return this.modelUris}evaluate(i,r,a,n){let o=this.layers[0],s=i.feature,l=this.canonical,h=i.rotation=o.paint.get("model-rotation").evaluate(s,r,l),u=i.scale=o.paint.get("model-scale").evaluate(s,r,l),c=i.translation=o.paint.get("model-translation").evaluate(s,r,l),d=Object.assign({},o.paint.get("model-color").evaluate(s,r,l));d.a=o.paint.get("model-color-mix-intensity").evaluate(s,r,l);let p=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]);let f=c[0]*c[0]+c[1]*c[1],m=f>0?Math.sqrt(f):0;a.maxScale=Math.max(Math.max(a.maxScale,u[0]),Math.max(u[1],u[2])),a.maxXYTranslationDistance=Math.max(a.maxXYTranslationDistance,m),this.maxScale=Math.max(Math.max(this.maxScale,u[0]),Math.max(u[1],u[2])),c5(p,h,u);let _=Math.round(100*d.a)+d.b/1.05;for(let r=0;r<i.instancedDataCount;++r){let o=i.instancedDataOffset+r,s=16*o,h=a.instancedDataArray.float32,u=0;n&&(u=h[s+6]-a.instancesEvaluatedElevation[o]);let f=0|h[s+1];h[s]=(0|h[s])+d.r/1.05,h[s+1]=f+d.g/1.05,h[s+2]=_,h[s+3]=1/(l.z>10?this.tileToMeter:s6(l,f)),h[s+4]=c[0],h[s+5]=c[1],h[s+6]=c[2]+(a.instancesRoadElevation?a.instancesRoadElevation[o]:0)+u,h[s+7]=p[0],h[s+8]=p[1],h[s+9]=p[2],h[s+10]=p[4],h[s+11]=p[5],h[s+12]=p[6],h[s+13]=p[8],h[s+14]=p[9],h[s+15]=p[10],a.instancesEvaluatedElevation[o]=c[2]}}}ne(f4,"ModelBucket",{omit:["layers"]}),ne(f5,"PerModelAttributes"),ne(f3,"ModelFeature");class f6{constructor(i,r,a){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=a}static create(i,r,a){let n=a||i.findDEMTileFor(r);if(!n||!n.dem)return;let o=n.dem,s=n.tileID,l=1<<r.canonical.z-s.canonical.z;return new f6(n,o.dim/8192/l,[(r.canonical.x/l-s.canonical.x)*o.dim,(r.canonical.y/l-s.canonical.y)*o.dim])}tileCoordToPixel(i,r){let a=r*this._scale+this._offset[1];return new e4(Math.floor(i*this._scale+this._offset[0]),Math.floor(a))}getElevationAt(i,r,a,n){let o=i*this._scale+this._offset[0],s=r*this._scale+this._offset[1],l=Math.floor(o),h=Math.floor(s),u=this._dem;return n=!!n,a?iv(iv(u.get(l,h,n),u.get(l,h+1,n),s-h),iv(u.get(l+1,h,n),u.get(l+1,h+1,n),s-h),o-l):u.get(l,h,n)}getElevationAtPixel(i,r,a){return this._dem.get(i,r,!!a)}getMeterToDEM(i){return(1<<this._demTile.tileID.canonical.z)*(1/sK(i))*this._dem.stride}}let f8=new Float32Array(262144),f9=new Uint8Array(262144),f7=["","wall","door","roof","window","lamp","logo"];class me{constructor(i){this.node=i,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:i.id,geometry:[],properties:{height:function i(r){let a=0;if(r.meshes)for(let i of r.meshes)a=Math.max(a,i.aabb.max[2]);if(r.children)for(let n of r.children)a=Math.max(a,i(n));return a}(i)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new lT([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let i=0,r=new lT([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(let a of this.node.meshes)this.node.lightMeshIndex!==i&&(a.transformedAabb=lT.applyTransformFast(a.aabb,this.node.globalMatrix),r.encapsulate(a.transformedAabb)),i++;this.aabb=r}return this.aabb}}class mt{constructor(i,r,a,n,o,s,l,h){for(const u of(this.id=a,this.layers=i,this.layerIds=this.layers.map(i=>i.fqid),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.modelTraits|=c9.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=c9.HasMapbox
7MeshFeatures),o&&(this.modelTraits|=c9.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=s,this.worldview=h,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[],r))this.nodesInfo.push(new me(u)),function i(r,a,n){if(r.meshes)for(let i of r.meshes){if(i.aabb.min[0]===1/0)continue;let o=lT.applyTransform(i.aabb,r.globalMatrix);n.insert(a,o.min[0],o.min[1],o.max[0],o.max[1])}if(r.children)for(let o of r.children)i(o,a,n)}(u,l.featureIndexArray.length,l.grid),l.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,l.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(i,r){for(let a of this.getNodesInfo()){let n=a.node;n.footprint&&r.push({footprint:n.footprint,id:i})}}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(i){let r=0!==Object.keys(i).length;if(r&&!this.stateDependentLayers.length)return;let a=r?this.stateDependentLayers:this.layers;if(!e6(i,this.states))for(let r of a)this.evaluate(r,i);this.states=structuredClone(i)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(i){if(!this.needsUpload)return;let r=this.getNodesInfo();for(let a of r){let r=a.node;this.uploaded?this.updatePbrBuffer(r):di(r,i,!0)}for(let i of r)dr(i.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(i){let r=!1;if(!i.meshes)return r;for(let a of i.meshes)a.pbrBuffer&&(a.pbrBuffer.updateData(a.featureArray),r=!0);return r}needsReEvaluation(i,r,a){let n=i.transform.projectionOptions,o=i.style.getBrightness(),s=this.brightness!==o;if(!this.uploaded||this.dirty||n.name!==this.projection.name||mi(a.paint.get("model-color").value,s)||mi(a.paint.get("model-color-mix-intensity").value,s)||mi(a.paint.get("model-roughness").value,s)||mi(a.paint.get("model-emissive-strength").value,s)||mi(a.paint.get("model-height-based-emissive-strength-multiplier").value,s)){for(let i of(this.projection=n,this.brightness=o,this.getNodesInfo()))i.state=null;return!0}return!1}evaluateTransform(i,r){if(i.transform.zoom===this.zoom)return;this.zoom=i.transform.zoom;let a=this.getNodesInfo(),n=this.id.canonical;for(let i of a){let a=i.feature;i.evaluatedTranslation=r.paint.get("model-translation").evaluate(a,{},n),i.evaluatedScale=r.paint.get("model-scale").evaluate(a,{},n)}}evaluate(i,r){for(let a of this.getNodesInfo()){if(!a.node.meshes)continue;let n=a.feature,o=r&&r[n.id];if(e6(o,a.state))continue;a.state=structuredClone(o);let s=a.node.meshes&&a.node.meshes[0].featureData,l=a.evaluatedColor[2],h=a.evaluatedRMEA[2],u=this.id.canonical;if(a.hasTranslucentParts=!1,s){for(let r=0;r<f7.length;r++){let s=f7[r];s.length&&(n.properties.part=s);let l=i.paint.get("model-color").evaluate(n,o,u).toPremultipliedRenderColor(null),h=i.paint.get("model-color-mix-intensity").evaluate(n,o,u);a.evaluatedColor[r]=[l.r,l.g,l.b,h],a.evaluatedRMEA[r][0]=i.paint.get("model-roughness").evaluate(n,o,u),a.evaluatedRMEA[r][2]=i.paint.get("model-emissive-strength").evaluate(n,o,u),a.evaluatedRMEA[r][3]=l.a,a.emissionHeightBasedParams[r]=i.paint.get("model-height-based-emissive-strength-multiplier").evaluate(n,o,u),!a.hasTranslucentParts&&l.a<1&&(a.hasTranslucentParts=!0)}delete n.properties.part,function(i,r,a){let n=i.node,o=0,s=a&c9.HasMeshoptCompression;for(let a of n.meshes){if(n.lights&&n.lightMeshIndex===o||!a.featureData)continue;a.featureArray=new o0,a.featureArray.reserve(a.featureData.length);let l=r;
7for(let r of a.featureData){let o,h=s?65535&r:r>>16&65535,u=s?r>>16&65535:65535&r,c=(15&u)<8?15&u:0,d=i.evaluatedRMEA[c],p=i.evaluatedColor[c],f=i.emissionHeightBasedParams[c];if(l&&2===c&&n.lights&&(o=new o0).resize(10*n.lights.length),function(i,r,a,n,o,s,l,h){let u,c,d,p,f=(61440&r|(61440&r)>>4)>>8,m=(3840&r|(3840&r)>>4)>>4,_=240&r|(240&r)>>4;a[3]>0&&(f=iv(f,255*a[0],a[3]),m=iv(m,255*a[1],a[3]),_=iv(_,255*a[2],a[3]));let g=f<<8|m,y=_<<8|Math.floor(255*n[3]),x=Math.min(Math.round(.5*tr(n[2],0,2)*255),255)<<8|15*n[0]<<4|15*n[1],v=tr(o[0],0,1),b=tr(o[1],0,1),w=tr(o[2],0,1),T=tr(o[3],0,1);if(v!==b&&l!==s&&b!==v){let i=l-s;c=1/(i*(b-v)),d=-(s+i*v)/(i*(b-v)),p=Math.pow(10,tr(o[4],-1,1)),u=255*w<<8|255*T}else u=65535,c=0,d=1,p=1;if(i.emplaceBack(g,y,x,u,c,d,p),h){let i=h.length;h.clear();for(let r=0;r<i;r++)h.emplaceBack(g,y,x,u,c,d,p)}}(a.featureArray,h,p,d,f,a.aabb.min[2],a.aabb.max[2],o),o&&l){l=!1;let i=n.meshes[n.lightMeshIndex];i.featureArray=o,i.featureArray._trim()}}a.featureArray._trim(),o++}}(a,l!==a.evaluatedColor[2]||h!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=i.paint.get("model-emissive-strength").evaluate(n,o,u);a.evaluatedTranslation=i.paint.get("model-translation").evaluate(n,o,u),a.evaluatedScale=i.paint.get("model-scale").evaluate(n,o,u),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(i,r,a,n){let o=i.findDEMTileFor(a);if(o&&(o.tileID.canonical!==this.terrainTile||r!==this.terrainExaggeration)){if(o.dem&&o.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=o.tileID.overscaledZ;let r=f6.create(i,a,o);if(!r)return;for(let o of(this.modelTraits&c9.HasMapboxMeshFeatures&&this.updateDEM(i,r,a,n),this.getNodesInfo())){let i=o.node;if(!i.footprint||!i.footprint.vertices||!i.footprint.vertices.length)continue;let a=i.footprint.vertices,n=r.getElevationAt(a[0].x,a[0].y,!0,!0);for(let i=1;i<a.length;i++)n=Math.min(n,r.getElevationAt(a[i].x,a[i].y,!0,!0));i.elevation=n}}this.terrainTile=o.tileID.canonical,this.terrainExaggeration=r}}updateDEM(i,r,a,n){let o=r._dem._modifiedForSources[n];if(void 0===o&&(r._dem._modifiedForSources[n]=[],o=r._dem._modifiedForSources[n]),o.includes(a.canonical))return;let s=r._dem.dim;o.push(a.canonical);let l=!1;for(let i of this.getNodesInfo()){let a=i.node;if(!a.footprint||!a.footprint.grid)continue;let n=a.footprint.grid,o=r.tileCoordToPixel(n.min.x,n.min.y),h=r.tileCoordToPixel(n.max.x,n.max.y),u=Math.min(Math.min(s-h.y,o.x),Math.min(o.y,s-h.x));if(u<0)continue;let c=tr(u,2,5),d=Math.max(0,o.x-c),p=Math.max(0,o.y-c),f=Math.min(h.x+c,s-1),m=Math.min(h.y+c,s-1);for(let i=p;i<=m;++i)for(let r=d;r<=f;++r)f9[i*s+r]=255;let _=0,g=0;for(let i=0;i<n.cellsY;++i)for(let a=0;a<n.cellsX;++a){if(!n.cells[i*n.cellsX+a])continue;let o=r.tileCoordToPixel(n.min.x+a/n.xScale,n.min.y+i/n.yScale),l=r.tileCoordToPixel(n.min.x+(a+1)/n.xScale,n.min.y+(i+1)/n.yScale);for(let i=o.y;i<=Math.min(l.y+1,s-1);++i)for(let a=o.x;a<=Math.min(l.x+1,s-1);++a)255===f9[i*s+a]&&(f9[i*s+a]=0,_+=r.getElevationAtPixel(a,i),g++)}let y=_/g;d=Math.max(1,o.x-c),p=Math.max(1,o.y-c),f=Math.min(h.x+c,s-2),m=Math.min(h.y+c,s-2),l=!0;for(let i=p;i<=m;++i)for(let a=d;a<=f;++a)0===f9[i*s+a]&&(f8[i*s+a]=r._dem.set(a,i,y));for(let i=1;i<c;++i){d=Math.max(1,o.x-i),p=Math.max(1,o.y-i),f=Math.min(h.x+i,s-2),m=Math.min(h.y+i,s-2);for(let a=p;a<=m;++a)for(let n=d;n<=f;++n){let o=a*s+n;if(255===f9[o]){let l=0,h=0,u=-1,d=-1;for(let r=-1;r<=1;++r)for(let o=-1;o<=1;++o){let c=(a+r)*s+n+o;if(f9[c]>=i)continue;let p=f8[c],f=Math.abs(p);f>h&&(l=p,h=f,u=o,d=r)}if(h>.1){let s=1-(i+.5*Math.abs(u*d))/c,h=r._dem.get(n,a)+l*s,p=r._dem.get(n+u,a+d),f=r._dem.get(n-u,a-d,!0);(h-p)*(h-f)>0&&(h=(p+f)/2),f8[o]=r._dem.set(n,a,h),f9[o]=i}}}}}l&&(r._demTile.needsDEMTextureUpload=!0,r._dem._timestamp=tO.now())}setFilter(i){this.filter=i?n7(i):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(i=>this.filter.filter(new nH(this.id.overscaledZ,{worldview:this.worldview}),i.feature,this.id.canonical)):this.nodesInfo}destroy(){for(let i of this.getNodesInfo())dr(i.node),da(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(i,r){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let a=r.getReplacementRegionsForTile(i.toUnwrapped());for(let i of this.getNodesInfo()){let r=i.node.footprint;i.hiddenByReplacement=!!r&&!a.find(i=>i.footprint===r)}}getHeightAtTileCoord(i,r){let a=[],n=[0,0,0],o=ee([]);for(let s of this.getNodesInfo()){let l=s.node.meshes[0],h=l.transformedAabb;if(i<h.min[0]||r<h.min[1]||i>h.max[0]||r>h.max[1])continue;if(!0===s.node.hidden)return{height:1/0,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]};et(o,s.node.globalMatrix),n[0]=i,n[1]=r,eR(n,n,o);let u=(n[0]-l.aabb.min[0])/(l.aabb.max[0]-l.aabb.min[0])*64|0,c=64*Math.min(63,(n[1]-l.aabb.min[1])/(l.aabb.max[1]-l.aabb.min[1])*64|0)+Math.min(63,u),d=l.heightmap[c];if(!(d<0&&s.node.footprint)){if(s.hiddenByReplacement)return;return{height:d,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]}}if(s.node.footprint.grid.query(new e4(i,r),new e4(i,r),a),a.length>0)return{height:void 0,maxHeight:s.feature.properties.height,hidden:s.hiddenByReplacement,verticalScale:s.evaluatedScale[2]}}}}function mi(i,r){return i instanceof a2&&!i.isLightConstant&&r}ne(mt,"Tiled3dModelBucket",{omit:["layers"]}),ne(me,"Tiled3dModelFeature");let mr=["id","tile","layer","source","sourceLayer","state"];class ma{constructor(i,r,a,n,o){this.type="Feature",this._vectorTileFeature=i,this._z=r,this._x=a,this._y=n,this.properties=i?i.properties:{},this.id=o}clone(){let i=new ma(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(i.state=Object.assign({},this.state)),this.layer&&(i.layer=Object.assign({},this.layer)),this.source&&(i.source=this.source),this.sourceLayer&&(i.sourceLayer=this.sourceLayer),i}get geometry(){return void 0===this._geometry&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(i){this._geometry=i}toJSON(){let i={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(let r of mr)void 0!==this[r]&&(i[r]=this[r]);return i}}class mn extends iu{constructor(i,r,a,n){super(),this.id=i,this.type="model",this.models=[],this._options=r,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}loadGLTFFromURI(i,r){return cN(this.map._requestManager.transformRequest(i,tQ.Model).url,r)}async loadModel(i,r,a){try{let n=await this.loadGLTFFromURI(r.uri,a);if(a.aborted)return;let o=this._modelsInfo.get(i);if(!o)return;let s=dl(n),l=o.modelSpec,h=new de(i,l.uri,l.position,l.orientation,s);mn.applyModelSpecification(h,l),h.computeBoundsAndApplyParent(),this.models.push(h),o.model=h}catch(n){if(n instanceof Error&&"AbortError"===n.name)return;let a=n instanceof Error?n.message:"Unknown error";this.fire(new is(Error(`Could not load model ${i} from ${r.uri}: ${a}`)))}}async load(){this._abortController||(this._abortController=new AbortController);let i=this._abortController.signal,r=[];for(let a in this._options.models){let n=this._options.models[a],o=this._modelsInfo.get(a);if(o&&o.model){o.modelSpec=n;let i=o.model;i.position=null!=n.position?new sX(n.position[0],n.position[1]):new sX(0,0),i.orientation=null!=n.orientation?n.orientation:[0,0,0],mn.applyModelSpecification(i,n),i.computeBoundsAndApplyParent(),this.models.push(i)}else o?o.modelSpec=n:(this._modelsInfo.set(a,{modelSpec:n,model:null}),r.push(this.loadModel(a,n,i)))}0!==r.length?(await Promise.allSettled(r),i.aborted||this.fire(new io("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new io("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(i,r){r.nodeOverrides&&mn.convertNodeOverrides(i,r.nodeOverrides),r.materialOverrides&&mn.convertMaterialOverrides(i,r.materialOverrides),r.nodeOverrideNames&&(i.nodeOverrideNames=[...r.nodeOverrideNames]),r.materialOverrideNames&&(i.materialOverrideNames=[...r.materialOverrideNames]),r.featureProperties&&(i.featureProperties=r.featureProperties)}static convertNodeOverrides(i,r){if(Array.isArray(r)&&r.every(i=>"string"==typeof i))for(let a of(i.nodeOverrideNames=[],r))i.nodeOverrideNames.push(a);else Object.entries(r).forEach(([r,a])=>{let n={orientation:[0,0,0]};if(a.hasOwnProperty("orientation")){let i=a.orientation;i&&(n.orientation=i)}i.nodeOverrides.set(r,n)})}static convertMaterialOverrides(i,r){if(Array.isArray(r)&&r.every(i=>"string"==typeof i))for(let a of(i.materialOverrideNames=[],r))i.materialOverrideNames.push(a);else Object.entries(r).forEach(([r,a])=>{let n={color:new i_(1,1,1),colorMix:0,emissionStrength:0,opacity:1},o=a["model-color"];void 0!==o&&(n.color.r=o[0],n.color.g=o[1],n.color.b=o[2]);let s=a["model-color-mix-intensity"];void 0!==s&&(n.colorMix=s);let l=a["model-emissive-strength"];void 0!==l&&(n.emissionStrength=l);let h=a["model-opacity"];
7void 0!==h&&(n.opacity=h),i.materialOverrides.set(r,n)})}onAdd(i){this.map=i,this.load()}hasTransition(){return!1}loaded(){if(0===this._modelsInfo.size)return!0;for(let i of this._modelsInfo.values())if(null==i.model)return!1;return!0}getModels(){return this.models}loadTile(i,r){}serialize(){return this._options}setProperty(i,r){return!1}reload(){this.cancelModelRequests();let i=os(this.id,this.scope);this.map.style.clearSource(i),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(i){this.cancelModelRequests()}setModels(i){this.models=[];let r=new Map;for(let a in i){let n=i[a],o=this._modelsInfo.get(a);o&&o.modelSpec.uri===n.uri&&r.set(a,o)}if(this._modelsInfo.size!==r.size)for(let[i,a]of(this.cancelModelRequests(),r))a.model||r.delete(i);this._modelsInfo=r,this._options.models=i,this.load()}}function mo(i,r,a,n){let o=1<<i.z;r.lat=s1((n/8192+i.y)/o),r.lng=s0((a/8192+i.x)/o)}let ms={circle:class extends op{constructor(i,r,a,n){super(i,{layout:f||(f=new n5({"circle-sort-key":new n2(n4.layout_circle["circle-sort-key"]),"circle-elevation-reference":new n1(n4.layout_circle["circle-elevation-reference"]),visibility:new n1(n4.layout_circle.visibility)})),paint:m||(m=new n5({"circle-radius":new n2(n4.paint_circle["circle-radius"]),"circle-color":new n2(n4.paint_circle["circle-color"]),"circle-blur":new n2(n4.paint_circle["circle-blur"]),"circle-opacity":new n2(n4.paint_circle["circle-opacity"]),"circle-translate":new n1(n4.paint_circle["circle-translate"]),"circle-translate-anchor":new n1(n4.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new n1(n4.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new n1(n4.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new n2(n4.paint_circle["circle-stroke-width"]),"circle-stroke-color":new n2(n4.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new n2(n4.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new n1(n4.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}createBucket(i){return new lC(i)}queryRadius(i){return lU("circle-radius",this,i)+lU("circle-stroke-width",this,i)+lj(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,a,n,o,s,l,h){let u=lq(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a);return hg(i,n,s,l,h,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),u,c)}getProgramIds(){return["circle"]}getDefaultProgramParams(i,r,a){let n=h_(this);return{config:new sB(this,{zoom:r,lut:a}),defines:n,overrideFog:!1}}is3D(i){return!i&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}},heatmap:class extends op{createBucket(i){return new hv(i)}constructor(i,r,a,n){super(i,{layout:_||(_=new n5({visibility:new n1(n4.layout_heatmap.visibility)})),paint:g||(g=new n5({"heatmap-radius":new n2(n4.paint_heatmap["heatmap-radius"]),"heatmap-weight":new n2(n4.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new n1(n4.paint_heatmap["heatmap-intensity"]),"heatmap-color":new n3(n4.paint_heatmap["heatmap-color"]),"heatmap-opacity":new n1(n4.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=hA({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(i){return lU("heatmap-radius",this,i)}queryIntersectsFeature(i,r,a,n,o,s,l,h){let u=this.paint.get("heatmap-radius").evaluate(r,a);return hg(i,n,s,l,h,!0,!0,new e4(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(i,r,a){return"heatmap"===i?{config:new sB(this,{zoom:r,lut:a}),overrideFog:!1}:{}}},hillshade:class extends op{constructor(i,r,a,n){super(i,{layout:y||(y=new n5({visibility:new n1(n4.layout_hillshade.visibility)})),paint:x||(x=new n5({"hillshade-illumination-direction":new n1(n4.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new n1(n4.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new n1(n4.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new n1(n4.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new n1(n4.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new n1(n4.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new n1(n4.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(i,r,a){return{overrideFog:!1}}},fill:class extends op{constructor(i,r,a,n){super(i,{layout:v||(v=new n5({"fill-sort-key":new n2(n4.layout_fill["fill-sort-key"]),visibility:new n1(n4.layout_fill.visibility),"fill-elevation-reference":new n1(n4.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new n2(n4.layout_fill["fill-construct-bridge-guard-rail"])}
7)),paint:b||(b=new n5({"fill-antialias":new n1(n4.paint_fill["fill-antialias"]),"fill-opacity":new n2(n4.paint_fill["fill-opacity"]),"fill-color":new n2(n4.paint_fill["fill-color"]),"fill-outline-color":new n2(n4.paint_fill["fill-outline-color"]),"fill-translate":new n1(n4.paint_fill["fill-translate"]),"fill-translate-anchor":new n1(n4.paint_fill["fill-translate-anchor"]),"fill-pattern":new n2(n4.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new n1(n4.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new n1(n4.paint_fill["fill-emissive-strength"]),"fill-z-offset":new n2(n4.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new n2(n4.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new n2(n4.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}getProgramIds(){let i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),a=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&a.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),a}getDefaultProgramParams(i,r,a){return{config:new sB(this,{zoom:r,lut:a}),overrideFog:!1}}recalculate(i,r){super.recalculate(i,r);let a=this.paint._values["fill-outline-color"];"constant"===a.value.kind&&void 0===a.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new uI(i)}queryRadius(){return lj(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,a,n,o,s){return!i.queryGeometry.isAboveHorizon&&lP(lG(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),n)}isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(i){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;let r=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=i?r&&!i:r}hasElevation(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class extends op{constructor(i,r,a,n){super(i,{layout:S||(S=new n5({visibility:new n1(n4["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new n1(n4["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new n1(n4["layout_fill-extrusion"]["source-max-zoom"])})),paint:I||(I=new n5({"fill-extrusion-opacity":new n1(n4["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new n2(n4["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new n1(n4["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new n1(n4["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new n2(n4["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new n1(n4["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new n2(n4["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new n2(n4["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new n1(n4["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new n1(n4["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new n1(n4["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new n1(n4["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new n1(n4["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new n1(n4["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new n1(n4["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new n1(n4["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new n1(n4["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new n1(n4["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new n2(n4["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new n2(n4["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new n1(n4["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new n1(n4["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new n1(n4["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new n1(n4["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new n1(n4["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new n2(n4["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new n2(n4["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new n1(n4["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(i){return new ct(i)}queryRadius(){return lj(this.paint.get("fill-extrusion-translate"))}is3D(i){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(i,r,a,n,o,s,l,h,u){let c=lq(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),d=this.paint.get("fill-extrusion-height").evaluate(r,a),p=this.paint.get("fill-extrusion-base").evaluate(r,a),f=[0,0],m=h&&s.elevation,_=s.elevation?s.elevation.exaggeration():1,g=i.tile.getBucket(this);if(g instanceof ct){let i=g.centroidData.find(i=>u>=i.vertexArrayOffset&&u<i.vertexArrayOffset+i.vertexCount);if(i&&0x40000000&i.flags)return!1;if(m){let i=g.centroidVertexArray,r=u+1;r<i.length&&(f[0]=i.geta_centroid_pos0(r),f[1]=i.geta_centroid_pos1(r))}}if(0===f[0]&&1===f[1])return!1;"globe"===s.projection.name&&(n=ch([n],[new e4(0,0),new e4(8192,8192)],i.tileID.canonical).map(i=>i.polygon).flat());let[y,x]=cx(s,n,p,d,c,l,m?h:null,f,_,s.center.lat,i.tileID.canonical),v=i.queryGeometry;return cy(y,x,v.isPointQuery()?v.screenBounds:v.screenGeometry)}},building:class extends op{constructor(i,r,a,n){super(i,{layout:E||(E=new n5({visibility:new n1(n4.layout_building.visibility),"building-facade":new n2(n4.layout_building["building-facade"]),"building-facade-floors":new n2(n4.layout_building["building-facade-floors"]),"building-facade-unit-width":new n2(n4.layout_building["building-facade-unit-width"]),"building-facade-window":new n2(n4.layout_building["building-facade-window"]),"building-roof-shape":new n2(n4.layout_building["building-roof-shape"]),"building-height":new n2(n4.layout_building["building-height"]),"building-base":new n2(n4.layout_building["building-base"]),"building-flood-light-wall-radius":new n2(n4.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new n2(n4.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new n2(n4.layout_building["building-flip-roof-orientation"])})),paint:A||(A=new n5({"building-opacity":new n1(n4.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new n1(n4.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new n1(n4.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new n1(n4.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new n1(n4.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new n1(n4.paint_building["building-vertical-scale"]),"building-cast-shadows":new n1(n4.paint_building["building-cast-shadows"]),"building-color":new n2(n4.paint_building["building-color"]),"building-emissive-strength":new n2(n4.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new n1(n4.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new n1(n4.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new n1(n4.paint_building["building-front-cutoff"]),"building-flood-light-color":new n1(n4.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new n1(n4.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new n1(n4.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(i){return new dw(i)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(i){return!0}queryRadius(i){return 0}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){let d=this.layout.get("building-height").evaluate(r,a),p=this.layout.get("building-base").evaluate(r,a),f=i.tile.getBucket(this).getFootprint(r);if(f){if(0!==f.hiddenFlags)return!1;d=f.height}let[m,_]=cx(s,n,p,d,new e4(0,0),l,null,[0,0],1,s.center.lat,i.tileID.canonical),g=i.queryGeometry;return cy(m,_,g.isPointQuery()?g.screenBounds:g.screenGeometry)}},line:class extends op{constructor(i,r,a,n){const o=dU();super(i,o,r,a,n),o.layout&&(this.layout=new n0(o.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(i){if("line-gradient"===i){let i=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=i._styleExpression&&i._styleExpression.expression instanceof r2,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(i,r){super.recalculate(i,r),this.paint._values["line-floorwidth"]=(D||((D=new dj(dU().paint.properties["line-width"].specification)).useIntegerZoom=!0),D).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new dL(i)}getProgramIds(){let i=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return"default"!==this.paint.get("line-blend-mode")&&i.push("lineBlendComposite"),i}getDefaultProgramParams(i,r,a){if("lineBlendComposite"===i)return{};let n=dV(this);return{config:new sB(this,{zoom:r,lut:a}),defines:n,overrideFog:!1}}queryRadius(i){var r,a;return r=lU("line-width",this,i),((a=lU("line-gap-width",this,i))>0?a+2*r:r)/2+Math.abs(lU("line-offset",this,i))+lj(this.paint.get("line-translate"))}queryIntersectsFeature(i,r,a,n,o,s){var l,h;if(i.queryGeometry.isAboveHorizon)return!1;let u=lG(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=i.pixelToTileUnitsFactor/2*(l=this.paint.get("line-width").evaluate(r,a),(h=this.paint.get("line-gap-width").evaluate(r,a))>0?h+2*l:l),d=this.paint.get("line-offset").evaluate(r,a);return d&&(n=function(i,r){let a=[],n=new e4(0,0);for(let o=0;o<i.length;o++){let s=i[o],l=[];for(let i=0;i<s.length;
7i++){let a=s[i],o=s[i+1],h=0===i?n:a.sub(s[i-1])._unit()._perp(),u=i===s.length-1?n:o.sub(a)._unit()._perp(),c=h._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),l.push(c._mult(r)._add(a))}a.push(l)}return a}(n,d*i.pixelToTileUnitsFactor)),function(i,r,a){for(let n=0;n<r.length;n++){let o=r[n];if(i.length>=3){for(let r=0;r<o.length;r++)if(lO(i,o[r]))return!0}if(function(i,r,a){if(i.length>1){if(lD(i,r))return!0;for(let n=0;n<r.length;n++)if(lL(r[n],i,a))return!0}for(let n=0;n<i.length;n++)if(lL(i[n],r,a))return!0;return!1}(i,o,a))return!0}return!1}(u,n,c)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(i){return!this.hasElevatedBuckets||this.layout&&"hd-road-markup"===this.layout.get("line-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("line-elevation-reference")}hasOffscreenPass(){return"default"!==this.paint.get("line-blend-mode")&&0!==this.paint.get("line-opacity").constantOr(1)&&0!==this.paint.get("line-width").constantOr(1)&&"none"!==this.visibility}resize(){this._destroyLineBlendFbo()}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(){this.lineBlendFbo&&(this.lineBlendFbo.destroy(),this.lineBlendFbo=null),this.lineBlendStencil=null,this.lineBlendDrapeFbo&&(this.lineBlendDrapeFbo.destroy(),this.lineBlendDrapeFbo=null),this.lineBlendDrapeStencil=null}},symbol:f$,background:class extends op{constructor(i,r,a,n){super(i,{layout:F||(F=new n5({visibility:new n1(n4.layout_background.visibility)})),paint:O||(O=new n5({"background-pitch-alignment":new n1(n4.paint_background["background-pitch-alignment"]),"background-color":new n1(n4.paint_background["background-color"]),"background-pattern":new n1(n4.paint_background["background-pattern"]),"background-opacity":new n1(n4.paint_background["background-opacity"]),"background-emissive-strength":new n1(n4.paint_background["background-emissive-strength"]),"background-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(i,r,a){return{overrideFog:!1}}is3D(i){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:fK,"raster-particle":fJ,sky:class extends op{constructor(i,r,a,n){super(i,{layout:U||(U=new n5({visibility:new n1(n4.layout_sky.visibility)})),paint:j||(j=new n5({"sky-type":new n1(n4.paint_sky["sky-type"]),"sky-atmosphere-sun":new n1(n4.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new n1(n4.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new n1(n4.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new n1(n4.paint_sky["sky-gradient-radius"]),"sky-gradient":new n3(n4.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new n1(n4.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new n1(n4.paint_sky["sky-atmosphere-color"]),"sky-opacity":new n1(n4.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(i){"sky-gradient"===i?this._updateColorRamp():"sky-atmosphere-sun"!==i&&"sky-atmosphere-halo-color"!==i&&"sky-atmosphere-color"!==i&&"sky-atmosphere-sun-intensity"!==i||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=hA({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(i){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){let r=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(i,r){if("atmosphere"===this.paint.get("sky-type")){let a=this.paint.get("sky-atmosphere-sun"),n=!a,o=i.style.light,s=o.properties.get("position");return n&&"viewport"===o.properties.get("anchor")&&t_("The sun direction is attached to a light with viewport anchor, lighting may behave unex
7pectedly."),n?f0(s.azimuthal,90-s.polar,r):f0(a[0],90-a[1],r)}let a=this.paint.get("sky-gradient-center");return f0(a[0],90-a[1],r)}isSky(){return!0}markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let i=this.paint.get("sky-type");return"atmosphere"===i?["skyboxCapture","skybox"]:"gradient"===i?["skyboxGradient"]:null}},slot:class extends op{constructor(i,r,a,n){super(i,{paint:G||(G=new n5({}))},r,null)}},model:class extends op{constructor(i,r,a,n){super(i,{layout:q||(q=new n5({visibility:new n1(n4.layout_model.visibility),"model-id":new n2(n4.layout_model["model-id"]),"model-allow-density-reduction":new n1(n4.layout_model["model-allow-density-reduction"])})),paint:$||($=new n5({"model-opacity":new n2(n4.paint_model["model-opacity"]),"model-rotation":new n2(n4.paint_model["model-rotation"]),"model-scale":new n2(n4.paint_model["model-scale"]),"model-translation":new n2(n4.paint_model["model-translation"]),"model-color":new n2(n4.paint_model["model-color"]),"model-color-mix-intensity":new n2(n4.paint_model["model-color-mix-intensity"]),"model-type":new n1(n4.paint_model["model-type"]),"model-cast-shadows":new n1(n4.paint_model["model-cast-shadows"]),"model-receive-shadows":new n1(n4.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new n1(n4.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new n2(n4.paint_model["model-emissive-strength"]),"model-roughness":new n2(n4.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new n2(n4.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new n1(n4.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new n1(n4.paint_model["model-front-cutoff"]),"model-elevation-reference":new n1(n4.paint_model["model-elevation-reference"]),"model-ignore-line-cutout":new n1(n4.paint_model["model-ignore-line-cutout"]),"model-color-use-theme":new n2({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this.layer=i,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(i){return new f4(i)}getProgramIds(){return["model"]}is3D(i){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(i){return 8191*(i instanceof mt)}queryRenderedFeatures(i,r,a){let n=r.getSource();if(!(n&&n instanceof mn))return{};let o={};o[this.id]=[];let s=o[this.id],l=0;for(let o of n.models){let n=r.getFeatureState(this.sourceLayer,o.id),h={type:"Unknown",id:o.id,properties:o.featureProperties},u=this.paint.get("model-rotation").evaluate(h,n),c=this.paint.get("model-scale").evaluate(h,n),d=this.paint.get("model-translation").evaluate(h,n),p=this.paint.get("model-elevation-reference"),f=[];c7(f,o,a,o.position,u,c,d,"ground"===p,"ground"===p,!1),"globe"===a.projection.name&&(f=c6(f,a));let m=ei([],a.projMatrix,f),_=c8(i.isPointQuery()?i.screenBounds:i.screenGeometry,a,m,o.aabb);if(null!=_){let i=new ma(void 0,0,0,0,o.id);i.layer=this.layer,i.properties=structuredClone(o.featureProperties),i.properties.layer=this.id,i.properties.uri=o.uri,i.properties.orientation=o.orientation,i.sourceLayer=this.sourceLayer,i.geometry={type:"Point",coordinates:[o.position.lng,o.position.lat]},i.state=n,i.source=this.source,s.push({featureIndex:l,feature:i,intersectionZ:_})}++l}return o}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){if(!this.modelManager)return!1;let d=this.modelManager,p=i.tile.getBucket(this);if(!(p&&p instanceof f4))return!1;for(let a in p.instancesPerModel){let n=p.instancesPerModel[a],o=void 0!==r.id?r.id:r.properties&&r.properties.hasOwnProperty("id")?r.properties.id:void 0;if(n.idToFeaturesIndex.hasOwnProperty(o)){let r=n.features[n.idToFeaturesIndex[o]],l=d.getModel(a,c||this.scope);if(!l)return!1;let h=[],u=new sX(0,0),f=p.canonical,m=Number.MAX_VALUE;for(let a=0;a<r.instancedDataCount;++a){let o=16*(r.instancedDataOffset+a),c=n.instancedDataArray.float32,d=[c[o+4],c[o+5],c[o+6]];mo(f,u,Math.floor(c[o]),Math.floor(c[o+1])),c7(h,l,s,u,r.rotation,r.scale,d,!1,!1,!1),"globe"===s.projection.name&&(h=c6(h,s));let p=ei([],s.projMatrix,h),_=i.queryGeometry,g=c8(_.isPointQuery()?_.screenBounds:_.screenGeometry,s,p,l.aabb);null!=g&&(m=Math.min(g,m))}return m!==Number.MAX_VALUE&&m}}return!1}_handleOverridablePaintPropertyUpdate(i,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven()||"model-color"!==i&&"model-color-mix-intensity"!==i&&"model-rotation"!==i&&"model-scale"!==i&&"model-translation"!==i&&"model-emissive-strength"!==i)}_isPropertyZoomDependent(i){let r=this._transitionablePaint._values[i];return null!=r&&null!=r.value&&null!=r.value.expression&&r.value.expression instanceof a3}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends op{constructor(i,r,a,n){super(i,{layout:w||(w=new n5({"clip-layer-types":ne
7w n1(n4.layout_clip["clip-layer-types"]),"clip-layer-scope":new n1(n4.layout_clip["clip-layer-scope"]),visibility:new n1(n4.layout_clip.visibility)})),paint:T||(T=new n5({}))},r,a,n)}recalculate(i,r){super.recalculate(i,r)}createBucket(i){return new uC(i)}is3D(i){return!0}}};class ml{constructor(i){this._callback=i,this._triggered=!1,"u">typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class mh{constructor(i){this._stringToNumber={},this._numberToString=[];for(let r=0;r<i.length;r++){const a=i[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(i){return this._stringToNumber[i]}decode(i){return this._numberToString[i]}}class mu{constructor(i,r){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new a9(8192,16,0),this.featureIndexArray=new si,this.promoteId=r,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(i,r,a,n,o,s=0,l=0){let h=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,n,o,s);let u=this.grid;for(let i=0;i<r.length;i++){let a=r[i],n=[1/0,1/0,-1/0,-1/0];for(let i=0;i<a.length;i++){let r=a[i];n[0]=Math.min(n[0],r.x),n[1]=Math.min(n[1],r.y),n[2]=Math.max(n[2],r.x),n[3]=Math.max(n[3],r.y)}0!==l&&(n[0]-=l,n[1]-=l,n[2]+=l,n[3]+=l),n[0]<8192&&n[1]<8192&&n[2]>=0&&n[3]>
7=0&&u.insert(h,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers)for(let i in this.vtLayers=new lo(new d6(this.rawTileData)).layers,this.sourceLayerCoder=new mh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r){let a,{tilespaceGeometry:n,transform:o,tileTransform:s,pixelPosMatrix:l,availableImages:h,worldview:u}=r;this.loadVTLayers(),this.serializedLayersCache.clear();let c=r.queryRadius?r.queryRadius:0,d=n.bufferedTilespaceBounds,p=this.grid.query(d.min.x,d.min.y,d.max.x,d.max.y,(i,r,a,o)=>lB(n.bufferedTilespaceGeometry,i-c,r-c,a+c,o+c));p.sort(md);let f=null;o.elevation&&p.length>0&&(f=f6.create(o.elevation,this.tileID));let m={};for(let c=0;c<p.length;c++){let d=p[c];if(d===a)continue;a=d;let _=this.featureIndexArray.get(d),g=null;this.is3DTile?this.loadMatchingModelFeature(m,_,i,n,o,u):this.loadMatchingFeature(m,_,i,h,u,(i,a,h,u=0)=>(g||(g=le(i,this.tileID.canonical,s)),a.queryIntersectsFeature(n,i,h,g,this.z,o,l,f,u,r.scope)))}return m}loadMatchingFeature(i,r,a,n,o,s){let{featureIndex:l,bucketIndex:h,sourceLayerIndex:u,layoutVertexArrayOffset:c}=r,d=this.bucketLayerIDs[h],p=a.layers,f=Object.keys(p);if(f.length&&!tf(f,d))return;let m=a.sourceCache,_=this.sourceLayerCoder.decode(u),g=this.vtLayers[_].feature(l),y=this.getId(g,_);for(let r=0;r<d.length;r++){let a=d[r];if(!p[a])continue;let{styleLayer:h,targets:u}=p[a],f={};void 0!==y&&(f=m.getFeatureState(h.sourceLayer,y));let _=!s||s(g,h,f,c);if(!_)continue;let x=new ma(g,this.z,this.x,this.y,y);x.tile=this.tileID.canonical,x.state=f;let v=this.serializedLayersCache.get(a);v||((v=h.serialize()).id=a,this.serializedLayersCache.set(a,v)),x.source=v.source,x.sourceLayer=v["source-layer"],x.layer=Object.assign({},v),x.layer.paint=mc(v.paint,h.paint,g,f,n),x.layer.layout=mc(v.layout,h.layout,g,f,n);let b=!1;for(let i of u){this.updateFeatureProperties(x,i);let{filter:r}=i;if(r){if(g.properties=x.properties,r.needGeometry){let i=lt(g,!0);if(!r.filter(new nH(this.tileID.overscaledZ,{worldview:o}),i,this.tileID.canonical))continue}else if(!r.filter(new nH(this.tileID.overscaledZ,{worldview:o}),g))continue}b=!0,i.targetId&&this.addFeatureVariant(x,i)}b&&this.appendToResult(i,a,l,x,_)}}loadMatchingModelFeature(i,r,a,n,o,s){let{featureIndex:l,bucketIndex:h}=r,u=this.bucketLayerIDs[h],c=a.layers,d=Object.keys(c);if(!d.length||tf(d,u))for(let r=0;r<u.length;r++){let h=u[r],{styleLayer:d,targets:p}=c[h];if("model"!==d.type)continue;let f=n.tile,m=f.getBucket(d);if(!(m&&m instanceof mt))continue;let _=function(i,r,a,n){let o=i.getNodesInfo()[r];if(!o||o.hiddenByReplacement||!o.node.meshes)return;let s=Number.MAX_VALUE,l=o.node,h=a.tile,u=n.calculatePosMatrix(h.tileID.toUnwrapped(),n.worldSize),c=o.evaluatedScale,d=0;n.elevation&&l.elevation&&(d=l.elevation*n.elevation.exaggeration()),er(u,u,[(l.anchor?l.anchor[0]:0)*(c[0]-1),(l.anchor?l.anchor[1]:0)*(c[1]-1),d]),ea(u,u,c);let p=a.queryGeometry,f=p.isPointQuery()?p.screenBounds:p.screenGeometry,m=function(i){let r=ei([],u,i.globalMatrix);ei(r,n.expandedFarZProjMatrix,r);for(let a=0;a<i.meshes.length;++a){let o=i.meshes[a];if(a===i.lightMeshIndex)continue;let l=c8(f,n,r,o.aabb);null!=l&&(s=Math.min(l,s))}if(i.children)for(let r of i.children)m(r)};if(m(l),s===Number.MAX_VALUE)return;let _=new sX(0,0);return mo(h.tileID.canonical,_,o.node.anchor[0],o.node.anchor[1]),{intersectionZ:s,position:_,feature:o.feature}}(m,l,n,o);if(!_)continue;let{z:g,x:y,y:x}=f.tileID.canonical,{feature:v,intersectionZ:b,position:w}=_,T={};void 0!==v.id&&(T=a.sourceCache.getFeatureState(d.sourceLayer,v.id));let S=new ma({},g,y,x,v.id);S.tile=this.tileID.canonical,S.state=T,S.properties=v.properties,S.geometry={type:"Point",coordinates:[w.lng,w.lat]};let I=this.serializedLayersCache.get(h);I||((I=d.serialize()).id=h,this.serializedLayersCache.set(h,I)),S.source=I.source,S.sourceLayer=I["source-layer"],S.layer=Object.assign({},I);let E=!1;for(let i of p){this.updateFeatureProperties(S,i);let{filter:r}=i;if(r){if(v.properties=S.properties,r.needGeometry){if(!r.filter(new nH(this.tileID.overscaledZ,{worldview:s}),v,this.tileID.canonical))continue}else if(!r.filter(new nH(this.tileID.overscaledZ,{worldview:s}),v))continue}E=!0,i.targetId&&this.addFeatureVariant(S,i)}E&&this.appendToResult(i,h,l,S,b)}}updateFeatureProperties(i,r,a){if(r.properties){let n={};for(let o in r.properties){let s=r.properties[o].evaluate({zoom:this.z},i._vectorTileFeature,i.state,i.tile,a);null!=s&&(n[o]=s)}i.properties=n}}addFeatureVariant(i,r,a){let n={target:r.target,namespace:r.namespace,uniqueFeatureID:r.uniqueFeatureID};r.properties&&(n.properties=i.properties),i.variants=i.variants||{},i.variants[r.targetId]=i.variants[r.targetId]||[],i.variants[r.targetId].push(n)}appendToResult(i,r,a,n,o){let s=i[r];void 0===s&&(s=i[r]=[]),s.push({featureIndex:a,feature:n,intersectionZ:o})}lookupSymbolFeatures(i,r,a,n,o,s){let l={};
7for(let h of(this.loadVTLayers(),i))this.loadMatchingFeature(l,{bucketIndex:r,sourceLayerIndex:a,featureIndex:h,layoutVertexArrayOffset:0},n,o,s);return l}loadFeature(i){let{featureIndex:r,sourceLayerIndex:a}=i;this.loadVTLayers();let n=this.sourceLayerCoder.decode(a),o=this.vtFeatures[n];if(o[r])return o[r];let s=this.vtLayers[n].feature(r);return o[r]=s,s}hasLayer(i){for(let r of this.bucketLayerIDs)for(let a of r)if(i===a)return!0;return!1}getId(i,r){let a=i.id;if(this.promoteId){let n=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[r];if(null!=n)if(Array.isArray(n)){if(!this.promoteIdExpression){let i=a1(n);if("success"!==i.result){let r=i.value.map(i=>`${i.key}: ${i.message}`).join(", ");return void t_(`Failed to create expression for promoteId: ${r}`)}this.promoteIdExpression=i.value}a=this.promoteIdExpression.evaluate({zoom:0},i)}else a=i.properties[n];"boolean"==typeof a&&(a=Number(a))}return a}}function mc(i,r,a,n,o){return tc(i,(i,s)=>{let l=r instanceof n0?r.get(s):null;return l&&l.evaluate?l.evaluate(a,n,void 0,o):l})}function md(i,r){return r-i}function mp(i,r){let a={};if(!r)return a;for(let n of i){let i=n.layerIds.map(i=>r.getLayer(i)).filter(Boolean);if(0!==i.length)for(let r of(n.layers=i,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(r=>i.filter(i=>i.id===r)[0])),i))a[r.fqid]=n}return a}ne(mu,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let mf=new Uint16Array(8184);for(let i=0;i<2046;i++){let r=i+2,a=0,n=0,o=0,s=0,l=0,h=0;for(1&r?o=s=l=32:a=n=h=32;(r>>=1)>1;){let i=a+o>>1,u=n+s>>1;1&r?(o=a,s=n,a=l,n=h):(a=o,n=s,o=l,s=h),l=i,h=u}let u=4*i;mf[u+0]=a,mf[u+1]=n,mf[u+2]=o,mf[u+3]=s}let mm=new Uint16Array(2178),m_=new Uint8Array(1089),mg=new Uint16Array(1089);function my(i){return 0===i?-.03125:.03125*(32===i)}let mx={Other:0,Symbol:1,FillExtrusion:2},mv={type:2,extent:8192,loadGeometry:()=>[[new e4(0,0),new e4(8193,0),new e4(8193,8193),new e4(0,8193),new e4(0,0)]]};class mb{constructor(){this.tasks={},this.taskQueue=[],tu(["process"],this),this.invoker=new ml(this.process),this.nextId=0}add(i,r){let a=this.nextId++,n=function({type:i,renderSourceType:r,zoom:a}){a=a||0;let n=r===mx.Symbol;return"message"===i?0:"maybePrepare"!==i||n?"parseTile"!==i||n?"parseTile"===i&&n?300-a:"maybePrepare"===i&&n?400-a:500:200-a:100-a}(r);return 0===n?(i(),null):(this.tasks[a]={fn:i,metadata:r,priority:n,id:a},this.taskQueue.push(a),this.invoker.trigger(),{cancel:()=>{delete this.tasks[a]}})}process(){{if(this.taskQueue=this.taskQueue.filter(i=>!!this.tasks[i]),!this.taskQueue.length)return;let i=this.pick();if(null===i)return;let r=this.tasks[i];if(delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}}pick(){let i=null,r=1/0;for(let a=0;a<this.taskQueue.length;a++){let n=this.tasks[this.taskQueue[a]];n.priority<r&&(r=n.priority,i=a)}if(null===i)return null;let a=this.taskQueue[i];return this.taskQueue.splice(i,1),a}remove(){this.invoker.remove()}}let mw=new i_(0,0,0);function mT(i,r,a){var n;1===i&&r.icons.push((n=a.readVarint()+a.pos,function(i){if(i.usvg_tree.height||(i.usvg_tree.height=i.usvg_tree.width),!i.metadata)return i;let{metadata:r}=i;if(r.content_area){let{content_area:a}=r;null==a.left&&(a.left=0),null==a.top&&(a.top=a.left),null==a.width&&(a.width=i.usvg_tree.width),null==a.height&&(a.height=a.width)}if(r.text_placeholder){let{text_placeholder:i}=r;null==i.top&&(i.top=i.left),null==i.height&&(i.height=i.width)}return r.stretch_x&&r.stretch_x.length&&mS(r,"x"),r.stretch_y&&r.stretch_y.length&&mS(r,"y"),i}(a.readFields(mI,{name:void 0},n))))}function mS(i,r){let a=[],n=i[`stretch_${r}`],o=null;for(let i=0;i<n.length;i++)null===o?o=0===a.length?n[0]:a[a.length-1][1]+n[i]:(a.push([o,o+n[i]]),o=null);i[`stretch_${r}_areas`]=a}function mI(i,r,a){var n,o;1===i?r.name=a.readString():2===i?(n=a.readVarint()+a.pos,r.metadata=a.readFields(mE,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},n)):3===i&&(o=a.readVarint()+a.pos,r.usvg_tree=a.readFields(mP,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},o),r.data="usvg_tree")}function mE(i,r,a){var n;1===i?r.stretch_x=a.readPackedVarint():2===i?r.stretch_y=a.readPackedVarint():3===i?r.content_area=mA(a,a.readVarint()+a.pos):4===i?r.variables.push((n=a.readVarint()+a.pos,a.readFields(mM,{name:void 0},n))):5===i&&(r.text_placeholder=mA(a,a.readVarint()+a.pos))}function mA(i,r){return i.readFields(mC,{},r)}function mC(i,r,a){1===i?r.left=a.readVarint():2===i?r.width=a.readVarint():3===i?r.top=a.readVarint():4===i&&(r.height=a.readVarint())}function mM(i,r,a){1===i?r.name=a.readString():2===i&&(r.rgb_color=mk(a.readVarint()),r.value="rgb_color")}function mP(i,r,a){var n,o,s,l;let h;1===i?r.width=r.height=a.readVarint():2===i?r.height=a.readVarint():3===i?r.children.push(mD(a,a.readVarint()+a.pos)):4===i?r.linear_gradients.push((n=a.readVarint()+a.pos,a.readFields(mN,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},n))):5===i?r.radial_gradients.push((o=a.readVarint()+a.pos,a.readFields(mG,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},o))):7===i?r.clip_paths.push((s=a.readVarint()+a.pos,a.readFields(mq,{children:[]},s))):8===i&&r.masks.push((l=a.readVarint()+a.pos,null==(h=a.readFields(m$,{left:0,width:20,mask_type:1,children:[]}
7,l)).height&&(h.height=h.width),null==h.top&&(h.top=h.left),h))}function mD(i,r){return i.readFields(mR,{},r)}function mR(i,r,a){var n,o;1===i?(n=a.readVarint()+a.pos,r.group=a.readFields(mL,{opacity:255,children:[]},n),r.node="group"):2===i&&(o=a.readVarint()+a.pos,r.path=a.readFields(mO,{paint_order:1,commands:[],step:1,diffs:[],rule:1},o),r.node="path")}function mL(i,r,a){1===i?r.transform=mz(a,a.readVarint()+a.pos):2===i?r.opacity=a.readVarint():5===i?r.clip_path_idx=a.readVarint():6===i?r.mask_idx=a.readVarint():7===i&&r.children.push(mD(a,a.readVarint()+a.pos))}function mz(i,r){return i.readFields(mF,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},r)}function mF(i,r,a){1===i?r.sx=a.readFloat():2===i?r.ky=a.readFloat():3===i?r.kx=a.readFloat():4===i?r.sy=a.readFloat():5===i?r.tx=a.readFloat():6===i&&(r.ty=a.readFloat())}function mO(i,r,a){var n,o;1===i?(n=a.readVarint()+a.pos,r.fill=a.readFields(mB,{rgb_color:mw,paint:"rgb_color",opacity:255},n)):2===i?(o=a.readVarint()+a.pos,r.stroke=a.readFields(mV,{rgb_color:mw,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},o)):3===i?r.paint_order=a.readVarint():5===i?a.readPackedVarint(r.commands):6===i?r.step=a.readFloat():7===i?a.readPackedSVarint(r.diffs):8===i&&(r.rule=a.readVarint())}function mB(i,r,a){1===i?(r.rgb_color=mk(a.readVarint()),r.paint="rgb_color"):2===i?(r.linear_gradient_idx=a.readVarint(),r.paint="linear_gradient_idx"):3===i?(r.radial_gradient_idx=a.readVarint(),r.paint="radial_gradient_idx"):5===i&&(r.opacity=a.readVarint())}function mk(i){return new i_((i>>16&255)/255,(i>>8&255)/255,(255&i)/255,1)}function mV(i,r,a){1===i?(r.rgb_color=mk(a.readVarint()),r.paint="rgb_color"):2===i?(r.linear_gradient_idx=a.readVarint(),r.paint="linear_gradient_idx"):3===i?(r.radial_gradient_idx=a.readVarint(),r.paint="radial_gradient_idx"):5===i?a.readPackedFloat(r.dasharray):6===i?r.dashoffset=a.readFloat():7===i?r.miterlimit=a.readFloat():8===i?r.opacity=a.readVarint():9===i?r.width=a.readFloat():10===i?r.linecap=a.readVarint():11===i&&(r.linejoin=a.readVarint())}function mN(i,r,a){1===i?r.transform=mz(a,a.readVarint()+a.pos):2===i?r.spread_method=a.readVarint():3===i?r.stops.push(mU(a,a.readVarint()+a.pos)):4===i?r.x1=a.readFloat():5===i?r.y1=a.readFloat():6===i?r.x2=a.readFloat():7===i&&(r.y2=a.readFloat())}function mU(i,r){return i.readFields(mj,{offset:0,opacity:255,rgb_color:mw},r)}function mj(i,r,a){1===i?r.offset=a.readFloat():2===i?r.opacity=a.readVarint():3===i&&(r.rgb_color=mk(a.readVarint()))}function mG(i,r,a){1===i?r.transform=mz(a,a.readVarint()+a.pos):2===i?r.spread_method=a.readVarint():3===i?r.stops.push(mU(a,a.readVarint()+a.pos)):4===i?r.cx=a.readFloat():5===i?r.cy=a.readFloat():6===i?r.r=a.readFloat():7===i?r.fx=a.readFloat():8===i?r.fy=a.readFloat():9===i&&(r.fr=a.readFloat())}function mq(i,r,a){1===i?r.transform=mz(a,a.readVarint()+a.pos):2===i?r.clip_path_idx=a.readVarint():3===i&&r.children.push(mD(a,a.readVarint()+a.pos))}function m$(i,r,a){1===i?r.left=r.top=a.readFloat():2===i?r.width=r.height=a.readFloat():3===i?r.top=a.readFloat():4===i?r.height=a.readFloat():5===i?r.mask_type=a.readVarint():6===i?r.mask_idx=a.readVarint():7===i&&r.children.push(mD(a,a.readVarint()+a.pos))}class mH{static calculate(i={},r=[]){let a=new Map,n=new Map;if(0===Object.keys(i).length)return a;for(let[o,s]of(r.forEach(i=>{n.set(i.name,i.rgb_color||new i_(0,0,0))}),Object.entries(i)))n.has(o)?a.set(n.get(o).toString(),s):console.warn(`Ignoring unknown image variable "${o}"`);return a}}function mZ(i,r=255,a){let n=i.toString(),o=a.has(n)?a.get(n).clone():i.clone();return o.a*=r/255,o.toString()}function mW(i,r){if(!tF()){let a=document.createElement("canvas");return a.width=i,a.height=r,a}return new OffscreenCanvas(i,r)}let mX,mY=null;function mK(i,r,a,n,o){for(let s of n.children)(function i(r,a,n,o,s){var l;o.group?(r.save(),function(r,a,n,o,s){var l,h;let u=null!=o.mask_idx?n.masks[o.mask_idx]:null,c=null!=o.clip_path_idx?n.clip_paths[o.clip_path_idx]:null;if(o.transform&&(a=m3(o.transform).preMultiplySelf(a)),l=null!=c,h=null!=u,255===o.opacity&&!l&&!h)return mK(r,a,n,o,s);let d=mW(r.canvas.width,r.canvas.height),p=d.getContext("2d");mK(p,a,n,o,s),c&&function i(r,a,n,o){let s=mW(r.canvas.width,r.canvas.height);(function r(a,n,o,s){let l=s.transform?m3(s.transform).preMultiplySelf(n):n,h=mW(a.canvas.width,a.canvas.height),u=h.getContext("2d");for(let i of s.children)if(i.group)r(u,l,o,i.group);else if(i.path){let r=i.path,a=new Path2D;a.addPath(m4(r),l),u.fill(a,mQ(r))}let c=null!=s.clip_path_idx?o.clip_paths[s.clip_path_idx]:null;c&&i(u,l,o,c),a.globalCompositeOperation="source-over",a.drawImage(h,0,0)})(s.getContext("2d"),a,n,o),r.globalCompositeOperation="destination-in",r.drawImage(s,0,0)}
7(p,a,n,c),u&&function r(a,n,o,s,l){if(0===s.children.length)return;let h=null!=s.mask_idx?o.masks[s.mask_idx]:null;h&&r(a,n,o,h,l);let u=a.canvas.width,c=a.canvas.height,d=mW(u,c),p=d.getContext("2d"),f=s.width,m=s.height,_=s.left,g=s.top,y=new Path2D,x=new Path2D;for(let r of(x.rect(_,g,f,m),y.addPath(x,n),p.clip(y),s.children))i(p,n,o,r,l);let v=p.getImageData(0,0,u,c),b=v.data;if(1===s.mask_type)for(let i=0;i<b.length;i+=4)b[i+3]=b[i+3]/255*(.2126*b[i]+.7152*b[i+1]+.0722*b[i+2]);p.putImageData(v,0,0),a.globalCompositeOperation="destination-in",a.drawImage(d,0,0)}(p,a,n,u,s),r.globalAlpha=o.opacity/255,r.drawImage(d,0,0)}(r,a,n,o.group,s),r.restore()):o.path&&(r.save(),l=o.path,r.setTransform(a),1===l.paint_order?(mJ(r,n,l,s),m0(r,n,l,s)):(m0(r,n,l,s),mJ(r,n,l,s)),r.restore())})(i,r,a,s,o)}function mJ(i,r,a,n){let o=a.fill;if(!o)return;let s=o.opacity/255;switch(i.save(),i.beginPath(),m5(a,i),o.paint){case"rgb_color":i.fillStyle=mZ(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":{let a=r.linear_gradients[o.linear_gradient_idx];a.transform&&i.setTransform(m3(a.transform).preMultiplySelf(i.getTransform())),i.fillStyle=m1(i,a,s,n);break}case"radial_gradient_idx":{let a=r.radial_gradients[o.radial_gradient_idx];a.transform&&i.setTransform(m3(a.transform).preMultiplySelf(i.getTransform())),i.fillStyle=m2(i,a,s,n)}}i.fill(mQ(a)),i.restore()}function mQ(i){return 1===i.rule?"nonzero":2===i.rule?"evenodd":void 0}function m0(i,r,a,n){let o=a.stroke;if(!o)return;let s=m4(a);i.lineWidth=o.width,i.miterLimit=o.miterlimit,i.setLineDash(o.dasharray),i.lineDashOffset=o.dashoffset;let l=o.opacity/255;switch(o.paint){case"rgb_color":i.strokeStyle=mZ(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":i.strokeStyle=m1(i,r.linear_gradients[o.linear_gradient_idx],l,n,!0);break;case"radial_gradient_idx":i.strokeStyle=m2(i,r.radial_gradients[o.radial_gradient_idx],l,n,!0)}switch(o.linejoin){case 2:case 1:i.lineJoin="miter";break;case 3:i.lineJoin="round";break;case 4:i.lineJoin="bevel"}switch(o.linecap){case 1:i.lineCap="butt";break;case 2:i.lineCap="round";break;case 3:i.lineCap="square"}i.stroke(s)}function m1(i,r,a,n,o=!1){if(1===r.stops.length){let i=r.stops[0];return mZ(i.rgb_color,i.opacity*a,n)}let{x1:s,y1:l,x2:h,y2:u}=r,c=new DOMPoint(s,l),d=new DOMPoint(h,u);if(o){let i=m3(r.transform);c=i.transformPoint(c),d=i.transformPoint(d)}let p=i.createLinearGradient(c.x,c.y,d.x,d.y);for(let i of r.stops)p.addColorStop(i.offset,mZ(i.rgb_color,i.opacity*a,n));return p}function m2(i,r,a,n,o=!1){if(1===r.stops.length){let i=r.stops[0];return mZ(i.rgb_color,i.opacity*a,n)}let s=m3(r.transform),{fx:l,fy:h,fr:u,cx:c,cy:d,r:p}=r,f=new DOMPoint(l,h),m=new DOMPoint(c,d),_=u,g=p;if(o){f=s.transformPoint(f),m=s.transformPoint(m);let i=(s.a+s.d)/2;_=u*i,g=r.r*i}let y=i.createRadialGradient(f.x,f.y,_,m.x,m.y,g);for(let i of r.stops)y.addColorStop(i.offset,mZ(i.rgb_color,i.opacity*a,n));return y}function m3(i){return i?new DOMMatrix([i.sx,i.ky,i.kx,i.sy,i.tx,i.ty]):new DOMMatrix}function m5(i,r){let a=i.step,n=i.diffs[0]*a,o=i.diffs[1]*a;r.moveTo(n,o);for(let s=0,l=2;s<i.commands.length;s++)switch(i.commands[s]){case 1:n+=i.diffs[l++]*a,o+=i.diffs[l++]*a,r.moveTo(n,o);break;case 2:n+=i.diffs[l++]*a,o+=i.diffs[l++]*a,r.lineTo(n,o);break;case 3:{let s=n+i.diffs[l++]*a,h=o+i.diffs[l++]*a;n=s+i.diffs[l++]*a,o=h+i.diffs[l++]*a,r.quadraticCurveTo(s,h,n,o);break}case 4:{let s=n+i.diffs[l++]*a,h=o+i.diffs[l++]*a,u=s+i.diffs[l++]*a,c=h+i.diffs[l++]*a;n=u+i.diffs[l++]*a,o=c+i.diffs[l++]*a,r.bezierCurveTo(s,h,u,c,n,o);break}case 5:r.closePath()}return r}function m4(i){return m5(i,new Path2D)}class m6{constructor(i){this.capacity=i,this.cache=new Map}get(i){if(!this.cache.has(i))return;let r=this.cache.get(i);return this.cache.delete(i),this.cache.set(i,r),r}put(i,r){this.cache.has(i)?this.cache.delete(i):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(i,r)}delete(i){this.cache.delete(i)}}ne(m6,"LRUCache");class m8{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(i){return new hI(i,i.data)}getFromCache(i,r,a){return this.cacheMap.has(a)||this.cacheMap.set(a,new m6(150)),this.cacheMap.get(a).get(os(i.toString(),r))}setInCache(i,r,a,n){this.cacheDependenciesMap.has(n)||this.cacheDependenciesMap.set(n,new Map),this.cacheMap.has(n)||this.cacheMap.set(n,new m6(150));let o=this.cacheDependenciesMap.get(n),s=os(i.id.toString(),a);o.get(s)||o.set(s,new Set);let l=this.cacheMap.get(n),h=i.toString();o.get(s).add(h),l.put(os(i.toString(),a),r)}removeImagesFromCacheByIds(i,r,a=0){if(!this.cacheMap.has(a)||!this.cacheDependenciesMap.has(a))return;let n=this.cacheMap.get(a),o=this.cacheDependenciesMap.get(a);for(let a of i){let i=os(a.toString(),r);if(o.has(i)){for(let r of o.get(i))n.delete(r);o.delete(i)}}}rasterize(i,r,a,n){var o;let s,l,h,u,c,d,p,f=this.getFromCache(i,a,n);if(f)return f.clone();let m=(o=r.icon,s=mH.calculate(i.params,o.metadata?o.metadata.variables:[]),h=(l=o.usvg_tree).width,u=l.height,c=Math.max(1,Math.round(h*i.sx)),p=new DOMMatrix([c/h,0,0,(d=Math.max(1,Math.round(u*i.sy)))/u,0,0]),null===mY&&(mX=(mY=mW(10,10)).getContext("2d",{willReadFrequently:!0})),mY.width=c,mY.height=d,mK(mX,p,l,l,s),mX.getImageData(0,0,c,d)),_=m8._getImage(m);return this.setInCache(i,_,a,n),_.clone()}}class m9{constructor(i){this.size=i,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(i,r){let a=this.toIdx(i,r);return{min:this.minimums[a],max:this.maximums[a]}}isLeaf(i,r){return this.leaves[this.toIdx(i,r)]}toIdx(i,r){return r*this.size+i}}function m7(i,r,a,n){let o=0,s=Number.MAX_VALUE;for(let l=0;l<3;l++)if(1e-15>Math.abs(n[l])){if(a[l]<i[l]||a[l]>r[l])return null}else{let h=1/n[l],u=(i[l]-a[l])*h,c=(r[l]-a[l])*h;if(u>c){let i=u;u=c,c=i}if(u>o&&(o=u),c<s&&(s=c),o>s)return null}return o}function _e(i,r,a,n,o,s,l,h,u,c,d){let p=n-i,f=o-r,m=s-a,_=l-i,g=h-r,y=u-a,x=d[1]*y-d[2]*g,v=d[2]*_-d[0]*y,b=d[0]*g-d[1]*_,w=p*x+f*v+m*b;if(1e-15>Math.abs(w))return null;let T=1/w,S=c[0]-i,I=c[1]-r,E=c[2]-a,A=(S*x+I*v+E*b)*T;if(A<0||A>1)return null;let C=I*m-E*f,M=E*p-S*m,P=S*f-I*p,D=(d[0]*C+d[1]*M+d[2]*P)*T;return D<0||A+D>1?null:(_*C+g*M+y*P)*T}function _t(i,r,a,n,o,s,l,h,u){let c=1<<a,d=s-n,p=l-o;h[0]=(i+0)/c*d+n,h[1]=(r+0)/c*p+o,u[0]=(i+1)/c*d+n,u[1]=(r+1)/c*p+o}class _i{constructor(i){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=i,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const r=function(i){let r=Math.ceil(Math.log2(i.dim/8)),a=[],n=Math.ceil(Math.pow(2,r)),o=1/n,s=(i,r,a,n,o)=>{let s=+!!n;o[0]=i*a,o[1]=r*a,o[2]=(i+1)*a-s,o[3]=(r+1)*a-s},l=new m9(n),h=[];for(let r=0;r<n*n;r++){s(r%n,Math.floor(r/n),o,!1,h);let a=_a(h[0],h[1],i),u=_a(h[2],h[1],i),c=_a(h[2],h[3],i),d=_a(h[0],h[3],i);l.minimums.push(Math.min(a,u,c,d)),l.maximums.push(Math.max(a,u,c,d)),l.leaves.push(1)}for(a.push(l),n/=2;n>=1;n/=2){let i=a[a.length-1];l=new m9(n);for(let r=0;r<n*n;r++){s(r%n,Math.floor(r/n),2,!0,h);let a=i.getElevation(h[0],h[1]),o=i.getElevation(h[2],h[1]),u=i.getElevation(h[2],h[3]),c=i.getElevation(h[0],h[3]),d=i.isLeaf(h[0],h[1]),p=i.isLeaf(h[2],h[1]),f=i.isLeaf(h[2],h[3]),m=i.isLeaf(h[0],h[3]),_=Math.min(a.min,o.min,u.min,c.min),g=Math.max(a.max,o.max,u.max,c.max),y=d&&p&&f&&m;l.maximums.push(g),l.minimums.push(_),l.leaves.push(g-_<=5&&y?1:0)}a.push(l)}return a}(this.dem),a=r.length-1,n=r[a];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(r,0,0,a,0)}
7raycastRoot(i,r,a,n,o,s,l=1){return m7([i,r,-100],[a,n,this.maximums[0]*l],o,s)}raycast(i,r,a,n,o,s,l=1){if(!this.nodeCount)return null;let h=this.raycastRoot(i,r,a,n,o,s,l);if(null==h)return null;let u=[],c=[],d=[],p=[],f=[{idx:0,t:h,nodex:0,nodey:0,depth:0}];for(;f.length>0;){let{idx:h,t:x,nodex:v,nodey:b,depth:w}=f.pop();if(this.leaves[h]){_t(v,b,w,i,r,a,n,d,p);let h=1<<w,u=(v+0)/h,c=(v+1)/h,f=(b+0)/h,T=(b+1)/h,S=_a(u,f,this.dem)*l,I=_a(c,f,this.dem)*l,E=_a(c,T,this.dem)*l,A=_a(u,T,this.dem)*l,C=_e(d[0],d[1],S,p[0],d[1],I,p[0],p[1],E,o,s),M=_e(p[0],p[1],E,d[0],p[1],A,d[0],d[1],S,o,s),P=Math.min(null!==C?C:Number.MAX_VALUE,null!==M?M:Number.MAX_VALUE);if(P!==Number.MAX_VALUE)return P;{var m,_,g,y;let i=eT([],o,s,x);if(_r(S,I,A,E,(m=i[0],(m-(_=d[0]))/(p[0]-_)),(g=i[1],(g-(y=d[1]))/(p[1]-y)))>=i[2])return x}continue}let T=0;for(let f=0;f<this._siblingOffset.length;f++){_t((v<<1)+this._siblingOffset[f][0],(b<<1)+this._siblingOffset[f][1],w+1,i,r,a,n,d,p),d[2]=-100,p[2]=this.maximums[this.childOffsets[h]+f]*l;let m=m7(d,p,o,s);if(null!=m){u[f]=m;let i=!1;for(let r=0;r<T&&!i;r++)m>=u[c[r]]&&(c.splice(r,0,f),i=!0);i||(c[T]=f),T++}}for(let i=0;i<T;i++){let r=c[i];f.push({idx:this.childOffsets[h]+r,t:u[r],nodex:(v<<1)+this._siblingOffset[r][0],nodey:(b<<1)+this._siblingOffset[r][1],depth:w+1})}}return null}_addNode(i,r,a){return this.minimums.push(i),this.maximums.push(r),this.leaves.push(a),this.childOffsets.push(0),this.nodeCount++}_construct(i,r,a,n,o){if(1===i[n].isLeaf(r,a))return;this.childOffsets[o]||(this.childOffsets[o]=this.nodeCount);let s=n-1,l=i[s],h=0,u=0;for(let i=0;i<this._siblingOffset.length;i++){let n=2*r+this._siblingOffset[i][0],o=2*a+this._siblingOffset[i][1],s=l.getElevation(n,o),c=l.isLeaf(n,o),d=this._addNode(s.min,s.max,c);c&&(h|=1<<i),u||(u=d)}for(let n=0;n<this._siblingOffset.length;n++)h&1<<n||this._construct(i,2*r+this._siblingOffset[n][0],2*a+this._siblingOffset[n][1],s,u+n)}}function _r(i,r,a,n,o,s){return iv(iv(i,a,s),iv(r,n,s),o)}function _a(i,r,a){let n=a.dim,o=tr(i*n-.5,0,n-1),s=tr(r*n-.5,0,n-1),l=Math.floor(o),h=Math.floor(s),u=Math.min(l+1,n-1),c=Math.min(h+1,n-1);return _r(a.get(l,h),a.get(u,h),a.get(l,c),a.get(u,c),o-l,s-h)}let _n={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function _o(i,r,a){return(256*i*256+256*r+a)/10-1e4}function _s(i,r,a){return 256*i+r+a/256-32768}class _l{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(i,r,a,n=!1){if(this.uid=i,r.height!==r.width)throw RangeError("DEM tiles must be square");if(a&&"mapbox"!==a&&"terrarium"!==a)return void t_(`"${a}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const o=this.dim=r.height-2,s=new Uint32Array(r.data.buffer);if(this.pixels=new Uint8Array(r.data.buffer),this.floatView=new Float32Array(r.data.buffer),this.borderReady=n,this._modifiedForSources={},!n){for(let i=0;i<o;i++)s[this._idx(-1,i)]=s[this._idx(0,i)],s[this._idx(o,i)]=s[this._idx(o-1,i)],s[this._idx(i,-1)]=s[this._idx(i,0)],s[this._idx(i,o)]=s[this._idx(i,o-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(o,-1)]=s[this._idx(o-1,0)],s[this._idx(-1,o)]=s[this._idx(0,o-1)],s[this._idx(o,o)]=s[this._idx(o-1,o-1)]}const l="terrarium"===a?_s:_o;for(let i=0;i<s.length;++i){const r=4*i;this.floatView[i]=l(this.pixels[r],this.pixels[r+1],this.pixels[r+2])}this._timestamp=tO.now()}_buildQuadTree(){this._tree=new _i(this)}get(i,r,a=!1){a&&(i=tr(i,-1,this.dim),r=tr(r,-1,this.dim));let n=this._idx(i,r);return this.floatView[n]}set(i,r,a){let n=this._idx(i,r),o=this.floatView[n];return this.floatView[n]=a,a-o}static getUnpackVector(i){return _n[i]}_idx(i,r){if(i<-1||i>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}static pack(i,r){let a=[0,0,0,0],n=_l.getUnpackVector(r),o=Math.floor((i+n[3])/n[2]);return a[2]=o%256,o=Math.floor(o/256),a[1]=o%256,o=Math.floor(o/256),a[0]=o,a}getPixels(){return new hE({width:this.stride,height:this.stride},this.pixels)}backfillBorder(i,r,a){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let n=r*this.dim,o=r*this.dim+this.dim,s=a*this.dim,l=a*this.dim+this.dim;switch(r){case -1:n=o-1;break;case 1:o=n+1}switch(a){case -1:s=l-1;break;case 1:l=s+1}let h=-r*this.dim,u=-a*this.dim;for(let r=s;r<l;r++)for(let a=n;a<o;a++){let n=4*this._idx(a,r),o=4*this._idx(a+h,r+u);this.pixels[n+0]=i.pixels[o+0],this.pixels[n+1]=i.pixels[o+1],this.pixels[n+2]=i.pixels[o+2],this.pixels[n+3]=i.pixels[o+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function _h(i,r,a){var n;1===i?r.headerLength=a.readFixed32():2===i?r.x=a.readVarint():3===i?r.y=a.readVarint():4===i?r.z=a.readVarint():5===i&&r.layers.push((n=a.readVarint()+a.pos,a.readFields(_f,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},n)))}function _u(i,r,a){var n;1===i?(n=a.readVarint()+a.pos,r.delta_filter=a.readFields(_c,{blockSize:0},n),r.filter="delta_filter"):2===i?(a.readVarint(),r.filter="zigzag_filter"):3===i?(a.readVarint(),r.filter="bitshuffle_filter"):4===i&&(a.readVarint(),r.filter="byteshuffle_filter")}function _c(i,r,a){1===i&&(r.blockSize=a.readVarint())}function _d(i,r,a){1===i?(a.readVarint(),r.codec="gzip_data"):2===i?(a.readVarint(),r.codec="jpeg_image"):3===i?(a.readVarint(),r.codec="webp_image"):4===i&&(a.readVarint(),r.codec="png_image")}function _p(i,r,a){var n,o;let s=0,l=0;1===i?r.firstByte=a.readFixed64():2===i?r.lastByte=a.readFixed64():3===i?r.filters.push((n=a.readVarint()+a.pos,a.readFields(_u,{},n))):4===i?(o=a.readVarint()+a.pos,r.codec=a.readFields(_d,{},o)):5===i?l=a.readFloat():6===i?s=a.readFloat():7===i?r.bands.push(a.readString()):8===i?r.offset=a.readDouble():9===i&&(r.scale=a.readDouble()),0===r.offset&&(r.offset=l),0===r.scale&&(r.scale=s)}function _f(i,r,a){var n;1===i?r.version=a.readVarint():2===i?r.name=a.readString():3===i?r.units=a.readString():4===i?r.tileSize=a.readVarint():5===i?r.buffer=a.readVarint():6===i?r.pixelFormat=a.readVarint():7===i&&r.dataIndex.push((n=a.readVarint()+a.pos,a.readFields(_p,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},n)))}function _m(i,r,a){if(2===i){var n;n=a.readVarint()+a.pos,a.readFields(__,r,n)}else if(3===i)throw Error("Not implemented")}function __(i,r,a){if(1===i){let i=0,n=a.readVarint()+a.pos;for(;a.pos<n;)r[i++]=a.readVarint()}}ne(_l,"DEMData"),ne(_i,"DemMinMaxQuadTree",{omit:["dem"]});var _g=Uint8Array,_y=Uint16Array,_x=Int32Array,_v=new _g([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),_b=new _g([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_w=new _g([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_T=function(i,r){for(var a=new _y(31),n=0;n<31;++n)a[n]=r+=1<<i[n-1];var o=new _x(a[30]);for(n=1;n<30;++n)for(var s=a[n];s<a[n+1];++s)o[s]=s-a[n]<<5|n;return{b:a,r:o}},_S=_T(_v,2),_I=_S.b,_E=_S.r;_I[28]=258,_E[258]=28;for(var _A=_T(_b,0).b,_C=new _y(32768),_M=0;_M<32768;++_M){var _P=(43690&_M)>>1|(21845&_M)<<1;_C[_M]=((65280&(_P=(61680&(_P=(52428&_P)>>2|(13107&_P)<<2))>>4|(3855&_P)<<4))>>8|(255&_P)<<8)>>1}var _D=function(i,r,a){for(var n=i.length,o=0,s=new _y(r);o<n;++o)i[o]&&++s[i[o]-1];var l,h=new _y(r);for(o=1;o<r;++o)h[o]=h[o-1]+s[o-1]<<1;
7l=new _y(1<<r);var u=15-r;for(o=0;o<n;++o)if(i[o])for(var c=o<<4|i[o],d=r-i[o],p=h[i[o]-1]++<<d,f=p|(1<<d)-1;p<=f;++p)l[_C[p]>>u]=c;return l},_R=new _g(288);for(_M=0;_M<144;++_M)_R[_M]=8;for(_M=144;_M<256;++_M)_R[_M]=9;for(_M=256;_M<280;++_M)_R[_M]=7;for(_M=280;_M<288;++_M)_R[_M]=8;var _L=new _g(32);for(_M=0;_M<32;++_M)_L[_M]=5;var _z=_D(_R,9),_F=_D(_L,5),_O=function(i){for(var r=i[0],a=1;a<i.length;++a)i[a]>r&&(r=i[a]);return r},_B=function(i,r,a){var n=r/8|0;return(i[n]|i[n+1]<<8)>>(7&r)&a},_k=function(i,r){var a=r/8|0;return(i[a]|i[a+1]<<8|i[a+2]<<16)>>(7&r)},_V=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],_N=function(i,r,a){var n=Error(r||_V[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,_N),!a)throw n;return n},_U=new _g(0),_j="u">typeof TextDecoder&&new TextDecoder;try{_j.decode(_U,{stream:!0})}catch(i){}let _G={gzip_data:"gzip"};class _q extends Error{constructor(i){super(i),this.name="MRTError"}}let _$={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},_H={uint32:1,uint16:2,uint8:4},_Z={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class _W{constructor(i=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=i}getLayer(i){let r=this.layers[i];if(!r)throw new _q(`Layer '${i}' not found`);return r}getHeaderLength(i){let r=new Uint8Array(i),a=new DataView(i);if(13!==r[0])throw new _q("File is not a valid MRT.");return a.getUint32(1,!0)}parseHeader(i){let r=new Uint8Array(i),a=this.getHeaderLength(i);if(r.length<a)throw new _q(`Expected header with length >= ${a} but got buffer of length ${r.length}`);let n=new H(r.subarray(0,a)).readFields(_h,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new _q(`Invalid attempt to parse header ${n.z}/${n.x}/${n.y} for tile ${this.z}/${this.x}/${this.y}`);for(let i of(this.x=n.x,this.y=n.y,this.z=n.z,n.layers))this.layers[i.name]=new _X(i,{cacheSize:this._cacheSize});return this}createDecodingTask(i){let r=[],a=this.getLayer(i.layerName);for(let n of i.blockIndices){let o=a.dataIndex[n],s=o.firstByte-i.firstByte,l=o.lastByte-i.firstByte;if(a._blocksInProgress.has(n))continue;let h={layerName:a.name,firstByte:s,lastByte:l,pixelFormat:a.pixelFormat,blockIndex:n,blockShape:[o.bands.length].concat(a.bandShape),buffer:a.buffer,codec:o.codec.codec,filters:o.filters.map(i=>i.filter)};a._blocksInProgress.add(n),r.push(h)}return new _Y(r,()=>{r.forEach(i=>a._blocksInProgress.delete(i.blockIndex))},(i,n)=>{if(r.forEach(i=>a._blocksInProgress.delete(i.blockIndex)),i)throw i;n.forEach(i=>{this.getLayer(i.layerName).processDecodedData(i)})})}}class _X{constructor({version:i,name:r,units:a,tileSize:n,pixelFormat:o,buffer:s,dataIndex:l},h){if(this.version=i,1!==this.version)throw new _q(`Cannot parse raster layer encoded with MRT version ${i}`);this.name=r,this.units=a,this.tileSize=n,this.buffer=s,this.pixelFormat=_$[o],this.dataIndex=l,this.bandShape=[n+2*s,n+2*s,_H[this.pixelFormat]],this._decodedBlocks=new m6(h?h.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return _H[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:i})=>i).flat()}processDecodedData(i){let r=i.blockIndex.toString();this._decodedBlocks.get(r)||this._decodedBlocks.put(r,i.data)}getBlockForBand(i){let r=0;switch(typeof i){case"string":for(let[a,n]of this.dataIndex.entries()){for(let[o,s]of n.bands.entries())if(s===i)return{bandIndex:r+o,blockIndex:a,blockBandIndex:o};r+=n.bands.length}break;case"number":for(let[a,n]of this.dataIndex.entries()){if(i>=r&&i<r+n.bands.length)return{bandIndex:i,blockIndex:a,blockBandIndex:i-r};r+=n.bands.length}break;default:throw new _q(`Invalid band \`${JSON.stringify(i)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(i){let r=1/0,a=-1/0,n=[],o=new Set;for(let s of i){let{blockIndex:i}=this.getBlockForBand(s);if(i<0)throw new _q(`Invalid band: ${JSON.stringify(s)}`);let l=this.dataIndex[i];n.includes(i)||n.push(i),o.add(i),r=Math.min(r,l.firstByte),a=Math.max(a,l.lastByte)}if(o.size>this.cacheSize)throw new _q(`Number of blocks to decode (${o.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:r,lastByte:a,blockIndices:n}}hasBand(i){let{blockIndex:r}=this.getBlockForBand(i);return r>=0}hasDataForBand(i){let{blockIndex:r}=this.getBlockForBand(i);return r>=0&&!!this._decodedBlocks.get(r.toString())}getBandView(i){let{blockIndex:r,blockBandIndex:a}=this.getBlockForBand(i);if(r<0)throw new _q(`Band not found: ${JSON.stringify(i)}`);let n=this._decodedBlocks.get(r.toString());if(!n)throw new _q(`Data for band ${JSON.stringify(i)} of layer "${this.name}" not decoded.`);let o=this.dataIndex[r],s=this.bandShape.reduce((i,r)=>i*r,1),l=a*s,h=n.subarray(l,l+s);return{data:h,bytes:new Uint8Array(h.buffer).subarray(h.byteOffset,h.byteOffset+h.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:o.offset,scale:o.scale}}}_W.setPbf=function(i){H=i};class _Y{constructor(i,r,a){this.tasks=i,this._onCancel=r,this._onComplete=a,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(i,r){this._finalized||(this._onComplete(i,r),this._finalized=!0)}}_W.performDecoding=function(i,r){let a=new Uint8Array(i);return Promise.all(r.tasks.map(i=>{let{layerName:r,firstByte:n,lastByte:o,pixelFormat:s,blockShape:l,blockIndex:h,filters:u,codec:c}=i,d=a.subarray(n,o+1),p=new Uint32Array(l[0]*l[1]*l[2]);if("gzip_data"!==c)throw new _q(`Unhandled codec: ${c}`);return(function(i,r){var a,n,o;
7if(!globalThis.DecompressionStream&&"gzip_data"===r)return Promise.resolve(((o=function(i){31==i[0]&&139==i[1]&&8==i[2]||_N(6,"invalid gzip data");var r=i[3],a=10;4&r&&(a+=2+(i[10]|i[11]<<8));for(var n=(r>>3&1)+(r>>4&1);n>0;n-=!i[a++]);return a+(2&r)}(i))+8>i.length&&_N(6,"invalid gzip data"),function(i,r,a,n){var o,s,l=i.length;if(!l||r.f&&!r.l)return a||new _g(0);var h=!a,u=h||2!=r.i,c=r.i;h&&(a=new _g(3*l));var d=function(i){var r=a.length;if(i>r){var n=new _g(Math.max(2*r,i));n.set(a),a=n}},p=r.f||0,f=r.p||0,m=r.b||0,_=r.l,g=r.d,y=r.m,x=r.n,v=8*l;do{if(!_){p=_B(i,f,1);var b=_B(i,f+1,3);if(f+=3,!b){var w=i[(L=((f+7)/8|0)+4)-4]|i[L-3]<<8,T=L+w;if(T>l){c&&_N(0);break}u&&d(m+w),a.set(i.subarray(L,T),m),r.b=m+=w,r.p=f=8*T,r.f=p;continue}if(1==b)_=_z,g=_F,y=9,x=5;else if(2==b){var S=_B(i,f,31)+257,I=_B(i,f+10,15)+4,E=S+_B(i,f+5,31)+1;f+=14;for(var A=new _g(E),C=new _g(19),M=0;M<I;++M)C[_w[M]]=_B(i,f+3*M,7);f+=3*I;var P=_O(C),D=(1<<P)-1,R=_D(C,P);for(M=0;M<E;){var L,z=R[_B(i,f,D)];if(f+=15&z,(L=z>>4)<16)A[M++]=L;else{var F=0,O=0;for(16==L?(O=3+_B(i,f,3),f+=2,F=A[M-1]):17==L?(O=3+_B(i,f,7),f+=3):18==L&&(O=11+_B(i,f,127),f+=7);O--;)A[M++]=F}}var B=A.subarray(0,S),k=A.subarray(S);y=_O(B),x=_O(k),_=_D(B,y),g=_D(k,x)}else _N(1);if(f>v){c&&_N(0);break}}u&&d(m+131072);for(var V=(1<<y)-1,N=(1<<x)-1,U=f;;U=f){var j=(F=_[_k(i,f)&V])>>4;if((f+=15&F)>v){c&&_N(0);break}if(F||_N(2),j<256)a[m++]=j;else{if(256==j){U=f,_=null;break}var G=j-254;j>264&&(G=_B(i,f,(1<<(H=_v[M=j-257]))-1)+_I[M],f+=H);var q=g[_k(i,f)&N],$=q>>4;if(q||_N(3),f+=15&q,k=_A[$],$>3){var H=_b[$];k+=_k(i,f)&(1<<H)-1,f+=H}if(f>v){c&&_N(0);break}u&&d(m+131072);var Z=m+G;if(m<k){var W=0-k,X=Math.min(k,Z);for(W+m<0&&_N(3);m<X;++m)a[m]=n[W+m]}for(;m<Z;++m)a[m]=a[m-k]}}r.l=_,r.p=U,r.b=m,r.f=p,_&&(p=1,r.m=y,r.d=g,r.n=x)}while(!p);return m!=a.length&&h?(o=a,(null==(s=m)||s>o.length)&&(s=o.length),new _g(o.subarray(0,s))):a.subarray(0,m)}(i.subarray(o,-8),{i:2},new _g((i[(n=i.length)-4]|i[n-3]<<8|i[n-2]<<16|i[n-1]<<24)>>>0),a)));let s=_G[r];if(!s)throw Error(`Unhandled codec: ${r}`);let l=new globalThis.DecompressionStream(s);return new Response(new Blob([i]).stream().pipeThrough(l)).arrayBuffer().then(i=>new Uint8Array(i))})(d,c).then(i=>{var r;return r=new H(i),r.readFields(_m,p),new(0,_Z[s])(p.buffer)}).then(i=>{for(let r=u.length-1;r>=0;r--)switch(u[r]){case"delta_filter":!function(i,r){if(4!==r.length)throw Error(`Expected data of dimension 4 but got ${r.length}.`);let a=r[3];for(let n=2;n>=1;n--){let o=+(1===n),s=+(2===n);for(let n=0;n<r[0];n++){let l=r[1]*n;for(let n=o;n<r[1];n++){let o=r[2]*(n+l);for(let n=s;n<r[2];n++){let s=r[3]*(n+o);for(let n=0;n<r[3];n++){let r=s+n;i[r]+=i[r-a]}}}}a*=r[n]}}(i,l);break;case"zigzag_filter":var a=i;for(let i=0,r=a.length;i<r;i++)a[i]=a[i]>>>1^-(1&a[i]);break;case"bitshuffle_filter":!function(i,r){switch(r){case"uint32":return;case"uint16":for(let r=0;r<i.length;r+=2){let a=i[r],n=i[r+1];i[r]=(240&a)>>4|(61440&a)>>8|(240&n)<<4|61440&n,i[r+1]=15&a|(3840&a)>>4|(15&n)<<8|(3840&n)<<4}return;case"uint8":for(let r=0;r<i.length;r+=4){let a=i[r],n=i[r+1],o=i[r+2],s=i[r+3];i[r+0]=(192&a)>>6|(192&n)>>4|(192&o)>>2|192&s,i[r+1]=(48&a)>>4|(48&n)>>2|48&o|(48&s)<<2,i[r+2]=(12&a)>>2|12&n|(12&o)<<2|(12&s)<<4,i[r+3]=3&a|(3&n)<<2|(3&o)<<4|(3&s)<<6}return;default:throw Error(`Invalid pixel format, "${r}"`)}}(i,s);break;default:throw new _q(`Unhandled filter "${u[r]}"`)}return{layerName:r,blockIndex:h,data:i}}).catch(i=>{throw i})}))},ne(_Y,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),ne(_W,"MapboxRasterTile"),ne(_X,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let _K=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _J{static from(i){if(!(i instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[r,a]=new Uint8Array(i,0,2);if(219!==r)throw Error("Data does not appear to be in a KDBush format.");let n=a>>4;if(1!==n)throw Error(`Got v${n} data when expected v1.`);let o=_K[15&a];if(!o)throw Error("Unrecognized array type.");let[s]=new Uint16Array(i,2,1),[l]=new Uint32Array(i,4,1);return new _J(l,s,o,i)}constructor(i,r=64,a=Float64Array,n){if(isNaN(i)||i<0)throw Error(`Unpexpected numItems value: ${i}.`);this.numItems=+i,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=i<65536?Uint16Array:Uint32Array;const o=_K.indexOf(this.ArrayType),s=2*i*this.ArrayType.BYTES_PER_ELEMENT,l=i*this.IndexArrayType.BYTES_PER_ELEMENT,h=(8-l%8)%8;if(o<0)throw Error(`Unexpected typed array class: ${a}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+l+h,2*i),this._pos=2*i,this._finished=!0):(this.data=new ArrayBuffer(8+s+l+h),this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+l+h,2*i),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=i)}add(i,r){let a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=i,this.coords[this._pos++]=r,a}finish(){let i=this._pos>>1;if(i!==this.numItems)throw Error(`Added ${i} items when expected ${this.numItems}.`);return function i(r,a,n,o,s,l){if(s-o<=n)return;let h=o+s>>1;(function i(r,a,n,o,s,l){for(;s>o;){if(s-o>600){let h=s-o+1,u=n-o+1,c=Math.log(h),d=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*d*(h-d)/h)*(u-h/2<0?-1:1);i(r,a,n,Math.max(o,Math.floor(n-u*d/h+p)),Math.min(s,Math.floor(n+(h-u)*d/h+p)),l)}let h=a[2*n+l],u=o,c=s;for(_Q(r,a,o,n),a[2*s+l]>h&&_Q(r,a,o,s);u<c;){for(_Q(r,a,u,c),u++,c--;a[2*u+l]<h;)u++;for(;a[2*c+l]>h;)c--}a[2*o+l]===h?_Q(r,a,o,c):_Q(r,a,++c,s),c<=n&&(o=c+1),n<=c&&(s=c-1)}})(r,a,h,o,s,l),i(r,a,n,o,h-1,1-l),i(r,a,n,h+1,s,1-l)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(i,r,a,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:s,nodeSize:l}=this,h=[0,o.length-1,0],u=[];for(;h.length;){let c=h.pop()||0,d=h.pop()||0,p=h.pop()||0;if(d-p<=l){for(let l=p;l<=d;l++){let h=s[2*l],c=s[2*l+1];h>=i&&h<=a&&c>=r&&c<=n&&u.push(o[l])}continue}let f=p+d>>1,m=s[2*f],_=s[2*f+1];m>=i&&m<=a&&_>=r&&_<=n&&u.push(o[f]),(0===c?i<=m:r<=_)&&(h.push(p),h.push(f-1),h.push(1-c)),(0===c?a>=m:n>=_)&&(h.push(f+1),h.push(d),h.push(1-c))}return u}within(i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:s}=this,l=[0,n.length-1,0],h=[],u=a*a;for(;l.length;){let c=l.pop()||0,d=l.pop()||0,p=l.pop()||0;if(d-p<=s){for(let a=p;a<=d;a++)_1(o[2*a],o[2*a+1],i,r)<=u&&h.push(n[a]);continue}let f=p+d>>1,m=o[2*f],_=o[2*f+1];_1(m,_,i,r)<=u&&h.push(n[f]),(0===c?i-a<=m:r-a<=_)&&(l.push(p),l.push(f-1),l.push(1-c)),(0===c?i+a>=m:r+a>=_)&&(l.push(f+1),l.push(d),l.push(1-c))}return h}}function _Q(i,r,a,n){_0(i,a,n),_0(r,2*a,2*n),_0(r,2*a+1,2*n+1)}function _0(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}function _1(i,r,a,n){let o=i-a,s=r-n;return o*o+s*s}i.$=rZ,i.A=class{constructor(i,r,a){this.target=i,this.parent=r,this.mapId=a,this.callbacks={},this.cancelCallbacks={},tu(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
7=new mb}send(i,r,a,n,o=!1,s){let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);a&&(a.metadata=s,this.callbacks[l]=a);let h=new Set;return this.target.postMessage({id:l,type:i,hasCallback:!!a,targetMapId:n,mustQueue:o,sourceMapId:this.mapId,data:ni(r,h)},h),{cancel:()=>{a&&delete this.callbacks[l],this.target.postMessage({id:l,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(i){let r=i.data;if(!r)return;let a=r.id;if(a&&(!r.targetMapId||this.mapId===r.targetMapId))if("<cancel>"===r.type){let i=this.cancelCallbacks[a];delete this.cancelCallbacks[a],i&&i.cancel()}else if(r.mustQueue||tx(self)){let i=this.callbacks[a],n=this.scheduler.add(()=>this.processTask(a,r),i&&i.metadata||{type:"message"});n&&(this.cancelCallbacks[a]=n)}else this.processTask(a,r)}processTask(i,r){if(delete this.cancelCallbacks[i],"<response>"===r.type){let a=this.callbacks[i];delete this.callbacks[i],a&&(r.error?a(nr(r.error)):a(null,nr(r.data)))}else{let a=new Set,n=r.hasCallback?(r,n)=>{this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:r?ni(r):null,data:ni(n,a)},a)}:()=>{},o=nr(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,o,n);else if(this.parent.getWorkerSource){let i=r.type.split("."),{source:a,scope:s}=o;this.parent.getWorkerSource(r.sourceMapId,{type:i[0],source:a,scope:s,uid:0})[i[1]](o,n)}else n(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.B=is,i.C=io,i.D=i$,i.E=iu,i.F=os,i.G=2,i.H=pN,i.I=ic,i.J=pz,i.K=i5,i.L=n6,i.M=i3,i.N=i6,i.O=a$,i.P=e4,i.Q=aj,i.R=tQ,i.S=aq,i.T=cG,i.U=a0,i.V=f1,i.W=n8,i.X=a1,i.Y=a5,i.Z=rW,i._=rH,i.a=function(i){return tM.API_CDN_URL_REGEX.test(i)},i.a$=_W,i.a0=ri,i.a1=i8,i.a2=i4,i.a3=im,i.a4=n9,i.a5=class extends f1{},i.a6=aH,i.a7=aG,i.a8=n4,i.a9=function(i){let r=i.value;return r?i4(r)?f2(r,!0)?[]:[new f1(i.key,r,`invalid url "${r}"`)]:[new f1(i.key,r,`string expected, "${i3(r)}" found`)]:[]},i.aA=dF,i.aB=function(i){let r=1/0,a=1/0,n=-1/0,o=-1/0;for(let s of i)r=Math.min(r,s.x),a=Math.min(a,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);return{min:new e4(r,a),max:new e4(n,o)}},i.aC=tr,i.aD=ei,i.aE=eN,i.aF=sG,i.aG=lO,i.aH=sJ,i.aI=s9,i.aJ=function(i,r){let a={};for(let n=0;n<r.length;n++){let o=r[n];o in i&&(a[o]=i[o])}return a},i.aK=sY,i.aL=sQ,i.aM=function(i){try{let r=new URL(i).pathname.split("/").pop()||"",a=r.lastIndexOf(".");return a>=0?r.slice(a+1):""}catch{return""}},i.aN=class{constructor(i){this.entries={},this.scheduler=i}request(i,r,a,n){let o=this.entries[i]=this.entries[i]||{callbacks:[]};if(o.result){let[i,a]=o.result;return this.scheduler?this.scheduler.add(()=>{n(i,a)},r):n(i,a),()=>{}}return o.callbacks.push(n),o.cancel||(o.cancel=a((a,n)=>{for(let i of(o.result=[a,n],o.callbacks))this.scheduler?this.scheduler.add(()=>{i(a,n)},r):i(a,n);setTimeout(()=>delete this.entries[i],3e3)})),()=>{o.result||(o.callbacks=o.callbacks.filter(i=>i!==n),o.callbacks.length||(o.cancel(),delete this.entries[i]))}}},i.aO=function(i,r,a){let n=JSON.stringify(i.request);return i.data&&(this.deduped.entries[n]={result:[null,i.data]}),this.deduped.request(n,{type:"parseTile",renderSourceType:i.renderSourceType,zoom:i.tileZoom},r=>{let n=t5(i.request,(i,n,o)=>{i?t1(i)?r(null,null):r(i):n&&r(null,{rawData:n,vectorTile:a?void 0:new lo(new d6(n)),responseHeaders:new Map(o.entries())})});return()=>{n.cancel(),r(null,null)}},r)},i.aP=function(i){return i?{cacheControl:i.get("cache-control"),expires:i.get("expires")}:{cacheControl:void 0,expires:void 0}},i.aQ=function(i){++t$>tU&&(i.getActor().send("enforceCacheSizeLimit",tN),t$=0)},i.aR=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log2(i)))},i.aS=lZ,i.aT=fK,i.aU=fJ,i.aV=sX,i.aW=fY,i.aX=function(i,r){let a=document.createElement("video");a.muted=!0,a.onloadstart=function(){r(null,a)};for(let r=0;r<i.length;r++){let n=document.createElement("source");(function(i){let r=document.createElement("a");return r.href=i,r.protocol===location.protocol&&r.host===location.host})(i[r])||(a.crossOrigin="Anonymous"),n.src=i[r],a.appendChild(n)}return{cancel:()=>{}}},i.aY=cq,i.aZ=mn,i.a_=tu,i.aa=nX,i.ab=n5,i.ac=n1,i.ad=class{constructor(i){this.specification=i}possiblyEvaluate(i,r){return ty(i.expression.evaluate(r))}
7interpolate(i,r,a){return{x:iv(i.x,r.x,a),y:iv(i.y,r.y,a),z:iv(i.z,r.z,a),azimuthal:iv(i.azimuthal,r.azimuthal,a),polar:iv(i.polar,r.polar,a)}}},i.ae=nH,i.af=a3,i.ag=s8,i.ah=eR,i.ai=ef,i.aj=ta,i.ak=n0,i.al=hh,i.am=iv,i.an=8192,i.ao=ib,i.ap=function(i){return i*e8},i.aq=i_,i.ar=class{constructor(i){this.specification=i}possiblyEvaluate(i,r){return function([i,r]){let a=ty([1,i,r]);return{x:a.x,y:a.y,z:a.z}}(i.expression.evaluate(r))}interpolate(i,r,a){return{x:iv(i.x,r.x,a),y:iv(i.y,r.y,a),z:iv(i.z,r.z,a)}}},i.as=function(i,r,a=0,n=!0){let o=new e4(a,a),s=i.sub(o),l=r.add(o),h=[s,new e4(l.x,s.y),l,new e4(s.x,l.y)];return n&&h.push(s.clone()),h},i.at=function(i,r){let a=[];for(let n=0;n<i.length;n++){let o=tn(n-1,-1,i.length-1),s=tn(n+1,-1,i.length-1),l=i[n],h=i[s],u=i[o].sub(l).unit(),c=h.sub(l).unit(),d=c.angleWithSep(u.x,u.y),p=u.add(c).unit().mult(-1*r/Math.sin(d/2));a.push(l.add(p))}return a},i.au=fp,i.av=lB,i.aw=function(i,r,a=0){return em(((r.x-a)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,s2(r.z,r.y))},i.ax=ey,i.ay=eC,i.az=l_,i.b=function(i){return tM.API_FONTS_REGEX.test(i)},i.b$=sv,i.b0=d6,i.b1=class{constructor(i,r,a,n,o,s){this.tileID=i,this.uid=tl(),this.uses=0,this.tileSize=r,this.tileZoom=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection),this.worldview=s,this._hasAppearances=null}registerFadeDuration(i){let r=i+this.timeAdded;r<tO.now()||void 0!==this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=fd(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,a){if(this.unloadVectorData(),this.state="loaded",i){for(let n in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=mp(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){let i=this.buckets[n];if(i instanceof fU){if(this.hasSymbolBuckets=!0,!a)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof fU&&r.hasRTLText){this.hasRTLText=!0,n$();break}}for(let i in this.queryPadding=0,this.buckets){let a=this.buckets[i],n=r.style.getOwnLayer(i);if(!n)continue;let o=n.queryRadius(a);this.queryPadding=Math.max(this.queryPadding,o)}i.imageAtlas&&(this.imageAtlas=r.style.imageManager.imageAtlasCache.getOrCache(i.imageAtlas)),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas),this._lastUpdatedBrightness=i.brightness}else this.collisionBoxArray=new o5}unloadVectorData(){if(this.hasData()){for(let i in this.buckets)this.buckets[i].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(i,r,a){i&&(i.resourceTiming&&(this.resourceTiming=i.resourceTiming),this.buckets=Object.assign({},this.buckets,mp(i.buckets,r.style)),i.featureIndex&&(this.latestFeatureIndex=i.featureIndex))}getBucket(i){return this.buckets[i.fqid]}upload(i,r){for(let a in this.buckets){let n=this.buckets[a];if(n.uploadPending()){let a={},o=[],s={zoom:0,pitch:0,brightness:0,worldview:""};if(r){if(r.style){o=r.style.listImages();let i=n.layers[0],s=i.sourceLayer||"_geojsonTileLayer",l=r.style.getLayerSourceCache(i);l&&(a=l._state.getState(s,void 0))}s={zoom:r.transform.zoom||0,pitch:r.transform.pitch||0,brightness:r.style.getBrightness()||0,worldview:r.worldview||""}}n.upload(i,this.tileID.canonical,a,o,s)}}let a=i.gl,n=this.imageAtlas;!n||this.imageAtlasTexture&&n.uploaded||(this.imageAtlasTexture=null,this.imageAtlasTexture=r.style.imageManager.imageAtlasCache.getTextureForAtlas(n,i,a.RGBA8),n.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new cG(i,this.glyphAtlasImage,a.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new cG(i,this.lineAtlas.image,a.R8),this.lineAtlas.uploaded=!0)}prepare(i,r,a){if(this.imageAtlas&&this.imageAtlasTexture&&r){let n=r.style.getLut(a);this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture,a,n)}if(!r||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;let n=r.style.getBrightness(),o=r.style.listImages(),s=o.length,l=r.style._changes.getUpd
7atedPaintProperties(),h=Object.keys(this.buckets).some(i=>this.buckets[i].layers.some(i=>l.has(i.fqid))),u=Object.keys(this.buckets).some(i=>this.buckets[i].layers.some(i=>i.hasTransition&&i.hasTransition())),c=this._firstPrepareComplete&&s!==this._lastAvailableImagesCount;null===this._hasAppearances&&(this._hasAppearances=this.hasAppearances(r));let d=this._lastUpdatedBrightness!==n;this._lastAvailableImagesCount=s,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||n||this._hasAppearances||h||u||c)&&(!(this._hasAppearances||h||u||c)&&this._lastUpdatedBrightness&&n&&.001>Math.abs(this._lastUpdatedBrightness-n)||(this.updateBuckets(r,d,void 0,c||h||u,l,o),this._lastUpdatedBrightness=n))}evaluateQueryRenderedFeaturePadding(){let i=0;for(let r in this.buckets){let a=this.buckets[r];a.evaluateQueryRenderedFeaturePadding&&(i=Math.max(i,a.evaluateQueryRenderedFeaturePadding()))}return i}queryRenderedFeatures(i,r,a,n,o,s,l){var h;let u;if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};let c=this.evaluateQueryRenderedFeaturePadding(),d=(h=this.tileID,er(u=el([],[.5*o.width,-(.5*o.height),1]),u,[1,-1,0]),ei(u,u,o.calculateProjMatrix(h.toUnwrapped())),Float32Array.from(u));return this.latestFeatureIndex.query(i,{tilespaceGeometry:r,pixelPosMatrix:d,transform:n,availableImages:a,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:c,scope:l})}querySourceFeatures(i,r){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;let n=a.loadVTLayers(),o=r?r.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;let l=n7(r&&r.filter),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<s.length;r++){let n=s.feature(r);if(l.needGeometry){let i=lt(n,!0);if(!l.filter(new nH(this.tileID.overscaledZ,{worldview:this.worldview}),i,this.tileID.canonical))continue}else if(!l.filter(new nH(this.tileID.overscaledZ,{worldview:this.worldview}),n))continue;let p=a.getId(n,o),f=new ma(n,h,u,c,p);f.tile=d,i.push(f)}}loaded(){return"loaded"===this.state||"errored"===this.state}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=tv(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let i=Date.now(),a=!1;if(this.expirationTime>i)a=!1;else if(r)if(this.expirationTime<r)a=!0;else{let n=this.expirationTime-r;n?this.expirationTime=i+Math.max(n,3e4):a=!0}else a=!0;a?(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(),0x7fffffff)}refreshFeatureState(i,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!i)return;let a=i.style.listImages();this.updateBuckets(i,!1,r,void 0,void 0,a)}hasAppearances(i){for(let r in this.buckets)if(i.style.hasLayer(r)&&this.buckets[r].layers.some(i=>i.appearances&&i.appearances.length>0))return!0;return!1}updateBuckets(i,r,a,n,o,s){if(!this.latestFeatureIndex||!i.style)return;let l=s||i.style.listImages(),h=i.style.getBrightness(),u=o||new Set;for(let o in this.buckets){if(!i.style.hasLayer(o))continue;let s=this.buckets[o],c=s.layers[0],d=c.sourceLayer||"_geojsonTileLayer",p=i.style.getLayerSourceCache(c),f=s.layers.some(i=>u.has(i.fqid)),m=(n||f)&&s instanceof fU?i.style.getOwnLayer(o):void 0,_=a&&a[d]||{};p&&!a&&(_=p._state.getState(d,void 0));let g=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},y=Object.keys(_).length>0&&!r;s.hasAppearances=s.layers.some(i=>i.appearances&&i.appearances.length>0);let x=y?s.stateDependentLayers:s.layers;if(y&&0!==s.stateDependentLayers.length||r||f||n){let a=this.latestFeatureIndex.loadVTLayers()[d];if(s.update(_,a,l,g,x,r,h,this.tileID.canonical),(n||f)&&!r&&s instanceof fU&&m&&"symbol"===m.type&&(s.text&&s.text.uboBinder&&s.text.uboBinder.updateDynamicExpressions(m,a,this.tileID.canonical,l,_,h),s.icon&&s.icon.uboBinder&&s.icon.uboBinder.updateDynamicExpressions(m,a,this.tileID.canonical,l,_,h)),s instanceof fU){let r=i.context;s.text&&s.text.uboBinder&&s.text.uboBinder.upload(r),s.icon&&s.icon.uboBinder&&s.icon.uboBinder.upload(r)}}if(y&&0!==s.stateDependentLayers.length||r||s.hasAppearances){let r={zoom:i.transform.zoom,pitch:i.transform.pitch,brightness:i.style.getBrightness()||0,worldview:i.worldview},a=s.updateAppearances(this.tileID.canonical,_,l,r,i.imageManager,y&&0!==s.stateDependentLayers.length);if(a&&a.hasUboChanges){let r=i.context;s instanceof fU&&s.text&&s.text.uboBinder&&s.text.uboBinder.upload(r),s instanceof fU&&s.icon&&s.icon.uboBinder&&s.icon.uboBinder.upload(r)}}(s instanceof dL||s instanceof uI)&&i._terrain&&i._terrain.enabled&&p&&s.uploadPending()&&i._terrain._clearRenderCacheForTile(p.id,this.tileID);let v=i&&i.style&&i.style.getOwnLayer(o);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<tO.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=tO.now()+i}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof cG?this.texture.update(i):(this.texture=new cG(a,i,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}
7setDependencies(i,r){let a={};for(let i of r)a[i]=!0;this.dependencies[i]=a}hasDependency(i,r){for(let a of i){let i=this.dependencies[a];if(i){for(let a of r)if(i[a])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let a=le(mv,this.tileID.canonical,this.tileTransform)[0],n=new ov,o=new oJ;for(let i=0;i<a.length;i++){let{x:r,y:s}=a[i];n.emplaceBack(r,s),o.emplaceBack(i)}o.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(o),this._tileDebugBuffer=i.createVertexBuffer(n,lJ.members),this._tileDebugSegments=sh.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(i,r){let a,n;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=le(mv,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let a=fd(i,r),n=Math.pow(2,i.z);for(let o=0;o<33;o++)for(let s=0;s<33;s++){let l=s0((i.x+(s+my(s))/32)/n),h=s1((i.y+(o+my(o))/32)/n),u=r.project(l,h),c=33*o+s;mm[2*c+0]=Math.round((u.x*a.scale-a.x)*8192),mm[2*c+1]=Math.round((u.y*a.scale-a.y)*8192)}m_.fill(0),mg.fill(0);for(let i=2045;i>=0;i--){let r=4*i,a=mf[r+0],n=mf[r+1],o=mf[r+2],s=mf[r+3],l=a+o>>1,h=n+s>>1,u=l+h-n,c=h+a-l,d=33*n+a,p=33*s+o,f=33*h+l,m=Math.hypot((mm[2*d+0]+mm[2*p+0])/2-mm[2*f+0],(mm[2*d+1]+mm[2*p+1])/2-mm[2*f+1])>=16;m_[f]=m_[f]||+!!m,i<1022&&(m_[f]=m_[f]||m_[(n+c>>1)*33+(a+u>>1)]||m_[(s+c>>1)*33+(o+u>>1)])}let o=new ow,s=new oj,l=0;function h(i,r){let a=33*r+i;return 0===mg[a]&&(o.emplaceBack(mm[2*a+0],mm[2*a+1],8192*i/32,8192*r/32),mg[a]=++l),mg[a]-1}function u(i,r,a,n,o,l){let c=i+a>>1,d=r+n>>1;if(Math.abs(i-o)+Math.abs(r-l)>1&&m_[33*d+c])u(o,l,i,r,c,d),u(a,n,o,l,c,d);else{let u=h(i,r),c=h(a,n),d=h(o,l);s.emplaceBack(u,c,d)}}return u(0,0,32,32,32,0),u(32,32,0,0,0,32),{vertices:o,indices:s}}(this.tileID.canonical,r);a=i.vertices,n=i.indices}else{for(let{x:i,y:r}of(a=new ow,n=new oj,o))a.emplaceBack(i,r,0,0);let i=hR(a.int16.subarray(0,4*a.length),void 0,4);for(let r=0;r<i.length;r+=3)n.emplaceBack(i[r],i[r+1],i[r+2])}this._tileBoundsBuffer=i.createVertexBuffer(a,fH.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(n),this._tileBoundsSegments=sh.simpleSegment(0,0,a.length,n.length)}_makeGlobeTileDebugBuffers(i,r){let a,n=r.projection;if(!n||"globe"!==n.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=ha(l6(o,r)),l=hh(r.zoom);l>0&&(a=et(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,o,r,s,a,l),this._makeGlobeTileDebugTextBuffer(i,o,r,s,a,l)}_globePoint(i,r,a,n,o,s,l){let h=ht(i,r,a);if(s){let o=1<<a.z,u=sJ(n.center.lng),c=sQ(n.center.lat),d=(a.x+.5)/o-u,p=0;d>.5?p=-1:d<-.5&&(p=1);let f=(i/8192+a.x)/o+p,m=(r/8192+a.y)/o;f=(f-u)*n._pixelsPerMercatorPixel+u,m=(m-c)*n._pixelsPerMercatorPixel+c;let _=[f*n.worldSize,m*n.worldSize,0];eR(_,_,s),h=l4(h,_,l)}return eR(h,h,o)}_makeGlobeTileDebugBorderBuffer(i,r,a,n,o,s){let l=new ov,h=new oJ,u=new ob,c=(i,c,d,p,f)=>{let m=(d-i)/(f-1),_=(p-c)/(f-1),g=l.length;for(let d=0;d<f;d++){let p=i+d*m,f=c+d*_;l.emplaceBack(p,f);let y=this._globePoint(p,f,r,a,n,o,s);u.emplaceBack(y[0],y[1],y[2]),h.emplaceBack(g+d)}};c(0,0,8192,0,16),c(8192,0,8192,8192,16),c(8192,8192,0,8192,16),c(0,8192,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(h),this._tileDebugBuffer=i.createVertexBuffer(l,lJ.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(u,lK.members),this._tileDebugSegments=sh.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(i,r,a,n,o,s){let l=new ov,h=new oj,u=new ob;h.reserve(32),l.reserve(25),u.reserve(25);let c=(i,r)=>25*i+r;for(let i=0;i<25;i++){let h=2048*i;for(let i=0;i<25;i++){let c=2048*i;l.emplaceBack(c,h);let d=this._globePoint(c,h,r,a,n,o,s);u.emplaceBack(d[0],d[1],d[2])}}for(let i=0;i<4;i++)for(let r=0;r<4;r++){let a=c(i,r),n=c(i,r+1),o=c(i+1,r),s=c(i+1,r+1);h.emplaceBack(a,n,o),h.emplaceBack(o,n,s)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(h),this._tileDebugTextBuffer=i.createVertexBuffer(l,lJ.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(u,lK.members),this._tileDebugTextSegments=sh.simpleSegment(0,0,25,32)}destroy(i=!0){for(let r in this.buckets)this.buckets[r].destroy(i);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&delete this.imageAtlasTexture,this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),i&&this.texture&&this.texture instanceof cG&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof cG&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}},i.b2=t5,i.b3=t1,i.b4=function(i,r){let a=[];for(let n in i)n in r||a.push(n);return a},i.b5=mx,i.b6=["type","source","source-layer","minzoom","maxzoom","filter","layout"],i.b7=e6,i.b8=et,i.b9=Q,i.bA=uV,i.bB=uW,i.bC=uH,i.bD=uZ,i.bE=lt,i.bF=eB,i.bG=px,i.bH=p8,i.bI=fn,i.bJ=_J,i.bK=ew,i.bL=ef,i.bM=ej,i.bN=function(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u+o*h,i[1]=o*u-n*h,i[2]=s*u+l*h,i[3]=l*u-s*h,i},i.bO=eG,i.bP=tT,i.bQ=el,i.bR=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},i.bS=ec,i.bT=function(i,r,a,n,o){var s=1/Math.tan(r/2);if(i[0]=s/a,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=o&&o!==1/0){var l=1/(n-o);i[10]=(o+n)*l,i[14]=2*o*n*l}else i[10]=-1,i[14]=-2*n;return i},i.bU=function(i,r,a,n,o,s,l){var h=1/(r-a),u=1/(n-o),c=1/(s-l);return i[0]=-2*h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*u,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*c,i[11]=0,i[12]=(r+a)*h,i[13]=(o+n)*u,i[14]=(l+s)*c,i[15]=1,i},i.bV=function(i,r){return i/sK(r)},i.bW=s1,i.bX=function(i,r,a){i[4*r+0]=a[0],i[4*r+1]=a[1],i[4*r+2]=a[2],i[4*r+3]=a[3]},i.bY=sy,i.bZ=sb,i.b_=sx,i.ba=ee,i.bb=es,i.bc=J,i.bd=function(i,r){let{x:a,y:n}=i.point,o=hl(a,n,i.worldSize/i._pixelsPerMercatorPixel,0,0);return ei(o,o,hn(l5(r)))},i.be=W,i.bf=eF,i.bg=eS,i.bh=eT,i.bi=eP,i.bj=eM,i.bk=pM,i.bl=pu,i.bm=pC,i.bn=function(i,r,a,n,o){let s=5*r+2;i.float32[s+0]=a,i.float32[s+1]=n,i.float32[s+2]=o},i.bo=fk,i.bp=eY,i.bq=eQ,i.br=eK,i.bs=eJ,i.bt=tn,i.bu=function(i,r,a,n){var o=new Z(4);return o[0]=i,o[1]=r,o[2]=a,o[3]=n,o},i.bv=class{isDataAvailableAtPoint(i){let r=this._source();if(this.isUsingMockSource()||!r||i.y<0||i.y>1)return!1;let a=r.getSource().maxzoom,n=1<<a,o=Math.floor(i.x),s=Math.floor((i.x-o)*n),l=Math.floor(i.y*n),h=this.findDEMTileFor(new lZ(a,o,a,s,l));return!(!h||!h.dem)}
7getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,a=!0){if(this.isUsingMockSource())return null;null==r&&(r=null);let n=this._source();if(!n||i.y<0||i.y>1)return r;let o=n.getSource().maxzoom,s=1<<o,l=Math.floor(i.x),h=i.x-l,u=new lZ(o,l,o,Math.floor(h*s),Math.floor(i.y*s)),c=this.findDEMTileFor(u);if(!c||!c.dem)return r;let d=c.dem,p=1<<c.tileID.canonical.z,f=(h*p-c.tileID.canonical.x)*d.dim,m=(i.y*p-c.tileID.canonical.y)*d.dim,_=Math.floor(f),g=Math.floor(m);return(a?this.exaggeration():1)*iv(iv(d.get(_,g),d.get(_,g+1),m-g),iv(d.get(_+1,g),d.get(_+1,g+1),m-g),f-_)}static getAtTileOffset(i,r,a,n){let o=1<<i.canonical.z;return n?n.pointElevation(r):a?a.getAtPointOrZero(new s8(i.wrap+(i.canonical.x+r.x/8192)/o,(i.canonical.y+r.y/8192)/o)):0}static getAtTileOffsetFunc(i,r,a,n){return(o,s,l)=>{let h=this.getAtTileOffset(i,o,s,l),u=n.upVector(i.canonical,o.x,o.y);return ew(u,u,h*n.upVectorScale(i.canonical,r,a).metersToTile),u}}getForTilePoints(i,r,a,n){if(this.isUsingMockSource())return!1;let o=f6.create(this,i,n);return!!o&&(r.forEach(i=>{i[2]=this.exaggeration()*o.getElevationAt(i[0],i[1],a)}),!0)}getMinMaxForTile(i){if(this.isUsingMockSource())return null;let r=this.findDEMTileFor(i);if(!r||!r.dem)return null;let a=r.dem.tree,n=r.tileID,o=1<<i.canonical.z-n.canonical.z,s=i.canonical.x/o-n.canonical.x,l=i.canonical.y/o-n.canonical.y,h=0;for(let r=0;r<i.canonical.z-n.canonical.z&&!a.leaves[h];r++){let i=2*Math.floor(l*=2)+Math.floor(s*=2);h=a.childOffsets[h]+i,s%=1,l%=1}return{min:this.exaggeration()*a.minimums[h],max:this.exaggeration()*a.maximums[h]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(i,r,a){throw Error("Pure virtual method called.")}pointCoordinate(i){throw Error("Pure virtual method called.")}_source(){throw Error("Pure virtual method called.")}isUsingMockSource(){throw Error("Pure virtual method called.")}exaggeration(){throw Error("Pure virtual method called.")}findDEMTileFor(i){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){let i=this.visibleDemTiles;if(0===i.length)return null;let r=!1,a=Number.MAX_VALUE,n=5e-324;for(let o of i){let i=this.getMinMaxForTile(o.tileID);i&&(a=Math.min(a,i.min),n=Math.max(n,i.max),r=!0)}return r?{min:a,max:n}:null}},i.bw=cf,i.bx=lM,i.by=er,i.bz=24,i.c=tz,i.c$=pZ,i.c0=sE,i.c1=fP,i.c2=function(){var i=new Z(4);return Z!=Float32Array&&(i[1]=0,i[2]=0),i[0]=1,i[3]=1,i},i.c3=function(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u+s*h,i[1]=o*u+l*h,i[2]=-(n*h)+s*u,i[3]=-(o*h)+l*u,i},i.c4=function(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]},i.c5=eO,i.c6=function(i){var r=i[0],a=i[1],n=i[2],o=i[3];return Math.sqrt(r*r+a*a+n*n+o*o)},i.c7=eV,i.c8=ez,i.c9=lH,i.cA=function(i){let{x:r,y:a}=i.point,{lng:n,lat:o}=i._center;return hl(r,a,i.worldSize,n,o)},i.cB=ex,i.cC=function(i){return i*e9},i.cD=lW,i.cE=lk,i.cF=5,i.cG=function(i,r,a){let n=0;for(let a=0;a<2;++a)i[a]>0&&(n+=(i[a]-0)*(i[a]-0)),r[a]<0&&(n+=(0-r[a])*(0-r[a]));return n},i.cH=function(i){return i*i*i*i*i},i.cI=sK,i.cJ=45,i.cK=sT,i.cL=function(i,r,a){let n=Math.sqrt(i*i+r*r+a*a),o=n>0?Math.acos(a/n)*e9:0,s=0!==i||0!==r?Math.atan2(-r,-i)*e9+90:0;return s<0&&(s+=360),[n,s,o]},i.cM=em,i.cN=ty,i.cO=s6,i.cP=eg,i.cQ=lT,i.cR=ey,i.cS=function(i){return[Math.pow(i[0],1/2.2),Math.pow(i[1],1/2.2),Math.pow(i[2],1/2.2)]},i.cT=cN,i.cU=dl,i.cV=de,i.cW=f2,i.cX=function(i,r){return i.readFields(mT,{icons:[]},r)},i.cY=lP,i.cZ=class{static calculate(i,r,a){let n=new Set,o=new Map,s=new Set,l=new Set;for(let a of Object.values(i))for(let[i,h]of Object.entries(a.floors)){s.add(i),h.isDefault&&l.add(i),h.conflicts&&o.set(i,h.conflicts);let a=i===r,u=h.connections&&r&&h.connections.has(r);(a||u)&&n.add(i)}let h=i=>{let r=o.get(i)||new Set;for(let a of n)if((o.get(a)||new Set).has(i)||r.has(a))return!0;return!1};if(a)for(let i of a)s.has(i)&&(h(i)||n.add(i));for(let i of l)n.has(i)||h(i)||n.add(i);return n}},i.c_=pW,i.ca=3,i.cb=2,i.cc=7,i.cd=6,i.ce=eD,i.cf=ed,i.cg=lw,i.ch=cQ,i.ci=l$,i.cj=l9,i.ck=function(i,r,a,n,o,s,l,h,u){if("globe"===u.name)return l9(i,r,new l$(a,n,o),!1);let c=fd({z:a,x:n,y:o},u);return new lT([(s+c.x/c.scale)*r,r*(c.y/c.scale),l],[(s+c.x2/c.scale)*r,r*(c.y2/c.scale),h
7])},i.cl=function(i,r,a){return i[0]=Math.min(r[0],a[0]),i[1]=Math.min(r[1],a[1]),i[2]=Math.min(r[2],a[2]),i[3]=Math.min(r[3],a[3]),i},i.cm=function(i,r,a){return i[0]=Math.max(r[0],a[0]),i[1]=Math.max(r[1],a[1]),i[2]=Math.max(r[2],a[2]),i[3]=Math.max(r[3],a[3]),i},i.cn=function(i){return e7[Math.round((i+45+360)%360/90)%4]},i.co=85.051129,i.cp=ek,i.cq=6,i.cr=function(i){let r=ee(new Float64Array(16));ei(r,i.pixelMatrix,i.globeMatrix);let a=[0,s$,0],n=[0,sG,0];return eR(a,a,r),eR(n,n,r),[a[0]>0&&a[0]<=i.width&&a[1]>0&&a[1]<=i.height&&!hc(i,new sX(i.center.lat,90)),n[0]>0&&n[0]<=i.width&&n[1]>0&&n[1]<=i.height&&!hc(i,new sX(i.center.lat,-90))]},i.cs=function(i,r){var a,n,o,s,l,h,u,c;let{scale:d}=i.tileTransform,p=8192*d/(i.tileSize*Math.pow(2,r.zoom-i.tileID.overscaledZ+i.tileID.canonical.z));return a=new Float32Array(4),n=r.inverseAdjustmentMatrix,o=[p,p],s=n[1],l=n[2],h=n[3],u=o[0],c=o[1],a[0]=n[0]*u,a[1]=s*u,a[2]=l*c,a[3]=h*c,a},i.ct=c0,i.cu=ei,i.cv=cJ,i.cw=function(i){let r=cJ(i,!0);return W([],[r[0],r[1],r[4],r[5]])},i.cx=ea,i.cy=lg,i.cz=en,i.d=function(i){return tM.API_TILEJSON_REGEX.test(i)},i.d$=0x80000000,i.d0=t2,i.d1=function(){return{API_URL:tM.API_URL,DRACO_URL:tM.DRACO_URL,MESHOPT_URL:tM.MESHOPT_URL,MESHOPT_SIMD_URL:tM.MESHOPT_SIMD_URL,BUILDING_GEN_URL:tM.BUILDING_GEN_URL}},i.d2=nV,i.d3=tk,i.d4=ia,i.d5=tp,i.d6=function(i){let r=i.indexOf("\x1f");return r>=0?i.slice(0,r):i},i.d7=function(i){return i.indexOf("\x1f")>=0},i.d8=function(i){let r=i.lastIndexOf("\x1f");return r>=0?i.slice(r+1):""},i.d9=function(i){let r=[],a=i.id;return void 0===a&&r.push({message:`layers.${a}: missing required property "id"`}),void 0===i.render&&r.push({message:`layers.${a}: missing required method "render"`}),i.renderingMode&&"2d"!==i.renderingMode&&"3d"!==i.renderingMode&&r.push({message:`layers.${a}: property "renderingMode" must be either "2d" or "3d"`}),r}
7,i.dA=X,i.dB=function(i,r){var a=Math.sin(r),n=Math.cos(r);return i[0]=n,i[1]=a,i[2]=0,i[3]=-a,i[4]=n,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},i.dC=eL,i.dD=hs,i.dE=tE,i.dF=tA,i.dG=1024,i.dH=function(i,r){let a=[0,0,0];return eR(a,a,ha(l5(r.canonical))),eR(a,a,i),a},i.dI=i=>({u_matrix:new sE(i),u_texsize:new sv(i),u_pixels_to_tile_units:new sM(i),u_device_pixel_ratio:new sx(i),u_width_scale:new sx(i),u_floor_width_scale:new sx(i),u_image:new sy(i),u_units_to_pixels:new sv(i),u_tile_units_to_pixels:new sx(i),u_alpha_discard_threshold:new sx(i),u_trim_offset:new sv(i),u_trim_fade_range:new sv(i),u_trim_gradient_mix_range:new sv(i),u_trim_color:new sT(i),u_zbias_factor:new sx(i),u_tile_to_meter:new sx(i),u_ground_shadow_factor:new sb(i),u_pattern_transition:new sx(i)}),i.dJ=i=>({u_matrix:new sE(i),u_pixels_to_tile_units:new sM(i),u_device_pixel_ratio:new sx(i),u_width_scale:new sx(i),u_floor_width_scale:new sx(i),u_units_to_pixels:new sv(i),u_dash_image:new sy(i),u_gradient_image:new sy(i),u_image_height:new sx(i),u_texsize:new sv(i),u_tile_units_to_pixels:new sx(i),u_alpha_discard_threshold:new sx(i),u_trim_offset:new sv(i),u_trim_fade_range:new sv(i),u_trim_gradient_mix_range:new sv(i),u_trim_color:new sT(i),u_zbias_factor:new sx(i),u_tile_to_meter:new sx(i),u_ground_shadow_factor:new sb(i)}),i.dK=i=>({u_camera_to_center_distance:new sx(i),u_extrude_scale:new sM(i),u_device_pixel_ratio:new sx(i),u_matrix:new sE(i),u_inv_rot_matrix:new sE(i),u_merc_center:new sv(i),u_tile_id:new sb(i),u_zoom_transition:new sx(i),u_up_dir:new sb(i),u_emissive_strength:new sx(i)}),i.dL=oN,i.dM=dQ,i.dN=class{constructor(i,r,a,n){this.context=i,this.format=n,this.size=a,this.texture=i.gl.createTexture();const[o,s,l]=this.size,{gl:h}=i;h.bindTexture(h.TEXTURE_3D,this.texture),i.pixelStoreUnpackFlipY.set(!1),i.pixelStoreUnpack.set(1),i.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in r&&r.data&&h.texImage3D(h.TEXTURE_3D,0,this.format,o,s,l,0,cU(this.format),cj(this.format),r.data)}bind(i,r){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_3D,this.texture),i!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,i),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,i),this.minFilter=i),r!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,r),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,r),this.wrapS=r)}destroy(){let{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}},i.dO=h_,i.dP=(i,r,a,n,o,s)=>{let l,h=i.transform,u="globe"===h.projection.name;if("map"===s.paint.get("circle-pitch-alignment"))if(u){let i=hs(h.zoom,r.canonical)*h._pixelsPerMercatorPixel;l=Float32Array.from([i,0,0,i])}else l=h.calculatePixelsToTileUnitsMatrix(a);else l=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);let c={u_camera_to_center_distance:i.transform.getCameraToCenterDistance(h.projection),u_matrix:i.translatePosMatrix(r.projMatrix,a,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:tO.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:hm,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get("circle-emissive-strength")};if(u){c.u_inv_rot_matrix=n,c.u_merc_center=o,c.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],c.u_zoom_transition=hh(h.zoom);let i=8192*o[0],a=8192*o[1];c.u_up_dir=h.projection.upVector(new l$(0,0,0),i,a)}return c},i.dQ=dV,i.dR=iH,i.dS=(i,r,a,n,o,s,l,h,u,c)=>{let d=i.transform,p=d.pitch<15?dO(.07,.7,tr((14-d.zoom)/5,0,1)):.07,f="none"===a.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:dk(i,r,a,n),u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:d.calculatePixelsToTileUnitsMatrix(r),u_device_pixel_ratio:o,u_width_scale:s,u_floor_width_scale:l,u_image:0,u_tile_units_to_pixels:dB(r,d),u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:h,u_trim_fade_range:a.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:a.paint.get("line-trim-color").toPremultipliedRenderColor(f?null:a.lut).toArray01(),u_zbias_factor:p,u_tile_to_meter:s6(r.tileID.canonical,0),u_ground_shadow_factor:u,u_pattern_transition:c}},i.dT=(i,r,a,n,o,s,l,h,u,c)=>{let d=i.transform,p=d.calculatePixelsToTileUnitsMatrix(r),f="none"===a.paint.get("line-trim-color-use-theme").
7constantOr("default"),m=d.pitch<15?dO(.07,.7,tr((14-d.zoom)/5,0,1)):.07;return{u_matrix:dk(i,r,a,n),u_pixels_to_tile_units:p,u_device_pixel_ratio:s,u_width_scale:l,u_floor_width_scale:h,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:dN(a)&&r.lineAtlasTexture?r.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:dB(r,i.transform),u_alpha_discard_threshold:0,u_trim_offset:u,u_trim_fade_range:a.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:a.paint.get("line-trim-color").toPremultipliedRenderColor(f?null:a.lut).toArray01(),u_zbias_factor:m,u_tile_to_meter:s6(r.tileID.canonical,0),u_ground_shadow_factor:c}},i.dU=th,i.dV=hA,i.dW=s2,i.dX=lX,i.dY=ct,i.dZ=cl,i.d_=s5,i.da=function(i,r,a,n){return"custom"===i.type?new fQ(i,r):new ms[i.type](i,r,a,n)},i.db=td,i.dc=n7,i.dd=function(i){let r=i.indexOf("\x1f");return r>=0?i.slice(r+1):""},i.de=class extends ma{constructor(i,r){super(i._vectorTileFeature,i._z,i._x,i._y,i.id),i.state&&(this.state=Object.assign({},i.state)),this.target=r.target,this.namespace=r.namespace,r.properties&&(this.properties=r.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=i.source,this.sourceLayer=i.sourceLayer,this.layer=i.layer)}toJSON(){let i=super.toJSON();return i.target=this.target,i.namespace=this.namespace,i}},i.df=nU,i.dg=function(i){return i({pluginStatus:nB,pluginURL:nk}),nU.on("pluginStateChange",i),i},i.dh=sS,i.di=class extends sg{constructor(i){super(i),this.current=sA}set(i,r,a){if(this.fetchUniformLocation(i,r)){for(let i=0;i<9;i++)if(a[i]!==this.current[i]){this.current=a,this.gl.uniformMatrix3fv(this.location,!1,a);break}}}},i.dj=te,i.dk=function(i,r,a){let n=hh(a.zoom),o=i.style.map._antialias,s=i.terrain&&i.terrain.exaggeration()>0;return 0===n&&!o&&!s},i.dl=function(i){let r=i.pixelsPerMeter,a=r/(1/sK(i.center.lat)),n=ee(new Float64Array(16));return er(n,n,[i.point.x,i.point.y,0]),ea(n,n,[a,a,r]),Float32Array.from(n)},i.dm=l7,i.dn=function(i){return Math.round(Math.pow(Math.abs(Math.sin((i=tr(i,-80.051129,80.051129)/80.051129*90)*e8)),3)*(sq.length-1))},i.dp=function(i,r,a,n){let o=r.getNorth(),s=r.getSouth(),l=r.getWest(),h=r.getEast(),u=1<<i.z,c=h-l,d=o-s,p=c/64,f=-d/sq[a],m=[0,p,0,f,0,0,o,l,0];if(i.z>0){let i=180/n;K(m,m,[i/c+1,0,0,0,i/d+1,0,-.5*i/p,.5*i/f,1])}return m[2]=u,m[5]=i.x,m[8]=i.y,m},i.dq=ha,i.dr=l5,i.ds=function(i,r,a){let n=ee(new Float64Array(16)),o=(r/(1<<i)-.5)*Math.PI*2;return eo(n,a.globeMatrix,o),Float32Array.from(n)},i.dt=lJ,i.du=sh,i.dv=hE,i.dw=lQ,i.dx=ov,i.dy=oj,i.dz=function(i,r){return[Math.pow(i[0],2.2)*r,Math.pow(i[1],2.2)*r,Math.pow(i[2],2.2)*r]},i.e=tM,i.e$=function(i,r,a=!1){if(nB===nF.deferred||nB===nF.loading||nB===nF.loaded)throw Error("setRTLTextPlugin cannot be called multiple times.");nk=tO.resolveURL(i),nB=nF.deferred,nO=r,nN(),a||nG()},i.e0=450,i.e1=7,i.e2=function(i,r){if(i===r){var a=r[1],n=r[2],o=r[3],s=r[6],l=r[7],h=r[11];i[1]=r[4],i[2]=r[8],i[3]=r[12],i[4]=a,i[6]=r[9],i[7]=r[13],i[8]=n,i[9]=s,i[11]=r[14],i[12]=o,i[13]=l,i[14]=h}else i[0]=r[0],i[1]=r[4],i[2]=r[8],i[3]=r[12],i[4]=r[1],i[5]=r[5],i[6]=r[9],i[7]=r[13],i[8]=r[2],i[9]=r[6],i[10]=r[10],i[11]=r[14],i[12]=r[3],i[13]=r[7],i[14]=r[11],i[15]=r[15];return i},i.e3=.0039101094886591446,i.e4=oy,i.e5=o1,i.e6=256,i.e7=function(i){return i>>>=0,(i=Math.imul((i=Math.imul((i=Math.imul(0xa3c59ac3^i,0x9e3779b9)>>>0)^i>>>16,0x9e3779b9)>>>0)^i>>>16,0x9e3779b9)>>>0)/0x100000000},i.e8=l6,i.e9=hn,i.eA=oX,i.eB=oW,i.eC=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new e4(1/0,1/0),max:new e4(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(i,r=!1){let a=uq(new e4(0,0),new e4(8192,8192),i),n=[];if(r&&!uj(a,this._globalClipBounds))return n;for(let r of this._activeRegions){if(r.hiddenByOverlap||!uj(a,r))continue;let o=function(i,r,a){let n=1<<a.canonical.z,o=((r.x-a.wrap)*n-a.canonical.x)*8192,s=(r.y*n-a.canonical.y)*8192;return{min:new e4(((i.x-a.wrap)*n-a.canonical.x)*8192,(i.y*n-a.canonical.y)*8192),max:new e4(o,s)}}(r.min,r.max,i);n.push({min:o.min,max:o.max,sourceId:this._sourceIds[r.priority],footprint:r.footprint,footprintTileId:r.tileId,order:r.order,clipMask:r.clipMask,clipScope:r.clipScope})}return n}
7setSources(i){this._setSources(i.map(i=>({getSourceId:()=>i.cache.id,getFootprints:()=>{let r=[];for(let a of i.cache.getVisibleCoordinates()){let n=i.cache.getTile(a).buckets[i.layer];n&&n.updateFootprints(a.toUnwrapped(),r)}return r},getOrder:()=>i.order,getClipMask:()=>i.clipMask,getClipScope:()=>i.clipScope})))}_addSource(i){let r=i.getFootprints();if(0===r.length)return;let a=i.getOrder(),n=i.getClipMask(),o=i.getClipScope();for(let i of r){if(!i.footprint)continue;let r=uq(i.footprint.min,i.footprint.max,i.id);this._activeRegions.push({min:r.min,max:r.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:i.id,footprint:i.footprint,order:a,clipMask:n,clipScope:o})}this._sourceIds.push(i.getSourceId())}_computeReplacement(){this._activeRegions.sort((i,r)=>{var a,n;let o;return i.priority-r.priority||uN(i.min,r.min)||uN(i.max,r.max)||i.order-r.order||i.clipMask-r.clipMask||(a=i.clipScope,n=r.clipScope,o=(i,r)=>i+r,a.length-n.length||a.reduce(o,"").localeCompare(n.reduce(o,"")))});let i=this._activeRegions.length!==this._prevRegions.length;if(!i){let r=0;for(;!i&&r!==this._activeRegions.length;){let a=this._activeRegions[r],n=this._prevRegions[r];i=a.priority!==n.priority||!uU(a,n)||a.order!==n.order||a.clipMask!==n.clipMask||!e6(a.clipScope,n.clipScope),this._activeRegions[r].hiddenByOverlap=n.hiddenByOverlap,++r}}if(i){for(let i of(++this._updateTime,this._activeRegions))i.order!==uB&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));let i=i=>{let r=this._activeRegions;if(i>=r.length)return i;let a=r[i].priority;for(;i<r.length&&r[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let r=0,a=i(0);for(;r!==a;){let n=r,o=r;for(;n!==a;){let i=this._activeRegions[n];i.hiddenByOverlap=!1;for(let r=0;r<o;r++){let a=this._activeRegions[r];if(!a.hiddenByOverlap&&i.order===uB&&uj(i,a)&&(i.hiddenByOverlap=function i(r,a,n,o){if(!r||!n)return!1;let s=r.vertices;if(!a.canonical.equals(o.canonical)||a.wrap!==o.wrap){if(n.vertices.length<r.vertices.length)return i(n,o,r,a);let l=a.canonical,h=o.canonical,u=Math.pow(2,h.z-l.z);s=r.vertices.map(i=>new e4((i.x+8192*l.x)*u-8192*h.x,(i.y+8192*l.y)*u-8192*h.y))}return u$(n,s,r.indices,0,r.indices.length,0,0)}(i.footprint,i.tileId,a.footprint,a.tileId),i.hiddenByOverlap))break}++n}a=i(r=a)}}}}_setSources(i){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let r=i.length-1;r>=0;r--)this._addSource(i[r]);this._computeReplacement()}},i.eD=ow,i.eE=fH,i.eF=oJ,i.eG=uB,i.eH=class{constructor(i){this._createGrid(i),this._createPoles(i)}destroy(){for(let i of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))i.destroy();for(let i of this._gridSegments)i.withSkirts.destroy(),i.withoutSkirts.destroy()}_fillGridMeshWithLods(i,r){let a=new ov,n=new oj,o=[],s=i+1+2,l=r[0]+1,h=r[0]+1+(1+r.length),u=(i,r,a)=>{let n=i===s-1?i-2:0===i?i:i-1;return[n+=24575*!!a,r]};for(let i=0;i<s;++i)a.emplaceBack(...u(i,0,!0));for(let i=0;i<l;++i)for(let r=0;r<s;++r)a.emplaceBack(...u(r,i,0===r||r===s-1));for(let i=0;i<r.length;++i){let n=r[i];for(let i=0;i<s;++i)a.emplaceBack(...u(i,n,!0))}for(let i=0;i<r.length;++i){let l=n.length,u=r[i]+1+2,c=new oj;for(let a=0;a<u-1;a++){let o=a===u-2,l=o?s*(h-r.length+i-a):s;for(let i=0;i<s-1;i++){let r=a*s+i;0===a||o||0===i||i===s-2?(c.emplaceBack(r+1,r,r+l),c.emplaceBack(r+l,r+l+1,r+1)):(n.emplaceBack(r+1,r,r+l),n.emplaceBack(r+l,r+l+1,r+1))}}let d=sh.simpleSegment(0,l,a.length,n.length-l);for(let i=0;i<c.uint16.length;i+=3)n.emplaceBack(c.uint16[i],c.uint16[i+1],c.uint16[i+2]);let p=sh.simpleSegment(0,l,a.length,n.length-l);o.push({withoutSkirts:d,withSkirts:p})}return{vertices:a,indices:n,segments:o}}_createGrid(i){let r=this._fillGridMeshWithLods(64,sq);this._gridSegments=r.segments,this._gridBuffer=i.createVertexBuffer(r.vertices,lJ.members),this._gridIndexBuffer=i.createIndexBuffer(r.
7indices,!0)}_createPoles(i){let r=new oj;for(let i=0;i<=64;i++)r.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=i.createIndexBuffer(r,!0);let a=new oH,n=new oH,o=new oH,s=new oH;this._poleSegments=[];for(let i=0,r=0;i<6;i++){let l=360/(1<<i);a.emplaceBack(0,-sG,0,.5,0),n.emplaceBack(0,-sG,0,.5,1),o.emplaceBack(0,-sG,0,.5,.5),s.emplaceBack(0,-sG,0,.5,.5);for(let i=0;i<=64;i++){let r=i/64,h=0,u=iv(0,l,r),[c,d,p]=sH(hp,hf,u,sG);a.emplaceBack(c,d,p,r,h),n.emplaceBack(c,d,p,r,1-h);let f=u*e8;r=.5+.5*Math.sin(f),h=.5+.5*Math.cos(f),o.emplaceBack(c,d,p,r,h),s.emplaceBack(c,d,p,r,1-h)}this._poleSegments.push(sh.simpleSegment(r,0,66,64)),r+=66}this._poleNorthVertexBuffer=i.createVertexBuffer(a,lY,!1),this._poleSouthVertexBuffer=i.createVertexBuffer(n,lY,!1),this._texturedPoleNorthVertexBuffer=i.createVertexBuffer(o,lY,!1),this._texturedPoleSouthVertexBuffer=i.createVertexBuffer(s,lY,!1)}getGridBuffers(i,r){return[this._gridBuffer,this._gridIndexBuffer,r?this._gridSegments[i].withSkirts:this._gridSegments[i].withoutSkirts]}getPoleBuffers(i,r){return[r?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,r?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[i]]}},i.eI=uk,i.eJ=tt,i.eK=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},i.eL=ti,i.eM=s4,i.eN=function(i,r,a){return i[0]=r[0]/a[0],i[1]=r[1]/a[1],i[2]=r[2]/a[2],i},i.eO=ex,i.eP=sZ,i.eQ=eE,i.eR=e_,i.eS=function([i,r,a]){let n=Math.hypot(i,r,a);return new sX(Math.atan2(i,a)*e9,(.5*Math.PI-Math.acos(-r/n))*e9)},i.eT=eV,i.eU=c2,i.eV=function(i){let r=i.navigator?i.navigator.userAgent:null;return!!function(i){if(null==tw){let r=i.navigator?i.navigator.userAgent:null;tw=!!i.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return tw}(i)&&!(!r||!(r.match("Version/15.4")||r.match("Version/15.5")||r.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},i.eW=function(i,r){tN=i,tU=r},i.eX=hc,i.eY=hu,i.eZ=function(i){let r=[0,0,0],a=ee(new Float64Array(16));return ei(a,i.pixelMatrix,i.globeMatrix),eR(r,r,a),new e4(r[0],r[1])},i.e_=nj,i.ea=oM,i.eb=eo,i.ec=function(i,r){return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[4],i[4]=r[5],i[5]=r[6],i[6]=r[8],i[7]=r[9],i[8]=r[10],i},i.ed=oH,i.ee=oZ,i.ef=function(i,r,a,n,o){return tr((i-r)/(a-r)*(o-n)+n,n,o)},i.eg=eq,i.eh=function(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8],p=d*l-h*c,f=-d*s+h*u,m=c*s-l*u,_=a*p+n*f+o*m;return _?(i[0]=p*(_=1/_),i[1]=(-d*n+o*c)*_,i[2]=(h*n-o*l)*_,i[3]=f*_,i[4]=(d*a-o*u)*_,i[5]=(-h*a+o*s)*_,i[6]=m*_,i[7]=(-c*a+n*u)*_,i[8]=(l*a-n*s)*_,i):null},i.ei=aD,i.ej=2,i.ek=eA,i.el=eU,i.em=eu,i.en=function(i,r){var a=new Z(3);eu(a,r);var n=1/a[0],o=1/a[1],s=1/a[2],l=r[0]*n,h=r[1]*o,u=r[2]*s,c=r[4]*n,d=r[5]*o,p=r[6]*s,f=r[8]*n,m=r[9]*o,_=r[10]*s,g=l+d+_,y=0;return g>0?(y=2*Math.sqrt(g+1),i[3]=.25*y,i[0]=(p-m)/y,i[1]=(f-u)/y,i[2]=(h-c)/y):l>d&&l>_?(y=2*Math.sqrt(1+l-d-_),i[3]=(p-m)/y,i[0]=.25*y,i[1]=(h+c)/y,i[2]=(f+u)/y):d>_?(y=2*Math.sqrt(1+d-l-_),i[3]=(f-u)/y,i[0]=(h+c)/y,i[1]=.25*y,i[2]=(p+m)/y):(y=2*Math.sqrt(1+_-l-d),i[3]=(h-c)/y,i[0]=(f+u)/y,i[1]=(p+m)/y,i[2]=.25*y),i},i.eo=function(i,r){var a=2*Math.acos(r[3]),n=Math.sin(a/2);return n>1e-6?(i[0]=r[0]/n,i[1]=r[1]/n,i[2]=r[2]/n):(i[0]=1,i[1]=0,i[2]=0),a},i.ep=mo,i.eq=c7,i.er=c6,i.es=[1,1,1],i.et=f6,i.eu=function(i,r,a,n){var o=r[0],s=r[1],l=r[2],h=r[3];return i[0]=o+n*(a[0]-o),i[1]=s+n*(a[1]-s),i[2]=l+n*(a[2]-l),i[3]=h+n*(a[3]-h),i},i.ev=c9,i.ew=oB,i.ex=oY,i.ey=function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){var y=new Z(16);return y[0]=i,y[1]=r,y[2]=a,y[3]=n,y[4]=o,y[5]=s,y[6]=l,y[7]=h,y[8]=u,y[9]=c,y[10]=d,y[11]=p,y[12]=f,y[13]=m,y[14]=_,y[15]=g,y},i.ez=6371008.8,i.f=function(i){return btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(i,r)=>String.fromCharCode(Number("0x"+r))))},i.f0=tR,i.f1=tD,i.f2=tP,i.f3=function(i){let r=tG();if(!r)return;let a=r.delete(tV);i&&a.then(()=>i()).catch(i)},i.f4=ne,i.f5=hS,i.f6=2,i.f7=rF,i.f8=fd,i.f9=o5,i.fA=nq,i.fB=nF,i.fC=function(i){tq(),null!=h&&h.then(r=>{r.keys().then(a=>{for(let n=0;n<a.length-i;n++)r.delete(a[n]).catch(i=>t_(i.message))}).catch(i=>t_(i.message))}).catch(i=>t_(i.message))}
7,i.fa=mh,i.fb=mu,i.fc=dM,i.fd=ll,i.fe="hd_road_elevation",i.ff=lE,i.fg=tc,i.fh=uI,i.fi=h0,i.fj=pU,i.fk=1,i.fl=fU,i.fm=function(i,r,a,n,o,s,l,h=1,u,c,d,p){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let f=i.layers[0].layout,m=i.layers[0]._unevaluatedLayout._values,_={};_.scaleFactor=h,_.textSizeScaleRange=f.get("text-size-scale-range"),_.iconSizeScaleRange=f.get("icon-size-scale-range");let[g,y]=_.textSizeScaleRange,[x,v]=_.iconSizeScaleRange;_.textScaleFactor=tr(_.scaleFactor,g,y),_.iconScaleFactor=tr(_.scaleFactor,x,v);let b=m["text-size"],w=m["icon-size"];if("composite"===i.textSizeData.kind){let{minZoom:r,maxZoom:a}=i.textSizeData;_.compositeTextSizes=[b.possiblyEvaluate(new nH(r,{worldview:d}),s),b.possiblyEvaluate(new nH(a,{worldview:d}),s)]}if("composite"===i.iconSizeData.kind){let{minZoom:r,maxZoom:a}=i.iconSizeData;_.compositeIconSizes=[w.possiblyEvaluate(new nH(r,{worldview:d}),s,p),w.possiblyEvaluate(new nH(a,{worldview:d}),s,p)]}_.layoutTextSize=b.possiblyEvaluate(new nH(l+1,{worldview:d}),s),_.layoutIconSize=w.possiblyEvaluate(new nH(l+1,{worldview:d}),s,p),_.textMaxSize=b.possiblyEvaluate(new nH(18,{worldview:d}),s);let T=f.get("symbol-placement"),S="map"===f.get("text-rotation-alignment")&&"point"!==T,I=f.get("text-size"),E=!1,A=[];for(let l of i.features){let h=f.get("text-font").evaluate(l,{},s).join(","),g=I.evaluate(l,{},s)*_.textScaleFactor,y=_.layoutTextSize.evaluate(l,{},s)*_.textScaleFactor,x=_.layoutIconSize.evaluate(l,{},s,p)*_.iconScaleFactor,v={horizontal:{},vertical:void 0},b=l.text,w,C=[0,0];if(b){let n=b.toString(),c=24*f.get("text-letter-spacing").evaluate(l,{},s),d=24*f.get("text-line-height").evaluate(l,{},s),p=!function(i){for(let a of i){var r;if(na(r=a.charCodeAt(0))||nn(r)||no(r)||nI(r)||nM(r))return!1}return!0}(n)?0:c,m=f.get("text-anchor").evaluate(l,{},s),x=f.get("text-variable-anchor");if(!x){let i=f.get("text-radial-offset").evaluate(l,{},s);if(i)C=p8(m,[24*i,p5]);else{let i=f.get("text-offset").evaluate(l,{},s);C=[24*i[0],24*i[1]]}}let w=S?"center":f.get("text-justify").evaluate(l,{},s),I="point"===T,E=I?24*f.get("text-max-width").evaluate(l,{},s):1/0,A=s=>{i.allowVerticalPlacement&&nD(n)&&(v.vertical=pp(b,r,a,o,h,E,d,m,s,p,C,pu.vertical,!0,y,g,u,_.textScaleFactor))};if(!S&&x){let i="auto"===w?x.map(i=>fn(i)):[w],n=!1;for(let s=0;s<i.length;s++){let l=i[s];if(!v.horizontal[l])if(n)v.horizontal[l]=v.horizontal[0];else{let i=pp(b,r,a,o,h,E,d,"center",l,p,C,pu.horizontal,!1,y,g,u,_.textScaleFactor);i&&(v.horizontal[l]=i,n=1===i.positionedLines.length)}}A("left")}else{if("auto"===w&&(w=fn(m)),I||f.get("text-writing-mode").indexOf("horizontal")>=0||!nD(n)){let i=pp(b,r,a,o,h,E,d,m,w,p,C,pu.horizontal,!1,y,g,u,_.textScaleFactor);i&&(v.horizontal[w]=i)}A(I?"left":w)}}let M,P,D,R,L,z,F=!1,O=f.get("icon-text-fit").evaluate(l,{},s);if(l.icon&&l.icon.hasPrimary()){let r=fi(l.icon,i.iconSizeData,m["icon-size"],s,i.zoom,l,u,_.iconScaleFactor,d,p);M=r.iconPrimary,D=r.iconSecondary;let a=M.toString();if((P=n.get(a))&&(L=f.get("icon-offset").evaluate(l,{},s),z=f.get("icon-anchor").evaluate(l,{},s),w=pw(o.get(a),D?o.get(D.toString()):void 0,L,z),F=P.sdf,void 0===i.sdfIcons?i.sdfIcons=P.sdf:i.sdfIcons!==P.sdf&&t_("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(P.pixelRatio!==i.pixelRatio||0!==f.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0)),D){let i=D.toString();R=n.get(i)}}E=E||!(!l.icon||!l.icon.hasSecondary());let B=fl(v.horizontal)||v.vertical;i.iconsInText||(i.iconsInText=!!B&&B.iconsInText);let{defaultShapedIcon:k,verticallyShapedIcon:V}=function(i,r,a,n,o,s,l,h,u){let c=fl(s.horizontal)||s.vertical,d=a.get("icon-text-fit-padding").evaluate(n,{},o),p,f=r;return r&&"none"!==u&&(i.allowVerticalPlacement&&s.vertical&&(p=pT(r,s.vertical,u,d,h,l)),c&&(f=pT(r,c,u,d,h,l))),{defaultShapedIcon:f,verticallyShapedIcon:p}}(i,w,f,l,s,v,y*_.textScaleFactor/24,L,O);"none"!==O&&w&&(pS(w)||pI(w))&&(fe(0,P,M,w,k,O,c,n,o),fe(0,R,D,w,k,O,c,n,o),V&&(fe(0,P,M,w,V,O,c,n,o),fe(0,R,D,w,V,O,c,n,o)));let{iconBBox:N,iconVerticalBBox:U,textBBox:j,textVerticalBBox:G}=function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=i.layers[0],y=g.appearances;if(0===y.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};let x={iconBBox:null,iconVerticalBBox:null},v={textBBox:null,textVerticalBBox:null},{baseIconRotate:b,baseTextRotate:w,iconScaleFactor:T}=function(i,r,a){let n=i.get("icon-rotate").evaluate(r,{},a),o=i.get("text-rotate").evaluate(r,{},a),[s,l]=i.get("icon-size-scale-range");return{baseIconRotate:n,baseTextRotate:o,iconScaleFactor:tr(1,s,l)}}(n,o,s);r&&(x.iconBBox=p6(r,x.iconBBox,b),a)&&(x.iconVerticalBBox=p6(a,x.iconVerticalBBox,b+90));let S=fl(p.horizontal);for(let a of(S&&(v.textBBox=p6(S,v.textBBox,w,1,m)),p.vertical&&(v.textVerticalBBox=p6(p.vertical,v.textVerticalBBox,w+90,1,m)),y))a.hasIconLayoutProperties()&&function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let{appearanceIconOffset:g,appearanceIconRotate:y,appearanceIconSize:x}=p9(n,a,o,s,l,h,u,c.iconScaleFactor),v=null,b=null,w=null;n.hasLayoutProperty("icon-image")?w=function(i,r,a,n,o,s,l,h){let u=null,c=r.getAppearanceValueAndResolveTokens(a,"icon-image",n,o,h);if(c){let d=i.getResolvedImageFromTokens(c),p=a.hasLayoutProperty("icon-size")?a.getUnevaluatedLayoutProperty("icon-size"):r._unevaluatedLayout._values["icon-size"],f=fi(d,pA(i.zoom,p,i.worldview,h),p,o,i.zoom,n,i.pixelRatio,l,i.worldview,h);u=s.get(f.iconPrimary.toString())}return u}(r,a,n,o,s,p,f,_):d&&(w=d.imagePrimary),w&&(v=pw(w,null,g,m),r.allowVerticalPlacement&&(b=pw(w,null,g,m)));let T=u>0?x/u:1;v&&(i.iconBBox=p6(v,i.iconBBox,y,1!==T?T:void 0)),b&&(i.iconVerticalBBox=p6(b,i.iconVerticalBBox,y+90,1!==T?T:void 0))}(x,i,g,a,o,s,h,b,l,u,r,c,T,d,_),a.hasTextLayoutProperties()&&function(i,r,a,n,o,s,l,h,u,c){let{appearanceTextOffset:d,appearanceTextRotate:p,appearanceTextSize:f}=p7(a,r,n,o,s,l,h),m=f/h,_=[(d[0]-s[0])*m,(d[1]-s[1])*m],g=0!==_[0]||0!==_[1];u&&(i.textBBox=p6(u,i.textBBox,p,m,d,g?_:void 0)),c&&(i.textVerticalBBox=p6(c,i.textVerticalBBox,p+90,m,d,g?_:void 0))}(v,g,a,o,s,m,w,f,S,p.vertical);return{iconBBox:x.iconBBox,iconVerticalBBox:x.iconVerticalBBox,textBBox:v.textBBox,textVerticalBBox:v.textVerticalBBox}}(i,w=k,V,f,l,s,x,L,_,o,z,v,y,C,p);A.push({feature:l,shapedTextOrientations:v,shapedText:B,shapedIcon:w,iconPrimary:M,iconSecondary:D,iconOffset:L,iconAnchor:z,verticallyShapedIcon:V,layoutTextSize:y,layoutIconSize:x,textOffset:C,isSDFIcon:F,iconTextFit:O,iconCollisionBounds:N,iconVerticalCollisionBounds:U,textCollisionBounds:j,textVerticalCollisionBounds:G})}return{featureData:A,sizes:_,hasAnySecondaryIcon:E,textAlongLine:S,symbolPlacement:T}},i.fn=pj,i.fo=pV,i.fp=pG,i.fq=pq,i.fr=function(i,r,a,n,o,s,l,h,u,c){i.iconAtlasPositions=c.iconPositions;let{featureData:d,hasAnySecondaryIcon:p,sizes:f,textAlongLine:m,symbolPlacement:_}=r;for(let r of d){let{shapedIcon:a,verticallyShapedIcon:s,feature:d,shapedTextOrientations:g,shapedText:y,layoutTextSize:x,textOffset:v,isSDFIcon:b,iconPrimary:w,iconSecondary:T,iconTextFit:S,iconOffset:I,iconCollisionBounds:E,iconVerticalCollisionBounds:A,textCollisionBounds:C}=r;fr(a,c.iconPositions,w,T),fr(s,c.iconPositions,w,T),function(i,r){for(let a in i.horizontal)fa(i.horizontal[a],r);fa(i.vertical,r)}(g,c.iconPositions),function(i,r,a){if(!r)return;let n=a.get(i.toString()),o=a.get(r.toString());n&&o&&(n.paddedRect.w===o.paddedRect.w&&n.paddedRect.h===o.paddedRect.h||t_(`Mismatch in icon variant sizes: ${i.toString()} and ${r.toString()}`),n.usvg!==o.usvg&&t_(`Mismatch in icon variant image types: ${i.id} and ${r.id}`))}(w,T,c.iconPositions),(y||a)&&function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T){var S;let I=l.textMaxSize.evaluate(r,{},p);void 0===I?I=h*l.textScaleFactor:I*=l.textScaleFactor;let E=i.layers[0].layout,A=h*l.textScaleFactor/24,C=fl(a.horizontal)||a.vertical,M=i.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),P=i.getAppearanceFeatureData(r.index);("none"!==g||M)&&P&&(P.textShaping=C,P.iconTextFitPadding=E.get("icon-text-fit-padding").evaluate(r,{},p),P.fontScale=A,P.textScaleFactor=l.textScaleFactor);let D="globe"===f.name,R=i.tilePixelRatio*I/24,L=(S=i.overscaling,i.zoom>18&&S>2&&(S>>=1),Math.max(8192/(512*S),1)*E.get("symbol-spacing")),z=E.get("text-padding")*i.tilePixelRatio,F=E.get("icon-padding")*i.tilePixelRatio,O=E.get("text-max-angle")*e8,B="map"===E.get("icon-rotation-alignment")&&"point"!==v,k=L/2;!1===i.hasAnyIconTextFit&&"none"!==g&&(i.hasAnyIconTextFit=!0);let V=r.properties?+r.properties[ll]:null,N=V&&i.elevationFeatureIdToIndex?i.elevationFeatureIdToIndex.get(V):65535,U=(h,v,S
7)=>{if(v.x<0||v.x>=8192||v.y<0||v.y>=8192)return;let I=null;if(D){let{x:i,y:r,z:a}=f.projectTilePoint(v.x,v.y,S);I={anchor:new pP(i,r,a,0,void 0),up:f.upVector(S,v.x,v.y)}}!function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E,A,C,M,P,D,R){let L=i.addToLineVertexArray(r,n),z,F,O,B,k,V,N,U=0,j=0,G=0,q=0,$=-1,H=-1,Z={},W=ia(""),X=a?a.anchor:r,Y="none"!==C,K=0,J=0;if(void 0===u._unevaluatedLayout.getValue("text-radial-offset")){let i=u.layout.get("text-offset").evaluate(b,{},I);K=24*i[0],J=24*i[1]}else K=24*u.layout.get("text-radial-offset").evaluate(b,{},I),J=p5;if(i.allowVerticalPlacement&&o.vertical){let i=o.vertical;if(_)V=fu(i),h&&(N=fu(h));else{let a=u.layout.get("text-rotate").evaluate(b,{},I)+90;O=fh(c,X,r,d,p,f,i,m,a,g,R),h&&(B=fh(c,X,r,d,p,f,h,y,a,null,D))}}if(s){let n=u.layout.get("icon-rotate").evaluate(b,{},I),o=pY(s,n,T,Y,w.iconScaleFactor),l=h?pY(h,n,T,Y,w.iconScaleFactor):void 0;F=fh(c,X,r,d,p,f,s,y,n,null,P);let m=function(i,r,a,n,o,s,l,h,u){let c=i.layers[0],d=c.appearances,p=r.length;if(a&&(p=Math.max(p,a.length)),0===d.length)return p;let[f,m]=n.get("icon-size-scale-range"),_=tr(1,f,m);for(let r of d)if(r.hasLayoutProperty("icon-image")){let a=c.getAppearanceValueAndResolveTokens(r,"icon-image",s,l,u);if(a){let n=i.getResolvedImageFromTokens(a);if(n){let a=r.hasLayoutProperty("icon-size")?r.getUnevaluatedLayoutProperty("icon-size"):o._values["icon-size"],c=fi(n,pA(i.zoom,a,i.worldview,u),a,l,i.zoom,s,i.pixelRatio,_,i.worldview,u),d=h.get(c.iconPrimary.toString());d&&(p=Math.max(p,function(i){let r=i.stretchY||[[0,i.paddedRect.h-2]];return i.stretchX||i.stretchY?pQ(i.stretchX||[[0,i.paddedRect.w-2]])*pQ(r):1}(d)))}}}return p}(i,o,l,u.layout,u._unevaluatedLayout,b,I,i.iconAtlasPositions,S);U=4*m;let _=u.layout.get("icon-size").evaluate(b,{},I,S),g=w.compositeIconSizes?w.compositeIconSizes[0].evaluate(b,{},I,S):0,C=w.compositeIconSizes?w.compositeIconSizes[1].evaluate(b,{},I,S):0,M=fs(i.layerIds[0],i.iconSizeData,_,w.iconScaleFactor,g,C);i.addSymbols(i.icon,o,M,v,x,b,void 0,a,r,L.lineStartIndex,L.lineLength,-1,S,I,E,A,i.symbolInstances.length,m),$=i.icon.placedSymbolArray.length-1,l&&(j=4*m,i.addSymbols(i.icon,l,M,v,x,b,pu.vertical,a,r,L.lineStartIndex,L.lineLength,-1,S,I,E,A,i.symbolInstances.length,m),H=i.icon.placedSymbolArray.length-1)}for(let n in o.horizontal){let s=o.horizontal[n];z||(W=ia(s.text),_?k=fu(s):z=fh(c,X,r,d,p,f,s,m,u.layout.get("text-rotate").evaluate(b,{},I),g,R));let h=1===s.positionedLines.length;if(G+=fo(i,a,r,s,l,u,_,b,g,L,o.vertical?pu.horizontal:pu.horizontalOnly,h?p3(o.horizontal):[n],Z,$,w,S,I,i.symbolInstances.length,E),h)break}o.vertical&&(q+=fo(i,a,r,o.vertical,l,u,_,b,g,L,pu.vertical,["vertical"],Z,H,w,S,I,i.symbolInstances.length,E));let Q=-1,ee=(i,r)=>i?Math.max(i,r):r;Q=ee(k,-1),Q=ee(V,Q);let et=+((Q=ee(N,Q))>-1);i.glyphOffsetArray.length>=65535&&t_("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,b.sortKey),i.symbolInstances.emplaceBack(r.x,r.y,X.x,X.y,X.z,Z.right>
7=0?Z.right:-1,Z.center>=0?Z.center:-1,Z.left>=0?Z.left:-1,Z.vertical>=0?Z.vertical:-1,$,H,W,void 0!==z?z:i.collisionBoxArray.length,void 0!==z?z+1:i.collisionBoxArray.length,void 0!==O?O:i.collisionBoxArray.length,void 0!==O?O+1:i.collisionBoxArray.length,void 0!==F?F:i.collisionBoxArray.length,void 0!==F?F+1:i.collisionBoxArray.length,B||i.collisionBoxArray.length,B?B+1:i.collisionBoxArray.length,d,G,q,U,j,et,0,K,J,Q,0,+!!Y,M)}(i,v,I,h,a,n,s,o,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,z,x,u,F,B,y,r,l,c,d,p,m,_,g,N,b,w,T)};if("line"===v)for(let o of cf(r.geometry,0,0,8192,8192))for(let r of function(i,r,a,n,o,s,l){let h=n?.6*24*s:0,u=pL(n,o),c=u*s,d=0===i[0].x||8192===i[0].x||0===i[0].y||8192===i[0].y;return r-c<r/4&&(r=c+r/4),function i(r,a,n,o,s,l,h,u,c){let d=l/2,p=pR(r),f=0,m=a-n,_=[];for(let i=0;i<r.length-1;i++){let a=r[i],h=r[i+1],u=a.dist(h),g=h.angleTo(a);for(;m+n<f+u;){let y=((m+=n)-f)/u,x=iv(a.x,h.x,y),v=iv(a.y,h.y,y);if(x>=0&&x<c&&v>=0&&v<c&&m-d>=0&&m+d<=p){let a=new pP(x,v,0,g,i);o&&!pD(r,a,l,o,s)||_.push(a)}}f+=u}return u||_.length||h||(_=i(r,f/2,n,o,s,l,h,!0,c)),_}(i,d?r/2*l%r:(u/2+48)*s*l%r,r,h,a,c,d,!1,8192)}(o,L,O,a.vertical||C,n,R,i.overscaling))C&&function(i,r,a,n){let o=i.compareText;if(r in o){let i=o[r];for(let r=i.length-1;r>=0;r--)if(n.dist(i[r])<a)return!0}else o[r]=[];return o[r].push(n),!1}(i,C.text,k,r)||U(o,r,p);else if("line-center"===v){for(let i of r.geometry)if(i.length>1){let r=function(i,r,a,n,o){let s=a?.6*24*o:0,l=pL(a,n)*o,h=0,u=pR(i)/2;for(let a=0;a<i.length-1;a++){let n=i[a],o=i[a+1],c=n.dist(o);if(h+c>u){let d=(u-h)/c,p=new pP(iv(n.x,o.x,d),iv(n.y,o.y,d),0,o.angleTo(n),a);return!s||pD(i,p,l,s,r)?p:void 0}h+=c}}(i,O,a.vertical||C,n,R);r&&U(i,r,p)}}else if("Polygon"===r.type)for(let i of hX(r.geometry,0)){let r=function(i,r=1,a=!1){let n=1/0,o=1/0,s=-1/0,l=-1/0,h=i[0];for(let i=0;i<h.length;i++){let r=h[i];(!i||r.x<n)&&(n=r.x),(!i||r.y<o)&&(o=r.y),(!i||r.x>s)&&(s=r.x),(!i||r.y>l)&&(l=r.y)}let u=Math.min(s-n,l-o),c=u/2,d=new rE([],p1);if(0===u)return new e4(n,o);for(let r=n;r<s;r+=u)for(let a=o;a<l;a+=u)d.push(new p2(r+c,a+c,c,i));let p=function(i){let r=0,a=0,n=0,o=i[0];for(let i=0,s=o.length,l=s-1;i<s;l=i++){let s=o[i],h=o[l],u=s.x*h.y-h.x*s.y;a+=(s.x+h.x)*u,n+=(s.y+h.y)*u,r+=3*u}return new p2(a/r,n/r,0,i)}(i),f=d.length;for(;d.length;){let n=d.pop();(n.d>p.d||!p.d)&&(p=n,a&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,f)),n.max-p.d<=r||(c=n.h/2,d.push(new p2(n.p.x-c,n.p.y-c,c,i)),d.push(new p2(n.p.x+c,n.p.y-c,c,i)),d.push(new p2(n.p.x-c,n.p.y+c,c,i)),d.push(new p2(n.p.x+c,n.p.y+c,c,i)),f+=4)}return a&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}(i,16);U(i[0],new pP(r.x,r.y,0,0,void 0),p)}else if("LineString"===r.type)for(let i of r.geometry)U(i,new pP(i[0].x,i[0].y,0,0,void 0),p);else if("Point"===r.type)for(let i of r.geometry)for(let r of i)U([r],new pP(r.x,r.y,0,0,void 0),p)}(i,d,g,a,s,u,f,x,v,b,n,o,l,h,p,S,I,m,_,E,A,C)}a&&i.generateCollisionDebugBuffers(s,i.collisionBoxArray,f.textScaleFactor)},i.fs=dL,i.ft=lo,i.fu=_l,i.fv=li,i.fw=function(i){let r=0;if(0x46546c67!==new Uint32Array(i,0,1)[0]){let a=new Uint32Array(i,0,7),[,,n,o,s,l]=a;r=a.byteLength+o+s+l+s,(n!==i.byteLength||r>=i.byteLength)&&t_("Invalid b3dm header information.")}return cV(i,r)},i.fx=function(i,r){let a=dl(i);for(let i of a){for(let r of i.meshes)!function(i){i.heightmap=new Float32Array(4096),i.heightmap.fill(-1);let r=i.vertexArray.float32,a=i.aabb.min[0]-1,n=i.aabb.min[1]-1,o=64/(i.aabb.max[0]-a+2),s=64/(i.aabb.max[1]-n+2);for(let l=0;l<r.length;l+=3){let h=r[l+2],u=(r[l+0]-a)*o|0,c=(r[l+1]-n)*s|0;h>i.heightmap[64*c+u]&&(i.heightmap[64*c+u]=h)}}(r);i.lights&&(i.lightMeshIndex=i.meshes.length,i.meshes.push(function(i,r){let a={};a.indexArray=new oj,a.vertexArray=new oM,a.colorArray=new oF,dh(i,r,a.indexArray,a.vertexArray,a.colorArray);let n={defined:!0};n.emissiveFactor=i_.black;let o={};return o.baseColorFactor=i_.white,n.pbrMetallicRoughness=o,a.material=n,a.aabb=new lT([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),a}(i.lights,r)))}return a},i.fy=mt,i.fz=tx,i.g=function(i,r){return t3(Object.assign(i,{method:"GET"}),r)},i.h=function(i){return 0===i.indexOf("mapbox:")},i.i=function(i){return tM.API_STYLE_REGEX.test(i)&&!tz(i)},i.j=tL,i.k=tH,i.l=function(i){return decodeURIComponent(atob(i).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join(""))},i.m=function(i,r){return t3(Object.assign(i,{type:"json"}),r)},i.n=t4,i.o=tO,i.p=function(i,r){return t3(Object.assign(i,{method:"POST"}),r)}
7,i.q=hI,i.r=tl,i.s=function(i){try{let r=self[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch(i){return!1}},i.t=to,i.u=function(){return function i(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()},i.v=function(i){return!!i&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i)},i.w=t_,i.x=class{constructor(i){this.cache=new Map,this.textures=new Map,this.textureAccessTimes=new Map,this.textureMemoryUsed=0,this.maxTextureMemory=1024*(i&&i.maxTextureMemoryMB?i.maxTextureMemoryMB:256)*1024,this.finalizationRegistry=new FinalizationRegistry(i=>{this.cache.delete(i),this.clearExpiredTextures()})}calculateTextureMemory(i){return i.image?Math.ceil(i.image.width*i.image.height*4*(i.patternPositions.size>0?1.33:1)):0}evictTexture(i){let r=this.textures.get(i);if(r){let a=this.calculateTextureMemory(i);r.destroy(),this.textures.delete(i),this.textureAccessTimes.delete(i),this.textureMemoryUsed-=a}}evictTexturesIfNeeded(i){for(;this.textureMemoryUsed+i>this.maxTextureMemory&&this.textures.size>0;){let i=null,r=1/0;for(let[a]of this.textures.entries()){let n=this.textureAccessTimes.get(a)||0;n<r&&(r=n,i=a)}if(!i)break;this.evictTexture(i)}}findCachedAtlas(i){let r=this.cache.get(i.hash);if(r){let a=r.deref();if(a&&a.contentDescriptor&&this.isMipmapCompatible(i,a.contentDescriptor))return a}for(let[,r]of this.cache.entries()){let a=r.deref();if(a&&a.contentDescriptor){let r=i.subsetOf(a.contentDescriptor),n=this.isMipmapCompatible(i,a.contentDescriptor);if(r&&n)return a}}}getTextureForAtlas(i,r,a){this.textureAccessTimes.set(i,performance.now());let n=this.textures.get(i);if(n)return n;if(i.image){let o=this.calculateTextureMemory(i);return this.evictTexturesIfNeeded(o),n=new cG(r,i.image,a,{useMipmap:!!i.patternPositions.size}),this.textures.set(i,n),this.textureMemoryUsed+=o,n}return null}clearExpiredTextures(){for(let[i]of this.textures.entries())if(!this.isAtlasCached(i)){let r=this.textures.get(i);if(r){let a=this.calculateTextureMemory(i);r.destroy(),this.textureMemoryUsed-=a}this.textures.delete(i),this.textureAccessTimes.delete(i)}}isAtlasCached(i){if(!i.contentDescriptor)return!1;let r=this.cache.get(i.contentDescriptor.hash);return!!r&&r.deref()===i}getOrCache(i){if(!("image"in i)){let r=this.cache.get(i.sourceAtlasHash);if(r){let i=r.deref();if(i)return i}return t_("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!i.contentDescriptor)return i;let r=i.contentDescriptor,a=r.hash,n=this.cache.get(a);if(n){let i=n.deref();if(i&&i.contentDescriptor&&this.isMipmapCompatible(r,i.contentDescriptor))return i}return this.cache.set(a,new WeakRef(i)),this.finalizationRegistry.register(i,a,i),i}isMipmapCompatible(i,r){return!i.requiresMipMaps||r.requiresMipMaps}destroyTextures(){for(let i of this.textures.values())i&&i.destroy();this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}clear(){for(let i of this.textures.values())i&&i.destroy();this.cache.clear(),this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}},i.y=tF,i.z=m8}),o(["require","./shared"],function(i,r){var n;function o(i){let r=i?i.url.toString():void 0;return r?performance.getEntriesByName(r):[]}function s(i){if("number"==typeof i||"boolean"==typeof i||"string"==typeof i||null==i)return JSON.stringify(i);if(Array.isArray(i)){let r="[";for(let a of i)r+=`${s(a)},`;return`${r}]`}let r="{";for(let a of Object.keys(i).sort())r+=`${a}:${s(i[a])},`;return`${r}}`}class l{constructor(i){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),i&&this.replace(i)}replace(i,r){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(i,[],r)}update(i,a,n){for(let a of(this._options=n,i))this._layerConfigs[a.id]=a,(this._layers[a.id]=r.da(a,this.scope,null,this._options)).compileFilter(n),this.keyCache[a.id]&&delete this.keyCache[a.id];for(let i of a)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];for(let i of(this.familiesBySource=Object.create(null),function(i,a){let n=Object.create(null);for(let o=0;o<i.length;o++){let l=i[o],h=a&&a[l.id];h||("symbol"===l.type?h=l.id:(h=function(i){let a="";for(let n of r.b6)a+=`/${s(i[n])}`;return a}(l),"line"===l.type&&l.paint&&function(i,r){return function i(a){return"string"==typeof a&&a===r||(Array.isArray(a)?a.some(i):!(!a||"object"!=typeof a)&&Object.values(a).some(i))}(i)}(l.paint["line-width"],"line-progress")&&(h+=`/${s(l.paint["line-width"])}`))),a&&(a[l.id]=h);let u=n[h];u||(u=n[h]=[]),u.push(l)}let o=[];for(let i in n)o.push(n[i]);return o}(Object.values(this._layerConfigs),this.keyCache))){let r=i.map(i=>this._layers[i.id]),a=r[0];if("none"===a.visibility)continue;let n=a.source||"",o=this.familiesBySource[n];o||(o=this.familiesBySource[n]=Object.create(null));let s=a.sourceLayer||"_geojsonTileLayer",l=o[s];l||(l=o[s]=[]),l.push(r)}}}let h=+r.f6;class u{constructor(i){const a={},n=[];for(const r in i){const o=i[r],s=a[r]={};for(const i in o.glyphs){const r=o.glyphs[+i];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const a=r.metrics.localGlyph?h:1,l={x:0,y:0,w:r.bitmap.width+2*a,h:r.bitmap.height+2*a};n.push(l),s[i]=l}}const{w:o,h:s}=r.J(n),l=new r.f5({width:o||1,height:s||1});for(const n in i){const o=i[n];for(const i in o.glyphs){const s=o.glyphs[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const u=a[n][i],c=s.metrics.localGlyph?h:1;r.f5.copy(s.bitmap,l,{x:0,y:0},{x:u.x+c,y:u.y+c},s.bitmap)}}this.image=l,this.positions=a}}function c(i,r,a){i[r]?a&&(i[r].center=a):i[r]={floorIds:new Set,center:a||[0,0],floors:{}}}function d(i,r){return r.every(r=>i.properties&&null!=i.properties[r])}r.f4(u,"GlyphAtlas");class p{constructor(i){this.tileID=new r.aS(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.lut=i.lut,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.scope=i.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.request&&i.request.collectResourceTiming,this.promoteId=i.promoteId,this.renderSourceType=i.renderSourceType,this.tileTransform=r.f8(i.tileID.canonical,i.projection),this.projection=i.projection,this.worldview=i.worldview,this.localizableLayerIds=i.localizableLayerIds,this.brightness=i.brightness,this.extraShadowCaster=!!i.extraShadowCaster,this.tessellationStep=i.tessellationStep,this.scaleFactor=i.scaleFactor,this.worldview=i.worldview,this.indoor=i.indoor}parse(i,a,n,o,s,l){this.status="parsing",this.data=i,this.collisionBoxArray=new r.f9;let h=new r.fa(Object.keys(i.layers).sort()),p=new r.fb(this.tileID,this.promoteId);p.bucketLayerIDs=[];let m={},_=new r.fc(256,256),g={featureIndex:p,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:_,availableImages:n,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};this.indoor&&(g.activeFloors=function(i,a,n,o){let s=a.indoorState.activeFloorsVisible;if(!a.sourceLayers)return s?a.indoorState.activeFloors:void 0;let l=function(i,a){if(!i)return r.w("No source layers defined in indoor specification"),a;if(0===i.size)return a;for(let n of i.difference(a))r.w(`Missing source layer required in indoor specification: ${n}`);return a.intersection(a)}
7(a.sourceLayers,new Set(Object.keys(i.layers))),h=a.indoorState,u=function(i,a,n,o,s){let l={};for(let n of a){let a=i.layers[n];if(a)for(let i=0;i<a.length;i++){let n=a.feature(i);if(d(n,["type","id","name"])&&"structure"===n.properties.type){let{id:i,center:r}={id:n.properties.id.toString(),center:[n.properties.center_lon||0,n.properties.center_lat||0]};c(l,i,r);continue}if(d(n,["type","id","name","z_index"])&&"floor"===n.properties.type){let i=(h=n,u=s,{id:h.properties.id.toString(),isDefault:!!h.properties.is_default&&h.properties.is_default,connections:h.properties.connected_floor_ids?new Set(h.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:h.properties.conflicted_floor_ids?new Set(h.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:h.properties.structure_ids?new Set(h.properties.structure_ids.toString().split(";")):new Set,name:h.properties.name.toString(),zIndex:h.properties.z_index,geometry:function(i,a){let n=i.loadGeometry();if(!n||0===n.length)return;let o=n.map(n=>n.map(n=>r.f7(n,a,i.extent)));return 0===o.length?void 0:{type:"Polygon",coordinates:[o[0]]}}(h,u)});var h,u,p=i.buildings,f=i.id;for(let r of p)c(l,r),l[r].floors[f]=i,l[r].floorIds.add(f)}}else r.w(`indoor source layer not found: ${n}`)}return{buildings:l,activeFloors:r.cZ.calculate(l,o,n)}}(i,l,h.activeFloors,h.selectedFloorId,o);return n.send("setIndoorData",u),s?u.activeFloors:void 0}(i,this.indoor,s,this.canonical));let y=[],x=a.familiesBySource[this.source];for(let a in x){let s=i.layers[a];if(!s)continue;let l=!1,u=!1,c=!1,d=!1;for(let i of x[a])"symbol"===i[0].type?l=!0:"fill-extrusion"===i[0].type?u=!0:c=!0,i[0].is3D()&&"model"!==i[0].type&&(d=!0);if(this.extraShadowCaster&&!d||this.renderSourceType===r.b5.Symbol&&!l||this.renderSourceType===r.b5.FillExtrusion&&!u||this.renderSourceType===r.b5.Other&&!c)continue;1===s.version&&r.w(`Vector tile source "${this.source}" layer "${a}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let _=h.encode(a),v=[],b=this.localizableLayerIds&&this.localizableLayerIds.has(a),w=!1;for(let i=0,n=0;i<s.length;i++){let o=s.feature(i),l=p.getId(o,a),h=o.properties?o.properties.worldview:null;if(b&&this.worldview&&"string"==typeof h)if("all"===h)o.properties.$localized=!0;else{if(!h.split(",").includes(this.worldview))continue;o.properties.$localized=!0,o.properties.worldview=this.worldview}!w&&o.properties&&o.properties.hasOwnProperty(r.fd)&&(w=!0),v.push({feature:o,id:l,index:n,sourceLayerIndex:_}),n++}for(let s of(w&&!g.elevationFeatures&&i.layers.hasOwnProperty(r.fe)&&(g.elevationFeatures=r.ff.parseFrom(i.layers[r.fe],this.canonical)),x[a])){let i=s[0];if(this.extraShadowCaster&&(!i.is3D()||"model"===i.type)||this.renderSourceType===r.b5.Symbol&&"symbol"!==i.type||this.renderSourceType===r.b5.FillExtrusion&&"fill-extrusion"!==i.type||this.renderSourceType===r.b5.Other&&("symbol"===i.type||"fill-extrusion"===i.type)||i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"===i.visibility)continue;f(s,this.zoom,g.brightness,n,this.worldview,g.activeFloors);let a=m[i.id]=i.createBucket({index:p.bucketLayerIDs.length,layers:s,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:o,worldview:this.worldview,localizable:b,availableImages:n,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO});p.bucketLayerIDs.push(s.map(i=>r.F(i.id,i.scope)));let l=a.prepare?a.prepare():null;null!=l?(l=l.then(()=>a.populate(v,g,this.tileID.canonical,this.tileTransform)),y.push(l)):a.populate(v,g,this.tileID.canonical,this.tileTransform)}}let v=()=>{let a,o,c,d,y,x,v;_.trim();let b={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},w=()=>{if(a)return this.status="done",l(a);if(this.extraShadowCaster)this.status="done",l(null,{buckets:Object.values(m).filter(i=>!i.isEmpty()),featureIndex:p,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:g.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(o&&c&&d&&v){let i,a=new u(o),l=new Map;for(let[i,a]of c.entries()){let{imagePosition:n}=r.fj(i,a,r.fk);l.set(i,n)}let h={};for(let i in m){let s=m[i];s instanceof r.fl&&(f(s.layers,this.zoom,g.brightness,n,this.worldview,g.activeFloors),h[i]=r.fm(s,o,a.positions,c,l,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,y,this.worldview,n))}let p={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(s,c,y,()=>{p.iconsPending=!1,T(h,a,p,i,v)}),this.rasterizeIfNeeded(s,d,x,()=>{p.patternsPending=!1,T(h,a,p,i,v)})}},T=(i,a,o,h,u)=>{if(o.iconsPending||o.patternsPending)return;let y=c.size>0||d.size>0,x=Object.keys(i).length>0;if(!y&&!x)return this.status="done",void l(null,{buckets:Object.values(m).filter(i=>!i.isEmpty()),featureIndex:p,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:a.image,lineAtlas:_,imageAtlas:null,brightness:g.brightness});let v=(o,s)=>{for(let a in m){let o=m[a];if(a in i)r.fr(o,i[a],this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,c,s);else if(o.hasPattern&&(o instanceof r.fs||o instanceof r.fh||o instanceof r.dY)){f(o.layers,this.zoom,g.brightness,n,this.worldview,g.activeFloors);let i=Object.fromEntries(s.patternPositions);o.addFeatures(g,this.tileID.canonical,i,n,this.tileTransform,this.brightness)}}this.status="done",l(null,{buckets:Object.values(m).filter(i=>!i.isEmpty()),featureIndex:p,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:a.image,lineAtlas:_,imageAtlas:o,brightness:g.brightness})};if(y){let i=new Map,a=r.fn(c,i),n=r.fn(d,i),o=new r.fo(a,n,u,this.lut,i);s.send("checkAtlasCache",{descriptor:o,scope:this.scope},(i,a)=>{let n,o;
7if(i&&r.w(`[Worker] Error checking atlas cache: ${i.message}`),a)n=new r.fp(a.sourceHash),o=a;else{let i=new r.fq(c,d,this.lut,u);n=i,o=i}v(n,o)})}else v(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){let i=r.fg(g.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(i).length?s.send("getGlyphs",{uid:this.uid,stacks:i},(i,r)=>{a||(a=i,o=r,w())},void 0,!1,b):o={},v=new Map;let n=Array.from(g.iconDependencies.keys()).map(i=>r.I.parse(i));n.length?s.send("getImages",{images:n,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(i,r)=>{if(!a){for(let[n,o]of(a=i,c=new Map,y=this.updateImageMapAndGetImageTaskQueue(c,r.images,g.iconDependencies),r.versions.entries()))v.set(n,o);w()}},void 0,!1,b):(c=new Map,y=new Map);let l=Array.from(g.patternDependencies.keys()).map(i=>r.I.parse(i));l.length?s.send("getImages",{images:l,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(i,r)=>{if(!a){for(let[n,o]of(a=i,d=new Map,x=this.updateImageMapAndGetImageTaskQueue(d,r.images,g.patternDependencies),r.versions.entries()))v.set(n,o);w()}},void 0,!1,b):(d=new Map,x=new Map)}if(g.elevationFeatures&&g.elevationFeatures.length>0){let a=[];for(let i of Object.values(m))if(i instanceof r.fh){let r=i.getUnevaluatedPortalGraph();r&&a.push(r)}let n=r.fi.evaluate(a);for(let a of Object.values(m))if(a instanceof r.fh){let r=i.layers[h.decode(a.sourceLayerIndex)];a.setEvaluatedPortalGraph(n,r,this.tileID.canonical,g.availableImages,g.brightness)}}w()};y.length>0?Promise.allSettled(y).then(v).catch(l):v()}updateParameters(i){this.scaleFactor=i.scaleFactor,this.showCollisionBoxes=i.showCollisionBoxes,this.projection=i.projection,this.brightness=i.brightness,this.tileTransform=r.f8(i.tileID.canonical,i.projection),this.extraShadowCaster=i.extraShadowCaster,this.lut=i.lut,this.worldview=i.worldview,this.indoor=i.indoor}rasterizeIfNeeded(i,r,a,n){Array.from(r.values()).some(i=>i.usvg)?this.rasterize(i,r,a,n):n()}updateImageMapAndGetImageTaskQueue(i,r,a){let n=new Map;for(let o of r.keys())for(let s of a.get(o)||[]){let a=s.toString(),o=r.get(s.id.toString());o.usvg?n.has(a)||(n.set(a,s),i.set(a,Object.assign({},o))):i.set(a,o)}return n}rasterize(i,r,a,n){this.rasterizeTask=i.send("rasterizeImages",{scope:this.scope,tasks:a},(i,a)=>{if(!i)for(let[i,n]of a.entries()){let a=Object.assign(r.get(i),{data:n});r.set(i,a)}n()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function f(i,a,n,o,s,l){let h=new r.ae(a,{brightness:n,worldview:s,activeFloors:l});for(let r of i)r.recalculate(h,o)}class m extends r.E{constructor({actor:i,layerIndex:a,availableImages:n,availableModels:o,isSpriteLoaded:s,tileProvider:l,brightness:h,maxUniformBufferBindings:u,maxUniformBlockSizeDwords:c,disableSymbolUBO:d}){super(),this.actor=i,this.layerIndex=a,this.availableImages=n,this.availableModels=o,this.loadVectorData=r.aO,this.tileProvider=l,this.loading={},this.loaded={},this.deduped=new r.aN(i.scheduler),this.isSpriteLoaded=s,this.scheduler=i.scheduler,this.brightness=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSizeDwords=c,this.disableSymbolUBO=d}loadTileData(i,r){if(!this.tileProvider)return this.loadVectorData(i,r);let a=new AbortController,{z:n,x:o,y:s}=i.tileID.canonical;return this.tileProvider.loadTile({z:n,x:o,y:s},{request:i.request,signal:a.signal}).then(i=>{if(a.signal.aborted)return;if(null==i){let i=Error("Tile not found");return i.status=404,r(i)}if(null===i.data)return r(null,null);let n=new Map;i.expires&&n.set("expires",i.expires),i.cacheControl&&n.set("cache-control",i.cacheControl),r(null,{rawData:i.data,responseHeaders:n})}).catch(i=>{a.signal.aborted||r(i instanceof Error?i:Error(String(i)))}),()=>a.abort()}loadTile(i,a){let n=i.uid,s=i&&i.request,l=s&&s.collectResourceTiming,h=this.loading[n]=new p(i);h.maxUniformBufferBindings=this.maxUniformBufferBindings,h.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords,h.disableSymbolUBO=this.disableSymbolUBO,h.abort=this.loadTileData(i,(u,c)=>{let d=!this.loading[n];if(delete this.loading[n],h.cancelRasterize(),d||u||!c)return h.status="done",d||(this.loaded[n]=h),a(u);let p=c.rawData,f={},m=r.aP(c.responseHeaders);m&&m.expires&&(f.expires=m.expires),m&&m.cacheControl&&(f.cacheControl=m.cacheControl),h.vectorTile=c.vectorTile||new r.ft(new r.b0(p));let _=()=>{h.parse(h.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(i,r)=>{if(i||!r)return a(i);let n={};if(l){let i=o(s);i.length>0&&(n.resourceTiming=JSON.parse(JSON.stringify(i)))}a(null,Object.assign({rawTileData:p.slice(0),responseHeaders:c.responseHeaders},r,f,n))})};this.isSpriteLoaded?_():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(_,{type:"parseTile",renderSourceType:i.renderSourceType,zoom:i.tileZoom}):_()}),this.loaded=this.loaded||{},this.loaded[n]=h})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let o=a[n];o.updateParameters(i);let s=(i,a)=>{let n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,n)),r(i,a)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,s):s())}else r(null,void 0)}abortTile(i,r){let a=i.uid,n=this.loading[a];n&&(n.abort&&n.abort(),delete this.loading[a]),r()}removeTile(i,r){let a=this.loaded,n=i.uid;a&&a[n]&&delete a[n],r()}}class _{loadTile(i,a){let{uid:n,encoding:o,rawImageData:s,padding:l}=i,h=ImageBitmap&&s instanceof ImageBitmap?this.getImageData(s,l):s;a(null,new r.fu(n,h,o,l<1))}reloadTile(i,r){r(null,null)}abortTile(i,r){r()}removeTile(i,r){r()}getImageData(i,r){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(i.width,i.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=i.width,this.offscreenCanvas.height=i.height,this.offscreenCanvasContext.drawImage(i,0,0,i.width,i.height);let a=this.offscreenCanvasContext.getImageData(-r,-r,i.width+2*r,i.height+2*r);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),a}}r.a$.setPbf(r.b0);class g{constructor(i){this._mrt=new r.a$(i.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=i.uid,this.tileID=i.tileID,this.source=i.source}
7parse(i,a){let n=this._mrt;this.status="parsing",this._entireBuffer=i;try{n.parseHeader(i),this._isHeaderLoaded=!0;let o=[];for(let a in n.layers){let s=n.getLayer(a),l=s.getDataRange(s.getBandList()),h=n.createDecodingTask(l),u=i.slice(l.firstByte,l.lastByte+1),c=r.a$.performDecoding(u,h).then(i=>h.complete(null,i)).catch(i=>h.complete(i,null));o.push(c)}Promise.allSettled(o).then(()=>a(null,n)).catch(i=>a(i))}catch(i){a(i)}}}class y{constructor({actor:i}){this.actor=i,this.loading={},this.loaded={}}loadTile(i,a){let n=i.uid,o=i.request,s=this.loading[n]=new g(i),{cancel:l}=r.b2(o,(i,r,o)=>{let l=!this.loading[n];if(delete this.loading[n],l||i||!r)return s.status="done",l||(this.loaded[n]=s),a(i);s.parse(r,(i,r)=>{if(i||!r)return a(i);a(null,r,o)}),this.loaded[n]=s});s.abort=l}reloadTile(i,r){r(null,void 0)}abortTile(i,r){let a=i.uid,n=this.loading[a];n&&(n.abort&&n.abort(),delete this.loading[a]),r()}removeTile(i,r){let a=i.uid;this.loaded[a]&&delete this.loaded[a],r()}decodeRasterArray(i,a){r.a$.performDecoding(i.buffer,i.task).then(i=>a(null,i)).catch(i=>a(i))}}let x=r.fv.prototype.toGeoJSON;class v{constructor(i){this._feature=i,this.extent=r.an,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){if(1===this._feature.type){let i=[];for(let a of this._feature.geometry)i.push([new r.P(a[0],a[1])]);return i}{let i=[];for(let a of this._feature.geometry){let n=[];for(let i of a)n.push(new r.P(i[0],i[1]));i.push(n)}return i}}toGeoJSON(i,r,a){return x.call(this,i,r,a)}}class b{constructor(i,a){this.name=i,this.extent=r.an,this.length=a.length,this._jsonFeatures=a}feature(i){return new v(this._jsonFeatures[i])}}class w{constructor(i){for(const a of(this.layers={},this.extent=r.an,Object.keys(i)))this.layers[a]=new b(a,i[a])}}let T=64/4096;class S{constructor(){this.features=new Map}clear(){this.features.clear()}load(i=[],r){for(let a of i){let i=a.id;if(null==i)continue;let n=this.features.get(i);n&&this.updateCache(n,r),a.geometry?(n=function(i){let{id:r,geometry:a,properties:n}=i;if(!a)return;if("GeometryCollection"===a.type)throw Error("GeometryCollection not supported in dynamic mode.");let{type:o,coordinates:s}=a,l={id:r,type:1,geometry:[],tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},h=l.geometry;if("Point"===o)E(s,h,l);else if("MultiPoint"===o)for(let i of s)E(i,h,l);else if("LineString"===o)l.type=2,A(s,h,l);else if("MultiLineString"===o)l.type=2,C(s,h,l);else if("Polygon"===o)l.type=3,C(s,h,l,!0);else{if("MultiPolygon"!==o)throw Error("Input data is not a valid GeoJSON object.");for(let i of(l.type=3,s))C(i,h,l,!0)}return l}(a),this.updateCache(n,r),this.features.set(i,n)):this.features.delete(i),this.updateCache(n,r)}}updateCache(i,r){for(let{canonical:a,uid:n}of Object.values(r)){let{z:o,x:s,y:l}=a;I(i,Math.pow(2,o),s,l)&&delete r[n]}}getTile(i,a,n){let o=Math.pow(2,i),s=[];for(let i of this.features.values())I(i,o,a,n)&&s.push(function(i,a,n,o){let{id:s,type:l,geometry:h,tags:u}=i,c=[];if(1===l)for(let i=0;i<h.length;i+=2){let s=Math.round(r.an*(h[i+0]*a-n)),l=Math.round(r.an*(h[i+1]*a-o));c.push([s,l])}else if(2===l)for(let i of h)!function(i,a,n,o,s){let l,h=r.an+128;for(let u=0;u<i.length-2;u+=2){let c=Math.round(r.an*(i[u+0]*a-n)),d=Math.round(r.an*(i[u+1]*a-o)),p=Math.round(r.an*(i[u+2]*a-n)),f=Math.round(r.an*(i[u+3]*a-o)),m=p-c,_=f-d;c<-128&&p<-128||(c<-128?(d+=Math.round((-128-c)/m*_),c=-128):p<-128&&(f=d+Math.round((-128-c)/m*_),p=-128),d<-128&&f<-128||(d<-128?(c+=Math.round((-128-d)/_*m),d=-128):f<-128&&(p=c+Math.round((-128-d)/_*m),f=-128),c>=h&&p>=h||(c>=h?(d+=Math.round((h-c)/m*_),c=h):p>=h&&(f=d+Math.round((h-c)/m*_),p=h),d>=h&&f>=h||(d>=h?(c+=Math.round((h-d)/_*m),d=h):f>=h&&(p=c+Math.round((h-d)/_*m),f=h),l&&c===l[l.length-1][0]&&d===l[l.length-1][1]||(l=[[c,d]],s.push(l)),l.push([p,f])))))}}(i,a,n,o,c);else if(3===l)for(let i of h)!function(i,a,n,o,s){let l=(n-T)/a,h=(o-T)/a,u=(n+1+T)/a,c=(o+1+T)/a;function d(i,r){let a=0;return i<l?a|=1:i>u&&(a|=2),r<h?a|=4:r>c&&(a|=8),a}let p=[];for(let r=1;r<=8;r*=2){let a=i[i.length-2],n=i[i.length-1],o=!(d(a,n)&r);for(let s=0;s<i.length;s+=2){let f=i[s],m=i[s+1],_=!(d(f,m)&r);_!==o&&(8&r?p.push(a+(f-a)*(c-n)/(m-n),c):4&r?p.push(a+(f-a)*(h-n)/(m-n),h):2&r?p.push(u,n+(m-n)*(u-
7a)/(f-a)):1&r&&p.push(l,n+(m-n)*(l-a)/(f-a))),_&&p.push(f,m),a=f,n=m,o=_}if(!(i=p).length||8===r)break;p=[]}let f=[];for(let i=0;i<p.length;i+=2)f.push([Math.round(r.an*(p[i]*a-n)),Math.round(r.an*(p[i+1]*a-o))]);f.length&&s.push(f)}(i,a,n,o,c);return{id:s,type:l,geometry:c,tags:u}}(i,o,a,n));return{features:s}}getFeatures(){return[...this.features.values()]}}function I({minX:i,minY:r,maxX:a,maxY:n},o,s,l){return i<(s+1+T)/o&&r<(l+1+T)/o&&a>(s-T)/o&&n>(l-T)/o}function E([i,a],n,o){let s=r.aH(i),l=r.aL(a);l=l<0?0:l>1?1:l,n.push(s,l),o.minX=Math.min(o.minX,s),o.minY=Math.min(o.minY,l),o.maxX=Math.max(o.maxX,s),o.maxY=Math.max(o.maxY,l)}function A(i,r,a,n=!1,o=!1){let s=[];for(let r of i)E(r,s,a);r.push(s),n&&function(i,r){let a=0;for(let r=0,n=i.length,o=n-2;r<n;o=r,r+=2)a+=(i[r]-i[o])*(i[r+1]+i[o+1]);if(a>0===r)for(let r=0,a=i.length;r<a/2;r+=2){let n=i[r],o=i[r+1];i[r]=i[a-2-r],i[r+1]=i[a-1-r],i[a-2-r]=n,i[a-1-r]=o}}(s,o)}function C(i,r,a,n=!1){for(let o=0;o<i.length;o++)A(i[o],r,a,n,0===o)}function M({name:i,features:a},n){n.writeStringField(1,i),n.writeVarintField(5,r.an);let o=new Map,s=new Map,l={keys:o,values:s,feature:null};for(let i of a)l.feature=i,n.writeMessage(2,P,l);for(let i of o.keys())n.writeStringField(3,i);for(let i of s.keys())n.writeMessage(4,F,i)}function P(i,r){let a=i.feature;void 0!==a.id&&Number.isSafeInteger(+a.id)&&r.writeVarintField(1,+a.id),a.tags&&r.writeMessage(2,D,i),r.writeVarintField(3,a.type),r.writeMessage(4,z,a)}function D({keys:i,values:r,feature:a},n){for(let o of Object.keys(a.tags)){let s=a.tags[o];if(null===s)continue;let l=i.get(o);void 0===l&&(l=i.size,i.set(o,l)),n.writeVarint(l);let h=typeof s;"string"!==h&&"boolean"!==h&&"number"!==h&&(s=JSON.stringify(s));let u=r.get(s);void 0===u&&(u=r.size,r.set(s,u)),n.writeVarint(u)}}function R(i,r){return(r<<3)+(7&i)}function L(i){return i<<1^i>>31}function z(i,r){let{geometry:a,type:n}=i,o=0,s=0;if(1===n)for(let i of(r.writeVarint(R(1,a.length)),a)){let a=i[0]-o,n=i[1]-s;r.writeVarint(L(a)),r.writeVarint(L(n)),o+=a,s+=n}else for(let i of a){if(0===i.length)continue;r.writeVarint(R(1,1));let a=i.length-(3===n);for(let n=0;n<a;n++){1===n&&r.writeVarint(R(2,a-1));let l=i[n][0]-o,h=i[n][1]-s;r.writeVarint(L(l)),r.writeVarint(L(h)),o+=l,s+=h}3===n&&r.writeVarint(R(7,1))}}function F(i,r){let a=typeof i;"string"===a?r.writeStringField(1,i):"boolean"===a?r.writeBooleanField(7,i):"number"===a&&(i%1!=0?r.writeDoubleField(3,i):i<0?r.writeSVarintField(6,i):r.writeVarintField(5,i))}let O={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},B=Math.fround||(n=new Float32Array(1),i=>(n[0]=+i,n[0]));class k{constructor(i){this.options=Object.assign(Object.create(O),i),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(i){let{log:r,minZoom:a,maxZoom:n}=this.options;r&&console.time("total time");let o=`prepare ${i.length} points`;r&&console.time(o),this.points=i;let s=[];for(let r=0;r<i.length;r++){let a=i[r];if(!a.geometry)continue;let[n,o]=a.geometry.coordinates,l=B(U(n)),h=B(j(o));s.push(l,h,1/0,r,-1,1),this.options.reduce&&s.push(0)}let l=this.trees[n+1]=this._createTree(s);r&&console.timeEnd(o);for(let i=n;i>=a;i--){let a=+Date.now();l=this.trees[i]=this._createTree(this._cluster(l,i)),r&&console.log("z%d: %d clusters in %dms",i,l.numItems,Date.now()-a)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let a=((i[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,i[1])),o=180===i[2]?180:((i[2]+180)%360+360)%360-180,s=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)a=-180,o=180;else if(a>o){let i=this.getClusters([a,n,180,s],r),l=this.getClusters([-180,n,o,s],r);return i.concat(l)}let l=this.trees[this._limitZoom(r)],h=l.range(U(a),j(s),U(o),j(n)),u=l.data,c=[];for(let i of h){let r=this.stride*i;c.push(u[r+5]>1?V(u,r,this.clusterProps):this.points[u[r+3]])}return c}getChildren(i){let r=this._getOriginId(i),a=this._getOriginZoom(i),n="No cluster with the specified id.",o=this.trees[a];if(!o)throw Error(n);let s=o.data;if(r*this.stride>=s.length)throw Error(n);let l=this.options.radius/(this.options.extent*Math.pow(2,a-1)),h=o.within(s[r*this.stride],s[r*this.stride+1],l),u=[];for(let r of h){let a=r*this.stride;s[a+4]===i&&u.push(s[a+5]>1?V(s,a,this.clusterProps):this.points[s[a+3]])}if(0===u.length)throw Error(n);return u}getLeaves(i,r,a){let n=[];return this._appendLeaves(n,i,r=r||10,a=a||0,0),n}getTile(i,r,a){let n=this.trees[this._limitZoom(i)],o=Math.pow(2,i),{extent:s,radius:l}=this.options,h=l/s,u=(a-h)/o,c=(a+1+h)/o,d={features:[]};return this._addTileFeatures(n.range((r-h)/o,u,(r+1+h)/o,c),n.data,r,a,o,d),0===r&&this._addTileFeatures(n.range(1-h/o,u,1,c),n.data,o,a,o,d),r===o-1&&this._addTileFeatures(n.range(0,u,h/o,c),n.data,-1,a,o,d),d.features.length?d:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){let a=this.getChildren(i);if(r++,1!==a.length)break;i=a[0].properties.cluster_id}return r}_appendLeaves(i,r,a,n,o){for(let s of this.getChildren(r)){let r=s.properties;if(r&&r.cluster?o+r.point_count<=n?o+=r.point_count:o=this._appendLeaves(i,r.cluster_id,a,n,o):o<n?o++:i.push(s),i.length===a)break}return o}_createTree(i){let a=new r.bJ(i.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<i.length;r+=this.stride)a.add(i[r],i[r+1]);return a.finish(),a.data=i,a}_addTileFeatures(i,r,a,n,o,s){for(let l of i){let i,h,u,c,d=l*this.stride,p=r[d+5]>1;if(p)i=N(r,d,this.clusterProps),h=r[d],u=r[d+1];else{let a=this.points[r[d+3]];i=a.properties;let[n,o]=a.geometry.coordinates;h=U(n),u=j(o)}let f={type:1,geometry:[[Math.round(this.options.extent*(h*o-a)),Math.round(this.options.extent*(u*o-n))]],tags:i};void 0!==(c=p||this.options.generateId?r[d+3]:this.points[r[d+3]].id)&&(f.id=c),s.features.push(f)}}_limitZoom(i){return Math.max(this.options.minZoom,Math.min(Math.floor(+i),this.options.maxZoom+1))}_cluster(i,r){let{radius:a,extent:n,reduce:o,minPoints:s}=this.options,l=a/(n*Math.pow(2,r)),h=i.data,u=[],c=this.stride;for(let a=0;a<h.length;a+=c){if(h[a+2]<=r)continue;h[a+2]=r;let n=h[a],d=h[a+1],p=i.within(h[a],h[a+1],l),f=h[a+5],m=f;for(let i of p){let a=i*c;h[a+2]>r&&(m+=h[a+5])}if(m>f&&m>=s){let i,s=n*f,l=d*f,_=-1,g=(a/c<<5)+(r+1)+this.points.length;for(let n of p){let u=n*c;if(h[u+2]<=r)continue;h[u+2]=r;
7let d=h[u+5];s+=h[u]*d,l+=h[u+1]*d,h[u+4]=g,o&&(i||(i=this._map(h,a,!0),_=this.clusterProps.length,this.clusterProps.push(i)),o(i,this._map(h,u)))}h[a+4]=g,u.push(s/m,l/m,1/0,g,-1,m),o&&u.push(_)}else{for(let i=0;i<c;i++)u.push(h[a+i]);if(m>1)for(let i of p){let a=i*c;if(!(h[a+2]<=r)){h[a+2]=r;for(let i=0;i<c;i++)u.push(h[a+i])}}}}return u}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r,a){if(i[r+5]>1){let n=this.clusterProps[i[r+6]];return a?Object.assign({},n):n}let n=this.points[i[r+3]].properties,o=this.options.map(n);return a&&o===n?Object.assign({},o):o}}function V(i,r,a){return{type:"Feature",id:i[r+3],properties:N(i,r,a),geometry:{type:"Point",coordinates:[360*(i[r]-.5),360*Math.atan(Math.exp((180-360*i[r+1])*Math.PI/180))/Math.PI-90]}}}function N(i,r,a){let n=i[r+5],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=i[r+6];return Object.assign(-1===s?{}:Object.assign({},a[s]),{cluster:!0,cluster_id:i[r+3],point_count:n,point_count_abbreviated:o})}function U(i){return i/360+.5}function j(i){let r=Math.sin(i*Math.PI/180),a=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return a<0?0:a>1?1:a}function G(i,r,a,n){let o={id:i??null,type:r,geometry:a,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===r||"MultiPoint"===r||"LineString"===r)q(o,a);else if("Polygon"===r)q(o,a[0]);else if("MultiLineString"===r)for(let i of a)q(o,i);else if("MultiPolygon"===r)for(let i of a)q(o,i[0]);return o}function q(i,r){for(let a=0;a<r.length;a+=3)i.minX=Math.min(i.minX,r[a]),i.minY=Math.min(i.minY,r[a+1]),i.maxX=Math.max(i.maxX,r[a]),i.maxY=Math.max(i.maxY,r[a+1])}function $(i,r,a,n){if(!r.geometry)return;let o=r.geometry.coordinates;if(o&&0===o.length)return;let s=r.geometry.type,l=Math.pow(a.tolerance/((1<<a.maxZoom)*a.extent),2),h=[],u=r.id;if(a.promoteId?u=r.properties[a.promoteId]:a.generateId&&(u=n||0),"Point"===s)H(o,h);else if("MultiPoint"===s)for(let i of o)H(i,h);else if("LineString"===s)Z(o,h,l,!1);else if("MultiLineString"===s){if(a.lineMetrics){for(let a of o)Z(a,h=[],l,!1),i.push(G(u,"LineString",h,r.properties));return}W(o,h,l,!1)}else if("Polygon"===s)W(o,h,l,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(let o of r.geometry.geometries)$(i,{id:u,geometry:o,properties:r.properties},a,n);return}throw Error("Input data is not a valid GeoJSON object.")}for(let i of o){let r=[];W(i,r,l,!0),h.push(r)}}i.push(G(u,s,h,r.properties))}function H(i,r){r.push(i[0]/360+.5,X(i[1]),0)}function Z(i,r,a,n){let o,s,l=0;for(let a=0;a<i.length;a++){let h=i[a][0]/360+.5,u=X(i[a][1]);r.push(h,u,0),a>0&&(l+=n?(o*u-h*s)/2:Math.sqrt(Math.pow(h-o,2)+Math.pow(u-s,2))),o=h,s=u}let h=r.length-3;r[2]=1,function i(r,a,n,o){let s=o,l=a+(n-a>>1),h,u=n-a,c=r[a],d=r[a+1],p=r[n],f=r[n+1];for(let i=a+3;i<n;i+=3){let a=function(i,r,a,n,o,s){let l=o-a,h=s-n;if(0!==l||0!==h){let u=((i-a)*l+(r-n)*h)/(l*l+h*h);u>1?(a=o,n=s):u>0&&(a+=l*u,n+=h*u)}return(l=i-a)*l+(h=r-n)*h}(r[i],r[i+1],c,d,p,f);if(a>s)h=i,s=a;else if(a===s){let r=Math.abs(i-l);r<u&&(h=i,u=r)}}s>o&&(h-a>3&&i(r,a,h,o),r[h+2]=s,n-h>3&&i(r,h,n,o))}(r,0,h,a),r[h+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function W(i,r,a,n){for(let o=0;o<i.length;o++){let s=[];Z(i[o],s,a,n),r.push(s)}}function X(i){let r=Math.sin(i*Math.PI/180),a=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return a<0?0:a>1?1:a}function Y(i,r,a,n,o,s,l,h){if(n/=r,s>=(a/=r)&&l<n)return i;if(l<a||s>=n)return null;let u=[];for(let r of i){let i=r.geometry,s=r.type,l=0===o?r.minX:r.minY,_=0===o?r.maxX:r.maxY;if(l>=a&&_<n){u.push(r);continue}if(_<a||l>=n)continue;let g=[];if("Point"===s||"MultiPoint"===s){var c=i,d=g,p=a,f=n,m=o;for(let i=0;i<c.length;i+=3){let r=c[i+m];r>=p&&r<=f&&ee(d,c[i],c[i+1],c[i+2])}}else if("LineString"===s)K(i,g,a,n,o,!1,h.lineMetrics);else if("MultiLineString"===s)Q(i,g,a,n,o,!1);else if("Polygon"===s)Q(i,g,a,n,o,!0);else if("MultiPolygon"===s)for(let r of i){let i=[];Q(r,i,a,n,o,!0),i.length&&g.push(i)}if(g.length){if(h.lineMetrics&&"LineString"===s){for(let i of g)u.push(G(r.id,s,i,r.tags));continue}"LineString"!==s&&"MultiLineString"!==s||(1===g.length?(s="LineString",g=g[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===g.length?"Point":"MultiPoint"),u.push(G(r.id,s,g,r.tags))}}return u.length?u:null}function K(i,r,a,n,o,s,l){let h=J(i),u=0===o?et:ei,c,d,p=i.start;for(let f=0;f<i.length-3;f+=3){let m=i[f],_=i[f+1],g=i[f+2],y=i[f+3],x=i[f+4],v=0===o?m:_,b=0===o?y:x,w=!1;l&&(c=Math.sqrt(Math.pow(m-y,2)+Math.pow(_-x,2))),v<a?b>a&&(d=u(h,m,_,y,x,a),l&&(h.start=p+c*d)):v>n?b<n&&(d=u(h,m,_,y,x,n),l&&(h.start=p+c*d)):ee(h,m,_,g),b<a&&v>=a&&(d=u(h,m,_,y,x,a),w=!0),b>n&&v<=n&&(d=u(h,m,_,y,x,n),w=!0),!s&&w&&(l&&(h.end=p+c*d),r.push(h),h=J(i)),l&&(p+=c)}let f=i.length-3,m=i[f],_=i[f+1],g=0===o?m:_;g>=a&&g<=n&&ee(h,m,_,i[f+2]),f=h.length-3,s&&f>=3&&(h[f]!==h[0]||h[f+1]!==h[1])&&ee(h,h[0],h[1],h[2]),h.length&&r.push(h)}function J(i){let r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function Q(i,r,a,n,o,s){for(let l of i)K(l,r,a,n,o,s,!1)}function ee(i,r,a,n){i.push(r,a,n)}function et(i,r,a,n,o,s){let l=(s-r)/(n-r);return ee(i,s,a+(o-a)*l,1),l}function ei(i,r,a,n,o,s){let l=(s-a)/(o-a);return ee(i,r+(n-r)*l,s,1),l}function er(i,r){let a=[];for(let n=0;n<i.length;n++){let o,s=i[n],l=s.type;if("Point"===l||"MultiPoint"===l||"LineString"===l)o=ea(s.geometry,r);else if("MultiLineString"===l||"Polygon"===l)for(let i of(o=[],s.geometry))o.push(ea(i,r));else if("MultiPolygon"===l)for(let i of(o=[],s.geometry)){let a=[];for(let n of i)a.push(ea(n,r));o.push(a)}
7a.push(G(s.id,l,o,s.tags))}return a}function ea(i,r){let a=[];a.size=i.size,void 0!==i.start&&(a.start=i.start,a.end=i.end);for(let n=0;n<i.length;n+=3)a.push(i[n]+r,i[n+1],i[n+2]);return a}function en(i,r){if(i.transformed)return i;let a=1<<i.z,n=i.x,o=i.y;for(let s of i.features){let i=s.geometry,l=s.type;if(s.geometry=[],1===l)for(let l=0;l<i.length;l+=2)s.geometry.push(eo(i[l],i[l+1],r,a,n,o));else for(let l=0;l<i.length;l++){let h=[];for(let s=0;s<i[l].length;s+=2)h.push(eo(i[l][s],i[l][s+1],r,a,n,o));s.geometry.push(h)}}return i.transformed=!0,i}function eo(i,r,a,n,o,s){return[Math.round(a*(i*n-o)),Math.round(a*(r*n-s))]}function es(i,r,a,n,o,s){let l=n*n;if(n>0&&r.size<(o?l:n))return void(a.numPoints+=r.length/3);let h=[];for(let i=0;i<r.length;i+=3)(0===n||r[i+2]>l)&&(a.numSimplified++,h.push(r[i],r[i+1])),a.numPoints++;o&&function(i,r){let a=0;for(let r=0,n=i.length,o=n-2;r<n;o=r,r+=2)a+=(i[r]-i[o])*(i[r+1]+i[o+1]);if(a>0===r)for(let r=0,a=i.length;r<a/2;r+=2){let n=i[r],o=i[r+1];i[r]=i[a-2-r],i[r+1]=i[a-1-r],i[a-2-r]=n,i[a-1-r]=o}}(h,s),i.push(h)}let el={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class eh{constructor(i,r){const a=(r=this.options=function(i,r){for(let a in r)i[a]=r[a];return i}(Object.create(el),r)).debug;if(a&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");let n=function(i,r){let a=[];if("FeatureCollection"===i.type)for(let n=0;n<i.features.length;n++)$(a,i.features[n],r,n);else $(a,"Feature"===i.type?i:{geometry:i},r);return a}(i,r);this.tiles={},this.tileCoords=[],a&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(i,r){let a=r.buffer/r.extent,n=i,o=Y(i,1,-1-a,a,0,-1,2,r),s=Y(i,1,1-a,2+a,0,-1,2,r);return(o||s)&&(n=Y(i,1,-a,1+a,0,-1,2,r)||[],o&&(n=er(o,1).concat(n)),s&&(n=n.concat(er(s,-1)))),n}(n,r)).length&&this.splitTile(n,0,0,0),a&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(i,r,a,n,o,s,l){let h=[i,r,a,n],u=this.options,c=u.debug;for(;h.length;){n=h.pop(),a=h.pop(),r=h.pop(),i=h.pop();let d=1<<r,p=eu(r,a,n),f=this.tiles[p];if(!f&&(c>1&&console.time("creation"),f=this.tiles[p]=function(i,r,a,n,o){let s=r===o.maxZoom?0:o.tolerance/((1<<r)*o.extent),l={features:[],numPoints:0,numSimplified:0,numFeatures:i.length,source:null,x:a,y:n,z:r,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let r of i)!function(i,r,a,n){let o=r.geometry,s=r.type,l=[];if(i.minX=Math.min(i.minX,r.minX),i.minY=Math.min(i.minY,r.minY),i.maxX=Math.max(i.maxX,r.maxX),i.maxY=Math.max(i.maxY,r.maxY),"Point"===s||"MultiPoint"===s)for(let r=0;r<o.length;r+=3)l.push(o[r],o[r+1]),i.numPoints++,i.numSimplified++;else if("LineString"===s)es(l,o,i,a,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(let r=0;r<o.length;r++)es(l,o[r],i,a,"Polygon"===s,0===r);else if("MultiPolygon"===s)for(let r=0;r<o.length;r++){let n=o[r];for(let r=0;r<n.length;r++)es(l,n[r],i,a,!0,0===r)}if(l.length){let a=r.tags||null;if("LineString"===s&&n.lineMetrics){for(let i in a={},r.tags)a[i]=r.tags[i];a.mapbox_clip_start=o.start/o.size,a.mapbox_clip_end=o.end/o.size}let h={geometry:l,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:a};null!==r.id&&(h.id=r.id),i.features.push(h)}}(l,r,s,o);return l}(i,r,a,n,u),this.tileCoords.push({z:r,x:a,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,a,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));let i=`z${r}`;this.stats[i]=(this.stats[i]||0)+1,this.total++}if(f.source=i,null==o){if(r===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue}else{if(r===u.maxZoom||r===o)continue;if(null!=o){let i=o-r;if(a!==s>>i||n!==l>>i)continue}}if(f.source=null,0===i.length)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,_=.5-m,g=.5+m,y=1+m,x=null,v=null,b=null,w=null,T=Y(i,d,a-m,a+g,0,f.minX,f.maxX,u),S=Y(i,d,a+_,a+y,0,f.minX,f.maxX,u);i=null,T&&(x=Y(T,d,n-m,n+g,1,f.minY,f.maxY,u),v=Y(T,d,n+_,n+y,1,f.minY,f.maxY,u),T=null),S&&(b=Y(S,d,n-m,n+g,1,f.minY,f.maxY,u),w=Y(S,d,n+_,n+y,1,f.minY,f.maxY,u),S=null),c>1&&console.timeEnd("clipping"),h.push(x||[],r+1,2*a,2*n),h.push(v||[],r+1,2*a,2*n+1),h.push(b||[],r+1,2*a+1,2*n),h.push(w||[],r+1,2*a+1,2*n+1)}}getTile(i,r,a){i*=1,r*=1,a*=1;let{extent:n,debug:o}=this.options;if(i<0||i>24)return null;let s=1<<i,l=eu(i,r=r+s&s-1,a);if(this.tiles[l])return en(this.tiles[l],n);o>1&&console.log("drilling down to z%d-%d-%d",i,r,a);let h,u=i,c=r,d=a;for(;!h&&u>0;)u--,c>>=1,d>>=1,h=this.tiles[eu(u,c,d)];return h&&h.source?(o>1&&(console.log("found parent tile z%d-%d-%d",u,c,d),console.time("drilling down")),this.splitTile(h.source,u,c,d,i,r,a),o>1&&console.timeEnd("drilling down"),this.tiles[l]?en(this.tiles[l],n):null):null}}function eu(i,r,a){return 32*((1<<i)*a+r)+i}function ec(i,a){let n=i.tileID.canonical;if(!this._geoJSONIndex)return void a(null,null);let o=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!o)return void a(null,null);let s=i=>i.tags&&"3d_elevation_id"in i.tags&&"source"in i.tags&&"elevation"===i.tags.source,l=o.features.filter(i=>s(i)),h={_geojsonTileLayer:o.features};l.length>0&&(h={_geojsonTileLayer:o.features.filter(i=>!s(i)),hd_road_elevation:l}),a(null,{vectorTile:new w(h),rawData:function(i){let a=new r.b0;for(let r of Object.keys(i))a.writeMessage(3,M,{name:r,features:i[r]});return a.finish()}(h).buffer})}class ed extends m{constructor(i){super(i),this.loadVectorData=ec,this._dynamicIndex=new S}loadData(i,a){let n=i&&i.request,s=n&&n.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(i,(l,h)=>
7{if(l||!h)return a(l);if("object"!=typeof h)return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{try{var u,c;if(i.filter){let a=r.X(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===a.result)throw Error(a.value.map(i=>`${i.key}: ${i.message}`).join(", "));h.features=h.features.filter(i=>a.value.evaluate({zoom:0},i))}i.dynamic?("Feature"===h.type&&(h={type:"FeatureCollection",features:[h]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(h.features,this.loaded),i.cluster&&(h.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new k(function({superclusterOptions:i,clusterProperties:a}){if(!a||!i)return i;let n={},o={},s={accumulated:null,zoom:0},l={properties:null},h=Object.keys(a);for(let i of h){let[s,l]=a[i],h=r.X(l),u=r.X("string"==typeof s?[s,["accumulated"],["get",i]]:s);n[i]=h.value,o[i]=u.value}return i.map=i=>{l.properties=i;let r={};for(let i of h)r[i]=n[i].evaluate(s,l);return r},i.reduce=(i,r)=>{for(let a of(l.properties=r,h))s.accumulated=i[a],i[a]=o[a].evaluate(s,l)},i}(i)).load(h.features):i.dynamic?this._dynamicIndex:(u=h,c=i.geojsonVtOptions,new eh(u,c))}catch(i){return a(i)}let l={};if(s){let r=o(n);r&&(l.resourceTiming={},l.resourceTiming[i.source]=JSON.parse(JSON.stringify(r)))}a(null,l)}})}reloadTile(i,r){let a=this.loaded;return a&&a[i.uid]?i.partial?r(null,void 0):super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(i,a){if(i.request)r.m(i.request,a);else{if("string"!=typeof i.data)return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return a(null,JSON.parse(i.data))}catch(r){return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(i){r(i)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(i){r(i)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(i){r(i)}}}class ep{constructor(i,a,n){this.tileID=new r.aS(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=i.projection,this.brightness=a,this.worldview=n}parse(i,a,n,o){this.status="parsing";let s=new r.aS(n.tileID.overscaledZ,n.tileID.wrap,n.tileID.canonical.z,n.tileID.canonical.x,n.tileID.canonical.y),l=[],h=a.familiesBySource[n.source],u=new r.fb(s,n.promoteId);u.bucketLayerIDs=[],u.is3DTile=!0,r.fw(i).then(i=>{let a=i.json.extensionsUsed&&i.json.extensionsUsed.includes("MAPBOX_mesh_features")||i.json.asset.extras&&i.json.asset.extras.MAPBOX_mesh_features,c=i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression"),d=new r.ae(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(let o in h)for(let p of h[o]){let o=p[0];u.bucketLayerIDs.push(p.map(i=>r.F(i.id,i.scope))),o.recalculate(d,[]);let h=r.fx(i,1/r.cO(n.tileID.canonical)),f=new r.fy(p,h,s,a,c,this.brightness,u,this.worldview);a||(f.needsUpload=!0),l.push(f),f.evaluate(o)}this.status="done",o(null,{buckets:l,featureIndex:u,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(i=>o(Error(i.message)))}}class ef{constructor({actor:i,layerIndex:r,availableImages:a,availableModels:n,brightness:o,worldview:s}){this.actor=i,this.layerIndex=r,this.availableImages=a,this.availableModels=n,this.brightness=o,this.loading={},this.loaded={},this.worldview=s}loadTile(i,a){let n=i.uid,o=this.loading[n]=new ep(i,this.brightness,this.worldview);r.b2(i.request,(r,s)=>{let l=!this.loading[n];return delete this.loading[n],l||r?(o.status="done",l||(this.loaded[n]=o),a(r)):s&&0!==s.byteLength?void o.parse(s,this.layerIndex,i,(i,r)=>{o.status="done",this.loaded=this.loaded||{},this.loaded[n]=o,i||!r?a(i):a(null,r)}
7):(o.status="done",this.loaded[n]=o,a())})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let o=a[n];o.projection=i.projection,o.brightness=i.brightness;let s=(a,n)=>{o.reloadCallback&&(delete o.reloadCallback,this.loadTile(i,r)),r(a,n)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&this.loadTile(i,r)}}abortTile(i,r){let a=i.uid;this.loading[a]&&delete this.loading[a],r()}removeTile(i,r){let a=this.loaded,n=i.uid;a&&a[n]&&delete a[n],r()}}let em=new Map,e_=new Map;class eg{constructor(i){this.self=i,this.actor=new r.A(i,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new r.z,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=r.c1({name:"mercator"}),this.workerSourceTypes={vector:m,geojson:ed,"raster-dem":_,"raster-array":y,"batched-model":ef},this.workerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=i=>{if(r.fA.isParsed())throw Error("RTL text plugin already registered.");for(let a of(r.fA.setState({pluginStatus:r.fB.parsed,pluginURL:r.fA.getPluginURL()}),r.fA.applyArabicShaping=i.applyArabicShaping,r.fA.processBidirectionalText=i.processBidirectionalText,r.fA.processStyledBidirectionalText=i.processStyledBidirectionalText,this.rtlPluginParsingListeners))a(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(i,r,a){delete this.layerIndexes[i],delete this.availableImages[i],delete this.availableModels[i],delete this.workerSources[i],a()}checkIfReady(i,r,a){a()}setReferrer(i,r){this.referrer=r}spriteLoaded(i,a){this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={});let{scope:n,isLoaded:o}=a;if(this.isSpriteLoaded[i][n]=o,this.workerSources[i]&&this.workerSources[i][n])for(let a in this.workerSources[i][n]){let s=this.workerSources[i][n][a];for(let i in s){let a=s[i];a instanceof m&&(a.isSpriteLoaded=o,a.fire(new r.C("isSpriteLoaded")))}}}setImages(i,r,a){this.availableImages[i]||(this.availableImages[i]={});let{scope:n,images:o}=r;if(this.availableImages[i][n]=o,this.workerSources[i]&&this.workerSources[i][n]){for(let r in this.workerSources[i][n]){let a=this.workerSources[i][n][r];for(let i in a)a[i].availableImages=o}a()}else a()}setModels(i,{scope:r,models:a},n){if(this.availableModels[i]||(this.availableModels[i]={}),this.availableModels[i][r]=a,this.workerSources[i]&&this.workerSources[i][r]){for(let n in this.workerSources[i][r]){let o=this.workerSources[i][r][n];for(let i in o)o[i].availableModels=a}n()}else n()}setProjection(i,a){this.projections[i]=r.c1(a)}setBrightness(i,r,a){this.brightness=r,a()}setContextParams(i,r,a){this.maxUniformBufferBindings=r.maxBindingPoints,this.maxUniformBlockSizeDwords=r.maxUniformBlockSizeDwords,this.disableSymbolUBO=r.disableSymbolUBO,a()}setWorldview(i,r,a){this.worldview=r,a()}setLayers(i,r,a){this.getLayerIndex(i,r.scope).replace(r.layers,r.options),a()}updateLayers(i,r,a){this.getLayerIndex(i,r.scope).update(r.layers,r.removedIds,r.options),a()}loadTile(i,r,a){r.projection=this.projections[i]||this.defaultProjection,this.getWorkerSource(i,r).loadTile(r,a)}decodeRasterArray(i,r,a){this.getWorkerSource(i,r).decodeRasterArray(r,a)}reloadTile(i,r,a){r.projection=this.projections[i]||this.defaultProjection,this.getWorkerSource(i,r).reloadTile(r,a)}abortTile(i,r,a){this.getWorkerSource(i,r).abortTile(r,a)}removeTile(i,r,a){this.getWorkerSource(i,r).removeTile(r,a)}removeSource(i,r,a){if(!(this.workerSources[i]&&this.workerSources[i][r.scope]&&this.workerSources[i][r.scope][r.type]&&this.workerSources[i][r.scope][r.type][r.source]))return;let n=this.workerSources[i][r.scope][r.type][r.source];delete this.workerSources[i][r.scope][r.type][r.source],void 0!==n.removeSource?n.removeSource(r,a):a()}loadTileProvider(i,r,n){(async function(i,r){let n=e_.get(i);if(n)return n;let o=em.get(i);if(void 0!==o)return o;let s=a(31372)(r).then(r=>{let a=r.default;if("function"!=typeof a)throw Error(`TileProvider "${i}" module must default-export a class`);if("function"!=typeof a.prototype.loadTile)throw Error(`TileProvider "${i}" class must have a loadTile method`);return e_.set(i,a),a}).finally(()=>{em.delete(i)});return em.set(i,s),s})(r.name,r.url).then(a=>{let n=new a(r.options);return this.getWorkerSource(i,{type:r.type,source:r.source,scope:r.scope},n),n.load&&r.request?n.load({request:r.request}):null}).then(i=>n(null,i)).catch(i=>n(i instanceof Error?i:Error("string"==typeof i?i:"Unknown error")))}loadWorkerSource(i,r,a){try{this.self.importScripts(r.url),a()}catch(i){a(i)}}
7syncRTLPluginState(i,a,n){if(r.fA.isParsed())n(null,!0);else if(r.fA.isParsing())this.rtlPluginParsingListeners.push(n);else try{r.fA.setState(a);let i=r.fA.getPluginURL();!r.fA.isLoaded()||r.fA.isParsed()||r.fA.isParsing()||null==i||(r.fA.setState({pluginStatus:r.fB.parsing,pluginURL:r.fA.getPluginURL()}),this.self.importScripts(i),r.fA.isParsed()?n(null,!0):this.rtlPluginParsingListeners.push(n))}catch(i){n(i)}}setConfig(i,a){Object.assign(r.e,a)}getAvailableImages(i,r){this.availableImages[i]||(this.availableImages[i]={});let a=this.availableImages[i][r];return a||(a=[]),a}getAvailableModels(i,r){this.availableModels[i]||(this.availableModels[i]={});let a=this.availableModels[i][r];return a||(a={}),a}getLayerIndex(i,r){this.layerIndexes[i]||(this.layerIndexes[i]={});let a=this.layerIndexes[i][r];return a||((a=this.layerIndexes[i][r]=new l).scope=r),a}getWorkerSource(i,r,a){let{type:n,source:o,scope:s}=r,l=this.workerSources;if(l[i]||(l[i]={}),l[i][s]||(l[i][s]={}),l[i][s][n]||(l[i][s][n]={}),this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={}),!l[i][s][n][o]){let r={send:(r,a,n,o,s,l)=>this.actor.send(r,a,n,i,s,l),scheduler:this.actor.scheduler},h=this.workerSourceTypes[n];if(!h)throw Error(`Unknown worker source type "${n}".`);l[i][s][n][o]=new h({actor:r,layerIndex:this.getLayerIndex(i,s),availableImages:this.getAvailableImages(i,s),availableModels:this.getAvailableModels(i,s),isSpriteLoaded:this.isSpriteLoaded[i][s],tileProvider:a,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO})}return l[i][s][n][o]}rasterizeImagesWorker(i,r,a){let n=new Map;for(let[a,{image:o,imageVariant:s}]of r.tasks.entries()){let l=this.imageRasterizer.rasterize(s,o,r.scope,i);n.set(a,l)}a(void 0,n)}removeRasterizedImages(i,r,a){this.imageRasterizer.removeImagesFromCacheByIds(r.imageIds,r.scope,i),a()}enforceCacheSizeLimit(i,a){r.fC(a)}getWorkerPerformanceMetrics(i,r,a){a(void 0,void 0)}}return r.fz(self)&&(self.worker=new eg(self)),eg}),o(["./shared"],function(i){let r,a,n,o,s,l;var h="3.21.0";let u={create:"create",load:"load",fullLoad:"fullLoad"},c={mark(i){performance.mark(i)},measure(i,r,a){performance.measure(i,r,a)}};function d(r){let a=r.name.split("?")[0];return i.a(a)&&a.includes("mapbox-gl.js")?"javascript":i.a(a)&&a.includes("mapbox-gl.css")?"css":i.b(a)?"fontRange":i.c(a)?"sprite":i.i(a)?"style":i.d(a)?"tilejson":"other"}var p,f={},m=function(){if(p)return f;function i(i){return!r(i)}function r(r){var n;return"u"<typeof window||"u"<typeof document?"not a browser":!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var i,r,a=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(a);try{r=new Worker(n),i=!0}catch(r){i=!1}return r&&r.terminate(),URL.revokeObjectURL(n),i}()?"insufficient worker support":!function(){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");if(!r)return!1;var a=r.getImageData(0,0,1,1);return a&&a.width===i.width}()?"insufficient Canvas/getImageData support":(void 0===a[n=r&&r.failIfMajorPerformanceCaveat]&&(a[n]=function(r){var a,n,o,s=(a=document.createElement("canvas"),(n=Object.create(i.webGLContextAttributes)).failIfMajorPerformanceCaveat=r,a.getContext("webgl2",n));if(!s)return!1;try{o=s.createShader(s.VERTEX_SHADER)}catch(i){return!1}return!(!o||s.isContextLost())&&(s.shaderSource(o,"void main() {}"),s.compileShader(o),!0===s.getShaderParameter(o,s.COMPILE_STATUS))}(n)),a[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support")}p=1,f.supported=i,f.notSupportedReason=r;var a={};return i.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},f}();function _(i,r,a){let n=document.createElement(i);return null!=r&&(n.className=r),a&&a.appendChild(n),n}function g(i,r,a){let n=document.createElementNS("http://www.w3.org/2000/svg",i);for(let i of Object.keys(r))n.setAttributeNS(null,i,String(r[i]));return a&&a.appendChild(n),n}let y="u">typeof document?document.documentElement&&document.documentElement.style:null,x=y&&void 0!==y.userSelect?"userSelect":"WebkitUserSelect";function v(){y&&x&&(r=y[x],y[x]="none")}function b(){y&&x&&(y[x]=r)}function w(i){i.preventDefault(),i.stopPropagation(),window.removeEventListener("click",w,!0)}function T(){window.addEventListener("click",w,!0),window.setTimeout(()=>{window.removeEventListener("click",w,!0)},0)}function S(i,r){let a=i.getBoundingClientRect();return A(i,a,r)}function I(i,r){let a=i.getBoundingClientRect(),n=[];for(let o=0;o<r.length;o++)n.push(A(i,a,r[o]));return n}function E(i){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&2===i.button&&i.ctrlKey?0:i.button}function A(r,a,n){let o=r.offsetWidth===a.width?1:r.offsetWidth/a.width;
7return new i.P((n.clientX-a.left)*o,(n.clientY-a.top)*o)}let C="NO_ACCESS_TOKEN";class M{constructor(i,r,a){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!a,this._createSkuToken()}_createSkuToken(){let i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(r,a){if(!i.h(r))return r;let n=D(r);return n.params.push(`sdk=js-${h}`),n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}normalizeGlyphsURL(r,a){if(!i.h(r))return r;let n=D(r);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}normalizeModelURL(r,a){if(!i.h(r))return r;let n=D(r);return n.path=`/models/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}normalizeSourceURL(r,a,n,o){if(!i.h(r))return r;let s=D(r);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),n&&s.params.push(`language=${n}`),o&&s.params.push(`worldview=${o}`),this._makeAPIURL(s,this._customAccessToken||a)}normalizeIconsetURL(r,a){let n=D(r);return i.h(r)?(n.path=`/styles/v1${n.path}/iconset.pbf`,this._makeAPIURL(n,this._customAccessToken||a)):R(n)}normalizeSpriteURL(r,a,n,o){let s=D(r);return i.h(r)?(s.path=`/styles/v1${s.path}/sprite${a}${n}`,this._makeAPIURL(s,this._customAccessToken||o)):(s.path+=`${a}${n}`,R(s))}normalizeTileURL(r,a,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),r&&!i.h(r))return r;let o=D(r);o.path=o.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${a||n&&"raster"!==o.authority&&512===n?"@2x":""}${i.k.supported?".webp":"$1"}`),"raster"===o.authority?o.path=`/${i.e.RASTER_URL_PREFIX}${o.path}`:"rasterarrays"===o.authority?o.path=`/${i.e.RASTERARRAYS_URL_PREFIX}${o.path}`:"3dtiles"===o.authority?o.path=`/${i.e.TILES3D_URL_PREFIX}${o.path}`:(o.path=o.path.replace(/^.+\/v4\//,"/"),o.path=`/${i.e.TILE_URL_VERSION}${o.path}`);let s=this._customAccessToken||function(i){for(let r of i){let i=r.match(/^access_token=(.*)$/);if(i)return i[1]}return null}(o.params)||i.e.ACCESS_TOKEN;return i.e.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&o.params.push(`sku=${this._skuToken}`),this._makeAPIURL(o,s)}canonicalizeTileURL(r,a){let n=D(r);if(!n.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!n.path.match(/\.[\w]+$/))return r;let o="mapbox://";n.path.match(/^\/raster\/v1\//)?o+=`raster/${n.path.replace(`/${i.e.RASTER_URL_PREFIX}/`,"")}`:n.path.match(/^\/rasterarrays\/v1\//)?o+=`rasterarrays/${n.path.replace(`/${i.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:o+=`tiles/${n.path.replace(`/${i.e.TILE_URL_VERSION}/`,"")}`;let s=n.params;return a&&(s=s.filter(i=>!i.match(/^access_token=/))),s.length&&(o+=`?${s.join("&")}`),o}canonicalizeTileset(r,a){let n=!!a&&i.h(a),o=[];for(let a of r.tiles||[])i.j(a)?o.push(this.canonicalizeTileURL(a,n)):o.push(a);return o}_makeAPIURL(r,a){let n="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",o=D(i.e.API_URL);if(r.protocol=o.protocol,r.authority=o.authority,"http"===r.protocol){let i=r.params.indexOf("secure");i>=0&&r.params.splice(i,1)}if("/"!==o.path&&(r.path=`${o.path}${r.path}`),!i.e.REQUIRE_ACCESS_TOKEN)return R(r);if(a=a||i.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!a)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===a[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return r.params=r.params.filter(i=>-1===i.indexOf("access_token")),r.params.push(`access_token=${a||""}`),R(r)}}let P=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function D(i){let r=i.match(P);if(!r)throw Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function R(i){let r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}let L="mapbox.eventData";function z(r){if(!r)return null;let a=r.split(".");if(!a||3!==a.length)return null;try{return JSON.parse(i.l(a[1]))}catch(i){return null}}class F{constructor(i){this.type=i,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(r){let a=z(i.e.ACCESS_TOKEN),n="";return n=a&&a.u?i.f(a.u):i.e.ACCESS_TOKEN||"",r?`${L}.${r}:${n}`:`${L}:${n}`}fetchEventData(){let r=i.s("localStorage"),a=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.getStorageKey("uuidTimestamp");if(r)try{let i=localStorage.getItem(a);i&&(this.eventData=JSON.parse(i));let r=localStorage.getItem(n);r&&(this.anonId=r);let s=localStorage.getItem(o);s&&(this.anonIdTimestamp=Number(s));let l=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<l)&&this.refreshUUID()}catch(r){i.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=i.u(),this.anonIdTimestamp=Date.now()}saveEventData(){let r=i.s("localStorage"),a=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.getStorageKey("uuidTimestamp"),s=this.anonId,l=this.anonIdTimestamp;if(r&&s)try{localStorage.setItem(n,s),Object.keys(this.eventData).length>=1&&localStorage.setItem(a,JSON.stringify(this.eventData)),l&&localStorage.setItem(o,l.toString())}catch(r){i.w("Unable to write to LocalStorage")}}processRequests(i){}postEvent(r,a,n,o){if(!i.e.EVENTS_URL)return;let s=D(i.e.EVENTS_URL);s.params.push(`access_token=${o||i.e.ACCESS_TOKEN||""}`);let l={event:this.type,created:new Date(r).toISOString()},h=a?Object.assign(l,a):l,u={url:R(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([h])};this.pendingRequest=i.p(u,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}queueRequest(i,r){this.queue.push(i),this.processRequests(r)}}class O extends F{constructor(i){super("metrics"),i&&(this.data=i)}postMetricsEvent(r){if(!i.e.EVENTS_URL||!r&&!i.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID();let a=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:a},r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,payload:a}=this.queue.shift();this.postEvent(r,a,()=>{},i)}}let B=new class extends F{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(r,a){i.e.EVENTS_URL&&i.e.ACCESS_TOKEN&&Array.isArray(r)&&r.some(r=>i.h(r)||i.j(r))&&this.queueRequest(Date.now(),a)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let a=z(i.e.ACCESS_TOKEN),n=a?a.u:i.e.ACCESS_TOKEN,o=n!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),o=!0);let s=this.queue.shift();if(this.eventData.lastSuccess){let i=new Date(this.eventData.lastSuccess),r=new Date(s),a=(s-this.eventData.lastSuccess)/864e5;o=o||a>=1||a<-1||i.getDate()!==r.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:"01","enabled.telemetry":!1,userId:this.anonId},i=>{i||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)},r):this.processRequests()}},k=B.postTurnstileEvent.bind(B),V=new class extends F{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(r,a,n,o){this.skuToken=a,this.errorCb=o,i.e.EVENTS_URL&&(n||i.e.ACCESS_TOKEN?this.queueRequest({id:r,timestamp:Date.now()},n):this.errorCb(Error(C)))}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;let{id:a,timestamp:n}=this.queue.shift();a&&this.success[a]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID(),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:"01",skuToken:this.skuToken,userId:this.anonId},i=>{i?this.errorCb(i):a&&(this.success[a]=!0)},r))}remove(){this.errorCb=null}},N=V.postMapLoadEvent.bind(V),U=new class extends F{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(r){let a=this.mapInstanceIdMap.get(r);return a||(a=i.u(),this.mapInstanceIdMap.set(r,a)),a}getEventId(i){let r=this.eventIdPerMapInstanceMap.get(i)||0;return this.eventIdPerMapInstanceMap.set(i,r+1),r}postStyleLoadEvent(r,a){let{map:n,style:o,importedStyles:s}=a;if(!i.e.EVENTS_URL||!r&&!i.e.ACCESS_TOKEN)return;let l=this.getMapInstanceId(n),h={mapInstanceId:l,eventId:this.getEventId(l),style:o};s.length&&(h.importedStyles=s),this.queueRequest({timestamp:Date.now(),payload:h},r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,payload:a}=this.queue.shift();this.postEvent(r,a,()=>{},i)}},j=U.postStyleLoadEvent.bind(U),G=new O({attributes:[{name:"maps/js/layer
7-animations/style-with-appearances"}]}),q=G.postMetricsEvent.bind(G),$=new O({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),H=$.postMetricsEvent.bind($),Z=new class extends F{constructor(){super("gljs.performance")}postPerformanceEvent(r,a){i.e.EVENTS_URL&&(r||i.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:a},r)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:a,performanceData:n}=this.queue.shift(),o=function(r){let a=performance.getEntriesByType("resource"),n=performance.getEntriesByType("mark"),o=function(i){let r={};if(i){for(let a in i)if("other"!==a)for(let n of i[a]){let i=`${a}ResolveRangeMin`,o=`${a}ResolveRangeMax`,s=`${a}RequestCount`,l=`${a}RequestCachedCount`;r[i]=Math.min(r[i]||1/0,n.startTime),r[o]=Math.max(r[o]||-1/0,n.responseEnd);let h=i=>{void 0===r[i]&&(r[i]=0),++r[i]};void 0!==n.transferSize&&0===n.transferSize&&h(l),h(s)}}return r}(function(i,r){let a={};if(i)for(let n of i){let i=r(n);void 0===a[i]&&(a[i]=[]),a[i].push(n)}return a}(a,d)),s=window.devicePixelRatio,l=navigator.connection||navigator.mozConnection||navigator.webkitConnection,c=l?l.effectiveType:void 0,p={counters:[],metadata:[],attributes:[]},f=(i,r,a)=>{null!=a&&i.push({name:r,value:a.toString()})};for(let i in o)f(p.counters,i,o[i]);if(r.interactionRange[0]!==1/0&&r.interactionRange[1]!==-1/0&&(f(p.counters,"interactionRangeMin",r.interactionRange[0]),f(p.counters,"interactionRangeMax",r.interactionRange[1])),n)for(let i of Object.values(u)){let r=n.find(r=>r.name===i);r&&f(p.counters,i,r.startTime)}return f(p.counters,"visibilityHidden",r.visibilityHidden),f(p.attributes,"style",function(r){if(r)for(let a of r){let r=a.name.split("?")[0];if(i.i(r)){let i=r.split("/").slice(-2);if(2===i.length)return`mapbox://styles/${i[0]}/${i[1]}`}}}(a)),f(p.attributes,"terrainEnabled",r.terrainEnabled?"true":"false"),f(p.attributes,"fogEnabled",r.fogEnabled?"true":"false"),f(p.attributes,"projection",r.projection),f(p.attributes,"zoom",r.zoom),f(p.metadata,"devicePixelRatio",s),f(p.metadata,"connectionEffectiveType",c),f(p.metadata,"navigatorUserAgent",navigator.userAgent),f(p.metadata,"screenWidth",window.screen.width),f(p.metadata,"screenHeight",window.screen.height),f(p.metadata,"windowWidth",window.innerWidth),f(p.metadata,"windowHeight",window.innerHeight),f(p.metadata,"mapWidth",r.width/s),f(p.metadata,"mapHeight",r.height/s),f(p.metadata,"webglRenderer",r.renderer),f(p.metadata,"webglVendor",r.vendor),f(p.metadata,"sdkVersion",h),f(p.metadata,"sdkIdentifier","mapbox-gl-js"),p}(n);for(let i of o.metadata);for(let i of o.counters);for(let i of o.attributes);this.postEvent(a,o,()=>{},r)}},W=Z.postPerformanceEvent.bind(Z),X=new class extends F{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(r,a,n,o){if(!i.e.API_URL||!i.e.SESSION_PATH)return;let s=D(i.e.API_URL+i.e.SESSION_PATH);s.params.push(`sku=${a||""}`),s.params.push(`access_token=${o||i.e.ACCESS_TOKEN||""}`);let l={url:R(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.g(l,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}getSessionAPI(r,a,n,o){this.skuToken=a,this.errorCb=o,i.e.SESSION_PATH&&i.e.API_URL&&(n||i.e.ACCESS_TOKEN?this.queueRequest({id:r,timestamp:Date.now()},n):this.errorCb(Error(C)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:a}=this.queue.shift();r&&this.success[r]||this.getSession(a,this.skuToken,i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i)}remove(){this.errorCb=null}},Y=X.getSessionAPI.bind(X),K=new Set;function J(i,r){r?K.add(i):K.delete(i)}class Q{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(i,r){this._updatedSourceCaches[i]=r,this.setDirty()}discardSourceCacheUpdate(i){delete this._updatedSourceCaches[i]}updateLayer(i){let r=i.scope;this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._updatedLayers[r].add(i.id),this.setDirty()}removeLayer(i){let r=i.scope;this._removedLayers[r]=this._removedLayers[r]||{},this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._removedLayers[r][i.id]=i,this._updatedLayers[r].delete(i.id),this._updatedPaintProps.delete(i.fqid),this.setDirty()}getRemovedLayer(i){return this._removedLayers[i.scope]?this._removedLayers[i.scope][i.id]:null}discardLayerRemoval(i){this._removedLayers[i.scope]&&delete this._removedLayers[i.scope][i.id]}getLayerUpdatesByScope(){let i={};for(let r in this._updatedLayers)i[r]=i[r]||{},i[r].updatedIds=Array.from(this._updatedLayers[r].values());for(let r in this._removedLayers)i[r]=i[r]||{},i[r].removedIds=Object.keys(this._removedLayers[r]);return i}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(i){this._updatedPaintProps.add(i.fqid),this.setDirty()}getUpdatedImages(i){return this._updatedImages[i]?Array.from(this._updatedImages[i].values()):[]}updateImage(r,a){this._updatedImages[a]=this._updatedImages[a]||new Set,this._updatedImages[a].add(i.I.toString(r)),this.setDirty()}resetUpdatedImages(i){this._updatedImages[i]&&this._updatedImages[i].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}let ee={workerUrl:"",workerClass:null,workerParams:void 0},et="mapboxgl_preloaded_worker_pool";class ei{constructor(i){this.active={},this.name=i}acquire(i,r=ei.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<r;){var a;let r=(a=`${this.name||""}WorkerPool: ${i}-${this.workers.length}`,null!=ee.workerClass?new ee.workerClass:new self.Worker(ee.workerUrl,Object.assign({name:a},ee.workerParams)));this.workers.push(r)}return this.active[i]=!0,this.workers.slice()}release(i){delete this.active[i],this.workers&&0===this.numActive()&&(this.workers.forEac
7h(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[et]}numActive(){return Object.keys(this.active).length}}ei.workerCount=2;class er{constructor(r,a,n="Worker",o=ei.workerCount){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=i.r();const s=this.workerPool.acquire(this.id,o);for(let i=0;i<s.length;i++){const r=new er.Actor(s[i],a,this.id);r.name=`${n} ${i}`,this.actors.push(r)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(r,a,n){i.t(this.actors,(i,n)=>{i.send(r,a,n)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}function ea(){return a||(a=new ei),a}er.Actor=i.A;class en extends i.E{constructor(r){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.imageVersions=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.imageAtlasCache=new i.x,this.dirty=!0,this.spriteFormat=r,"raster"!==r&&i.y()&&(this.imageRasterizerDispatcher=new er((n||(n=new ei("ImageRasterizer")),n),this,"Image Rasterizer Worker",1))}addScope(r){this.loaded.set(r,!1),this.imageProviders.set(r,new Map),this.images.set(r,new Map),this.updatedImages.set(r,new Set),this.callbackDispatchedThisFrame.set(r,new Set),this.imageVersions.set(r,new Map),this.patterns.set(r,new Map),this.atlasImage.set(r,new i.q({width:1,height:1}))}removeScope(i){this.loaded.delete(i),this.imageProviders.delete(i),this.images.delete(i),this.updatedImages.delete(i),this.callbackDispatchedThisFrame.delete(i),this.imageVersions.delete(i),this.patterns.delete(i),this.atlasImage.delete(i);let r=this.atlasTexture.get(i);r&&(r.destroy(),this.atlasTexture.delete(i))}addImageProvider(i,r){this.imageProviders.has(r)||this.imageProviders.set(r,new Map),this.imageProviders.get(r).set(i.id,i)}removeImageProvider(i,r){this.imageProviders.has(r)&&this.imageProviders.get(r).delete(i)}getPendingImageProviders(){let i=[];for(let r of this.imageProviders.values())for(let a of r.values())a.hasPendingRequests()&&i.push(a);return i}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new i.z),this._imageRasterizer}isLoaded(){for(let i of this.loaded.keys())if(!this.loaded.get(i))return!1;return!0}setLoaded(i,r){if(this.loaded.get(r)!==i&&(this.loaded.set(r,i),i)){for(let{ids:i,callback:a}of this.requestors)this._notify(i,r,a);this.requestors=[]}}hasImage(i,r){return!!this.getImage(i,r)}getImage(i,r){return this.images.get(r).get(i.toString())}addImage(i,r,a){if(this._validate(i,a)){this.images.get(r).set(i.toString(),a);let n=this.imageVersions.get(r),o=n.get(i.toString())||0;n.set(i.toString(),o+1)}}_validate(r,a){let n=!0;return this._validateStretch(a.stretchX,a.data&&a.data.width)||(this.fire(new i.B(Error(`Image "${r.name}" has invalid "stretchX" value`))),n=!1),this._validateStretch(a.stretchY,a.data&&a.data.height)||(this.fire(new i.B(Error(`Image "${r.name}" has invalid "stretchY" value`))),n=!1),this._validateContent(a.content,a)||(this.fire(new i.B(Error(`Image "${r.name}" has invalid "content" value`))),n=!1),n}_validateStretch(i,r){if(!i)return!0;let a=0;for(let n of i){if(n[0]<a||n[1]<n[0]||r<n[1])return!1;a=n[1]}return!0}_validateContent(i,r){return!i||4===i.length&&(!!r.usvg||!(i[0]<0)&&!(r.data.width<i[0])&&!(i[1]<0)&&!(r.data.height<i[1])&&!(i[2]<0)&&!(r.data.width<i[2])&&!(i[3]<0)&&!(r.data.height<i[3]))&&!(i[2]<i[0]||i[3]<i[1])}updateImage(i,r,a){a.version=this.images.get(r).get(i.toString()).version+1,this.images.get(r).set(i.toString(),a),this.updatedImages.get(r).add(i);let n=this.imageVersions.get(r),o=n.get(i.toString())||0;n.set(i.toString(),o+1),this.removeFromImageRasterizerCache(i,r)}clearUpdatedImages(i){this.updatedImages.get(i).clear()}removeFromImageRasterizerCache(r,a){"raster"!==this.spriteFormat&&(i.y()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[r],scope:a}):this.imageRasterizer.removeImagesFromCacheByIds([r],a))}removeImage(i,r){let a=this.images.get(r),n=a.get(i.toString());a.delete(i.toString());let o=this.imageVersions.get(r),s=o.get(i.toString())||0;o.set(i.toString(),s+1),this.patterns.get(r).delete(i.toString()),this.removeFromImageRasterizerCache(i,r),n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(r){return Array.from(this.images.get(r).keys()).map(r=>i.I.from(r))}getImageVersions(i){let r=this.imageVersions.get(i);if(r)return r}getImages(i,r,a){let n=[],o=[],s=this.imageProviders.get(r);for(let a of i){if(!a.iconsetId){n.push(a);continue}let i=s.get(a.iconsetId);i&&(this.getImage(a,r)?o.push(a):i.addPendingRequest(a))}if(0===n.length)return void this._notify(o,r,a);let l=!0,h=!!this.loaded.get(r),u=this.images.get(r);
7if(!h)for(let i of n)u.has(i.toString())||(l=!1);h||l?this._notify(n,r,a):this.requestors.push({ids:n,scope:r,callback:a})}rasterizeImages(i,r){let a=new Map,{tasks:n,scope:o}=i;for(let[i,r]of n.entries()){let n=this.getImage(r.id,o);n&&a.set(i,{image:n,imageVariant:r})}this._rasterizeImages(o,a,r)}_rasterizeImages(r,a,n){if(i.y())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:a,scope:r},n);else{let i=new Map;for(let[n,{image:o,imageVariant:s}]of a.entries())i.set(n,this.imageRasterizer.rasterize(s,o,r,0));n(void 0,i)}}getUpdatedImages(i){return this.updatedImages.get(i)||new Set}_notify(r,a,n){let o=this.images.get(a),s=new Map;for(let a of r){if(!o.get(a.toString())){if(a.iconsetId)continue;this.fire(new i.C("styleimagemissing",{id:a.name}))}let r=o.get(a.toString());if(!r){i.w(`Image "${a.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}let n={data:r.usvg?null:r.data.clone(),pixelRatio:r.pixelRatio,sdf:r.sdf,usvg:r.usvg,stretchX:r.stretchX,stretchY:r.stretchY,content:r.content,hasRenderCallback:!!(r.userImage&&r.userImage.render)};r.usvg&&Object.assign(n,{width:r.icon.usvg_tree.width,height:r.icon.usvg_tree.height}),s.set(i.I.toString(a),n)}n(null,{images:s,versions:this.getImageVersions(a)})}getPixelSize(i){let{width:r,height:a}=this.atlasImage.get(i);return{width:r,height:a}}getPattern(r,a,n){let o=r.toString(),s=this.patterns.get(a),l=s.get(o),h=this.getImage(r,a);if(!h)return null;if(l){if(l.position.version===h.version)return l.position;l.position.version=h.version}else{if(h.usvg&&!h.data){let s=this.getPatternInFlightId(o,a);if(this.patternsInFlight.has(s))return null;this.patternsInFlight.add(s);let l=new i.D(r).scaleSelf(i.o.devicePixelRatio),u=new Map([[l.toString(),{image:h,imageVariant:l}]]);return this._rasterizeImages(a,u,(i,r)=>this.storePatternImage(l,a,h,n,r)),null}this.storePattern(r,a,h)}return this._updatePatternAtlas(a,n),s.get(o).position}getPatternInFlightId(r,a){return i.F(r,a)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(i,r,a,n,o){let s=i.toString(),l=o?o.get(s):void 0;l&&(a.data=l,this.storePattern(i.id,r,a),this._updatePatternAtlas(r,n),this.patternsInFlight.delete(this.getPatternInFlightId(i.id.toString(),r)))}storePattern(r,a,n){let o={w:n.data.width+2*i.G,h:n.data.height+2*i.G,x:0,y:0},s=new i.H(o,n,i.G);this.patterns.get(a).set(r.toString(),{bin:o,position:s})}destroyAtlasTextures(){for(let i of this.atlasTexture.values())i&&i.destroy();this.atlasTexture.clear()}bind(r,a){let n=r.gl,o=this.atlasTexture.get(a);o?this.dirty&&(o.update(this.atlasImage.get(a)),this.dirty=!1):(o=new i.T(r,this.atlasImage.get(a),n.RGBA8),this.atlasTexture.set(a,o)),o.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(r,a){let n=this.patterns.get(r),o=Array.from(n.values()).map(({bin:i})=>i),{w:s,h:l}=i.J(o),h=this.atlasImage.get(r);h.resize({width:s||1,height:l||1});let u=this.images.get(r);for(let[r,{bin:o,position:s}]of n.entries()){let n=s.padding,l=o.x+n,c=o.y+n,d=u.get(r).data,p=d.width,f=d.height;n=n>1?n-1:n,i.q.copy(d,h,{x:0,y:0},{x:l,y:c},{width:p,height:f},a),i.q.copy(d,h,{x:0,y:f-n},{x:l,y:c-n},{width:p,height:n},a),i.q.copy(d,h,{x:0,y:0},{x:l,y:c+f},{width:p,height:n},a),i.q.copy(d,h,{x:p-n,y:0},{x:l-n,y:c},{width:n,height:f},a),i.q.copy(d,h,{x:0,y:0},{x:l+p,y:c},{width:n,height:f},a),i.q.copy(d,h,{x:p-n,y:f-n},{x:l-n,y:c-n},{width:n,height:n},a),i.q.copy(d,h,{x:0,y:f-n},{x:l+p,y:c-n},{width:n,height:n},a),i.q.copy(d,h,{x:0,y:0},{x:l+p,y:c+f},{width:n,height:n},a),i.q.copy(d,h,{x:p-n,y:0},{x:l-n,y:c+f},{width:n,height:n},a)}this.dirty=!0}beginFrame(){for(let i of this.images.keys())this.callbackDispatchedThisFrame.set(i,new Set)}dispatchRenderCallbacks(i,r){let a=this.images.get(r);for(let n of i){if(this.callbackDispatchedThisFrame.get(r).has(n.toString()))continue;this.callbackDispatchedThisFrame.get(r).add(n.toString());let i=a.get(n.toString());(function(i){let{userImage:r}=i;return!!(r&&r.render&&r.render())&&(i.data.replace(new Uint8Array(r.data.buffer)),!0)})(i)&&this.updateImage(n,r,i)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function eo(r){let a=r.value,n=r.valueSpec,o=r.style,s=r.styleSpec,l=r.key,h=r.arrayElementValidator||eS;if(!Array.isArray(a))return[new i.V(l,a,`array expected, ${i.M(a)} found`)];if(n.length&&a.length!==n.length)return[new i.V(l,a,`array length ${n.length} expected, length ${a.length} found`)];if(n["min-length"]&&a.length<n["min-length"])return[new i.V(l,a,`array length at least ${n["min-length"]} expected, length ${a.length} found`)];let u={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};s.$version<7&&(u.function=n.function),i.K(n.value)&&(u=n.value);let c=[];for(let i=0;i<a.length;i++)c=c.concat(h({array:a,arrayIndex:i,value:a[i],valueSpec:u,style:o,styleSpec:s,key:`${l}[${i}]`},!0));return c}function es(r){let a=r.key,n=r.value,o=r.valueSpec;if(!i.N(n))return[new i.V(a,n,`number expected, ${i.M(n)} found`)];if(n!=n)return[new i.V(a,n,"number expected, NaN found")];if("minimum"in o){let s=o.minimum;if(Array.isArray(o.minimum)&&(s=o.minimum[r.arrayIndex]),n<s)return[new i.V(a,n,`${n} is less than the minimum value ${s}`)]}if("maximum"in o){let s=o.maximum;if(Array.isArray(o.maximum)&&(s=o.maximum[r.arrayIndex]),n>s)return[new i.V(a,n,`${n} is greater than the maximum value ${s}`)]}return[]}function el(r){let a,n=r.key,o=r.value;if(!i.K(o))return[new i.V(n,o,`object expected, ${i.M(o)} found`)];let s=r.valueSpec,l=i.L(o.type),h,u,c,d={},p="categorical"!==l&&void 0===o.property,f=Array.isArray(a=o.stops)&&Array.isArray(a[0])&&i.K(a[0][0]),m=eI({key:r.key,value:r.value,valueSpec:r.styleSpec.function,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(r){if("identity"===l)return[new i.V(r.key,r.value,'identity function may not have a "stops" property')];let a=[],n=r.value;return a=a.concat(eo({key:r.key,value:n,valueSpec:r.valueSpec,style:r.style,styleSpec:r.styleSpec,arrayElementValidator:_})),Array.isArray(n)&&0===n.length&&a.push(new i.V(r.key,n,"array must have at least one stop")),a},default:function(i){return eS({key:i.key,value:i.value,valueSpec:s,style:i.style,styleSpec:i.styleSpec})}}});return"identity"===l&&p&&m.push(new i.V(r.key,r.value,'missing required property "property"')),"identity"===l||o.stops||m.push(new i.V(r.key,r.value,'missing required property "stops"')),"exponential"===l&&s.expression&&!i.O(s)&&m.push(new i.V(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(p||i.Q(s)?p&&!i.S(s)&&m.push(new i.V(r.key,r.value,"zoom functions not supported")):m.push(new i.V(r.key,r.value,"property functions not supported"))),("categorical"===l||f)&&void 0===o.property&&m.push(new i.V(r.key,r.value,'"property" property is required')),m;function _(r){let a=[],n=r.value,o=r.key;if(!Array.isArray(n))return[new i.V(o,n,`array expected, ${i.M(n)} found`)];if(2!==n.length)return[new i.V(o,n,`array length 2 expected, length ${n.length} found`)];if(f){if(!i.K(n[0]))return[new i.V(o,n,`object expected, ${i.M(n[0])} found`)];let s=n[0];if(void 0===s.zoom)return[new i.V(o,n,"object stop key must have zoom")];if(void 0===s.value)return[new i.V(o,n,"object stop key must have value")];let l=i.L(s.zoom);if("number"!=typeof l)return[new i.V(o,s.zoom,"stop zoom values must be numbers")];if(c&&c>l)return[new i.V(o,s.zoom,"stop zoom values must appear in ascending order")];l!==c&&(c=l,u=void 0,d={}),a=a.concat(eI({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},style:r.style,styleSpec:r.styleSpec,objectElementValidators:{zoom:es,value:g}}))}else a=a.concat(g({key:`${o}[0]`,value:n[0],style:r.style,styleSpec:r.styleSpec},n));return i.U(i.W(n[1]))?a.concat([new i.V(`${o}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(eS({ke
7y:`${o}[1]`,value:n[1],valueSpec:s,style:r.style,styleSpec:r.styleSpec}))}function g(r,a){let n=i.M(r.value),o=i.L(r.value),c=null!==r.value?r.value:a;if(h){if(n!==h)return[new i.V(r.key,c,`${n} stop domain type must match previous stop domain type ${h}`)]}else h=n;if("number"!==n&&"string"!==n&&"boolean"!==n&&"number"!=typeof o&&"string"!=typeof o&&"boolean"!=typeof o)return[new i.V(r.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==n&&"categorical"!==l){let a=`number expected, ${n} found`;return i.Q(s)&&void 0===l&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new i.V(r.key,c,a)]}return"categorical"!==l||"number"!==n||"number"==typeof o&&isFinite(o)&&Math.floor(o)===o?"categorical"!==l&&"number"===n&&"number"==typeof o&&"number"==typeof u&&void 0!==u&&o<u?[new i.V(r.key,c,"stop domain values must appear in ascending order")]:(u=o,"categorical"===l&&o in d?[new i.V(r.key,c,"stop domain values must be unique")]:(d[o]=!0,[])):[new i.V(r.key,c,`integer expected, found ${String(o)}`)]}}function eh(r){let a=("property"===r.expressionContext?i.Y:i.X)(i.W(r.value),r.valueSpec);if("error"===a.result)return a.value.map(a=>new i.V(`${r.key}${a.key}`,r.value,a.message));let n=a.value.expression||a.value._styleExpression.expression;if("property"===r.expressionContext&&"text-font"===r.propertyKey&&!n.outputDefined())return[new i.V(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===r.expressionContext&&"layout"===r.propertyType&&!i.$(n))return[new i.V(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===r.expressionContext)return function r(a,n){let o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)o.delete(i);if(0===o.size)return[];let s=[];return a instanceof i.a0&&o.has(a.name)?[new i.V(n.key,n.value,`["${a.name}"] expression is not supported in a filter for a ${n.object.type} layer with id: ${n.object.id}`)]:(a.eachChild(i=>{s.push(...r(i,n))}),s)}(n,r);if("appearance"===r.expressionContext)return function r(a,n){let o=new Set;if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)o.add(i);if(0===o.size)return[];let s=[];return a instanceof i.a0&&!o.has(a.name)?[new i.V(n.key,n.value,`["${a.name}"] is not an allowed parameter`)]:(a.eachChild(i=>{s.push(...r(i,n))}),s)}(n,r);if(r.expressionContext&&0===r.expressionContext.indexOf("cluster")){if(!i.Z(n,["zoom","feature-state"]))return[new i.V(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===r.expressionContext&&!i._(n))return[new i.V(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function eu(r){let a=r.key,n=r.value,o=r.valueSpec,s=[];return Array.isArray(o.values)?-1===o.values.indexOf(i.L(n))&&s.push(new i.V(a,n,`expected one of [${o.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(o.values).indexOf(i.L(n))&&s.push(new i.V(a,n,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(n)} found`)),s}function ec(r){return i.a4(i.W(r.value))?eh(Object.assign({},r,{expressionContext:"filter",valueSpec:r.styleSpec[`filter_${r.layerType||"fill"}`]})):function r(a){let n=a.value,o=a.key;if(!Array.isArray(n))return[new i.V(o,n,`array expected, ${i.M(n)} found`)];if(n.length<1)return[new i.V(o,n,"filter array must have at least 1 element")];let s=a.styleSpec,l=eu({key:`${o}[0]`,value:n[0],valueSpec:s.filter_operator}),h=()=>{n.length>=2&&(i.a2(n[1])||l.push(new i.V(`${o}[1]`,n[1],`string expected, ${i.M(n[1])} found`)));for(let r=2;r<n.length;r++)"$type"===i.L(n[1])?l=l.concat(eu({key:`${o}[${r}]`,value:n[r],valueSpec:s.geometry_type})):i.a2(n[r])||i.N(n[r])||i.a1(n[r])||l.push(new i.V(`${o}[${r}]`,n[r],`string, number, or boolean expected, ${i.M(n[r])} found.`))};switch(i.L(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===i.L(n[1])&&l.push(new i.V(o,n,`"$type" cannot be use with operator "${n[0]}"`)),3!==n.length&&l.push(new i.V(o,n,`filter array for operator "${n[0]}" must have 3 elements`)),h();break;case"==":case"!=":3!==n.length&&l.push(new i.V(o,n,`filter array for operator "${n[0]}" must have 3 elements`)),h();break;case"in":case"!in":h();break;case"any":case"all":case"none":for(let i=1;i<n.length;i++)l=l.concat(r({key:`${o}[${i}]`,value:n[i],style:a.style,styleSpec:a.styleSpec}));break;case"has":case"!has":2!==n.length?l.push(new i.V(o,n,`filter array for "${n[0]}" operator must have 2 elements`)):i.a2(n[1])||l.push(new i.V(`${o}[1]`,n[1],`string expected, ${i.M(n[1])} found`))}return l}(r)}function ed(r,a){let n,o=r.key,s=r.style,l=r.layer,h=r.styleSpec,u=r.value,c=r.objectKey,d=h[`${a}_${r.layerType}`];if(!d)return[];let p=c.match(/^(.*)-use-theme$/);
7if(p&&d[p[1]])return i.U(i.W(u))?[].concat(eS({key:o,value:u,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:s,styleSpec:h,expressionContext:"property",propertyType:a,propertyKey:c})):eS({key:o,value:u,valueSpec:{type:"string"},style:s,styleSpec:h});let f=c.match(/^(.*)-transition$/);if("paint"===a&&f&&d[f[1]]&&d[f[1]].transition)return eS({key:o,value:u,valueSpec:h.transition,style:s,styleSpec:h});let m=r.valueSpec||d[c];if(!m)return[new i.a5(o,u,`unknown property "${c}"`)];if(i.a2(u)&&i.Q(m)&&!m.tokens&&(n=/^{([^}]+)}$/.exec(u))){let r=`\`{ "type": "identity", "property": ${n?JSON.stringify(n[1]):'"_"'} }\``;return[new i.V(o,u,`"${c}" does not support interpolation syntax 8Use an identity property function instead: ${r}.`)]}let _=[];if("symbol"===r.layerType)"text-field"!==c||!s||s.glyphs||s.imports||_.push(new i.V(o,u,'use of "text-field" requires a style "glyphs" property')),"text-font"===c&&i.a6(i.W(u))&&"identity"===i.L(u.type)&&_.push(new i.V(o,u,'"text-font" does not support identity functions'));else if("model"===r.layerType&&"paint"===a&&l&&l.layout&&l.layout.hasOwnProperty("model-id")&&i.Q(m)&&(i.a7(m)||i.S(m))){let r=i.Y(i.W(u),m).value,a="expression"in r&&r.expression||"_styleExpression"in r&&r._styleExpression&&r._styleExpression.expression;a&&!i.Z(a,["measure-light"])&&("model-emissive-strength"===c&&i._(a)&&i.$(a)||_.push(new i.V(o,u,`${c} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return _.concat(eS({key:r.key,value:u,valueSpec:m,style:s,styleSpec:h,expressionContext:"property",propertyType:a,propertyKey:c}))}function ep(i){return ed(i,"paint")}function ef(i){return ed(i,"layout")}function em(r){let a=[],n=r.value,o=r.key,s=r.style,l=r.styleSpec;if(!i.K(n))return[new i.V(o,n,"object expected")];n.type||n.ref||a.push(new i.V(o,n,'either "type" or "ref" is required'));let h=i.L(n.type),u=i.L(n.ref);if(n.id){let l=i.L(n.id);for(let h=0;h<r.arrayIndex;h++){let r=s.layers[h];i.L(r.id)===l&&a.push(new i.V(o,n.id,`duplicate layer id "${l}", previously used at line ${r.id.__line__}`))}}if("ref"in n){let r;["type","source","source-layer","filter","layout"].forEach(r=>{r in n&&a.push(new i.V(o,n[r],`"${r}" is prohibited for ref layers`))}),s.layers.forEach(a=>{i.L(a.id)===u&&(r=a)}),r?r.ref?a.push(new i.V(o,n.ref,"ref cannot reference another ref layer")):h=i.L(r.type):"string"==typeof u&&a.push(new i.V(o,n.ref,`ref layer "${u}" not found`))}else if("background"!==h&&"sky"!==h&&"slot"!==h)if(n.source)if(i.a2(n.source)){let r=s.sources&&s.sources[n.source],l=r&&i.L(r.type);r?"vector"===l&&"raster"===h?a.push(new i.V(o,n.source,`layer "${n.id}" requires a raster source`)):"raster"===l&&"raster"!==h?a.push(new i.V(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==l||n["source-layer"]?"raster-dem"===l&&"hillshade"!==h?a.push(new i.V(o,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==l||["raster","raster-particle"].includes(h)?"line"===h&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&"geojson"===l&&!r.lineMetrics?a.push(new i.V(o,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"raster-particle"===h&&"raster-array"!==l&&a.push(new i.V(o,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):a.push(new i.V(o,n.source,"raster-array source can only be used with layer type 'raster'.")):a.push(new i.V(o,n,`layer "${n.id}" must specify a "source-layer"`)):a.push(new i.V(o,n.source,`source "${n.source}" not found`))}else a.push(new i.V(`${o}.source`,n.source,'"source" must be a string'));else a.push(new i.V(o,n,'missing required property "source"'));return a=a.concat(eI({key:o,value:n,valueSpec:l.layer,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{"*":()=>[],type:()=>eS({key:`${o}.type`,value:n.type,valueSpec:l.layer.type,style:r.style,styleSpec:r.styleSpec,object:n,objectKey:"type"}),filter:i=>ec(Object.assign({layerType:h},i)),layout:i=>eI({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>ef(Object.assign({layerType:h},i))}}),paint:i=>eI({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>ep(Object.assign({layerType:h,layer:n},i))}}),appearances(r){let a=eo({key:r.key,value:r.value,valueSpec:r.valueSpec,style:r.style,styleSpec:r.styleSpec,arrayElementValidator:r=>(function(r){let{key:a,layer:n,layerType:o}=r,s=i.L(r.value),l=i.L(s.name),h=i.L(s.condition),u=eI({key:a,value:s,valueSpec:r.styleSpec.appearance,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{condition:r=>{var a;let s;return a=Object.assign({layer:n,layerType:o},r),(s=[]).push(...eh({key:a.key,value:a.object.condition,valueSpec:i.a8.appearance.condition,expressionContext:"appearance"})),s},properties:r=>(function(r){let a=[],{styleSpec:n,layer:o,layerType:s}=r,l=n[`paint_${s}`],h=n[`layout_${s}`],u=r.object[r.objectKey];for(let n in u){let c=n in l?"paint":n in h?"layout":void 0;if(!c){a.push(new i.V(r.key,n,`unknown property "${n}" for layer type "${s}"`));continue}let d=Object.assign({},r,{key:`${r.key}.${n}`,object:u,objectKey:n,layer:o,layerType:s,value:u[n],valueSpec:"paint"===c?l[n]:h[n]});a.push(...ed(d,c))}return a})(Object.assign({layer:n,layerType:o},r))}});return"hidden"!==l&&void 0===h&&u.push(new i.V(r.key,"name",'Appearance with name different than "hidden" must have a condition')),u})(Object.assign({layerType:h,layer:n},r))}),o=Array.isArray(r.value)?r.value:[],s=new Set;return o.forEach((o,l)=>{let h=i.L(o.name);if(h)if(s.has(h)){let o=i.L(n.id);a.push(new i.V(r.key,h,`Duplicated appearance name "${h}" for layer "${o}"`))}else s.add(h)}),a}}}))}function e_({key:r,value:a}){return i.a2(a)?[]:[new i.V(r,a,`string expected, ${i.M(a)} found`)]}let eg={promoteId:function r({key:a,value:n}){if(i.a2(n))return e_({key:a,value:n});if(Array.isArray(n)){let r=[],o=i.W(n),s=i.X(o);return"error"===s.result?s.value.forEach(n=>{r.push(new i.V(`${a}${n.key}`,null,`${n.message}`))}):i.Z(s.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||r.push(new i.V(`${a}`,null,"promoteId expression should be only feature dependent")),r}if(!i.K(n))return[new i.V(a,n,`string, expression or object expected, "${i.M(n)}" found`)];let o=[];for(let i in n)o.push(...r({key:`${a}.${i}`,value:n[i]}));return o}};function ey(r){let a=r.value,n=r.key,o=r.styleSpec,s=r.style;
8if(!i.K(a))return[new i.V(n,a,`object expected, ${i.M(a)} found`)];if(!("type"in a))return[new i.V(n,a,'"type" is required')];let l=i.L(a.type),h=[];switch(["vector","raster","raster-dem","raster-array"].includes(l)&&("url"in a||"tiles"in a||h.push(new i.a5(n,a,'Either "url" or "tiles" is required.'))),l){case"vector":case"raster":case"raster-dem":case"raster-array":return h.concat(eI({key:n,value:a,valueSpec:o[`source_${l.replace("-","_")}`],style:r.style,styleSpec:o,objectElementValidators:eg}));case"geojson":if(h=eI({key:n,value:a,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:eg}),"cluster"in a&&"clusterProperties"in a){if(!i.K(a.clusterProperties))return[new i.V(`${n}.clusterProperties`,a,`object expected, ${i.M(a)} found`)];for(let r in a.clusterProperties){let o=a.clusterProperties[r];if(!Array.isArray(o))return[new i.V(`${n}.clusterProperties.${r}`,o,"array expected")];let[s,l]=o,u="string"==typeof s?[s,["accumulated"],["get",r]]:s;h.push(...eh({key:`${n}.${r}.map`,value:l,expressionContext:"cluster-map"})),h.push(...eh({key:`${n}.${r}.reduce`,value:u,expressionContext:"cluster-reduce"}))}}return h;case"video":return eI({key:n,value:a,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return eI({key:n,value:a,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new i.V(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:var u;return eu({key:`${n}.type`,value:a.type,valueSpec:{values:(u=o).source.reduce((i,r)=>{let a=u[r];return"enum"===a.type.type&&(i=i.concat(Object.keys(a.type.values||{}))),i},[])}})}}function ex(r){let a=r.value,n=r.styleSpec,o=n.light,s=r.style;if(void 0===a)return[];if(!i.K(a))return[new i.V("light",a,`object expected, ${i.M(a)} found`)];let l=[];for(let r in a){let h=r.match(/^(.*)-transition$/),u=r.match(/^(.*)-use-theme$/);l=l.concat(u&&o[u[1]]?eS({key:r,value:a[r],valueSpec:{type:"string"},style:s,styleSpec:n}):h&&o[h[1]]&&o[h[1]].transition?eS({key:r,value:a[r],valueSpec:n.transition,style:s,styleSpec:n}):o[r]?eS({key:r,value:a[r],valueSpec:o[r],style:s,styleSpec:n}):[new i.V(r,a[r],`unknown property "${r}"`)])}return l}function ev(r){let a=r.value;if(!a)return[];let n=r.key;if(!i.K(a))return[new i.V(n,a,`object expected, ${i.M(a)} found`)];let o=[],s=r.styleSpec,l=s["light-3d"],h=r.style,u=r.style.lights;for(let r of["type","id"])if(!(r in a))return o.concat([new i.V(n,a,`missing property "${r}"`)]);if(!i.a2(a.type))return o.concat([new i.V(`${n}.type`,a.type,"string expected")]);if(u)for(let s=0;s<r.arrayIndex;s++){let r=i.L(a.type),l=u[s];i.L(l.type)===r&&o.push(new i.V(n,a.id,`duplicate light type "${a.type}", previously defined at line ${l.id.__line__}`))}let c=`properties_light_${a.type}`;if(!(c in s))return o.concat([new i.V(`${n}.type`,a,`Invalid light type ${a.type}`)]);let d=s[c];for(let n in a)if("properties"===n){let l=a[n];if(!i.K(l))return o.concat([new i.V("properties",l,`object expected, ${i.M(l)} found`)]);for(let u in l){let c=u.match(/^(.*)-transition$/),p=u.match(/^(.*)-use-theme$/);o=o.concat(p&&d[p[1]]?eS({key:n,value:l[u],valueSpec:{type:"string"},style:h,styleSpec:s}):c&&d[c[1]]&&d[c[1]].transition?eS({key:n,value:a[n],valueSpec:s.transition,style:h,styleSpec:s}):d[u]?eS({key:u,value:l[u],valueSpec:d[u],style:h,styleSpec:s}):[new i.a5(r.key,l[u],`unknown property "${u}"`)])}}else o=o.concat(l[n]?eS({key:n,value:a[n],valueSpec:l[n],style:h,styleSpec:s}):[new i.a5(n,a[n],`unknown property "${n}"`)]);return o}function eb(r){let a=r.value,n=r.key,o=r.style,s=r.styleSpec,l=s.terrain;if(null==a)return[];if(!i.K(a))return[new i.V("terrain",a,`object expected, ${i.M(a)} found`)];let h=[];for(let r in a){let n=r.match(/^(.*)-transition$/),u=r.match(/^(.*)-use-theme$/);h=h.concat(u&&l[u[1]]?eS({key:r,value:a[r],valueSpec:{type:"string"},style:o,styleSpec:s}):n&&l[n[1]]&&l[n[1]].transition?eS({key:r,value:a[r],valueSpec:s.transition,style:o,styleSpec:s}):l[r]?eS({key:r,value:a[r],valueSpec:l[r],style:o,styleSpec:s}):[new i.a5(r,a[r],`unknown property "${r}"`)])}if(a.source)if(i.a2(a.source)){let r=o.sources&&o.sources[a.source],s=r&&i.L(r.type);r?"raster-dem"!==s&&h.push(new i.V(`${n}.source`,a.source,`terrain cannot be used with a source of type ${s}, it only be used with a "raster-dem" source type`)):h.push(new i.V(`${n}.source`,a.source,`source "${a.source}" not found`))}else h.push(new i.V(`${n}.source`,a.source,"source must be a string"));else h.push(new i.V(n,a,'terrain is missing required property "source"'));return h}function ew(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.fog;if(void 0===a)return[];
8if(!i.K(a))return[new i.V("fog",a,`object expected, ${i.M(a)} found`)];let l=[];for(let r in a){let h=r.match(/^(.*)-transition$/),u=r.match(/^(.*)-use-theme$/);l=l.concat(u&&s[u[1]]?eS({key:r,value:a[r],valueSpec:{type:"string"},style:n,styleSpec:o}):h&&s[h[1]]&&s[h[1]].transition?eS({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?eS({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new i.a5(r,a[r],`unknown property "${r}"`)])}return l}let eT={"*":()=>[],array:eo,boolean:function(r){let a=r.value,n=r.key;return i.a1(a)?[]:[new i.V(n,a,`boolean expected, ${i.M(a)} found`)]},number:es,color:function({key:r,value:a}){return i.a2(a)?null===i.a3.parseCSSColor(a)?[new i.V(r,a,`color expected, "${a}" found`)]:[]:[new i.V(r,a,`color expected, ${i.M(a)} found`)]},enum:eu,filter:ec,function:el,layer:em,object:eI,source:ey,model:i.a9,light:ex,"light-3d":ev,terrain:eb,fog:ew,string:e_,formatted:function(i){return 0===e_(i).length?[]:eh(i)},resolvedImage:function(i){return 0===e_(i).length?[]:eh(i)},projection:function(r){let a=r.value,n=r.styleSpec,o=n.projection,s=r.style;if(i.K(a)){let i=[];for(let r in a)i=i.concat(eS({key:r,value:a[r],valueSpec:o[r],style:s,styleSpec:n}));return i}return i.a2(a)?[]:[new i.V("projection",a,`object or string expected, ${i.M(a)} found`)]},import:function(r){let a=r.key,{value:n,styleSpec:o}=r;if(!i.K(n))return[new i.V(a,n,"import must be an object")];let{data:s,...l}=n;Object.defineProperty(l,"__line__",{value:n.__line__,enumerable:!1});let h=eI(Object.assign({},r,{value:l,valueSpec:o.import}));return""===i.L(l.id)&&h.push(new i.V(`${r.key}.id`,l,"import id can't be an empty string")),s&&(h=h.concat(eA(s,o,{key:`${r.key}.data`}))),h},iconset:function(r){let a=r.value,n=r.key,o=r.styleSpec,s=r.style;if(!i.K(a))return[new i.V(n,a,"object expected")];if(!a.type)return[new i.V(n,a,'"type" is required')];let l=i.L(a.type),h=[];if(h=h.concat(eI({key:n,value:a,valueSpec:o[`iconset_${l}`],style:s,styleSpec:o})),!("source"!==l||!a.source)){let r=s.sources&&s.sources[a.source],o=r&&i.L(r.type);r?"raster-array"!==o&&h.push(new i.V(n,a.source,`iconset cannot be used with a source of type ${String(o)}, it only be used with a "raster-array" source type`)):h.push(new i.V(n,a.source,`source "${a.source}" not found`))}return h}};function eS(r,a=!1){let n=r.value,o=r.valueSpec,s=r.styleSpec;if(o.expression){if(i.a6(i.L(n)))return el(r);if(i.U(i.W(n)))return eh(r)}if(o.type&&eT[o.type]){let i=eT[o.type](r);return!0===a&&i.length>0&&Array.isArray(r.value)?eh(r):i}return eI(Object.assign({},r,{valueSpec:o.type?s[o.type]:o}))}function eI(r){let a=r.key,n=r.value,o=r.valueSpec||{},s=r.objectElementValidators||{},l=r.style,h=r.styleSpec;if(!i.K(n))return[new i.V(a,n,`object expected, ${i.M(n)} found`)];let u=[];for(let r in n){let c,d=r.split(".")[0];s[d]?c=s[d]:o[d]?c=eS:s["*"]?c=s["*"]:o["*"]&&(c=eS),c?u=u.concat(c({key:(a?`${a}.`:a)+r,value:n[r],valueSpec:o[d]||o["*"],style:l,styleSpec:h,object:n,objectKey:r},n)):u.push(new i.a5(a,n[r],`unknown property "${r}"`))}for(let r in o){if(s[r])continue;let l=o[r];l.required&&void 0===l.default&&void 0===n[r]&&u.push(new i.V(a,n,`missing required property "${r}"`))}return u}function eE({key:r,value:a}){let n=e_({key:r,value:a});return n.length||(-1===a.indexOf("{fontstack}")&&n.push(new i.V(r,a,'"glyphs" url must include a "{fontstack}" token')),-1===a.indexOf("{range}")&&n.push(new i.V(r,a,'"glyphs" url must include a "{range}" token'))),n}function eA(r,a=i.a8,n={}){return eI({key:n.key||"",value:r,valueSpec:Object.assign(a.$root,{"*":{type:"*"}}),styleSpec:a,style:r,objectElementValidators:{glyphs:eE}})}function eC(r,a=i.a8){return eU(eA(r,a))}let eM=i=>eU(ey(i)),eP=i=>eU(ex(i)),eD=i=>eU(ev(i)),eR=i=>eU(eb(i)),eL=i=>eU(ew(i)),ez=r=>eU(function(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.snow;if(void 0===a)return[];if(!i.K(a))return[new i.V("snow",a,`object expected, ${i.M(a)} found`)];let l=[];for(let r in a){let h=r.match(/^(.*)-transition$/);l=l.concat(h&&s[h[1]]&&s[h[1]].transition?eS({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?eS({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new i.a5(r,a[r],`unknown property "${r}"`)])}return l}(r)),eF=r=>eU(function(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.rain;if(void 0===a)return[];
8if(!i.K(a))return[new i.V("rain",a,`object expected, ${i.M(a)} found`)];let l=[];for(let r in a){let h=r.match(/^(.*)-transition$/);l=l.concat(h&&s[h[1]]&&s[h[1]].transition?eS({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?eS({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new i.a5(r,a[r],`unknown property "${r}"`)])}return l}(r)),eO=i=>eU(em(i)),eB=i=>eU(ec(i)),ek=i=>eU(ep(i)),eV=i=>eU(ef(i)),eN=r=>eU(i.a9(r));function eU(i){return i.slice().sort((i,r)=>i.line&&r.line?i.line-r.line:0)}function ej(r,a){let n=!1;if(a&&a.length)for(let o of a)o instanceof i.a5?i.w(o.message):(r.fire(new i.B(Error(o.message))),n=!0);return n}let eG=i.a8.light;class eq extends i.E{constructor(r,a="flat"){super(),this._transitionable=new i.aa(o||(o=new i.ab({anchor:new i.ac(eG.anchor),position:new i.ad(eG.position),color:new i.ac(eG.color),intensity:new i.ac(eG.intensity)}))),this.setLight(r,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(i,r,a={}){this._validate(eP,i,a)||(this._transitionable.setTransitionOrValue(i),this.id=r)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&ej(this,r.call(eC,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.a8})))}}let e$=i.a8.terrain,eH=class extends i.E{constructor(r,a,n,o,s){super(),this.scope=n,this._transitionable=new i.aa(new i.ab({source:new i.ac(e$.source),exaggeration:new i.ac(e$.exaggeration)}),n,o),this._transitionable.setTransitionOrValue(r,o),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=a,this.worldview=s}get(){return this._transitionable.serialize()}set(i,r){this._transitionable.setTransitionOrValue(i,r)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}getExaggeration(r){return this._transitioning.possiblyEvaluate(new i.ae(r,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;let r=this._transitionable._values.exaggeration;if(!r)return null;let a=r.value.expression;if(!a)return null;let n=-1,o=-1,s=1;for(let r of a.zoomStops)(s=a.evaluate(new i.ae(r,{worldview:this.worldview})))>.01?(n=r,o=-1):o=r;return s<.01&&n>0&&o>n?[n,o]:null}isZoomDependent(){let r=this._transitionable._values.exaggeration;return null!=r&&null!=r.value&&null!=r.value.expression&&r.value.expression instanceof i.af}};function eZ(r,a,n,o){let s=i.aj(45,65,n),[l,h]=eW(r,o),u=1-Math.min(1,Math.exp(-((a-l)/(h-l)*6)));return u*=u*u,(u=Math.min(1,1.00747*u))*s*r.alpha}function eW(i,r){let a=.5/Math.tan(.5*r);return[i.range[0]+a,i.range[1]+a]}function eX(r,a,n,o,s){let l=i.ah([],[a,n,o],s.mercatorFogMatrix);return eZ(r,i.ai(l),s.pitch,s._fov)}function eY(r,a,n,o,s,l,h){let u=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let r of[[n,o,0],[s,o,0],[s,l,0],[n,l,0]]){let n=i.ah([],r,a),o=i.ai(n);u=Math.min(u,o),c=Math.max(c,o)}return[eZ(r,u,h.pitch,h._fov),eZ(r,c,h.pitch,h._fov)]}let eK=i.a8.fog;class eJ extends i.E{constructor(r,a,n,o){super();const s=new i.ab({range:new i.ac(eK.range),color:new i.ac(eK.color),"color-use-theme":new i.ac({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.ac(eK["high-color"]),"high-color-use-theme":new i.ac({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.ac(eK["space-color"]),"space-color-use-theme":new i.ac({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.ac(eK["horizon-blend"]),"star-intensity":new i.ac(eK["star-intensity"]),"vertical-range":new i.ac(eK["vertical-range"])});this._transitionable=new i.aa(s,n,new Map(o)),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this._transform=a,this.properties=new i.ak(s),this.scope=n}get state(){let r=this._transform,a="globe"===r.projection.name,n=i.al(r.zoom),o=this.properties.get("range");return{range:a?[i.am(.5,o[0],n),i.am(3,o[1],n)]:o,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,r,a={}
8){if(this._validate(eL,i,a))return;let n=Object.assign({},i);for(let i of Object.keys(eK))void 0===n[i]&&(n[i]=eK[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;let a=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:i.aj(45,65,r))*a.a}getOpacityAtLatLng(r,a){var n;let o,s;return this._transform.projection.supportsFog?(n=this.state,o=i.ag.fromLngLat(r),s=a.elevation?a.elevation.getAtPointOrZero(o):0,eX(n,o.x,o.y,s,a)):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];let a=this._transform.calculateFogTileMatrix(r.toUnwrapped());return eY(this.state,a,0,0,i.an,i.an,this._transform)}getOpacityForBounds(i,r,a,n,o){return this._transform.projection.supportsFog?eY(this.state,i,r,a,n,o,this._transform):[1,1]}getFovAdjustedRange(i){return this._transform.projection.supportsFog?eW(this.state,i):[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;for(let a of[4,5,6,7]){let n,o=r.points[a];if(o[2]>=0)n=o;else{let s=r.points[a-4];n=i.ao(s,o,s[2]/(s[2]-o[2]))}if(eX(this.state,n[0],n[1],0,this._transform)>=.05)return!0}return!1}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,new Map(i))}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&ej(this,r.call(eC,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.a8})))}}let eQ,e0,e1,e2=class extends i.E{constructor(r,a,n,o){super();const s=eQ||(eQ=new i.ab({density:new i.ac(i.a8.snow.density),intensity:new i.ac(i.a8.snow.intensity),color:new i.ac(i.a8.snow.color),opacity:new i.ac(i.a8.snow.opacity),vignette:new i.ac(i.a8.snow.vignette),"vignette-color":new i.ac(i.a8.snow["vignette-color"]),"center-thinning":new i.ac(i.a8.snow["center-thinning"]),direction:new i.ac(i.a8.snow.direction),"flake-size":new i.ac(i.a8.snow["flake-size"])}));this._transitionable=new i.aa(s,n,new Map(o)),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ak(s),this.scope=n}get state(){let r=this.properties.get("opacity"),a=this.properties.get("color"),n=this.properties.get("direction"),o=i.ap(n[0]),s=-Math.max(i.ap(n[1]),.01),l=[Math.cos(o)*Math.cos(s),Math.sin(o)*Math.cos(s),Math.sin(s)],h=this.properties.get("vignette"),u=this.properties.get("vignette-color");return u.a=h,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.aq(a.r,a.g,a.b,a.a*r),direction:l,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:u}}get(){return this._transitionable.serialize()}set(r,a,n={}){if(this._validate(ez,r,n))return;let o=Object.assign({},r),s=i.a8.snow;for(let i of Object.keys(s))void 0===o[i]&&(o[i]=s[i].default);this._options=o,this._transitionable.setTransitionOrValue(this._options,a)}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,new Map(i))}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&ej(this,r.call(eC,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.a8})))}},e3=class extends i.E{constructor(r,a,n,o){super();const s=e0||(e0=new i.ab({density:new i.ac(i.a8.rain.density),intensity:new i.ac(i.a8.rain.intensity),color:new i.ac(i.a8.rain.color),opacity:new i.ac(i.a8.rain.opacity),vignette:new i.ac(i.a8.rain.vignette),"vignette-color":new i.ac(i.a8.rain["vignette-color"]),"center-thinning":new i.ac(i.a8.rain["center-thinning"]),direction:new i.ac(i.a8.rain.direction),"droplet-size":new i.ac(i.a8.rain["droplet-size"]),"distortion-strength":new i.ac(i.a8.rain["distortion-strength"])}));this._transitionable=new i.aa(s,n,new Map(o)),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ak(s),this.scope=n}get state(){let r=this.properties.get("opacity"),a=this.properties.get("color"),n=this.properties.get("direction"),o=i.ap(n[0]),s=-Math.max(i.ap(n[1]),.01),l=[Math.cos(o)*Math.cos(s),Math.sin(o)*Math.cos(s),Math.sin(s)],h=this.properties.get("vignette-color");return h.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.aq(a.r,a.g,a.b,a.a*r),direction:l,centerThinning:this.properties.get("center-thinning"),droplet
8Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:h}}get(){return this._transitionable.serialize()}set(r,a,n={}){if(this._validate(eF,r,n))return;let o=Object.assign({},r),s=i.a8.rain;for(let i of Object.keys(s))void 0===o[i]&&(o[i]=s[i].default);this._options=o,this._transitionable.setTransitionOrValue(this._options,a)}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,new Map(i))}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&ej(this,r.call(eC,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.a8})))}};class e5 extends i.E{constructor(r,a,n,o){super(),this.scope=n,this._options=r,this.properties=new i.ak(a),this._transitionable=new i.aa(a,n,new Map(o)),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(i){this._transitionable.setTransitionOrValue(this._options.properties,new Map(i))}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(i,r){this._options=i,this._transitionable.setTransitionOrValue(i.properties,r)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}let e4=()=>e1||(e1=new i.ab({color:new i.ac(i.a8.properties_light_ambient.color),"color-use-theme":new i.ac({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.ac(i.a8.properties_light_ambient.intensity)})),e6=()=>s||(s=new i.ab({direction:new i.ar(i.a8.properties_light_directional.direction),color:new i.ac(i.a8.properties_light_directional.color),"color-use-theme":new i.ac({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.ac(i.a8.properties_light_directional.intensity),"cast-shadows":new i.ac(i.a8.properties_light_directional["cast-shadows"]),"shadow-quality":new i.ac(i.a8.properties_light_directional["shadow-quality"]),"shadow-intensity":new i.ac(i.a8.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new i.ac(i.a8.properties_light_directional["shadow-draw-before-layer"])}));class e8{constructor(i,r,a){this.screenBounds=i,this.cameraPoint=a.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(r,a){let n,o;if(r instanceof i.P||"number"==typeof r[0]){let s=i.P.convert(r);n=[s],o=a.isPointAboveHorizon(s)}else{let s=i.P.convert(r[0]),l=i.P.convert(r[1]),h=s.add(l)._div(2);n=[s,l],o=i.as(s,l).every(i=>a.isPointAboveHorizon(i))&&a.isPointAboveHorizon(h)}return new e8(n,o,a)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.as(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){let a=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],o=i.as(a,n,0,!1);return this.cameraPoint.y>n.y&&(this.cameraPoint.x>a.x&&this.cameraPoint.x<n.x?o.splice(3,0,this.cameraPoint):this.cameraPoint.x>=n.x?o[2]=this.cameraPoint:this.cameraPoint.x<=a.x&&(o[3]=this.cameraPoint)),i.at(o,r)}bufferedCameraGeometryGlobe(r){let a=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],o=i.as(a,n,r),s=this.cameraPoint.clone(),l=Number(s.x>a.x)+Number(s.x>n.x);switch(3*(Number(s.y>a.y)+Number(s.y>n.y))+l){case 0:o[0]=s,o[4]=s.clone();break;case 1:o.splice(1,0,s);break;case 2:o[1]=s;break;case 3:o.splice(4,0,s);break;case 5:o.splice(2,0,s);break;case 6:o[3]=s;break;case 7:o.splice(3,0,s);break;case 8:o[2]=s}return o}containsTile(r,a,n,o=0){var s;let l=Math.max(r.queryPadding,r.evaluateQueryRenderedFeaturePadding())/a._pixelsPerMercatorPixel+1,h=n?this._bufferedCameraMercator(l,a):this._bufferedScreenMercator(l,a),u=r.tileID.wrap+(h.unwrapped?o:0),c=h.polygon.map(a=>i.au(r.tileTransform,a,u));if(!i.av(c,0,0,i.an,i.an))return;u=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?o:0);let d=this.screenGeometryMercator.polygon.map(a=>i.aw(r.tileTransform,a,u)),p=d.map(r=>new i.P(r[0],r[1])),f=a.getFreeCameraOptions().position||new i.ag(0,0,0),m=i.aw(r.tileTransform,f,u),_=d.map(r=>{let a=i.ax(r,r,m);return i.ay(a,a),new i.az(m,a)}),g=i.aA(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:p,tilespaceRays:_,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.aB(c)).min.x=i.aC(s.min.x,0,i.an),s.min.y=i.aC(s.min.y,0,i.an),s.max.x=i.aC(s.max.x,
80,i.an),s.max.y=i.aC(s.max.y,0,i.an),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:g}}_bufferedScreenMercator(i,r){let a=100*i|0;if(this._screenRaycastCache[a])return this._screenRaycastCache[a];{let n;return n="globe"===r.projection.name?this._projectAndResample(this.bufferedScreenGeometry(i),r):{polygon:this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._screenRaycastCache[a]=n,n}}_bufferedCameraMercator(i,r){let a=100*i|0;if(this._cameraRaycastCache[a])return this._cameraRaycastCache[a];{let n;return n="globe"===r.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(i),r):{polygon:this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._cameraRaycastCache[a]=n,n}}_projectAndResample(r,a){let n=function(r,a){let n=i.aD([],a.pixelMatrix,a.globeMatrix),o=[0,-i.aF,0,1],s=[0,i.aF,0,1],l=[0,0,0,1];i.aE(o,o,n),i.aE(s,s,n),i.aE(l,l,n);let h=new i.P(o[0]/o[3],o[1]/o[3]),u=new i.P(s[0]/s[3],s[1]/s[3]),c=i.aG(r,h)&&o[3]<l[3],d=i.aG(r,u)&&s[3]<l[3];if(!c&&!d)return null;let p=function(i,r,a){for(let n=1;n<i.length;n++){let o=e7(r.pointCoordinate3D(i[n-1]).x),s=e7(r.pointCoordinate3D(i[n]).x);if(a<0){if(o<s)return{idx:n,t:-o/(s-1-o)}}else if(s<o)return{idx:n,t:(1-o)/(s+1-o)}}return null}(r,a,c?-1:1);if(!p)return null;let{idx:f,t:m}=p,_=f>1?e9(r.slice(0,f),a):[],g=f<r.length?e9(r.slice(f),a):[];_=_.map(r=>new i.P(e7(r.x),r.y)),g=g.map(r=>new i.P(e7(r.x),r.y));let y=[..._];0===y.length&&y.push(g[g.length-1]);let x=i.am(y[y.length-1].y,(0===g.length?_[0]:g[0]).y,m);return y.push(...c?[new i.P(0,x),new i.P(0,0),new i.P(1,0),new i.P(1,x)]:[new i.P(1,x),new i.P(1,1),new i.P(0,1),new i.P(0,x)]),0===g.length?y.push(_[0]):y.push(...g),{polygon:y.map(r=>new i.ag(r.x,r.y)),unwrapped:!1}}(r,a);if(n)return n;let o=function(r,a){let n=!1,o=-1/0,s=0;for(let i=0;i<r.length-1;i++)r[i].x>o&&(o=r[i].x,s=i);for(let i=0;i<r.length-1;i++){let a=(s+i)%(r.length-1),o=r[a],l=r[a+1];Math.abs(o.x-l.x)>.5&&(o.x<l.x?(o.x+=1,0===a&&(r[r.length-1].x+=1)):(l.x+=1,a+1===r.length-1&&(r[0].x+=1)),n=!0)}let l=i.aH(a.center.lng);return n&&l<Math.abs(l-1)&&r.forEach(i=>{i.x-=1}),{polygon:r,unwrapped:n}}(e9(r,a).map(r=>new i.P(e7(r.x),r.y)),a);return{polygon:o.polygon.map(r=>new i.ag(r.x,r.y)),unwrapped:o.unwrapped}}}function e9(r,a){return i.aI(r,i=>{let r=a.pointCoordinate3D(i);i.x=r.x,i.y=r.y},1/256)}function e7(i){return i<0?1+i%1:i%1}function te(r,a,n){try{a=function(i){if(!i.variants)return i;if(!Array.isArray(i.variants))throw Error("variants must be an array");for(let r of i.variants){if(null==r||"object"!=typeof r||r.constructor!==Object)throw Error("variant must be an object");if(!Array.isArray(r.capabilities))throw Error("capabilities must be an array");if(1===r.capabilities.length&&"meshopt"===r.capabilities[0])return Object.assign(i,r)}return i}(a)}catch(i){return Error("Failed to process TileJSON variants",{cause:i})}let o=i.aJ(Object.assign({},a,r),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);return r.url&&a.tiles&&r.tiles&&(o.tiles=a.tiles),o.tiles=n.canonicalizeTileset(o,r.url),o}function tt(r,a,n,o,s){let l=function(i,n){if(i)return s(i);if(n){r.url&&n.tiles&&r.tiles&&delete r.tiles;let i=te(r,n,a);if(i instanceof Error)return s(i);s(null,i)}},h=function(i,r,a){if(!i)return null;if(!r&&!a)return i;a=a||i.worldview_default;let n=Object.values(i.language||{});if(0===n.length)return null;let o=Object.values(i.worldview||{});if(0===o.length)return null;let s=n.every(i=>i===r),l=o.every(i=>i===a);return s&&l?i:r in(i.language_options||{})||a in(i.worldview_options||{})?null:i.language_options&&i.worldview_options?i:null}(r.data,n,o);return h?i.o.frame(()=>l(null,h)):r.url?i.m(a.transformRequest(a.normalizeSourceURL(r.url,null,n,o),i.R.Source),l):i.o.frame(()=>{let{data:i,...a}=r;l(null,a)})}function ti(r,a){let n=Math.pow(2,a.z),o=Math.floor(i.aH(r.getWest())*n),s=Math.floor(i.aL(r.getNorth())*n),l=Math.ceil(i.aH(r.getEast())*n),h=Math.ceil(i.aL(r.getSouth())*n);return a.x>=o&&a.x<l&&a.y>=s&&a.y<h}class tr{constructor(r,a,n){this.bounds=r?i.aK.convert(this.validateBounds(r)):null,this.minzoom=a||0,this.maxzoom=n||24}
8validateBounds(i){return Array.isArray(i)&&4===i.length?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}addExtraBounds(r){if(r)for(let a of(this.extraBounds||(this.extraBounds=[]),r))this.extraBounds.push(i.aK.convert(this.validateBounds(a)))}contains(i){if(i.z>this.maxzoom||i.z<this.minzoom||this.bounds&&!ti(this.bounds,i))return!1;if(!this.extraBounds)return!0;for(let r of this.extraBounds)if(ti(r,i))return!0;return!1}static fromTileJSON(i){if(!i.bounds&&!i.extra_bounds)return null;let r=new tr(i.bounds,i.minzoom,i.maxzoom);return r.addExtraBounds(i.extra_bounds),r}}class ta extends i.E{constructor(r,a,n,o){if(super(),this.id=r,this.dispatcher=n,this.type="vector",this.provider=a.provider,this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,i.aJ(a,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},a),this._collectResourceTiming=!!a.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o),this._tileWorkers={},this._deduped=new i.aN}load(r){this._loaded=!1,this.fire(new i.C("dataloading",{dataType:"source"}));let a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview(),o=(o,s)=>{this._tileJSONRequest=null,this._loaded=!0,o?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),n&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new i.B(o))):s&&(this._setTileJSON(s),k(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.C("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)};this.provider=this._options.provider;let s=function(r){let a;if("provider"in r&&!r.provider)return null;let n=r.provider;if(!n&&"url"in r&&r.url&&(n=i.aM(r.url)),!n)return null;let o=i.e.TILE_PROVIDER_URLS[n];if(!o)return null;try{a=new URL(o,i.e.API_URL).href}catch(r){return i.w(`TileProvider "${n}" has an invalid URL: "${o}"`),null}return{name:n,url:a}}(this._options);this.provider&&!s?(this._loaded=!0,this.fire(new i.B(Error(`TileProvider "${this.provider}" is not registered`))),r&&r()):this._tileJSONRequest=s?this._loadWithProvider(s,o):tt(this._options,this.map._requestManager,a,n,o)}_loadWithProvider(r,a){this.provider=r.name;let n=new AbortController,o=this._options.url&&!this._options.tiles?this.map._requestManager.transformRequest(this._options.url,i.R.Source):void 0,s=o?Object.assign({},this._options,{url:o.url}):this._options;return this.dispatcher.broadcast("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.type,options:s,request:o},(i,r)=>{if(n.signal.aborted)return;if(i)return void a(i);let o=r?r.find(i=>null!=i):null;if(o){let i=te(this._options,o,this.map._requestManager);i instanceof Error?a(i):a(null,i)}else a(null,{tiles:this._options.tiles})}),{cancel:()=>{n.abort()}}}_setTileJSON(i){if(Object.assign(this,i),this.hasWorldviews=!!i.worldview_options,i.worldview_default&&(this.worldviewDefault=i.worldview_default),i.vector_layers)for(let r of(this.vectorLayers=i.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set,i.vector_layers))this.vectorLayerIds.push(r.id),i.worldview&&i.worldview[r.source]&&this.localizableLayerIds.add(r.id);this.tileBounds=tr.fromTileJSON(i)}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.F(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(i){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(r,a){let n=r.tileID.canonical.url(this.tiles,this.scheme),o=this.map._requestManager.normalizeTileURL(n),s=this.map._requestManager.transformRequest(o,i.R.Tile),l=this.map.style?this.map.style.getLut(this.scope):null,h=l?{image:l.image.clone()}:null,u={request:s,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,lut:h,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,renderSourceType:r.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.getIndoorTileOptions(this.id,this.scope)};if(this.hasWorldviews&&i.h(n)&&(u.localizableLayerIds=this.localizableLayerIds),u.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=a:r.request=r.actor.send("reloadTile",u,c.bind(this));else if(r.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready||this.provider)r.request=r.actor.send("loadTile",u,c.bind(this),void 0,!0);else{let a=i.aO.call({deduped:this._deduped},u,(a,n)=>{if(a||!n)c.call(this,a);else{let a=i.aP(n.responseHeaders);u.data={rawData:n.rawData.slice(0),expires:a.expires,cacheControl:a.cacheControl},r.actor&&r.actor.send("loadTile",u,c.bind(this),void 0,!0)}},!0);r.request={cancel:a}}function c(n,o){return delete r.request,r.aborted?a(null):n?a(n):(o&&o.resourceTiming&&(r.resourceTiming=o.resourceTiming),this.map._refreshExpiredTiles&&o&&r.setExpiryData(o),r.loadVectorData(o,this.map.painter),i.aQ(this.dispatcher),a(null,o),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(i,r){i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),i.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class tn extends i.E{constructor(r,a,n,o){super(),this.id=r,this.dispatcher=n,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},a),Object.assign(this,i.aJ(a,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new i.C("dataloading",{dataType:"source"}));let a=this.map.getWorldview();this._tileJSONRequest=tt(this._options,this.map._requestManager,null,a,(a,n)=>{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new i.B(a)):n&&(Object.assign(this,n),n.raster_layers&&(this.rasterLayers=n.raster_layers,this.rasterLayerIds=this.rasterLayers.map(i=>i.id)),this.tileBounds=tr.fromTileJSON(n),k(n.tiles),this.fire(new i.C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.C("data",{dataType:"source",sourceDataType:"content"}))),r&&r(a)})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.F(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(i){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,a){let n=i.o.devicePixelRatio>=2,o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize);r.request=i.n(this.map._requestManager.transformRequest(o,i.R.Tile),(n,o,s)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(n)return r.state="errored",a(n);if(!o)return a(null);let l=i.aP(s);this.map._refreshExpiredTiles&&r.setExpiryData(l),r.setTexture(o,this.map.painter),r.state="loaded",i.aQ(this.dispatcher),a(null)})}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r&&r()}unloadTile(r,a){r.texture&&r.texture instanceof i.T?(r.destroy(!1),r.texture&&r.texture instanceof i.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),a&&a()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class to extends tn{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},r)}triggerRepaint(i){let r=this.map.painter._terrain,a=this.map.style.getSourceCache(this.id);r&&r.enabled&&a&&r._clearRenderCacheForTile(a.id,i.tileID),this.map.triggerRepaint()}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),o=this.map._requestManager.transformRequest(n,i.R.Tile),s={request:o,uid:r.uid,tileID:r.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:this.partial};r.source=this.id,r.scope=this.scope,r.requestParams=o,r.actor||(r.actor=this.dispatcher.getActor());let l=(n,o,s)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(n){if("AbortError"===n.name)return;return r.state="errored",a(n)}if(this.map._refreshExpiredTiles&&o){let a=i.aP(s);r.setExpiryData(a)}if(this.partial&&"expired"!==r.state)r.state="empty";else if(!this.partial){if(!o)return a(null);r.state="loaded",r._isHeaderLoaded=!0,r._mrt=o}a(null)};r.request=this.partial?r.fetchHeader(void 0,l.bind(this)):r.actor.send("loadTile",s,l.bind(this),void 0,!0)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(i,r){let a=i.texturePerLayer;if(i.flushAllQueues(),a.size)for(let r of(i.destroy(!1),a.values()))this.map.painter.saveTileTexture(r);else i.destroy()}prepareTile(r,a,n,o){r._isHeaderLoaded&&("empty"!==r.state&&(r.state="reloading"),r.fetchBandForRender(a,n,o,(a,o)=>{a?(r.state="errored",this.fire(new i.B(a))):o&&(r._isHeaderLoaded=!0,r.setTexturePerLayer(n,o,this.map.painter),r.state="loaded"),this.triggerRepaint(r)}))}getInitialBand(i){if(!this.rasterLayers)return 0;let r=this.rasterLayers.find(({id:r})=>r===i),a=r&&r.fields,n=a&&a.bands&&a.bands;return n?n[0]:0}getTextureDescriptor(r,a,n){if(!r)return;let o=a.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!o)return;let s=null;a instanceof i.aT?s=a.paint.get("raster-array-band"):a instanceof i.aU&&(s=a.paint.get("raster-particle-array-band"));let l=s||this.getInitialBand(o);return null==l?void 0:r.textureDescriptorPerLayer.get(a.id)?!r.updateNeeded(a.id,l)||n?Object.assign({},r.textureDescriptorPerLayer.get(a.id),{texture:r.texturePerLayer.get(a.id)}):void 0:void this.prepareTile(r,o,a.id,l)}getImages(r,a){let n=new Map;for(let o of r)for(let r of a){let[a,s]=r.split("/"),l=o.getLayer(a);if(!l||!l.hasBand(s)||!l.hasDataForBand(s))continue;let{bytes:h,tileSize:u,buffer:c}=l.getBandView(s),d=u+2*c,p={data:new i.q({width:d,height:d},h),pixelRatio:2,sdf:!1,usvg:!1,version:0};n.set(r,p)}return n}queryRasterArrayValueByBandId(r,a,n){let o=a._mrt;return new Promise(s=>{let l={},h=new Set;for(let[u,c]of Object.entries(o.layers)){if(n.layerName&&u!==n.layerName)continue;let d={};for(let{bands:p}of(l[u]=d,c.dataIndex))for(let f of p)n.bands&&!n.bands.includes(f)||(h.add(i.F(u,f)),a.fetchBand(u,null,f,a=>{i.o.frame(()=>{d[f]=a?null:function([r,a],n,o,{scaled:s=!0}={}){let{tileSize:l,buffer:h}=o,{x:u,y:c,z:d}=n;if(!isFinite(u)||!isFinite(c)||!isFinite(d))throw Error("Invalid MRT header");let p=2**d;return function([i,r],a,{scaled:n=!0}={}){if(!a)throw Error("bandView is undefined");let{data:o,tileSize:s,buffer:l,offset:h,scale:u,dimension:c}=a;if(i<-l||i>s+l||r<-l||r>s+l)throw Error(`Point (${i}, ${r}) out of bounds for tileSize=${s}, buffer=${l}`);let d=(r+l)*(s+2*l)+(i+l);if(0xffffffff===new Uint32Array(o.buffer)[d])return null;let p=[];p=n?[]:new(0,a.data.constructor)(c);for(let i=0;i<c;i++)p[i]=Math.round(1e12*(o[c*d+i]*u+h))/1e12;return p}([Math.min(Math.max(-h,Math.floor((p*i.aH(r)-u)*l)),l-1+h),Math.min(Math.max(-h,Math.floor((p*i.aL(a)-c)*l)),l-1+h)],o,{scaled:s})}([r.lng,r.lat],o,c.getBandView(f)),h.delete(i.F(u,f)),0===h.size&&s(l)})},!1))}0===h.size&&s(l)})}_loadTileForQuery(r,a){if(this._loadTileLoaded[r.uid])return void a(null,r._mrt);if(this._loadTilePending[r.uid])return void this._loadTilePending[r.uid].push(a);this._loadTilePending[r.uid]=[a];let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),o=this.map._requestManager.transformRequest(n,i.R.Tile);r.actor.send("loadTile",{request:o,uid:r.uid,tileID:r.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:!1},(a,n,o)=>{if(a)return this._loadTilePending[r.uid].forEach(i=>i(a,null)),void delete this._loadTilePending[r.uid];if(!n)return this._loadTilePending[r.uid].forEach(i=>i(null,null)),void delete this._loadTilePending[r.uid];if(this.map._refreshExpiredTiles&&n){let a=i.aP(o);r.setExpiryData(a)}r._mrt=n,r._isHeaderLoaded=!0,r.state="loaded",this._loadTilePending[r.uid].forEach(i=>i(null,n)),this._loadTileLoaded[r.uid]=!0,delete this._loadTilePending[r.uid]},void 0,!0)}queryRasterArrayValueByAllBands(i,r,a){return new Promise((n,o)=>{this._loadTileForQuery(r,(s,l)=>{s?o(s):n(l?this.queryRasterArrayValueByBandId(i,r,a):null)})})}queryRasterArrayValue(r,a){let n=i.aV.convert(r),o=this.findLoadedParent(n);return o&&o._mrt?a.bands||!this.partial?this.queryRasterArrayValueByBandId(n,o,a):this.queryRasterArrayValueByAllBands(n,o,a):Promise.resolve(null)}findLoadedParent(r){let a=i.ag.fromLngLat(r,this.map.transform.tileSize),n=this.maxzoom+1,o=1<<n,s=Math.floor(a.x),l=Math.floor((a.x-s)*o),h=Math.floor(a.y*o),u=this.map.style.getSourceCache(this.id),c=new i.aS(n,s,n,l,h);return u.findLoadedParent(c,this.minzoom)}}let ts={vector:ta,raster:tn,"raster-dem":class extends tn{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function o(i,n){i&&(r.state="errored",a(i)),n&&(r.dem=n,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0,r.state="loaded",a(null))}r.request=i.n(this.map._requestManager.transformRequest(n,i.R.Tile),(function(n,s,l){if(delete r.request,r.aborted)r.state="unloaded",a(null);else if(n)r.state="errored",a(n);else if(s){let a=i.aP(l);this.map._refreshExpiredTiles&&r.setExpiryData(a);let n=i.y(),h=1-(s.width-i.aR(s.width))/2;h<1||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID));let u=n?s:i.o.getImageData(s,h),c={uid:r.uid,tileID:r.tileID,source:this.id,type:this.t
8ype,scope:this.scope,rawImageData:u,encoding:this.encoding,padding:h};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.actor.send("loadTile",c,o.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(r){let a=r.canonical,n=Math.pow(2,a.z),o=(a.x-1+n)%n,s=0===a.x?r.wrap-1:r.wrap,l=(a.x+1+n)%n,h=a.x+1===n?r.wrap+1:r.wrap,u={};return u[new i.aS(r.overscaledZ,s,a.z,o,a.y).key]={backfilled:!1},u[new i.aS(r.overscaledZ,h,a.z,l,a.y).key]={backfilled:!1},a.y>0&&(u[new i.aS(r.overscaledZ,s,a.z,o,a.y-1).key]={backfilled:!1},u[new i.aS(r.overscaledZ,r.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},u[new i.aS(r.overscaledZ,h,a.z,l,a.y-1).key]={backfilled:!1}),a.y+1<n&&(u[new i.aS(r.overscaledZ,s,a.z,o,a.y+1).key]={backfilled:!1},u[new i.aS(r.overscaledZ,r.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},u[new i.aS(r.overscaledZ,h,a.z,l,a.y+1).key]={backfilled:!1}),u}},"raster-array":to,geojson:class extends i.E{constructor(r,a,n,o){super(),this.id=r,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(o),this._data=a.data,this._options=Object.assign({},a),this._collectResourceTiming=a.collectResourceTiming,void 0!==a.maxzoom&&(this.maxzoom=a.maxzoom),void 0!==a.minzoom&&(this.minzoom=a.minzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId;const s=i.an/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:a.cluster||!1,geojsonVtOptions:{buffer:(void 0!==a.buffer?a.buffer:128)*s,tolerance:(void 0!==a.tolerance?a.tolerance:.375)*s,extent:i.an,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:void 0!==a.clusterMaxZoom?a.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,a.clusterMinPoints||2),extent:i.an,radius:(void 0!==a.clusterRadius?a.clusterRadius:50)*s,log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter,dynamic:a.dynamic},a.workerOptions)}onAdd(i){this.map=i,this.setData(this._data)}setData(i){return this._data=i,this._updateWorkerData(),this}updateData(r){if(!this._options.dynamic)return this.fire(new i.B(Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof r&&("Feature"===r.type&&(r={type:"FeatureCollection",features:[r]}),"FeatureCollection"!==r.type))return this.fire(new i.B(Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof r&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){let i=new Map;for(let r of this._data.features)i.set(r.id,r);for(let a of r.features)i.set(a.id,a);this._data.features=[...i.values()]}else this._data=r;return this._updateWorkerData(!0),this}getClusterExpansionZoom(i,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:i,source:this.id,scope:this.scope},r),this}getClusterChildren(i,r){return this.actor.send("geojson.getClusterChildren",{clusterId:i,source:this.id,scope:this.scope},r),this}getClusterLeaves(i,r,a,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:i,limit:r,offset:a},n),this}_updateWorkerData(r=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new i.C("dataloading",{dataType:"source"})),this._loaded=!1;let a=Object.assign({append:r},this.workerOptions);a.scope=this.scope;let n=this._data;"string"==typeof n?(a.request=this.map._requestManager.transformRequest(i.o.resolveURL(n),i.R.Source),a.request.collectResourceTiming=this._collectResourceTiming):a.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,a,(a,n)=>{if(this._loaded=!0,this._pendingLoad=null,a)this.fire(new i.B(a));else{let a={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(a.resourceTiming=n.resourceTiming[this.id]),r&&(this._partialReload=!0),this.fire(new i.C("data",a)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(r),this._coalesce=!1)})}loaded(){return this._loaded}reload(){let r=i.F(this.id,this.scope);this.map.style.clearSource(r),this._updateWorkerData()}loadTile(r,a){let n=r.actor?"reloadTile":"loadTile";r.actor=this.actor;let o=this.map.style?this.map.style.getLut(this.scope):null,s=o?{image:o.image.clone()}
8:null,l=this._partialReload,h={type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:s,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:l,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};r.request=this.actor.send(n,h,(i,o)=>l&&!o?(r.state="loaded",a(null)):(delete r.request,r.destroy(!1),r.aborted?a(null):i?a(i):(r.loadVectorData(o,this.map.painter,"reloadTile"===n),a(null))),void 0,"loadTile"===n)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i,r){this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),i.destroy()}onRemove(i){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
8,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends i.aW{constructor(i,r,a,n){super(i,r,a,n),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;let r=this.options;for(let a of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(a,i.R.Source).url);i.aX(this.urls,(r,a)=>{this._loaded=!0,r?this.fire(new i.B(r)):a&&(this.video=a,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){let a=this.video.seekable;r<a.start(0)||r>a.end(0)?this.fire(new i.B(new i.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let r=this.map.painter.context,a=r.gl;this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new i.T(r,this.video,a.RGBA8),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(r)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:i.aW,model:i.aZ,"batched-model":class extends i.E{constructor(i,r,a,n){super(),this.type="batched-model",this.id=i,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=a,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(n)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.F(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(r){this._loaded=!1,this.fire(new i.C("dataloading",{dataType:"source"}));let a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=tt(this._options,this.map._requestManager,a,n,(o,s)=>{this._tileJSONRequest=null,this._loaded=!0,o?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),n&&2!==n.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new i.B(o))):s&&(Object.assign(this,s),s.bounds&&(this.tileBounds=new tr(s.bounds,this.minzoom,this.maxzoom)),k(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.C("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)})}hasTransition(){return!1}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loaded(){return this._loaded}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),o={request:this.map._requestManager.transformRequest(n,i.R.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:r.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:i.o.devicePixelRatio,promoteId:this.promoteId};if(r.actor&&"expired"!==r.state)if("loading"===r.state)r.reloadCallback=a;else{if(r.buckets){for(let i of Object.values(r.buckets))i.dirty=!0;return void(r.state="loaded")}r.request=r.actor.send("reloadTile",o,s.bind(this))}else r.actor=this.dispatcher.getActor(),r.request=r.actor.send("loadTile",o,s.bind(this),void 0,!0);function s(i,n){return r.aborted?a(null):i&&404!==i.status?a(i):(this.map._refreshExpiredTiles&&n&&r.setExpiryData(n),r.loadModelData(n,this.map.painter),r.state="loaded",void a(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.aW{constructor(r,a,n,o){super(r,a,n,o),a.coordinates?Array.isArray(a.coordinates)&&4===a.coordinates.length&&!a.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.B(new i.V(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.B(new i.V(`sources.${r}`,null,'missing required property "coordinates"'))),a.animate&&"boolean"!=typeof a.animate&&this.fire(new i.B(new i.V(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),a.canvas?"string"==typeof a.canvas||a.canvas instanceof HTMLCanvasElement||this.fire(new i.B(new i.V(`sources.${r}`,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 i.B(new i.V(`sources.${r}`,null,'missing required property "canvas"'))),this.options=a,this.animate=void 0===a.animate||a.animate}load(){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 i.B(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(i){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let a=this.map.painter.context;this.texture?!r&&!this._playing||this.texture instanceof i.aY||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.T(a,this.canvas,a.gl.RGBA8,{premultiply:!0}),this._prepareData(a)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}},custom:class extends i.E{constructor(r,a,n,o){super(),this.id=r,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=a,this.setEventedParent(o),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.B(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.B(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new tr(this._implementation.bounds,this.minzoom,this.maxzoom)),a.update=this._update.bind(this),a.clearTiles=this._clearTiles.bind(this),a.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,i.aJ(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.aJ(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.C("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(r){this.map=r,this._loaded=!1,this.fire(new i.C("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(r),this.load()}onRemove(i){this._implementation.onRemove&&this._implementation.onRemove(i)}hasTile(i){if(this._implementation.hasTile){let{x:r,y:a,z:n}=i.canonical;return this._implementation.hasTile({x:r,y:a,z:n})}
8return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(i,r){let{x:a,y:n,z:o}=i.tileID.canonical,s=new AbortController,l=Promise.resolve(this._implementation.loadTile({x:a,y:n,z:o},{signal:s.signal})).then((function(a){return delete i.request,i.aborted?(i.state="unloaded",r(null)):void 0===a?(i.state="errored",r(null)):null===a?(this.loadTileData(i,{width:this.tileSize,height:this.tileSize,data:null}),i.state="loaded",r(null)):a instanceof ImageData||a instanceof HTMLCanvasElement||a instanceof ImageBitmap||a instanceof HTMLImageElement?(this.loadTileData(i,a),i.state="loaded",void r(null)):(i.state="errored",r(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(a=>{"AbortError"!==a.name&&(i.state="errored",r(a))});l.cancel=()=>s.abort(),i.request=l}loadTileData(i,r){i.setTexture(r,this.map.painter)}unloadTile(r,a){if(r.texture&&r.texture instanceof i.T?(r.destroy(!1),r.texture&&r.texture instanceof i.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),this._implementation.unloadTile){let{x:i,y:a,z:n}=r.tileID.canonical;this._implementation.unloadTile({x:i,y:a,z:n})}a&&a()}abortTile(i,r){i.request&&i.request.cancel&&(i.request.cancel(),delete i.request),r&&r()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(i=>({x:i.canonical.x,y:i.canonical.y,z:i.canonical.z}))}_clearTiles(){let r=i.F(this.id,this.scope);this.map.style.clearSource(r)}_update(){this.fire(new i.C("data",{dataType:"source",sourceDataType:"content"}))}}},tl=function(r,a,n,o){let s=new ts[a.type](r,a,n,o);if(s.id!==r)throw Error(`Expected Source id to be ${r} instead of ${s.id}`);return i.a_(["load","abort","unload","serialize","prepare"],s),s};function th(i,r,a=""){return`${a}:${r.id||""}:${r.layer.id}:${function(i){if("layerId"in i)return`layer:${i.layerId}`;{let{featuresetId:r,importId:a}=i;return`featureset:${r}${a?`:import:${a}`:""}`}}(i.target)}`}function tu(i,r,a,n=""){if(i.uniqueFeatureID){let o=th(i,r,n);if(a.has(o))return!0;a.add(o)}return!1}function tc(i,r){let a=i.tileID,n=r.tileID;return a.overscaledZ-n.overscaledZ||a.canonical.y-n.canonical.y||a.wrap-n.wrap||a.canonical.x-n.canonical.x}i.a$.setPbf(i.b0);class td extends i.b1{constructor(i,r,a,n,o){super(i,r,a,n,o),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(i){return this._mrt&&this._mrt.getLayer(i)}setTexturePerLayer(r,a,n){let o=n.context,s=o.gl,l=this.texturePerLayer.get(r)||n.getTileTexture(a.width);l&&l instanceof i.T?l.update(a,{premultiply:!1}):l=new i.T(o,a,s.RGBA8,{premultiply:!1}),this.texturePerLayer.has(r)||this.texturePerLayer.set(r,l)}flushQueues(i){let r=this._workQueuePerLayer.get(i)||[],a=this._fetchQueuePerLayer.get(i)||[];for(;r.length;)r.pop()();for(;a.length;)a.pop()()}flushAllQueues(){for(let i of this._workQueuePerLayer.keys()){let r=this._workQueuePerLayer.get(i)||[];for(;r.length;)r.pop()()}for(let i of this._fetchQueuePerLayer.keys()){let r=this._fetchQueuePerLayer.get(i)||[];for(;r.length;)r.pop()()}}fetchHeader(r=16384,a){let n=this._mrt=new i.a$(30),o=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(r-1)}});return this.entireBuffer=null,this.request=i.b2(o,(i,o,s)=>{if(i)a(i);else try{let i=n.getHeaderLength(o);if(i>r)return void(this.request=this.fetchHeader(i,a));n.parseHeader(o),this._isHeaderLoaded=!0;let l=0;for(let i of Object.values(n.layers))l=Math.max(l,i.dataIndex[i.dataIndex.length-1].lastByte);o.byteLength>=l&&(this.entireBuffer=o),a(null,this.entireBuffer||o,s)}catch(i){a(i)}}),this.request}fetchBandForRender(i,r,a,n){this.fetchBand(i,r,a,o=>{if(o)return void n(o);this.updateTextureDescriptor(i,r,a);let s=this.textureDescriptorPerLayer.get(r);n(null,s?s.img:null)})}fetchBand(r,a,n,o,s=!0){let l,h,u=this._mrt;if(!this._isHeaderLoaded||!u)return void o(Error("Tile header is not ready"));let c=this.actor;if(!c)return void o(Error("Can't fetch tile band without an actor"));let d=i.F(String(n),i.F(this.tileID.key,r)),p=this._taskQueue.get(d);p?p.add(o):((p=new Set).add(o),this._taskQueue.set(d,p));let f=(i,r)=>
8{l.complete(i,r),i?o(i):(p.forEach(i=>i(null,r)),this._taskQueue.delete(d))},m=(i,r)=>{if(i)return o(i);let n=c.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:r,task:l},f,void 0,!0);if(null!==a){let i=this._workQueuePerLayer.get(a)||[];i.push(()=>{n&&n.cancel(),l.cancel()}),this._workQueuePerLayer.has(a)||this._workQueuePerLayer.set(a,i)}};try{h=u.getLayer(r)}catch(i){if("reloading"===this.state)return;throw i}if(!h)return void o(Error(`Unknown sourceLayer "${r}"`));if(h.hasDataForBand(n))return p.forEach(i=>i(null,null)),void this._taskQueue.delete(d);let _=h.getDataRange([n]);if(!(l=u.createDecodingTask(_))||l.tasks.length)if(null!==a&&this.flushQueues(a),this.entireBuffer)m(null,this.entireBuffer.slice(_.firstByte,_.lastByte+1));else{let r=Object.assign({},this.requestParams,{headers:{Range:`bytes=${_.firstByte}-${_.lastByte}`}}),n=i.b2(r,m);if(null!==a){let i=this._fetchQueuePerLayer.get(a)||[];i.push(()=>{n.cancel(),l.cancel()}),this._fetchQueuePerLayer.has(a)||this._fetchQueuePerLayer.set(a,i)}}}updateNeeded(i,r){return(!this.textureDescriptorPerLayer.get(i)||this.textureDescriptorPerLayer.get(i).band!==r||this.refreshedUponExpiration)&&"errored"!==this.state}updateTextureDescriptor(r,a,n){if(!this._mrt)return;let o=this._mrt.getLayer(r);if(!o||!o.hasBand(n)||!o.hasDataForBand(n))return;let{bytes:s,tileSize:l,buffer:h,offset:u,scale:c}=o.getBandView(n),d=l+2*h,p=new i.q({width:d,height:d},s),f=this.texturePerLayer.get(a);f&&f instanceof i.T&&f.update(p,{premultiply:!1}),this.textureDescriptorPerLayer.set(a,{layer:r,band:n,img:p,buffer:h,offset:u,tileSize:l,format:o.pixelFormat,mix:[c,256*c,65536*c,0x1000000*c]})}destroy(r=!1){if(super.destroy(r),delete this._mrt,!r)for(let r of this.texturePerLayer.values())r&&r instanceof i.T&&r.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class tp{constructor(i,r){this.max=i,this.onRemove=r,this.reset()}reset(){for(let i in this.data)for(let r of this.data[i])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(i,r,a){let n=i.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);let o={value:r,timeout:void 0};if(void 0!==a&&(o.timeout=setTimeout(()=>{this.remove(i,o)},a)),this.data[n].push(o),this.order.push(n),this.order.length>this.max){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){let r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){let r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;let a=i.wrapped().key,n=void 0===r?0:this.data[a].indexOf(r),o=this.data[a][n];return this.data[a].splice(n,1),o.timeout&&clearTimeout(o.timeout),0===this.data[a].length&&delete this.data[a],this.onRemove(o.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(i){let r=[];for(let a in this.data)for(let n of this.data[a])i(n.value)||r.push(n);for(let i of r)this.remove(i.value.tileID,i)}}class tf{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,r,a){let n=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][n]=this.stateChanges[i][n]||{},Object.assign(this.stateChanges[i][n],a),null===this.deletedStates[i])for(let r in this.deletedStates[i]={},this.state[i])r!==n&&(this.deletedStates[i][r]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][n])for(let r in this.deletedStates[i][n]={},this.state[i][n])a[r]||(this.deletedStates[i][n][r]=null);else for(let r in a)this.deletedStates[i]&&this.deletedStates[i][n]&&null===this.deletedStates[i][n][r]&&delete this.deletedStates[i][n][r]}removeFeatureState(i,r,a){if(null===this.deletedStates[i])return;let n=String(r);if(this.deletedStates[i]=this.deletedStates[i]||{},a&&void 0!==r)null!==this.deletedStates[i][n]&&(this.deletedStates[i][n]=this.deletedStates[i][n]||{},this.deletedStates[i][n][a]=null);else if(void 0!==r)if(this.stateChanges[i]&&this.stateChanges[i][n])for(a in this.deletedStates[i][n]={},this.stateChanges[i][n])this.deletedStates[i][n][a]=null;else this.deletedStates[i][n]=null;else this.deletedStates[i]=null}getState(i,r){let a=this.state[i]||{},n=this.stateChanges[i]||{},o=this.deletedStates[i];if(null===o)return{};if(void 0!==r){let i=String(r),s=Object.assign({},a[i],n[i]);if(o){let i=o[r];if(null===i)return{};for(let r in i)delete s[r]}return s}let s=Object.assign({},a,n);if(o)for(let i in o)delete s[i];return s}initializeTileState(i,r){i.refreshFeatureState(r)}coalesceChanges(i,r){let a={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let r={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),Object.assign(this.state[i][a],this.stateChanges[i][a]),r[a]=this.state[i][a];a[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let r={};
8if(null===this.deletedStates[i])for(let a in this.state[i])r[a]={},this.state[i][a]={};else for(let a in this.deletedStates[i]){if(null===this.deletedStates[i][a])this.state[i][a]={};else if(this.state[i][a])for(let r of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][r];r[a]=this.state[i][a]}a[i]=a[i]||{},Object.assign(a[i],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(let n in i)i[n].refreshFeatureState(r,a)}}class tm extends i.E{constructor(i,r,a){super(),this.id=i,this._renderSourceType=a,this._maxzoomOverride=null,r.on("data",i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new tp(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new tf,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"_dataType"in this._source&&"raster"===this._source._dataType,this._supportsFading="raster"===this._source.type||"raster-array"===this._source.type||"image"===this._source.type||"video"===this._source.type||"custom"===this._source.type,this._isRasterElevatedOverTerrain=!1}onAdd(i){this.map=i,this._minTileCacheSize=void 0===this._minTileCacheSize&&i?i._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&i?i._maxTileC
8acheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let i in this._tiles)if(!this._tiles[i].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}setMaxzoomOverride(i){this._maxzoomOverride=i}_loadTile(i,r){return i.renderSourceType=this._renderSourceType,i.isExtraShadowCaster=this._shadowCasterTiles[i.tileID.key],this._source.loadTile(i,r)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i)}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i)}serialize(){return this._source.serialize()}prepare(i){for(let r in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let a=this._tiles[r];a.upload(i,this.map?this.map.painter:void 0),a.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(i=>i.tileID).sort(t_).map(i=>i.key)}getRenderableIds(r,a){let n=[];for(let i in this._tiles)this._isIdRenderable(+i,r,a)&&n.push(this._tiles[i]);return r?n.sort((r,a)=>{let n=r.tileID,o=a.tileID,s=new i.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),l=new i.P(o.canonical.x,o.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-o.overscaledZ||l.y-s.y||l.x-s.x}).map(i=>i.tileID.key):n.map(i=>i.tileID).sort(t_).map(i=>i.key)}hasRenderableParent(i){let r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r,a){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())&&(a||!this._shadowCasterTiles[i])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){let a=this._tiles[i];a&&("loading"!==a.state&&(a.state=r),this._loadTile(a,this._tileLoaded.bind(this,a,i,r)))}_tileLoaded(r,a,n,o,s){if(o){if(r.state="errored",i.b3(o)){if(this._source.fire(new i.C("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:r})),!(r.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let i=this.map.painter.terrain;this.update(this.transform,i.getScaledDemTileSize(),!0),i.resetTileLookupCache(this.id)}else this.update(this.transform)}else this._source.fire(new i.B(o,{tile:r}));return}r.timeAdded=i.o.now(),"expired"===n&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(a,r),"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null);let l=new Map;s&&s.responseHeaders&&(l=s.responseHeaders),this._source.fire(new i.C("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id,responseHeaders:l}))}_backfillDEM(i){let r=this.getRenderableIds();for(let n=0;n<r.length;n++){let o=r[n];if(i.neighboringTiles&&i.neighboringTiles[o]){let r=this.getTileByID(o);a(i,r),a(r,i)}}function a(i,r){if(!i.dem||i.dem.borderReady)return;i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0;let a=r.tileID.canonical.x-i.tileID.canonical.x,n=r.tileID.canonical.y-i.tileID.canonical.y,o=Math.pow(2,i.tileID.canonical.z),s=r.tileID.key;0===a&&0===n||Math.abs(n)>1||(Math.abs(a)>1&&(1===Math.abs(a+o)?a+=o:1===Math.abs(a-o)&&(a-=o)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,a,n),i.neighboringTiles&&i.neighboringTiles[s]&&(i.neighboringTiles[s].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,a,n){for(let o in this._tiles){let s=this._tiles[o];if(n[o]||!s.hasData()||s.tileID.overscaledZ<=r||s.tileID.overscaledZ>a)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>r+1;){let i=s.tileID.scaledTo(s.tileID.overscaledZ-1);(s=this._tiles[i.key])&&s.hasData()&&(l=i)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){n[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){let a=this._loadedParentTiles[i.key];return a&&a.tileID.overscaledZ>=r?a:null}for(let a=i.overscaledZ-1;a>=r;a--){let r=i.scaledTo(a),n=this._getLoadedTile(r);if(n)return n}}_getLoadedTile(i){let r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;let a=Math.floor((Math.ceil(i.width/r)+1)*(Math.ceil(i.height/r)+1)*5),n="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,a):a,o="number"==typeof this._maxTileC
8acheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}handleWrapJump(i){let r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){let i={};for(let a in this._tiles){let n=this._tiles[a];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+r),i[n.tileID.key]=n}for(let r in this._tiles=i,this._timers)clearTimeout(this._timers[r]),delete this._timers[r];for(let i in this._tiles)this._setTileReloadTimer(+i,this._tiles[i])}}update(r,a,n,o,s){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(r,a),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};let l="batched-model"===this._source.type,h,u=this._source.maxzoom;null!==this._maxzoomOverride&&(u=Math.min(u,this._maxzoomOverride));let c=this.map&&this.map.painter?this.map.painter._terrain:null;if(c&&c.sourceCache===this&&c.attenuationRange()){let i=Math.floor(c.attenuationRange()[0])-Math.log2(c.getDemUpscale());u>i&&(u=i)}let d=null===this._maxzoomOverride&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)h=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(r=>new i.aS(r.canonical.z,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y));else if(0!==this.tileCoverLift){let o=r.clone();o.tileCoverLift=this.tileCoverLift,h=o.coveringTiles({tileSize:a||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:u,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:d,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.minzoom<=1&&"globe"===r.projection.name&&(h.push(new i.aS(1,0,1,0,0)),h.push(new i.aS(1,0,1,1,0)),h.push(new i.aS(1,0,1,0,1)),h.push(new i.aS(1,0,1,1,1)))}else if(h=r.coveringTiles({tileSize:a||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:u,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:d,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.hasTile){let i=this._source.hasTile.bind(this._source);h=h.filter(r=>i(r))}}else h=[];if(h.length>0&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!this._supportsFading){let i=Math.min(r.coveringZoomLevel({tileSize:a||this._source.tileSize,roundZoom:this._source.roundZoom&&!n}),u);if(l)for(let a of r.extendTileCover(h,i))h.push(a);else if(s)for(let a of r.extendTileCoverToNearPlane(h,this.transform.getFrustum(i),i))h.push(a);else if(this.castsShadows&&o)for(let a of r.extendTileCover(h,i,o,16))this._shadowCasterTiles[a.key]=!0,h.push(a)}let p=this._updateRetainedTiles(h);if(this._supportsFading&&0!==h.length){let r={},a={},n=i.o.now();for(let i of Object.keys(p)){let o=p[i],s=this._tiles[i];if(!s||void 0!==s.fadeEndTime&&s.fadeEndTime<=n)continue;let l=this.findLoadedParent(o,Math.max(o.overscaledZ-tm.maxOverzooming,this._source.minzoom));l&&(this._addTile(l.tileID),r[l.tileID.key]=l.tileID),a[i]=o}let o=h[h.length-1].overscaledZ;for(let i in this._tiles){let r=this._tiles[i];if(p[i]||!r.hasData())continue;let n=r.tileID;for(;n.overscaledZ>o;){n=n.scaledTo(n.overscaledZ-1);let o=this._tiles[n.key];if(o&&o.hasData()&&a[n.key]){p[i]=r.tileID;break}}}for(let i in r)p[i]||(this._coveredTiles[i]=!0,p[i]=r[i])}for(let i in p)this._tiles[i].clearFadeHold();for(let r of i.b4(this._tiles,p)){let i=this._tiles[r];i.hasSymbolBuckets&&!i.holdingForFade()?i.setHoldDuration(this.map._fadeDuration):i.hasSymbolBuckets&&!i.symbolFadeFinished()||this._removeTile(+r)}this._updateLoadedParentTileCache(),this._renderSourceType===i.b5.Symbol&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){let r={};if(0===i.length)return r;let a={},n=i.reduce((i,r)=>Math.min(i,r.overscaledZ),1/0),o=i[0].overscaledZ,s=Math.max(o-tm.maxOverzooming,this._source.minzoom),l=Math.max(o+tm.maxUnderzooming,this._source.minzoom),h={};for(let a of i){let i=this._addTile(a);r[a.key]=a,i.hasData()||n<this._source.maxzoom&&(h[a.key]=a)}for(let o of(this._retainLoadedChildren(h,n,l,r),i)){let i=this._tiles[o.key];if(i.hasData())continue;if(o.canonical.z>=this._source.maxzoom){let i=o.children(this._source.maxzoom)[0],a=this.getTile(i);if(a&&a.hasData()){r[i.key]=i;continue}}else{let i=o.children(this._source.maxzoom);
8if(r[i[0].key]&&r[i[1].key]&&r[i[2].key]&&r[i[3].key])continue}let n=i.wasRequested();for(let l=o.overscaledZ-1;l>=s;--l){let s=o.scaledTo(l);if(a[s.key]||(a[s.key]=!0,(i=this.getTile(s))||!n||(i=this._addTile(s)),i&&(r[s.key]=s,n=i.wasRequested(),i.hasData())))break}}return r}_updateLoadedParentTileCache(){for(let i in this._loadedParentTiles={},this._tiles){let r=[],a,n=this._tiles[i].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){a=this._loadedParentTiles[n.key];break}r.push(n.key);let i=n.scaledTo(n.overscaledZ-1);if(a=this._getLoadedTile(i))break;n=i}for(let i of r)this._loadedParentTiles[i]=a}}_addTile(r){let a=this._tiles[r.key];if(a)return!0!==a.isExtraShadowCaster||this._shadowCasterTiles[r.key]||this._reloadTile(r.key,"reloading"),a;(a=this._cache.getAndRemove(r))&&(this._setTileReloadTimer(r.key,a),a.tileID=r,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,a)));let n=!!a;if(!n){let n=this.map?this.map.painter:null,o=this._source.tileSize*r.overscaleFactor();a="raster-array"===this._source.type?new td(r,o,this.transform.tileZoom,n,this._isRaster):new i.b1(r,o,this.transform.tileZoom,n,this._isRaster,this._source.worldview),this._loadTile(a,this._tileLoaded.bind(this,a,r.key,a.state))}return a.uses++,this._tiles[r.key]=a,n||this._source.fire(new i.C("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);let a=r.getExpiryTimeout();a&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},a))}_removeTile(i){let r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state||"empty"===r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(let i in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(r,a,n){let o=[],s=this.transform;if(!s)return o;let l="globe"===s.projection.name,h=i.aH(s.center.lng);for(let u in this._tiles){let c,d=this._tiles[u];if(n&&d.clearQueryDebugViz(),!d.holdingForFade()){if(l){let r=d.tileID.canonical;if(0===r.z){let a=[Math.abs(i.aC(h,...tg(r,-1))-h),Math.abs(i.aC(h,...tg(r,1))-h)];c=[0,2*a.indexOf(Math.min(...a))-1]}else{let a=[Math.abs(i.aC(h,...tg(r,-1))-h),Math.abs(i.aC(h,...tg(r,0))-h),Math.abs(i.aC(h,...tg(r,1))-h)];c=[a.indexOf(Math.min(...a))-1]}}else c=[0];for(let i of c){let n=r.containsTile(d,s,a,i);n&&o.push(n)}}}return o}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(i){return this._getRenderableCoordinates(i)}_getRenderableCoordinates(i,r){let a=this.getRenderableIds(i,r).map(i=>this._tiles[i].tileID),n="globe"===this.transform.projection.name;for(let i of a)i.projMatrix=this.transform.calculateProjMatrix(i.toUnwrapped()),i.expandedProjMatrix=n?this.transform.calculateProjMatrix(i.toUnwrapped(),!1,!0):i.projMatrix;return a}sortCoordinatesByDistance(i){let r=i.slice(),a=this.transform._camera.position,n=this.transform._camera.forward(),o={};for(let i of r){let r=1/(1<<i.canonical.z);o[i.key]=((i.canonical.x+.5)*r+i.wrap-a[0])*n[0]+((i.canonical.y+.5)*r-a[1])*n[1]-a[2]*n[2]}return r.sort((i,r)=>o[i.key]-o[r.key]),r}hasTransition(){if(this._source.hasTransition())return!0;if(this._supportsFading){let r=i.o.now();for(let i in this._tiles){let a=this._tiles[i];if(void 0!==a.fadeEndTime&&a.fadeEndTime>=r)return!0}}return!1}setFeatureState(i,r,a){this._state.updateState(i=i||"_geojsonTileLayer",r,a)}removeFeatureState(i,r,a){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,a)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}
8setDependencies(i,r,a){let n=this._tiles[i];n&&n.setDependencies(r,a)}reloadTilesForDependencies(i,r){for(let a in this._tiles)this._tiles[a].hasDependency(i,r)&&this._reloadTile(+a,"reloading");this._cache.filter(a=>!a.hasDependency(i,r))}_preloadTiles(r,a){if(!this._sourceLoaded){let i=()=>{this._sourceLoaded&&(this._source.off("data",i),this._preloadTiles(r,a))};return void this._source.on("data",i)}let n=new Map,o=Array.isArray(r)?r:[r],s=this.map.painter.terrain,l=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(let i of o){for(let r of i.coveringTiles({tileSize:l,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}))n.set(r.key,r);this.usedForTerrain&&i.updateElevation(!1)}let h=Array.from(n.values());i.t(h,(r,a)=>{let n=new i.b1(r,this._source.tileSize*r.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),a(i,n)})},a)}}function t_(i,r){let a=Math.abs(2*i.wrap)-(i.wrap<0),n=Math.abs(2*r.wrap)-(r.wrap<0);return i.overscaledZ-r.overscaledZ||n-a||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function tg(i,r){let a=1<<i.z;return[i.x/a+r,(i.x+1)/a+r]}tm.maxOverzooming=10,tm.maxUnderzooming=3;class ty{constructor(i){this.style=i,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){for(let i in this.layers=[],this.style._mergedLayers){let r=this.style._mergedLayers[i];if("fill-extrusion"===r.type||"building"===r.type)this.layers.push({layer:r,visible:!1,visibilityChanged:!1});else if("model"===r.type){let i=this.style.getLayerSource(r);i&&"batched-model"===i.type&&this.layers.push({layer:r,visible:!1,visibilityChanged:!1})}}}onNewFrame(i){for(let r of(this.layersGotHidden=!1,this.layers)){let a=r.layer,n=!1;"fill-extrusion"===a.type?n=!a.isHidden(i)&&a.paint.get("fill-extrusion-opacity")>0:"building"===a.type?n=!a.isHidden(i)&&a.paint.get("building-opacity")>0:"model"===a.type&&(n=!a.isHidden(i)&&a.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!n&&r.visible,r.visible=n}}updateZOffset(i,r){for(let i of(this.currentBuildingBuckets=[],this.layers)){let a=i.layer,n=this.style.getLayerSourceCache(a),o=1;"fill-extrusion"===a.type?o=i.visible?a.paint.get("fill-extrusion-vertical-scale"):0:"building"===a.type&&(o=i.visible?a.paint.get("building-vertical-scale"):0);let s=n?n.getTile(r):null;if(!s&&n)for(let i in n._tiles){let a=n._tiles[i];if(r.canonical.isChildOf(a.tileID.canonical)){s=a;break}}this.currentBuildingBuckets.push({bucket:s?s.getBucket(a):null,tileID:s?s.tileID:r,verticalScale:o})}i.hasAnyZOffset=!1;let a=!1;for(let n=0;n<i.symbolInstances.length;n++){let o=i.symbolInstances.get(n),s=o.zOffset,l=this._getHeightAtTileOffset(r,o.tileAnchorX,o.tileAnchorY);o.zOffset=l!==-1/0?l:s,a||s===o.zOffset||(a=!0),i.hasAnyZOffset||0===o.zOffset||(i.hasAnyZOffset=!0)}a&&(i.zOffsetBuffersNeedUpload=!0,i.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(r,a,n,o){let s=a,l=n;if(r.canonical.z!==o.canonical.z){let h=o.canonical,u=1/(1<<r.canonical.z-h.z);s=(a+r.canonical.x*i.an)*u-h.x*i.an|0,l=(n+r.canonical.y*i.an)*u-h.y*i.an|0}return{tileX:s,tileY:l}}_getHeightAtTileOffset(i,r,a){let n,o;for(let s=0;s<this.layers.length;++s){let l=this.layers[s].layer;if("fill-extrusion"!==l.type&&"building"!==l.type)continue;let{bucket:h,tileID:u,verticalScale:c}=this.currentBuildingBuckets[s];if(!h)continue;let{tileX:d,tileY:p}=this._mapCoordToOverlappingTile(i,r,a,u),f=h.getHeightAtTileCoord(d,p);f&&void 0!==f.height&&(f.hidden?n=f.height:o=Math.max(f.height*c,o||0))}if(void 0!==o)return o;for(let o=0;o<this.layers.length;++o){let s=this.layers[o];if("model"!==s.layer.type||!s.visible)continue;let{bucket:l,tileID:h}=this.currentBuildingBuckets[o];if(!l)continue;let{tileX:u,tileY:c}=this._mapCoordToOverlappingTile(i,r,a,h),d=l.getHeightAtTileCoord(u,c);if(d&&!d.hidden)return void 0===d.height&&void 0!==n?Math.min(d.maxHeight,n)*d.verticalScale:d.height?d.height*d.verticalScale:-1/0}return this.layersGotHidden?0:-1/0}}function tx(r){r=r.slice();let a=Object.create(null);for(let i=0;i<r.length;i++)a[r[i].id]=r[i];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=function(r,a){let n={};for(let i in r)"ref"!==i&&(n[i]=r[i]);
8return i.b6.forEach(i=>{i in a&&(n[i]=a[i])}),n}(r[n],a[r[n].ref]));return r}let tv={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function tb(i,r,a){a.push({command:tv.addSource,args:[i,r[i]]})}function tw(i,r,a){r.push({command:tv.removeSource,args:[i]}),a[i]=!0}function tT(r,a,n,o,s,l){let h;for(h in a=a||{},r=r||{})r.hasOwnProperty(h)&&(i.b7(r[h],a[h])||n.push({command:l,args:[o,h,a[h],s]}));for(h in a)a.hasOwnProperty(h)&&!r.hasOwnProperty(h)&&(i.b7(r[h],a[h])||n.push({command:l,args:[o,h,a[h],s]}))}function tS(i){return i.id}function tI(i,r){return i[r.id]=r,i}function tE(r,a,n){let o=a.createTileMatrix(r,r.worldSize,n.toUnwrapped());return i.aD(new Float32Array(16),r.projMatrix,o)}function tA(i,r,a){return r.name===a.projection.name?i.projMatrix:tE(a,r,i)}class tC{constructor(i,r){this.reset(i,r)}reset(i,r){this.points=i||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(r||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(1===this.points.length)return this.points[0];r=i.aC(r,0,1);let a=1,n=this._distances[a],o=r*this.paddedLength+this.padding;for(;n<o&&a<this._distances.length;)n=this._distances[++a];let s=a-1,l=this._distances[s],h=n-l,u=h>0?(o-l)/h:0;return this.points[s].mult(1-u).add(this.points[a].mult(u))}}class tM{constructor(i,r,a){const n=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(i/a),this.yCellCount=Math.ceil(r/a);for(let i=0;i<this.xCellCount*this.yCellCount;i++)n.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=i,this.height=r,this.xScale=this.xCellCount/i,this.yScale=this.yCellCount/r,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(i,r,a,n,o){this._forEachCell(r,a,n,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n),this.bboxes.push(o)}insertCircle(i,r,a,n){this._forEachCell(r-n,a-n,r+n,a+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(i),this.circles.push(r),this.circles.push(a),this.circles.push(n)}_insertBoxCell(i,r,a,n,o,s){this.boxCells[o].push(s)}_insertCircleCell(i,r,a,n,o,s){this.circleCells[o].push(s)}_query(i,r,a,n,o,s){if(a<0||i>this.width||n<0||r>this.height)return!o&&[];let l=[];if(i<=0&&r<=0&&this.width<=a&&this.height<=n){if(o)return!0;for(let i=0;i<this.boxKeys.length;i++)l.push({key:this.boxKeys[i],x1:this.bboxes[4*i],y1:this.bboxes[4*i+1],x2:this.bboxes[4*i+2],y2:this.bboxes[4*i+3]});for(let i=0;i<this.circleKeys.length;i++){let r=this.circles[3*i],a=this.circles[3*i+1],n=this.circles[3*i+2];l.push({key:this.circleKeys[i],x1:r-n,y1:a-n,x2:r+n,y2:a+n})}return s?l.filter(s):l}return this._forEachCell(i,r,a,n,this._queryCell,l,{hitTest:o,seenUids:{box:{},circle:{}}},s),o?l.length>0:l}_queryCircle(i,r,a,n,o){let s=i-a,l=i+a,h=r-a,u=r+a;if(l<0||s>this.width||u<0||h>this.height)return!n&&[];let c=[];return this._forEachCell(s,h,l,u,this._queryCellCircle,c,{hitTest:n,circle:{x:i,y:r,radius:a},seenUids:{box:{},circle:{}}},o),n?c.length>0:c}query(i,r,a,n,o){return this._query(i,r,a,n,!1,o)}hitTest(i,r,a,n,o){return this._query(i,r,a,n,!0,o)}hitTestCircle(i,r,a,n){return this._queryCircle(i,r,a,!0,n)}_queryCell(i,r,a,n,o,s,l,h){let u=l.seenUids,c=this.boxCells[o];if(null!==c){let o=this.bboxes;for(let d of c)if(!u.box[d]){u.box[d]=!0;let c=4*d;if(i<=o[c+2]&&r<=o[c+3]&&a>=o[c+0]&&n>=o[c+1]&&(!h||h(this.boxKeys[d]))){if(l.hitTest)return s.push(!0),!0;s.push({key:this.boxKeys[d],x1:o[c],y1:o[c+1],x2:o[c+2],y2:o[c+3]})}}}let d=this.circleCells[o];if(null!==d){let o=this.circles;for(let c of d)if(!u.circle[c]){u.circle[c]=!0;let d=3*c;
8if(this._circleAndRectCollide(o[d],o[d+1],o[d+2],i,r,a,n)&&(!h||h(this.circleKeys[c]))){if(l.hitTest)return s.push(!0),!0;{let i=o[d],r=o[d+1],a=o[d+2];s.push({key:this.circleKeys[c],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}}}}}_queryCellCircle(i,r,a,n,o,s,l,h){let u=l.circle,c=l.seenUids,d=this.boxCells[o];if(null!==d){let i=this.bboxes;for(let r of d)if(!c.box[r]){c.box[r]=!0;let a=4*r;if(this._circleAndRectCollide(u.x,u.y,u.radius,i[a+0],i[a+1],i[a+2],i[a+3])&&(!h||h(this.boxKeys[r])))return s.push(!0),!0}}let p=this.circleCells[o];if(null!==p){let i=this.circles;for(let r of p)if(!c.circle[r]){c.circle[r]=!0;let a=3*r;if(this._circlesCollide(i[a],i[a+1],i[a+2],u.x,u.y,u.radius)&&(!h||h(this.circleKeys[r])))return s.push(!0),!0}}}_forEachCell(i,r,a,n,o,s,l,h){let u=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r),d=this._convertToXCellCoord(a),p=this._convertToYCellCoord(n);for(let f=u;f<=d;f++)for(let u=c;u<=p;u++)if(o.call(this,i,r,a,n,this.xCellCount*u+f,s,l,h))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,r,a,n,o,s){let l=n-i,h=o-r,u=a+s;return u*u>l*l+h*h}_circleAndRectCollide(i,r,a,n,o,s,l){let h=(s-n)/2,u=Math.abs(i-(n+h));if(u>h+a)return!1;let c=(l-o)/2,d=Math.abs(r-(o+c));if(d>c+a)return!1;if(u<=h||d<=c)return!0;let p=u-h,f=d-c;return p*p+f*f<=a*a}}let tP=Math.tan(85*Math.PI/180);function tD(r,a,n,o,s,l,h){let u=i.bc();if(n)if("globe"===l.name){let r=i.bd(s,a);i.aD(u,u,r)}else{let r=i.be([],h);u[0]=r[0],u[1]=r[1],u[4]=r[2],u[5]=r[3],o||i.bb(u,u,s.angle)}else i.aD(u,s.labelPlaneMatrix,r);return u}function tR(i,r,a,n,o,s,l){let h=tD(i,r,a,n,o,s,l);return"globe"===s.name&&a||(h[2]=h[6]=h[10]=h[14]=0),h}function tL(r,a,n,o,s,l,h){if(n){if("globe"===l.name){let u=tD(r,a,n,o,s,l,h);return i.b8(u,u),i.aD(u,r,u),u}{let a=i.b9(r),n=i.ba([]);return n[0]=h[0],n[1]=h[1],n[4]=h[2],n[5]=h[3],i.aD(a,a,n),o||i.bb(a,a,-s.angle),a}}return s.glCoordMatrix}function tz(r,a,n,o){let s=[r,a,n,1];n?i.aE(s,s,o):tq(s,s,o);let l=s[3];return s[0]/=l,s[1]/=l,s[2]/=l,s}function tF(i,r){return Math.min(.5+i/r*.5,1.5)}function tO(r,a,n,o,s,l,h,u,c,d,p=1){let f=n.transform,m=o?r.textSizeData:r.iconSizeData,_=i.bk(m,n.transform.zoom,p),g="globe"===f.projection.name,y=[256/n.width*2+1,256/n.height*2+1],x=o?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;x.clear();let v=null;g&&(v=o?r.text.globeExtVertexArray:r.icon.globeExtVertexArray);let b=r.lineVertexArray,w=o?r.text.placedSymbolArray:r.icon.placedSymbolArray,T=n.transform.width/n.transform.height,S,I=!1;for(let o=0;o<w.length;o++){let p=w.get(o),{numGlyphs:g,writingMode:E}=p;if(E!==i.bl.vertical||I||S===i.bl.horizontal||(I=!0),S=E,(p.hidden||E===i.bl.vertical)&&!I){tG(g,x);continue}I=!1;let A=new i.P(p.tileAnchorX,p.tileAnchorY),C="road"===r.elevationType,M=!!f.elevation||C,{x:P,y:D,z:R}=f.projection.projectTilePoint(A.x,A.y,d.canonical),L=null;if(M){let i=C?r.getElevationFeatureForText(o):null;L={getElevation:c,elevation:f.elevation,elevationFeature:i};let[a,n,s]=c(A,f.elevation,i);P+=a,D+=n,R+=s}let z=[P,D,R,1];if(i.aE(z,z,a),!function(i,r){let a=i[0]/i[3],n=i[1]/i[3];return a>=-r[0]&&a<=r[0]&&n>=-r[1]&&n<=r[1]}(z,y)){tG(g,x);continue}let F=z[3],O=tF(n.transform.getCameraToCenterDistance(f.projection),F),B=i.bm(m,_,p),k=h?B/O:B*O,V=tz(P,D,R,s);if(V[3]<=0){tG(g,x);continue}let N={},U=Math.cos(i.ap(r.layers[0].layout.get("text-max-angle"))),j=h?null:L,G=tV(p,k,!1,u,a,s,l,r.glyphOffsetArray,b,x,v,V,A,N,T,j,f.projection,d,h,U);I=G.useVertical,j&&G.needsFlipping&&(N={}),(G.notEnoughRoom||I||G.needsFlipping&&tV(p,k,!0,u,a,s,l,r.glyphOffsetArray,b,x,v,V,A,N,T,j,f.projection,d,h,U).notEnoughRoom)&&tG(g,x)}o?(r.text.dynamicLayoutVertexBuffer.updateData(x),v&&r.text.globeExtVertexBuffer&&r.text.globeExtVertexBuffer.updateData(v)):(r.icon.dynamicLayoutVertexBuffer.updateData(x),v&&r.icon.globeExtVertexBuffer&&r.icon.globeExtVertexBuffer.updateData(v))}function tB(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let{lineStartIndex:x,glyphStartIndex:v,segment:b}=h,w=v+h.numGlyphs,T=x+h.lineLength,S=r.getoffsetX(v),I=r.getoffsetX(w-1),E=tj(i*S,a,n,o,s,l,b,x,T,u,c,d,p,f,!0,m,_,g,y);if(!E)return null;let A=tj(i*I,a,n,o,s,l,b,x,T,u,c,d,p,f,!0,m,_,g,y);return A?{first:E,last:A}:null}function tk(r,a,n,o){return r===i.bl.horizontal&&Math.abs(o)>Math.abs(n)?{useVertical:!0}:r===i.bl.vertical?o>0?{needsFlipping:!0}:null:0!==a&&(0===n||Math.abs(o/n)>tP)?1===a?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function tV(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=a/24,S=r.lineOffsetX*T,I=r.lineOffsetY*T,{lineStartIndex:E,glyphStartIndex:A,numGlyphs:C,segment:M,writingMode:P,flipState:D}=r,R=E+r.lineLength,L=r=>{if(p){let[a,n,o]=r.up,s=d.length;i.bn(p,s+0,a,n,o),i.bn(p,s+1,a,n,o),i.bn(p,s+2,a,n,o),i.bn(p,s+3,a,n,o)}let[a,n,o]=r.point;i.bo(d,a,n,o,r.angle)};if(C>1){let i=tB(T,u,S,I,n,f,m,r,c,l,_,y,!1,x,v,b,w);if(!i)return{notEnoughRoom:!0};if(o&&!n){let[a,n,o]=i.first.point,[s,l,u]=i.last.point;[a,n]=tz(a,n,o,h),[s,l]=tz(s,l,u,h);let c=tk(P,D,(s-a)*g,l-n);if(r.flipState=c&&c.needsFlipping?1:2,c)return c}L(i.first);for(let i=A+1;i<A+C-1;
8i++){let r=tj(T*u.getoffsetX(i),S,I,n,f,m,M,E,R,c,l,_,y,!1,!1,x,v,b,w);if(!r)return d.length-=4*(i-A),{notEnoughRoom:!0};L(r)}L(i.last)}else{if(o&&!n){let a=tz(m.x,m.y,0,s),n=E+M+1,o=new i.P(c.getx(n),c.gety(n)),l=tz(o.x,o.y,0,s),h=l[3]>0?l:tU(m,o,a,1,s,void 0,x,v.canonical),u=tk(P,D,(h[0]-a[0])*g,h[1]-a[1]);if(r.flipState=u&&u.needsFlipping?1:2,u)return u}let a=tj(T*u.getoffsetX(A),S,I,n,f,m,M,E,R,c,l,_,y,!1,!1,x,v,b,w);if(!a)return{notEnoughRoom:!0};L(a)}return{}}function tN(i,r,a,n,o){let{x:s,y:l,z:h}=n.projectTilePoint(i.x,i.y,r);if(!o)return tz(s,l,h,a);let[u,c,d]=o.getElevation(i,o.elevation,o.elevationFeature);return tz(s+u,l+c,h+d,a)}function tU(r,a,n,o,s,l,h,u){let c=tN(r.sub(a)._unit()._add(r),u,s,h,l);return i.ax(c,n,c),i.ay(c,c),i.bh(c,n,c,o)}function tj(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=o?r-a:r+a,T=w>0?1:-1,S=0;o&&(T*=-1,S=Math.PI),T<0&&(S+=Math.PI);let I=u+h+(T>0?0:1)|0,E=s,A=s,C=0,M=0,P=Math.abs(w),D=[],R=[],L=l,z=L,F=i.bf([]),O=()=>tU(z,L,A,P-C+1,p,m,y,x.canonical);for(;C+M<=P;){if((I+=T)<u||I>=c)return null;if(A=E,z=L,D.push(A),_&&R.push(z),L=new i.P(d.getx(I),d.gety(I)),!(E=f[I])){let i=tN(L,x.canonical,p,y,m);E=i[3]>0?f[I]=i:O()}C+=M;let r=i.ax([],E,A),a=i.bg(A,E);if(n&&a>0&&M>0&&i.bj(F,r)/(M*a)<b)return null;M=a,F=r}g&&m&&(f[I]&&(E=O(),M=i.bg(A,E),F=i.ax([],E,A)),f[I]=E);let B=(P-C)/M,k=L.sub(z)._mult(B)._add(z),V=i.bh([],A,F,B),N=[0,0,1],U=F[0],j=F[1];if(v&&(0!==(N=y.upVector(x.canonical,k.x,k.y))[0]||0!==N[1]||1!==N[2])){let r=[N[2],0,-N[0]],a=i.bi([],N,r);i.ay(r,r),i.ay(a,a),U=i.bj(F,r),j=i.bj(F,a)}if(n){let r=i.bi([],N,F);i.ay(r,r),i.bh(V,V,r,n*T)}let G=S+Math.atan2(j,U);return D.push(V),_&&R.push(k),{point:V,angle:G,path:D,tilePath:R,up:N}}function tG(i,r){let a=r.length,n=a+4*i;r.resize(n),r.float32.fill(-1/0,4*a,4*n)}function tq(i,r,a){let n=r[0],o=r[1];return i[0]=a[0]*n+a[4]*o+a[12],i[1]=a[1]*n+a[5]*o+a[13],i[3]=a[3]*n+a[7]*o+a[15],i}class t${constructor(i,r,a=new tM(i.width+200,i.height+200,25),n=new tM(i.width+200,i.height+200,25)){this.transform=i,this.grid=a,this.ignoredGrid=n,this.pitchfactor=Math.cos(i._pitch)*i.cameraToCenterDistance,this.screenRightBoundary=i.width+100,this.screenBottomBoundary=i.height+100,this.gridRightBoundary=i.width+200,this.gridBottomBoundary=i.height+200,this.fogState=r,this.clippedSymbols=new Map}clearClippedSymbolsForBucket(i){this.clippedSymbols.delete(i)}markSymbolAsClipped(i,r){let a=this.clippedSymbols.get(i);a||(a=new Set,this.clippedSymbols.set(i,a)),a.add(r)}placeCollisionBox(r,a,n,o,s,l,h,u,c,d,p){let f=n.projectedAnchorX,m=n.projectedAnchorY,_=n.projectedAnchorZ,g=n.tileAnchorX,y=n.tileAnchorY,x=n.elevation,v=n.tileID,b=r.getProjection();if(x&&v){let[i,r,a]=b.upVector(v.canonical,n.tileAnchorX,n.tileAnchorY),o=b.upVectorScale(v.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;f+=i*x*o,m+=r*x*o,_+=a*x*o}let w="globe"===r.projection.name,T="globe"===r.projection.name?i.al(this.transform.zoom):0;if(v&&w&&T<1&&!l){let r=1<<v.canonical.z,a=i.bp(g,y);i.bq(a,a,1/i.an),i.br(a,a,i.bp(v.canonical.x,v.canonical.y)),i.bq(a,a,1/r),i.bs(a,a,i.bp(o[0],o[1])),a[0]=i.bt(a[0],-.5,.5),i.bq(a,a,i.an);let n=i.bu(a[0],a[1],i.an/(2*Math.PI),1);i.aE(n,n,s),f=i.am(f,n[0],T),m=i.am(m,n[1],T),_=i.am(_,n[2],T)}let S=this.projectAndGetPerspectiveRatio(d,f,m,_,n.tileID,"globe"===b.name||!!x||this.transform.pitch>0,b),I=c*S.perspectiveRatio,E=(n.x1*a+h.x-n.padding)*I+S.point.x,A=(n.y1*a+h.y-n.padding)*I+S.point.y,C=(n.x2*a+h.x+n.padding)*I+S.point.x,M=(n.y2*a+h.y+n.padding)*I+S.point.y,P=S.perspectiveRatio<=.55||S.occluded;return!this.isInsideGrid(E,A,C,M)||!u&&this.grid.hitTest(E,A,C,M,p)||P?{box:[],offscreen:!1,occluded:S.occluded}:{box:[E,A,C,M],offscreen:this.isOffscreen(E,A,C,M),occluded:!1}}placeCollisionCircles(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=[],v=this.transform.elevation,b=r.getProjection(),w="road"===r.elevationType,T=!!v||w,S=i.bv.getAtTileOffsetFunc(y,this.transform.center.lat,this.transform.worldSize,b),I=new i.P(n.tileAnchorX,n.tileAnchorY),E=new i.P(n.tileAnchorX,n.tileAnchorY),{x:A,y:C,z:M}=b.projectTilePoint(E.x,E.y,y.canonical),P=null;if(T){let i=w?r.getElevationFeatureForText(o):null;P={getElevation:S,elevation:v,elevationFeature:i};let[a,n,s]=S(I,v,i);A+=a,C+=n,M+=s}let D="globe"===b.name,R=this.projectAndGetPerspectiveRatio(u,A,C,M,y,D||!!v||this.transform.pitch>0,b),{perspectiveRatio:L}=R,z=(f?h/L:h*L)/i.bz,F=tz(A,C,M,c),O=n.lineOffsetX*z,B=n.lineOffsetY*z,k=Math.cos(i.ap(r.layers[0].layout.get("text-max-angle"))),V=R.signedDistanceFromCamera>0?tB(z,l,O,B,w&&1===n.flipState,F,E,n,s,c,{},T&&!f?P:null,f&&T,b,y,f,k):null,N=!1,U=!1,j=!0;if(V&&!R.occluded){let r=.5*_*L+g,n=new i.P(-100,-100),o=new i.P(this.screenRightBoundary,this.screenBottomBoundary),s=new tC,{first:l,last:h}=V,u=l.path.length,c=[];for(let i=u-1;i>=1;i--)c.push(l.path[i]);for(let i=1;i<h.path.length;i++)c.push(h.path[i]);let f=2.5*r;d&&(c=c.map(([i,r,a],n)=>(T&&!D&&(a=S(n<u-1?l.tilePath[u-1-n]:h.tilePath[n-u+2],v,P.elevationFeature)[2]),tz(i,r,a,d)))).some(i=>i[3]<=0)&&(c=[]);let y=[];if(c.length>0){let r=1/0,a=-1/0,s=1/0,l=-1/0;for(let i of c)r=Math.min(r,i[0]),s=Math.min(s,i[1]),a=Math.max(a,i[0]),l=Math.max(l,i[1]);a>=n.x&&r<=o.x&&l>=n.y&&s<=o.y&&(y=[c.map(r=>new i.P(r[0],r[1]))],(r<n.x||a>o.x||s<n.y||l>o.y)&&(y=i.bw(y,n.x,n.y,o.x,o.y)))}for(let i of y){s.reset(i,.25*r);let n=0;n=s.length<=.5*r?1:Math.ceil(s.paddedLength/f)+1;for(let i=0;i<n;i++){let o=i/Math.max(n-1,1),l=s.lerp(o),h=l.x+100,u=l.y+100;x.push(h,u,r,0);let c=h-r,d=u-r,f=h+r,_=u+r;if(j=j&&this.isOffscreen(c,d,f,_),U=U||this.isInsideGrid(c,d,f,_),!a&&this.grid.hitTestCircle(h,u,r,m)&&(N=!0,!p))return{circles:[],offscreen:!1,collisionDetected:N,occluded:!1}}}}return{circles:(p||!N)&&U?x:[],offscreen:j,collisionDetected:N,occluded:R.occluded}}queryRenderedSymbols(r){if(0===r.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let a=[],n=1/0,o=1/0,s=-1/0,l=-1/0;for(let h of r){let r=new i.P(h.x+100,h.y+100);n=Math.min(n,r.x),o=Math.min(o,r.y),s=Math.max(s,r.x),l=Math.max(l,r.y),a.push(r)}let h=this.grid.query(n,o,s,l).concat(this.ignoredGrid.query(n,o,s,l)),u={},c={};for(let r of h){let n=r.key;if(void 0===u[n.bucketInstanceId]&&(u[n.bucketInstanceId]={}),u[n.bucketInstanceId][n.featureIndex])continue;
8let o=this.clippedSymbols.get(n.bucketInstanceId);if(o&&o.has(n.featureIndex))continue;let s=[new i.P(r.x1,r.y1),new i.P(r.x2,r.y1),new i.P(r.x2,r.y2),new i.P(r.x1,r.y2)];i.bx(a,s)&&(u[n.bucketInstanceId][n.featureIndex]=!0,void 0===c[n.bucketInstanceId]&&(c[n.bucketInstanceId]=[]),c[n.bucketInstanceId].push(n.featureIndex))}return c}insertCollisionBox(i,r,a,n,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:n,collisionGroupID:o},i[0],i[1],i[2],i[3])}insertCollisionCircles(i,r,a,n,o){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:a,featureIndex:n,collisionGroupID:o};for(let r=0;r<i.length;r+=4)s.insertCircle(l,i[r],i[r+1],i[r+2])}projectAndGetPerspectiveRatio(r,a,n,o,s,l,h){let u=[a,n,o,1],c=!1;if(o||this.transform.pitch>0){if(i.aE(u,u,r),this.fogState&&s&&"globe"!==h.name){var d,p,f;let r,l;d=this.fogState,p=s.toUnwrapped(),r=(f=this.transform).calculateFogTileMatrix(p),l=[a,n,o],i.ah(l,l,r),c=eZ(d,i.ai(l),f.pitch,f._fov)>.9}}else tq(u,u,r);let m=u[3];return{point:new i.P((u[0]/m+1)/2*this.transform.width+100,(-u[1]/m+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(h)/m*.5,1.5),signedDistanceFromCamera:m,occluded:l&&u[2]>m||c}}isOffscreen(i,r,a,n){return a<100||i>=this.screenRightBoundary||n<100||r>this.screenBottomBoundary}isInsideGrid(i,r,a,n){return a>=0&&i<this.gridRightBoundary&&n>=0&&r<this.gridBottomBoundary}getViewportMatrix(){let r=i.ba([]);return i.by(r,r,[-100,-100,0]),r}}class tH{constructor(i,r,a,n){this.opacity=i?Math.max(0,Math.min(1,i.opacity+(i.placed?r:-r))):n&&a?1:0,this.placed=a}isHidden(){return 0===this.opacity&&!this.placed}}class tZ{constructor(i,r,a,n,o,s=!1){this.text=new tH(i?i.text:null,r,a,o),this.icon=new tH(i?i.icon:null,r,n,o),this.clipped=s}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class tW{constructor(i,r,a,n=!1){this.text=i,this.icon=r,this.skipFade=a,this.clipped=n}}class tX{constructor(){this.invProjMatrix=i.bc(),this.viewportMatrix=i.bc(),this.circles=[]}}class tY{constructor(i,r,a,n,o){this.bucketInstanceId=i,this.featureIndex=r,this.sourceLayerIndex=a,this.bucketIndex=n,this.tileID=o}}class tK{constructor(i){this.crossSourceCollisions=i,this.maxGroupID=0,this.collisionGroups={}}get(i){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[i]){let r=++this.maxGroupID;this.collisionGroups[i]={ID:r,predicate:i=>i.collisionGroupID===r}}return this.collisionGroups[i]}}function tJ(r,a,n,o,s){let{horizontalAlign:l,verticalAlign:h}=i.bG(r),u=i.bH(r,o);return new i.P(-(l-.5)*a+u[0]*s,-(h-.5)*n+u[1]*s)}function tQ(r,a,n,o,s){let l=new i.P(r,a);return n&&l._rotate(o?s:-s),l}class t0{constructor(i,r,a,n,o,s){this.transform=i.clone(),this.projection=i.projection.name,this.collisionIndex=new t$(this.transform,o),this.buildingIndex=s,this.frontCutoffStart=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new tK(a),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(r,a,n,o,s=1){var l,h,u;let c=n.getBucket(a),d=n.latestFeatureIndex;if(!c||!d||a.fqid!==c.layerIds[0])return;let p=c.layers[0].layout,f=c.layers[0].paint,m=n.collisionBoxArray,_=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),g=n.tileSize/i.an,y=n.tileID.toUnwrapped();this.transform.setProjection(c.projection);let x=(l=n.tileID,h=c.getProjection(),u=this.transform,h.name===this.projection?u.calculateProjMatrix(l.toUnwrapped()):tE(u,h,l)),v="map"===p.get("text-pitch-alignment"),b="map"===p.get("text-rotation-alignment");a.compileFilter(a.options);let w=a.dynamicFilter(),T=a.dynamicFilterNeedsFeature(),S=a.dynamicFilterNeedsGeometry(),I=this.transform.calculatePixelsToTileUnitsMatrix(n),E=tR(x,n.tileID.canonical,v,b,this.transform,c.getProjection(),I),A=null,C=c.getProjection().createInversionMatrix(this.transform,n.tileID.canonical);if(v){let r=tL(x,n.tileID.canonical,v,b,this.transform,c.getProjection(),I);
8A=i.aD([],this.transform.labelPlaneMatrix,r)}let M=null;w&&n.latestFeatureIndex&&(M={unwrappedTileID:y,dynamicFilter:w,dynamicFilterNeedsFeature:T,needGeometry:S}),this.retainedQueryData[c.bucketInstanceId]=new tY(c.bucketInstanceId,d,c.sourceLayerIndex,c.index,n.tileID);let[P,D]=c.layers[0].layout.get("text-size-scale-range"),R=i.aC(s,P,D),[L,z]=p.get("icon-size-scale-range"),F=i.aC(s,L,z),O={bucket:c,layout:p,paint:f,posMatrix:x,invMatrix:C,mercatorCenter:[i.aH(this.transform.center.lng),i.aL(this.transform.center.lat)],textLabelPlaneMatrix:E,labelToScreenMatrix:A,clippingData:M,scale:_,textPixelRatio:g,holdingForFade:n.holdingForFade(),collisionBoxArray:m,partiallyEvaluatedTextSize:i.bk(c.textSizeData,this.transform.zoom,R),partiallyEvaluatedIconSize:i.bk(c.iconSizeData,this.transform.zoom,F),collisionGroup:this.collisionGroups.get(c.sourceID),latestFeatureIndex:n.latestFeatureIndex};if(o)for(let i of c.sortKeyRanges){let{sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:o}=i;r.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:o,parameters:O})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:O})}attemptAnchorPlacement(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let{textOffset0:T,textOffset1:S,crossTileID:I}=_,E=[T,S],A=tJ(i,s,l,E,h),C=this.collisionIndex.placeCollisionBox(y,h,r,a,n,o,tQ(A.x,A.y,u,c,this.transform.angle),m,d,p,f.predicate);if(v){let i=y.getSymbolInstanceIconSize(w,this.transform.zoom,_.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(y,i,v,a,n,o,tQ(A.x,A.y,u,c,this.transform.angle),m,d,p,f.predicate).box.length)return}if(C.box.length>0){let r;return this.prevPlacement&&this.prevPlacement.variableOffsets[I]&&this.prevPlacement.placements[I]&&this.prevPlacement.placements[I].text&&(r=this.prevPlacement.variableOffsets[I].anchor),this.variableOffsets[I]={textOffset:E,width:s,height:l,anchor:i,textScale:h,prevAnchor:r},this.markUsedJustification(y,i,_,x),y.allowVerticalPlacement&&(this.markUsedOrientation(y,x,_),this.placedOrientations[I]=x),{shift:A,placedGlyphBoxes:C}}}placeLayerBucketPart(r,a,n,o,s=1){let{bucket:l,layout:h,paint:u,posMatrix:c,textLabelPlaneMatrix:d,labelToScreenMatrix:p,clippingData:f,textPixelRatio:m,mercatorCenter:_,invMatrix:g,holdingForFade:y,collisionBoxArray:x,partiallyEvaluatedTextSize:v,partiallyEvaluatedIconSize:b,collisionGroup:w,latestFeatureIndex:T}=r.parameters,S=h.get("text-optional"),I=h.get("icon-optional"),E=h.get("text-allow-overlap"),A=h.get("icon-allow-overlap"),C="map"===h.get("text-rotation-alignment"),M="map"===h.get("icon-rotation-alignment"),P="map"===h.get("text-pitch-alignment"),D=u.get("symbol-z-offset"),R="sea"===h.get("symbol-elevation-reference"),L=h.get("symbol-placement"),[z,F]=h.get("text-size-scale-range"),[O,B]=h.get("icon-size-scale-range"),k=i.aC(s,z,F),V=i.aC(s,O,B),N=h.get("text-variable-anchor"),U=C&&"point"!==L,j=N&&l.hasTextData(),G=l.hasIconTextFit()&&j&&l.hasIconData();this.transform.setProjection(l.projection);let q=j||U,$=M&&"point"!==L||G,H=E&&(A||!l.hasIconData()||I),Z=A&&(E||!l.hasTextData()||S),W=!D.isConstant();!l.collisionArrays&&x&&l.deserializeCollisionBoxes(x),n&&o&&l.updateCollisionDebugBuffers(this.transform.zoom,x,k,V);let X=(r,o,s)=>{let{crossTileID:u,numVerticalGlyphVertices:x}=r,M=null;if(f&&f.dynamicFilterNeedsFeature||W){let a=this.retainedQueryData[l.bucketInstanceId],n=T.loadFeature({featureIndex:r.featureIndex,bucketIndex:a.bucketIndex,sourceLayerIndex:a.sourceLayerIndex,layoutVertexArrayOffset:0}),o=n.properties?n.properties.worldview:null;if(l.localizable&&l.worldview&&"string"==typeof o)if("all"===o)n.properties.$localized=!0;else{if(!o.split(",").includes(l.worldview))return;n.properties.$localized=!0,n.properties.worldview=l.worldview}M=f&&f.needGeometry?i.bE(n,!0):n}if(f&&!(0,f.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:l.worldview},M,this.retainedQueryData[l.bucketInstanceId].tileID.canonical,new i.P(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(f.unwrappedTileID)))return this.placements[u]=new tW(!1,!1,!1,!0),void a.add(u);let L=D.evaluate(M,{});if((r.zOffset||0)+(L||0)>
80&&this.frontCutoffStart>0){let n=2*this.frontCutoffStart-1,o=[r.tileAnchorX,r.tileAnchorY,0,1],s=i.aE(i.bF(),o,c);if(s[1]/s[3]<n)return this.placements[u]=new tW(!1,!1,!1,!0),void a.add(u)}if(a.has(u))return;if(y)return void(this.placements[u]=new tW(!1,!1,!1));let z=!1,F=!1,O=!0,B=!1,k=!1,V=null,U={box:null,offscreen:null,occluded:null},j={box:null},G=null,X=null,Y=null,K=0,J=0,Q=0;s.textFeatureIndex?K=s.textFeatureIndex:r.useRuntimeCollisionCircles&&(K=r.featureIndex),s.verticalTextFeatureIndex&&(J=s.verticalTextFeatureIndex);let ee=l.elevationFeatures?l.elevationFeatures[r.elevationFeatureIndex]:void 0,et=a=>{a.tileID=this.retainedQueryData[l.bucketInstanceId].tileID;let n=this.transform.elevation;a.elevation=R?L:L+i.bv.getAtTileOffset(a.tileID,new i.P(a.tileAnchorX,a.tileAnchorY),n,ee),a.elevation+=r.zOffset},ei=s.textBox;if(ei){et(ei);let a=a=>{let n=i.bl.horizontal;if(l.allowVerticalPlacement&&!a&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[u];i&&(this.placedOrientations[u]=i,n=i,this.markUsedOrientation(l,n,r))}return n},n=(r,a)=>{if(l.allowVerticalPlacement&&x>0&&s.verticalTextBox){for(let n of l.writingModes)if(n===i.bl.vertical?j=U=a():U=r(),U&&U.box&&U.box.length)break}else U=r()};if(N){let h=N;if(this.prevPlacement&&this.prevPlacement.variableOffsets[u]){let i=this.prevPlacement.variableOffsets[u];h.indexOf(i.anchor)>0&&(h=h.filter(r=>r!==i.anchor)).unshift(i.anchor)}let d=(i,a,n)=>{let s=l.getSymbolInstanceTextSize(v,r,this.transform.zoom,o),u=(i.x2-i.x1)*s+2*i.padding,d=(i.y2-i.y1)*s+2*i.padding,p=r.hasIconTextFit&&!A?a:null;p&&et(p);let f={box:[],offscreen:!1,occluded:!1},y=E?2*h.length:h.length;for(let a=0;a<y;++a){let y=this.attemptAnchorPlacement(h[a%h.length],i,_,g,q,u,d,s,C,P,m,c,w,a>=h.length,r,o,l,n,p,v,b);if(y&&(f=y.placedGlyphBoxes)&&f.box&&f.box.length){z=!0,V=y.shift;break}}return f};n(()=>d(ei,s.iconBox,i.bl.horizontal),()=>{let r=s.verticalTextBox;return r&&et(r),l.allowVerticalPlacement&&!(U&&U.box&&U.box.length)&&x>0&&r?d(r,s.verticalIconBox,i.bl.vertical):{box:null,offscreen:null,occluded:null}}),U&&(z=U.box,O=U.offscreen,B=U.occluded);let p=a(!(!U||!U.box));if(!z&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[u];i&&(this.variableOffsets[u]=i,this.markUsedJustification(l,i.anchor,r,p))}}else{let h=(a,n)=>{let s=l.getSymbolInstanceTextSize(v,r,this.transform.zoom,o),h=this.collisionIndex.placeCollisionBox(l,s,a,_,g,q,new i.P(0,0),E,m,c,w.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(l,n,r),this.placedOrientations[u]=n),h};n(()=>h(ei,i.bl.horizontal),()=>{let r=s.verticalTextBox;return l.allowVerticalPlacement&&x>0&&r?(et(r),h(r,i.bl.vertical)):{box:null,offscreen:null,occluded:null}}),a(!!(U&&U.box&&U.box.length))}}if(z=(G=U)&&G.box&&G.box.length>0,O=G&&G.offscreen,B=G&&G.occluded,r.useRuntimeCollisionCircles){let a=r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex,o=l.text.placedSymbolArray.get(a),s=i.bm(l.textSizeData,v,o),u=h.get("text-padding");X=this.collisionIndex.placeCollisionCircles(l,E,o,a,l.lineVertexArray,l.glyphOffsetArray,s,c,d,p,n,P,w.predicate,r.collisionCircleDiameter*s/i.bz,u,this.retainedQueryData[l.bucketInstanceId].tileID),z=E||X.circles.length>0&&!X.collisionDetected,O=O&&X.offscreen,B=X.occluded}if(s.iconFeatureIndex&&(Q=s.iconFeatureIndex),s.iconBox){let a=a=>{et(a);let n=r.hasIconTextFit&&V?tQ(V.x,V.y,C,P,this.transform.angle):new i.P(0,0),o=l.getSymbolInstanceIconSize(b,this.transform.zoom,r.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(l,o,a,_,g,$,n,A,m,c,w.predicate)};F=j&&j.box&&j.box.length&&s.verticalIconBox?(Y=a(s.verticalIconBox)).box.length>0:(Y=a(s.iconBox)).box.length>0,O=O&&Y.offscreen,k=Y.occluded}let er=S||0===r.numHorizontalGlyphVertices&&0===x,ea=I||0===r.numIconVertices;if(er||ea?ea?er||(F=F&&z):z=F&&z:F=z=F&&z,z&&G&&G.box&&this.collisionIndex.insertCollisionBox(G.box,h.get("text-ignore-placement"),l.bucketInstanceId,j&&j.box&&J?J:K,w.ID),F&&Y&&this.collisionIndex.insertCollisionBox(Y.box,h.get("icon-ignore-placement"),l.bucketInstanceId,Q,w.ID),X&&(z&&this.collisionIndex.insertCollisionCircles(X.circles,h.get("text-ignore-placement"),l.bucketInstanceId,K,w.ID),n)){let i=l.bucketInstanceId,r=this.collisionCircleArrays[i];void 0===r&&(r=this.collisionCircleArrays[i]=new tX);for(let i=0;i<X.circles.length;i+=4)r.circles.push(X.circles[i+0]),r.circles.push(X.circles[i+1]),r.circles.push(X.circles[i+2]),r.circles.push(+!!X.collisionDetected)}let en="globe"!==l.projection.name;
8H=H&&(en||!B),Z=Z&&(en||!k),this.placements[u]=new tW(z||H,F||Z,O||l.justReloaded),a.add(u)},Y=this.retainedQueryData[l.bucketInstanceId].tileID;if("offset"===l.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(l,Y),"road"===l.elevationType&&l.updateRoadElevation(Y.canonical),l.updateZOffset(),l.sortFeaturesByY){let r=l.getSortedSymbolIndexes(this.transform.angle);for(let i=r.length-1;i>=0;--i){let a=r[i];X(l.symbolInstances.get(a),a,l.collisionArrays[a])}l.hasAnyZOffset&&i.w(`${l.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(l.hasAnyZOffset){let i=l.getSortedIndexesByZOffset();for(let r=0;r<i.length;++r){let a=i[r];X(l.symbolInstances.get(a),a,l.collisionArrays[a])}}else for(let i=r.symbolInstanceStart;i<r.symbolInstanceEnd;i++)X(l.symbolInstances.get(i),i,l.collisionArrays[i]);if(n&&l.bucketInstanceId in this.collisionCircleArrays){let r=this.collisionCircleArrays[l.bucketInstanceId];i.b8(r.invProjMatrix,c),r.viewportMatrix=this.collisionIndex.getViewportMatrix()}l.justReloaded=!1}markUsedJustification(r,a,n,o){let{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u,crossTileID:c}
8=n,d=i.bI(a),p=o===i.bl.vertical?u:"left"===d?s:"center"===d?l:"right"===d?h:-1;s>=0&&(r.text.placedSymbolArray.get(s).crossTileID=p>=0&&s!==p?0:c),l>=0&&(r.text.placedSymbolArray.get(l).crossTileID=p>=0&&l!==p?0:c),h>=0&&(r.text.placedSymbolArray.get(h).crossTileID=p>=0&&h!==p?0:c),u>=0&&(r.text.placedSymbolArray.get(u).crossTileID=p>=0&&u!==p?0:c)}markUsedOrientation(r,a,n){let o=a===i.bl.horizontal||a===i.bl.horizontalOnly?a:0,s=a===i.bl.vertical?a:0,{leftJustifiedTextSymbolIndex:l,centerJustifiedTextSymbolIndex:h,rightJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:c}=n,d=r.text.placedSymbolArray;l>=0&&(d.get(l).placedOrientation=o),h>=0&&(d.get(h).placedOrientation=o),u>=0&&(d.get(u).placedOrientation=o),c>=0&&(d.get(c).placedOrientation=s)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;let r=this.prevPlacement,a=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;let n=r?r.symbolFadeChange(i):1,o=r?r.opacities:{},s=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(let i in this.placements){let r=this.placements[i],s=o[i];s?(this.opacities[i]=new tZ(s,n,r.text,r.icon,null,r.clipped),a=a||r.text!==s.text.placed||r.icon!==s.icon.placed):(this.opacities[i]=new tZ(null,n,r.text,r.icon,r.skipFade,r.clipped),a=a||r.text||r.icon)}for(let i in o){let r=o[i];if(!this.opacities[i]){let o=new tZ(r,n,!1,!1);o.isHidden()||(this.opacities[i]=o,a=a||r.text.placed||r.icon.placed)}}for(let i in s)this.variableOffsets[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.variableOffsets[i]=s[i]);for(let i in l)this.placedOrientations[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.placedOrientations[i]=l[i]);a?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r,a,n){n&&(this.lastReplacementSourceUpdateTime=n.updateTime);let o=new Set;for(let s of r){let r=s.getBucket(i);r&&s.latestFeatureIndex&&i.fqid===r.layerIds[0]&&(this.updateBucketOpacities(r,o,s,s.collisionBoxArray,a,n,s.tileID,i.scope),"offset"===r.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(r,s.tileID),"road"===r.elevationType&&r.updateRoadElevation(s.tileID.canonical),r.updateZOffset())}}updateBucketOpacities(r,a,n,o,s,l,h,u){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();let c=r.layers[0].layout,d=r.layers[0].paint,p=!!r.layers[0].dynamicFilter(),f=new tZ(null,0,!1,!1,!0),m=c.get("text-allow-overlap"),_=c.get("icon-allow-overlap"),g=c.get("text-variable-anchor"),y="map"===c.get("text-rotation-alignment"),x="map"===c.get("text-pitch-alignment"),v=d.get("symbol-z-offset"),b="sea"===c.get("symbol-elevation-reference"),w=!v.isConstant(),T=new tZ(null,0,m&&(_||!r.hasIconData()||c.get("icon-optional")),_&&(m||!r.hasTextData()||c.get("text-optional")),!0);!r.collisionArrays&&o&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(o);let S=(i,r,a)=>{for(let n=0;n<r/4;n++)i.opacityVertexArray.emplaceBack(a)},I=0;l&&r.updateReplacement(h,l),this.collisionIndex.clearClippedSymbolsForBucket(r.bucketInstanceId);for(let o=0;o<r.symbolInstances.length;o++){let c=r.symbolInstances.get(o),{numHorizontalGlyphVertices:d,numVerticalGlyphVertices:m,crossTileID:_,numIconVertices:E,tileAnchorX:A,tileAnchorY:C}=c,M=null,P=this.retainedQueryData[r.bucketInstanceId];w&&c&&P&&(M=n.latestFeatureIndex.loadFeature({featureIndex:c.featureIndex,bucketIndex:P.bucketIndex,sourceLayerIndex:P.sourceLayerIndex,layoutVertexArrayOffset:0}));let D=v.evaluate(M,{}),R=a.has(_),L=this.opacities[_];
8R?L=f:L||(L=T,this.opacities[_]=L),a.add(_);let z=d>0||m>0,F=E>0,O=this.placedOrientations[_],B=O===i.bl.vertical,k=O===i.bl.horizontal||O===i.bl.horizontalOnly;!z&&!F||L.isHidden()||I++;let V=!1;if((z||F)&&l)for(let a of r.activeReplacements){if(i.bA(a,s,i.bB.Symbol,u)||a.min.x>A||A>a.max.x||a.min.y>C||C>a.max.y)continue;let r=i.bC(A,C,h.canonical,a.footprintTileId.canonical);if(V=i.bD(r,a.footprint))break}if(V&&this.collisionIndex.markSymbolAsClipped(r.bucketInstanceId,c.featureIndex),z){let i=V?t3:t2(L.text);S(r.text,d,B?t3:i),S(r.text,m,k?t3:i);let a=L.text.isHidden(),{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:l}=c,h=r.text.placedSymbolArray,u=a||B?1:0;n>=0&&(h.get(n).hidden=u),o>=0&&(h.get(o).hidden=u),s>=0&&(h.get(s).hidden=u),l>=0&&(h.get(l).hidden=a||k?1:0);let p=this.variableOffsets[_];p&&this.markUsedJustification(r,p.anchor,c,O);let f=this.placedOrientations[_];f&&(this.markUsedJustification(r,"left",c,f),this.markUsedOrientation(r,f,c))}if(F){let i=V?t3:t2(L.icon),{placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:n}=c,o=r.icon.placedSymbolArray,s=+!!L.icon.isHidden();a>=0&&(S(r.icon,E,B?t3:i),o.get(a).hidden=s),n>=0&&(S(r.icon,c.numVerticalIconVertices,k?t3:i),o.get(n).hidden=s)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){let a=r.collisionArrays[o];if(a){let n=new i.P(0,0),o=!0;if(a.textBox||a.verticalTextBox){if(g){let i=this.variableOffsets[_];i?(n=tJ(i.anchor,i.width,i.height,i.textOffset,i.textScale),y&&n._rotate(x?this.transform.angle:-this.transform.angle)):o=!1}p&&(o=!L.clipped),a.textBox&&t1(r.textCollisionBox.collisionVertexArray,L.text.placed,!o||B,D,b,n.x,n.y),a.verticalTextBox&&t1(r.textCollisionBox.collisionVertexArray,L.text.placed,!o||k,D,b,n.x,n.y)}let s=o&&!!(!k&&a.verticalIconBox);a.iconBox&&t1(r.iconCollisionBox.collisionVertexArray,L.icon.placed,s,D,b,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0),a.verticalIconBox&&t1(r.iconCollisionBox.collisionVertexArray,L.icon.placed,!s,D,b,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0)}}}if(r.fullyClipped=0===I,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=i.invProjMatrix,r.placementViewportMatrix=i.viewportMatrix,r.collisionCircleArray=i.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return i-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(i,r){let a=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*a>i}isStale(){return this.stale}setStale(){this.stale=!0}}function t1(i,r,a,n,o,s,l){i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o)}function t2(i){if(0===i.opacity&&!i.placed)return 0;if(1===i.opacity&&i.placed)return 0xffffffff;let r=+!!i.placed,a=Math.floor(127*i.opacity);return 0x2000000*a+0x1000000*r+131072*a+65536*r+512*a+256*r+2*a+r}let t3=0;class t5{constructor(i){this._sortAcrossTiles="viewport-y"!==i.layout.get("symbol-z-order")&&void 0!==i.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(i,r,a,n,o,s){let l=this._bucketParts;for(;this._currentTileIndex<i.length;)if(r.getBucketParts(l,n,i[this._currentTileIndex],this._sortAcrossTiles,s),this._currentTileIndex++,o())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,l.sort((i,r)=>i.sortKey-r.sortKey));this._currentPartIndex<l.length;){let i=l[this._currentPartIndex];if(r.placeLayerBucketPart(i,this._seenCrossTileIDs,a,0===i.symbolInstanceStart,s),this._currentPartIndex++,o())return!0}return!1}}class t4{startNewPlacement(i,r,a,n,o,s,l,h){return this.placement=new t0(i,n,o,s,l,h),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=a,this._fadeDuration=n,this._done=!1,this._inProgressLayer=null,this}requestFullPlacement(){this._forceFullPlacement=!0}isFullPlacementRequested(){return this._forceFullPlacement}setStale(){this.placement&&(this.placement.stale=!0)}isStale(){return!!this.placement&&this.placement.stale}isDone(){return this._done}continuePlacement(r,a,n,o,s){let l=i.o.now(),h=()=>{let r=i.o.now()-l;return!this.isFullPlacementRequested()&&0!==this._fadeDuration&&r>2};for(;this._currentPlacementIndex>=0;){let l=a[r[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&"none"!==l.visibility&&(!l.minzoom||l.minzoom<=u)&&(!l.maxzoom||l.maxzoom>u)){let r=l.layout.get("symbol-z-elevate"),a=void 0!==l.layout.get("symbol-sort-key").constantOr(1),u=l.layout.get("symbol-z-order"),c="viewport-y"===u||"auto"===u&&!("viewport-y"!==u&&a),d=l.layout.get("text-allow-overlap")||l.layout.get("icon-allow-overlap")||l.layout.get("text-ignore-placement")||l.layout.get("icon-ignore-placement"),p=c&&d,f=this._inProgressLayer=this._inProgressLayer||new t5(l),m=i.F(l.source,l.scope);if(f.continuePlacement(r||p?o[m]:n[m],this.placement,this._showCollisionBoxes,l,h,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(i){return this.placement.commit(i),this.placement}}let t6=512/i.an/2;class t8{constructor(r,a,n){this.tileID=r,this.bucketInstanceId=n,this.index=new i.bJ(a.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const o=r.canonical.x*i.an,s=r.canonical.y*i.an;for(let i=0;i<a.length;i++){const{key:r,crossTileID:n,tileAnchorX:l,tileAnchorY:h}
8=a.get(i),u=Math.floor((o+l)*t6),c=Math.floor((s+h)*t6);this.index.add(u,c),this.keys.push(r),this.crossTileIDs.push(n)}this.index.finish()}findMatches(r,a,n){let o=this.tileID.canonical.z<a.canonical.z?1:Math.pow(2,this.tileID.canonical.z-a.canonical.z),s=t6/Math.pow(2,a.canonical.z-this.tileID.canonical.z),l=a.canonical.x*i.an,h=a.canonical.y*i.an;for(let i=0;i<r.length;i++){let a=r.get(i);if(a.crossTileID)continue;let{key:u,tileAnchorX:c,tileAnchorY:d}=a,p=Math.floor((l+c)*s),f=Math.floor((h+d)*s);for(let i of this.index.range(p-o,f-o,p+o,f+o).sort((i,r)=>i-r)){let r=this.crossTileIDs[i];if(this.keys[i]===u&&!n.has(r)){n.add(r),a.crossTileID=r;break}}}}}class t9{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class t7{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){let r=Math.round((i-this.lng)/360);if(0!==r)for(let i in this.indexes){let a=this.indexes[i],n={};for(let i in a){let o=a[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),n[o.tileID.key]=o}this.indexes[i]=n}this.lng=i}addBucket(i,r,a){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let i=0;i<r.symbolInstances.length;i++)r.symbolInstances.get(i).crossTileID=0;this.usedCrossTileIDs[i.overscaledZ]||(this.usedCrossTileIDs[i.overscaledZ]=new Set);let n=this.usedCrossTileIDs[i.overscaledZ];for(let a in this.indexes){let o=this.indexes[a];if(Number(a)>i.overscaledZ)for(let a in o){let s=o[a];s.tileID.isChildOf(i)&&s.findMatches(r.symbolInstances,i,n)}else{let s=o[i.scaledTo(Number(a)).key];s&&s.findMatches(r.symbolInstances,i,n)}}for(let i=0;i<r.symbolInstances.length;i++){let o=r.symbolInstances.get(i);o.crossTileID||(o.crossTileID=a.generate(),n.add(o.crossTileID))}return void 0===this.indexes[i.overscaledZ]&&(this.indexes[i.overscaledZ]={}),this.indexes[i.overscaledZ][i.key]=new t8(i,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(i,r){for(let a of r.crossTileIDs)this.usedCrossTileIDs[i].delete(a)}removeStaleBuckets(i){let r=!1;for(let a in this.indexes){let n=this.indexes[a];for(let o in n)i[n[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,n[o]),delete n[o],r=!0)}return r}}class ie{constructor(){this.layerIndexes={},this.crossTileIDs=new t9,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(i,r,a,n){let o=this.layerIndexes[i.fqid];void 0===o&&(o=this.layerIndexes[i.fqid]=new t7);let s=!1,l={};for(let h of("globe"!==n.name&&o.handleWrapJump(a),r)){let r=h.getBucket(i);r&&i.fqid===r.layerIds[0]&&(r.bucketInstanceId||(r.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(h.tileID,r,this.crossTileIDs)&&(s=!0),l[r.bucketInstanceId]=!0)}return o.removeStaleBuckets(l)&&(s=!0),s}pruneUnusedLayers(i){let r={};for(let a in i.forEach(i=>{r[i]=!0}),this.layerIndexes)r[a]||delete this.layerIndexes[a]}}class it{constructor(i,r,a,n){this.blendFunction=i,this.blendColor=r.toNonPremultipliedRenderColor(null),this.mask=a,this.blendEquation=n}}it.Replace=[1,0,1,0],it.disabled=new it(it.Replace,i.aq.transparent,[!1,!1,!1,!1]),it.unblended=new it(it.Replace,i.aq.transparent,[!0,!0,!0,!0]),it.alphaBlended=new it([1,771,1,771],i.aq.transparent,[!0,!0,!0,!0]),it.alphaBlendedNonPremultiplied=new it([770,771,770,771],i.aq.transparent,[!0,!0,!0,!0]),it.multiply=new it([774,0,774,0],i.aq.transparent,[!0,!0,!0,!0]),it.multiplyAccumulateAlpha=new it([774,0,1,771],i.aq.transparent,[!0,!0,!0,!0]),it.additive=new it([1,1,1,1],i.aq.transparent,[!0,!0,!0,!0]);class ii{constructor(i,r,a){this.func=i,this.mask=r,this.range=a}}ii.ReadOnly=!1,ii.ReadWrite=!0,ii.disabled=new ii(519,ii.ReadOnly,[0,1]);class ir{constructor(i,r,a,n,o,s){this.test=i,this.ref=r,this.mask=a,this.fail=n,this.depthFail=o,this.pass=s}}ir.disabled=new ir({func:519,mask:0},0,0,7680,7680,7680);class ia{constructor(i,r,a){this.enable=i,this.mode=r,this.frontFace=a}}function io(r,a){let n=i.bP(r,3);i.bS(r,a),i.bX(r,3,n)}function is(r,a){let n=i.bM([]);return i.bN(n,n,-a),i.bO(n,n,-r),n}function il(r,a){let n=[r[0],r[1],0],o=[a[0],a[1],0];if(i.ai(n)>=1e-15){let r=i.ay([],n);i.bK(o,r,i.bj(o,r)),a[0]=o[0],a[1]=o[1]}let s=i.bi([],a,r);if(1e-15>i.bL(s))return null;let l=Math.atan2(-s[1],s[0]);return is(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),l)}ia.disabled=new ia(!1,1029,2305),ia.backCCW=new ia(!0,1029,2305),ia.backCW=new ia(!0,1029,2304),ia.frontCW=new ia(!0,1028,2304),ia.frontCCW=new ia(!0,1028,2305);class ih{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){if(r){let a=r instanceof i.ag?r:new i.ag(r[0],r[1],r[2]);
8this._renderWorldCopies&&(a.x=i.bt(a.x,0,1)),this._position=a}else this._position=null}lookAtPoint(r,a,n){if(this.orientation=null,!this.position)return;let o=this.position,s=n||(this._elevation?this._elevation.getAtPointOrZero(i.ag.fromLngLat(r)):0),l=i.ag.fromLngLat(r,s),h=[l.x-o.x,l.y-o.y,l.z-o.z];a||(a=[0,0,1]),a[2]=Math.abs(a[2]),this.orientation=il(h,a)}setPitchBearing(r,a){this.orientation=is(i.ap(r),i.ap(-a))}}class iu{constructor(r,a){this._transform=i.ba([]),this.orientation=a,this.position=r}get mercatorPosition(){let r=this.position;return new i.ag(r[0],r[1],r[2])}get position(){let r=i.bP(this._transform,3);return[r[0],r[1],r[2]]}set position(r){r&&i.bX(this._transform,3,[r[0],r[1],r[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||i.bM([]),r&&io(this._transform,this._orientation)}getPitchBearing(){let i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=is(i,r),io(this._transform,this._orientation)}forward(){let r=i.bP(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){let r=i.bP(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){let r=i.bP(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,a){let n=new Float64Array(16);return i.b8(n,this.getWorldToCamera(r,a)),n}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,a,n){let o=this.position;i.bK(o,o,-r);let s=new Float64Array(16);return i.bQ(s,[n,n,n]),i.by(s,s,o),s[10]*=a,s}getWorldToCamera(r,a){let n=new Float64Array(16),o=new Float64Array(4),s=this.position;return i.bR(o,this._orientation),i.bK(s,s,-r),i.bS(n,o),i.by(n,n,s),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=a,n[9]*=a,n[10]*=a,n[11]*=a,n}getCameraToClipPerspective(r,a,n,o){let s=new Float64Array(16);return i.bT(s,r,a,n,o),s}getCameraToClipOrthographic(r,a,n,o,s,l){let h=new Float64Array(16);return i.bU(h,r,a,n,o,s,l),h}getDistanceToElevation(r,a=!1){let n=0===r?0:i.bV(r,a?i.bW(this.position[1]):this.position[1]),o=this.forward();return(n-this.position[2])/o[2]}clone(){return new iu([...this.position],[...this.orientation])}}let ic=(i,r)=>({u_matrix:i,u_ground_shadow_factor:r});class id{constructor(i=0,r=0,a=0,n=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0||isNaN(n)||n<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=a,this.right=n}interpolate(r,a,n){return null!=a.top&&null!=r.top&&(this.top=i.am(r.top,a.top,n)),null!=a.bottom&&null!=r.bottom&&(this.bottom=i.am(r.bottom,a.bottom,n)),null!=a.left&&null!=r.left&&(this.left=i.am(r.left,a.left,n)),null!=a.right&&null!=r.right&&(this.right=i.am(r.right,a.right,n)),this}getCenter(r,a){let n=i.aC((this.left+r-this.right)/2,0,r),o=i.aC((this.top+a-this.bottom)/2,0,a);return new i.P(n,o)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new id(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ip{constructor(r,a,n,o,s,l,h){this.tileSize=512,this._renderWorldCopies=void 0===s||s,this._minZoom=r||0,this._maxZoom=a||22,this._minPitch=n??0,this._maxPitch=o??60,this.setProjection(l),this.setMaxBounds(h),this.width=0,this.height=0,this._center=new i.aV(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._nearClipOffset=0,this._unmodified=!0,this._edgeInsets=new id,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new iu,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){let i=new ip(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i._centerAltitudeValidForE
8xaggeration=this._centerAltitudeValidForExaggeration,i.tileSize=this.tileSize,i.mercatorFromTransition=this.mercatorFromTransition,i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._seaLevelZoom=this._seaLevelZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._nearClipOffset=this._nearClipOffset,i._averageElevation=this._averageElevation,i._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i.frustumCorners=this.frustumCorners,i._allowWorldUnderZoom=this._allowWorldUnderZoom,i}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,this._updateCameraOnTerrain(),this._calcMatrices())}get nearClipOffset(){return this._nearClipOffset}set nearClipOffset(i){this._nearClipOffset=i,this._calcMatrices()}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(i,r=!1){let a=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
8xaggeration;(null==this._seaLevelZoom||a)&&this._updateCameraOnTerrain(),(i||a)&&this._constrainCamera(r),this._calcMatrices()}getProjection(){return i.aJ(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};let a=this.projection?this.getProjection():void 0;this.projection=i.c1(this.projectionOptions);let n=this.getProjection(),o=!i.b7(a,n);return o&&this._calcMatrices(),this.mercatorFromTransition=!1,o}setOrthographicProjectionAtLowPitch(i){return this._orthographicProjectionAtLowPitch!==i&&(this._orthographicProjectionAtLowPitch=i,this._calcMatrices(),!0)}setMercatorFromTransition(){let r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=i.c1({name:"mercator"});let a=r!==this.projection.name;return a&&this._calcMatrices(),a}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){let i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get cameraWorldSize(){let i=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return i.bV(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.P(this.width,this.height)}get bearing(){return i.bt(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(r){let a=-r*Math.PI/180;this.angle!==a&&(this._unmodified=!1,this.angle=a,this._calcMatrices(),this.rotationMatrix=i.c2(),i.c3(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){let a=i.aC(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=i.ap(r),this._calcMatrices())}get fovX(){return this._fov}get fovY(){let i=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/i)}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(i){let r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(i){this._tileCoverLift!==i&&(this._tileCoverLift=i)}_updateCameraOnTerrain(){let i=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),-1/0):-1/0,r=this.elevation&&i===-1/0&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||i===-1/0&&(!r||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);let a=this._elevation;r||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&a.exaggeration()&&this._centerAltitudeValidForExaggeration!==a.exaggeration()?this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*a.exaggeration():this._centerAltitude=i||0,this._centerAltitudeValidForExaggeration=a.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(void 0===this._centerAltitudeValidForExaggeration)return;let i=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(i)}sampleAverageElevation(){if(!this._elevation)return 0;let r=this._elevation,a=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],n=this.horizonLineFromTop(),o=0,s=0;for(let l=0;l<a.length;l++){let h=new i.P(a[l][0]*this.width,n+a[l][1]*(this.height-n)),u=r.pointCoordinate(h);if(!u)continue;let c=1/Math.hypot(u[0]-this._camera.position[0],u[1]-this._camera.position[1]);o+=u[3]*c,s+=c}return 0===s?NaN:o/s}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let i=this._seaLevelZoom,r=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),a=this.pixelsPerMeter/this.worldSize*r,n=Math.max(this._mercatorZfromZoom(i)-a,this._mercatorZfromZoom(this._maxZoom));this._setZoom(this._zoomFromMercatorZ(n))}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}equals(i){let r=this.elevation,a=i.elevation,n=null!=r!=(null!=a)||r&&a&&r.exaggeration()!==a.exaggeration();return this.width===i.width&&this.height===i.height&&this.center.lng===i.center.lng&&this.center.lat===i.center.lat&&this.zoom===i.zoom&&this.bearing===i.bearing&&this.pitch===i.pitch&&this.fov===i.fov&&this.projection.name===i.projection.name&&this._edgeInsets.equals(i.padding)&&!n}computeZoomRelativeTo(r){let a,n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));a=r.z<this._camera.position[2]?[n.x,n.y,n.z]:[r.x,r.y,r.z];let o=i.ai(i.ax([],this._camera.position,a));return i.aC(this._zoomFromMercatorZ(o),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let a=!1;if(r.orientation&&!i.c4(r.orientation,this._camera.orientation)&&(a=this._setCameraOrientation(r.orientation)),r.position){let n=[r.position.x,r.position.y,r.position.z];i.c5(n,this._camera.position)||(this._setCameraPosition(n),a=!0)}a&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let r=this._camera.position,a=new ih;return a.position=new i.ag(r[0],r[1],r[2]),a.orientation=this._camera.orientation,a._elevation=this.elevation,a._renderWorldCopies=this.renderWorldCopies,a}_setCameraOrientation(r){if(!i.c6(r))return!1;i.c7(r,r);let a=i.c8([],[0,0,-1],r),n=i.c8([],[0,-1,0],r);if(n[2]<0)return!1;let o=il(a,n);return!!o&&(this._camera.orientation=o,!0)}_setCameraPosition(r){let a=this.zoomScale(this.minZoom)*this.tileSize,n=this.zoomScale(this.maxZoom)*this.tileSize,o=this.cameraToCenterDistance;r[2]=i.aC(r[2],o/n,o/a),this._camera.position=r}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,r,a){this._unmodified=!1,this._edgeInsets.interpolate(i,r,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){return Math.max(0,(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize)))}getVisibleUnwrappedCoordinates(r){let a=[new i.c9(0,r)];if(this.renderWorldCopies){let n=this.pointCoordinate(new i.P(0,0)),o=this.pointCoordinate(new i.P(this.width,0)),s=this.pointCoordinate(new i.P(this.width,this.height)),l=this.pointCoordinate(new i.P(0,this.height)),h=Math.floor(Math.min(n.x,o.x,s.x,l.x)),u=Math.floor(Math.max(n.x,o.x,s.x,l.x));for(let n=h-1;n<=u+1;n++)0!==n&&a.push(new i.c9(n,r))}return a}isLODDisabled(i){return(!i||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(r,a,n,o){let s=[],l=null!=n,h=!l;if(h&&this.zoom<a||l&&0===n[0]&&0===n[1])return s;let u=new Set,c=(r,a,n,o,l)=>{let h=i.cD(a,r,n,o,l);u.has(h)||(s.push(new i.aS(r,a,n,o,l)),u.add(h))};for(let i=0;i<r.length;i++){let s=r[i];if(h&&s.canonical.z!==a||l&&void 0!==o&&o>s.canonical.z)continue;let u=s.canonical,d=s.overscaledZ,p=s.wrap,f=1<<u.z,m=u.x+1<f,_=u.x>
80,g=u.y+1<f,y=u.y>0,x=s.wrap-!_,v=s.wrap+ +!m,b=_?u.x-1:f-1,w=m?u.x+1:0;if(l)n[0]<0?(c(d,v,u.z,w,u.y),n[1]<0&&g&&(c(d,p,u.z,u.x,u.y+1),c(d,v,u.z,w,u.y+1)),n[1]>0&&y&&(c(d,p,u.z,u.x,u.y-1),c(d,v,u.z,w,u.y-1))):n[0]>0?(c(d,x,u.z,b,u.y),n[1]<0&&g&&(c(d,p,u.z,u.x,u.y+1),c(d,x,u.z,b,u.y+1)),n[1]>0&&y&&(c(d,p,u.z,u.x,u.y-1),c(d,x,u.z,b,u.y-1))):n[1]<0&&g?c(d,p,u.z,u.x,u.y+1):y&&c(d,p,u.z,u.x,u.y-1);else{let i=s.visibleQuadrants;1&i&&(c(d,x,u.z,b,u.y),y&&(c(d,p,u.z,u.x,u.y-1),c(d,x,u.z,b,u.y-1))),2&i&&(c(d,v,u.z,w,u.y),y&&(c(d,p,u.z,u.x,u.y-1),c(d,v,u.z,w,u.y-1))),4&i&&(c(d,x,u.z,b,u.y),g&&(c(d,p,u.z,u.x,u.y+1),c(d,x,u.z,b,u.y+1))),8&i&&(c(d,v,u.z,w,u.y),g&&(c(d,p,u.z,u.x,u.y+1),c(d,v,u.z,w,u.y+1)))}}let d=[];for(let i of s)s.some(r=>i.isChildOf(r))||d.push(i);if(s=d.filter(i=>!r.some(r=>!!(i.overscaledZ<a&&r.isChildOf(i))||i.equals(r)||i.isChildOf(r))),h){let i=1<<a,r="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),n=[i*r.x,i*r.y];s=s.filter(i=>{let r=i.canonical.x+.5-n[0],a=i.canonical.y+.5-n[1];return r*r+a*a<16})}return s}extendTileCoverToNearPlane(r,a,n){let o=[],s=new Set;for(let i of r)s.add(i.key);let l=(r,a,n,l,h)=>{let u=i.cD(a,r,n,l,h);s.has(u)||(o.push(new i.aS(r,a,n,l,h)),s.add(u))},h=r.reduce((i,r)=>Math.max(i,r.overscaledZ),n),u=1<<n,c=[new i.P(0,0),new i.P(i.an,0),new i.P(i.an,i.an),new i.P(0,i.an)],d=new i.P(0,0),p=new i.P(0,0),f=(r,a)=>{let o=Math.floor(r[0]),s=Math.floor(r[1]),f=(r[0]-o)*i.an,m=(r[1]-s)*i.an,_=Math.floor(a[0]),g=Math.floor(a[1]),y=(a[0]-_)*i.an,x=(a[1]-g)*i.an;for(let r=-1;r<=1;r++){let a=o+r;if(!(a<0||a>=u)){d.x=f-r*i.an,p.x=y-(a-_)*i.an;for(let r=-1;r<=1;r++){let o=s+r;d.y=m-r*i.an,p.y=x-(o-g)*i.an,i.cE(d,p,c)&&l(h,0,n,a,o)}}}},m=a.points,_=m[i.ca],g=m[i.cb],y=this._projectToGround(_,m[i.cc]),x=this._projectToGround(g,m[i.cd]);return f(_,y),f(g,x),o}_projectToGround(r,a){return i.ce(i.cf(),r,a,r[2]/(r[2]-a[2]))}coveringTiles(r){let a,n=this.coveringZoomLevel(r),o=n,s=this.elevation&&this.elevation.exaggeration(),l=s&&!r.isTerrainDEM,h="mercator"===this.projection.name;if(void 0!==r.minzoom&&n<r.minzoom)return[];void 0!==r.maxzoom&&n>r.maxzoom&&(n=r.maxzoom);let u=this.locationCoordinate(this.center),c=this.center.lat,d=1<<n,p=[d*u.x,d*u.y,0],f="globe"===this.projection.name,m=!f,_=i.cg.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,m),g=f?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),y=d*i.bV(1,this.center.lat),x=this._camera.position[2]/i.bV(1,this.center.lat),v=[d*g.x,d*g.y,x*(m?1:y)],b=f||s,w=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),T=this.isLODDisabled(!0)?n:0;if(this._elevation&&r.isTerrainDEM)a=1e4*this._elevation.exaggeration();else if(this._elevation){let i=this._elevation.getMinMaxForVisibleTiles();a=i?i.max:this._centerAltitude}else a=this._centerAltitude;let S=r.isTerrainDEM?-a:this._elevation?this._elevation.getMinElevationBelowMSL():0,I=this.projection.isReprojectedInTileSpace?i.ch(this):1,E=r=>{let a=1/4e4,n=new i.ag(r.x+a,r.y,r.z),o=new i.ag(r.x,r.y+a,r.z),s=r.toLngLat(),l=n.toLngLat(),h=o.toLngLat(),u=this.locationCoordinate(s),c=this.locationCoordinate(l),d=this.locationCoordinate(h);return Math.sqrt(Math.hypot(c.x-u.x,c.y-u.y)*Math.hypot(d.x-u.x,d.y-u.y))*I/a},A=r=>{let n=a;return{aabb:i.ck(this,d,0,0,0,r,S,n,this.projection),zoom:0,x:0,y:0,minZ:S,maxZ:n,wrap:r,fullyVisible:!1}},C=[],M=[],P=n,D=r.reparseOverscaled?o:n,R=(x-this._centerAltitude)*y,L=i=>{if(!this._elevation||!i.tileID||!h)return;let r=this._elevation.getMinMaxForTile(i.tileID),a=i.aabb;r?(a.min[2]=r.min,a.max[2]=r.max,a.center[2]=(a.min[2]+a.max[2])/2):(i.shouldSplit=F(i),i.shouldSplit||(a.min[2]=a.max[2]=a.center[2]=this._centerAltitude))},z=(i,r)=>{if(.707*r<i)return 1;let a=r/i;return a/(1.4144271570014144+(Math.pow(1.1,a-1.4144271570014144+1)-1)/(1.1-1)-1)},F=r=>{if(r.zoom<T)return!0;if(r.zoom===P)return!1;if(null!=r.shouldSplit)return r.shouldSplit;let a=r.aabb.distanceX(v),n=r.aabb.distanceY(v),s=R,u=1;if(f){s=r.aabb.distanceZ(v);let a=Math.pow(2,r.zoom),n=Math.min(Math.max(c,i.bW((r.y+1)/a)),i.bW(r.y/a)),o=i.cI(n)/i.cI(c);if(u=n===c?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,o/this._mercatorScaleRatio),this.zoom<=i.cF&&r.zoom===P-1&&o>=.9)return!0}else if(l&&(s=r.aabb.distanceZ(v)*y),this.projection.isReprojectedInTileSpace&&o<=5){let a=Math.pow(2,r.zoom),n=E(new i.ag((r.x+.5)/a,(r.y+.5)/a));u=n>.85?1:n}if(!h&&!f){let i=Math.sqrt(a*a+n*n+s*s),o=(1<<P-r.zoom)*w*u;return o*=z(Math.max(s,R),i),i<o}let d=Number.MAX_VALUE,m=0,_=r.aabb.getCorners(),g=[];for(let r of _){i.ax(g,r,v),f||(l?g[2]*=y:g[2]=R);let a=i.bj(g,this._camera.forward());a<d&&(d=a,m=Math.abs(g[2]))}let x=(1<<P-r.zoom)*w*u;if(x*=z(Math.max(m,R),d),d<x)return!0;let b=r.aabb.closestPoint(p);return b[0]===p[0]&&b[1]===p[1]};if(this.renderWorldCopies)for(let i=1;i<=3;i++)C.push(A(-i)),C.push(A(i));for(C.push(A(0));C.length>0;){let a=C.pop(),o=a.x,s=a.y,u=a.fullyVisible,c=()=>"globe"===this.projection.name&&(0===a.y||a.y===(1<<a.zoom)-1);if(!u){let r=b?a.aabb.intersects(_):a.aabb.intersectsFlat(_);if(0===r&&c()){let n=new i.ci(a.zoom,o,s);r=i.cj(this,d,n,!0).intersects(_)}if(0===r)continue;u=2===r}
8if(a.zoom===P||!F(a)){let l=a.zoom===P?D:a.zoom;if(r.minzoom&&r.minzoom>l)continue;let h=0;if(!u){let n=b?a.aabb.intersectsPrecise(_):a.aabb.intersectsPreciseFlat(_);if(0===n&&c()){let r=new i.ci(a.zoom,o,s);n=i.cj(this,d,r,!0).intersectsPrecise(_)}if(0===n)continue;if(r.calculateQuadrantVisibility)if(_.containsPoint(a.aabb.center))h=15;else for(let i=0;i<4;i++)0!==a.aabb.quadrant(i).intersects(_)&&(h|=1<<i)}let f=p[0]-(.5+o+(a.wrap<<a.zoom))*(1<<n-a.zoom),m=p[1]-.5-s,g=a.tileID?a.tileID:new i.aS(l,a.wrap,a.zoom,o,s);r.calculateQuadrantVisibility&&(g.visibleQuadrants=h),M.push({tileID:g,distanceSq:f*f+m*m});continue}for(let r=0;r<4;r++){let n=(o<<1)+r%2,c=(s<<1)+(r>>1),p={aabb:h?a.aabb.quadrant(r):i.ck(this,d,a.zoom+1,n,c,a.wrap,a.minZ,a.maxZ,this.projection),zoom:a.zoom+1,x:n,y:c,wrap:a.wrap,fullyVisible:u,tileID:void 0,shouldSplit:void 0,minZ:a.minZ,maxZ:a.maxZ};l&&!f&&(p.tileID=new i.aS(a.zoom+1===P?D:a.zoom+1,a.wrap,a.zoom+1,n,c),L(p)),C.push(p)}}if(this.fogCullDistSq){let n=this.fogCullDistSq,o=this.horizonLineFromTop();M=M.filter(s=>{let l=[0,0,0,1],h=[i.an,i.an,0,1],u=this.calculateFogTileMatrix(s.tileID.toUnwrapped());i.aE(l,l,u),i.aE(h,h,u);let c=i.cl([],l,h),d=i.cm([],l,h),p=i.cG(c,d);if(0===p)return!0;let f=!1,m=this._elevation;if(m&&p>n&&0!==o){let n,l=this.calculateProjMatrix(s.tileID.toUnwrapped());r.isTerrainDEM||(n=m.getMinMaxForTile(s.tileID)),n||(n={min:S,max:a});let h=i.cn(this.rotation),u=[h[0]*i.an,h[1]*i.an,n.max];i.ah(u,u,l),f=(1-u[1])*this.height*.5<o}return p<n||f})}return M.sort((i,r)=>i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log2(i)}project(r){let a=i.aC(r.lat,-i.co,i.co),n=this.projection.project(r.lng,a);return new i.P(n.x*this.worldSize,n.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/i.bV(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,a){let n,o,s=this.centerPoint;if("globe"===this.projection.name){let i=this.worldSize;n=(a.x-s.x)/i,o=(a.y-s.y)/i}else{let i=this.pointCoordinate(a),r=this.pointCoordinate(s);n=i.x-r.x,o=i.y-r.y}let l=this.locationCoordinate(r);this.setLocation(new i.ag(l.x-n,l.y-o))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i,r){return this.projection.locationPoint(this,i,r)}locationPoint3D(i,r){return this.projection.locationPoint(this,i,r,!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i,r){return this.coordinateLocation(this.pointCoordinate3D(i,r))}locationCoordinate(r,a){let n=a?i.bV(a,r.lat):void 0,o=this.projection.project(r.lng,r.lat);return new i.ag(o.x,o.y,n)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,a){let n=null!=a?a:this._centerAltitude,o=[r.x,r.y,0,1],s=[r.x,r.y,1,1];i.aE(o,o,this.pixelMatrixInverse),i.aE(s,s,this.pixelMatrixInverse);let l=s[3];i.cp(o,o,1/o[3]),i.cp(s,s,1/l);let h=o[2],u=s[2];return{p0:o,p1:s,t:h===u?0:(n-h)/(u-h)}}screenPointToMercatorRay(r){let a=[r.x,r.y,0,1],n=[r.x,r.y,1,1];return i.aE(a,a,this.pixelMatrixInverse),i.aE(n,n,this.pixelMatrixInverse),i.cp(a,a,1/a[3]),i.cp(n,n,1/n[3]),a[2]=i.bV(a[2],this._center.lat)*this.worldSize,n[2]=i.bV(n[2],this._center.lat)*this.worldSize,i.cp(a,a,1/this.worldSize),i.cp(n,n,1/this.worldSize),new i.az([a[0],a[1],a[2]],i.ay([],i.ax([],n,a)))}rayIntersectionCoordinate(r){let{p0:a,p1:n,t:o}=r,s=i.bV(a[2],this._center.lat),l=i.bV(n[2],this._center.lat);return new i.ag(i.am(a[0],n[0],o)/this.worldSize,i.am(a[1],n[1],o)/this.worldSize,i.am(s,l,o))}pointCoordinate(i,r=this._centerAltitude){return this.projection.pointCoordinate(this,i.x,i.y,r)}
8pointCoordinate3D(r,a){if(!this.elevation)return this.pointCoordinate(r,a);let n=this.projection.pointCoordinate3D(this,r.x,r.y);if(n)return new i.ag(n[0],n[1],n[2]);let o=0,s=this.horizonLineFromTop();if(r.y>s)return this.pointCoordinate(r,a);let l=.02*s,h=r.clone();for(let r=0;r<10&&s-o>l;r++){h.y=i.am(o,s,.66);let r=this.projection.pointCoordinate3D(this,h.x,h.y);r?(s=h.y,n=r):o=h.y}return n?new i.ag(n[0],n[1],n[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){return this.projection.isPointAboveHorizon(this,i)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=i.cq)return!this.isPointAboveHorizon(r);let a=this.pointCoordinate(r);return a.y>=0&&a.y<=1}_coordinatePoint(r,a){let n=a&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,o=[r.x*this.worldSize,r.y*this.worldSize,n+r.toAltitude(),1];return i.aE(o,o,this.pixelMatrix),o[3]>0?new i.P(o[0]/o[3],o[1]/o[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){let{top:r,left:a}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,s=this.pointLocation3D(new i.P(a,r)),l=this.pointLocation3D(new i.P(o,r)),h=this.pointLocation3D(new i.P(o,n)),u=this.pointLocation3D(new i.P(a,n)),c=Math.min(s.lng,l.lng,h.lng,u.lng),d=Math.max(s.lng,l.lng,h.lng,u.lng),p=Math.min(s.lat,l.lat,h.lat,u.lat),f=Math.max(s.lat,l.lat,h.lat,u.lat),m=Math.pow(2,-this.zoom)/16*270,_="globe"===this.projection.name?1:4,g=(r,a,n,o,s)=>{let l=(r+n)/2,h=(a+o)/2,u=new i.P(l,h),{lng:y,lat:x}=this.pointLocation3D(u),v=Math.max(0,c-y,p-x,y-d,x-f);c=Math.min(c,y),d=Math.max(d,y),p=Math.min(p,x),f=Math.max(f,x),(s<_||v>m)&&(g(r,a,l,h,s+1),g(l,h,n,o,s+1))};if(g(a,r,o,r,1),g(o,r,o,n,1),g(o,n,a,n,1),g(a,n,a,r,1),"globe"===this.projection.name){let[r,a]=i.cr(this);r?(f=90,d=180,c=-180):a&&(p=-90,d=180,c=-180)}return new i.aK(new i.aV(c,p),new i.aV(d,f))}_getBoundsRectangular(r,a){let{top:n,left:o}=this._edgeInsets,s=this.height-this._edgeInsets.bottom,l=this.width-this._edgeInsets.right,h=new i.P(o,n),u=new i.P(l,n),c=new i.P(l,s),d=new i.P(o,s),p=this.pointCoordinate(h,r),f=this.pointCoordinate(u,r),m=this.pointCoordinate(c,a),_=this.pointCoordinate(d,a),g=(i,r)=>(r.y-i.y)/(r.x-i.x);return p.y>1&&f.y>=0?p=new i.ag((1-_.y)/g(_,p)+_.x,1):p.y<0&&f.y<=1&&(p=new i.ag(-_.y/g(_,p)+_.x,0)),f.y>1&&p.y>=0?f=new i.ag((1-m.y)/g(m,f)+m.x,1):f.y<0&&p.y<=1&&(f=new i.ag(-m.y/g(m,f)+m.x,0)),(new i.aK).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(m))}_getBoundsRectangularTerrain(){let i=this.elevation;if(!i.visibleDemTiles.length||i.isUsingMockSource())return this._getBoundsRectangular(0,0);let r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){let a=r.dem.tree;i.min=Math.min(i.min,a.minimums[0]),i.max=Math.max(i.max,a.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(i=!0){let r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,a=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,a):a}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.co,this.maxLat=i.co,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=i.aH(this.minLng)*this.tileSize,this.worldMaxX=i.aH(this.maxLng)*this.tileSize,this.worldMinY=i.aL(this.maxLat)*this.tileSize,this.worldMaxY=i.aL(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(i,r){return this.projection.createTileMatrix(this,r,i)}calculateDistanceTileData(r){let a=r.key,n=this._distanceTileDataCache;
8if(n[a])return n[a];let o=r.canonical,s=1/this.height,l=this.cameraWorldSize,h=l/this.zoomScale(o.z),u=(o.x+Math.pow(2,o.z)*r.wrap)*h,c=o.y*h,d=this.point;d.x*=l/this.worldSize,d.y*=l/this.worldSize;let p=this.angle,f=Math.sin(-p),m=-Math.cos(-p);return n[a]={bearing:[f,m],center:[(d.x-u)*s,(d.y-c)*s],scale:h/i.an*s},n[a]}calculateFogTileMatrix(r){let a=r.key,n=this._fogTileMatrixCache;if(n[a])return n[a];let o=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,r);return i.aD(o,this.worldToFogMatrix,o),n[a]=new Float32Array(o),n[a]}calculateProjMatrix(r,a=!1,n=!1){let o,s,l=r.key;if((o=n?this._expandedProjMatrixCache:a?this._alignedProjMatrixCache:this._projMatrixCache)[l])return o[l];let h=this.calculatePosMatrix(r,this.worldSize);return s=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:n?this.expandedFarZProjMatrix:a?this.alignedProjMatrix:this.projMatrix,i.aD(h,s,h),o[l]=new Float32Array(h),o[l]}calculatePixelsToTileUnitsMatrix(r){let a=r.tileID.key,n=this._pixelsToTileUnitsCache;if(n[a])return n[a];let o=i.cs(r,this);return n[a]=o,n[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){let r=1/this.worldSize,a=i.bQ([],[r,r,r]);return i.aD(a,a,this.globeMatrix),a}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let r=this._elevation;this._updateCameraState();let a=i.bV(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),o=this._camera.forward(),s=i.bV(1,this._center.lat);n[2]/=s,o[2]/=s,i.ay(o,o);let l=r.raycast(n,o,r.exaggeration());if(l){let r=i.bh([],n,o,l),a=new i.ag(r[0],r[1],i.bV(r[2],i.bW(r[1]))),h=(a.z+i.ai([a.x-n[0],a.y-n[1],a.z-n[2]*s]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(h),this._centerAltitude=a.toAltitude(),this._center=this.coordinateLocation(a),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(r=!1){if(!this._elevation)return;let a=this._elevation,n=i.bV(1,this._center.lat)*this.worldSize,o=this._computeCameraPosition(n),s=a.getAtPointOrZero(new i.ag(...o)),l=this.pixelsPerMeter/this.worldSize*s,h=this._minimumHeightOverTerrain(),u=o[2]-l;if(u<=h)if(u<0||r){let r=this.locationCoordinate(this._center,this._centerAltitude),a=[o[0],o[1],r.z-o[2]],n=i.ai(a);a[2]-=(h-u)/this._pixelsPerMercatorPixel;let s=i.ai(a);if(0===s)return;i.bK(a,a,n/s*this._pixelsPerMercatorPixel),this._camera.position=[o[0],o[1],r.z*this._pixelsPerMercatorPixel-a[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let r="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){let a=this.center;return a.lat=i.aC(a.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||r)||(a.lng=i.aC(a.lng,this.minLng,this.maxLng)),this.center=a,void(this._constraining=!1)}let a=this._unmodified,{x:n,y:o}=this.point,s=0,l=n,h=o,u=this.width/2,c=this.height/2,d=this.worldMinY*this.scale,p=this.worldMaxY*this.scale;if(o-c<d&&(h=d+c),o+c>p&&(h=p-c),p-d<this.height&&(s=Math.max(s,this.height/(p-d)),h=(p+d)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let i=this.worldMinX*this.scale,r=this.worldMaxX*this.scale,a=this.worldSize/2-(i+r)/2;(l=(n+a+this.worldSize)%this.worldSize-a)-u<i&&(l=i+u),l+u>r&&(l=r-u),r-i<this.width&&(s=Math.max(s,this.width/(r-i)),l=(r+i)/2)}l===n&&h===o||this._allowWorldUnderZoom||(this.center=this.unproject(new i.P(l,h))),s&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(s)),this._constrainCamera(),this._unmodified=a,this._constraining=!1}_minZoomForBounds(){let i=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(i=Math.max(i,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),i}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){let r;if(!this.height)return;let a=this.centerOffset,n="globe"===this.projection.name,o=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=i.bV(1,this.center.lat)/i.bV(1,i.cJ));let s=i.ct(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,s),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;let l="meters"===this.projection.zAxisUnit?o:1,h=this._camera.getWorldToCamera(this.worldSize,l),u=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(u[8]=-(2*a.x)/this.width,u[9]=2*a.y/this.height,this.isOrthographic){let n=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),o=n*this.aspect,s=-o,l=-n;o-=a.x,s-=a.x,n+=a.y,l+=a.y,((r,a,n,o)=>{for(let s=0;s<16;s++)r[s]=i.am(a[s],n[s],o)})(r=this._camera.getCameraToClipOrthographic(s,o,l,n,this._nearZ+this._nearClipOffset,this._farZ),r,u,i.cH(this.pitch>=15?1:this.pitch/15))}else r=u;let c=i.cu([],u,h),d=i.cu([],r,h);if(this.projection.isReprojectedInTileSpace){let r=this.locationCoordinate(this.center),a=i.ba([]);i.by(a,a,[r.x*this.worldSize,r.y*this.worldSize,0]),i.aD(a,a,i.cv(this)),i.by(a,a,[-r.x*this.worldSize,-r.y*this.worldSize,0]),i.aD(d,d,a),i.aD(c,c,a),this.inverseAdjustmentMatrix=i.cw(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=i.cx([],d,[this.worldSize,this.worldSize,this.worldSize/l,1]),this.projMatrix=d,this.invProjMatrix=i.b8(new Float64Array(16),this.projMatrix),n){let r=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);r[8]=-(2*a.x)/this.width,r[9]=2*a.y/this.height,this.expandedFarZProjMatrix=i.cu([],r,h)}else this.expandedFarZProjMatrix=this.projMatrix;let p=i.b8([],r);this.frustumCorners=i.cy.fromInvProjectionMatrix(p,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cg.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n);let f=new Float32Array(16);i.ba(f),i.cx(f,f,[1,-1,1]),i.cz(f,f,this._pitch),i.bb(f,f,this.angle);let m=i.bT(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.b9(m);let _=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;m[8]=-(2*a.x)/this.width,m[9]=2*(a.y+_)/this.height,this.skyboxMatrix=i.aD(f,m,f);let g=this.point,y=g.x,x=g.y,v=this.width%2/2,b=this.height%2/2,w=Math.cos(this.angle),T=Math.sin(this.angle),S=y-Math.round(y)+w*v+T*b,I=x-Math.round(x)+w*b+T*v,E=new Float64Array(d);if(i.by(E,E,[S>.5?S-1:S,I>.5?I-1:I,0]),this.alignedProjMatrix=E,d=i.bc(),i.cx(d,d,[this.width/2,-this.height/2,1]),i.by(d,d,[1,-1,0]),this.labelPlaneMatr
8ix=d,d=i.bc(),i.cx(d,d,[1,-1,1]),i.by(d,d,[-1,-1,0]),i.cx(d,d,[2/this.width,2/this.height,1]),this.glCoordMatrix=d,this.pixelMatrix=i.aD(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},!(d=i.b8(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");if(this.pixelMatrixInverse=d,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=i.cA(this);let r=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.ah(r,r,h),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=d;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};let r=this.cameraWorldSizeForFog,a=this.cameraPixelsPerMeter,n=this._camera.position,o=1/this.height/this._pixelsPerMercatorPixel,s=[r,r,a];i.bK(s,s,o),i.bK(n,n,-1),i.cB(n,n,s);let l=i.bc();i.by(l,l,n),i.cx(l,l,s),this.mercatorFogMatrix=l,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,a,o)}_computeCameraPosition(i){let r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,a=this._camera.forward(),n=this.point,o=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[n.x/this.worldSize-a[0]*o,n.y/this.worldSize-a[1]*o,i/this.worldSize*this._centerAltitude-a[2]*o]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){let a=this._maxCameraBoundsDistance()*Math.cos(this._pitch),n=this._camera.position[2],o=r[2],s=1;this.projection.wrap&&(this.center=this.center.wrap()),o>0&&(s=Math.min((a-n)/o,1)),this._camera.position=i.bh([],this._camera.position,r,s),this._updateStateFromCamera()}_updateStateFromCamera(){let r=this._camera.position,a=this._camera.forward(),{pitch:n,bearing:o}=this._camera.getPitchBearing(),s=i.bV(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.ap(this._maxPitch)),h=Math.max((r[2]-s)/Math.cos(n),l),u=this._zoomFromMercatorZ(h);i.bh(r,r,a,h),this._pitch=i.aC(n,i.ap(this.minPitch),i.ap(this.maxPitch)),this.angle=i.bt(o,-Math.PI,Math.PI),this._setZoom(i.aC(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.ag(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){let i=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,i)*this.tileSize))}zoomFromMercatorZAdjusted(r){let a=0,n=i.cq,o=0,s=1/0;for(;n-a>1e-6&&n>a;){let i=a+.5*(n-a),l=this.tileSize*Math.pow(2,i),h=this.getCameraToCenterDistance(this.projection,i,l),u=this.scaleZoom(h/(Math.max(0,r)*this.tileSize)),c=Math.abs(i-u);c<s&&(s=c,o=i),i<u?a=i:n=i}return o}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(r,a){let n=Math.min(r.x,a.x),o=Math.max(r.x,a.x),s=Math.min(r.y,a.y),l=Math.max(r.y,a.y);if(s<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;let h=[new i.P(n,s),new i.P(o,l),new i.P(n,l),new i.P(o,s)],u=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(let i of h){let r=this.pointRayIntersection(i);if(r.t<0)return!0;let a=this.rayIntersectionCoordinate(r);if(a.x<u||a.y<0||a.x>c||a.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.cC(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.P(0,0),new i.P(this.width,this.height))}zoomDeltaToMovement(r,a){let n=i.ai(i.ax([],this._camera.position,r)),o=this._zoomFromMercatorZ(n)+a;return n-this._mercatorZfromZoom(o)}getCameraPoint(){if("globe"===this.projection.name){let r=function([r,a,n],o){let s=[r,a,n,1];i.aE(s,s,o);let l=s[3]=Math.max(s[3],1e-6);return s[0]/=l,s[1]/=l,s[2]/=l,s}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.P(r[0],r[1])}{let r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,r))}}getCameraToCenterDistance(r,a=this.zoom,n=this.worldSize){let o=i.ct(r,a,this.width,this.height,1024),s=r.pixelSpaceConversion(this.center.lat,n,o),l=.5/Math.tan(.5*this._fov)*this.height*s;return this.isOrthographic&&(l=i.am(1,l,i.cH(this.pitch>=15?1:this.pitch/15))),l}getWorldToCameraMatrix(){let r=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&i.aD(r,r,this.globeMatrix),r}getFrustum(r){return i.cg.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,"meters"===this.projection.zAxisUnit)}}let im=(r,a)=>{if(a>0&&r.terrain&&i.w("Cutoff is currently disabled on terrain"),a<=0||r.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let n=r.transform,o=n.pitch,s=n.isLODDisabled(!1)?60:30;if(o<s-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let l=n._farZ-n._nearZ,h=a*n.height*1.3,u=Math.pow(2,.85*Math.max(n._zoom-r.minCutoffZoom,0)),c=1.4*n.cameraToCenterDistance*u,d=i.aj(s-15,s,o),p=(1-d)*(n._farZ+h
8)+d*c,f=Math.min(h,p-n._nearZ);return{shouldRenderCutoff:d>0,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(p-n._nearZ)/l,(p-f-n._nearZ)/l]}}};class i_{constructor(i,r){this.aabb=i,this.lastCascade=r}}class ig{add(i,r){let a=this.receivers[i.key];void 0!==a?(a.aabb.min[0]=Math.min(a.aabb.min[0],r.min[0]),a.aabb.min[1]=Math.min(a.aabb.min[1],r.min[1]),a.aabb.min[2]=Math.min(a.aabb.min[2],r.min[2]),a.aabb.max[0]=Math.max(a.aabb.max[0],r.max[0]),a.aabb.max[1]=Math.max(a.aabb.max[1],r.max[1]),a.aabb.max[2]=Math.max(a.aabb.max[2],r.max[2])):this.receivers[i.key]=new i_(r,null)}clear(){this.receivers={}}get(i){return this.receivers[i.key]}computeRequiredCascades(r,a,n){let o=i.cQ.fromPoints(r.points),s=0;for(let r in this.receivers){let l=this.receivers[r];if(!l||!o.intersectsAabb(l.aabb))continue;l.aabb.min=o.closestPoint(l.aabb.min),l.aabb.max=o.closestPoint(l.aabb.max);let h=l.aabb.getCorners();for(let r=0;r<n.length;r++){let o=!0;for(let s of h){let l=[s[0]*a,s[1]*a,s[2]];if(i.ah(l,l,n[r].matrix),l[0]<-1||l[0]>1||l[1]<-1||l[1]>1){o=!1;break}}if(l.lastCascade=r,s=Math.max(s,r),o)break}}return s+1}}class iy{constructor(i){this.painter=i,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new ig,this._depthMode=new ii(i.context.gl.LEQUAL,ii.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(let i of this._cascades)i.texture.destroy(),i.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,a){let n=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!a||!a.properties)return;let o=a.properties.get("shadow-intensity"),s=a.properties.get("shadow-draw-before-layer");if(!a.shadowsEnabled()||o<=0)return;let l=-1,h=0;for(let i of n.style.order){let a=n.style._mergedLayers[i];a.hasShadowPass()&&!a.isHidden(r.zoom)&&(l=h),s&&(s===i||s===a.slot)&&(this._drawShadowAfterLayer=h>0?h-1:0),h+=1}if(this._enabled=l>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=l);let u=n.context;if(0===this._cascades.length||2048!==this._cascades[0].texture.size[0]){this._cascades=[];for(let r=0;r<2;++r){let r=u.gl,a=u.createFramebuffer(2048,2048,0,"texture"),n=new i.T(u,{width:2048,height:2048,data:null},r.DEPTH_COMPONENT16);a.depthAttachment.set(n.texture),this._cascades.push({framebuffer:a,texture:n,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cg,scale:0})}}this.shadowDirection=iv(a);let c=0;if(r.elevation){let i=r.elevation,a=[1e4,-1e4];i.visibleDemTiles.filter(i=>i.dem).forEach(i=>{let r=i.dem.tree;a[0]=Math.min(a[0],r.minimums[0]),a[1]=Math.max(a[1],r.maximums[0])}),1e4!==a[0]&&(c=(a[1]-a[0])*i.exaggeration())}let d=1.5*r.cameraToCenterDistance,p=3*d,f=new Float64Array(16);for(let a=0;a<this._cascades.length;++a){let n=this._cascades[a],o=r.height/50,s=1;0===a?s=d:(o=d,s=p);let[l,h]=function(r,a,n,o,s){let l,h,u=r.zoom,c=r.scale,d=r.worldSize,p=1/d,f=r.aspect,m=Math.sqrt(1+f*f)*Math.tan(.5*r.fovX),_=m*m,g=o-n,y=o+n;_>g/y?(l=o,h=o*m):(l=.5*y*(1+_),h=.5*Math.sqrt(g*g+2*(o*o+n*n)*_+y*y*_*_));let x=r.projection.pixelsPerMeter(r.center.lat,d),v=r._camera.getCameraToWorldMercator(),b=[0,0,-l*p];i.ah(b,b,v);let w=h*p,T=r._edgeInsets;if((0!==T.left||0!==T.top||0!==T.right||0!==T.bottom)&&(T.left!==T.right||T.top!==T.bottom)){let a=r._camera.getWorldToCamera(r.worldSize,"meters"===r.projection.zAxisUnit?x:1),s=r._camera.getCameraToClipPerspective(r._fov,r.width/r.height,n,o);s[8]=-(2*r.centerOffset.x)/r.width,s[9]=2*r.centerOffset.y/r.height;let l=new Float64Array(16);i.cu(l,s,a);let h=new Float64Array(16);for(let a of(i.b8(h,l),i.cg.fromInvProjectionMatrix(h,d,u,!0).points)){let n=(a[0]/=c,a[1]/=c,a[2]=i.bV(a[2],r._center.lat),a);w=Math.max(w,i.bL(i.cR([],b,n)))}}w*=2048/2047;let S=Math.acos(a[2]),I=Math.atan2(-a[0],-a[1]),E=new iu;E.position=b,E.setPitchBearing(S,I);let A=E.getWorldToCamera(d,x),C=w*d,M=Math.min(-(r._mercatorZfromZoom(17)*d*2),-2*C),P=E.getCameraToClipOrthographic(-C,C,-C,C,M,(C+s*x)/a[2]),D=new Float64Array(16);i.aD(D,P,A);let R=i.cM(Math.floor(1e6*b[0])/1e6*d,Math.floor(1e6*b[1])/1e6*d,0),L=1024,z=[0,0,0];i.ah(z,R,D),i.bK(z,z,L);let F=[Math.floor(z[0]),Math.floor(z[1]),Math.floor(z[2])],O=[0,0,0];i.ax(O,z,F),i.bK(O,O,-1/L);let B=new Float64Array(16);return i.ba(B),i.by(B,B,O),i.aD(D,B,D),[D,C]}(r,this.shadowDirection,o,s,c);n.scale=r.scale,n.matrix=l,n.boundingSphereRadius=h,i.b8(f,n.matrix),n.frustum=i.cg.fromInvProjectionMatrix(f,1,0,!0),n.far=s}let m=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[m].far,this._cascades[m].far],this._uniformValues.u_shadow_intensity=o,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=48828125e-11,this._uniformValues.u_shadow_map_resolution=2048,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=n.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});let _=n.transform.elevation;for(let i of this._groundShadowTiles){let r={min:0,max:0};if(_){let a=_.getMinMaxForTile(i);a&&(r=a)}this.addShadowReceiver(i.toUnwrapped(),r.min,r.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(i){this._enabled=i}drawShadowPass(r,a){if(!this.enabled)return;let n=this.painter,o=n.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(n.transform.getFrustum(0),n.transform.worldSize,this._cascades),o.viewport.set([0,0,2048,2048]);for(let s=0;s<this._numCascadesToRender;++s)for(let l of(n.currentShadowCascade=s,o.bindFramebuffer.set(this._cascades[s].framebuffer.framebuffer),o.clear({color:i.aq.white,depth:1}),r.order)){let i=r._mergedLayers[l];if(!i.hasShadowPass()||i.isHidden(n.transform.zoom))continue;let o=r.getLayerSourceCache(i),s=o?a[o.id]:void 0;("model"===i.type||s&&s.length)&&n.renderLayer(n,o,i,s)}n.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;let i=this.painter,r=i.style,a=i.context,n=a.gl,o=r.directionalLight,s=r.ambientLight;if(!o||!s)return;let l=[],h=im(i,i.longestCutoffRange);h.shouldRenderCutoff&&l.push("RENDER_CUTOFF"),l.push("RENDER_SHADOWS"),this.useNormalOffset&&l.push("NORMAL_OFFSET");let u=ib(r,o,s),c=new ii(n.LEQUAL,ii.ReadOnly,i.depthRangeFor3D),d=new ir({func:n.EQUAL,mask:255},0,255,n.KEEP,n.KEEP,n.KEEP);for(let r of this._groundShadowTiles){let o=r.toUnwrapped(),s=i.isTileAffectedByFog(r),p=i.getOrCreateProgram("groundShadow",{defines:l,overrideFog:s});this.setupShadows(o,p),i.uploadCommonUniforms(a,p,o,null,h);let f=ic(i.transform.calculateProjMatrix(o),u);p.draw(i,n.TRIANGLES,c,d,it.multiply,ia.disabled,f,"ground_shadow",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments,null,i.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(r){let a=this.painter.transform,n=a.calculatePosMatrix(r,a.worldSize);return i.aD(n,this._cascades[this.painter.currentShadowCascade].matrix,n),Float32Array.from(n)}
8calculateShadowPassMatrixFromMatrix(r){let a=i.b9(r);return i.aD(a,this._cascades[this.painter.currentShadowCascade].matrix,r),a}setupShadows(r,a,n){if(!this.enabled)return;let o=this.painter.transform,s=this.painter.context,l=s.gl,h=this._uniformValues,u=new Float64Array(16),c=o.calculatePosMatrix(r,o.worldSize);for(let r=0;r<this._cascades.length;r++)i.aD(u,this._cascades[r].matrix,c),h[0===r?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(u),s.activeTexture.set(l.TEXTURE0+11+r),this._cascades[r].texture.bindExtraParam(l.LINEAR,l.LINEAR,l.CLAMP_TO_EDGE,l.CLAMP_TO_EDGE,l.GREATER);if(this.useNormalOffset=!!n,this.useNormalOffset){var d;let a,s=i.cO(r.canonical),l=2/o.tileSize*i.an/2048,u=l*this._cascades[0].boundingSphereRadius,c=l*this._cascades[this._cascades.length-1].boundingSphereRadius,p=("vector-tile"===n?1:3)*(d=o.zoom,.125*(1-(a=i.aC(-((d-22)/22),0,1)))+4*a);h.u_shadow_normal_offset=[s,u*p,c*p],h.u_shadow_bias=[1e-4,.0012,.012]}else h.u_shadow_bias=[36e-5,.0012,.012];a.setShadowUniformValues(s,h)}setupShadowsFromMatrix(r,a,n=!1){if(!this.enabled)return;let o=this.painter.context,s=o.gl,l=this._uniformValues,h=new Float64Array(16);for(let a=0;a<2;a++)i.aD(h,this._cascades[a].matrix,r),l[0===a?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(h),o.activeTexture.set(s.TEXTURE0+11+a),this._cascades[a].texture.bindExtraParam(s.LINEAR,s.LINEAR,s.CLAMP_TO_EDGE,s.CLAMP_TO_EDGE,s.GREATER);this.useNormalOffset=n,n?(l.u_shadow_normal_offset=[1,3,3],l.u_shadow_bias=[6e-5,.0012,.012]):l.u_shadow_bias=[36e-5,.0012,.012],a.setShadowUniformValues(o,l)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(r,a,n,o){let s;if(o[2]>=0)return{};let l=(s=n/(1<<r.canonical.z),new i.cQ([r.canonical.x*s+r.wrap*n,r.canonical.y*s+r.wrap*n,0],[(r.canonical.x+1)*s+r.wrap*n,(r.canonical.y+1)*s+r.wrap*n,a])).getCorners(),h=-(a/o[2]);o[0]<0?(i.cP(l[0],l[0],[o[0]*h,0,0]),i.cP(l[3],l[3],[o[0]*h,0,0])):o[0]>0&&(i.cP(l[1],l[1],[o[0]*h,0,0]),i.cP(l[2],l[2],[o[0]*h,0,0])),o[1]<0?(i.cP(l[0],l[0],[0,o[1]*h,0]),i.cP(l[1],l[1],[0,o[1]*h,0])):o[1]>0&&(i.cP(l[2],l[2],[0,o[1]*h,0]),i.cP(l[3],l[3],[0,o[1]*h,0]));let u={};return u.vertices=l,u.planes=[ix(l[1],l[0],l[4]),ix(l[2],l[1],l[5]),ix(l[3],l[2],l[6]),ix(l[0],l[3],l[7])],u}addShadowReceiver(r,a,n){this._receivers.add(r,i.cQ.fromTileIdAndHeight(r,a,n))}getMaxCascadeForTile(i){let r=this._receivers.get(i);return r&&r.lastCascade?r.lastCascade:0}}function ix(r,a,n){let o=i.ax([],n,a),s=i.ax([],r,a),l=i.bi([],o,s),h=i.ai(l);return 0===h?[0,0,1,0]:(i.bK(l,l,1/h),[l[0],l[1],l[2],-i.bj(l,a)])}function iv(r){let a=r.properties.get("direction"),n=i.cL(a.x,a.y,a.z);n[2]=i.aC(n[2],0,75);let o=i.cN([n[0],n[1],n[2]]);return i.cM(o.x,o.y,o.z)}function ib(r,a,n){let o="none"===a.properties.get("color-use-theme"),s=a.properties.get("color"),l=a.properties.get("intensity"),h=a.properties.get("direction"),u=[h.x,h.y,h.z],c="none"===n.properties.get("color-use-theme"),d=n.properties.get("color"),p=n.properties.get("intensity"),f=Math.max(i.bj([0,0,1],u),0),m=[0,0,0];i.bK(m,d.toPremultipliedRenderColor(c?null:r.getLut(a.scope)).toArray01Linear().slice(0,3),p);let _=[0,0,0];return i.bK(_,s.toPremultipliedRenderColor(o?null:r.getLut(n.scope)).toArray01Linear().slice(0,3),f*l),i.cS([m[0]>0?m[0]/(m[0]+_[0]):0,m[1]>0?m[1]/(m[1]+_[1]):0,m[2]>0?m[2]/(m[2]+_[2]):0])}class iw extends i.E{constructor(i){super(),this.requestManager=i,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(r,a){return i.cT(this.requestManager.transformRequest(a,i.R.Model).url).then(n=>{let o=i.cU(n),s=new i.cV(r,a,void 0,void 0,o);return s.computeBoundsAndApplyParent(),s}).catch(n=>{if(n&&404===n.status)return null;this.fire(new i.B(Error(`Could not load model ${r} from ${a}: ${n.message}`)))})}load(r,a,n={forceReload:!1}){this.models[a]||(this.models[a]={});let o=Object.keys(r),s=[],l=[];for(let i of o){let o=r[i];this.hasURLBeenRequested(o)&&!n.forceReload||(this.modelByURL[o]={modelId:i,scope:a},s.push(this.loadModel(i,o)),l.push(i)),this.models[a][i]||(this.models[a][i]={model:null,numReferences:1})}this.numModelsLoading[a]=(this.numModelsLoading[a]||0)+l.length,Promise.allSettled(s).then(r=>{for(let i=0;i<r.length;i++){let{status:n}=r[i];if("rejected"===n)continue;let{value:o}=r[i];this.models[a][l[i]]||(this.models[a][l[i]]={model:null,numReferences:1}),this.models[a][l[i]].model=o}this.numModelsLoading[a]-=l.length,this.fire(new i.C("data",{dataType:"style"}))}).catch(r=>{this.fire(new i.B(Error(`Could not load models: ${r.message}`)))})}isLoaded(){for(let i in this.numModelsLoading)if(this.numModelsLoading[i]>0)return!1;return!0}hasModel(i,r,a={exactIdMatch:!1}){return!!(a.exactIdMatch?this.getModel(i,r):this.getModelByURL(this.modelUris[r][i]))}getModel(i,r){return this.models[r]||(this.models[r]={}),this.models[r][i]?this.models[r][i].model:void 0}getModelByURL(i){if(!i)return null;let r=this.modelByURL[i];return r?this.models[r.scope][r.modelId].model:null}hasModelBeenAdded(i,r){return this.models[r]&&void 0!==this.models[r][i]}getModelURIs(i){return this.modelUris[i]||{}}addModel(i,r,a){this.models[a]||(this.models[a]={}),this.modelUris[a]||(this.modelUris[a]={});let n=this.requestManager.normalizeModelURL(r);if((this.hasModel(i,a,{exactIdMatch:!0})||this.hasModelBeenAdded(i,a))&&this.modelUris[a][i]===n)this.models[a][i].numReferences++;else if(this.hasURLBeenRequested(n)){let{scope:i,modelId:r}=this.modelByURL[n];this.models[i][r].numReferences++}else this.modelUris[a][i]=n,this.load({[i]:this.modelUris[a][i]},a)}
8addModelURLs(i,r){this.models[r]||(this.models[r]={}),this.modelUris[r]||(this.modelUris[r]={});let a=this.modelUris[r];for(let r in i)a[r]=this.requestManager.normalizeModelURL(i[r])}reloadModels(i){this.load(this.modelUris[i],i,{forceReload:!0})}addModelsFromBucket(r,a){this.models[a]||(this.models[a]={}),this.modelUris[a]||(this.modelUris[a]={});let n={};for(let o of r)this.hasModel(o,a,{exactIdMatch:!0})||this.hasURLBeenRequested(o)?this.models[a][o].numReferences++:this.modelUris[a][o]&&!this.hasURLBeenRequested(o)?n[o]=this.modelUris[a][o]:!this.hasURLBeenRequested(o)&&i.cW(o,!1)&&(this.modelUris[a][o]=this.requestManager.normalizeModelURL(o),n[o]=this.modelUris[a][o]);this.load(n,a)}hasURLBeenRequested(i){return void 0!==this.modelByURL[i]}removeModel(i,r,a=!1,n=!1){if(this.models[r]&&this.models[r][i]&&(this.models[r][i].numReferences--,0===this.models[r][i].numReferences||n)){let n=this.modelUris[r][i];a||delete this.modelUris[r][i],delete this.modelByURL[n];let o=this.models[r][i].model;o&&(delete this.models[r][i],o.destroy())}}destroy(){for(let i of Object.keys(this.models))for(let r of Object.keys(this.models[i])){let a=this.models[i][r].model;delete this.models[i][r],a&&a.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(i){return this.models[i]||(this.models[i]={}),Object.keys(this.models[i])}upload(i,r){for(let a in this.models[r]||(this.models[r]={}),this.models[r])this.models[r][a].model&&this.models[r][a].model.upload(i.context)}}let iT=i.a8.colorTheme,iS=new i.ab({data:new i.ac(iT.data)});function iI(r){if(r)return r.map(([r,a])=>[r*i.o.devicePixelRatio,a*i.o.devicePixelRatio])}class iE{constructor(i,r,a){this.id=i,this.scope=r,this.sourceCache=a,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(i){this.missingRequests.has(i.name)||this.pendingRequests.has(i.name)||this.pendingRequests.add(i.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){let r=new Map;if(!this.sourceCache.loaded())return r;let a=this.sourceCache.getVisibleCoordinates();if(0===a.length)return r;let n=this.sourceCache.getSource();if(!(n instanceof to))return r;let o=a.map(i=>this.sourceCache.getTile(i));for(let[a,s]of n.getImages(o,Array.from(this.pendingRequests)))r.set(i.I.from({name:a,iconsetId:this.id}),s),this.pendingRequests.delete(a);for(let i of this.pendingRequests)this.missingRequests.add(i);return this.pendingRequests.clear(),r}}class iA{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indoorMinimumZoom=16}findClosestBuilding(i,r,a,n,o){if(a<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let s=null,l=Number.MAX_VALUE,h=Number.MAX_VALUE,u=!1,c=this._previousClosestBuildingId?i[this._previousClosestBuildingId]:null;for(let[a,d]of(this._previousClosestBuildingId&&c&&this._isBuildingVisible(c,n,o)&&(u=!0,h=this._calculateDistance(r,c)),Object.entries(i))){if(!this._isBuildingVisible(d,n,o))continue;let i=this._calculateDistance(r,d);i<l&&(l=i,s=a)}return u&&s&&this._previousClosestBuildingId&&s!==this._previousClosestBuildingId?l>h*this._hysteresisRatio&&(s=this._previousClosestBuildingId):u&&!s&&(s=this._previousClosestBuildingId),this._previousClosestBuildingId=s,s}_calculateDistance(i,r){if(!r.center)return Number.MAX_VALUE;let a=i.lat-r.center[1],n=i.lng-r.center[0];return a*a+n*n}_isBuildingVisible(r,a,n){if(!n)return!1;for(let a of r.floorIds){let o=r.floors[a];if(!o.geometry)continue;let s=o.geometry;if("Polygon"===s.type){let r=this._convertRingToPoints(s.coordinates[0]);if(i.bx(r,n))return!0}else if("MultiPolygon"===s.type){let r=this._convertMultiPolygonToPoints(s.coordinates);if(i.cY(n,r))return!0}}return!1}_convertRingToPoints(r){return r.map(r=>new i.P(r[0],r[1]))}_convertMultiPolygonToPoints(r){return r.map(r=>0===r.length?[]:r[0].map(r=>new i.P(r[0],r[1])))}}class iC extends i.E{constructor(r){super(),this._style=r,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indoorState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new iA,this._initialLoadDone=!1,i.a_(["_updateUI"],this),this._style.on("style.load",()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>
8{this._initialLoadDone=!0,this._indoorState&&this._indoorState.needsUpdate&&(this._indoorState.needsUpdate=!1,this._style.updateIndoorDependentLayers()),this._updateUI()}),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI))})}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(i){i===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=i,this._recalculateActiveFloors())}setActiveFloorsVisibility(i){this._updateActiveFloors(i),this._updateIndoorSelector()}setIndoorData(i){let r=!1;for(let[a,n]of Object.entries(i.buildings))if(this._buildings[a])for(let i of n.floorIds)this._buildings[a].floorIds.add(i),this._buildings[a].floors[i]?this._mergeFloors(this._buildings[a].floors[i],n.floors[i]):(this._buildings[a].floors[i]=n.floors[i],this._buildings[a].floorIds.add(i),r=!0);else this._buildings[a]=n,r=!0;r&&this._recalculateActiveFloors()}getIndoorTileOptions(i,r){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(i,r),indoorState:this._indoorState}:null}getControlState(){let i=this._buildings,r=this._closestBuildingId,a=r&&i?i[r]:void 0;if(!a)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let n=null;for(let i of a.floorIds)if(this._activeFloors&&this._activeFloors.has(i)){n=i;break}let o=Array.from(a.floorIds).map(i=>({id:i,name:a.floors[i].name,zIndex:a.floors[i].zIndex})).sort((i,r)=>r.zIndex-i.zIndex).filter((i,r,a)=>0===r||i.zIndex!==a[r-1].zIndex);return{selectedFloorId:n,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:o}}_updateUI(){this._initialLoadDone=!0;let i=this._style.map.transform,r=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,i.center,i.zoom,i.getBounds(),this._makeViewportPolygon());if(r!==this._closestBuildingId){let i=this._closestBuildingId;this._closestBuildingId=r,this._onBuildingTransition(i,r),this._updateIndoorSelector()}}_onBuildingTransition(i,r){this._indoorState&&(!r&&i?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):r&&!i&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0)))}_updateIndoorSelector(){this.fire(new i.C("selector-update",this.getControlState()))}_updateActiveFloors(i){this._indoorState={selectedFloorId:this._selectedFloorId,activeFloorsVisible:i,activeFloors:this._activeFloors},this._initialLoadDone?this._style.updateIndoorDependentLayers():this._indoorState.needsUpdate=!0}_recalculateActiveFloors(){if(!this._buildings)return;let r=i.cZ.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(i,r){if(i===r)return!0;if(!i||!r||i.size!==r.size)return!1;for(let a of i)if(!r.has(a))return!1;return!0})(r,this._activeFloors)||(this._activeFloors=r,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(i,r){r.geometry&&(i.geometry?("Polygon"===i.geometry.type&&(i.geometry={type:"MultiPolygon",coordinates:[i.geometry.coordinates]}),"Polygon"===r.geometry.type?i.geometry.coordinates.push(r.geometry.coordinates):"MultiPolygon"===r.geometry.type&&i.geometry.coordinates.push(...r.geometry.coordinates)):i.geometry=r.geometry)}_makeViewportPolygon(){let r=this._style.map.transform,a=r.width,n=r.height;return[r.pointLocation(new i.P(0,0)),r.pointLocation(new i.P(a,0)),r.pointLocation(new i.P(a,n)),r.pointLocation(new i.P(0,n))].map(r=>new i.P(r.lng,r.lat))}}let iM=(i,r)=>ej(i,r&&r.filter(i=>"source.canvas"!==i.identifier)),iP=i.aJ(tv,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),iD=i.aJ(tv,["setCenter","setZoom","setBearing","setPitch"]),iR=new Set(["background","sky","slot","custom"]),iL={version:8,layers:[],sources:{}},iz={duration:300,delay:0};class iF extends i.E{constructor(r,a={}){if(super(),this.map=r,this.scope=a.scope||"",this.globalId=null,this.fragments=[],this.importDepth=a.importDepth||0,this.importsCache=a.importsCache||new Map,this.resolvedImports=a.resolvedImports||new Set,this.transition=Object.assign({},iz),this._buildingIndex=new ty(this),this.crossTileSymbolIndex=new ie,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._mergedFillExtrusionSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=a.styleChanges||new Q,this._hasDataDrivenEmissive=!1,this.indoorManager=new iC(this),this.dispatcher=a.dispatcher?a.dispatcher:new er(ea(),this),this.map.painter&&this.map.painter.context){const i=this.map.painter.context.maxUniformBufferBindings,r=Math.floor(this.map.painter.context.maxUniformBlockSize/4);this.dispatcher.broadcast("setContextParams",{maxBindingPoints:i,maxUniformBlockSizeDwords:r,disableSymbolUBO:this.map.painter.context.disableSymbolUBO})}a.imageManager?this.imageManager=a.imageManager:(this.imageManager=new en(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=a.glyphManager?a.glyphManager:new i.c_(r._requestManager,a.localFontFamily?i.c$.all:a.localIdeographFontFamily?i.c$.ideographs:i.c$.none,a.localFontFamily||a.localIdeographFontFamily),a.modelManager?this.modelManager=a.modelManager:(this.modelManager=new iw(r._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._fillExtrusionSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={}
8,this._order=[],this._markersNeedUpdate=!1,this.options=a.configOptions?a.configOptions:new Map,this._configDependentLayers=a.configDependentLayers?a.configDependentLayers:new Set,this._indoorDependentLayers=a.indoorDependentLayers?a.indoorDependentLayers:new Set,this._config=a.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:a.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=a.initialConfig,this.dispatcher.broadcast("setReferrer",i.d0()),this.dispatcher.broadcast("setConfig",i.d1());const n=this;this._rtlTextPluginCallback=iF.registerForPluginStateChange(r=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,a)=>{if(i.d2(r),a&&a.every(i=>i))for(let i in n._sourceCaches){let r=n._sourceCaches[i],a=r.getSource().type;"vector"!==a&&"geojson"!==a||r.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;let r=this.getOwnSource(i.sourceId);if(r&&r.vectorLayerIds)for(let i in this._layers){let a=this._layers[i];a.source===r.id&&this._validateLayer(a)}})}load(i){return i&&("string"==typeof i?this.loadURL(i):this.loadJSON(i)),this}_getGlobalId(r){if(!r)return null;if("string"==typeof r){if(i.h(r))return r;let a=i.d3(r);if(!a.startsWith("http"))try{return new URL(a,location.href).toString()}catch(i){}return a}return`json://${i.d4(JSON.stringify(r))}`}_diffStyle(r,a,n){this.globalId=this._getGlobalId(r);let o=(i,r)=>{try{r(null,this.setState(i,n))}catch(i){r(i,!1)}};if("string"==typeof r){let n=this.map._requestManager.normalizeStyleURL(r),s=this.map._requestManager.transformRequest(n,i.R.Style);i.m(s,(r,n)=>{r?this.fire(new i.B(r)):n&&o(n,a)})}else"object"==typeof r&&o(r,a)}loadURL(r,a={}){this.fire(new i.C("dataloading",{dataType:"style"}));let n="boolean"==typeof a.validate?a.validate:!i.h(r);this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,a.accessToken),this.resolvedImports.add(r);let o=this.importsCache.get(r);if(o)return this._load(o,n);let s=this.map._requestManager.transformRequest(r,i.R.Style);this._request=i.m(s,(a,o)=>{if(this._request=null,a)this.fire(new i.B(a));else if(o)return this.importsCache.set(r,o),this._load(o,n)})}loadJSON(r,a={}){this.fire(new i.C("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(r),this._request=i.o.frame(()=>{this._request=null,this._load(r,!1!==a.validate)})}loadEmpty(){this.fire(new i.C("dataloading",{dataType:"style"})),this._load(iL,!1)}_loadImports(r,a,n){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();let o=[];for(let s of r){let r=this._createFragmentStyle(s),l=new Promise(i=>{r.once("style.import.load",i),r.once("error",i)}).then(()=>{this.mergeAll(),this.fire(new i.C("data",{dataType:"style"}))});if(o.push(l),this.resolvedImports.has(s.url)){r.loadEmpty();continue}let h=s.data||this.importsCache.get(s.url);h?(s.data?(r.fire(new i.C("dataloading",{dataType:"style"})),r.globalId=r._getGlobalId(h),queueMicrotask(()=>r._load(h,a))):r.loadJSON(h,{validate:a}),this._isInternalStyle(h)&&(r.globalId=null)):s.url?r.loadURL(s.url,{validate:a}):r.loadEmpty();let u={style:r,id:s.id,config:s.config};if(n){let i=this.fragments.findIndex(({id:i})=>i===n);this.fragments=this.fragments.slice(0,i).concat(u).concat(this.fragments.slice(i))}else this.fragments.push(u)}return Promise.allSettled(o)}getImportGlobalIds(i=this,r=new Set){for(let a of i.fragments)a.style.globalId&&r.add(a.style.globalId),this.getImportGlobalIds(a.style,r);return[...r.values()]}_createFragmentStyle(r){let a,n=this.scope?i.F(r.id,this.scope):r.id,o=this._initialConfig&&this._initialConfig[n];(r.config||o)&&(a=Object.assign({},r.config,o));let s=new iF(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:a,configOptions:this.options,colorThemeOverride:r["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indo
8orDependentLayers});return s.setEventedParent(this.map,{style:s}),s}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(i){return this.isRootStyle()&&(i.fragment||!!i.schema&&!1!==i.fragment)}_load(r,a){if(this._isInternalStyle(r)){let i=Object.assign({},iL,{imports:[{id:"basemap",data:r,url:""}]},r.center?{center:r.center}:{},r.bearing?{bearing:r.bearing}:{},r.pitch?{pitch:r.pitch}:{},r.zoom?{zoom:r.zoom}:{},r.light?{light:r.light}:{});return this._importedAsBasemap=!0,void this._load(i,a)}if(this.updateConfig(this._config,r.schema),a&&iM(this,eC(r)))return;for(let i in this._loaded=!0,r.sources)this.addSource(i,r.sources[i],{validate:!1,isInitialLoad:!0});this.stylesheet=i.d5(r);let n=()=>{if(r.iconsets)for(let i in r.iconsets)this.addIconset(i,r.iconsets[i]);r.sprite?this._loadIconset(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&r.glyphs&&this.glyphManager.setURL(r.glyphs);let n=tx(this.stylesheet.layers);if(this._order=n.map(i=>i.id),this.stylesheet.light&&i.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){let i=this.stylesheet.lights[0];this.light=new eq(i.properties,i.id)}else this.setLights(this.stylesheet.lights);for(let r of(this.light||(this.light=new eq(this.stylesheet.light)),this._layers={},n)){let a=i.da(r,this.scope,this._styleColorTheme.lut,this.options);0!==a.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(a.fqid),a.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(a.fqid),this._hasAppearances=this._hasAppearances||0!==a.getAppearances().length,a.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=a;let n=this.getOwnLayerSourceCache(a),o=!!this.directionalLight&&this.directionalLight.shadowsEnabled();n&&a.canCastShadows()&&o&&(n.castsShadows=!0)}if(this.glyphManager.url){let i=new Set;for(let r in this._layers){let a=this._layers[r];if("symbol"===a.type&&a.layout){let r=a.layout.get("text-font");r&&r.value&&"constant"===r.value.kind&&i.add(r.value.value.join(","))}}for(let r of i)this.glyphManager.prefetchRange(r,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);let o=this.stylesheet.terrain;o&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(o,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new i.C("data",{dataType:"style"}));let s=this.isRootStyle();r.imports?this._loadImports(r.imports,a).then(()=>{this._reloadImports(),this.fire(new i.C(s?"style.load":"style.import.load"))}).catch(r=>{this.fire(new i.B(Error("Failed to load imports",r))),this.fire(new i.C(s?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new i.C(s?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];let o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(o){let r=this._evaluateColorThemeData(o);this._loadColorTheme(r).then(()=>{n()}).catch(r=>{i.w(`Couldn't load color theme from the stylesheet: ${r}`),n()})}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}hasAppearances(){return this._hasAppearances||this.fragments.some(i=>i.style.hasAppearances())}mergeAll(){let i,r,a,n,o,s,l,h,u,c,d={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(p=>
8{if(p.stylesheet){if(null!=p.light&&(i=p.light),p.stylesheet.lights)for(let i of p.stylesheet.lights)"ambient"===i.type&&null!=p.ambientLight&&(r=p.ambientLight),"directional"===i.type&&null!=p.directionalLight&&(a=p.directionalLight);n=this._prioritizeTerrain(n,p.terrain,p.stylesheet.terrain),p.stylesheet.fog&&null!=p.fog&&(o=p.fog),p.stylesheet.snow&&null!=p.snow&&(s=p.snow),p.stylesheet.rain&&null!=p.rain&&(l=p.rain),null!=p.stylesheet.camera&&(c=p.stylesheet.camera),null!=p.stylesheet.projection&&(h=p.stylesheet.projection),null!=p.stylesheet.transition&&(u=p.stylesheet.transition),d[p.scope]=p._styleColorTheme}}),this.light=i,this.ambientLight=r,this.directionalLight=a,this.fog=o,this.snow=s,this.rain=l,this._styleColorThemeForScope=d,null===n?delete this.terrain:this.terrain=n,this.camera=c||{"camera-projection":"perspective"},this.projection=h||{name:"mercator"},this.transition=Object.assign({},iz,u),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(i){let r=a=>{for(let i of a.fragments)r(i.style);i(a)};r(this)}_prioritizeTerrain(i,r,a){let n=i&&0===i.drapeRenderMode;return null===a?r&&0===r.drapeRenderMode?r:n?i:null:null!=r&&(!i||n||r&&1===r.drapeRenderMode)?r:i}mergeTerrain(){let i;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(r=>{i=this._prioritizeTerrain(i,r.terrain,r.stylesheet.terrain)}),null===i?delete this.terrain:this.terrain=i}mergeProjection(){let i;this.forEachFragmentStyle(r=>{null!=r.stylesheet.projection&&(i=r.stylesheet.projection)}),this.projection=i||{name:"mercator"}}mergeSources(){let r={},a={},n={},o={};this.forEachFragmentStyle(s=>{for(let a in s._sourceCaches)r[i.F(a,s.scope)]=s._sourceCaches[a];for(let r in s._otherSourceCaches)a[i.F(r,s.scope)]=s._otherSourceCaches[r];for(let r in s._symbolSourceCaches)n[i.F(r,s.scope)]=s._symbolSourceCaches[r];for(let r in s._fillExtrusionSourceCaches)o[i.F(r,s.scope)]=s._fillExtrusionSourceCaches[r]}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=a,this._mergedSymbolSourceCaches=n,this._mergedFillExtrusionSourceCaches=o}mergeIndoor(){this.forEachFragmentStyle(r=>{if(r.stylesheet&&r.stylesheet.indoor)for(let a of Object.values(r.stylesheet.indoor)){let n=i.F(a.sourceId,r.scope);this._mergedIndoor[n]=new Set(a.sourceLayers||[])}})}mergeLayers(){let r={},a=[],n={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(n=>{for(let o of n._order){let s=n._layers[o];if("slot"===s.type){let a=i.d6(o);if(r[a])continue;r[a]=[]}s.slot&&r[s.slot]?r[s.slot].push(s):a.push(s)}}),this._mergedOrder=[];let o=-1,s=(a=[])=>{for(let l of a)if("slot"===l.type){let a=i.d6(l.id);r[a]&&s(r[a]),this._mergedSlots.push(a)}else{let r=i.F(l.id,l.scope);this._mergedOrder.push(r),n[r]=l,l.is3D(!!this.terrain)&&(this._has3DLayers=!0,o=this._mergedOrder.length-1),"circle"===l.type&&(this._hasCircleLayers=!0),"symbol"===l.type&&(this._hasSymbolLayers=!0),"clip"===l.type&&(this._clipLayerPresent=!0)}};if(s(a),this._has3DLayers){let i={};for(let r=0;r<this._mergedOrder.length;++r){let a=this._mergedOrder[r];i[a]=r===o?1:r<o?2*!!n[a].hasOcclusionOpacityProperties:4}this._mergedOrder.sort((r,a)=>i[r]-i[a])}this._mergedLayers=n,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?(function(r,a,n){let o=Object.assign({},a);for(let i of Object.keys(iT))void 0===o[i]&&(o[i]=iT[i].default);let s=new i.aa(iS,r,new Map(n));return s.setTransitionOrValue(o,n),s.untransitioned().possiblyEvaluate(new i.ae(0,{worldview:void 0}))})(this.scope,r,this.options).get("data"):null}_loadColorTheme(r){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;let a=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((n,o)=>{let s="data:image/png;base64,";if(!r||0===r.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void n();let l=r;l.startsWith(s)||(l=s+l);let h=i.I.from("mapbox-reserved-lut"),u=new Image;u.src=l,u.onerror=()=>{this._styleColorTheme.lutLoading=!1,o(Error("Failed to load image data"))},u.onload=()=>
8{if(this._styleColorTheme.lutLoadingCorrelationID!==a)return void n();this._styleColorTheme.lutLoading=!1;let{width:s,height:l,data:c}=i.o.getImageData(u);if(l>32)return void o(Error("The height of the image must be less than or equal to 32 pixels."));if(s!==l*l)return void o(Error("The width of the image must be equal to the height squared."));this.getImage(h)&&this.removeImage(h),this.addImage(h,{data:new i.q({width:s,height:l},c),pixelRatio:1,sdf:!1,usvg:!1,version:0});let d=this.imageManager.getImage(h,this.scope);d?(this._styleColorTheme.lut={image:d.data,data:r},n()):o(Error("Missing LUT image."))}})}getLut(i){let r=this._styleColorThemeForScope[i];return r?r.lut:null}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(r){this._spriteRequest=function(r,a,n){let o,s,l,h=i.o.devicePixelRatio>1?"@2x":"",u=i.m(a.transformRequest(a.normalizeSpriteURL(r,h,".json"),i.R.SpriteJSON),(i,r)=>{u=null,l||(l=i,o=r,d())}),c=i.n(a.transformRequest(a.normalizeSpriteURL(r,h,".png"),i.R.SpriteImage),(i,r)=>{c=null,l||(l=i,s=r,d())});function d(){if(l)n(l);else if(o&&s){let r=i.o.getImageData(s),a={};for(let n in o){let{width:s,height:l,x:h,y:u,sdf:c,pixelRatio:d,stretchX:p,stretchY:f,content:m}=o[n],_=new i.q({width:s,height:l});i.q.copy(r,_,{x:h,y:u},{x:0,y:0},{width:s,height:l},null),a[n]={data:_,pixelRatio:void 0!==d?d:1,sdf:void 0!==c&&c,stretchX:p,stretchY:f,content:m,usvg:!1,version:0}}n(null,a)}}return{cancel(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(r,this.map._requestManager,(r,a)=>{if(this._spriteRequest=null,r)this.fire(new i.B(r));else if(a){let r=new Map;for(let n in a)r.set(i.I.from(n),a[n]);this.addImages(r)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.C("data",{dataType:"style"}))})}addIconset(r,a){if("sprite"===a.type)return void this._loadSprite(a.url);let n=this.getOwnSourceCache(a.source);if(!n)return void this.fire(new i.B(Error(`Source "${a.source}" as specified by iconset "${r}" does not exist and cannot be used as an iconset source`)));let o=n.getSource();if("raster-array"!==o.type)return void this.fire(new i.B(Error(`Source "${a.source}" as specified by iconset "${r}" is not a "raster-array" source and cannot be used as an iconset source`)));o.partial=!1;let s=new iE(r,this.scope,n);this.imageManager.addImageProvider(s,this.scope)}removeIconset(i){this.imageManager.removeImageProvider(i,this.scope)}_loadIconset(r){var a,n;if(!i.h(r)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(r);let o="auto"===this.map._spriteFormat;this._spriteRequest=(n=(a,n)=>{if(this._spriteRequest=null,a)o?this._loadSprite(r):this.fire(new i.B(a));else if(n){let r=new Map;for(let a in n)r.set(i.I.from(a),n[a]);this.addImages(r)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.C("data",{dataType:"style"}))},i.b2((a=this.map._requestManager).transformRequest(a.normalizeIconsetURL(r),i.R.Iconset),(r,a)=>{if(r)return void n(r);let o={};for(let r of i.cX(new i.b0(a)).icons){let a={version:1,pixelRatio:i.o.devicePixelRatio,content:function(r){if(!r.metadata||!r.metadata.content_area)return;let a=i.o.devicePixelRatio,{left:n,top:o,width:s,height:l}=r.metadata.content_area,h=n*a,u=o*a;return[h,u,h+s*a,u+l*a]}(r),stretchX:r.metadata?iI(r.metadata.stretch_x_areas):void 0,stretchY:r.metadata?iI(r.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:r};o[r.name]=a}n(null,o)}))}_validateLayer(r){let a=this.getOwnSource(r.source);if(!a)return;let n=r.sourceLayer;n&&("geojson"===a.type||a.vectorLayerIds&&-1===a.vectorLayerIds.indexOf(n))&&this.fire(new i.B(Error(`Source layer "${n}" does not exist on source "${a.id}" as specified by style layer "${r.id}"`)))}
8loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(let i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(let{style:i}of this.fragments)if(!i.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((i,r)=>{let a=this.fragments[r];return a&&a.style&&(i.data=a.style.serialize()),i})}_serializeSources(){let i={};for(let r in this._sourceCaches){let a=this._sourceCaches[r].getSource();i[a.id]||(i[a.id]=a.serialize())}return i}_serializeLayers(i){let r=[];for(let a of i){let i=this._layers[a];i&&"custom"!==i.type&&r.push(i.serialize())}return r}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(let i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(let i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(let i in this._mergedLayers){let r=this._mergedLayers[i];if(r._transitionablePaint&&r._transitionablePaint._values){let i=r._transitionablePaint._values["line-emissive-strength"];if(i&&i.value&&i.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(i){return i?this.order:this._mergedOrder}isLayerDraped(i){return!!this.terrain&&i.isDraped(this.getLayerSourceCache(i))}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}_checkLayer(r){let a=this.getOwnLayer(r);if(a)return a;this.fire(new i.B(Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){let a=this.getOwnSource(r);if(a)return a;this.fire(new i.B(Error(`The source '${r}' does not exist in the map's style.`)))}precompilePrograms(i,r){let a=this.map.painter;if(a)for(let n=i.minzoom||0;n<(i.maxzoom||25.5);n++){let n=i.getProgramIds();if(n)for(let o of n){let n=i.getDefaultProgramParams(o,r.zoom,this._styleColorTheme.lut);n&&(a.style=this,this.fog&&(a._fogVisible=!0,n.overrideFog=!0,a.getOrCreateProgram(o,n)),a._fogVisible=!1,n.overrideFog=!1,a.getOrCreateProgram(o,n),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(n.overrideRtt=!0,a.getOrCreateProgram(o,n)))}}}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);let a=this.calculateLightsBrightness();r.brightness=a||0,a!==this._brightness&&(this._brightness=a,this.dispatcher.broadcast("setBrightness",a)),r.worldview!==this._worldview&&(this._worldview=r.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));let n=this._changes.isDirty(),o=!1;if(this._changes.isDirty()){let i=this._changes.getLayerUpdatesByScope();for(let r in i){let{updatedIds:a,removedIds:n}=i[r];(a||n)&&(this._updateWorkerLayers(r,a,n),o=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this.snow&&this.snow.updateTransitions(r),this.rain&&this.rain.updateTransitions(r),this._changes.reset()}let s={};for(let i in this._mergedSourceCaches){let r=this._mergedSourceCaches[i];s[i]=r.used,r.used=!1,r.tileCoverLift=0}let l={};for(let a of this._mergedOrder){let n=this._mergedLayers[a];if(("none"!==n.visibility||n.hasTransition())&&n.recalculate(r,this._availableImages),!n.isHidden(r.zoom)){let i=this.getLayerSourceCache(n);i&&(i.used=!0,i.tileCoverLift=Math.max(i.tileCoverLift,n.tileCoverLift()))}if("fill-extrusion"===n.type){let r=i.F(n.source,n.scope);if(r in this._mergedFillExtrusionSourceCaches){let i=n.layout&&n.layout.get("source-max-zoom");if(null!=i){let a=l[r];l[r]=null==a?i:Math.min(a,i)}}}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
8{this.precompilePrograms(n,r)}):this.precompilePrograms(n,r))}for(let i in this._shouldPrecompile&&(this._precompileDone=!0),this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[i].setMaxzoomOverride(null!=l[i]?l[i]:null);for(let i of(this.terrain&&o&&this.mergeLayers(),this.imageManager.getPendingImageProviders()))i.sourceCache.used=!0;for(let r in s){let a=this._mergedSourceCaches[r];s[r]!==a.used&&a.getSource().fire(new i.C("data",{sourceDataType:"visibility",dataType:"source",sourceId:a.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.snow&&this.snow.recalculate(r),this.rain&&this.rain.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),n&&this.fire(new i.C("data",{dataType:"style"}))}updateImageProviders(){for(let i of this.imageManager.getPendingImageProviders()){let r=i.resolvePendingRequests(),a=this.getFragmentStyle(i.scope);a&&a.addImages(r)}}_updateTilesForChangedImages(){let i={};for(let r in this._mergedSourceCaches){let a=this._mergedSourceCaches[r].getSource().scope;i[a]=i[a]||this._changes.getUpdatedImages(a),0!==i[a].length&&this._mergedSourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i[a])}for(let r in i)this._changes.resetUpdatedImages(r)}_updateWorkerLayers(i,r,a){let n=this.getFragmentStyle(i);n&&this.dispatcher.broadcast("updateLayers",{layers:r?n._serializeLayers(r):[],scope:i,removedIds:a||[],options:n.options})}setState(r,a){if(this._checkLoaded(),iM(this,eC(r)))return!1;(r=i.d5(r)).layers=tx(r.layers);let n=(function(r,a){if(!r)return[{command:tv.setStyle,args:[a]}];let n=[];try{if(!i.b7(r.version,a.version)||(i.b7(r.center,a.center)||n.push({command:tv.setCenter,args:[a.center]}),i.b7(r.zoom,a.zoom)||n.push({command:tv.setZoom,args:[a.zoom]}),i.b7(r.bearing,a.bearing)||n.push({command:tv.setBearing,args:[a.bearing]}
8),i.b7(r.pitch,a.pitch)||n.push({command:tv.setPitch,args:[a.pitch]}),i.b7(r.sprite,a.sprite)||n.push({command:tv.setSprite,args:[a.sprite]}),i.b7(r.glyphs,a.glyphs)||n.push({command:tv.setGlyphs,args:[a.glyphs]}),i.b7(r.imports,a.imports)||function(r=[],a=[],n){let o,s,l,h;a=a||[];let u=(r=r||[]).map(tS),c=a.map(tS),d=r.reduce(tI,{}),p=a.reduce(tI,{}),f=u.slice();for(o=0,s=0;o<u.length;o++)l=u[o],p.hasOwnProperty(l)?s++:(n.push({command:tv.removeImport,args:[l]}),f.splice(f.indexOf(l,s),1));for(o=0,s=0;o<c.length;o++)l=c[c.length-1-o],f[f.length-1-o]!==l&&(d.hasOwnProperty(l)?(n.push({command:tv.removeImport,args:[l]}),f.splice(f.lastIndexOf(l,f.length-s),1)):s++,h=f[f.length-o],n.push({command:tv.addImport,args:[p[l],h]}),f.splice(f.length-o,0,l));for(let r of a){let a=d[r.id];a&&(delete a.data,i.b7(a,r)||n.push({command:tv.updateImport,args:[r.id,r]}))}}(r.imports,a.imports,n),i.b7(r.transition,a.transition)||n.push({command:tv.setTransition,args:[a.transition]}),i.b7(r.light,a.light)||n.push({command:tv.setLight,args:[a.light]}),i.b7(r.fog,a.fog)||n.push({command:tv.setFog,args:[a.fog]}),i.b7(r.snow,a.snow)||n.push({command:tv.setSnow,args:[a.snow]}),i.b7(r.rain,a.rain)||n.push({command:tv.setRain,args:[a.rain]}),i.b7(r.projection,a.projection)||n.push({command:tv.setProjection,args:[a.projection]}),i.b7(r.lights,a.lights)||n.push({command:tv.setLights,args:[a.lights]}),i.b7(r.camera,a.camera)||n.push({command:tv.setCamera,args:[a.camera]}),i.b7(r.iconsets,a.iconsets)||function(r,a,n){let o;for(o in a=a||{},r=r||{})r.hasOwnProperty(o)&&(a.hasOwnProperty(o)||n.push({command:tv.removeIconset,args:[o]}));for(o in a){if(!a.hasOwnProperty(o))continue;let s=a[o];r.hasOwnProperty(o)?i.b7(r[o],s)||(n.push({command:tv.removeIconset,args:[o]}),n.push({command:tv.addIconset,args:[o,s]})):n.push({command:tv.addIconset,args:[o,s]})}}(r.iconsets,a.iconsets,n),!i.b7(r["color-theme"],a["color-theme"])))return[{command:tv.setStyle,args:[a]}];let o={},s=[];!function(r,a,n,o){let s;for(s in a=a||{},r=r||{})r.hasOwnProperty(s)&&(a.hasOwnProperty(s)||tw(s,n,o));for(s in a){var l;if(!a.hasOwnProperty(s))continue;let h=a[s];r.hasOwnProperty(s)?i.b7(r[s],h)||("geojson"===r[s].type&&"geojson"===h.type&&function(r,a,n){let o;for(o in r[n])if(r[n].hasOwnProperty(o)&&"data"!==o&&!i.b7(r[n][o],a[n][o]))return!1;for(o in a[n])if(a[n].hasOwnProperty(o)&&"data"!==o&&!i.b7(r[n][o],a[n][o]))return!1;return!0}(r,a,s)?n.push({command:tv.setGeoJSONSourceData,args:[s,h.data]}):(l=a,tw(s,n,o),tb(s,l,n))):tb(s,a,n)}}(r.sources,a.sources,s,o);let l=[];r.layers&&r.layers.forEach(i=>{i.source&&o[i.source]?n.push({command:tv.removeLayer,args:[i.id]}):l.push(i)});let h=r.terrain;h&&o[h.source]&&(n.push({command:tv.setTerrain,args:[void 0]}),h=void 0),n=n.concat(s),i.b7(h,a.terrain)||n.push({command:tv.setTerrain,args:[a.terrain]}),function(r,a,n){let o,s,l,h,u,c,d;a=a||[];let p=(r=r||[]).map(tS),f=a.map(tS),m=r.reduce(tI,{}),_=a.reduce(tI,{}),g=p.slice(),y=Object.create(null);for(o=0,s=0;o<p.length;o++)l=p[o],_.hasOwnProperty(l)?s++:(n.push({command:tv.removeLayer,args:[l]}),g.splice(g.indexOf(l,s),1));for(o=0,s=0;o<f.length;o++)l=f[f.length-1-o],g[g.length-1-o]!==l&&(m.hasOwnProperty(l)?(n.push({command:tv.removeLayer,args:[l]}),g.splice(g.lastIndexOf(l,g.length-s),1)):s++,c=g[g.length-o],n.push({command:tv.addLayer,args:[_[l],c]}),g.splice(g.length-o,0,l),y[l]=!0);for(o=0;o<f.length;o++)if(h=m[l=f[o]],u=_[l],!y[l]&&!i.b7(h,u))if(i.b7(h.source,u.source)&&i.b7(h["source-layer"],u["source-layer"])&&i.b7(h.type,u.type)){for(d in tT(h.layout,u.layout,n,l,null,tv.setLayoutProperty),tT(h.paint,u.paint,n,l,null,tv.setPaintProperty),i.b7(h.slot,u.slot)||n.push({command:tv.setSlot,args:[l,u.slot]}),i.b7(h.filter,u.filter)||n.push({command:tv.setFilter,args:[l,u.filter]}),i.b7(h.minzoom,u.minzoom)&&i.b7(h.maxzoom,u.maxzoom)||n.push({command:tv.setLayerZoomRange,args:[l,u.minzoom,u.maxzoom]}),h)h.hasOwnProperty(d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&"slot"!==d&&(0===d.indexOf("paint.")?tT(h[d],u[d],n,l,d.slice(6),tv.setPaintProperty):i.b7(h[d],u[d])||n.push({command:tv.setLayerProperty,args:[l,d,u[d]]}));for(d in u)u.hasOwnProperty(d)&&!h.hasOwnProperty(d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&"slot"!==d&&(0===d.indexOf("paint.")?tT(h[d],u[d],n,l,d.slice(6),tv.setPaintProperty):i.b7(h[d],u[d])||n.push({command:tv.setLayerProperty,args:[l,d,u[d]]}))}else n.push({command:tv.removeLayer,args:[l]}),c=g[g.lastIndexOf(l)+1],n.push({command:tv.addLayer,args:[u,c]})}(l,a.layers,n)}catch(i){console.warn("Unable to compute style diff:",i),n=[{command:tv.setStyle,args:[a]}]}return n})(this.serialize(),r).filter(i=>!(i.command in iD));if(0===n.length)return!1;let o=n.filter(i=>!(i.command in iP));if(o.length>0)throw Error(`Unimplemented: ${o.map(i=>i.command).join(", ")}.`);let s=[];
8return n.forEach(i=>{s.push(this[i.command](...i.args))}),a&&Promise.all(s).then(a).catch(a),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(r){if(0===r.size)return this;for(let[a,n]of r.entries()){if(this.getImage(a))return this.fire(new i.B(Error(`An image with the name "${a.name}" already exists.`)));this.imageManager.addImage(a,this.scope,n),this._changes.updateImage(a,this.scope)}return this._updateWorkerImages(),this.fire(new i.C("data",{dataType:"style"})),this}addImage(r,a){return this.getImage(r)?this.fire(new i.B(Error(`An image with the name "${r.name}" already exists.`))):(this.imageManager.addImage(r,this.scope,a),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.C("data",{dataType:"style"})),this)}updateImage(r,a,n=!1){this.imageManager.updateImage(r,this.scope,a),n&&(this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.C("data",{dataType:"style"})))}getImage(i){return this.imageManager.getImage(i,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.C("data",{dataType:"style"})),this):this.fire(new i.B(Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(r){return this.modelManager.addModelURLs(r,this.getActualScope()),this._updateWorkerModels(),this.fire(new i.C("data",{dataType:"style"})),this}addModel(r,a,n={}){return this._checkLoaded(),this._validate(eN,`models.${r}`,a,null,n)||(this.modelManager.addModel(r,a,this.getActualScope()),this.fire(new i.C("data",{dataType:"style"}))),this}hasModel(i){return this.modelManager.hasModel(i,this.getActualScope())}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.getActualScope(),!1,!0),this.fire(new i.C("data",{dataType:"style"})),this):this.fire(new i.B(Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(r,a,n={}){if(this._checkLoaded(),void 0!==this.getOwnSource(r))throw Error(`There is already a source with ID "${r}".`);if(!a.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(a.type)>=0&&this._validate(eM,`sources.${r}`,a,null,n))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);let o=tl(r,a,this.dispatcher,this);o.scope=this.scope,o.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(o.id),source:o.serialize(),sourceId:o.id}));let s=r=>{let a=(r===i.b5.Symbol?"symbol:":r===i.b5.FillExtrusion?"fill-extrusion:":"other:")+o.id,n=i.F(a,this.scope),s=this._sourceCaches[a]=new tm(n,o,r);r===i.b5.Symbol?this._symbolSourceCaches[o.id]=s:r===i.b5.FillExtrusion?this._fillExtrusionSourceCaches[o.id]=s:this._otherSourceCaches[o.id]=s,s.onAdd(this.map)};s(i.b5.Other),"vector"!==a.type&&"geojson"!==a.type||(s(i.b5.Symbol),"vector"===a.type&&s(i.b5.FillExtrusion)),o.onAdd&&o.onAdd(this.map),n.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();let a=this.getOwnSource(r);if(!a)throw Error("There is no source with this ID");for(let a in this._layers)if(this._layers[a].source===r)return this.fire(new i.B(Error(`Source "${r}" cannot be removed while layer "${a}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new i.B(Error(`Source "${r}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){let a=Object.entries(this.stylesheet.iconsets).find(([i,a])=>"source"===a.type&&a.source===r);if(a)return this.fire(new i.B(Error(`Source "${r}" cannot be removed while iconset "${a[0]}" is using it.`)))}for(let a of this.getOwnSourceCaches(r)){let r=i.d6(a.id);delete this._sourceCaches[r],this._changes.discardSourceCacheUpdate(a.id),a.fire(new i.C("data",{sourceDataType:"metadata",dataType:"source",sourceId:a.getSource().id})),a.setEventedParent(null),a.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],delete this._fillExtrusionSourceCaches[r],this.mergeSources(),a.setEventedParent(null),a.onRemove&&a.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(i,r){this._checkLoaded(),this.getOwnSource(i).setData(r),this._changes.setDirty()}getOwnSource(i){let r=this.getOwnSourceCache(i);return r&&r.getSource()}getOwnSources(){let i=[];for(let r in this._otherSourceCaches){let a=this.getOwnSourceCache(r);a&&i.push(a.getSource())}return i}areTilesLoaded(){let i=this._mergedSourceCaches;for(let r in i){let a=i[r]._tiles;for(let i in a){let r=a[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}}return!0}setLights(r){if(this._checkLoaded(),!r)return delete this.ambientLight,void delete this.directionalLight;let a=this._getTransitionParameters();
8for(let i of r){if(this._validate(eD,"lights",i))return;switch(i.type){case"ambient":if(this.ambientLight){let r=this.ambientLight;r.set(i),r.updateTransitions(a)}else this.ambientLight=new e5(i,e4(),this.scope,this.options);break;case"directional":if(this.directionalLight){let r=this.directionalLight;r.set(i),r.updateTransitions(a)}else this.directionalLight=new e5(i,e6(),this.scope,this.options)}}let n=Object.assign(a,{worldview:this.map.getWorldview()}),o=new i.ae(this.z||0,n);this.ambientLight&&this.ambientLight.recalculate(o),this.directionalLight&&this.directionalLight.recalculate(o),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){let r=this.directionalLight,a=this.ambientLight;if(!r||!a)return;let n=i=>.2126*(i[0]<=.03928?i[0]/12.92:Math.pow((i[0]+.055)/1.055,2.4))+.7152*(i[1]<=.03928?i[1]/12.92:Math.pow((i[1]+.055)/1.055,2.4))+.0722*(i[2]<=.03928?i[2]/12.92:Math.pow((i[2]+.055)/1.055,2.4)),o=r.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),s=r.properties.get("intensity"),l=r.properties.get("direction"),h=1-i.cL(l.x,l.y,l.z)[2]/90,u=n(o)*s*h,c=a.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),d=a.properties.get("intensity");return Number(((u+n(c)*d)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;let i=[];return this.directionalLight&&i.push(this.directionalLight.get()),this.ambientLight&&i.push(this.ambientLight.get()),i}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(null==r||""===r&&this.isRootStyle())return this;if(i.d7(r)){let a=i.d8(r),n=this.fragments.find(({id:i})=>i===a);if(!n)return;let o=i.d6(r);return n.style.getFragmentStyle(o)}{let i=this.fragments.find(({id:i})=>i===r);return i?i.style:void 0}}setFeaturesetSelectors(r){if(!r)return;let a=(i,r="")=>`${i}::${r}`;for(let n in this._featuresetSelectors={},r){let o={},s=this._featuresetSelectors[n]=[];for(let l of r[n].selectors){let r;if(l.featureNamespace){let r=this.getOwnLayer(l.layer);if(!r){i.w(`Layer is undefined for selector: ${l.layer}`);continue}let s=a(r.source,r.sourceLayer);if(s in o&&o[s]!==l.featureNamespace){i.w(`"featureNamespace ${l.featureNamespace} of featureset ${n}'s selector is not associated to the same source, skip this selector`);continue}o[s]=l.featureNamespace}if(l.properties)for(let a in l.properties){let n=i.X(l.properties[a]);"success"===n.result&&((r=r||{})[a]=n.value)}s.push({layerId:l.layer,namespace:l.featureNamespace,properties:r,uniqueFeatureID:l._uniqueFeatureID})}}}getFeaturesetDescriptors(i){let r=this.getFragmentStyle(i);if(!r||!r.stylesheet.featuresets)return[];let a=[];for(let i in r.stylesheet.featuresets)a.push({featuresetId:i,importId:r.scope?r.scope:void 0});return a}getFeaturesetLayers(r,a){let n=this.getFragmentStyle(a),o=n.stylesheet.featuresets;if(!o||!o[r])return this.fire(new i.B(Error(`The featureset '${r}' does not exist in the map's style and cannot be queried.`))),[];let s=[];for(let i of o[r].selectors){let r=n.getOwnLayer(i.layer);r&&s.push(r)}return s}getConfigProperty(r,a){let n=this.getFragmentStyle(r);if(!n)return null;let o=i.F(a,n.scope),s=n.options.get(o),l=s?s.value||s.default:null;return l?l.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(r,a){let n=i.F(r,a);return this._mergedIndoor[n]}setIndoorData(i,r){this.indoorManager.setIndoorData(r)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(r,a,n){let o,s=this.getFragmentStyle(r);if(!s)return;let l=s.stylesheet.schema;if(!l||!l[a])return;let h=i.X(n);if("success"!==h.result)return void iM(this,h.value);let u=h.value.expression,c=i.F(a,s.scope),d=s.options.get(c);if(!d)return;let{minValue:p,maxValue:f,stepValue:m,type:_,values:g}=l[a],y=i.X(l[a].default);"success"===y.result&&(o=y.value.expression),o?(this.options.set(c,Object.assign({},d,{value:u,default:o,minValue:p,maxValue:f,stepValue:m,type:_,values:g})),this.updateConfigDependencies(a)):this.fire(new i.B(Error(`No schema defined for the config option "${a}" in the "${r}" fragment.`)))}getConfig(r){let a=this.getFragmentStyle(r);if(!a)return null;let n=a.stylesheet.schema;if(!n)return null;let o={};for(let r in n){let n=i.F(r,a.scope),s=a.options.get(n),l=s?s.value||s.default:null;o[r]=l?l.serialize():null}return o}setConfig(i,r){let a=this.getFragmentStyle(i);a&&(a.updateConfig(r,a.stylesheet.schema),this.updateConfigDependencies())}getSchema(i){let r=this.getFragmentStyle(i);return r?r.stylesheet.schema:null}setSchema(i,r){let a=this.getFragmentStyle(i);a&&(a.stylesheet.schema=r,a.updateConfig(a._config,r),this.updateConfigDependencies())}updateConfig(r,a){if(this._config=r,r||a)if(a)for(let n in a){let o,s,l=i.X(a[n].default);if("success"===l.result&&(o=l.value.expression),r&&void 0!==r[n]){let a=i.X(r[n]);"success"===a.result&&(s=a.value.expression)}let{minValue:h,maxValue:u,stepValue:c,type:d,values:p}=a[n];if(o){let r=i.F(n,this.scope);this.options.set(r,{default:o,value:s,minValue:h,maxValue:u,stepValue:c,type:d,values:p})}
8else this.fire(new i.B(Error(`No schema defined for config option "${n}".`)))}else this.fire(new i.B(Error("Attempting to set config for a style without schema.")))}_updateLayers(i,r=()=>!0){for(let a of i){let i=this.getLayer(a);i&&r(i)&&(i.possiblyEvaluateVisibility(),this._updateLayer(i),this._changes.setDirty())}}updateConfigDependencies(i){this._updateLayers(this._configDependentLayers,r=>!i||r.expressionDependencies.configDependencies.has(i)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(i=>{let r=i._styleColorTheme.colorThemeOverride?i._styleColorTheme.colorThemeOverride:i._styleColorTheme.colorTheme;if(r){let a=i._evaluateColorThemeData(r);(!i._styleColorTheme.lut&&""!==a||i._styleColorTheme.lut&&a!==i._styleColorTheme.lut.data)&&i.setColorTheme(r)}}),this._changes.setDirty()}addLayer(r,a,n={}){let o;this._checkLoaded();let s=r.id;if(this._layers[s])return void this.fire(new i.B(Error(`Layer with i
8d "${s}" already exists on this map`)));if("custom"===r.type){if(iM(this,i.d9(r)))return;o=i.da(r,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof r.source&&(this.addSource(s,r.source),r=Object.assign(r=i.d5(r),{source:s})),this._validate(eO,`layers.${s}`,r,{arrayIndex:-1},n))return;o=i.da(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:s}})}let l=i.F(o.source,o.scope);0!==o.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(l),o.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(l);let h=this._order.length;if(a){let r=this._order.indexOf(a);if(-1===r)return void this.fire(new i.B(Error(`Layer with id "${a}" does not exist on this map.`)));o.slot&&o.slot!==this._layers[a].slot?i.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`):h=r}this._order.splice(h,0,s),this._handleLayerOrderChange(),this._layers[s]=o;let u=this.getOwnLayerSourceCache(o),c=!!this.directionalLight&&this.directionalLight.shadowsEnabled();u&&o.canCastShadows()&&c&&(u.castsShadows=!0);let d=this._changes.getRemovedLayer(o);if(d&&o.source&&u&&"custom"!==o.type){this._changes.discardLayerRemoval(o);let r=i.F(o.source,o.scope);d.type!==o.type?this._changes.updateSourceCache(r,"clear"):(this._changes.updateSourceCache(r,"reload"),u.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),o.scope=this.scope,this.mergeLayers()}moveLayer(r,a){this._checkLoaded();let n=this._checkLayer(r);if(!n||r===a)return;let o=this._order.indexOf(r);this._order.splice(o,1);let s=this._order.length;if(a){let r=this._order.indexOf(a);
8if(-1===r)return void this.fire(new i.B(Error(`Layer with id "${a}" does not exist on this map.`)));n.slot&&n.slot!==this._layers[a].slot?i.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`):s=r}this._order.splice(s,0,r),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(i){this._checkLoaded();let r=this._checkLayer(i);if(!r)return;r.setEventedParent(null);let a=this._order.indexOf(i);this._order.splice(a,1),delete this._layers[i],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(r.fqid),this._indoorDependentLayers.delete(r.fqid),this._changes.removeLayer(r);let n=this.getOwnLayerSourceCache(r);if(n&&n.castsShadows){let i=!1;for(let a in this._layers)if(this._layers[a].source===r.source&&this._layers[a].canCastShadows()){i=!0;break}n.castsShadows=i}r.onRemove&&r.onRemove(this.map),this.mergeLayers()}getOwnLayer(i){return this._layers[i]}hasLayer(i){return i in this._mergedLayers}hasLayerType(i){for(let r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(i,r,a){this._checkLoaded();let n=this._checkLayer(i);n&&(n.minzoom===r&&n.maxzoom===a||(null!=r&&(n.minzoom=r),null!=a&&(n.maxzoom=a),this._updateLayer(n)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(i,r){this._checkLoaded();let a=this._checkLayer(i);a&&a.slot!==r&&(a.slot=r,this._updateLayer(a))}setFilter(r,a,n={}){this._checkLoaded();let o=this._checkLayer(r);if(o&&!i.b7(o.filter,a))return null==a?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(eB,`layers.${o.id}.filter`,a,{layerType:o.type},n)||(o.filter=i.d5(a),this._updateLayer(o)))}getFilter(r){let a=this._checkLayer(r);if(a)return i.d5(a.filter)}setLayoutProperty(r,a,n,o={}){this._checkLoaded();let s=this._checkLayer(r);if(s&&!i.b7(s.getLayoutProperty(a),n)){if(null!=n&&(!o||!1!==o.validate)&&iM(s,eV.call(eC,{key:`layers.${r}.layout.${a}`,layerType:s.type,objectKey:a,value:n,styleSpec:i.a8,style:{glyphs:!0,sprite:!0}})))return;s.setLayoutProperty(a,n),0!==s.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(s.fqid),s.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(s.fqid),this._updateLayer(s)}}setLayerProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);o&&("appearances"===r?(o.setAppearances(a),this._updateLayer(o)):o.isPaintProperty(r)?this.setPaintProperty(i,r,a,n):this.setLayoutProperty(i,r,a,n))}getLayoutProperty(i,r){let a=this._checkLayer(i);if(a)return a.getLayoutProperty(r)}setPaintProperty(r,a,n,o={}){this._checkLoaded();let s=this._checkLayer(r);if(!s||i.b7(s.getPaintProperty(a),n)||null!=n&&(!o||!1!==o.validate)&&iM(s,ek.call(eC,{key:`layers.${r}.paint.${a}`,layerType:s.type,objectKey:a,value:n,styleSpec:i.a8})))return;let l=s.setPaintProperty(a,n);0!==s.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(s.fqid),s.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(s.fqid),l&&this._updateLayer(s),this._changes.updatePaintProperties(s)}getPaintProperty(i,r){let a=this._checkLayer(i);if(a)return a.getPaintProperty(r)}setFeatureState(r,a){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){let{featuresetId:i,importId:n}=r.target,o=this.getFragmentStyle(n);for(let{source:n,sourceLayer:s}of o.getFeaturesetLayers(i))o.setFeatureState({id:r.id,source:n,sourceLayer:s},a)}else if("layerId"in r.target){let{layerId:i}=r.target,n=this.getLayer(i);this.setFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer},a)}return}let n=r.source,o=r.sourceLayer,s=this._checkSource(n);if(!s)return;let l=s.type;if("geojson"===l&&o)return void this.fire(new i.B(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!o)return void this.fire(new i.B(Error("The sourceLayer parameter must be provided for vector source types.")));for(let s of(void 0===r.id&&this.fire(new i.B(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)))s.setFeatureState(o,r.id,a)}removeFeatureState(r,a){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){let{featuresetId:i,importId:n}=r.target,o=this.getFragmentStyle(n);for(let{source:n,sourceLayer:s}of o.getFeaturesetLayers(i))o.removeFeatureState({id:r.id,source:n,sourceLayer:s},a)}else if("layerId"in r.target){let{layerId:i}=r.target,n=this.getLayer(i);this.removeFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer},a)}return}let n=r.source,o=this._checkSource(n);if(!o)return;let s=o.type,l="vector"===s?r.sourceLayer:void 0;if("vector"===s&&!l)return void this.fire(new i.B(Error("The sourceLayer parameter must be provided for vector source types.")));if(a&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.B(Error("A feature id is required to remove its specific state property.")));for(let i of this.getOwnSourceCaches(n))i.removeFeatureState(l,r.id,a)}getFeatureState(r){if(this._checkLoaded(),"target"in r){let a;if("featuresetId"in r.target){let{featuresetId:n,importId:o}=r.target,s=this.getFragmentStyle(o);for(let{source:o,sourceLayer:l}of s.getFeaturesetLayers(n)){let n=s.getFeatureState({id:r.id,source:o,sourceLayer:l});if(n&&!a)a=n;else if(!i.b7(a,n))return void this.fire(new i.B(Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in r.target){let{layerId:i}=r.target,n=this.getLayer(i);a=this.getFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer})}return a}let a=r.source,n=r.sourceLayer,o=this._checkSource(a);if(o){if("vector"!==o.type||n)return void 0===r.id&&this.fire(new i.B(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(n,r.id);this.fire(new i.B(Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(i){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,i),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}setWorldview(i){i!==this._worldview&&(this._worldview=i,this.dispatcher.broadcast("setWorldview",this._worldview),this.reloadSources())}serialize(){this._checkLoaded();let r=this.getTerrain(),a=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return i.db({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:a,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},i=>void 0!==i)}_updateFilteredLayers(i){for(let r of Object.values(this._mergedLayers))i(r)&&this._updateLayer(r)}_updateLayer(r){this._changes.updateLayer(r);let a=this.getLayerSourceCache(r),n=i.F(r.source,r.scope),o=this._changes.getUpd
8atedSourceCaches();r.source&&!o[n]&&a&&"raster"!==a.getSource().type&&(this._changes.updateSourceCache(n,"reload"),a.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){let r=i=>this._mergedLayers[i].is3D(!!this.terrain),a=this.order,n={},o=[];for(let s=a.length-1;s>=0;s--){let l=a[s];if(r(l))for(let r of(n[l]=s,i)){let i=r[l];if(i)for(let r of i)o.push(r)}}o.sort((i,r)=>r.intersectionZ-i.intersectionZ);let s=[];for(let l=a.length-1;l>=0;l--){let h=a[l];if(r(h))for(let i=o.length-1;i>=0;i--){let r=o[i].feature;if(r.layer&&n[r.layer.id]<l)break;s.push(r),o.pop()}else for(let r of i){let i=r[h];if(i)for(let r of i)s.push(r.feature)}}return s}queryRasterValue(r,a,n){let o=this.getOwnSource(r);return o?"raster-array"!==o.type?(this.fire(new i.B(Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):o.queryRasterArrayValue(a,n):(this.fire(new i.B(Error(`Source with id "${r}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(r,a,n){let o;a&&!Array.isArray(a)&&a.filter&&(this._validate(eB,"queryRenderedFeatures.filter",a.filter,null,a),o=i.dc(a.filter));let s={},l=i=>{if(iR.has(i.type))return;let r=this.getOwnLayerSourceCache(i),a=s[r.id]=s[r.id]||{sourceCache:r,layers:{},has3DLayers:!1};i.is3D(!!this.terrain)&&(a.has3DLayers=!0),a.layers[i.fqid]=a.layers[i.fqid]||{styleLayer:i,targets:[]},a.layers[i.fqid].targets.push({filter:o})};if(a&&a.layers){if(!Array.isArray(a.layers))return this.fire(new i.B(Error("parameters.layers must be an Array."))),[];for(let r of a.layers){let a=this._layers[r];if(!a)return this.fire(new i.B(Error(`The layer '${r}' does not exist in the map's style and cannot be queried for features.`))),[];l(a)}}else for(let i in this._layers)l(this._layers[i]);let h=this._queryRenderedFeatures(r,s,n),u=this._flattenAndSortRenderedFeatures(h),c=[];for(let r of u)i.dd(r.layer.id)===this.scope&&c.push(r);return c}queryRenderedFeatureset(r,a,n){let o;a&&!Array.isArray(a)&&a.filter&&(this._validate(eB,"queryRenderedFeatures.filter",a.filter,null,a),o=i.dc(a.filter));let s="mock",l=[];if(a&&a.target)l.push(Object.assign({},a,{targetId:s,filter:o}));else{for(let i of this.getFeaturesetDescriptors())l.push({targetId:s,filter:o,target:i});for(let{style:i}of this.fragments)for(let r of i.getFeaturesetDescriptors())l.push({targetId:s,filter:o,target:r})}let h=this.queryRenderedTargets(r,l,n),u=[],c=new Set;for(let r of h)for(let a of r.variants[s])tu(a,r,c)||u.push(new i.de(r,a));return u}queryRenderedTargets(r,a,n){let o={},s=(i,r,a,n)=>{let s=o[r.id]=o[r.id]||{sourceCache:r,layers:{},has3DLayers:!1};(s.layers[i.fqid]=s.layers[i.fqid]||{styleLayer:i,targets:[]},i.is3D(!!this.terrain)&&(s.has3DLayers=!0),n)?s.layers[i.fqid].targets.push(Object.assign({},a,{namespace:n.namespace,properties:n.properties,uniqueFeatureID:n.uniqueFeatureID})):(a.uniqueFeatureID=!1,s.layers[i.fqid].targets.push(a))};for(let r of a)if("featuresetId"in r.target){let{featuresetId:a,importId:n}=r.target,o=this.getFragmentStyle(n);if(!o||!o._featuresetSelectors)continue;let l=o._featuresetSelectors[a];if(!l){this.fire(new i.B(Error(`The featureset '${a}' does not exist in the map's style and cannot be queried for features.`)));continue}for(let i of l){let a=o.getOwnLayer(i.layerId);a&&!iR.has(a.type)&&s(a,o.getOwnLayerSourceCache(a),r,i)}}else if("layerId"in r.target){let{layerId:i}=r.target,a=this.getLayer(i);if(!a||iR.has(a.type))continue;s(a,this.getLayerSourceCache(a),r)}let l=this._queryRenderedFeatures(r,o,n);return this._flattenAndSortRenderedFeatures(l)}_queryRenderedFeatures(r,a,n){let o=[],s=!!this.map._showQueryGeometry,l=e8.createFromScreenPoints(r,n);for(let i in a){let r=function(i,r,a,n,o=!1,s){let l=r.sourceCache.transform,h=r.sourceCache.tilesIn(i,r.has3DLayers,o);h.sort(tc);let u=[];for(let i of h){let h=i.tile.queryRenderedFeatures(r,i,a,n,l,o,s);Object.keys(h).length&&u.push({wrappedTileID:i.tile.tileID.wrapped().key,queryResults:h})}for(let a in r.layers){let o=r.layers[a];if(o.styleLayer){let a=o.styleLayer.queryRenderedFeatures(i,r.sourceCache,n);Object.keys(a).length&&u.push({wrappedTileID:0,queryResults:a})}}return 0===u.length?{}:function(i){let r={},a={};for(let n of i){let i=n.queryResults,o=n.wrappedTileID,s=a[o]=a[o]||{};for(let a in i){let n=i[a],o=s[a]=s[a]||{},l=r[a]=r[a]||[];for(let i of n)o[i.featureIndex]||(o[i.featureIndex]=!0,l.push(i))}}return r}(u)}(l,a[i],this._availableImages,n,s,this.getActualScope());Object.keys(r).length&&o.push(r)}if(this.placement)for(let r in a){if(a[r].sourceCache._renderSourceType!==i.b5.Symbol)continue;let n=function(i,r,a,n,o,s){let l={},h=n.queryRenderedSymbols(i),u=[];for(let i of Object.keys(h).map(Number))u.push(o[i]);for(let i of(u.sort(tc),u)){let n=i.featureIndex.lookupSymbolFeatures(h[i.bucketInstanceId],i.bucketIndex,i.sourceLayerIndex,r,a,s);for(let r in n){let a=l[r]=l[r]||[],o=n[r];for(let r of(o.sort((r,a)=>{let n=i.featureSortOrder;if(n){let i=n.indexOf(r.featureIndex);return n.indexOf(a.featureIndex)-i}return a.featureIndex-r.featureIndex}),o))a.push(r)}}return l}(l.screenGeometry,a[r],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(n).length&&o.push(n)}return o}querySourceFeatures(i,r){let a=r&&r.filter;
8a&&this._validate(eB,"querySourceFeatures.filter",a,null,r);let n=[];for(let a of this.getOwnSourceCaches(i))n=n.concat(function(i,r){let a=i.getRenderableIds().map(r=>i.getTileByID(r)),n=[],o={};for(let i=0;i<a.length;i++){let s=a[i],l=s.tileID.canonical.key;o[l]||(o[l]=!0,s.querySourceFeatures(n,r))}return n}(a,r));return n}addSourceType(i,r,a){return iF.getSourceType(i)?a(Error(`A source type called "${i}" already exists.`)):(iF.setSourceType(i,r),r.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:i,url:r.workerSourceURL},a):a(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,a,n={}){this._checkLoaded();let o=this.light.getLight(),s=!1;for(let a in r)if(!i.b7(r[a],o[a])){s=!0;break}if(!s)return;let l=this._getTransitionParameters();this.light.setLight(r,a,n),this.light.updateTransitions(l)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=i.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&i.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(r,a=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===a&&delete this.terrain,null===r?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let n=r,o=!("source"in r)||null==r.source;if(1===a){if(this.disableElevatedTerrain)return;if("source"in n&&"object"==typeof n.source){let r="terrain-dem-src";this.addSource(r,n.source),n=Object.assign(n=i.d5(n),{source:r})}let r=Object.assign({},n),a={};if(this.terrain&&o){r.source=this.terrain.get().source;let i=this.terrain?this.getFragmentStyle(this.terrain.scope):null;i&&(a.style=i.serialize())}if(this._validate(eR,"terrain",r,a))return}if(this.terrain&&(this.terrain.scope===this.scope||o)&&(!this.terrain||a===this.terrain.drapeRenderMode)){let a=this.terrain,o=a.get();for(let r of Object.keys(i.a8.terrain))!n.hasOwnProperty(r)&&i.a8.terrain[r].default&&(n[r]=i.a8.terrain[r].default);for(let n in r)if(!i.b7(r[n],o[n])){a.set(r,this.options),this.stylesheet.terrain=r;let n=this._getTransitionParameters({duration:0});a.updateTransitions(n),this.fire(new i.C("data",{dataType:"style"}));break}}else{if(!n)return;this._createTerrain(n,a),this.fire(new i.C("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(i){let r=this.fog=new eJ(i,this.map.transform,this.scope,this.options);this.stylesheet.fog=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_createSnow(i){let r=this.snow=new e2(i,this.map.transform,this.scope,this.options);this.stylesheet.snow=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_createRain(i){let r=this.rain=new e3(i,this.map.transform,this.scope,this.options);this.stylesheet.rain=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){let a=this.fog;if(!i.b7(a.get(),r)){a.set(r,this.options),this.stylesheet.fog=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createFog(r);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(r){if(this._checkLoaded(),!r)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){let a=this.snow;if(!i.b7(a.get(),r)){a.set(r,this.options),this.stylesheet.snow=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createSnow(r);
8this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(r){if(this._checkLoaded(),!r)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){let a=this.rain;if(!i.b7(a.get(),r)){a.set(r,this.options),this.stylesheet.rain=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createRain(r);this._markersNeedUpdate=!0}_reloadColorTheme(){let r=()=>{for(let i in this._layers)this._layers[i].lut=this._styleColorTheme.lut;for(let i in this._sourceCaches)this._sourceCaches[i].clearTiles()},a=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!a)return this._styleColorTheme.lut=null,void r();let n=this._evaluateColorThemeData(a);this._loadColorTheme(n).then(()=>{this.fire(new i.C("colorthemeset")),r()}).catch(r=>{i.w(`Couldn't set color theme: ${r}`)})}setColorTheme(r){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&i.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=r,this._reloadColorTheme()}setImportColorTheme(i,r){let a=this.getFragmentStyle(i);a&&(a._styleColorTheme.colorThemeOverride=r,a._reloadColorTheme())}_getTransitionParameters(r){return{now:i.o.now(),transition:Object.assign(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;let i=[],r=[];for(let a of this._mergedOrder)this.isLayerDraped(this._mergedLayers[a])?i.push(a):r.push(a);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(i,r){let a=this.terrain=new eH(i,r,this.scope,this.options,this.map.getWorldview());1===r&&(this.stylesheet.terrain=i),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();let n=this._getTransitionParameters({duration:0});a.updateTransitions(n)}_force3DLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,a,n,o,s={}){if(s&&!1===s.validate)return!1;let l=Object.assign({},this.serialize());return iM(this,r.call(eC,Object.assign({key:a,style:l,value:n,styleSpec:i.a8},o)))}_remove(){for(let r in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.df.off("pluginStateChange",this._rtlTextPluginCallback),this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(let i in this._mergedSourceCaches)this._mergedSourceCaches[i].clearTiles(),this._mergedSourceCaches[i].setEventedParent(null);this.imageManager.removeScope(this.scope),this.imageManager.imageAtlasCache.clear(),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(i){for(let r of this.getSourceCaches(i))r.clearTiles()}clearSources(){for(let i in this._mergedSourceCaches)this._mergedSourceCaches[i].clearTiles()}clearLayers(){for(let i in this._mergedLayers){let r=this._mergedLayers[i];r._clear&&r._clear()}}reloadSource(i){for(let r of this.getSourceCaches(i))r.resume(),r.reload()}
8reloadSources(){for(let i of this.getSources())i.reload&&i.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(i=>{i.modelManager.reloadModels(i.scope)})}updateSources(i){let r;this.directionalLight&&(r=iv(this.directionalLight));let a=new Set,n=new Set,o=new Set;for(let i in this._mergedLayers){let r=this._mergedLayers[i];"building"===r.type?a.add(r.source):"raster"===r.type&&r.paint&&"ground"===r.paint.get("raster-elevation-reference")&&o.add(r.source),r.hasElevation()&&!n.has(r.source)&&n.add(r.source)}for(let s in this._mergedSourceCaches){let l=this._mergedSourceCaches[s],h=n.has(l._source.id);l._isRasterElevatedOverTerrain=o.has(l._source.id),a.has(l._source.id)&&(l._source.reparseOverscaled=!1),l.update(i,void 0,void 0,r,h)}}_generateCollisionBoxes(){for(let i in this._sourceCaches){let r=this._sourceCaches[i];r.resume(),r.reload()}}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new i.C("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new t4),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(r,a,n,o,s){this.pauseablePlacement||(this.pauseablePlacement=new t4);let l=!1,h=!1,u={},c={};for(let a of this._mergedOrder){let n=this._mergedLayers[a];if("symbol"!==n.type)continue;let o=i.F(n.source,n.scope),s=u[o];if(!s){let i=this.getLayerSourceCache(n);if(!i)continue;let r=i.getRenderableIds(!0).map(r=>i.getTileByID(r));c[o]=r.slice(),s=u[o]=r.sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}let h=this.crossTileSymbolIndex.addLayer(n,s,r.center.lng,r.projection);l=l||h}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);let d=!!(this.placement&&!r.equals(this.placement.transform)),p=!!(this.placement&&(0!==this.placement.lastReplacementSourceUpdateTime&&!s||this.placement.lastReplacementSourceUpdateTime!==s.updateTime)),f=d||p||l,m=(f||this.pauseablePlacement.isStale())&&0===n,_=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),r.zoom)&&0!==n;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||m||_)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(r,this._mergedOrder,a,n,o,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this.map.painter)){let i=this.map.painter.maxFrontCutoffRawStart;if(i>0){let a=180*r.pitch/Math.PI;if(a>=15){let r=Math.min(1,Math.max(0,(a-15)/5)),n=r*r*(3-2*r);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-n)+i*n}}}if(this.pauseablePlacement.isDone()?f&&0!==n&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,u,c,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.o.now()),h=!0),l&&this.pauseablePlacement.setStale()),h||l){this._buildingIndex.onNewFrame(r.zoom);for(let r=0;r<this._mergedOrder.length;r++){let a=this._mergedLayers[this._mergedOrder[r]];if("symbol"!==a.type||"none"===a.visibility)continue;let n=this.isLayerClipped(a);this.placement.updateLayerOpacities(a,u[i.F(a.source,a.scope)],r,n?s:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(i.o.now())}_releaseSymbolFadeTiles(){for(let i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}addImport(r,a){this._checkLoaded();let n=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==n.findIndex(({id:i})=>i===r.id))return void this.fire(new i.B(Error(`Import with id '${r.id}' already exists in the map's style.`)));if(!a)return n.push(r),this._loadImports([r],!0);let o=n.findIndex(({id:i})=>i===a);return -1===o&&this.fire(new i.B(Error(`Import with id "${a}" does not exist on this map.`))),this.stylesheet.imports=n.slice(0,o).concat(r).concat(n.slice(o)),this._loadImports([r],!0,a)}updateImport(r,a){this._checkLoaded();let n=this.stylesheet.imports||[],o=this.getImportIndex(r);return -1===o||("string"==typeof a?this.setImportUrl(r,a):(a.url&&a.url!==n[o].url&&this.setImportUrl(r,a.url),i.b7(a.config,n[o].config)||this.setImportConfig(r,a.config,a.data.schema),i.b7(a.data,n[o].data)||this.setImportData(r,a.data))),this}moveImport(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);if(-1===n)return this;let o=this.getImportIndex(r);if(-1===o)return this;let s=a[n],l=this.fragments[n];return a=a.filter(({id:r})=>r!==i),this.fragments=this.fragments.filter(({id:r})=>
8r!==i),this.stylesheet.imports=a.slice(0,o).concat(s).concat(a.slice(o)),this.fragments=this.fragments.slice(0,o).concat(l).concat(this.fragments.slice(o)),this.mergeLayers(),this}setImportUrl(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);if(-1===n)return this;a[n].url=r;let o=this.fragments[n];return o.style=this._createFragmentStyle(a[n]),o.style.on("style.import.load",()=>this.mergeAll()),o.style.loadURL(r),this}setImportData(i,r){this._checkLoaded();let a=this.getImportIndex(i),n=this.stylesheet.imports||[];return -1===a?this:r?(this.fragments[a].style.setState(r),this._reloadImports(),this):(delete n[a].data,this.setImportUrl(i,n[a].url))}setImportConfig(i,r,a){this._checkLoaded();let n=this.getImportIndex(i),o=this.stylesheet.imports||[];if(-1===n)return this;r?o[n].config=r:delete o[n].config;let s=this.fragments[n];a&&s.style.stylesheet&&(s.style.stylesheet.schema=a);let l=s.style.stylesheet&&s.style.stylesheet.schema;return s.config=r,s.style.updateConfig(r,l),this.updateConfigDependencies(),this}removeImport(i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(i);-1!==a&&(r.splice(a,1),this.fragments[a].style._remove(),this.fragments.splice(a,1),this._reloadImports())}getImportIndex(r){let a=(this.stylesheet.imports||[]).findIndex(i=>i.id===r);return -1===a&&this.fire(new i.B(Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),a}getLayer(i){return this._mergedLayers[i]}getSources(){let i=[];for(let r in this._mergedOtherSourceCaches){let a=this._mergedOtherSourceCaches[r];a&&i.push(a.getSource())}return i}getSource(i,r){let a=this.getSourceCache(i,r);return a&&a.getSource()}getLayerSource(i){let r=this.getLayerSourceCache(i);return r&&r.getSource()}getSourceCache(r,a){let n=i.F(r,a);return this._mergedOtherSourceCaches[n]}getLayerSourceCache(r){let a=i.F(r.source,r.scope);return"symbol"===r.type?this._mergedSymbolSourceCaches[a]:"fill-extrusion"===r.type&&this._mergedFillExtrusionSourceCaches[a]||this._mergedOtherSourceCaches[a]}getSourceCaches(i){if(null==i)return Object.values(this._mergedSourceCaches);let r=[];return this._mergedOtherSourceCaches[i]&&r.push(this._mergedOtherSourceCaches[i]),this._mergedSymbolSourceCaches[i]&&r.push(this._mergedSymbolSourceCaches[i]),this._mergedFillExtrusionSourceCaches[i]&&r.push(this._mergedFillExtrusionSourceCaches[i]),r}updateSourceCaches(){let i=this._changes.getUpdatedSourceCaches();for(let r in i){let a=i[r];"reload"===a?this.reloadSource(r):"clear"===a&&this.clearSource(r)}}updateLayers(i){for(let r of this._changes.getUpdatedPaintProperties()){let a=this.getLayer(r);a&&a.updateTransitions(i)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(i){this.stylesheet.glyphs=i,this.glyphManager.setURL(i)}getImages(r,a,n){this.imageManager.getImages(a.images,a.scope,n),this._updateTilesForChangedImages();let o=r=>{if(r){let n=a.images.map(r=>i.I.toString(r));r.setDependencies(a.tileID.key,a.type,n)}},s=i.F(a.source,a.scope);o(this._mergedOtherSourceCaches[s]),o(this._mergedSymbolSourceCaches[s]),a.images.some(i=>i.iconsetId)&&this.fire(new i.C("data",{dataType:"style"}))}rasterizeImages(i,r,a){this.imageManager.rasterizeImages(r,a)}checkAtlasCache(i,r,a){let n=this.imageManager.imageAtlasCache.findCachedAtlas(r.descriptor);a(null,n&&n.contentDescriptor?{iconPositions:n.iconPositions,patternPositions:n.patternPositions,sourceHash:n.contentDescriptor.hash}:null)}getGlyphs(i,r,a){this.glyphManager.getGlyphs(r.stacks,a)}getOwnSourceCache(i){return this._otherSourceCaches[i]}getOwnLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:"fill-extrusion"===i.type&&this._fillExtrusionSourceCaches[i.source]||this._otherSourceCaches[i.source]}getOwnSourceCaches(i){let r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),this._fillExtrusionSourceCaches[i]&&r.push(this._fillExtrusionSourceCaches[i]),r}_isSourceCacheLoaded(r){let a=this.getOwnSourceCaches(r);return 0===a.length?(this.fire(new i.B(Error(`There is no source with ID '${r}'`))),!1):a.every(i=>i.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(i,r){if(!this._clipLayerPresent&&"fill-extrusion"!==i.type&&"building"!==i.type)return!1;
8let a="fill-extrusion"===i.type&&("building"===i.sourceLayer||"procedural_buildings"===i.sourceLayer),n="building"===i.type;if(i.is3D(!!this.terrain)){if(a||n||r&&"batched-model"===r.type||"model"===i.type)return!0}else if("symbol"===i.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}getBOMObject(){}destroy(){this._clearWorkerCaches(),this.imageManager.imageAtlasCache.clear(),this.fragments.forEach(i=>{i.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}iF.getSourceType=function(i){return ts[i]},iF.setSourceType=function(i,r){ts[i]=r},iF.registerForPluginStateChange=i.dg;var iO="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",iB="\n#ifdef DUAL_SOURCE_BLENDING\nlayout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;\n#else\nlayout(location=0) out vec4 glFragColor;\n#endif\n#ifdef USE_MRT1\nlayout(location=1) out vec4 out_Target1;\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nconst float DITHER_THRESHOLDS[16]=float[16](\n1.0/17.0, 9.0/17.0, 3.0/17.0,11.0/17.0,13.0/17.0, 5.0/17.0,15.0/17.0, 7.0/17.0,4.0/17.0,12.0/17.0, 2.0/17.0,10.0/17.0,16.0/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0\n);vec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}float cutoutGroundRoofOpacity(vec4 groundRoof) {\n#ifdef INDICATOR_CUTOUT\nfloat fadeStartX=u_indicator_cutout_params.w;float holeRadius=u_indicator_cutout_params.y;float holeMinOpacity=mix(u_indicator_cutout_params.x,1.0,smoothstep(u_indicator_cutout_params.z,u_indicator_cutout_centers.z,groundRoof.y));float distX=abs(u_indicator_cutout_centers.x-groundRoof.x);float roofOpacity=mix(holeMinOpacity,1.0,smoothstep(fadeStartX,holeRadius,u_indicator_cutout_centers.y-groundRoof.w));float groundOpacity=min(smoothstep(fadeStartX,holeRadius,distX)+holeMinOpacity,1.0);return max(roofOpacity,groundOpacity);\n#else\nreturn 1.0;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",ik="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;
8float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)\n{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib\n#define DECLARE_MATERIAL_TABLE_INFO\n#endif",iV="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",iN="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}
8float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
8size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\nint NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\nhighp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif",iU="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",ij="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
8vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",iG="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",iq="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",i$="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif",iH="#ifdef RENDER_SHADOWS\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
8p float bias) {\n#ifdef CLIP_ZERO_TO_ONE\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);\n#else\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);\n#endif\nreturn texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;\n#ifdef SHADOWS_SINGLE_CASCADE\nvec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);\n#else\nlight_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";let iZ=/#include\s+"([^"]+)"/g,iW=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,iX=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,iY=new Set(["ifdef","ifndef","elif","if","defined"]),iK=new Set;i5(iO,iK),i5(ik,iK),i5(iB,iK);let iJ={"_prelude_fog.vertex.glsl":iU,"_prelude_terrain.vertex.glsl":iN,"_prelude_shadow.vertex.glsl":i$,"_prelude_material_table.vertex.glsl":"#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer\n#define MATERIAL_TABLE_DEBUG 0\nuniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;\n#if MATERIAL_TABLE_DEBUG\nvec4 colorDebug;\n#endif\n};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}
8float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { \nif (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; \n}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { \niRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;\n#if MATERIAL_TABLE_DEBUG\nconst vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green;\n#endif\nuint offset=0u;\n#if MATERIAL_TABLE_DEBUG\nbool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}\n#endif\noffset++;\n#if MATERIAL_TABLE_DEBUG\nuint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}\n#endif\noffset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}\n#endif\nuint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding)\n{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}}\n#endif\noffset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}\n#endif\ninfo.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)\n{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);}\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)\n#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));\n#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;\n#endif","_prelude_fog.fragment.glsl":ij,"_prelude_shadow.fragment.glsl":iH,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
8));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif","_prelude_raster_array.glsl":iG,"_prelude_raster_particle.glsl":iq},iQ={};i6("",iN),i6(ij,iU),i6(iH,i$),i6(iG,""),i6(iq,"");let i0=i6(iB,ik),i1=["\n#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)\n#extension GL_EXT_blend_func_extended : require\n#endif\nprecision mediump float;",iO,i0.fragmentSource].join("\n"),i2=["precision highp float;",iO,i0.vertexSource].join("\n");var i3={background:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef FEATURE_CUTOUT\nvec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nfloat factorTex=min(texture(u_cutout_factor_image,uv).r,1.0);float cutoutFactor=(1.0-u_feature_cutout_params.x)*factorTex;out_color=u_color*(1.0-cutoutFactor);\n#else\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifndef FEATURE_CUTOUT\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#endif\n}'),backgroundPattern:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in ivec2 a_pos;out highp vec2 v_pos;void main() {vec2 pos=vec2(a_pos);gl_Position=u_matrix*vec4(pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,pos);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),building:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nconst float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;\n#ifdef RENDER_FRONT_CUTOFF\nin float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nin vec4 v_ground_roof;\n#endif\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nin highp float v_flood_radius;in float v_has_flood_light;\n#endif\nuniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}\n#ifdef BUILDING_FAUX_FACADE\nhighp float hash12(in highp vec2 p) {highp vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}highp vec2 get_uv_mask_id(in highp vec2 q,out highp float mask,out highp vec2 id) {highp vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;highp vec2 uv=modf(p/v_faux_facade_floor,id);highp vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;highp vec4 edge=d/v_faux_facade_floor.xyxy;highp vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}highp float ray_unit_box(in highp vec3 ray_o,in highp vec3 ray_d,in highp vec3 bmin,in highp vec3 bmax) {highp vec3 planes=mix(bmin,bmax,step(0.0,ray_d));highp vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in highp vec3 v,in highp vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;highp vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;\n#if 0\nif (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;\n#else\nif (x_major) {out_normal=-sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.
8w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;\n#endif\nreturn out_color;}\n#endif\nvec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;\n#ifdef BUILDING_FAUX_FACADE\nif (v_faux_facade > 0.0) {highp mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);highp vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;highp vec3 view_tangent=transpose(tbn)*v;highp vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);highp vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;highp vec3 bmin=vec3(0.0,0.0,-window_depth);highp vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);highp vec3 ray_o=vec3(uv,0.0);highp vec3 ray_d=normalize(view_tangent);highp float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);highp vec3 hit=ray_o+t_min*ray_d;highp vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;highp vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}\n#endif\nvec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;\n#ifdef RENDER_SHADOWS\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\n#else\nshadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));\n#endif\ncolor.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);\n#ifdef FLOOD_LIGHT\nfloat flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);\n#endif\ncolor.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));\n#endif\ncolor*=u_opacity;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\n{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}}\n#else\ncolor=applyCutout(color,v_pos.z);\n#endif\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nif (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}}\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x
vendor: 5,504 bytes, line 8
8);\n#endif\nglFragColor=color;\n#ifdef DEBUG_SHOW_NORMALS\ncolor.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;\n#ifdef FLOOD_LIGHT\nin int a_flood_light_wall_radius_1i16;\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;\n#endif\nuniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nout vec4 v_ground_roof;\n#endif\n#endif\nout vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nout lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nout highp float v_flood_radius;out float v_has_flood_light;\n#endif\nconst float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#ifdef BUILDING_FAUX_FACADE\nmat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}\n#endif\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive\nvoid main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive\n#ifdef FLOOD_LIGHT\nv_flood_radius=(float(a_flood_light_wall_radius_1i16)/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);\n#endif\nvec4 color_emissive=decode_color(vec2(part_color_emissive));v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=vec3(a_normal_3)/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;vec2 centroid_xy=vec2(a_centroid_3.xy >> 2);vec2 spanBits=vec2(a_centroid_3.xy & 3);\n#ifdef BUILDING_FAUX_FACADE\nvec4 faux_facade_data=vec4(a_faux_facade_data);v_faux_facade=faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(faux_facade_data.y/TWO_POW_8);float window_y_perc=faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(vec2(a_faux_facade_vertical_range)/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(vec2(faux_facade_color_emissive));v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);depth_offset=min(1000.0,float(a_centroid_3.z))*0.0000002;}\n#endif\nv_pos=a_pos_3f;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nfloat halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;vec2 screenUpInTile=vec2(u_matrix[0][1],u_matrix[1][1]);vec2 spanOffset=vec2(halfSpanX,halfSpanY)*sign(screenUpInTile);vec2 cutoff_highestCorner=centroid_xy+spanOffset;vec2 cutoff_lowestCorner=centroid_xy-spanOffset;\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=v_pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(v_pos);\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nv_front_cutoff_opacity=1.0;{hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;hidden=max(hidden,float(ndc_y < threshold-range_ndc));float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\ngl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nvec4 ic_ground=u_matrix*vec4(v_pos.xy,0.0,1.0);vec4 ic_roof=u_matrix*vec4(v_pos.xy,v_pos.z,1.0);v_ground_roof=vec4(ic_ground.xy/ic_ground.w,ic_roof.xy/ic_roof.w);\n#endif\n#endif\n}'),buildingBloom:
8i6("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;\n#ifdef HAS_ATTRIBUTE_a_bloom_attenuation\nfloat distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance);\n#endif\n#ifdef RENDER_CUTOFF\nopacity*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}","in vec3 a_pos_3f;\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nout vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\n#ifdef HAS_ATTRIBUTE_a_part_color_emissive\nvec4 color_emissive=decode_color(vec2(part_color_emissive));float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);\n#else\nv_color_emissive=vec4(1.0);\n#endif\ngl_Position=u_matrix*vec4(a_pos_3f,1.0);\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}"),buildingDepth:i6("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),circle:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
8iew_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos2=vec2(a_pos);vec2 extrude=vec2(mod(pos2,2.0)*2.0-1.0);vec2 circle_center=floor(pos2*0.5);float height=circle_elevation(circle_center);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nsurface_vectors=globe_mercator_surface_vectors(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*height;vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*height;vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:i6("void main() {glFragColor=vec4(1.0);}","in ivec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:i6('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(vec2(a_pos),2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(vec2(a_pos)*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=vec3(a_pos_normal_3)/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:i6("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));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),collisionBox:i6("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin ivec4 a_pos;in ivec2 a_anchor_pos;in ivec2 a_extrude;in uvec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\n#endif\nout float v_placed;out float v_notUsed;void main() {vec2 anchor_pos=vec2(a_anchor_pos);float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(anchor_pos));vec3 proj_pos=vec3(a_pos)+elevationVector(anchor_pos)*(feature_elevation+terrain_elevation);\n#ifdef PROJECTION_GLOBE_VIEW\n#ifndef PROJECTED_POS_ON_VIEWPORT\nvec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);\n#endif\n#endif\nvec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(vec2(a_extrude)*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=float(a_placed.x);v_notUsed=float(a_placed.y);}'),collisionCircle:i6("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in ivec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;int vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2)),mix(-1.0,1.0,float(vertexIdx >=1 && vertexIdx <=2)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=float(a_flags.x);gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:i6("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {vec2 pos=vec2(a_pos);float h=elevation(pos);v_uv=pos/8192.0;
8\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);\n#endif\n}'),elevatedStructuresDepth:i6("void main() {}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:i6("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#else\n#ifdef FEATURE_CUTOUT\napply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}"),elevatedStructures:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
8vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)\n{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nvec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);color.rgb=apply_lighting(color.rgb,transformed_normal,light);\n#else\ncolor=apply_lighting(color,transformed_normal);\n#endif\ncolor=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;in float a_height;in ivec4 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nv_normal=vec3(a_pos_normal_3)/16384.0;v_height=a_height;vec3 pos=vec3(vec2(a_pos),a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),fill:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;vec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef FLIP_Y\nv_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),fillOutlinePattern:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nuniform float u_emissive_strength;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);\n#ifdef FLIP_Y\nv_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillPattern:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),lineBlendComposite:i6("uniform sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;in vec2 v_pos;\n#define ADDITIVE 1\nvoid main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);float t=density/(1.0+density);glFragColor=vec4(avgColor*t*u_opacity,t*u_opacity);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),fillExtrusion:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef RENDER_FRONT_CUTOFF\nin float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nin vec4 v_ground_roof;\n#endif\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
8),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\n{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}}\n#else\ncolor=applyCutout(color,h);\n#endif\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nif (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}}\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;
vendor: 9,210 bytes, line 8
8uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;\n#endif\nout vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nout vec4 v_ground_roof;\n#endif\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny_start.y==0.0 && top_up_ny_start.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny_start.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;\n#else\nh=t > 0.0 ? height : base;\n#endif\npos=vec3(pos_nx.xy,h);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec2 centroid_decoded=pos.xy;bool isBorderCentroid=false;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {int iy=int(centroid_pos.y);int spanYbits=iy & 7;if (spanYbits==7) {isBorderCentroid=true;int borderID=(iy >> 3) & 3;float coordAlongBorder=float(iy >> 5)*4.0;if (borderID==0) centroid_decoded=vec2(0.0,coordAlongBorder);else if (borderID==1) centroid_decoded=vec2(EXTENT,coordAlongBorder);else if (borderID==2) centroid_decoded=vec2(coordAlongBorder,0.0);else centroid_decoded=vec2(coordAlongBorder,EXTENT);} else {centroid_decoded=floor(centroid_pos/8.0);}}\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);\n#endif\n#ifdef RENDER_CUTOFF\n#ifdef CLIP_ZERO_TO_ONE\ncutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);\n#else\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);\n#endif\nif (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_random/8.0;vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_FRONT_CUTOFF\nv_front_cutoff_opacity=1.0;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny_start.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nvec4 pos_ground=u_matrix*vec4(pos.xy,ele,1.0);vec4 pos_roof=u_matrix*vec4(pos.xy,ele+height,1.0);v_ground_roof=vec4(pos_ground.xy/pos_ground.w,pos_roof.xy/pos_roof.w);\n#endif\n#endif\n}'),fillExtrusion
8Depth:i6("void main() {}",'#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 top_up_ny=vec3(a_pos_normal_ed.xyz & 1);vec3 pos_nx=vec3(a_pos_normal_ed.xyz >> 1);base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);float c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;pos.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);}'),fillExtrusionPattern:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
8),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=float(a_pos_normal_ed.w);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny_start.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);p.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;p.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
8\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:i6('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\n#ifdef FEATURE_CUTOUT\nshadow=mix(shadow,vec3(1.0),get_cutout_factors(gl_FragCoord).y);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in ivec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:i6("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
8\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec4 pos_end=vec4(a_pos_end);vec2 p=pos_end.xy;vec2 q=floor(pos_end.zw*0.5);vec2 start_bottom=pos_end.zw-q*2.0;float fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=float(a_angular_offset_factor)/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=float(a_hidden_by_landmark);\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:i6("precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in ivec2 a_pos;in uvec2 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=(vec2(a_texture_pos)/8192.0)*scale+epsilon;}"),hillshade:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=vec2(a_texture_pos)/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),line:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;uniform bool u_emissive_in_shadows;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nin float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat dist=length(v_normal)*v_width2_dilute.x;\n#ifdef VARIABLE_LINE_WIDTH\nblur=mix(blur,0.0,stub_side);\n#endif\nfloat diluted_opacity=opacity*v_width2_dilute.z;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2_dilute.y-blur2),v_width2_dilute.x-dist)/blur2,0.0,1.0);\n#ifdef VARIABLE_LINE_WIDTH\nalpha=mix(alpha,1.0,stub_side);\n#endif\nalpha=side_z_offset > 0.0 ? 1.0-alpha : alpha;\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
8float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/float(dash.z);float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;\n#ifdef RENDER_LINE_GRADIENT\ngradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);\n#endif\nhighp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nfloat edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2_dilute.y-edgeBlur),v_width2_dilute.x-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}out_color*=v_width2_dilute.w;}\n#endif\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);light=u_emissive_in_shadows ? mix(light,1.0,emissive_strength) : light;\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*diluted_opacity);\n#ifdef LINE_BLEND_MULTIPLY\nglFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);HANDLE_WIREFRAME_DEBUG;return;\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec3 a_z_offset_width;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;\n#ifdef RENDER_LINE_CURVE\nuniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count;\n#endif\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;
8float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nout float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\n#ifdef RENDER_LINE_CURVE\nvec3 getCurvePoint(int index) {int row=index/3;int col=index-row*3;float x=u_curve_points_x[row][col];float y=u_curve_points_y[row][col];float z=u_curve_points_z[row][col];return vec3(x,y,z);}vec3 catmullRom(vec3 p0,vec3 p1,vec3 p2,vec3 p3,float t) {float t2=t*t;float t3=t2*t;return 0.5*(\n2.0*p1+(-p0+p2)*t+(2.0*p0-5.0*p1+4.0*p2-p3)*t2+(-p0+3.0*p1-3.0*p2+p3)*t3\n);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*(\n(-p0+p2)+(2.0*p0-5.0*p1+4.0*p2-p3)*2.0*t+(-p0+3.0*p1-3.0*p2+p3)*3.0*t2\n);}struct CurveResult {vec3 point;vec2 tangent;};CurveResult calculateCurve(float line_progress) {float curve_progress=line_progress*(u_curve_point_count-1.0);float curve_progress_local=fract(curve_progress);float curve_segment=floor(curve_progress);int seg=int(curve_segment);vec3 p1=getCurvePoint(seg);vec3 p2=getCurvePoint(seg+1);float is_first_seg=step(curve_segment,0.5);vec3 p0_extrapolated=p1-(p2-p1);vec3 p0_fetched=getCurvePoint(max(seg-1,0));vec3 p0=mix(p0_fetched,p0_extrapolated,is_first_seg);int last_seg=int(u_curve_point_count)-2;float is_last_seg=step(float(last_seg)-0.5,curve_segment);vec3 p3_extrapolated=p2+(p2-p1);vec3 p3_fetched=getCurvePoint(min(seg+2,int(u_curve_point_count)-1));vec3 p3=mix(p3_fetched,p3_extrapolated,is_last_seg);vec3 point=catmullRom(p0,p1,p2,p3,curve_progress_local);vec2 tangent=catmullRomTangent(p0.xy,p1.xy,p2.xy,p3.xy,curve_progress_local)*(u_curve_point_count-1.0);CurveResult result;result.point=point;result.tangent=tangent;return result;}\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\nhighp float line_progress=0.0;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nline_progress=a_packed[2];\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0;\n#ifdef RENDER_LINE_CURVE\nCurveResult curve=calculateCurve(line_progress);pos=curve.point.xy*8192.0;a_extrude=length(a_extrude)*normalize(curve.tangent);a_extrude=left ? vec2(-a_extrude.y,a_extrude.x) : vec2(a_extrude.y,-a_extrude.x);a_z_offset+=curve.point.z;\n#endif\ngapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=(u_width_scale*(left ? left_width : right_width))/2.0;if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=left_f;}offset=border_width >
8 0.0 ? (left_width+right_width)*u_width_scale*0.5 : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\nfloat 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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0);\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0);\n#endif\n#endif\n#ifndef ELEVATED\n#ifndef VARIABLE_LINE_WIDTH\n#ifndef RENDER_TO_TEXTURE\nfloat base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else\n{\n#ifdef RENDER_LINE_BORDER\nfloat border_ratio=(border_width*u_width_scale+ANTIALIASING)/outset;screen_width*=border_ratio;float max_border_component=max(screen_width.x,screen_width.y);dilute_border_scale=min(1.0,max_border_component/min_pixel);\n#endif\n}}\n#endif\n#endif\n#ifdef ELEVATED_ROADS\ngl_Position=gl_Position+projected_extrude;\n#else\ngl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nvec4 dashf=vec4(dash);float totalLength=dashf.z+dashf.w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dashf.y+dashf.x+0.5)/u_texsize.y);\n#endif\nv_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
8uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec3 a_z_offset_width;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/(float(pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=float(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;
vendor: 5,535 bytes, line 8
8\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;\n#endif\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;in uvec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT);\n#endif\nglobe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nvec4 world_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 texture_pos=vec2(a_texture_pos);uv=texture_pos/8192.0;vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nfloat tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;\n#endif\nvec4 merc_world_pos=vec4(0.0); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,ele,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);world_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nfloat ele=0.0;vec2 decodedPos=vec2(a_pos);\n#ifdef ELEVATION_REFERENCE_GROUND\nvec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;\n#else\nuv=vec2(a_texture_pos)/8192.0;\n#endif\nworld_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);\n#ifdef FOG\nv_fog_pos=fog_position(decodedPos);\n#endif\n#endif\nfloat w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef ELEVATED\nfloat z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor);gl_Position.z-=(gl_Position.w*zbias);\n#endif\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),
8rasterParticle:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=vec2(a_texture_pos)/8192.0;gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:i6("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin int a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(float(a_index),u_particle_texture_side_len),float(a_index)/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:i6("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in ivec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*vec2(a_pos)+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:i6('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
8vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in ivec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*vec2(a_pos+ivec2(1));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:i6('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nin highp float v_z_offset;\n#endif\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef USE_PAINT_PROPERTIES_UBO\nin lowp float opacity;\n#ifdef RENDER_SDF\nin lowp vec4 fill_np_color;in lowp vec4 halo_np_color;in lowp float halo_width;in lowp float halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nin lowp float emissive_strength;\n#endif\n#else\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#endif\nvoid main() {\n#ifdef USE_PAINT_PROPERTIES_UBO\nvec4 fill_color;vec4 halo_color;\n#ifdef RENDER_SDF\nfill_color=vec4(fill_np_color.rgb*fill_np_color.a,fill_np_color.a);halo_color=vec4(halo_np_color.rgb*halo_np_color.a,halo_np_color.a);\n#endif\n#else\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#endif\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef TERRAIN\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#else\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#define USING_APPEARANCE 1.0\nin ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin uvec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\n#endif\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;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 vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef USE_PAINT_PROPERTIES_UBO\n#ifndef MAX_UBO_SIZE_VEC4\n#define MAX_UBO_SIZE_VEC4 1024u\n#endif\n#define SPP_HEADER_SIZE_VEC4 3u\n#define DWORDS_PER_VEC4 4u\nstruct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};struct PropertyType {bool isDataDriven;bool isZoomDependent;uint offsetDwords;};struct SymbolPropertyHeader {uint dataDrivenBlockSizeVec4;PropertyType fill_np_color;PropertyType halo_np_color;PropertyType opacity;PropertyType halo_width;PropertyType halo_blur;PropertyType emissive_strength;PropertyType occlusion_opacity;PropertyType z_offset;PropertyType translate;};uniform float u_zoom;uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform lowp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float opacity;\n#ifdef RENDER_SDF\nout lowp vec4 fill_np_color;out lowp vec4 halo_np_color;out lowp float halo_width;out lowp float halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nout lowp float emissive_strength;\n#endif\nPropertyType getPropertyType(uint propertyIndex,uint dataDrivenMask,uint zoomDependentMask,uint offsetDwords) {PropertyType type;type.isDataDriven=(dataDrivenMask & (1u << propertyIndex)) !=0u;type.isZoomDependent=(zoomDependentMask & (1u << propertyIndex)) !=0u;type.offsetDwords=offsetDwords;return type;}SymbolPropertyHeader readSymbolPropertiesHeader() {SymbolPropertyHeader header;uint dataDrivenMask=u_spp_header.header[0][0];uint zoomDependentMask=u_spp_header.header[0][1];header.dataDrivenBlockSizeVec4=u_spp_header.header[0][2];header.fill_np_color =getPropertyType(0u,dataDrivenMask,zoomDependentMask,u_spp_header.header[0][3]);header.halo_np_color =getPropertyType(1u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][0]);header.opacity =getPropertyType(2u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][1]);header.halo_width =getPropertyType(3u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][2]);header.halo_blur =getPropertyType(4u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][3]);header.emissive_strength =getPropertyType(5u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][0]);header.occlusion_opacity =getPropertyType(6u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][1]);header.z_offset =getPropertyType(7u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][2]);header.translate =getPropertyType(8u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][3]);return header;}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :\n(index==1u) ? v.y :\n(index==2u) ? v.z : v.w;}float vec4At(vec4 v,uint index) {return (index==0u) ? v.x :\n(index==1u) ? v.y :\n(index==2u) ? v.z : v.w;}vec4 readVec4(uint baseOffsetVec4,uint propertyOffsetDwords) {return u_spp_properties.properties[baseOffsetVec4+propertyOffsetDwords/DWORDS_PER_VEC4];}float readFloat(vec4 slot,uint propertyOffsetDwords) {return slot[propertyOffsetDwords % DWORDS_PER_VEC4];}uint readUint(uvec4 slot,uint offset) {return slot[offset % DWORDS_PER_VEC4];}vec2 readVec2(vec4 slot,uint propertyOffsetDwords) {float x=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4);float y=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4+1u);return vec2(x,y);}uint getDataDrivenBlockOffsetVec4(uint dataDrivenBlockSizeVec4) {uint featureIndex=uint(a_feature_index);uvec4 slot=u_spp_index.block_indices[featureIndex/DWORDS_PER_VEC4];uint blockIndex=uvec4At(slot,featureIndex % DWORDS_PER_VEC4);return blockIndex*dataDrivenBlockSizeVec4;}vec4 readColorProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 color=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {color=unpack_mix_color(color,u_zoom);} else {vec2 packedColor=readVec2(color,propertyType.offsetDwords);color=decode_color(packedColor);}return color;}vec2 readVec2Property(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {vec2 minVal=slot.xy;vec2 maxVal=slot.zw;return mix(minVal,maxVal,u_zoom);}return readVec2(slot,propertyType.offsetDwords);}float readFloatProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);float value;if (propertyType.isZoomDependent) {vec2 packedValues=readVec2(slot,propertyType.offsetDwords);value=unpack_mix_vec2(packedValues,u_zoom);} else {value=readFloat(slot,propertyType.offsetDwords);}return value;}SymbolPaintProperties readSymbolPaintProperties() {SymbolPropertyHeader header=readSymbolPropertiesHeader();uint sizeVec4=header.dataDrivenBlockSizeVec4;SymbolPaintProperties props;props.fill_np_color =header.fill_np_color.isDataDriven ? readColorProperty(header.fill_np_color,sizeVec4) : u_spp_fill_np_color;props.halo_np_color =header.halo_np_color.isDataDriven ? readColorProperty(header.halo_np_color,sizeVec4) : u_spp_halo_np_color;props.opacity =header.opacity.isDataDriven ? readFloatProperty(header.opacity,sizeVec4) : u_spp_opacity;props.halo_width =header.halo_width.isDataDriven ? readFloatProperty(header.halo_width,sizeVec4) : u_spp_halo_width;props.halo_blur =header.halo_blur.isDataDriven ? readFloatProperty(header.halo_blur,sizeVec4) : u_spp_halo_blur;props.emissive_strength =header.emissive_strength.isDataDriven ? readFloatProperty(header.emissive_strength,sizeVec4) : u_spp_emissive_strength;props.occlusion_opacity =header.occlusion_opacity.isDataDriven ? readFloatProperty(header.occlusion_opacity,sizeVec4) : u_spp_occlusion_opacity;props.z_offset =header.z_offset.isDataDriven ? readFloatProperty(header.z_offset,sizeVec4) : u_spp_z_offset;props.translate =header.translate.isDataDriven ? readVec2Property(header.translate,sizeVec4) : vec2(0.0);return props;}\n#else\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\n#endif\nvec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}
8void main() {\n#ifdef USE_PAINT_PROPERTIES_UBO\nSymbolPaintProperties paint_properties=readSymbolPaintProperties();opacity=paint_properties.opacity;\n#ifdef RENDER_SDF\nfill_np_color=paint_properties.fill_np_color;halo_np_color=paint_properties.halo_np_color;halo_width=paint_properties.halo_width;halo_blur=paint_properties.halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nemissive_strength=paint_properties.emissive_strength;\n#endif\nlowp float occlusion_opacity=paint_properties.occlusion_opacity;lowp float z_offset=paint_properties.z_offset;\n#else\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\n#endif\nvec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(a_tex_size.zw);float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(a_pixeloffset.zw)/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,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 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=vec3(a_globe_anchor)+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(vec3(a_globe_anchor)+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); \n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\n#else\nz+=u_pitch_with_map ? z_offset : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\n#ifdef Z_TEST_OCCLUSION\nout_fade_opacity*=occlusion_opacity;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\n#ifdef ELEVATED_ROADS\nvec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\n#endif\n#endif\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);
8\n#ifdef USE_PAINT_PROPERTIES_UBO\n{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(\nu_spp_translate_rotation.x*tr.x-u_spp_translate_rotation.y*tr.y,u_spp_translate_rotation.y*tr.x+u_spp_translate_rotation.x*tr.y\n);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=vec2(a_texb)/u_texsize;\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#else\n#ifdef RENDER_SHADOWS\nv_z_offset=e;\n#endif\n#endif\n}'),terrainRaster:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nin vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:i6("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in ivec2 a_pos;out float v_depth;void main() {float elevation=elevation(vec2(a_pos));gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:i6('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
8nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',iV),skyboxGradient:i6('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',iV),skyboxCapture:i6
vendor: 3,689 bytes, line 8
8("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;
8v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nuniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:i6('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;
8vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:i6('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;\n#ifdef DITHERED_DISCARD\nuniform float u_dithered_discard_threshold;\n#endif\nuniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef FLIP_Y\ncoord.y=1.0-coord.y;\n#endif\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
8Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;\n#ifdef FLIP_Y\nT=-T;B=-B;\n#endif\nhighp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));\n#ifdef FLIP_Y\nn=normalize(cross(fdx,fdy));\n#else\nn=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
8Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
8y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef DITHERED_DISCARD\nif (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\n#ifdef FEATURE_CUTOUT\nfinalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp uvec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(vec2(pbr.xy));vec2 e_r_m=unpack_float(float(pbr.z));vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(float(pbr.w))/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#ifdef CLIP_ZERO_TO_ONE\nv_depth=-1.0+2.0*v_depth; \n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
8\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:i6("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
8rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\n}"),stars:i6("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:i6("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:i6("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
8pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),vignette:i6("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:i6("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function i5(i,r){for(let a of i.split("\n")){if("#"!==(a=a.trimStart())[0]||!a.includes("if")||a.startsWith("#endif"))continue;let i=a.match(iX);if(i)for(let a of i)iY.has(a)||r.add(a)}}function i4(i){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(i)}function i6(i,r){let a=new Set,n=[],o=[];i=i.replace(iZ,(i,r)=>(o.push(r),"")),r=r.replace(iZ,(i,r)=>(n.push(r),""));let s=new Set(iK);for(let a of(i5(i,s),i5(r,s),[...n,...o]))iQ[a]||(iQ[a]=new Set,i5(iJ[a],iQ[a])),s=new Set([...s,...iQ[a]]);return{fragmentSource:i=i.replace(iW,(i,r,n,o,s)=>(a.add(s),"define"===r?` 9#ifndef HAS_UNIFORM_u_${s} 10${i4(o)?"flat ":""}in ${n} ${o} ${s}; 11#else 12uniform ${n} ${o} u_${s}; 13#endif 14`:"initialize"===r?` 15#ifdef HAS_UNIFORM_u_${s} 16 ${n} ${o} ${s} = u_${s}; 17#endif 18`:"define-attribute"===r?` 19#ifdef HAS_ATTRIBUTE_a_${s} 20 in ${n} ${o} ${s}; 21#endif 22`:"initialize-attribute"===r?"":void 0)),vertexSource:r=r.replace(iW,(i,r,n,o,s)=>{let l=`MATERIAL_ATTRIBUTE_OFFSET_${s}`,h="float"===o?"vec2":o,u=`GET_ATTRIBUTE_${h}(a_${s}, materialInfo, ${l})`,c=s.match(/color/)?"color":h;return"define-attribute-vertex-shader-only"===r?` 23#ifdef HAS_ATTRIBUTE_a_${s} 24in ${n} ${o} a_${s}; 25#endif 26`:a.has(s)?"define"===r?` 27#ifndef HAS_UNIFORM_u_${s} 28uniform lowp float u_${s}_t; 29 #if !defined(${l}) 30 in ${n} ${h} a_${s}; 31 #endif 32${i4(o)?"flat ":""}out ${n} ${o} ${s}; 33#else 34uniform ${n} ${o} u_${s}; 35#endif 36`:"initialize"===r?"vec4"===c||"uvec4"===c?` 37#ifndef HAS_UNIFORM_u_${s} 38 ${s} = a_${s}; 39#else 40 ${n} ${o} ${s} = u_${s}; 41#endif 42`:` 43#if !defined(HAS_UNIFORM_u_${s}) 44 #ifdef ${l} 45 ${s} = unpack_mix_${c}(${u}, u_${s}_t); 46 #else 47 ${s} = unpack_mix_${c}(a_${s}, u_${s}_t); 48 #endif 49#else 50 ${n} ${o} ${s} = u_${s}; 51#endif 52`:"define-attribute"===r?` 53#ifdef HAS_ATTRIBUTE_a_${s} 54 in ${n} ${o} a_${s}; 55 out ${n} ${o} ${s}; 56#endif 57`:"initialize-attribute"===r?` 58#ifdef HAS_ATTRIBUTE_a_${s} 59 ${s} = a_${s}; 60#endif 61`:void 0:"define"===r?` 62#ifndef HAS_UNIFORM_u_${s} 63uniform lowp float u_${s}_t; 64 #if !defined(${l}) 65 in ${n} ${h} a_${s}; 66 #endif 67#else 68uniform ${n} ${o} u_${s}; 69#endif 70`:"define-instanced"===r?"mat4"===c?` 71#ifdef INSTANCED_ARRAYS 72in vec4 a_${s}0; 73in vec4 a_${s}1; 74in vec4 a_${s}2; 75in vec4 a_${s}3; 76#else 77uniform ${n} ${o} u_${s}; 78#endif 79`:` 80#ifdef INSTANCED_ARRAYS 81in ${n} ${h} a_${s}; 82#else 83uniform ${n} ${o} u_${s}; 84#endif 85`:"initialize-attribute-custom"===r?` 86#ifdef HAS_ATTRIBUTE_a_${s} 87 ${n} ${o} ${s} = a_${s}; 88#endif 89`:"vec4"===c||"uvec4"===c?` 90#ifndef HAS_UNIFORM_u_${s} 91 #ifdef ${l} 92 ${n} ${o} ${s} = ${u}; 93 #else 94 ${n} ${o} ${s} = a_${s}; 95 #endif 96#else 97 ${n} ${o} ${s} = u_${s}; 98#endif 99`:` 100#ifndef HAS_UNIFORM_u_${s} 101 #ifdef ${l} 102 ${n} ${o} ${s} = unpack_mix_${c}(${u}, u_${s}_t); 103 #else 104 ${n} ${o} ${s} = unpack_mix_${c}(a_${s}, u_${s}_t); 105 #endif 106#else 107 ${n} ${o} ${s} = u_${s}; 108#endif 109`}),usedDefines:s,vertexIncludes:n,fragmentIncludes:o}}class i8{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(i,r,a,n,o,s,l,h){this.context=i;let u=this.boundPaintVertexBuffers.length!==n.length;for(let i=0;!u&&i<n.length;i++)this.boundPaintVertexBuffers[i]!==n[i]&&(u=!0);let c=this.boundDynamicVertexBuffers.length!==l.length;for(let i=0;!c&&i<l.length;i++)this.boundDynamicVertexBuffers[i]!==l[i]&&(c=!0);if(!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==a||u||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==s)this.freshBind(r,a,n,o,s,l,h);else{for(let a of(i.bindVertexArrayOES.set(this.vao),l))a&&(a.bind(),h&&a.instanceCount&&a.setVertexAttribDivisor(i.gl,r,h));o&&o.dynamicDraw&&o.bind()}}freshBind(i,r,a,n,o,s,l){let h=this.context,u=h.gl;for(let l of(this.vao&&this.destroy(),this.vao=h.gl.createVertexArray(),h.bindVertexArrayOES.set(this.vao),this.boundProgram=i,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=n,this.boundVertexOffset=o,this.boundDynamicVertexBuffers=s,r.enableAttributes(u,i),r.bind(),r.setVertexAttribPointers(u,i,o),a))l.enableAttributes(u,i),l.bind(),l.setVertexAttribPointers(u,i,o);for(let r of s)r&&(r.enableAttributes(u,i),r.bind(),r.setVertexAttribPointers(u,i,o),l&&r.instanceCount&&r.setVertexAttribDivisor(u,i,l));n&&n.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function i9(r,a,n){if(!a.needsDEMTextureUpload)return;let o=r.context,s=o.gl;o.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||r.getTileTexture(n.stride);let l=n.getPixels();a.demTexture?a.demTexture.update(l,{premultiply:!1}):a.demTexture=new i.T(o,l,s.R32F,{premultiply:!1}),a.needsDEMTextureUpload=!1}class i7{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class re extends i7{getDefault(){return i.aq.transparent.toNonPremultipliedRenderColor(null)}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class rt extends i7{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class ri extends i7{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}
109class rr extends i7{getDefault(){return[!0,!0,!0,!0]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class ra extends i7{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class rn extends i7{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class ro extends i7{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){let r=this.current;(i.func!==r.func||i.ref!==r.ref||i.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class rs extends i7{getDefault(){let i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class rl extends i7{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=i,this.dirty=!1}}class rh extends i7{getDefault(){return[0,1]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class ru extends i7{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=i,this.dirty=!1}}class rc extends i7{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class rd extends i7{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.BLEND):r.disable(r.BLEND),this.current=i,this.dirty=!1}}class rp extends i7{getDefault(){let i=this.gl;return[i.ONE,i.ZERO,i.ONE,i.ZERO]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.blendFuncSeparate(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class rf extends i7{getDefault(){return i.aq.transparent.toNonPremultipliedRenderColor(null)}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class rm extends i7{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(i,i),this.current=i,this.dirty=!1)}}class r_ extends i7{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=i,this.dirty=!1}}class rg extends i7{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class ry extends i7{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}let rx=class extends i7{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}};class rv extends i7{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class rb extends i7{getDefault(){let i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class rw extends i7{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class rT extends i7{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class rS extends i7{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class rI extends i7{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class rE extends i7{getDefault(){return null}set(i){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class rA extends i7{getDefault(){return null}set(i){this.gl&&(i!==this.current||this.dirty)&&(this.gl.bindVertexArray(i),this.current=i,this.dirty=!1)}}class rC extends i7{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class rM extends i7{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class rP extends i7{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class rD extends i7{constructor(i,r){super(i),this.context=i,this.parent=r}getDefault(){return null}}class rR extends rD{constructor(i,r,a=0){super(i,r),this.attachmentPoint=i.gl.COLOR_ATTACHMENT0+a}setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachmentPoint,r.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class rL extends rD{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,this.attachment(),r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class rz extends rD{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachment(),r.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class rF extends rL{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}let rO=(i,r,a,n)=>({u_matrix:i,u_image0:0,u_image1:1,u_skirt_height:r,u_ground_shadow_factor:a,u_emissive_texture_available:n}),rB=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y)=>({u_proj_matrix:Float32Array.from(i),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(n),u_merc_matrix:a,u_zoom_transition:o,u_merc_center:s,u_image0:0,u_image1:1,u_frustum_tl:l,u_frustum_tr:h,u_frustum_br:u,u_frustum_bl:c,u_globe_pos:d,u_globe_radius:p,u_viewport:f,u_grid_matrix:y?Float32Array.from(y):new Float32Array(9),u_skirt_height:m,u_far_z_cutoff:_,u_emissive_texture_available:g});function rk(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}let rV=new class{constructor(){this.operations={}}newMorphing(i,r,a,n,o){if(i in this.operations){let r=this.operations[i];r.to.tileID.key!==a.tileID.key&&(r.queued=a)}else this.operations[i]={startTime:n,phase:0,duration:o,from:r,to:a,queued:null}}getMorphValuesForProxy(i){if(!(i in this.operations))return null;let r=this.operations[i];return{from:r.from,to:r.to,phase:r.phase}}update(i){for(let r in this.operations){let a=this.operations[r];for(a.phase=(i-a.startTime)/a.duration;a.phase>
109=1||!this._validOp(a);)if(!this._nextOp(a,i)){delete this.operations[r];break}}}_nextOp(i,r){return!!i.queued&&(i.from=i.to,i.to=i.queued,i.queued=null,i.phase=0,i.startTime=r,!0)}_validOp(i){return i.from.hasData()&&i.to.hasData()}},rN={0:null,1:"TERRAIN_VERTEX_MORPHING"};function rU(i,r,a){return 0===r?0:6*Math.pow(1.5,22-i)*Math.max(r,1)*(r<1&&514===a?.25/r:1)}function rj(i,r){if(!i.style||!i.style.enable3dLights())return;let a=i.context,n=a.gl;a.activeTexture.set(n.TEXTURE1),r?r.bind(n.LINEAR,n.CLAMP_TO_EDGE):i.emptyTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}let rG=i=>({u_matrix:i});function rq(r,a,n,o,s){if(s>0){let l=i.o.now(),h=(l-r.timeAdded)/s,u=a?(l-a.timeAdded)/s:-1,c=n.getSource(),d=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!a||Math.abs(a.tileID.overscaledZ-d)>Math.abs(r.tileID.overscaledZ-d),f=p&&r.refreshedUponExpiration?1:i.aC(p?h:1-u,0,1);return a?{opacity:1,mix:1-f,isFading:h<1}:{opacity:f,mix:0,isFading:h<1}}return{opacity:1,mix:0,isFading:!1}}class r$ extends tm{constructor(i){const r=tl("mock-dem",{type:"raster-dem",maxzoom:Math.ceil(i.transform.maxZoom)},i.style.dispatcher,i.style);super("mock-dem",r,null),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class rH extends tm{constructor(i){const r=tl("proxy",{type:"geojson",maxzoom:Math.ceil(i.transform.maxZoom)},i.style.dispatcher,i.style);super("proxy",r,null),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,a,n){if(r.freezeTileCoverage)return;this.transform=r;let o=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((a,n)=>{if(a[n.key]="",!this._tiles[n.key]){let a=new i.b1(n,this._source.tileSize*n.overscaleFactor(),r.tileZoom,void 0,void 0,this._source.worldview);a.state="loaded",this._tiles[n.key]=a}return a},{});for(let i in this._tiles)i in o||(this.freeFBO(i),this._tiles[i].unloadVectorData(),delete this._tiles[i])}freeFBO(i){let r=this.proxyCachedFBO[i];if(void 0!==r){let a=Object.values(r);this.renderCachePool.push(...a),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class rZ extends i.aS{constructor(i,r,a){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=a}}class rW extends i.bv{constructor(r,a){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[n,o,s]=function(){let r=new i.dx,a=new i.dy;r.reserve(17161),a.reserve(33800);let n=i.an/128,o=i.an+n/2,s=o+n;for(let a=-n;a<s;a+=n)for(let l=-n;l<s;l+=n){let n=24575*(l<0||l>o||a<0||a>o),s=i.aC(Math.round(l),0,i.an),h=i.aC(Math.round(a),0,i.an);r.emplaceBack(s+n,h)}let l=(i,r)=>{let n=131*r+i;a.emplaceBack(n+1,n,n+131),a.emplaceBack(n+131,n+131+1,n+1)};for(let i=1;i<129;i++)for(let r=1;r<129;r++)l(r,i);return[0,129].forEach(i=>{for(let r=0;r<130;r++)l(r,i),l(i,r)}),[r,a,32768]}(),l=r.context;this.gridBuffer=l.createVertexBuffer(n,i.dt.members),this.gridIndexBuffer=l.createIndexBuffer(o),this.gridSegments=i.du.simpleSegment(0,0,n.length,o.length),this.gridNoSkirtSegments=i.du.simpleSegment(0,0,n.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new rH(a.map),this.orthoMatrix=i.bc(),i.bU(this.orthoMatrix,.015*("globe"===this.painter.transform.projection.name),i.an,0,i.an,0,1);const h=l.gl;this._overlapStencilMode=new ir({func:h.GEQUAL,mask:255},0,255,h.KEEP,h.KEEP,h.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=a,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new r$(a.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),this._style=i,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,a,n){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);let o=r.terrain.properties,s=0===r.terrain.drapeRenderMode,l=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.o.now();let h=r.terrain&&r.terrain.scope,u=o.get("source"),c=s?this._mockSourceCache:r.getSourceCache(u,h);if(!c)return void i.w(`Couldn't find terrain source "${u}".`);if(this.sourceCache=c,this._attenuationRange=r.terrain.getAttenuationRange(),this._exaggeration=l?this.calculateExaggeration(a):o.get("exaggeration"),!a.projection.requiresDraping&&l&&0===this._exaggeration)return void this._disable();this.enabled=!0;let d=()=>{this.sourceCache.used&&i.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 110This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let r=this.getScaledDemTileSize();this.sourceCache.update(a,r,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,d(),this._initializing=!0),d(),a.updateElevation(!0,n),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(a),this._emptyDEMTextureDirty=!0,this._previousZoom=a.zoom}else this._disable()}calculateExaggeration(r){if(this._attenuationRange&&r.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(r.zoom);let a=this._previousCameraAltitude,n=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=n;let o=null!=a?n-a:Number.MAX_VALUE;if(2>Math.abs(o))return this._exaggeration;let s=r.zoom,l=this._style.terrain;if(!this._previousUpdateTimestamp)return l.getExaggeration(s);let h=s-this._previousZoom,u=this._previousUpdateTimestamp,c=s;null!=this._evaluationZoom&&(Math.abs(s-(c=this._evaluationZoom))>.5&&(h=.5*(s-c+h)),h*o<0&&(c+=h)),this._evaluationZoom=c;let d=l.getExaggeration(c),p=d===l.getExaggeration(Math.max(0,c-.1));if(p&&.01>Math.abs(d-this._exaggeration))return d;let f=Math.min(.1,.00375*(this._updateTimestamp-u));return(p||d<.1||1e-4>Math.abs(h))&&(f=Math.min(.2,4*f)),i.am(this._exaggeration,d,f)}resetTileLookupCache(i){this._findCoveringTileCache[i]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(i){"source"===i.dataType&&i.coord?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(let i in this._style._mergedSourceCaches)this._style._mergedSourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(i=>
110i.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){let i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){var a;let n,o;if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let s=this.proxySourceCache,l=this.painter.transform;this._initializing&&(this._initializing=0===l._centerAltitude&&-1===this.getAtPointOrZero(i.ag.fromLngLat(l.center),-1),this._emptyDEMTextureDirty=!this._initializing);let h=this.proxyCoords=s.getIds().map(i=>{let r=s.getTileByID(i).tileID;return r.projMatrix=l.calculateProjMatrix(r.toUnwrapped()),r});n=(a=this.painter).transform.pointCoordinate(a.transform.getCameraPoint()),o=new i.P(n.x,n.y),h.sort((r,a)=>{if(a.overscaledZ-r.overscaledZ)return a.overscaledZ-r.overscaledZ;let n=new i.P(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),s=new i.P(a.canonical.x+(1<<a.canonical.z)*a.wrap,a.canonical.y),l=o.mult(1<<r.canonical.z);return l.x-=.5,l.y-=.5,l.distSqr(n)-l.distSqr(s)});let u=this.proxyToSource||{};this.proxyToSource={},h.forEach(i=>{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};let c=this._style._mergedSourceCaches;for(let i in c){let a=c[i];if(!a.used||(a!==this.sourceCache&&this.resetTileLookupCache(a.id),this._setupProxiedCoordsForOrtho(a,r[i],u),a.usedForTerrain))continue;let n=r[i];(a.getSource().reparseOverscaled||a._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(n)}this.proxiedCoords[s.id]=h.map(i=>new rZ(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(h),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(u),this.renderingToTexture=!1;let d={};for(let i of(this._visibleDemTiles=[],this.proxyCoords)){let r=this.terrainTileForTile[i.key];if(!r)continue;let a=r.tileID.key;a in d||(this._visibleDemTiles.push(r),d[a]=a)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;let r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){let i=this.painter.context,r=i.gl;for(let a in this.terrainTileForTile){let n=this.terrainTileForTile[a],o=n.dem;o&&(!n.demTexture||n.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),i9(this.painter,n,o))}}_prepareDemTileUniforms(i,r,a,n){if(!r||null==r.demTexture)return!1;let o=i.tileID.canonical,s=Math.pow(2,r.tileID.canonical.z-o.z),l=n||"";return a[`u_dem_tl${l}`]=[o.x*s%1,o.y*s%1],a[`u_dem_scale${l}`]=s,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let i=0,r=this._visibleDemTiles.reduce((r,a)=>{if(!a.dem)return r;let n=a.dem.tree.minimums[0];return n>0&&i++,r+n},0);return i?r/i:0}_updateEmptyDEMTexture(){let r=this.painter.context,a=r.gl;r.activeTexture.set(a.TEXTURE2);let n=this._getLoadedAreaMinimum(),o=new i.dv({width:1,height:1},new Float32Array([n]));this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(o,{premultiply:!1}):s=this._emptyDEMTexture=new i.T(r,o,a.R32F,{premultiply:!1}),s}setupElevationDraw(r,a,n){var o;let s=this.painter.context,l=s.gl,h={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};h.u_exaggeration=this.exaggeration();let u=null,c=null,d=1;if(n&&n.morphing&&this._useVertexMorphing){let i=n.morphing.srcDemTile,a=n.morphing.dstDemTile;
110d=n.morphing.phase,i&&a&&(this._prepareDemTileUniforms(r,i,h,"_prev")&&(c=i),this._prepareDemTileUniforms(r,a,h)&&(u=a))}let p=i=>i&&i.demTexture&&this.painter.linearFloatFilteringSupported()?l.LINEAR:l.NEAREST,f=null;if(this.enabled?c&&u?(f=u.demTexture,s.activeTexture.set(l.TEXTURE4),c.demTexture.bind(p(c),l.CLAMP_TO_EDGE),h.u_dem_lerp=d):(u=this.terrainTileForTile[r.tileID.key],f=this._prepareDemTileUniforms(r,u,h)?u.demTexture:this.emptyDEMTexture):f=this.emptyDEMTexture,s.activeTexture.set(l.TEXTURE2),f&&(h.u_dem_size=1===(o=f).size[0]?1:o.size[0]-2,f.bind(p(u),l.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(n&&n.useDepthForOcclusion,a,h),n&&n.useMeterToDem&&u&&(h.u_meter_to_dem=(1<<u.tileID.canonical.z)*i.bV(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize),n&&n.labelPlaneMatrixInv&&(h.u_label_plane_matrix_inv=n.labelPlaneMatrixInv),a.setTerrainUniformValues(s,h),"globe"===this.painter.transform.projection.name){let i=this.globeUniformValues(this.painter.transform,r.tileID.canonical,n&&n.useDenormalizedUpVectorScale);a.setGlobeUniformValues(s,i)}}globeUniformValues(r,a,n){let o=r.projection;return{u_tile_tl_up:o.upVector(a,0,0),u_tile_tr_up:o.upVector(a,i.an,0),u_tile_br_up:o.upVector(a,i.an,i.an),u_tile_bl_up:o.upVector(a,0,i.an),u_tile_up_scale:n?i.dw(1):o.upVectorScale(a,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){let a=this.painter,n=this.painter.context;0!==r.length&&(n.bindFramebuffer.set(null),n.viewport.set([0,0,a.width,a.height]),a.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(r,a,n,o,s){if("globe"===r.transform.projection.name)!function(r,a,n,o,s){let l,h,u=r.context,c=u.gl,d=r.transform,p=i.dk(r,u,d),f=(i,a)=>{if(h===a)return;let n=[rN[a],"PROJECTION_GLOBE_VIEW"];p&&n.push("CUSTOM_ANTIALIASING");let o=r.isTileAffectedByFog(i);l=r.getOrCreateProgram("globeRaster",{defines:n,overrideFog:o}),h=a},m=r.colorModeForRenderPass(),_=new ii(c.LEQUAL,ii.ReadWrite,r.depthRangeFor3D);rV.update(s);let g=i.dl(d),y=[i.aH(d.center.lng),i.aL(d.center.lat)],x=r.globeSharedBuffers,v=[d.width*i.o.devicePixelRatio,d.height*i.o.devicePixelRatio],b=Float32Array.from(d.globeMatrix),w={useDenormalizedUpVectorScale:!0};{let d=r.transform,p=rU(d.zoom,a.exaggeration(),a.sourceCache._source.tileSize);h=-1;let T=c.TRIANGLES;for(let h of o){let o=n.getTile(h),S=ir.disabled,I=a.prevTerrainTileForTile[h.key],E=a.terrainTileForTile[h.key];rk(I,E)&&rV.newMorphing(h.key,I,E,s,250),rj(r,o.emissiveTexture),u.activeTexture.set(c.TEXTURE0),o.texture&&o.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=rV.getMorphValuesForProxy(h.key),C=+!!A;A&&Object.assign(w,{morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.dj(A.phase)}});let M=i.dm(h.canonical),P=i.dn(M.getCenter().lat),D=i.dp(h.canonical,M,P,d.worldSize/d._pixelsPerMercatorPixel),R=i.dq(i.dr(h.canonical)),L=+("mrt-fallback"===r.emissiveMode),z=rB(d.expandedFarZProjMatrix,b,g,R,i.al(d.zoom),y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,p,d._farZ,L,D);if(f(h,C),l&&(a.setupElevationDraw(o,l,w),r.uploadCommonUniforms(u,l,h.toUnwrapped()),x)){let[i,a,n]=x.getGridBuffers(P,0!==p);l.draw(r,T,_,S,m,ia.backCCW,z,"globe_raster",i,a,n)}}}if(x&&(r.renderDefaultNorthPole||r.renderDefaultSouthPole)){let s=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let h of(p&&s.push("CUSTOM_ANTIALIASING"),l=r.getOrCreateProgram("globeRaster",{defines:s}),o)){let{x:o,y:s,z:p}=h.canonical,f=0===s,g=s===(1<<p)-1,[b,T,S,I]=x.getPoleBuffers(p,!1);if(I&&(f||g)){let s=n.getTile(h);rj(r,s.emissiveTexture),u.activeTexture.set(c.TEXTURE0),s.texture&&s.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let x=i.ds(p,o,d),E=i.dq(i.dr(h.canonical)),A=+("mrt-fallback"===r.emissiveMode),C=(i,a)=>i.draw(r,c.TRIANGLES,_,ir.disabled,m,ia.disabled,rB(d.expandedFarZProjMatrix,x,x,E,0,y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,0,d._farZ,A),"globe_pole_raster",a,S,I);a.setupElevationDraw(s,l,w),r.uploadCommonUniforms(u,l,h.toUnwrapped()),f&&r.renderDefaultNorthPole&&C(l,b),g&&r.renderDefaultSouthPole&&(x=i.cx(i.bc(),x,[1,-1,1]),C(l,T))}}}}(r,a,n,o,s);else{let l,h,u=r.context,c=u.gl,d=r.shadowRenderer,p=im(r,r.longestCutoffRange),f=i=>{if(h===i)return;let a=[];a.push(rN[i]),p.shouldRenderCutoff&&a.push("RENDER_CUTOFF"),d&&(a.push("RENDER_SHADOWS"),d.useNormalOffset&&a.push("NORMAL_OFFSET")),l=r.getOrCreateProgram("terrainRaster",{defines:a}),h=i},m=r.colorModeForRenderPass(),_=new ii(c.LEQUAL,ii.ReadWrite,r.depthRangeFor3D);rV.update(s);let g=r.transform,y=rU(g.zoom,a.exaggeration(),a.sourceCache._source.tileSize),x=[0,0,0];if(d){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(x=ib(r.style,i,a))}{h=-1;let v=c.TRIANGLES,[b,w]=[a.gridIndexBuffer,a.gridSegments];for(let h of o){let o,T=n.getTile(h),S=ir.disabled,I=a.prevTerrainTileForTile[h.key],E=a.terrainTileForTile[h.key];rk(I,E)&&rV.newMorphing(h.key,I,E,s,250),rj(r,T.emissiveTexture),u.activeTexture.set(c.TEXTURE0),T.texture&&T.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=rV.getMorphValuesForProxy(h.key),C=+!!A;A&&(o={morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.dj(A.phase)}});let M=+("mrt-fallback"===r.emissiveMode),P=rO(h.projMatrix,!function(i,r){let a=1<<i.z;return!r&&(0===i.x||i.x===a-1)||0===i.y||i.y===a-1}(h.canonical,g.renderWorldCopies)?y:y/10,x,M);if(f(C),!l)continue;a.setupElevationDraw(T,l,o);let D=h.toUnwrapped();d&&d.setupShadows(D,l),r.uploadCommonUniforms(u,l,D,null,p),l.draw(r,v,_,S,m,ia.backCCW,P,"terrain_raster",a.gridBuffer,b,w)}}}}(a,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,a.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(0===this._drapedRenderBatches.length)return r+1;this.renderingToTexture=!0;let a=this.painter,n=this.painter.context,o=this.proxySourceCache,s=this.proxiedCoords[o.id],l=this._drapedRenderBatches.shift(),h=a.style.order,u=[];this._updateFBOs("mrt-fallback"===a.emissiveMode);let c=0;for(let d of s){let s,p=o.getTileByID(d.proxyTileKey),f=o.proxyCachedFBO[d.key]?o.proxyCachedFBO[d.key][r]:void 0,m=void 0!==f?o.renderCache[f]:this.pool[c++],_=void 0!==f;if(p.texture=m.tex,p.emissiveTexture=m.emissiveTex,_&&!m.dirty){u.push(p.tileID);continue}n.bindFramebuffer.set(m.fb.framebuffer);let g=n.gl;g.drawBuffers("mrt-fallback"===a.emissiveMode?[g.COLOR_ATTACHMENT0,g.COLOR_ATTACHMENT1]:[g.COLOR_ATTACHMENT0]),this.renderedToTile=!1,m.dirty&&(n.clear({color:i.aq.transparent,stencil:0}),m.dirty=!1);for(let i=l.start;i<=l.end;++i){let r=a.style._mergedLayers[h[i]];if(r.isHidden(a.transform.zoom))continue;let o=a.style.getLayerSourceCache(r),l=o?this.proxyToSource[d.key][o.id]:[d];l&&(n.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(o?o.id:null)&&(this._setupStencil(m,l,r,o),s=o?o.id:null),a.renderLayer(a,o,r,l))}if(g.drawBuffers([g.COLOR_ATTACHMENT0]),0===this._drapedRenderBatches.length)for(let i of this._pendingGroundEffectLayers){let r=a.style._mergedLayers[h[i]];if(r.isHidden(a.transform.zoom))continue;let o=a.style.getLayerSourceCache(r),l=o?this.proxyToSource[d.key][o.id]:[d];l&&(n.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(o?o.id:null)&&(this._setupStencil(m,l,r,o),s=o?o.id:null),a.renderLayer(a,o,r,l))}this.renderedToTile?(m.dirty=!0,u.push(p.tileID)):_||--c,5===c&&(c=0,this.renderToBackBuffer(u))}return this.renderToBackBuffer(u),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,a.width,a.height]),l.end+1}postRender(){}isLayerOrderingCorrect(i){let r=i.order.length,a=-1,n=r;for(let o=0;o<r;++o)this._style.isLayerDraped(i._mergedLayers[i.order[o]])?a=Math.max(a,o):n=Math.min(n,o);return n>a}getMinElevationBelowMSL(){let i=0;return this._visibleDemTiles.filter(i=>i.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,a){if(!this._visibleDemTiles)return null;let n=this._visibleDemTiles.filter(i=>i.dem).map(n=>{let o=n.tileID,s=1<<o.overscaledZ,{x:l,y:h}=o.canonical,u=l/s,c=(l+1)/s,d=h/s,p=(h+1)/s;return{minx:u,miny:d,maxx:c,maxy:p,t:n.dem.tree.raycastRoot(u,d,c,p,i,r,a),tile:n}});for(let o of(n.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),n)){if(null==o.t)break;let n=o.tile.dem.tree.raycast(o.minx,o.miny,o.maxx,o.maxy,i,r,a);if(null!=n)return n}return null}_createFBO(){let r,a=this.painter.context,n=a.gl,o=this.drapeBufferSize;a.activeTexture.set(n.TEXTURE0);
110let s=new i.T(a,{width:o[0],height:o[1],data:null},n.RGBA8);s.bind(n.LINEAR,n.CLAMP_TO_EDGE);let l=a.createFramebuffer(o[0],o[1],1,null);return l.colorAttachment0.set(s.texture),this._emissiveTexture&&((r=new i.T(a,{width:o[0],height:o[1],data:null},n.R8)).bind(n.LINEAR,n.CLAMP_TO_EDGE),l.createColorAttachment(a,1),l.colorAttachment1.set(r.texture)),l.depthAttachment=new rF(a,l.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=a.createRenderbuffer(a.gl.DEPTH_STENCIL,o[0],o[1]),this._stencilRef=0,l.depthAttachment.set(this._sharedDepthStencil),a.clear({stencil:0})):l.depthAttachment.set(this._sharedDepthStencil),a.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax),{fb:l,tex:s,emissiveTex:r,dirty:!1}}_updateFBOs(i){if(this._emissiveTexture!==i){for(let r of this.pool)this._updateFBO(r,i);for(let r of this.proxySourceCache.renderCache)this._updateFBO(r,i);this._emissiveTexture=i}}_updateFBO(r,a){let n=r.fb,o=this.painter.context,s=o.gl,l=this.drapeBufferSize;if(a){let a=new i.T(o,{width:l[0],height:l[1],data:null},s.R8);a.bind(s.LINEAR,s.CLAMP_TO_EDGE),r.emissiveTex=a,n.createColorAttachment(o,1),n.colorAttachment1.set(a.texture)}else r.emissiveTex=void 0,n.removeColorAttachment(o,1);r.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(let i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i].hasTransition())return!0;return this._style.order.some(i=>{let r=this._style._mergedLayers[i],a=r.isHidden(this.painter.transform.zoom);return"hillshade"===r.type||"custom"===r.type?!a&&r.shouldRedrape():!a&&r.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(let i of this._style.getSources())if(i instanceof ta){r=!0;break}if(!r)return;let a={};for(let r=0;r<this._style.order.length;++r){let n=this._style._mergedLayers[this._style.order[r]],o=this._style.getLayerSourceCache(n);if(!o||a[o.id]||n.isHidden(this.painter.transform.zoom)||"line"!==n.type)continue;let s=n.widthExpression(),l=n.emissiveStrengthExpression();if(s instanceof i.af||l instanceof i.af)for(let i of(a[o.id]=!0,this.proxyCoords)){let r=this.proxyToSource[i.key][o.id];if(r)for(let i of r)this._clearRenderCacheForTile(o.id,i)}}}_clearRasterLayersFromRenderCache(){let i=!1;for(let r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r]._source instanceof tn){i=!0;break}if(!i)return;let r={};for(let i=0;i<this._style.order.length;++i){let a=this._style._mergedLayers[this._style.order[i]],n=this._style.getLayerSourceCache(a);if(!n||r[n.id]||a.isHidden(this.painter.transform.zoom)||"raster"!==a.type)continue;let o=a.paint.get("raster-fade-duration");for(let i of this.proxyCoords){let r=this.proxyToSource[i.key][n.id];if(r)for(let i of r){let r=rq(n.getTile(i),n.findLoadedParent(i,0),n,this.painter.transform,o);(1!==r.opacity||0!==r.mix)&&this._clearRenderCacheForTile(n.id,i)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();let r=this._style.order,a=r.length;if(0===a)return;let n=[];this._pendingGroundEffectLayers=[];let o,s=0,l=this._style._mergedLayers[r[s]];for(;!this._style.isLayerDraped(l)&&l.isHidden(this.painter.transform.zoom)&&++s<a;)l=this._style._mergedLayers[r[s]];for(;s<a;++s){let i=this._style._mergedLayers[r[s]];i.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(i)?void 0===o&&(o=s):("fill-extrusion"===i.type&&this._pendingGroundEffectLayers.push(s),void 0!==o&&(n.push({start:o,end:s-1}),o=void 0)))}if(void 0!==o&&n.push({start:o,end:s-1}),0!==n.length){let r=n[n.length-1];this._pendingGroundEffectLayers.every(i=>i>r.end)||i.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=n}_setupRenderCache(i){let r=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,r.renderCache.length>r.renderCachePool.length){let i=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let a=0;a<i.length;++a){let n=Object.values(i[a]);r.renderCachePool.push(...n)}}return}this._clearRasterLayersFromRenderCache();let a=this.proxyCoords,n=this._tilesDirty;for(let o=a.length-1;o>=0;o--){let s=a[o];if(r.getTileByID(s.key),void 0!==r.proxyCachedFBO[s.key]){let a=i[s.key],o=this.proxyToSource[s.key],l=0;for(let i in o){let r=o[i],s=a[i];if(!s||s.length!==r.length||r.some((r,a)=>r!==s[a]||n[i]&&n[i].hasOwnProperty(r.key))){l=-1;break}++l}for(let i in r.proxyCachedFBO[s.key])r.renderCache[r.proxyCachedFBO[s.key][i]].dirty=l<0||l!==Object.values(a).length}}let o=[...this._drapedRenderBatches];for(let i of(o.sort((i,r)=>r.end-r.start-(i.end-i.start)),o))for(let n of a){if(r.proxyCachedFBO[n.key])continue;let a=r.renderCachePool.pop();void 0===a&&r.renderCache.length<50&&(a=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==a&&(r.proxyCachedFBO[n.key]={},r.proxyCachedFBO[n.key][i.start]=a,r.renderCache[a].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,a,n){let o;if(!n||!this._sourceTilesOverlap[n.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let s=this.painter.context,l=s.gl;if(r.length<=1)return void(this._overlapStencilType=!1);
110if(a.isTileClipped())o=r.length,this._overlapStencilMode.test={func:l.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);o=1,this._overlapStencilMode.test={func:l.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+o>255&&(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=o,this._overlapStencilMode.ref=this._stencilRef,a.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(i){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[i.key]),this._overlapStencilMode):ir.disabled}_renderTileClippingMasks(i,r){let a=this.painter,n=this.painter.context,o=n.gl;a._tileClippingMaskIDs={},n.setColorMode(it.disabled),n.setDepthMode(ii.disabled);let s=a.getOrCreateProgram("clippingMask");for(let n of i){let i=a._tileClippingMaskIDs[n.key]=--r;s.draw(a,o.TRIANGLES,ii.disabled,new ir({func:o.ALWAYS,mask:0},i,255,o.KEEP,o.KEEP,o.REPLACE),it.disabled,ia.disabled,rG(n.projMatrix),"$clipping",a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}}pointCoordinate(r){let a=this.painter.transform;if(r.x<0||r.x>a.width||r.y<0||r.y>a.height)return null;let n=[r.x,r.y,1,1];i.aE(n,n,a.pixelMatrixInverse),i.cp(n,n,1/n[3]),n[0]/=a.worldSize,n[1]/=a.worldSize;let o=a._camera.position,s=i.bV(1,a.center.lat),l=[o[0],o[1],o[2]/s,0],h=i.cR([],n.slice(0,3),l);i.ay(h,h);let u=this.raycast(l,h,this._exaggeration);return null!==u&&u?(i.bh(l,l,h,u),l[3]=l[2],l[2]*=s,l):null}_setupProxiedCoordsForOrtho(r,a,n){if(r.getSource()instanceof i.aW)return this._setupProxiedCoordsForImageSource(r,a,n);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};let o=this.proxiedCoords[r.id]=[],s=this.proxyCoords;for(let i=0;i<s.length;i++){let a=s[i],l=this._findTileCoveringTileID(a,r);if(l){let i=this._createProxiedId(a,l,n[a.key]&&n[a.key][r.id]);o.push(i),this.proxyToSource[a.key][r.id]=[i]}}let l=!1,h=new Set;for(let i=0;i<a.length;i++){let s=r.getTile(a[i]);if(!s||!s.hasData())continue;let u=this._findTileCoveringTileID(s.tileID,this.proxySourceCache);if(u&&u.tileID.canonical.z!==s.tileID.canonical.z){let i=this.proxyToSource[u.tileID.key][r.id],a=this._createProxiedId(u.tileID,s,n[u.tileID.key]&&n[u.tileID.key][r.id]);i?i.splice(i.length-1,0,a):this.proxyToSource[u.tileID.key][r.id]=[a];let c=this.proxyToSource[u.tileID.key][r.id];h.has(c)||h.add(c),o.push(a),l=!0}}if(this._sourceTilesOverlap[r.id]=l,l&&this._debugParams.sortTilesHiZFirst)for(let i of h)i.sort((i,r)=>r.overscaledZ-i.overscaledZ)}_setupProxiedCoordsForImageSource(r,a,n){if(!r.getSource().loaded())return;let o=this.proxiedCoords[r.id]=[],s=this.proxyCoords,l=r.getSource(),h=l.tileID;if(!h)return;let u=new i.P(h.x,h.y)._div(1<<h.z),c=l.coordinates.map(i.ag.fromLngLat).reduce((i,r)=>(i.min.x=Math.min(i.min.x,r.x-u.x),i.min.y=Math.min(i.min.y,r.y-u.y),i.max.x=Math.max(i.max.x,r.x-u.x),i.max.y=Math.max(i.max.y,r.y-u.y),i),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),d=(r,a)=>{let n=r.wrap+r.canonical.x/(1<<r.canonical.z),o=r.canonical.y/(1<<r.canonical.z),s=i.an/(1<<r.canonical.z),l=a.wrap+a.canonical.x/(1<<a.canonical.z),h=a.canonical.y/(1<<a.canonical.z);return n+s<l+c.min.x||n>l+c.max.x||o+s<h+c.min.y||o>h+c.max.y};for(let i=0;i<s.length;i++){let l=s[i];for(let i=0;i<a.length;i++){let s=r.getTile(a[i]);if(!s||!s.hasData()||d(l,s.tileID))continue;let h=this._createProxiedId(l,s,n[l.key]&&n[l.key][r.id]),u=this.proxyToSource[l.key][r.id];u?u.push(h):this.proxyToSource[l.key][r.id]=[h],o.push(h)}}}_createProxiedId(r,a,n){let o=this.orthoMatrix;if(n){let i=n.find(i=>i.key===a.tileID.key);if(i)return i}if(a.tileID.key!==r.key){let n,s,l,h=r.canonical.z-a.tileID.canonical.z;o=i.bc();let u=a.tileID.wrap-r.wrap<<r.overscaledZ;h>0?(s=(n=i.an>>h)*((a.tileID.canonical.x<<h)-r.canonical.x+u),l=n*((a.tileID.canonical.y<<h)-r.canonical.y)):(n=i.an<<-h,s=i.an*(a.tileID.canonical.x-(r.canonical.x+u<<-h)),l=i.an*(a.tileID.canonical.y-(r.canonical.y<<-h))),i.bU(o,0,n,0,n,0,1),i.by(o,o,[s,l,0])}return new rZ(a.tileID,r.key,o)}_findTileCoveringTileID(r,a){let n=a.getTile(r);if(n&&n.hasData())return n;let o=this._findCoveringTileCache[a.id],s=o[r.key];if((n=s?a.getTileByID(s):null)&&n.hasData()||null===s)return n;let l=n?n.tileID:r,h=l.overscaledZ,u=a.getSource().minzoom,c=[];if(!s){let o=a.getSource().maxzoom;if(r.canonical.z>=o){let n=r.canonical.z-o;a.getSource().reparseOverscaled?(h=Math.max(r.canonical.z+2,a.transform.tileZoom),l=new i.aS(h,r.wrap,o,r.canonical.x>>n,r.canonical.y>>n)):0!==n&&(h=o,l=new i.aS(h,r.wrap,o,r.canonical.x>>n,r.canonical.y>>n))}l.key!==r.key&&(c.push(l.key),n=a.getTile(l))}let d=i=>
110{c.forEach(r=>{o[r]=i}),c.length=0};for(h-=1;h>=u&&(!n||!n.hasData());h--){n&&d(n.tileID.key);let i=l.calculateScaledKey(h);if((n=a.getTileByID(i))&&n.hasData())break;let r=o[i];if(null===r)break;void 0===r?c.push(i):n=a.getTileByID(r)}return d(n?n.tileID.key:null),n&&n.hasData()?n:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let a=this._tilesDirty[i];a||(a=this._tilesDirty[i]={}),a[r.key]=!0}}let rX=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],rY=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class rK{static cacheKey(i,r,a,n){let o=[r];for(let r of(n&&o.push(n.cacheKey),a))("string"==typeof r&&r.includes(" ")||i.usedDefines.has(r))&&o.push(r);return o.join("/")}constructor(r,a,n,o,s,l){const h=r.gl;this.program=h.createProgram(),this.configuration=o,this.name=a,this.fixedDefines=[...l];const u=`#version 300 es 111${(o?o.defines():[]).concat(l.map(i=>`#define ${i}`)).join("\n")}`,c=[u,i1];for(const i of n.fragmentIncludes)c.push(iJ[i]);c.push(n.fragmentSource);const d=c.join("\n"),p=[u,i2];for(const i of n.vertexIncludes)p.push(iJ[i]);this.forceManualRenderingForInstanceIDShaders=r.forceManualRenderingForInstanceIDShaders&&n.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&p.push("uniform int u_instanceID;"),p.push(n.vertexSource);let f=p.join("\n");this.forceManualRenderingForInstanceIDShaders&&(f=f.replaceAll("gl_InstanceID","u_instanceID"));const m=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);h.shaderSource(m,d),h.compileShader(m),h.attachShader(this.program,m);const _=h.createShader(h.VERTEX_SHADER);h.isContextLost()?this.failedToCreate=!0:(h.shaderSource(_,f),h.compileShader(_),h.attachShader(this.program,_),this.attributes={},h.linkProgram(this.program),h.deleteShader(_),h.deleteShader(m),this.fixedUniforms=s(r),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=o?o.getUniforms(r):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(r=>({u_instanceID:new i.bY(r)}))(r)),(l.includes("TERRAIN")||l.includes("ELEVATED")||a.includes("symbol")||a.includes("circle"))&&(this.terrainUniforms=(r=>({u_dem:new i.bY(r),u_dem_prev:new i.bY(r),u_dem_tl:new i.b$(r),u_dem_scale:new i.b_(r),u_dem_tl_prev:new i.b$(r),u_dem_scale_prev:new i.b_(r),u_dem_size:new i.b_(r),u_dem_lerp:new i.b_(r),u_exaggeration:new i.b_(r),u_depth:new i.bY(r),u_depth_size_inv:new i.b$(r),u_depth_range_unpack:new i.b$(r),u_occluder_half_size:new i.b_(r),u_occlusion_depth_offset:new i.b_(r),u_meter_to_dem:new i.b_(r),u_label_plane_matrix_inv:new i.c0(r)}))(r)),l.includes("GLOBE")&&(this.globeUniforms=(r=>({u_tile_tl_up:new i.bZ(r),u_tile_tr_up:new i.bZ(r),u_tile_br_up:new i.bZ(r),u_tile_bl_up:new i.bZ(r),u_tile_up_scale:new i.b_(r)}))(r)),l.includes("FOG")&&(this.fogUniforms=(r=>({u_fog_matrix:new i.c0(r),u_fog_range:new i.b$(r),u_fog_color:new i.cK(r),u_fog_horizon_blend:new i.b_(r),u_fog_vertical_limit:new i.b$(r),u_fog_temporal_offset:new i.b_(r),u_frustum_tl:new i.bZ(r),u_frustum_tr:new i.bZ(r),u_frustum_br:new i.bZ(r),u_frustum_bl:new i.bZ(r),u_globe_pos:new i.bZ(r),u_globe_radius:new i.b_(r),u_globe_transition:new i.b_(r),u_is_globe:new i.bY(r),u_viewport:new i.b$(r)}))(r)),l.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(r=>({u_cutoff_params:new i.cK(r)}))(r)),l.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(r=>({u_lighting_ambient_color:new i.bZ(r),u_lighting_directional_dir:new i.bZ(r),u_lighting_directional_color:new i.bZ(r),u_ground_radiance:new i.bZ(r)}))(r)),l.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(r=>({u_light_matrix_0:new i.c0(r),u_light_matrix_1:new i.c0(r),u_fade_range:new i.b$(r),u_shadow_normal_offset:new i.bZ(r),u_shadow_intensity:new i.b_(r),u_shadow_texel_size:new i.b_(r),u_shadow_map_resolution:new i.b_(r),u_shadow_direction:new i.bZ(r),u_shadow_bias:new i.bZ(r),u_shadowmap_0:new i.bY(r),u_shadowmap_1:new i.bY(r)}))(r)))}getAttributeLocation(i,r){let a=this.attributes[r];return void 0===a&&(a=this.attributes[r]=i.getAttribLocation(this.program,r)),a}setTerrainUniformValues(i,r){if(!this.terrainUniforms)return;let a=this.terrainUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n]&&a[n].set(this.program,n,r[n])}setGlobeUniformValues(i,r){if(!this.globeUniforms)return;let a=this.globeUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n]&&a[n].set(this.program,n,r[n])}setFogUniformValues(i,r){if(!this.fogUniforms)return;let a=this.fogUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setCutoffUniformValues(i,r){if(!this.cutoffUniforms)return;let a=this.cutoffUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setLightsUniformValues(i,r){if(!this.lightsUniforms)return;let a=this.lightsUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setShadowUniformValues(i,r){if(this.failedToCreate||!this.shadowUniforms)return;let a=this.shadowUniforms;for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}_drawDebugWireframe(r,a,n,o,s,l,h,u,c,d){let p=r.options.wireframe;if(!1===p.terrain&&!1===p.layers2D&&!1===p.layers3D)return;let f=r.context;if(!(!(!p.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!p.layers2D||r._terrain&&r._terrain.renderingToTexture||!rX.includes(this.name))||!(!p.layers3D||!rY.includes(this.name))))return;let m=f.gl,_=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,s,f);if(!_)return;
111let g=[...this.fixedDefines,"DEBUG_WIREFRAME"],y=r.getOrCreateProgram(this.name,{config:this.configuration,defines:g});f.program.set(y.program);let x=(i,r,a)=>{if(r[i]&&a[i])for(let n in r[i])a[i][n]&&a[i][n].set(a.program,n,r[i][n].current)};c&&c.setUniforms(y.program,f,y.binderUniforms,h,{zoom:u}),x("fixedUniforms",this,y),x("terrainUniforms",this,y),x("globeUniforms",this,y),x("fogUniforms",this,y),x("lightsUniforms",this,y),x("shadowUniforms",this,y),_.bind(),f.setColorMode(new it([m.ONE,m.ONE_MINUS_SRC_ALPHA,m.ZERO,m.ONE],i.aq.transparent,[!0,!0,!0,!1])),f.setDepthMode(new ii(a.func===m.LESS?m.LEQUAL:a.func,ii.ReadOnly,a.range)),f.setStencilMode(ir.disabled);let v=3*l.primitiveLength*2,b=3*l.primitiveOffset*4;if(this.forceManualRenderingForInstanceIDShaders){let i=d||1;for(let r=0;r<i;++r)y.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",r),m.drawElements(m.LINES,v,m.UNSIGNED_SHORT,b)}else d&&d>1?m.drawElementsInstanced(m.LINES,v,m.UNSIGNED_SHORT,b,d):m.drawElements(m.LINES,v,m.UNSIGNED_SHORT,b);s.bind(),f.program.set(this.program),f.setDepthMode(a),f.setStencilMode(n),f.setColorMode(o)}checkUniforms(i,r,a){if(this.fixedDefines.includes(r)){for(let n of Object.keys(a))if(!a[n].initialized)throw Error(`Program '${this.name}', from draw '${i}': uniform ${n} not set but required by ${r} being defined`)}}draw(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=i.context,x=y.gl;if(this.failedToCreate)return;for(let[i,r]of(y.program.set(this.program),y.setDepthMode(a),y.setStencilMode(n),y.setColorMode(o),y.setCullFace(s),this.fixedUniformsEntries))r.set(this.program,i,l[i]);m&&m.setUniforms(this.program,y,this.binderUniforms,p,{zoom:f});let v={[x.POINTS]:1,[x.LINES]:2,[x.TRIANGLES]:3,[x.LINE_STRIP]:1}[r];this.checkUniforms(h,"RENDER_SHADOWS",this.shadowUniforms);let b=_||[],w=m?m.getPaintVertexBuffers():[],T=r===x.TRIANGLES&&c,S=g&&g>0?1:void 0;for(let s of d.get()){let l=s.vaos||(s.vaos={});if((l[h]||(l[h]=new i8)).bind(y,this,u,w,c,s.vertexOffset,b,S),this.forceManualRenderingForInstanceIDShaders){let i=g||1;for(let a=0;a<i;++a)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",a),c?x.drawElements(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2):x.drawArrays(r,s.vertexOffset,s.vertexLength)}else g&&g>1?x.drawElementsInstanced(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2,g):c?x.drawElements(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2):x.drawArrays(r,s.vertexOffset,s.vertexLength);T&&this._drawDebugWireframe(i,a,n,o,c,s,p,f,m,g)}}}function rJ(r,a,n=0){let o=Math.pow(2,a.tileID.overscaledZ),s=a.tileSize*Math.pow(2,r.transform.tileZoom)/o,l=s*(a.tileID.canonical.x+a.tileID.wrap*o),h=s*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture?a.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/i.aA(a,1,r.transform.tileZoom),u_pixel_coord_upper:[l>>16,h>>16],u_pixel_coord_lower:[65535&l,65535&h],u_pattern_transition:n}}let rQ={terrain:0,flat:1},r0=i.bc(),r1=(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b=[0,0,1])=>{let w=a.style.light,T=w.properties.get("position"),S=[T.x,T.y,T.z],I=i.dA();"viewport"===w.properties.get("anchor")&&(i.dB(I,-a.transform.angle),i.dC(S,S,I));let E=w.properties.get("color").toPremultipliedRenderColor(null),A=a.transform,C={u_matrix:r,u_lightpos:S,u_lightintensity:w.properties.get("intensity"),u_lightcolor:[E.r,E.g,E.b],u_vertical_gradient:+n,u_opacity:o,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:r0,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:rQ[d],u_base_type:rQ[p],u_ao:s,u_edge_radius:l,u_width_scale:h,u_flood_light_color:g,u_vertical_scale:y,u_flood_light_intensity:x,u_ground_shadow_factor:v,u_front_cutoff_params:b};return"globe"===A.projection.name&&(C.u_tile_id=[u.canonical.x,u.canonical.y,1<<u.canonical.z],C.u_zoom_transition=f,C.u_inv_rot_matrix=_,C.u_merc_center=m,C.u_up_dir=A.projection.upVector(new i.ci(0,0,0),m[0]*i.an,m[1]*i.an),C.u_height_lift=c),C},r2=(i,r,a,n,o,s)=>({u_matrix:i,u_edge_radius:r,u_width_scale:a,u_vertical_scale:n,u_height_type:rQ[o],u_base_type:rQ[s]}),r3=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x)=>{let v=r1(i,r,a,n,o,s,l,h,c,d,p,f,m,_,g,y,1,[0,0,0]),b={u_height_factor:-Math.pow(2,h.overscaledZ
111)/u.tileSize/8};return Object.assign(v,rJ(r,u,x),b)},r5=(i,r,a)=>({u_matrix:i,u_emissive_strength:r,u_ground_shadow_factor:a}),r4=(i,r,a,n,o,s=0)=>Object.assign(r5(i,r,o),rJ(a,n,s)),r6=(i,r,a,n)=>({u_matrix:i,u_world:a,u_emissive_strength:r,u_ground_shadow_factor:n}),r8=(i,r,a,n,o,s,l=0)=>Object.assign(r4(i,r,a,n,s,l),{u_world:o}),r9=(i,r)=>({u_matrix:i,u_depth_bias:r}),r7=(i,r)=>({u_matrix:i,u_ground_shadow_factor:r}),ae=(i,r,a,n,o)=>({u_matrix:i,u_camera_pos:[r[0],r[1],r[2]],u_depth_bias:a,u_height_scale:n,u_reset_depth:o}),at=(i,r,a)=>({u_image:i,u_opacity:r,u_blend_mode:a}),ai=(i,r,a,n,o,s,l,h,u,c=[0,0,1])=>({u_matrix:i,u_normal_matrix:r,u_opacity:a,u_faux_facade_ao_intensity:n,u_camera_pos:o,u_tile_to_meter:s,u_facade_emissive_chance:l,u_flood_light_color:h,u_flood_light_intensity:u,u_front_cutoff_params:c}),ar=i=>({u_matrix:i}),aa=i=>({u_matrix:i}),an=(r,a,n,o,s,l,h,u)=>{let c=i.an/l.tileSize;return{u_matrix:r,u_inv_rot_matrix:a,u_camera_to_center_distance:n.getCameraToCenterDistance(u),u_extrude_scale:[n.pixelsToGLUnits[0]/c,n.pixelsToGLUnits[1]/c],u_zoom_transition:o,u_tile_id:h,u_merc_center:s}},ao=(i,r,a,n)=>({u_matrix:i,u_inv_matrix:r,u_camera_to_center_distance:a.getCameraToCenterDistance(n),u_viewport_size:[a.width,a.height]}),as=(i,r,a=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:a}),al=i.bc(),ah=(r,a,n,o,s,l,h)=>{let u=r.transform,c="globe"===u.projection.name,d=c?i.dD(u.zoom,a.canonical)*u._pixelsPerMercatorPixel:i.aA(n,1,l),p={u_matrix:a.projMatrix,u_extrude_scale:d,u_intensity:h,u_inv_rot_matrix:al,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){p.u_inv_rot_matrix=o,p.u_merc_center=s,p.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],p.u_zoom_transition=i.al(u.zoom);let r=s[0]*i.an,n=s[1]*i.an;p.u_up_dir=u.projection.upVector(new i.ci(0,0,0),r,n)}return p};function au(i,[r,a,n,o],[s,l]){if(s===l)return[0,0,0,0];let h=255*(i-1)/(i*(l-s));return[r*h,a*h,n*h,o*h]}function ac(i,r,[a,n]){return a===n?0:.5/i+(r-a)*(i-1)/(i*(n-a))}let ad=(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S)=>{var I,E;let A,C,M;return{u_matrix:a,u_normalize_matrix:n,u_globe_matrix:o,u_merc_matrix:s,u_grid_matrix:l,u_tl_parent:h,u_scale_parent:p,u_fade_t:f.mix,u_opacity:f.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:i.dF(m.paint.get("raster-saturation")),u_contrast_factor:i.dE(m.paint.get("raster-contrast")),u_spin_weights:(C=Math.sin(E=m.paint.get("raster-hue-rotate")*(Math.PI/180)),[(2*(M=Math.cos(E))+1)/3,(-Math.sqrt(3)*C-M+1)/3,(Math.sqrt(3)*C-M+1)/3]),u_perspective_transform:_,u_raster_elevation:g,u_zoom_transition:u,u_merc_center:c,u_cutoff_params:d,u_colorization_mix:au(i.dG,x,b),u_colorization_offset:ac(i.dG,v,b),u_color_ramp:y,u_texture_offset:[T/(w+2*T),w/(w+2*T)],u_texture_res:[w+2*T,w+2*T],u_emissive_strength:S,u_zbias_factor:(A=r.terrain?r.terrain.exaggeration():1,(r.transform.pitch<15?.07*(1-(I=i.aC((14-r.transform.zoom)/5,0,1)))+.7*I:.07)*A)}},ap=(i,r,a,n,o,s,l,h,u,c,d,p)=>({u_matrix:i,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:c,u_fade_t:d.mix,u_opacity:d.opacity,u_image0:0,u_image1:1,u_raster_elevation:p,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:u}),af=(i,r,a,n,o,s,l,h,u,c)=>({u_particle_texture:i,u_particle_texture_side_len:r,u_tile_offset:a,u_velocity:n,u_color_ramp:s,u_velocity_res:o,u_max_speed:l,u_uv_offset:h,u_data_scale:[255*u[0],255*u[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),am=(i,r,a,n,o,s,l,h,u,c)=>({u_particle_texture:i,u_particle_texture_side_len:r,u_velocity:a,u_velocity_res:n,u_max_speed:o,u_speed_factor:s,u_reset_rate:l,u_rand_seed:Math.random(),u_uv_offset:h,u_data_scale:[255*u[0],255*u[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),a_=i.bc(),ag=(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E)=>{let A=s.transform,C={u_is_size_zoom_constant:+("constant"===r||"source"===r),u_is_size_feature_constant:+("constant"===r||"camera"===r),u_size_t:a?a.uSizeT:0,u_size:a?a.uSize:0,u_camera_to_center_distance:A.getCameraToCenterDistance(b),u_rotate_symbol:+n,u_aspect_ratio:A.width/A.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:l,u_label_plane_matrix:h,u_coord_matrix:u,u_is_text:+d,u_elevation_from_sea:+!!c,u_pitch_with_map:+o,u_texsize:p,u_texsize_icon:f,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:a_,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:a_,u_up_vector:[0,-1,0],u_color_adj_mat:S,u_icon_transition:I||0,u_gamma_scale:o?s.transform.getCameraToCenterDistance(b)*Math.cos(s.terrain?0:s.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:E||1,u_ground_shadow_factor:w,u_inv_matrix:i.b8(i.bc(),h),u_normal_scale:T,u_lutTexture:10,u_zoom:A.zoom-Math.floor(A.zoom),u_spp_fill_np_color:[0,0,0,1],u_spp_halo_np_color:[0,0,0,0],u_spp_opacity:1,u_spp_halo_width:0,u_spp_halo_blur:0,u_spp_emissive_strength:0,u_spp_occlusion_opacity:1,u_spp_z_offset:0,u_spp_translate_rotation:[1,0]};return"globe"===b.name&&(C.u_tile_id=[_.canonical.x,_.canonical.y,1<<_.canonical.z],C.u_zoom_transition=g,C.u_inv_rot_matrix=x,C.u_merc_center=y,C.u_camera_forward=A._camera.forward(),C.u_ecef_origin=i.dH(A.globeMatrix,_.toUnwrapped()),C.u_tile_matrix=Float32Array.from(A.globeMatrix),C.u_up_vector=v),C},ay=(i,r,a,n)=>({u_matrix:i,u_emissive_strength:r,u_opacity:a,u_color:n}),ax=(r,a,n,o,s,l,h,u,c)=>Object.assign(function(r,a,n,o,s){let{width:l,height:h}=n.imageManager.getPixelSize(r),u=Math.pow(2,s.tileID.overscaledZ
111),c=s.tileSize*Math.pow(2,n.transform.tileZoom)/u,d=c*(s.tileID.canonical.x+s.tileID.wrap*u),p=c*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:a.tl,u_pattern_br:a.br,u_texsize:[l,h],u_pattern_size:a.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/i.aA(s,1,n.transform.tileZoom),1/i.aA(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}}(l,h,o,u,c),{u_matrix:r,u_emissive_strength:a,u_opacity:n}),av=new Float32Array(i.ba([])),ab=(r,a,n,o,s,l,h,u,c,d,p,f,m,_=[0,0,0],g,y,x)=>{let v=s.style.light,b=v.properties.get("position"),w=[-b.x,-b.y,b.z],T=i.dA();"viewport"===v.properties.get("anchor")&&(i.dB(T,-s.transform.angle),i.dC(w,w,T));let S="MASK"===p.alphaMode,I=v.properties.get("color").toNonPremultipliedRenderColor(null),E=m.paint.get("model-ambient-occlusion-intensity"),A=m.paint.get("model-color").constantOr(i.aq.white).toNonPremultipliedRenderColor(null);return A.a=m.paint.get("model-color-mix-intensity").constantOr(0),x&&(A.r=x[0],A.g=x[1],A.b=x[2],A.a=x[3]),y&&(A.r=y.color.r,A.g=y.color.g,A.b=y.color.b,A.a=y.colorMix,f=y.emissionStrength,l*=y.opacity),{u_matrix:r,u_lighting_matrix:a,u_normal_matrix:n,u_node_matrix:o||av,u_lightpos:w,u_lightintensity:v.properties.get("intensity"),u_lightcolor:[I.r,I.g,I.b],u_camera_pos:_,u_opacity:l,u_baseTextureIsAlpha:0,u_alphaMask:+S,u_alphaCutoff:p.alphaCutoff,u_baseColorFactor:h.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:u.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:c,u_roughnessFactor:d,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:A.toArray01(),u_aoIntensity:E,u_emissive_strength:f,u_occlusionTextureTransform:g||[0,0,0,0]}},aw=(i,r=av,a=av)=>({u_matrix:i,u_instance:r,u_node_matrix:a}),aT={fillExtrusion:r=>({u_matrix:new i.c0(r),u_lightpos:new i.bZ(r),u_lightintensity:new i.b_(r),u_lightcolor:new i.bZ(r),u_vertical_gradient:new i.b_(r),u_opacity:new i.b_(r),u_edge_radius:new i.b_(r),u_width_scale:new i.b_(r),u_ao:new i.b$(r),u_height_type:new i.bY(r),u_base_type:new i.bY(r),u_tile_id:new i.bZ(r),u_zoom_transition:new i.b_(r),u_inv_rot_matrix:new i.c0(r),u_merc_center:new i.b$(r),u_up_dir:new i.bZ(r),u_height_lift:new i.b_(r),u_flood_light_color:new i.bZ(r),u_vertical_scale:new i.b_(r),u_flood_light_intensity:new i.b_(r),u_ground_shadow_factor:new i.bZ(r),u_front_cutoff_params:new i.bZ(r)}),fillExtrusionDepth:r=>({u_matrix:new i.c0(r),u_edge_radius:new i.b_(r),u_width_scale:new i.b_(r),u_vertical_scale:new i.b_(r),u_height_type:new i.bY(r),u_base_type:new i.bY(r)}),fillExtrusionPattern:r=>({u_matrix:new i.c0(r),u_lightpos:new i.bZ(r),u_lightintensity:new i.b_(r),u_lightcolor:new i.bZ(r),u_vertical_gradient:new i.b_(r),u_height_factor:new i.b_(r),u_edge_radius:new i.b_(r),u_width_scale:new i.b_(r),u_ao:new i.b$(r),u_height_type:new i.bY(r),u_base_type:new i.bY(r),u_tile_id:new i.bZ(r),u_zoom_transition:new i.b_(r),u_inv_rot_matrix:new i.c0(r),u_merc_center:new i.b$(r),u_up_dir:new i.bZ(r),u_height_lift:new i.b_(r),u_image:new i.bY(r),u_texsize:new i.b$(r),u_pixel_coord_upper:new i.b$(r),u_pixel_coord_lower:new i.b$(r),u_tile_units_to_pixels:new i.b_(r),u_opacity:new i.b_(r),u_pattern_transition:new i.b_(r)}),fillExtrusionGroundEffect:r=>({u_matrix:new i.c0(r),u_opacity:new i.b_(r),u_ao_pass:new i.b_(r),u_meter_to_tile:new i.b_(r),u_ao:new i.b$(r),u_flood_light_intensity:new i.b_(r),u_flood_light_color:new i.bZ(r),u_attenuation:new i.b_(r),u_edge_radius:new i.b_(r),u_fb:new i.bY(r),u_fb_size:new i.b_(r),u_dynamic_offset:new i.b_(r)}),fill:r=>({u_matrix:new i.c0(r),u_emissive_strength:new i.b_(r),u_ground_shadow_factor:new i.bZ(r)}),fillPattern:r=>({u_matrix:new i.c0(r),u_emissive_strength:new i.b_(r),u_image:new i.bY(r),u_texsize:new i.b$(r),u_pixel_coord_upper:new i.b$(r),u_pixel_coord_lower:new i.b$(r),u_tile_units_to_pixels:new i.b_(r),u_ground_shadow_factor:new i.bZ(r),u_pattern_transition:new i.b_(r)}),fillOutline:r=>({u_matrix:new i.c0(r),u_emissive_strength:new i.b_(r),u_world:new i.b$(r),u_ground_shadow_factor:new i.bZ(r)}),fillOutlinePattern:r=>({u_matrix:new i.c0(r),u_emissive_strength:new i.b_(r),u_world:new i.b$(r),u_image:new i.bY(r),u_texsize:new i.b$(r),u_pixel_coord_upper:new i.b$(r),u_pixel_coord_lower:new i.b$(r),u_tile_units_to_pixels:new i.b_(r),u_ground_shadow_factor:new i.bZ(r),u_pattern_transition:new i.b_(r)}),lineBlendComposite:r=>({u_image:new i.bY(r),u_opacity:new i.b_(r),u_blend_mode:new i.bY(r)}),building:r=>({u_matrix:new i.c0(r),u_normal_matrix:new i.c0(r),u_opacity:new i.b_(r),u_faux_facade_ao_intensity:new i.b_(r),u_c
111amera_pos:new i.bZ(r),u_tile_to_meter:new i.b_(r),u_facade_emissive_chance:new i.b_(r),u_flood_light_color:new i.bZ(r),u_flood_light_intensity:new i.b_(r),u_front_cutoff_params:new i.bZ(r)}),buildingBloom:r=>({u_matrix:new i.c0(r)}),buildingDepth:r=>({u_matrix:new i.c0(r)}),elevatedStructuresDepth:r=>({u_matrix:new i.c0(r),u_depth_bias:new i.b_(r)}),elevatedStructures:r=>({u_matrix:new i.c0(r),u_ground_shadow_factor:new i.bZ(r)}),elevatedStructuresDepthReconstruct:r=>({u_matrix:new i.c0(r),u_camera_pos:new i.bZ(r),u_depth_bias:new i.b_(r),u_height_scale:new i.b_(r),u_reset_depth:new i.b_(r)}),circle:i.dK,collisionBox:r=>({u_matrix:new i.c0(r),u_inv_rot_matrix:new i.c0(r),u_camera_to_center_distance:new i.b_(r),u_extrude_scale:new i.b$(r),u_zoom_transition:new i.b_(r),u_merc_center:new i.b$(r),u_tile_id:new i.bZ(r)}),collisionCircle:r=>({u_matrix:new i.c0(r),u_inv_matrix:new i.c0(r),u_camera_to_center_distance:new i.b_(r),u_viewport_size:new i.b$(r)}),debug:r=>({u_color:new i.dh(r),u_matrix:new i.c0(r),u_overlay:new i.bY(r),u_overlay_scale:new i.b_(r)}),clippingMask:r=>({u_matrix:new i.c0(r)}),heatmap:r=>({u_extrude_scale:new i.b_(r),u_intensity:new i.b_(r),u_matrix:new i.c0(r),u_inv_rot_matrix:new i.c0(r),u_merc_center:new i.b$(r),u_tile_id:new i.bZ(r),u_zoom_transition:new i.b_(r),u_up_dir:new i.bZ(r)}),heatmapTexture:r=>({u_image:new i.bY(r),u_color_ramp:new i.bY(r),u_opacity:new i.b_(r)}),hillshade:r=>({u_matrix:new i.c0(r),u_image:new i.bY(r),u_latrange:new i.b$(r),u_light:new i.b$(r),u_shadow:new i.dh(r),u_highlight:new i.dh(r),u_emissive_strength:new i.b_(r),u_accent:new i.dh(r)}),hillshadePrepare:r=>({u_matrix:new i.c0(r),u_image:new i.bY(r),u_dimension:new i.b$(r),u_zoom:new i.b_(r)}),line:i.dJ,linePattern:i.dI,raster:r=>({u_matrix:new i.c0(r),u_normalize_matrix:new i.c0(r),u_globe_matrix:new i.c0(r),u_merc_matrix:new i.c0(r),u_grid_matrix:new i.di(r),u_tl_parent:new i.b$(r),u_scale_parent:new i.b_(r),u_fade_t:new i.b_(r),u_opacity:new i.b_(r),u_image0:new i.bY(r),u_image1:new i.bY(r),u_brightness_low:new i.b_(r),u_brightness_high:new i.b_(r),u_saturation_factor:new i.b_(r),u_contrast_factor:new i.b_(r),u_spin_weights:new i.bZ(r),u_perspective_transform:new i.b$(r),u_raster_elevation:new i.b_(r),u_zoom_transition:new i.b_(r),u_merc_center:new i.b$(r),u_cutoff_params:new i.cK(r),u_colorization_mix:new i.cK(r),u_colorization_offset:new i.b_(r),u_color_ramp:new i.bY(r),u_texture_offset:new i.b$(r),u_texture_res:new i.b$(r),u_emissive_strength:new i.b_(r),u_zbias_factor:new i.b_(r)}),rasterParticle:r=>({u_matrix:new i.c0(r),u_normalize_matrix:new i.c0(r),u_globe_matrix:new i.c0(r),u_merc_matrix:new i.c0(r),u_grid_matrix:new i.di(r),u_tl_parent:new i.b$(r),u_scale_parent:new i.b_(r),u_fade_t:new i.b_(r),u_opacity:new i.b_(r),u_image0:new i.bY(r),u_image1:new i.bY(r),u_raster_elevation:new i.b_(r),u_zoom_transition:new i.b_(r),u_merc_center:new i.b$(r),u_cutoff_params:new i.cK(r)}),rasterParticleTexture:r=>({u_texture:new i.bY(r),u_opacity:new i.b_(r)}),rasterParticleDraw:r=>({u_particle_texture:new i.bY(r),u_particle_texture_side_len:new i.b_(r),u_tile_offset:new i.b$(r),u_velocity:new i.bY(r),u_color_ramp:new i.bY(r),u_velocity_res:new i.b$(r),u_max_speed:new i.b_(r),u_uv_offset:new i.b$(r),u_data_scale:new i.b$(r),u_data_offset:new i.b_(r),u_particle_pos_scale:new i.b_(r),u_particle_pos_offset:new i.b$(r)}),rasterParticleUpdate:r=>({u_particle_texture:new i.bY(r),u_particle_texture_side_len:new i.b_(r),u_velocity:new i.bY(r),u_velocity_res:new i.b$(r),u_max_speed:new i.b_(r),u_speed_factor:new i.b_(r),u_reset_rate:new i.b_(r),u_rand_seed:new i.b_(r),u_uv_offset:new i.b$(r),u_data_scale:new i.b$(r),u_data_offset:new i.b_(r),u_particle_pos_scale:new i.b_(r),u_particle_pos_offset:new i.b$(r)}),symbol:r=>({u_is_size_zoom_constant:new i.bY(r),u_is_size_feature_constant:new i.bY(r),u_size_t:new i.b_(r),u_size:new i.b_(r),u_camera_to_center_distance:new i.b_(r),u_rotate_symbol:new i.bY(r),u_aspect_ratio:new i.b_(r),u_fade_change:new i.b_(r),u_matrix:new i.c0(r),u_label_plane_matrix:new i.c0(r),u_coord_matrix:new i.c0(r),u_is_text:new i.bY(r),u_elevation_from_sea:new i.bY(r),u_pitch_with_map:new i.bY(r),u_texsize:new i.b$(r),u_texsize_icon:new i.b$(r),u_texture:new i.bY(r),u_texture_icon:new i.bY(r),u_gamma_scale:new i.b_(r),u_device_pixel_ratio:new i.b_(r),u_tile_id:new i.bZ(r),u_zoom_transition:new i.b_(r),u_inv_rot_matrix:new i.c0(r),u_merc_center:new i.b$(r),u_camera_forward:new i.bZ(r),u_tile_matrix:new i.c0(r),u_up_vector:new i.bZ(r),u_ecef_origin:new i.bZ(r),u_is_halo:new i.bY(r),u_icon_transition:new i.b_(r),u_color_adj_mat:new i.c0(r),u_scale_factor:new i.b_(r),u_ground_shadow_factor:new i.bZ(r),u_inv_matrix:new i.c0(r),u_normal_scale:new i.b_(r),u_lutTexture:new i.bY(r),u_zoom:new i.b_(r),u_spp_fill_np_color:new i.cK(r),u_spp_halo_np_color:new i.cK(r),u_spp_opacity:new i.b_(r),u_spp_halo_width:new i.b_(r),u_spp_halo_blur:new i.b_(r),u_spp_emissive_strength:new i.b_(r),u_spp_occlusion_opacity:new i.b_(r),u_spp_z_offset:new i.b_(r),u_spp_translate_rotation:new i.b$(r)}),background:r=>({u_matrix:new i.c0(r),u_emissive_strength:new i.b_(r),u_opacity:new i.b_(r),u_color:new i.dh(r)}),backgroundPattern:r=>({u_matrix:new i.c0(r),u_emissive_strength:new i.b_(r),u_opacity:new i.b_(r),u_image:new i.bY(r),u_pattern_tl:new i.b$(r),u_pattern_br:new i.b$(r),u_texsize:new i.b$(r),u_pattern_size:new i.b$(r),u_pixel_coord_upper:new i.b$(r),u_pixel_coord_lower:new i.b$(r),u_pattern_units_to_pixels:new i.b$(r)}),terrainRaster:r=>({u_matrix:new i.c0(r),u_image0:new i.bY(r),u_image1:new i.bY(r),u_skirt_height:new i.b_(r),u_ground_shadow_factor:new i.bZ(r),u_emissive_texture_available:new i.b_(r)}),skybox:r=>({u_matrix:new i.c0(r),u_sun_direction:new i.bZ(r),u_cubemap:new i.bY(r),u_opacity:new i.b_(r),u_temporal_offset:new i.b_(r)}),skyboxGradient:r=>({u_matrix:new i.c0(r),u_color_ramp:new i.bY(r),u_center_direction:new i.bZ(r),u_radius:new i.b_(r),u_opacity:new i.b_(r),u_temporal_offset:new i.b_(r)}),skyboxCapture:r=>({u_matrix_3f:new i.di(r),u_sun_direction:new i.bZ(r),u_sun_intensity:new i.b_(r),u_color_tint_r:new i.cK(r),u_color_tint_m:new i.cK(r),u_luminance:new i.b_(r)}),globeRaster:r=>({u_proj_matrix:new i.c0(r),u_globe_matrix:new i.c0(r),u_normalize_matrix:new i.c0(r),u_merc_matrix:new i.c0(r),u_zoom_transition:new i.b_(r),u_merc_center:new i.b$(r),u_image0:new i.bY(r),u_image1:new i.bY(r),u_grid_matrix:new i.di(r),u_skirt_height:new i.b_(r),u_far_z_cutoff:new i.b_(r),u_frustum_tl:new i.bZ(r),u_frustum_tr:new i.bZ(r),u_frustum_br:new i.bZ(r),u_frustum_bl:new i.bZ(r),u_globe_pos:new i.bZ(r),u_globe_radius:new i.b_(r),u_viewport:new i.b$(r),u_emissive_texture_available:new i.b_(r)}),globeAtmosphere:r=>({u_frustum_tl:new i.bZ(r),u_frustum_tr:new i.bZ(r),u_frustum_br:new i.bZ(r),u_frustum_bl:new i.bZ(r),u_horizon:new i.b_(r),u_transition:new i.b_(r),u_fadeout_range:new i.b_(r),u_atmosphere_fog_color:new i.cK(r),u_high_color:new i.cK(r),u_space_color:new i.cK(r),u_temporal_offset:new i.b_(r),u_horizon_angle:new i.b_(r)}),model:r=>({u_matrix:new i.c0(r),u_lighting_matrix:new i.c0(r),u_normal_matrix:new i.c0(r),u_node_matrix:new i.c0(r),u_lightpos:new i.bZ(r),u_lightintensity:new i.b_(r),u_lightcolor:new i.bZ(r),u_camera_pos:new i.bZ(r),u_opacity:new i.b_(r),u_baseColorFactor:new i.cK(r),u_emissiveFactor:new i.cK(r),u_metallicFactor:new i.b_(r),u_roughnessFactor:new i.b_(r),u_baseTextureIsAlpha:new i.bY(r),u_alphaMask:new i.bY(r),u_alphaCutoff:new i.b_(r),u_baseColorTexture:new i.bY(r),u_metallicRoughnessTexture:new i.bY(r),u_normalTexture:new i.bY(r),u_occlusionTexture:new i.bY(r),u_emissionTexture:new i.bY(r),u_lutTexture:new i.bY(r),u_color_mix:new i.cK(r),u_aoIntensity:new i.b_(r),u_emissive_strength:new i.b_(r),u_occlusionTextureTransform:new i.cK(r)}),modelDepth:r=>({u_matrix:new i.c0(r),u_instance:new i.c0(r),u_node_matrix:new i.c0(r)}),groundShadow:r=>({u_matrix:new i.c0(r),u_ground_shadow_factor:new i.bZ(r)}),stars:r=>({u_matrix:new i.c0(r),u_up:new i.bZ(r),u_right:new i.bZ(r),u_intensity_multiplier:new i.b_(r)}),snowParticle:r=>({u_modelview:new i.c0(r),u_projection:new i.c0(r),u_time:new i.b_(r),u_c
111am_pos:new i.bZ(r),u_velocityConeAperture:new i.b_(r),u_velocity:new i.b_(r),u_horizontalOscillationRadius:new i.b_(r),u_horizontalOscillationRate:new i.b_(r),u_boxSize:new i.b_(r),u_billboardSize:new i.b_(r),u_simpleShapeParameters:new i.b$(r),u_screenSize:new i.b$(r),u_thinningCenterPos:new i.b$(r),u_thinningShape:new i.bZ(r),u_thinningAffectedRatio:new i.b_(r),u_thinningParticleOffset:new i.b_(r),u_particleColor:new i.cK(r),u_direction:new i.bZ(r)}),rainParticle:r=>({u_modelview:new i.c0(r),u_projection:new i.c0(r),u_time:new i.b_(r),u_cam_pos:new i.bZ(r),u_texScreen:new i.bY(r),u_velocityConeAperture:new i.b_(r),u_velocity:new i.b_(r),u_boxSize:new i.b_(r),u_rainDropletSize:new i.b$(r),u_distortionStrength:new i.b_(r),u_rainDirection:new i.bZ(r),u_color:new i.cK(r),u_screenSize:new i.b$(r),u_thinningCenterPos:new i.b$(r),u_thinningShape:new i.bZ(r),u_thinningAffectedRatio:new i.b_(r),u_thinningParticleOffset:new i.b_(r),u_shapeDirectionalPower:new i.b_(r),u_shapeNormalPower:new i.b_(r),u_mode:new i.b_(r)}),vignette:r=>({u_vignetteShape:new i.bZ(r),u_vignetteColor:new i.cK(r)}),occlusion:r=>({u_matrix:new i.c0(r),u_anchorPos:new i.bZ(r),u_screenSizePx:new i.b$(r),u_occluderSizePx:new i.b$(r),u_color:new i.cK(r)})};class aS{constructor(i,r,a,n){this.id=aS.uniqueIdxCounter,aS.uniqueIdxCounter++,this.context=i;const o=i.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||n||r.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){this.id=aS.uniqueIdxCounter,aS.uniqueIdxCounter++;let r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}aS.uniqueIdxCounter=0;let aI={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class aE{constructor(i,r,a,n,o,s){this.length=r.length,this.attributes=a,this.itemSize=r.bytesPerElement,this.dynamicDraw=n,this.instanceCount=s,this.context=i;const l=i.gl;this.buffer=l.createBuffer(),i.bindVertexBuffer.set(this.buffer),l.bufferData(l.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||o||r.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,r){for(let a of this.attributes){let n=r.getAttributeLocation(i,a.name);-1!==n&&i.enableVertexAttribArray(n)}}setVertexAttribPointers(i,r,a){for(let n of this.attributes){let o=r.getAttributeLocation(i,n.name);if(-1!==o){let r=n.offset+this.itemSize*(a||0);"Float32"===n.type?i.vertexAttribPointer(o,n.components,i.FLOAT,!1,this.itemSize,r):i.vertexAttribIPointer(o,n.components,i[aI[n.type]],this.itemSize,r)}}}setVertexAttribDivisor(i,r,a){for(let n=0;n<this.attributes.length;n++){let o=r.getAttributeLocation(i,this.attributes[n].name);-1!==o&&this.instanceCount&&this.instanceCount>0&&i.vertexAttribDivisor(o,a)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class aA{constructor(i,r,a,n,o){this.context=i,this.width=r,this.height=a;const s=this.framebuffer=i.gl.createFramebuffer();n>0&&(this.colorAttachment0=new rR(i,s,0)),n>1&&(this.colorAttachment1=new rR(i,s,1)),o&&(this.depthAttachmentType=o,this.depthAttachment="renderbuffer"===o?new rL(i,s):new rz(i,s))}static createWithTexture(r,a,n,o,s){let l=r.gl;if(r.activeTexture.set(l.TEXTURE1),r.viewport.set([0,0,n,o]),a&&a.width===n&&a.height===o)return l.bindTexture(l.TEXTURE_2D,a.colorAttachment0.get()),r.bindFramebuffer.set(a.framebuffer),a;a&&a.destroy();let h=new i.T(r,{width:n,height:o,data:null},r.extRenderToTextureHalfFloat?r.gl.RGBA16F:r.gl.RGBA8);h.bind(l.LINEAR,l.CLAMP_TO_EDGE);let u=r.createFramebuffer(n,o,1,null);if(u.colorAttachment0.set(h.texture),s){let i=r.createRenderbuffer(l.DEPTH24_STENCIL8,n,o);r.bindFramebuffer.set(u.framebuffer),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,i),u._stencilRbo=i}return u}createColorAttachment(i,r){0===r?this.colorAttachment0=new rR(i,this.framebuffer,0):1===r&&(this.colorAttachment1=new rR(i,this.framebuffer,1))}
111removeColorAttachment(i,r){let a,n=this.context.gl;0===r?(a=this.colorAttachment0.get(),this.colorAttachment0=void 0):1===r&&(a=this.colorAttachment1.get(),this.colorAttachment1=void 0),a&&n.deleteTexture(a)}destroy(){let i=this.context.gl;if(this.colorAttachment0){let r=this.colorAttachment0.get();r&&i.deleteTexture(r)}if(this.colorAttachment1){let r=this.colorAttachment1.get();r&&i.deleteTexture(r)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){let r=this.depthAttachment.get();r&&i.deleteRenderbuffer(r)}else{let r=this.depthAttachment.get();r&&i.deleteTexture(r)}this._stencilRbo&&(i.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),i.deleteFramebuffer(this.framebuffer)}}class aC{constructor(i,r){this.gl=i,this.clearColor=new re(this),this.clearDepth=new rt(this),this.clearStencil=new ri(this),this.colorMask=new rr(this),this.depthMask=new ra(this),this.stencilMask=new rn(this),this.stencilFunc=new ro(this),this.stencilOp=new rs(this),this.stencilTest=new rl(this),this.depthRange=new rh(this),this.depthTest=new ru(this),this.depthFunc=new rc(this),this.blend=new rd(this),this.blendFunc=new rp(this),this.blendColor=new rf(this),this.blendEquation=new rm(this),this.cullFace=new r_(this),this.cullFaceSide=new rg(this),this.frontFace=new ry(this),this.program=new rx(this),this.activeTexture=new rv(this),this.viewport=new rb(this),this.bindFramebuffer=new rw(this),this.bindRenderbuffer=new rT(this),this.bindTexture=new rS(this),this.bindVertexBuffer=new rI(this),this.bindElementBuffer=new rE(this),this.bindVertexArrayOES=new rA(this),this.pixelStoreUnpack=new rC(this),this.pixelStoreUnpackPremultiplyAlpha=new rM(this),this.pixelStoreUnpackFlipY=new rP(this),this.options=r?Object.assign({},r):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=i.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=i.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=i.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=r&&!!r.forceManualRenderingForInstanceIDShaders||this.renderer&&-1!==this.renderer.indexOf("PowerVR"),this.disableSymbolUBO=r&&!!r.forceDisableSymbolUBO||this.renderer&&-1!==this.renderer.indexOf("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=i.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),this.maxUniformBlockSize=i.getParameter(i.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBufferBindings=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS),this.extBlendFuncExtended=i.getExtension("WEBGL_blend_func_extended")}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(i,r,a){return new aS(this,i,r,a)}createVertexBuffer(i,r,a,n,o){return new aE(this,i,r,a,n,o)}createRenderbuffer(i,r,a){let n=this.gl,o=n.createRenderbuffer();return this.bindRenderbuffer.set(o),n.renderbufferStorage(n.RENDERBUFFER,i,r,a),this.bindRenderbuffer.set(null),o}createFramebuffer(i,r,a,n){return new aA(this,i,r,a,n)}clear({color:i,depth:r,stencil:a,colorMask:n}){let o=this.gl,s=0;i&&(s|=o.COLOR_BUFFER_BIT,this.clearColor.set(i.toNonPremultipliedRenderColor(null)),this.colorMask.set(n||[!0,!0,!0,!0])),void 0!==r&&(s|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),void 0!==a&&(s|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),o.clear(s)}setCullFace(i){!1===i.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass
111]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(r){i.b7(r.blendFunction,it.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}function aM(r,a,n,o,s,h,u){let c=r.context,d=c.gl,p=r.transform,f=[i.aH(p.center.lng),i.aL(p.center.lat)],m=n.layout.get("symbol-placement"),_=n.layout.get("text-variable-anchor"),g="map"===n.layout.get("icon-rotation-alignment"),y="map"===n.layout.get("text-rotation-alignment"),x="point"!==m,v=[],b=0,w=0;for(let l=0;l<o.length;l++){let c=o[l],m=a.getTile(c),T=m.getBucket(n);if(!T)continue;let S=T.getProjection().createInversionMatrix(p,c.canonical),I=[],E=function(i,r,a){if(r.projection.name===a.projection.name)return i.projMatrix;let n=a.clone();return n.setProjection(r.projection),tE(n,r.getProjection(),i)}(c,T,p),A=!u&&g&&x,C=u&&y&&x,M=_&&T.hasTextData(),P=T.hasIconTextFit()&&M&&T.hasIconData(),D=A||C||u&&M||P,R="globe"===T.projection.name,L=R?i.al(p.zoom):0;R&&(I.push("PROJECTION_GLOBE_VIEW"),D&&I.push("PROJECTED_POS_ON_VIEWPORT"));let z=r.getOrCreateProgram("collisionBox",{defines:I}),F=E;0===s[0]&&0===s[1]||(F=r.translatePosMatrix(E,m,s,h));let O=u?T.textCollisionBox:T.iconCollisionBox,B=T.collisionCircleArray;if(B.length>0){let r=i.bc(),a=F;i.cu(r,T.placementInvProjMatrix,p.glCoordMatrix),i.cu(r,r,T.placementViewportMatrix),v.push({circleArray:B,circleOffset:w,transform:a,invTransform:r,projection:T.getProjection()}),b+=B.length/4,w=b}if(!O)continue;r.terrain&&r.terrain.setupElevationDraw(m,z);let k=R?[c.canonical.x,c.canonical.y,1<<c.canonical.z]:[0,0,0];z.draw(r,d.LINES,ii.disabled,ir.disabled,r.colorModeForRenderPass(),ia.disabled,an(F,S,p,L,f,m,k,T.getProjection()),n.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,null,p.zoom,null,[O.collisionVertexBuffer,O.collisionVertexBufferExt])}if(!u||!v.length)return;let T=r.getOrCreateProgram("collisionCircle"),S=new i.dL;S.resize(4*b),S._trim();let I=0;for(let i of v)for(let r=0;r<i.circleArray.length/4;r++){let a=4*r,n=i.circleArray[a+0],o=i.circleArray[a+1],s=i.circleArray[a+2],l=i.circleArray[a+3];S.emplace(I++,n,o,s,l,0),S.emplace(I++,n,o,s,l,1),S.emplace(I++,n,o,s,l,2),S.emplace(I++,n,o,s,l,3)}(!l||l.length<2*b)&&(l=function(r){let a=2*r,n=new i.dy;n.resize(a),n._trim();for(let i=0;i<a;i++){let r=6*i;n.uint16[r+0]=4*i+0,n.uint16[r+1]=4*i+1,n.uint16[r+2]=4*i+2,n.uint16[r+3]=4*i+2,n.uint16[r+4]=4*i+3,n.uint16[r+5]=4*i+0}return n}(b));let E=c.createIndexBuffer(l,!0),A=c.createVertexBuffer(S,i.dM.members,!0);for(let a of v){let o=ao(a.transform,a.invTransform,p,a.projection);T.draw(r,d.TRIANGLES,ii.disabled,ir.disabled,r.colorModeForRenderPass(),ia.disabled,o,n.id,A,E,i.du.simpleSegment(0,2*a.circleOffset,a.circleArray.length,a.circleArray.length/2),null,p.zoom)}A.destroy(),E.destroy()}let aP=i.bc();function aD(r){let a=r._camera.getWorldToCamera(r.worldSize,1),n=i.aD([],a,r.globeMatrix);i.b8(n,n);let o=[0,0,0],s=[0,1,0,0];return i.aE(s,s,n),o[0]=s[0],o[1]=s[1],o[2]=s[2],i.ay(o,o),o}function aR(r,a,n,o,s,l,h={}){let u=n.paint.get("icon-translate"),c=n.paint.get("text-translate"),d=n.paint.get("icon-translate-anchor"),p=n.paint.get("text-translate-anchor"),f=n.layout.get("icon-rotation-alignment"),m=n.layout.get("text-rotation-alignment"),_=n.layout.get("icon-pitch-alignment"),g=n.layout.get("text-pitch-alignment"),y=n.layout.get("icon-keep-upright"),x=n.layout.get("text-keep-upright"),v=n.paint.get("icon-color-saturation"),b=n.paint.get("icon-color-contrast"),w=n.paint.get("icon-color-brightness-min"),T=n.paint.get("icon-color-brightness-max"),S="sea"===n.layout.get("symbol-elevation-reference"),I="none"===n.layout.get("icon-image-use-theme"),E=r.context,A=E.gl,C=r.transform,M="map"===f,P="map"===m,D="map"===_,R="map"===g,L=void 0!==n.layout.get("symbol-sort-key").constantOr(1),z=!1,F=r.depthModeForSublayer(0,ii.ReadOnly),O=new ii(r.context.gl.LEQUAL,ii.ReadOnly,r.depthRangeFor3D),B=[i.aH(C.center.lng),i.aL(C.center.lat)],k=n.layout.get("text-variable-anchor"),V="globe"===C.projection.name,N=[],U=[0,-1,0];for(let s of o){let o=a.getTile(s),l=o.getBucket(n);if(!l||"mercator"===l.projection.name&&V||l.fullyClipped)continue;let f="globe"===l.projection.name,m=f?i.al(C.zoom):0,_=tA(s,l.getProjection(),C),g=C.calculatePixelsToTileUnitsMatrix(o),j=k&&l.hasTextData(),G=l.hasIconTextFit()&&j&&l.hasIconData(),q=l.getProjection().createInversionMatrix(C,s.canonical),$=(1<<o.tileID.canonical.z)*i.an/r.transform.worldSize,H=i=>{let a=[0,0,0];if(i){let i=r.style.directionalLight,n=r.style.ambientLight;i&&n&&(a=ib(r.style,i,n))}return a},Z=i=>{if(r.context.disableSymbolUBO)return;i.push("USE_PAINT_PROPERTIES_UBO");let a=Math.floor(Math.floor(r.context.maxUniformBlockSize/4)/4);i.push(`MAX_UBO_SIZE_VEC4 ${a}u`)},W=i=>{C.depthOcclusionForSymbolsAndCircles&&(n.hasOcclusionOpacityProperties||r.terrain)&&(i.push("DEPTH_D24"),i.push("DEPTH_OCCLUSION"))},X=a=>{n.lut&&!I&&(n.lut.texture||(n.lut.texture=new i.dN(r.context,n.lut.image,[n.lut.image.height,n.lut.image.height,n.lut.image.height],E.gl.RGBA8)),E.activeTexture.set(E.gl.TEXTURE0+10),n.lut.texture&&n.lut.texture.bind(E.gl.LINEAR,E.gl.CLAMP_TO_EDGE),a.push("APPLY_LUT_ON_GPU"))},Y=()=>{let a=M&&"point"!==n.layout.get("symbol-placement"),h=[];W(h),X(h);let c=a||G,p="road"===l.elevationType,x=r.shadowRenderer,I=p&&D&&!!x&&x.enabled,P=H(I),R=p&&D&&!r.terrain?O:F,L=n.paint.get("icon-image-cross-fade");r.terrainRenderModeElevated()&&D&&h.push("PITCH_WITH_MAP_TERRAIN"),f&&(h.push("PROJECTION_GLOBE_VIEW"),c&&h.push("PROJECTED_POS_ON_VIEWPORT")),L>0&&l.hasAnySecondaryIcon&&h.push("ICON_TRANSITION"),!l.icon.zOffsetVertexBuffer||p&&r.terrain||h.push("Z_OFFSET"),0===v&&0===b&&0===w&&1===T||h.push("COLOR_ADJUSTMENT"),l.sdfIcons&&h.push("RENDER_SDF"),I&&h.push("RENDER_SHADOWS","NORMAL_OFFSET"),p&&D&&!r.terrain&&l.icon.orientationVertexBuffer&&h.push("ELEVATED_ROADS"),Z(h);let z=E.disableSymbolUBO?l.icon.programConfigurations.get(n.id):null,k=r.getOrCreateProgram("symbol",{c
111onfig:z,defines:h}),N=o.imageAtlasTexture?o.imageAtlasTexture.size:[0,0],j=l.iconSizeData,Y=i.bk(j,C.zoom),K=D||!C.isOrthographic,J=tD(_,o.tileID.canonical,D,M,C,l.getProjection(),g),Q=tL(_,o.tileID.canonical,D,M,C,l.getProjection(),g),ee=l.icon.uboBinder&&l.icon.uboBinder.cachedHeader&&256&l.icon.uboBinder.cachedHeader.dataDrivenMask?[0,0]:u,et=r.translatePosMatrix(Q,o,ee,d,!0),ei=r.translatePosMatrix(_,o,ee,d),er=c?aP:J,ea=M&&!D&&!a,en=U;(V||C.mercatorFromTransition)&&!M&&(en=aD(C));let eo=f?en:U,es=n.getColorAdjustmentMatrix(v,b,w,T),el=ag(j.kind,Y,ea,D,r,ei,er,et,S,!1,N,[0,0],0,s,m,B,q,eo,l.getProjection(),P,$,es,L,null),eh=o.imageAtlasTexture?o.imageAtlasTexture:null,eu=1!==n.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear,ec=l.sdfIcons||r.options.rotating||r.options.zooming||eu||K?A.LINEAR:A.NEAREST,ed=l.sdfIcons&&0!==n.paint.get("icon-halo-width").constantOr(1),ep=r.terrain&&D&&a?i.b8(i.bc(),J):aP;if(a&&l.icon){let a=i.bv.getAtTileOffsetFunc(s,C.center.lat,C.worldSize,l.getProjection()),h=tR(_,o.tileID.canonical,D,M,C,l.getProjection(),g),u=n.layout.get("icon-size-scale-range"),c=i.aC(r.scaleFactor,u[0],u[1]);tO(l,_,r,!1,h,Q,D,y,a,s,c)}return{program:k,buffers:l.icon,uniformValues:el,atlasTexture:eh,atlasTextureIcon:null,atlasInterpolation:ec,atlasInterpolationIcon:null,isSDF:l.sdfIcons,hasHalo:ed,depthMode:R,tile:o,renderWithShadows:I,labelPlaneMatrixInv:ep}},K=()=>{let a=P&&"point"!==n.layout.get("symbol-placement"),h=[],u=a||k||G,d="road"===l.elevationType,y=r.shadowRenderer,v=d&&R&&!!y&&y.enabled,b=H(v),w=d&&R&&!r.terrain?O:F;r.terrainRenderModeElevated()&&R&&h.push("PITCH_WITH_MAP_TERRAIN"),f&&(h.push("PROJECTION_GLOBE_VIEW"),u&&h.push("PROJECTED_POS_ON_VIEWPORT")),!l.text.zOffsetVertexBuffer||d&&r.terrain||h.push("Z_OFFSET"),l.iconsInText&&h.push("RENDER_TEXT_AND_SYMBOL"),h.push("RENDER_SDF"),v&&h.push("RENDER_SHADOWS","NORMAL_OFFSET"),d&&R&&!r.terrain&&l.text.orientationVertexBuffer&&h.push("ELEVATED_ROADS"),W(h),Z(h);let T=E.disableSymbolUBO?l.text.programConfigurations.get(n.id):null,I=r.getOrCreateProgram("symbol",{config:T,defines:h}),M,D=[0,0],L=null,z=l.textSizeData;l.iconsInText&&(D=o.imageAtlasTexture?o.imageAtlasTexture.size:[0,0],L=o.imageAtlasTexture?o.imageAtlasTexture:null,M=R||!C.isOrthographic||r.options.rotating||r.options.zooming||"composite"===z.kind||"camera"===z.kind?A.LINEAR:A.NEAREST);let N=o.glyphAtlasTexture?o.glyphAtlasTexture.size:[0,0],j=n.layout.get("text-size-scale-range"),X=i.aC(r.scaleFactor,j[0],j[1]),Y=i.bk(z,C.zoom,X),K=tD(_,o.tileID.canonical,R,P,C,l.getProjection(),g),J=tL(_,o.tileID.canonical,R,P,C,l.getProjection(),g),Q=l.text.uboBinder&&l.text.uboBinder.cachedHeader&&256&l.text.uboBinder.cachedHeader.dataDrivenMask?[0,0]:c,ee=r.translatePosMatrix(J,o,Q,p,!0),et=r.translatePosMatrix(_,o,Q,p),ei=u?aP:K,er=P&&!R&&!a,ea=U;(V||C.mercatorFromTransition)&&!P&&(ea=aD(C));let en=ag(z.kind,Y,er,R,r,et,ei,ee,S,!0,N,D,0,s,m,B,q,f?ea:U,l.getProjection(),b,$,null,null,X),eo=o.glyphAtlasTexture?o.glyphAtlasTexture:null,es=A.LINEAR,el=0!==n.paint.get("text-halo-width").constantOr(1),eh=r.terrain&&R&&a?i.b8(i.bc(),K):aP;if(a&&l.text){let a=i.bv.getAtTileOffsetFunc(s,C.center.lat,C.worldSize,l.getProjection()),n=tR(_,o.tileID.canonical,R,P,C,l.getProjection(),g);tO(l,_,r,!0,n,J,R,x,a,s,X)}return{program:I,buffers:l.text,uniformValues:en,atlasTexture:eo,atlasTextureIcon:L,atlasInterpolation:es,atlasInterpolationIcon:M,isSDF:!0,hasHalo:el,depthMode:w,tile:o,renderWithShadows:v,labelPlaneMatrixInv:eh}},J=l.icon.segments.get().length,Q=l.text.segments.get().length,ee=J&&!h.onlyText?Y():null,et=Q&&!h.onlyIcons?K():null,ei=n.paint.get("icon-opacity").constantOr(1),er=n.paint.get("text-opacity").constantOr(1);if(L&&l.canOverlap){z=!0;let r=ei&&!h.onlyText?l.icon.segments.get():[],a=er&&!h.onlyIcons?l.text.segments.get():[];for(let a of r)N.push({segments:new i.du([a]),sortKey:a.sortKey,state:ee});for(let r of a)N.push({segments:new i.du([r]),sortKey:r.sortKey,state:et})}else h.onlyText||N.push({segments:ei?l.icon.segments:new i.du([]),sortKey:0,state:ee}),h.onlyIcons||N.push({segments:er?l.text.segments:new i.du([]),sortKey:0,state:et})}for(let i of(z&&N.sort((i,r)=>i.sortKey-r.sortKey),N)){let a=i.state;if(a)if(r.terrain?r.terrain.setupElevationDraw(a.tile,a.program,{useDepthForOcclusion:C.depthOcclusionForSymbolsAndCircles,labelPlaneMatr
111ixInv:a.labelPlaneMatrixInv}):r.setupDepthForOcclusion(C.depthOcclusionForSymbolsAndCircles,a.program),E.activeTexture.set(A.TEXTURE0),a.atlasTexture&&a.atlasTexture.bind(a.atlasInterpolation,A.CLAMP_TO_EDGE,!0),a.atlasTextureIcon&&(E.activeTexture.set(A.TEXTURE1),a.atlasTextureIcon&&a.atlasTextureIcon.bind(a.atlasInterpolationIcon,A.CLAMP_TO_EDGE,!0)),a.renderWithShadows&&r.shadowRenderer.setupShadows(a.tile.tileID.toUnwrapped(),a.program,"vector-tile"),r.uploadCommonLightUniforms(r.context,a.program),a.hasHalo){let o=a.uniformValues;o.u_is_halo=1,aL(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,o,2),o.u_is_halo=0}else{if(a.isSDF){let o=a.uniformValues;a.hasHalo&&(o.u_is_halo=1,aL(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,o,1)),o.u_is_halo=0}aL(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,a.uniformValues,1)}}}function aL(i,r,a,n,o,s,l,h,u,c){let d=n.context,p=d.gl,f=[i.dynamicLayoutVertexBuffer,i.opacityVertexBuffer,i.iconTransitioningVertexBuffer,i.globeExtVertexBuffer,i.zOffsetVertexBuffer,i.orientationVertexBuffer];i.featureIdBuffer&&f.push(i.featureIdBuffer);let m=i.uboBinder?null:i.programConfigurations.get(a.id);if(i.uboBinder){i.uboBinder.layer=a;let r=n.transform.zoom,o=n.style.getBrightness?n.style.getBrightness():null,s=i.uboBinder.getConstantUniformValues(r,o);u.u_spp_fill_np_color=s.fill_np_color,u.u_spp_halo_np_color=s.halo_np_color,u.u_spp_opacity=s.opacity,u.u_spp_halo_width=s.halo_width,u.u_spp_halo_blur=s.halo_blur,u.u_spp_emissive_strength=s.emissive_strength,u.u_spp_occlusion_opacity=s.occlusion_opacity,u.u_spp_z_offset=s.z_offset;let l=a.paint.get(i.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),h=i.uboBinder.cachedHeader&&256&i.uboBinder.cachedHeader.dataDrivenMask&&"map"===l?n.transform.angle:0;u.u_spp_translate_rotation=[Math.cos(h),Math.sin(h)]}let{batchIndices:_,batchSegments:g}=i.getBatchGrouping(r);for(let r of _){let _=g.get(r);i.uboBinder&&i.uboBinder.bind(d,o.program,r),o.draw(n,p.TRIANGLES,s,l,h,ia.disabled,u,a.id,i.layoutVertexBuffer,i.indexBuffer,_,a.paint,n.transform.zoom,m,f,c)}}function az(r,a,n,o,s,l){let h,u=n.paint.get("line-width"),c=n.paint.get("line-emissive-strength").isConstant(),d=n.paint.get("line-emissive-strength").constantOr(0),p=n.paint.get("line-occlusion-opacity"),f=n.layout.get("line-elevation-reference"),m="meters"===n.layout.get("line-width-unit"),_=!(!r.terrain||!r.terrain.enabled),g=r.context,y=g.gl;if(n.hasElevatedBuckets&&"globe"===r.transform.projection.name)return;let x=n.layout.get("line-cross-slope"),v=s||r.colorModeForDrapableLayerRenderPass(c?d:null),b=r.terrain&&r.terrain.renderingToTexture||l,w=b?1:i.o.devicePixelRatio,T=n.paint.get("line-dasharray"),S=T.constantOr(1),I=n.layout.get("line-cap"),E=T.constantOr(null),A=I.constantOr(null),C=n.paint.get("line-pattern"),M=C.constantOr(1),P=n.paint.get("line-pattern-cross-fade"),D=C.constantOr(null),R=n.paint.get("line-opacity").constantOr(1),L=!M&&1!==R||r.depthOcclusion&&p>0&&p<1,z=n.paint.get("line-gradient"),F=M?"linePattern":"line",O=i.dQ(n);if(b&&r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(L=!1),0!==p&&r.depthOcclusion){let r=n.paint._values["line-opacity"];r&&r.value&&"constant"===r.value.kind?h=r.value:i.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==u.value.kind&&!1===u.value.isLineProgressConstant&&O.push("VARIABLE_LINE_WIDTH"),b&&("dual-source-blending"!==r.emissiveMode||c?"mrt-fallback"===r.emissiveMode&&O.push("USE_MRT1"):O.push("DUAL_SOURCE_BLENDING"));let B={},k=(o,s,l,u,c,d)=>{for(let f of o){let o,_=a.getTile(f);if(M&&!_.patternsLoaded())continue;let x=_.getBucket(n);if(!x||"none"!==x.elevationType&&!c||"none"===x.elevationType&&c)continue;r.prepareDrawTile();let T=[...s],I=r.shadowRenderer,C="road"===x.elevationType&&!!I&&I.enabled,O=[0,0,0];if(C){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(O=ib(r.style,i,a)),T.push("RENDER_SHADOWS","NORMAL_OFFSET")}let k=x.programConfigurations.get(n.id),V=!1;if(D&&_.imageAtlas){let r=i.dR.from(D),a=r.getPrimary().scaleSelf(w).toString(),n=_.imageAtlas.patternPositions.get(a),o=r.getSecondary(),s=o?_.imageAtlas.patternPositions.get(o.scaleSelf(w).toString()):null;V=!!n&&!!s,n&&k.setConstantPatternPositions(n,s)}P>0&&(V||k.getPatternTransitionVertexBuffer("line-pattern"))&&T.push("LINE_PATTERN_TRANSITION"),x.elevationGroundScaleVertexBuffer&&T.push("ELEVATION_GROUND_SCALE");let N=r.isTileAffectedByFog(f),U=r.getOrCreateProgram(F,{config:k,defines:T,overrideFog:N});if(!M&&E&&A&&_.lineAtlas){let i=_.lineAtlas.getDash(E,A);
111i&&k.setConstantPatternPositions(i)}C&&I.setupShadows(_.tileID.toUnwrapped(),U,"vector-tile");let[j,G]=n.paint.get("line-trim-offset");("round"===A||"square"===A)&&j!==G&&(0===j&&(j-=1),1===G&&(G+=1));let q=b?f.projMatrix:null,$=m?1/x.tileToMeter/i.aA(_,1,r.transform.zoom):1,H=m?1/x.tileToMeter/i.aA(_,1,Math.floor(r.transform.zoom)):1,Z=S?n.paint._values["line-floorwidth"]:null;if(Z&&"constant"===Z.value.kind){let i=x.zoom;i in B||(B[i]=Math.max(.01,n.widthExpression().evaluate({zoom:i}))),o=Z.value.value;let a=Math.floor(r.transform.zoom);Z.value.value=B[i]*Math.pow(2,a-_.tileID.overscaledZ)}let W=M?i.dS(r,_,n,q,w,$,H,[j,G],O,P):i.dT(r,_,n,q,x.lineClipsArray.length,w,$,H,[j,G],O);if(z){let o=x.gradients[n.id],s=o.texture;if(n.gradientVersion!==o.version){let l=256;if(n.stepInterpolant){let n=a.getSource().maxzoom,o=f.canonical.z===n?Math.ceil(1<<r.transform.maxZoom-f.canonical.z):1;l=i.aC(i.dU(x.maxLineLength/i.an*1024*o),256,g.maxTextureSize)}o.gradient=i.dV({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:x.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new i.T(g,o.gradient,y.RGBA8),o.version=n.gradientVersion,s=o.texture}g.activeTexture.set(y.TEXTURE1),s.bind(n.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}S&&(g.activeTexture.set(y.TEXTURE0),_.lineAtlasTexture&&_.lineAtlasTexture.bind(y.LINEAR,y.REPEAT),k.updatePaintBuffers()),M&&(g.activeTexture.set(y.TEXTURE0),_.imageAtlasTexture&&_.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),k.updatePaintBuffers()),c&&r.terrain.setupElevationDraw(_,U),r.uploadCommonUniforms(g,U,f.toUnwrapped());let X=i=>{null!=h&&(h.value=R*p),U.draw(r,y.TRIANGLES,l,i,v,ia.disabled,W,n.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,n.paint,r.transform.zoom,k,[x.layoutVertexBuffer2,x.patternVertexBuffer,x.zOffsetVertexBuffer,x.elevationGroundScaleVertexBuffer]),null!=h&&(h.value=R)};if(L&&!c){let i=r.stencilModeForClipping(f).ref;0===i&&b&&g.clear({stencil:0});let a={func:y.EQUAL,mask:255};W.u_alpha_discard_threshold=.8,X(new ir(a,i,255,y.KEEP,y.KEEP,y.INVERT)),W.u_alpha_discard_threshold=0,X(new ir(a,i,255,y.KEEP,y.KEEP,y.KEEP))}else W.u_alpha_discard_threshold=L&&c&&d?.8:0,X(c?u:r.stencilModeForClipping(f));void 0!==o&&(Z.value.value=o)}},V=r.depthModeForSublayer(0,ii.ReadOnly),N=new ii(r.depthOcclusion?y.GREATER:y.LEQUAL,ii.ReadOnly,r.depthRangeFor3D);if(n.hasNonElevatedBuckets){let a=!b&&r.terrain;0!==p&&a?i.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):a?i.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):k(o,O,V,ir.disabled,!1,!0)}if(n.hasElevatedBuckets){"hd-road-markup"===f?_||(V=N,O.push("ELEVATED_ROADS")):(O.push("ELEVATED"),V=N,void 0!==x&&O.push(x<1?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),"sea"===f&&O.push("ELEVATION_REFERENCE_SEA"));let i=L?r.stencilModeFor3D():ir.disabled;r.forceTerrainMode=!0,k(o,O,V,i,!0,!0),L&&k(o,O,V,i,!0,!1),r.forceTerrainMode=!1}L&&(r.resetStencilClippingMasks(),b&&g.clear({stencil:0})),0===p||r.depthOcclusion||b||r.layersWithOcclusionOpacity.push(r.currentLayer)}let aF={additive:{clearColor:new i.aq(0,0,0,0),colorMode:it.additive,compositeUniformValue:1},multiply:{clearColor:new i.aq(1,1,1,1),colorMode:it.multiply,compositeUniformValue:0}};function aO(r,a){let n=1<<r.canonical.z,o=(a.x*n-r.canonical.x-r.wrap*n)*i.an,s=(a.y*n-r.canonical.y)*i.an,l=i.dW(a.z,a.y);return i.cM(o,s,l)}function aB(r,a,n,o,s){var l;let h;if(!n.layout||"none"===n.layout.get("fill-elevation-reference")||0===n.paint.get("fill-opacity").constantOr(1))return;let u=r.context.gl,c=new ii(r.context.gl.LEQUAL,ii.ReadWrite,r.depthRangeFor3D),d=new ii(r.context.gl.GREATER,ii.ReadWrite,r.depthRangeFor3D),p=(l=r.transform,h=.01,l.isOrthographic&&(h=i.am(1e-4,h,i.cH(l.pitch>=15?1:l.pitch/15))),2*h),f=r.transform.getFreeCameraOptions().position,m="elevatedStructuresDepthReconstruct",_=r.getOrCreateProgram(m,{defines:["DEPTH_RECONSTRUCTION"]}),g=r.getOrCreateProgram(m);for(let i of o){let o,l,h,m,y=a.getTile(i),x=y.getBucket(n);if(!x)continue;let v=x.elevatedStructures;if(!v)continue;let b=x.elevationBufferData.heightRange,w=aO(i.toUnwrapped(),f),T=r.translatePosMatrix(i.projMatrix,y,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if("initialize"===s){if(!b||b.min>=1||0===v.depthSegments.segments[0].primitiveLength)continue;o=ae(T,w,p,1,0),l=c,h=v.depthSegments,m=_}else if("reset"===s){if(!b||b.min>=0||0===v.maskSegments.segments[0].primitiveLength)continue;o=ae(T,w,0,0,1),l=d,h=v.maskSegments,m=_}else if("geometry"===s){if(0===v.depthSegments.segments[0].primitiveLength)continue;o=ae(T,w,p,1,0),l=c,h=v.depthSegments,m=g}m.draw(r,u.TRIANGLES,l,ir.disabled,it.disabled,ia.disabled,o,n.id,v.vertexBuffer,v.indexBuffer,h,n.paint,r.transform.zoom)}}function ak(r,a,n,o){let{painter:s,sourceCache:l,layer:h,coords:u,colorMode:c,elevationType:d,terrainEnabled:p,pass:f}=r,m=s.context.gl,_=h.paint.get("fill-pattern"),g=h.paint.get("fill-pattern-cross-fade"),y=_.constantOr(null),x=d;"road"!==d||a&&!p||(x="none");let v="road"===x,b=r.painter.shadowRenderer,w=v&&!!b&&b.enabled,T=new ii(s.
111context.gl.LEQUAL,ii.ReadOnly,s.depthRangeFor3D),S=[0,0,0];if(w){let i=s.style.directionalLight,r=s.style.ambientLight;i&&r&&(S=ib(s.style,i,r))}let I=_&&_.constantOr(1),E=s.terrain&&s.terrain.renderingToTexture,A=(r,f)=>{let _,x,A,C,M;for(let P of(f?(_=I&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",A=m.LINES):(_=I?"fillPattern":"fill",A=m.TRIANGLES),u)){let u=l.getTile(P);if(I&&!u.patternsLoaded())continue;let D=u.getBucket(h);if(!D)continue;let R=a?D.elevationBufferData:D.bufferData;if(R.isEmpty())continue;s.prepareDrawTile();let L=R.programConfigurations.get(h.id),z=s.isTileAffectedByFog(P),F=[],O=[];v&&(F.push("ELEVATED_ROADS"),O.push(R.elevatedLayoutVertexBuffer)),w&&F.push("RENDER_SHADOWS","NORMAL_OFFSET"),E&&n&&F.push("USE_MRT1"),I&&(s.context.activeTexture.set(m.TEXTURE0),u.imageAtlasTexture&&u.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),L.updatePaintBuffers());let B=!1;if(y&&u.imageAtlas){let r=u.imageAtlas,a=i.dR.from(y),n=a.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),o=a.getSecondary(),s=r.patternPositions.get(n),l=o?r.patternPositions.get(o.scaleSelf(i.o.devicePixelRatio).toString()):null;B=!!s&&!!l,s&&L.setConstantPatternPositions(s,l)}g>0&&(B||L.getPatternTransitionVertexBuffer("fill-pattern"))&&F.push("FILL_PATTERN_TRANSITION");let k=s.getOrCreateProgram(_,{config:L,overrideFog:z,defines:F}),V=s.translatePosMatrix(P.projMatrix,u,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));w&&b.setupShadows(u.tileID.toUnwrapped(),k,"vector-tile");let N=h.paint.get("fill-emissive-strength");if(f){C=R.lineIndexBuffer,M=R.lineSegments;let i=s.terrain&&s.terrain.renderingToTexture?s.terrain.drapeBufferSize:[m.drawingBufferWidth,m.drawingBufferHeight];x="fillOutlinePattern"===_&&I?r8(V,N,s,u,i,S,g):r6(V,N,i,S)}else C=R.indexBuffer,M=R.triangleSegments,x=I?r4(V,N,s,u,S,g):r5(V,N,S);s.uploadCommonUniforms(s.context,k,P.toUnwrapped());let U=r;("road"!==d||p)&&"offset"!==d||(U=T),k.draw(s,A,U,o||s.stencilModeForClipping(P),c,ia.disabled,x,h.id,R.layoutVertexBuffer,C,M,h.paint,s.transform.zoom,L,O)}};s.renderPass===f&&A(s.depthModeForSublayer(1,"opaque"===s.renderPass?ii.ReadWrite:ii.ReadOnly),!1),"none"===x&&"translucent"===s.renderPass&&h.paint.get("fill-antialias")&&A(s.depthModeForSublayer(2*!!h.getPaintProperty("fill-outline-color"),ii.ReadOnly),!0)}function aV(r,a,n,o,s,l,h,u){let c;n.resetLayerRenderingStats(r);let d=r.context,p=d.gl,f=r.transform,m=n.paint.get("fill-extrusion-pattern"),_=n.paint.get("fill-extrusion-pattern-cross-fade"),g=m.constantOr(null),y=m.constantOr(1),x=n.paint.get("fill-extrusion-opacity"),v=r.style.enable3dLights(),b=n.paint.get(v&&!y?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),w=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),b],T=n.layout.get("fill-extrusion-edge-radius"),S=T>0&&!n.paint.get("fill-extrusion-rounded-roof"),I=S?0:T,E="globe"===f.projection.name?i.dZ():0,A="globe"===f.projection.name,C=A?i.al(f.zoom):0,M=[i.aH(f.center.lng),i.aL(f.center.lat)],P="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"),D=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(P?null:n.lut).toArray01().slice(0,3),R=n.paint.get("fill-extrusion-flood-light-intensity"),L=n.paint.get("fill-extrusion-vertical-scale"),z=0!==n.paint.get("fill-extrusion-line-width").constantOr(1),F=n.paint.get("fill-extrusion-height-alignment"),O=n.paint.get("fill-extrusion-base-alignment"),B=im(r,n.paint.get("fill-extrusion-cutoff-fade-range")),k=n.paint.get("fill-extrusion-front-cutoff"),V=aU(f.pitch,k,!!r.terrain),N=V[2]<1;N&&(r.maxFrontCutoffRawStart=Math.max(r.maxFrontCutoffRawStart,k[0]));let U=[];A&&U.push("PROJECTION_GLOBE_VIEW"),w[0]>0&&U.push("FAUX_AO"),S&&U.push("ZERO_ROOF_RADIUS"),u&&U.push("HAS_CENTROID"),R>0&&U.push("FLOOD_LIGHT"),B.shouldRenderCutoff&&U.push("RENDER_CUTOFF"),N&&U.push("RENDER_FRONT_CUTOFF"),z&&U.push("RENDER_WALL_MODE");let j="shadow"===r.renderPass,G=r.shadowRenderer,q=j&&!!G,$=j?ia.disabled:ia.backCCW;r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!0);let H=[0,0,0];if(G){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(H=ib(r.style,i,a)),j||(U.push("RENDER_SHADOWS"),G.useNormalOffset&&U.push("NORMAL_OFFSET")),c=U.concat(["SHADOWS_SINGLE_CASCADE"])}let Z=q?"fillExtrusionDepth":y?"fillExtrusionPattern":"fillExtrusion",W=n.getLayerRenderingStats();for(let m of o){let o,v=a.getTile(m),b=v.getBucket(n);if(!b||b.projection.name!==f.projection.name)continue;let T=!1;G&&(T=0===G.getMaxCascadeForTile(m.toUnwrapped()));let S=r.isTileAffectedByFog(m),P=b.programConfigurations.get(n.id),k=!1;if(g&&v.imageAtlas){let r=v.imageAtlas,a=i.dR.from(g),n=a.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),o=a.getSecondary(),s=r.patternPositions.get(n),l=o?r.patternPositions.get(o.scaleSelf(i.o.devicePixelRatio).toString()):null;k=!!s&&!!l,s&&P.setConstantPatternPositions(s,l)}_>0&&(k||P.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&U.push("FILL_EXTRUSION_PATTERN_TRANSITION");let N=r.getOrCreateProgram(Z,{config:P,defines:T?c:U,overrideFog:S});if(r.terrain&&r.terrain.setupElevationDraw(v,N,{useMeterToDem:!0}),!b.centroidVertexBuffer){let i=N.getAttributeLocation(p,"a_centroid_pos");-1!==i&&p.vertexAttribI4ui(i,0,0,0,0)}!j&&G&&G.setupShadows(v.tileID.toUnwrapped(),N,"vector-tile"),y&&(r.context.activeTexture.set(p.TEXTURE0),v.imageAtlasTexture&&v.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),P.updatePaintBuffers());let q=n.paint.get("fill-extrusion-vertical-gradient"),X=1/b.tileToMeter;if(j&&G){if(aH(v.tileID,b.maxHeight,r))continue;o=r2(G.calculateShadowPassMatrixFromTile(v.tileID.toUnwrapped()),I,X,L,F,O)}else{let i=r.translatePosMatrix(m.expandedProjMatrix,v,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),a=f.projection.createInversionMatrix(f,m.canonical);o=y?r3(i,r,q,x,w,I,X,m,v,E,F,O,C,M,a,D,L,_):r1(i,r,q,x,w,I,X,m,E,F,O,C,M,a,D,L,R,H,V)}r.uploadCommonUniforms(d,N,m.toUnwrapped(),null,B);let Y=b.segments;if("mercator"===f.projection.name&&!j&&!(Y=b.getVisibleSegments(v.tileID,r.terrain,r.transform.getFrustum(0))).get().length)continue;if(W)if(j)for(let i of Y.get())W.numRenderedVerticesInShadowPass+=i.primitiveLength;else for(let i of Y.get())W.numRenderedVerticesInTransparentPass+=i.primitiveLength;let K=[];(r.terrain||u)&&K.push(b.centroidVertexBuffer),A&&K.push(b.layoutVertexExtBuffer),z&&K.push(b.wallVertexBuffer),N.draw(r,d.gl.TRIANGLES,s,l,h,$,o,n.id,b.layoutVertexBuffer,b.indexBuffer,Y,n.paint,r.transform.zoom,P,K)}r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!1)}class aN{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function aU(i,r,a){if(!(r[2]<1)||a)return[0,0,1];let n=180*i/Math.PI;if(n<15)return[-.5,r[1],r[2]];let o=Math.min(1,Math.max(0,(n-15)/5)),s=o*o*(3-2*o);return[-.5*(1-s)+r[0]*s,r[1],r[2]]}function aj(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T){let S=a.context,I=S.gl,
111E=a.transform,A=a.transform.zoom,C=[],M=r.translate,P=r.translateAnchor,D=r.edgeRadius,R=im(a,r.cutoffFadeRange);"clear"===p?(C.push("CLEAR_SUBPASS"),w&&(C.push("CLEAR_FROM_TEXTURE"),S.activeTexture.set(I.TEXTURE0),w.bind(I.LINEAR,I.CLAMP_TO_EDGE))):"sdf"===p?C.push("SDF_SUBPASS"):"emissive"===p&&(C.push("USE_MRT1"),S.activeTexture.set(I.TEXTURE0),w.bind(I.LINEAR,I.CLAMP_TO_EDGE)),v&&C.push("HAS_CENTROID"),R.shouldRenderCutoff&&C.push("RENDER_CUTOFF");let L=(i,r,n,s,p)=>{let b=C;null!=r.groundRadiusBuffer&&(b=C.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));let T=r.programConfigurations.get(o.id),I=a.isTileAffectedByFog(i),E=a.getOrCreateProgram("fillExtrusionGroundEffect",{config:T,defines:b,overrideFog:I}),M={u_matrix:s,u_opacity:f,u_ao_pass:+!!d,u_meter_to_tile:p,u_ao:[m,_*p],u_flood_light_intensity:g,u_flood_light_color:y,u_attenuation:x,u_edge_radius:A>=17?0:D*p,u_fb:0,u_fb_size:w?w.size[0]:0,u_dynamic_offset:1},P=[];v&&P.push(r.hiddenByLandmarkVertexBuffer),null!=r.groundRadiusBuffer&&P.push(r.groundRadiusBuffer),a.uploadCommonUniforms(S,E,i.toUnwrapped(),null,R),E.draw(a,S.gl.TRIANGLES,l,h,u,c,M,o.id,r.vertexBuffer,r.indexBuffer,n,o.paint,A,T,P)};for(let r of s){let s=n.getTile(r),l=s.getBucket(o);if(!l||l.projection.name!==E.projection.name||!l.groundEffect||l.groundEffect&&!l.groundEffect.hasData())continue;let h=l.groundEffect,u=1/l.tileToMeter;{let i=a.translatePosMatrix(r.projMatrix,s,M,P),n=h.getDefaultSegment();L(r,h,n,i,u)}if(b)for(let l=0;l<4;l++){let h,c,d=i.dX[l](r),p=n.getTile(d);if(!p)continue;let f=p.getBucket(o);if(!f||f.projection.name!==E.projection.name||!f.groundEffect||f.groundEffect&&!f.groundEffect.hasData())continue;let m=f.groundEffect;0===l?(h=[-i.an,0,0],c=1):1===l?(h=[i.an,0,0],c=0):2===l?(h=[0,-i.an,0],c=3):(h=[0,i.an,0],c=2);let _=m.regionSegments[c];if(!_)continue;let g=new Float32Array(16);i.by(g,r.projMatrix,h),L(r,m,_,a.translatePosMatrix(g,s,M,P),u)}}}let aG=[1,0,0],aq=[0,1,0],a$=[0,0,1];function aH(r,a,n){let o=n.transform,s=n.shadowRenderer;if(!s)return!0;let l=r.toUnwrapped(),h=o.tileSize*s._cascades[n.currentShadowCascade].scale,u=a;if(o.elevation){let i=o.elevation.getMinMaxForTile(r);i&&(u+=i.max)}let c=o.scaleZoom(h);u/=i.d_(o.center.lat,c);let d=[...s.shadowDirection];d[2]=-d[2];let p=s.computeSimplifiedTileShadowVolume(l,u,h,d);if(!p)return!1;let f=[aG,aq,a$,d,[d[0],0,d[2]],[0,d[1],d[2]]],m=i.cg.fromInvProjectionMatrix(o.invProjMatrix,o.worldSize,c,"globe"!==o.projection.name),_=s.getCurrentCascadeFrustum();return 0===m.intersectsPrecise(p.vertices,p.planes,f)||0===_.intersectsPrecise(p.vertices,p.planes,f)}function aZ(r){let{painter:a,source:n,layer:o,coords:s}=r,l=r.defines,h=a.context,u="shadow"===a.renderPass,c="light-beam"===a.renderPass,d=a.shadowRenderer,p=i.d_(a.transform.center.lat,a.transform.zoom),f=im(a,o.paint.get("building-cutoff-fade-range"));f.shouldRenderCutoff&&(l=l.concat("RENDER_CUTOFF"));let m=o.paint.get("building-front-cutoff"),_=m[2]<1&&!a.terrain,g=aU(a.transform.pitch,m,!!a.terrain);for(let y of(_&&(l=l.concat("RENDER_FRONT_CUTOFF"),a.maxFrontCutoffRawStart=Math.max(a.maxFrontCutoffRawStart,m[0])),r.floodLightIntensity>0&&(l=l.concat("FLOOD_LIGHT")),s)){let s=n.getTile(y),m=s.getBucket(o);if(!m)continue;d&&0===d.getMaxCascadeForTile(y.toUnwrapped())&&(l=l.concat("SHADOWS_SINGLE_CASCADE"));let _=m.programConfigurations.get(o.id),x,v,b,w=a.translatePosMatrix(y.expandedProjMatrix,s,[0,0],"map");if(w=i.cx(i.bc(),w,[1,1,r.verticalScale]),u&&d){if(aH(s.tileID,m.maxHeight*p,a))continue;let n=d.calculateShadowPassMatrixFromTile(s.tileID.toUnwrapped());b=aa(n=i.cx(i.bc(),n,[1,1,r.verticalScale])),x=v=a.getOrCreateProgram("buildingDepth",{config:_,defines:l,overrideFog:!1})}else if(c)x=v=a.getOrCreateProgram("buildingBloom",{config:_,defines:l,overrideFog:!1}),b=ar(w);else{let n=a.transform.calculatePosMatrix(y.toUnwrapped(),a.transform.worldSize);i.cx(n,n,[1,1,r.verticalScale]);let o=i.bc();i.cx(o,n,[1,-1,1/p]),i.b8(o,o),i.e2(o,o);let s=a.transform.getFreeCameraOptions().position,h=1<<y.canonical.z;if(b=ai(w,o,r.opacity,r.facadeAOIntensity,[((s.x-y.wrap)*h-y.canonical.x)*i.an,(s.y*h-y.canonical.y)*i.an,s.z*h*i.an],m.tileToMeter,r.facadeEmissiveChance,r.floodLightColor,r.floodLightIntensity,g),v=a.getOrCreateProgram("building",{config:_,defines:l,overrideFog:!1}),!0===r.depthOnly)x=v;else{let i=l.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);x=a.getOrCreateProgram("building",{config:_,defines:i,overrideFog:!1})}
111d&&(d.setupShadowsFromMatrix(n,v,!0),x!==v&&d.setupShadowsFromMatrix(n,x,!0))}let T=(i,n)=>{if(c){let s=i.entranceBloom;n.draw(a,h.gl.TRIANGLES,r.depthMode,ir.disabled,r.blendMode,ia.disabled,b,o.id,s.layoutVertexBuffer,s.indexBuffer,s.segmentsBucket,o.paint,a.transform.zoom,_,[s.layoutAttenuationBuffer,s.layoutColorBuffer])}else{let s=i.segmentsBucket,l=[i.layoutNormalBuffer,i.layoutCentroidBuffer,i.layoutColorBuffer,i.layoutFloodLightDataBuffer];i.layoutFacadePaintBuffer&&(l=l.concat([i.layoutFacadeDataBuffer,i.layoutFacadeVerticalRangeBuffer,i.layoutFacadePaintBuffer])),n.draw(a,h.gl.TRIANGLES,r.depthMode,ir.disabled,r.blendMode,u?ia.disabled:ia.backCW,b,o.id,i.layoutVertexBuffer,i.indexBuffer,s,o.paint,a.transform.zoom,_,l)}};a.uploadCommonUniforms(h,v,y.toUnwrapped(),null,f),m.buildingWithoutFacade&&T(m.buildingWithoutFacade,v),m.buildingWithFacade&&(x!==v&&a.uploadCommonUniforms(h,x,y.toUnwrapped(),null,f),T(m.buildingWithFacade,x))}}function aW(r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=r.context.gl,y=r.depthModeForSublayer(1,ii.ReadOnly,g.LEQUAL,!0),x=.1*(1-p)+3*p,v=r._showOverdrawInspector,b=new aN;v||aj(b,r,a,n,o,y,new ir({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),new it([g.ONE,g.ONE,g.ONE,g.ONE],i.aq.transparent,[!1,!1,!1,!0],g.MIN),ia.disabled,s,"sdf",l,h,u,c,d,x,f,!1,void 0);{let p=v?ir.disabled:new ir({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),m=v?r.colorModeForRenderPass():new it([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],i.aq.transparent,[!0,!0,!0,!0]);aj(b,r,a,n,o,y,p,m,ia.disabled,s,"color",l,h,u,c,d,x,f,!1,void 0)}}function aX(r){return[r[0]*i.e3,r[1]*i.e3,r[2]*i.e3,0]}function aY(r,a,n,o,s,l,h,u,c){let d,p,f,m,_,g,y,x,v=o.getSource(),b=n.globeSharedBuffers;if(!b||(a&&(d=o.getTile(a)),v instanceof i.aW?(p=v.texture,f=i.ds(0,0,n.transform)):d&&a&&(p=d.texture,f=i.ds(a.canonical.z,a.canonical.x,n.transform)),!p||!f))return;r||(f=i.cx(i.bc(),f,[1,-1,1]));let w=n.context,T=w.gl,S="nearest"===s.paint.get("raster-resampling")?T.NEAREST:T.LINEAR,I=n.colorModeForDrapableLayerRenderPass(l),E=h.defines;E.push("GLOBE_POLES");let A=new ii(T.LEQUAL,ii.ReadWrite,n.depthRangeFor3D),C=Float32Array.from(n.transform.expandedFarZProjMatrix),M=Float32Array.from(i.dq(i.dr(new i.ci(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),w.activeTexture.set(T.TEXTURE0),p.bind(S,T.CLAMP_TO_EDGE),w.activeTexture.set(T.TEXTURE1),p.bind(S,T.CLAMP_TO_EDGE),"useMipmap"in p&&w.extTextureFilterAnisotropic&&n.transform.pitch>20&&T.texParameterf(T.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);let[P,D,R,L]=a?b.getPoleBuffers(a.canonical.z,!1):b.getPoleBuffers(0,!0),z=s.paint.get("raster-elevation");r?(m=P,n.renderDefaultNorthPole=0!==z):(m=D,n.renderDefaultSouthPole=0!==z);let F=aX(h.mix),O=(_=f,g=i.al(n.transform.zoom),y=h.offset,x=h.range,ad(n,C,M,_,new Float32Array(16),new Float32Array(9),[0,0],g,[0,0],[0,0,0,0],1,{opacity:1,mix:0},s,[0,0],z,2,F,y,x,1,0,l)),B=n.getOrCreateProgram("raster",{defines:E});n.uploadCommonUniforms(w,B,null),B.draw(n,T.TRIANGLES,A,c,I,u,O,s.id,m,R,L)}var aK=i.e4([{name:"a_index",type:"Int16",components:1}]);class aJ{constructor(r,a,n,o){const s={width:n[0],height:n[1],data:null},l=r.gl;this.targetColorTexture=new i.T(r,s,l.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.T(r,s,l.RGBA8,{useMipmap:!1}),this.context=r,this.updateParticleTexture(a,o),this.lastInvalidatedAt=0}updateParticleTexture(r,a){if(this.particleTextureDimension===a.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());let n=this.context.gl,o=a.width*a.height;this.particleTexture0=new i.T(this.context,a,n.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,a,n.RGBA8,{premultiply:!1,useMipmap:!1});let s=new i.e5;s.reserve(o);for(let i=0;i<o;i++)s.emplaceBack(i);this.particleIndexBuffer=this.context.createVertexBuffer(s,aK.members,!0),this.particleSegment=i.du.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=a.width}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=i.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}let aQ=new i.aq(1,0,0,1),a0=new i.aq(0,1,0,1),a1=new i.aq(0,0,1,1),a2=new i.aq(1,0,1,1),a3=new i.aq(0,1,1,1);function a5(r,a,n,o,s,l){for(let h=0;h<n.length;h++)if(s){let s=new i.aq(.8*o.r,.8*o.g,.8*o.b,1);a4(r,a,n[h],o,-1,-1,l),a4(r,a,n[h],o,-1,1,l),a4(r,a,n[h],o,1,1,l),a4(r,a,n[h],o,1,-1,l),a4(r,a,n[h],s,0,0,l)}else a4(r,a,n[h],o,0,0,l)}function a4(r,a,n,o,s,l,h){let u=r.context,c=r.transform,d=u.gl,p="globe"===c.projection.name,f=i.b9(n.projMatrix);if(p&&i.al(c.zoom)>0){let r=i.e8(n.canonical,c),a=i.e9(r);f=i.aD(new Float32Array(16),c.globeMatrix,a),i.aD(f,c.projMatrix,f)}let m=i.bc();m[12]+=2*s/(i.o.devicePixelRatio*c.width),m[13]+=2*l/(i.o.devicePixelRatio*c.height),i.aD(f,m,f);let _=r.getOrCreateProgram("debug",{defines:p?["PROJECTION_GLOBE_VIEW"]:[]}),g=a.getTileByID(n.key);r.terrain&&r.terrain.setupElevationDraw(g,_);let y=ii.disabled,x=ir.disabled,v=r.colorModeForRenderPass(),b="$debug";u.activeTexture.set(d.TEXTURE0),r.emptyTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),p?g._makeGlobeTileDebugBuffers(r.context,c):g._makeDebugTileBoundsBuffers(r.context,c.projection);let w=g._tileDebugBuffer||r.debugBuffer,T=g._tileDebugIndexBuffer||r.debugIndexBuffer,S=g._tileDebugSegments||r.debugSegments;if(_.draw(r,d.LINE_STRIP,y,x,v,ia.disabled,as(f,o.toPremultipliedRenderColor(null)),b,w,T,S,null,null,null,[g._globeTileDebugBorderBuffer]),h){var I;let i,a,o,s=g.latestRawTileData,l=Math.floor((s&&s.byteLength||0)/1024),h=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(h+=` => ${n.overscaledZ}`),h+=` ${g.state}`,h+=` ${l}kb`,I=h,r.initDebugOverlayCanvas(),i=r.debugOverlayCanvas,a=r.context.gl,(o=r.debugOverlayCanvas.getContext("2d")).clearRect(0,0,i.width,i.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(I,5,5),o.strokeText(I,5,5),r.debugOverlayTexture.update(i),r.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}let E=512/Math.min(a.getTile(n).tileSize,512)*(n.overscaledZ/c.zoom)*.5,A=g._tileDebugTextBuffer||r.debugBuffer,C=g._tileDebugTextIndexBuffer||r.quadTriangleIndexBuffer,M=g._tileDebugTextSegments||r.debugSegments;_.draw(r,d.TRIANGLES,y,x,it.alphaBlended,ia.disabled,as(f,i.aq.transparent.toPremultipliedRenderColor(null),E),b,A,C,M,null,
111null,null,[g._globeTileDebugTextBuffer])}function a6(i,r,a,n){a9(i,0,r+a/2,i.transform.width,a,n)}function a8(i,r,a,n){a9(i,r-a/2,0,a,i.transform.height,n)}function a9(r,a,n,o,s,l){let h=r.context,u=h.gl;u.enable(u.SCISSOR_TEST),u.scissor(a*i.o.devicePixelRatio,n*i.o.devicePixelRatio,o*i.o.devicePixelRatio,s*i.o.devicePixelRatio),h.clear({color:l}),u.disable(u.SCISSOR_TEST)}let{members:a7}=i.e4([{name:"a_pos_3f",components:3,type:"Float32"}]);function ne(i,r,a,n){i.emplaceBack(r,a,n)}class nt{constructor(r){this.vertexArray=new i.ea,this.indices=new i.dy,ne(this.vertexArray,-1,-1,1),ne(this.vertexArray,1,-1,1),ne(this.vertexArray,-1,1,1),ne(this.vertexArray,1,1,1),ne(this.vertexArray,-1,-1,-1),ne(this.vertexArray,1,-1,-1),ne(this.vertexArray,-1,1,-1),ne(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=r.createVertexBuffer(this.vertexArray,a7),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.du.simpleSegment(0,0,36,12)}}function ni(r,a,n,o,s,l){let h,u,c,d=r.context.gl,p=a.paint.get("sky-atmosphere-color"),f=a.paint.get("sky-atmosphere-halo-color"),m=a.paint.get("sky-atmosphere-sun-intensity"),_=(h=i.ec(i.dA(),o),u=p.toPremultipliedRenderColor(null),c=f.toPremultipliedRenderColor(null),{u_matrix_3f:h,u_sun_direction:s,u_sun_intensity:m,u_color_tint_r:[u.r,u.g,u.b,u.a],u_color_tint_m:[c.r,c.g,c.b,c.a],u_luminance:5e-5});d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_CUBE_MAP_POSITIVE_X+l,a.skyboxTexture,0),n.draw(r,d.TRIANGLES,ii.disabled,ir.disabled,it.unblended,ia.frontCW,_,"skyboxCapture",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)}let nr=i.e4([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class na{constructor(r){const a=new i.ed;a.emplaceBack(-1,1,1,0,0),a.emplaceBack(1,1,1,1,0),a.emplaceBack(1,-1,1,1,1),a.emplaceBack(-1,-1,1,0,1);const n=new i.dy;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(a,nr.members),this.indexBuffer=r.createIndexBuffer(n),this.segments=i.du.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let nn=i.e4([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_opacity",components:1}]);class no{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ns{constructor(r){this.colorModeAlphaBlendedWriteRGB=new it([1,771,1,771],i.aq.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new it([1,0,1,0],i.aq.transparent,[!1,!1,!1,!0]),this.params=new no,this.updateNeeded=!0}update(r){let a=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new na(a);let r=this.params.sizeRange,n=this.params.intensityRange,o=function(r){let a=i.ei(30),n=[];for(let o=0;o<r;++o){let r=2*Math.PI*a(),o=Math.acos(1-2*a())-.5*Math.PI;n.push(i.cM(Math.cos(o)*Math.cos(r),Math.cos(o)*Math.sin(r),Math.sin(o)))}return n}(this.params.starsCount),s=i.ei(300),l=new i.ee,h=new i.dy,u=0;for(let a=0;a<o.length;++a){let c=i.bK([],o[a],200),d=Math.max(0,1+.01*r*(s()-.5)),p=Math.max(0,1+.01*n*(s()-.5));l.emplaceBack(c[0],c[1],c[2],-1,-1,d,p),l.emplaceBack(c[0],c[1],c[2],1,-1,d,p),l.emplaceBack(c[0],c[1],c[2],1,1,d,p),l.emplaceBack(c[0],c[1],c[2],-1,1,d,p),h.emplaceBack(u+0,u+1,u+2),h.emplaceBack(u+0,u+2,u+3),u+=4}this.starsVx=a.createVertexBuffer(l,nn.members),this.starsIdx=a.createIndexBuffer(h),this.starsSegments=i.du.simpleSegment(0,0,l.length,h.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(r,a){let n=r.context,o=n.gl,s=r.transform,l=new ii(o.LEQUAL,ii.ReadOnly,[0,1]),h=i.al(s.zoom),u=r.style.getLut(a.scope),c="none"===a.properties.get("color-use-theme"),d=a.properties.get("color").toNonPremultipliedRenderColor(c?null:u),p="none"===a.properties.get("high-color-use-theme"),f=a.properties.get("high-color").toNonPremultipliedRenderColor(p?null:u),m="none"===a.properties.get("space-color-use-theme"),_=a.properties.get("space-color").toNonPremultipliedRenderColor(m?null:u),g=i.ef(a.properties.get("horizon-blend"),0,1,5e-4,.25),y=i.dk(r,n,s)&&5e-4===g?s.worldSize/(2*Math.PI*1.025)-1:s.globeRadius,x=r.frameCounter/1e3%1,v=i.ai(s.globeCenterInViewSpace),b=Math.acos(Math.sqrt(Math.pow(v,2)-Math.pow(y,2))/v),w=i=>{let a,u,c,p,m,y="globe"===s.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];i&&y.push("ALPHA_PASS");let v=r.getOrCreateProgram("globeAtmosphere",{defines:y}),w=(a=s.frustumCorners.TL,u=s.frustumCorners.TR,c=s.frustumCorners.BR,p=s.frustumCorners.BL,m=s.frustumCorners.horizon,{u_frustum_tl:a,u_frustum_tr:u,u_frustum_br:c,u_frustum_bl:p,u_horizon:m,u_transition:h,u_fadeout_range:g,u_atmosphere_fog_color:d.toArray01(),u_high_color:f.toArray01(),u_space_color:_.toArray01(),u_temporal_offset:x,u_horizon_angle:b});r.uploadCommonUniforms(n,v);let T=this.atmosphereBuffer;T&&v.draw(r,o.TRIANGLES,l,ir.disabled,i?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,ia.backCW,w,i?"atmosphere_glow_alpha":"atmosphere_glow",T.vertexBuffer,T.indexBuffer,T.segments)};w(!1),w(!0)}drawStars(r,a){let n=i.aC(a.properties.get("star-intensity"),0,1);if(0===n)return;let o=r.context,s=o.gl,l=r.transform,h=r.getOrCreateProgram("stars"),u=i.bM([]);i.bO(u,u,-l._pitch),i.bN(u,u,-l.angle),i.bO(u,u,i.ap(l._center.lat)),i.eg(u,u,-i.ap(l._center.lng));let c=i.bS(new Float32Array(16),u),d=i.aD([],l.starsProjMatrix,c),p=i.ec([],c),f=i.eh([],p),m=[0,1,0];i.dC(m,m,f),i.bK(m,m,this.params.sizeMultiplier);let _=[1,0,0];i.dC(_,_,f),i.bK(_,_,this.params.sizeMultiplier);let g={u_matrix:Float32Array.from(d),u_up:m,u_right:_,u_intensity_multiplier:n};r.uploadCommonUniforms(o,h),this.starsVx&&this.starsIdx&&h.draw(r,s.TRIANGLES,ii.disabled,ir.disabled,this.colorModeAlphaBlendedWriteRGB,ia.disabled,g,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class nl{constructor(){this.visibleTiles=[]}updateBorders(r,a){let n=[],o=[];for(let i of r._getRenderableCoordinates(!1,!0)){let s=r.getTile(i);if(!s.hasData())continue;let l=s.getBucket(a);l&&(l.isEmpty()||(n.push(i.key),o.push({bucket:l,tileID:i.canonical})))}let s=n.length!==this.visibleTiles.length;if(!s){n.sort();for(let i=0;i<n.length;i++)if(n[i]!==this.visibleTiles[i]){s=!0;break}}if(!s)return;let l=new Set;for(let r of(this.visibleTiles=n,o.sort((i,r)=>i.tileID.z-r.tileID.z||i.tileID.x-r.tileID.x||i.tileID.y-r.tileID.y),o)){let a=[],n=[],o=r.bucket;for(let i of o.featuresOnBorder)l.has(i.featureId)?n.push(i.footprintIndex):(l.add(i.featureId),a.push(i.footprintIndex));o.updateFootprintHiddenFlags(a,i.ej,!1),o.updateFootprintHiddenFlags(n,i.ej,!0)}}}function nh(r,a){let n=[...r],o=a.cameraWorldSizeForFog/a.worldSize,s=i.ba([]);return i.cx(s,s,[o,o,1]),i.aD(n,s,n),i.aD(n,a.worldToFogMatrix,n),n}function nu(r,a,n,o,s){let l=n.material,h=o.context,{baseColorTexture:u,metallicRoughnessTexture:c}=l.pbrMetallicRoughness,{normalTexture:d,occlusionTexture:p,emissionTexture:f}=l;
111function m(i,a,n){if(i&&(r.push(a),h.activeTexture.set(h.gl.TEXTURE0+n),i.gfxTexture)){let{minFilter:r,magFilter:a,wrapS:n,wrapT:o}=i.sampler;i.gfxTexture.bindExtraParam(r,a,n,o)}}m(u,"HAS_TEXTURE_u_baseColorTexture",5),m(c,"HAS_TEXTURE_u_metallicRoughnessTexture",6),m(d,"HAS_TEXTURE_u_normalTexture",7),m(p,"HAS_TEXTURE_u_occlusionTexture",8),m(f,"HAS_TEXTURE_u_emissionTexture",9),s&&(s.texture||(s.texture=new i.dN(o.context,s.image,[s.image.height,s.image.height,s.image.height],h.gl.RGBA8)),h.activeTexture.set(h.gl.TEXTURE0+10),s.texture&&s.texture.bind(h.gl.LINEAR,h.gl.CLAMP_TO_EDGE),r.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(r.push("HAS_ATTRIBUTE_a_uv_2f"),a.push(n.texcoordBuffer)),n.colorBuffer&&(r.push(12===n.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),a.push(n.colorBuffer)),n.normalBuffer&&(r.push("HAS_ATTRIBUTE_a_normal_3f"),a.push(n.normalBuffer)),n.pbrBuffer&&(r.push("HAS_ATTRIBUTE_a_pbr"),r.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),a.push(n.pbrBuffer)),"OPAQUE"!==l.alphaMode&&"MASK"!==l.alphaMode||r.push("UNPREMULT_TEXTURE_IN_SHADER"),l.defined||r.push("DIFFUSE_SHADED");let _=o.shadowRenderer;_&&(r.push("RENDER_SHADOWS"),_.useNormalOffset&&r.push("NORMAL_OFFSET"))}
111function nc(r,a,n,o,s,l){let h,u=r.modelOpacity,c=a.context,d=new ii(a.context.gl.LEQUAL,r.isLightMesh?ii.ReadOnly:ii.ReadWrite,a.depthRangeFor3D),p=a.transform,f=r.mesh,m=f.material,_=m.pbrMetallicRoughness,g=a.style.fog;h="pixels"===a.transform.projection.zAxisUnit?[...r.nodeModelMatrix]:i.aD([],o.zScaleMatrix,r.nodeModelMatrix),i.aD(h,o.negCameraPosMatrix,h);let y=i.b8([],h);i.e2(y,y);let x="none"===n.paint.get("model-color-use-theme").constantOr("default"),v=n.paint.get("model-emissive-strength").constantOr(0),b=ab(new Float32Array(r.worldViewProjection),new Float32Array(h),new Float32Array(y),null,a,u,_.baseColorFactor,m.emissiveFactor,_.metallicFactor,_.roughnessFactor,m,v,n,void 0,void 0,r.materialOverride,r.modelColor),w={defines:[]},T=[],S=a.shadowRenderer;S&&(S.useNormalOffset=!1),nu(w.defines,T,f,a,x?null:n.lut);let I=null;if(g){let i=nh(r.nodeModelMatrix,a.transform);if(I=new Float32Array(i),"globe"!==p.projection.name){let r=f.aabb.min,a=f.aabb.max,[n,o]=g.getOpacityForBounds(i,r[0],r[1],a[0],a[1]);w.overrideFog=n>=.05||o>=.05}}let E=im(a,n.paint.get("model-cutoff-fade-range"));E.shouldRenderCutoff&&w.defines.push("RENDER_CUTOFF");let A=a.getOrCreateProgram("model",w);a.uploadCommonUniforms(c,A,null,I,E),"shadow"!==a.renderPass&&S&&S.setupShadowsFromMatrix(r.nodeModelMatrix,A),A.draw(a,c.gl.TRIANGLES,d,s,l,f.material.doubleSided?ia.disabled:ia.backCCW,b,n.id,f.vertexBuffer,f.indexBuffer,f.segments,n.paint,a.transform.zoom,void 0,T)}function nd(i,r){return i.style._importedAsBasemap?"basemap":r.scope}function np(r,a,n,o,s,l,h,u,c,d){let p=r.transform,f=!!a.isGeometryBloom&&a.isGeometryBloom;if(f&&"shadow"===r.renderPass)return;let m="globe"===p.projection.name?i.er(n,p):[...n];i.aD(m,m,a.globalMatrix);let _=i.aD([],o,m);if(a.meshes)for(let r of a.meshes){let o=u.get(r.material.name);if(o&&o.opacity<=0)continue;if("BLEND"!==r.material.alphaMode){h.push({mesh:r,depth:0,modelIndex:s,worldViewProjection:_,nodeModelMatrix:m,isLightMesh:f,materialOverride:o,modelOpacity:c,modelColor:d,node:a,modelMatrix:n});continue}let g=i.ah([],r.centroid,_);!p.isOrthographic&&g[2]<=0||l.push({mesh:r,depth:g[2],modelIndex:s,worldViewProjection:_,nodeModelMatrix:m,isLightMesh:f,materialOverride:o,modelOpacity:c,modelColor:d,node:a,modelMatrix:n})}if(a.children)for(let i of a.children)np(r,i,n,o,s,l,h,u,c,d)}function nf(i,r,a,n){let o=a.shadowRenderer;if(!o)return;let s=o.getShadowPassDepthMode(),l=aw(o.calculateShadowPassMatrixFromMatrix(r));a.getOrCreateProgram("modelDepth").draw(a,a.context.gl.TRIANGLES,s,ir.disabled,it.disabled,ia.disabled,l,n.id,i.vertexBuffer,i.indexBuffer,i.segments,n.paint,a.transform.zoom,void 0,void 0)}function nm(r,a,n,o){let s=function(r,a){let n;if(a.footprintDebugMesh)return a.footprintDebugMesh;if(!a.footprint)return null;let o=r.context,s=a.footprint.vertices,l=a.footprint.indices,h=new i.dx;for(let i of(h.reserve(s.length),s))h.emplaceBack(i.x,i.y);let u=new i.dy;u.reserve(l.length);for(let i=0;i<l.length;i+=3)u.emplaceBack(l[i],l[i+1],l[i+2]);let c=o.createVertexBuffer(h,i.dt.members),d=o.createIndexBuffer(u),p=i.du.simpleSegment(0,0,s.length,l.length),f=a.id||a.name||"footprint",m=parseInt(f,10);n=isNaN(m)?function(i){let r=0;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a)|0;return r}(f):m;let _=i.e7(n),g=i.e7(n+1),y=i.e7(n+2);return a.footprintDebugMesh={vertexBuffer:c,indexBuffer:d,segments:p,color:new i.aq(_,g,y,.5)},a.footprintDebugMesh}(r,n);if(!s)return;let l=r.context,h=l.gl,u=r.getOrCreateProgram("debug"),c=s.color,d=ii.disabled;l.activeTexture.set(h.TEXTURE0),r.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),u.draw(r,h.TRIANGLES,d,ir.disabled,it.alphaBlended,ia.disabled,as(o,c.toPremultipliedRenderColor(null)),"$debug",s.vertexBuffer,s.indexBuffer,s.segments)}function n_(i,r,a,n,o){let s=!1;for(let a of n)1!==a.modelOpacity&&(nc(a,i,r,o[a.modelIndex],ir.disabled,it.disabled),s=!0);for(let a of n)nc(a,i,r,o[a.modelIndex],1!==a.modelOpacity?i.stencilModeFor3D():ir.disabled,i.colorModeForRenderPass());s&&i.resetStencilClippingMasks();let l=it.additive;for(let n of a)nc(n,i,r,o[n.modelIndex],ir.disabled,n.isLightMesh?l:i.colorModeForRenderPass())}let ng={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new i.cQ([0,0,0],[i.an,i.an,0])},ny=[1,-1,1];
111class nx{}class nv{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(r,a,n){{let i=this._storage.get(a.id);if(i)return i.lastUsedFrameIdx=r,i.buf}let o=n.gl,s=o.getBufferParameter(o.ELEMENT_ARRAY_BUFFER,o.BUFFER_SIZE),l=new ArrayBuffer(s),h=new Int16Array(l);o.getBufferSubData(o.ELEMENT_ARRAY_BUFFER,0,new Int16Array(l));let u=new i.ew;for(let i=0;i<s/2;i+=3){let r=h[i],a=h[i+1],n=h[i+2];u.emplaceBack(r,a),u.emplaceBack(a,n),u.emplaceBack(n,r)}let c=n.bindVertexArrayOES.current,d=new nx;return d.buf=new aS(n,u),d.lastUsedFrameIdx=r,this._storage.set(a.id,d),n.bindVertexArrayOES.set(c),d.buf}update(i){for(let[r,a]of this._storage)i-a.lastUsedFrameIdx>30&&(a.buf.destroy(),this._storage.delete(r))}destroy(){for(let[i,r]of this._storage)r.buf.destroy(),this._storage.delete(i)}}class nb{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}let nw=i.e4([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class nT{constructor(i){this.revealStart=11,this.revealRange=2}}let nS=i.e4([{type:"Float32",name:"a_pos_2f",components:2}]);class nI{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(r,a){var n;let o=r.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){let a=new i.ex,n=new i.dy;a.emplaceBack(-1,-1),a.emplaceBack(1,-1),a.emplaceBack(1,1),a.emplaceBack(-1,1),n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),this.vignetteVx=r.context.createVertexBuffer(a,nS.members),this.vignetteIdx=r.context.createIndexBuffer(n)}let s=i.du.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){r.uploadCommonUniforms(r.context,o);let i={u_vignetteShape:(n={vignetteShape:[a.start,a.range,Math.pow(10,a.fadePower)],vignetteColor:[a.color.r,a.color.g,a.color.b,a.color.a*a.strength]}).vignetteShape,u_vignetteColor:n.vignetteColor};o.draw(r,r.context.gl.TRIANGLES,ii.disabled,ir.disabled,it.alphaBlended,ia.disabled,i,"vignette",this.vignetteVx,this.vignetteIdx,s)}}}class nE{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(r,a){let n=r.getFreeCameraOptions().position,o=n.toAltitude(),s=n.toLngLat(),l=i.ap(s.lng),h=i.ap(s.lat),u=r.pixelsPerMeter/a,c=l*i.ez,d=i.ez*Math.log(Math.tan(Math.PI/4+h/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{let i=-this._offsetYPrev+d,r=-this._elevationPrev+o;this._accumulatedOffsetX+=(-this._offsetXPrev+c)*u,this._accumulatedOffsetY+=i*u,this._accumulatedElevation+=r*u,this._offsetXPrev=c,this._offsetYPrev=d,this._elevationPrev=o}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function nA(i,r){return[-(i[0]-Math.floor(i[0]/r)*r),-(i[1]-Math.floor(i[1]/r)*r),-(i[2]-Math.floor(i[2]/r)*r)]}function nC(r){let a=i.ei(0x134104da55e),n=[];for(let o=0;o<r;++o){let r=2*a()-1,o=2*a()-1,s=2*a()-1;n.push(i.cM(r,o,s))}return n}function nM(r,a,n,o,s){let l=i.aC((s-n)/(o-n),0,1);return(1-l)*r+l*a}class nP{constructor(i){this._movement=new nE,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new nI,this._ppmScaleFactor=i}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(r,a){let n=r.transform;this._movement.update(n,this._ppmScaleFactor);let o=n.starsProjMatrix,s=i.bM([]);i.bO(s,s,i.ap(90)-n._pitch),i.bN(s,s,-n.angle);let l=i.bS(new Float32Array(16),s),h=i.ey(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),u=i.e2([],h),c=i.aD([],u,l),d=Date.now()/1e3;return this._accumulatedTimeFromStart+=(d-this._prevTime)*a,this._prevTime=d,{projectionMatrix:o,modelviewMatrix:c}}}class nD extends nP{constructor(i){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new nT("Precipitation >
111 Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(r){let a=r.context;if(!this.particlesVx){let r=nC(this.particlesCount),n=new i.eA,o=new i.dy,s=0,l=i.ei(0x134104da55e);for(let i=0;i<r.length;++i){let a=r[i],h=[2*l()-1,l(),l(),l()];n.emplaceBack(a[0],a[1],a[2],-1,-1,...h),n.emplaceBack(a[0],a[1],a[2],1,-1,...h),n.emplaceBack(a[0],a[1],a[2],1,1,...h),n.emplaceBack(a[0],a[1],a[2],-1,1,...h),o.emplaceBack(s+0,s+1,s+2),o.emplaceBack(s+0,s+2,s+3),s+=4}this.particlesVx=a.createVertexBuffer(n,nw.members),this.particlesIdx=a.createIndexBuffer(o)}}draw(r){if(!this._params.overrideStyleParameters&&!r.style.rain)return;let a=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},n=r.transform.zoom;if(a.revealStart>n)return;let o=nM(0,1,a.revealStart,a.revealStart+a.revealRange,n);if(!this.particlesVx||!this.particlesIdx)return;let s=structuredClone(this._params),l=[-s.direction.x,s.direction.y,-100];i.ay(l,l);let h=structuredClone(this._vignetteParams);h.strength*=o,s.overrideStyleParameters||(s.intensity=r.style.rain.state.density,s.timeFactor=r.style.rain.state.intensity,s.color=structuredClone(r.style.rain.state.color),l=structuredClone(r.style.rain.state.direction),s.screenThinning.intensity=r.style.rain.state.centerThinning,s.dropletSizeX=r.style.rain.state.dropletSize[0],s.dropletSizeYScale=r.style.rain.state.dropletSize[1]/r.style.rain.state.dropletSize[0],s.distortionStrength=100*r.style.rain.state.distortionStrength,h.strength=1,h.color=structuredClone(r.style.rain.state.vignetteColor));let u=this.updateOnRender(r,s.timeFactor),c=r.context,d=c.gl,p=r.transform;this.screenTexture&&this.screenTexture.size[0]===r.width&&this.screenTexture.size[1]===r.height||(this.screenTexture=new i.T(c,{width:r.width,height:r.height,data:null},d.RGBA8)),s.distortionStrength>0&&(c.activeTexture.set(d.TEXTURE0),this.screenTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.copyTexSubImage2D(d.TEXTURE_2D,0,0,0,0,0,r.width,r.height));let f=r.getOrCreateProgram("rainParticle");r.uploadCommonUniforms(c,f),c.activeTexture.set(d.TEXTURE0),this.screenTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE);let m=[s.color.r,s.color.g,s.color.b,s.color.a],_=(a,n)=>{var o;let h=nA(this._movement.getPosition(),a),c=s.dropletSizeX,_=s.dropletSizeX*s.dropletSizeYScale,g=r.width/2,y=r.height/2,x=nM(0,s.screenThinning.start,0,1,s.screenThinning.intensity),v=nM(.001,s.screenThinning.range,0,1,s.screenThinning.intensity),b=nM(0,s.screenThinning.particleOffset,0,1,s.screenThinning.intensity),w=(o={modelview:u.modelviewMatrix,projection:u.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:h,velocityConeAperture:s.velocityConeAperture,velocity:s.velocity,boxSize:a,rainDropletSize:[c,_],distortionStrength:s.distortionStrength,rainDirection:l,color:m,screenSize:[p.width,p.height],thinningCenterPos:[g,y],thinningShape:[x,v,Math.pow(10,s.screenThinning.fadePower)],thinningAffectedRatio:s.screenThinning.affectedRatio,thinningParticleOffset:b,shapeDirectionalPower:s.shapeDirPower,shapeNormalPower:s.shapeNormalPower,mode:+!n},{u_modelview:Float32Array.from(o.modelview),u_projection:Float32Array.from(o.projection),u_time:o.time,u_cam_pos:o.camPos,u_texScreen:0,u_velocityConeAperture:o.velocityConeAperture,u_velocity:o.velocity,u_boxSize:o.boxSize,u_rainDropletSize:o.rainDropletSize,u_distortionStrength:o.distortionStrength,u_rainDirection:o.rainDirection,u_color:o.color,u_screenSize:o.screenSize,u_thinningCenterPos:o.thinningCenterPos,u_thinningShape:o.thinningShape,u_thinningAffectedRatio:o.thinningAffectedRatio,u_thinningParticleOffset:o.thinningParticleOffset,u_shapeDirectionalPower:o.shapeDirectionalPower,u_shapeNormalPower:o.shapeNormalPower,u_mode:o.mode}),T=Math.round(s.intensity*this.particlesCount),S=i.du.simpleSegment(0,0,4*T,2*T);f.draw(r,d.TRIANGLES,ii.disabled,ir.disabled,it.alphaBlended,ia.disabled,w,"rain_particles",this.particlesVx,this.particlesIdx,S)};s.distortionStrength>0&&_(s.boxSize,!0),_(s.boxSize,!1),this._vignette.draw(r,h)}}let nR=i.e4([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);
111class nL extends nP{constructor(i){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new nT("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(r){let a=r.context;if(!this.particlesVx){let r=nC(this.particlesCount),n=new i.eB,o=new i.dy,s=0,l=i.ei(0x134104da55e);for(let i=0;i<r.length;++i){let a=r[i],h=l(),u=l(),c=l(),d=[i/r.length,h,u,c],p=[l(),l()];n.emplaceBack(a[0],a[1],a[2],-1,-1,...d,...p),n.emplaceBack(a[0],a[1],a[2],1,-1,...d,...p),n.emplaceBack(a[0],a[1],a[2],1,1,...d,...p),n.emplaceBack(a[0],a[1],a[2],-1,1,...d,...p),o.emplaceBack(s+0,s+1,s+2),o.emplaceBack(s+0,s+2,s+3),s+=4}this.particlesVx=a.createVertexBuffer(n,nR.members),this.particlesIdx=a.createIndexBuffer(o)}}draw(r){var a,n;let o,s,l,h,u,c,d,p,f;if(!this._params.overrideStyleParameters&&!r.style.snow)return;let m=structuredClone(this._params),_=[-m.direction.x,m.direction.y,-100];i.ay(_,_);let g=structuredClone(this._vignetteParams),y=m.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},x=r.transform.zoom;if(y.revealStart>x)return;let v=nM(0,1,y.revealStart,y.revealStart+y.revealRange,x);g.strength*=v,m.overrideStyleParameters||(m.intensity=r.style.snow.state.density,m.timeFactor=r.style.snow.state.intensity,m.color=structuredClone(r.style.snow.state.color),_=structuredClone(r.style.snow.state.direction),m.screenThinning.intensity=r.style.snow.state.centerThinning,m.billboardSize=2.79*r.style.snow.state.flakeSize,g.strength=1,g.color=structuredClone(r.style.snow.state.vignetteColor));let b=this.updateOnRender(r,m.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;let w=r.context,T=w.gl,S=r.transform,I=r.getOrCreateProgram("snowParticle");r.uploadCommonUniforms(w,I),a=m.boxSize,o=nA(this._movement.getPosition(),a),s=S.width/2,l=S.height/2,h=nM(0,m.screenThinning.start,0,1,m.screenThinning.intensity),u=nM(.001,m.screenThinning.range,0,1,m.screenThinning.intensity),c=nM(0,m.screenThinning.particleOffset,0,1,m.screenThinning.intensity),n={modelview:b.modelviewMatrix,projection:b.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:o,velocityConeAperture:m.velocityConeAperture,velocity:m.velocity,horizontalOscillationRadius:m.horizontalOscillationRadius,horizontalOscillationRate:m.horizontalOscillationRate,boxSize:a,billboardSize:+m.billboardSize,simpleShapeParameters:[m.shapeFadeStart,m.shapeFadePower],screenSize:[S.width,S.height],thinningCenterPos:[s,l],thinningShape:[h,u,Math.pow(10,m.screenThinning.fadePower)],thinningAffectedRatio:m.screenThinning.affectedRatio,thinningParticleOffset:c,color:[m.color.r,m.color.g,m.color.b,m.color.a],direction:_},d={u_modelview:Float32Array.from(n.modelview),u_projection:Float32Array.from(n.projection),u_time:n.time,u_cam_pos:n.camPos,u_velocityConeAperture:n.velocityConeAperture,u_velocity:n.velocity,u_horizontalOscillationRadius:n.horizontalOscillationRadius,u_horizontalOscillationRate:n.horizontalOscillationRate,u_boxSize:n.boxSize,u_billboardSize:n.billboardSize,u_simpleShapeParameters:n.simpleShapeParameters,u_screenSize:n.screenSize,u_thinningCenterPos:n.thinningCenterPos,u_thinningShape:n.thinningShape,u_thinningAffectedRatio:n.thinningAffectedRatio,u_thinningParticleOffset:n.thinningParticleOffset,u_particleColor:n.color,u_direction:n.direction},p=Math.round(m.intensity*this.particlesCount),f=i.du.simpleSegment(0,0,4*p,2*p),this.particlesVx&&this.particlesIdx&&I.draw(r,T.TRIANGLES,ii.disabled,ir.disabled,it.alphaBlended,ia.disabled,d,"snow_particles",this.particlesVx,this.particlesIdx,f),this._vignette.draw(r,g)}}let nz={symbol:function(r,a,n,o,s){if("translucent"!==r.renderPass)return;let l=ir.disabled,h=r.colorModeForRenderPass(),u=n.layout.get("text-variable-anchor"),c=n.layout.get("text-size-scale-range"),d=i.aC(r.scaleFactor,c[0],c[1]);u&&function(r,a,n,o,s,l,h,u){let c=a.transform,d="map"===s,p="map"===l;for(let a of r){let r=o.getTile(a),s=r.getBucket(n);if(!s||!s.text||!s.text.segments.get().length)continue;let l=i.bk(s.textSizeData,c.zoom,u),f=tA(a,s.getProjection(),c),m=c.calculatePixelsToTileUnitsMatrix(r),_=tD(f,r.tileID.canonical,p,d,c,s.getProjection(),m),g=s.hasIconTextFit()&&s.hasIconData();l&&function(r,a,n,o,s,l,h,u,c,d){let p=r.text.placedSymbolArray,f=r.text.dynamicLayoutVertexArray,m=r.icon.dynamicLayoutVertexArray,_={},g=r.getProjection(),y=tA(h,g,s),x=s.elevation,v=g.upVectorScale(h.canonical,s.center.lat,s.worldSize).metersToTile;f.clear();for(let m=0;m<p.length;m++){let b=p.get(m),{tileAnchorX:w,tileAnchorY:T,numGlyphs:S}=b,I=b.hidden||!b.crossTileID||r.allowVerticalPlacement&&!b.placedOrientation?null:o[b.crossTileID];if(I){let o=0,p=0,E=0,A="road"===r.elevationType;if(x||A){let a=A?r.getElevationFeatureForText(m):null,n=i.bv.getAtTileOffset(h,new i.P(w,T),x,a),[s,l,u]=g.upVector(h.canonical,w,T);o=n*s*v,p=n*l*v,E=n*u*v}let[C,M,P,D]=tz(b.projectedAnchorX+o,b.projectedAnchorY+p,b.projectedAnchorZ+E,n?y:l),R=tF(s.getCameraToCenterDistance(g),D),L=i.bm(r.textSizeData,c,b)*R/i.bz;n&&(L*=r.tilePixelRatio/u);let z=function({width:r,height:a,anchor:n,textOffset:o,textScale:s},l){let{horizontalAlign:h,verticalAlign:u}=i.bG(n),c=i.bH(n,o);return new i.P((-(h-.5)*r/s+c[0])*l,(-(u-.5)*a/s+c[1])*l)}(I,L);n?({x:C,y:M,z:P}=g.projectTilePoint(w+z.x,T+z.y,h.canonical),[C,M,P]=tz(C+o,M+p,P+E,l)):(a&&z._rotate(-s.angle),C+=z.x,M+=z.y,P=0);let F=r.allowVerticalPlacement&&b.placedOrientation===i.bl.vertical?Math.PI/2:0;for(let r=0;r<S;r++)i.bo(f,C,M,P,F);d&&b.associatedIconIndex>=0&&(_[b.associatedIconIndex]={x:C,y:M,z:P,angle:F})}else tG(S,f)}if(d){m.clear();let a=r.icon.placedSymbolArray;for(let r=0;r<a.length;r++){let n=a.get(r),{numGlyphs:o}=n,s=_[r];if(n.hidden||!s)tG(o,m);else{let{x:r,y:a,z:n,angle:l}=s;for(let s=0;s<o;s++)i.bo(m,r,a,n,l)}}r.icon.dynamicLayoutVertexBuffer.updateData(m)}r.text.dynamicLayoutVertexBuffer.updateData(f)}
111(s,d,p,h,c,_,a,Math.pow(2,c.zoom-r.tileID.overscaledZ),l,g)}}(o,r,n,a,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),s,d);let p=0!==n.paint.get("icon-opacity").constantOr(1),f=0!==n.paint.get("text-opacity").constantOr(1);void 0!==n.layout.get("symbol-sort-key").constantOr(1)&&(p||f)?aR(r,a,n,o,l,h):(p&&aR(r,a,n,o,l,h,{onlyIcons:!0}),f&&aR(r,a,n,o,l,h,{onlyText:!0})),a.map.showCollisionBoxes&&(aM(r,a,n,o,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),aM(r,a,n,o,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(r,a,n,o){if("translucent"!==r.renderPass)return;let s=n.paint.get("circle-opacity"),l=n.paint.get("circle-stroke-width"),h=n.paint.get("circle-stroke-opacity"),u=void 0!==n.layout.get("circle-sort-key").constantOr(1),c=n.paint.get("circle-emissive-strength");if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;let d=r.context,p=d.gl,f=r.transform,m=!(!r.terrain||!r.terrain.enabled),_=n.layout.get("circle-elevation-reference"),g=r.depthModeForSublayer(0,ii.ReadOnly),y=new ii(r.context.gl.LEQUAL,ii.ReadOnly,r.depthRangeFor3D),x="none"===_||m?g:y,v=ir.disabled,b=r.colorModeForDrapableLayerRenderPass(c),w="globe"===f.projection.name,T=[i.aH(f.center.lng),i.aL(f.center.lat)],S=[];for(let s=0;s<o.length;s++){let l=o[s],h=a.getTile(l),c=h.getBucket(n);if(!c||c.projection.name!==f.projection.name)continue;let d=c.programConfigurations.get(n.id),p=c.layoutVertexBuffer,m=c.globeExtVertexBuffer,_=c.indexBuffer,g=i.dO(n),y=[m],x=r.isTileAffectedByFog(l);w&&g.push("PROJECTION_GLOBE_VIEW"),g.push("DEPTH_D24"),r.terrain&&f.depthOcclusionForSymbolsAndCircles&&g.push("DEPTH_OCCLUSION"),c.hasElevation&&!r.terrain&&(g.push("ELEVATED_ROADS"),y.push(c.elevatedLayoutVertexBuffer));let v=r.getOrCreateProgram("circle",{config:d,defines:g,overrideFog:x}),b=f.projection.createInversionMatrix(f,l.canonical),I={programConfiguration:d,program:v,layoutVertexBuffer:p,dynamicBuffers:y,indexBuffer:_,uniformValues:i.dP(r,l,h,b,T,n),tile:h};if(u)for(let r of c.segments.get())S.push({segments:new i.du([r]),sortKey:r.sortKey,state:I});else S.push({segments:c.segments,sortKey:0,state:I})}u&&S.sort((i,r)=>i.sortKey-r.sortKey);let I={useDepthForOcclusion:f.depthOcclusionForSymbolsAndCircles};for(let i of S){let{programConfiguration:a,program:o,layoutVertexBuffer:s,dynamicBuffers:l,indexBuffer:h,uniformValues:u,tile:c}=i.state,m=i.segments;r.terrain&&r.terrain.setupElevationDraw(c,o,I),r.uploadCommonUniforms(d,o,c.tileID.toUnwrapped()),o.draw(r,p.TRIANGLES,x,v,b,ia.disabled,u,n.id,s,h,m,n.paint,f.zoom,a,l)}},heatmap:function(r,a,n,o){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===r.renderPass){let s=r.context,l=s.gl,h=ir.disabled,u=new it([l.ONE,l.ONE,l.ONE,l.ONE],i.aq.transparent,[!0,!0,!0,!0]),c="globe"===r.transform.projection.name?.5:.25;n.heatmapFbo=aA.createWithTexture(s,n.heatmapFbo,r.width*c,r.height*c),s.clear({color:i.aq.transparent});let d=r.transform,p="globe"===d.projection.name,f=p?["PROJECTION_GLOBE_VIEW"]:[],m=p?ia.frontCCW:ia.disabled,_=[i.aH(d.center.lng),i.aL(d.center.lat)];for(let i=0;i<o.length;i++){let c=o[i];if(a.hasRenderableParent(c))continue;let g=a.getTile(c),y=g.getBucket(n);if(!y||y.projection.name!==d.projection.name)continue;let x=r.isTileAffectedByFog(c),v=y.programConfigurations.get(n.id),b=r.getOrCreateProgram("heatmap",{config:v,defines:f,overrideFog:x}),{zoom:w}=r.transform;r.terrain&&r.terrain.setupElevationDraw(g,b),r.uploadCommonUniforms(s,b,c.toUnwrapped());let T=d.projection.createInversionMatrix(d,c.canonical);b.draw(r,l.TRIANGLES,ii.disabled,h,u,m,ah(r,c,g,T,_,w,n.paint.get("heatmap-intensity")),n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,r.transform.zoom,v,p?[y.globeExtVertexBuffer]:null)}s.viewport.set([0,0,r.width,r.height])}else"translucent"===r.renderPass&&(r.context.setColorMode(r.colorModeForRenderPass()),function(r,a){let n=r.context,o=n.gl,s=a.heatmapFbo;if(!s)return;n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,s.colorAttachment0.get()),n.activeTexture.set(o.TEXTURE1);let l=a.colorRampTexture;l||(l=a.colorRampTexture=new i.T(n,a.colorRamp,o.RGBA8)),l.bind(o.LINEAR,o.CLAMP_TO_EDGE),r.getOrCreateProgram("heatmapTexture").draw(r,o.TRIANGLES,ii.disabled,ir.disabled,r.colorModeForRenderPass(),ia.disabled,{u_image:0,u_color_ramp:1,u_opacity:a.paint.get("heatmap-opacity")},a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,a.paint,r.transform.zoom)}(r,n))},line:function(i,r,a,n){let o=a.paint.get("line-opacity"),s=a.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;let l=a.paint.get("line-blend-mode");if("default"!==l&&"globe"!==i.transform.projection.name){let o,s,h,u,c,d,p;return i.terrain&&i.terrain.renderingToTexture?void function(i,r,a,n,o){if("translucent"!==i.renderPass)return;let s=i.context,l=s.gl,h=i.terrain;if(!h)return;let u=s.bindFramebuffer.current,c="mrt-fallback"===i.emissiveMode;a.lineBlendDrapeFbo=aA.createWithTexture(s,a.lineBlendDrapeFbo,h.drapeBufferSize[0],h.drapeBufferSize[1],!0),a.lineBlendDrapeStencil=a.lineBlendDrapeFbo._stencilRbo,c&&l.drawBuffers([l.COLOR_ATTACHMENT0]),s.clear({color:aF[o].clearColor,depth:1,stencil:0});let d=i.currentStencilSource,p=i._tileClippingMaskIDs,f=i.nextStencilID;i.currentStencilSource=void 0,i._tileClippingMaskIDs={},i.nextStencilID=1;let m=i._terrain;
111i._terrain=null,i._renderTileClippingMasks(a,r,n),az(i,r,a,n,aF[o].colorMode,!0),i._terrain=m,i.currentStencilSource=d,i._tileClippingMaskIDs=p,i.nextStencilID=f,s.bindFramebuffer.set(u),c&&l.drawBuffers([l.COLOR_ATTACHMENT0,l.COLOR_ATTACHMENT1]);let _=h.drapeBufferSize;s.viewport.set([0,0,_[0],_[1]]);let g=a.lineBlendDrapeFbo;if(!g)return;s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,g.colorAttachment0.get());let y="additive"===o?1:a.paint.get("line-opacity").constantOr(1),x=a.paint.get("line-emissive-strength").constantOr(0),v="additive"===o?i.colorModeForDrapableLayerRenderPass(x):aF[o].colorMode;i.getOrCreateProgram("lineBlendComposite").draw(i,l.TRIANGLES,ii.disabled,ir.disabled,v,ia.disabled,at(0,y,aF[o].compositeUniformValue),a.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,a.paint,i.transform.zoom)}(i,r,a,n,l):"offscreen"===i.renderPass?void(o=i.context,s=Math.ceil(i.width),h=Math.ceil(i.height),a.lineBlendFbo=aA.createWithTexture(o,a.lineBlendFbo,s,h,!0),a.lineBlendStencil=a.lineBlendFbo._stencilRbo,o.clear({color:aF[l].clearColor,depth:1,stencil:0}),u=i.currentStencilSource,c=i._tileClippingMaskIDs,d=i.nextStencilID,i.currentStencilSource=void 0,i._tileClippingMaskIDs={},i.nextStencilID=1,i._renderTileClippingMasks(a,r,n),p=i.renderPass,i.renderPass="translucent",az(i,r,a,n,aF[l].colorMode),i.renderPass=p,i.currentStencilSource=u,i._tileClippingMaskIDs=c,i.nextStencilID=d,o.viewport.set([0,0,i.width,i.height])):"translucent"===i.renderPass?void function(i,r,a){let n=i.context,o=n.gl,s=r.lineBlendFbo;if(!s)return;n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,s.colorAttachment0.get());let l="additive"===a?1:r.paint.get("line-opacity").constantOr(1),h="additive"===a?i.colorModeForDrapableLayerRenderPass(r.paint.get("line-emissive-strength").constantOr(0)):aF[a].colorMode;i.getOrCreateProgram("lineBlendComposite").draw(i,o.TRIANGLES,ii.disabled,ir.disabled,h,ia.disabled,at(0,l,aF[a].compositeUniformValue),r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom)}(i,a,l):void 0}"translucent"===i.renderPass&&az(i,r,a,n)},fill:function(r,a,n,o){let s=n.paint.get("fill-color"),l=n.paint.get("fill-opacity");if(0===l.constantOr(1))return;let h=n.paint.get("fill-emissive-strength"),u=r.colorModeForDrapableLayerRenderPass(h),c=n.paint.get("fill-pattern"),d=r.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===s.constantOr(i.aq.transparent).a&&1===l.constantOr(0)?"opaque":"translucent",p="none";"none"!==n.layout.get("fill-elevation-reference")?p="road":0!==n.paint.get("fill-z-offset").constantOr(1)&&(p="offset");let f=!(!r.terrain||!r.terrain.enabled),m={painter:r,sourceCache:a,layer:n,coords:o,colorMode:u,elevationType:p,terrainEnabled:f,pass:d};if("shadow"===r.renderPass)return void(r.shadowRenderer&&"road"===p&&!f&&function(i){let{painter:r,sourceCache:a,layer:n,coords:o}=i,s=r.context.gl,l=i.painter.shadowRenderer;for(let i of o){let o=a.getTile(i),h=o.getBucket(n);if(!h)continue;let u=h.elevatedStructures;if(!u||!u.shadowCasterSegments||0===u.shadowCasterSegments.segments[0].primitiveLength)continue;r.prepareDrawTile();let c=h.bufferData.programConfigurations.get(n.id),d=r.isTileAffectedByFog(i),p=r.getOrCreateProgram("elevatedStructuresDepth",{config:c,overrideFog:d}),f=l.calculateShadowPassMatrixFromTile(o.tileID.toUnwrapped());r.uploadCommonUniforms(r.context,p,i.toUnwrapped());let m=r9(f,0);p.draw(r,s.TRIANGLES,l.getShadowPassDepthMode(),ir.disabled,it.disabled,ia.disabled,m,n.id,u.vertexBuffer,u.indexBuffer,u.shadowCasterSegments,n.paint,r.transform.zoom,c)}}(m));let _="mrt-fallback"===r.emissiveMode;if("offset"!==p){if(ak(m,!1,_),"road"===p){let i=!f&&"translucent"===r.renderPass;i&&aB(r,a,n,o,"geometry"),ak(m,!0,_,ir.disabled),i&&function(i){let{painter:r,sourceCache:a,layer:n,coords:o,colorMode:s}=i,l=r.context.gl,h=i.painter.shadowRenderer,u=!!h&&h.enabled,c=new ii(r.context.gl.LEQUAL,ii.ReadOnly,r.depthRangeFor3D),d=[0,0,0];if(u){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(d=ib(r.style,i,a))}let p=i=>{for(let p of o){let o,f,m=a.getTile(p),_=m.getBucket(n);if(!_)continue;let g=_.elevatedStructures;if(!g||(i?(o=g.renderableBridgeSegments,f=g.bridgeProgramConfigurations.get(n.id)):(o=g.renderableTunnelSegments,f=g.tunnelProgramConfigurations.get(n.id)),!o||0===o.segments[0].primitiveLength))continue;f.updatePaintBuffers(),r.prepareDrawTile();let y=r.isTileAffectedByFog(p),x=[];u&&x.push("RENDER_SHADOWS","NORMAL_OFFSET");let v=r.getOrCreateProgram("elevatedStructures",{config:f,overrideFog:y,defines:x}),b=r.translatePosMatrix(p.projMatrix,m,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));u&&h.setupShadows(m.tileID.toUnwrapped(),v,"vector-tile");let w=r7(b,d);r.uploadCommonUniforms(r.context,v,p.toUnwrapped()),v.draw(r,l.TRIANGLES,c,ir.disabled,s,ia.backCCW,w,n.id,g.vertexBuffer,g.indexBuffer,o,n.paint,r.transform.zoom,f,[g.vertexBufferNormal])}};p(!0),p(!1)}(m)}}else ak(m,!1,_,r.stencilModeFor3D())},"fill-extrusion":function(r,a,n,o){let s=n.paint.get("fill-extrusion-opacity"),l=r.context,h=l.gl,u=r.terrain,c=u&&u.renderingToTexture;if(0===s)return;let d="mrt-fallback"===r.emissiveMode,p=r.conflationActive&&r.style.isLayerClipped(n,a.getSource()),f=r.style.order.indexOf(n.fqid);if(p&&function(i,r,a,n,o){for(let s of n){let n=r.getTile(s).getBucket(a);n&&(n.updateReplacement(s,i.replacementSource,o),n.uploadCentroid(i.context))}}(r,a,n,o,f),u||p)for(let s of o){let o=a.getTile(s).getBucket(n);o&&function(r,a,n,o,s,l,h){0===o.centroidVertexArray.length&&o.createCentroidsBuffer();let u=l?l.findDEMTileFor(n):null;if(!(u&&u.dem||h))return;l&&u&&u.dem&&o.selfDEMTileTimestamp!==u.dem._timestamp&&(o.borderDoneWithNeighborZ=[-1,-1,-1,-1],o.selfDEMTileTimestamp=u.dem._timestamp);let c=(r,a)=>{(r.flags|a.flags)&i.d$?(r.flags|=i.d$,a.flags|=i.d$):(r.flags&=~i.d$,a.flags&=~i.d$)},d=r=>new i.P(Math.ceil((r+i.e0)*i.e1),0),p=(r,a,n)=>{let o=Math.ceil((r+i.e0)*i.e1),s=Math.floor(Math.max(0,Math.min(i.an-1,n))/4);return new i.P(o,s<<5|(3&a)<<3|7)},f=i=>{let r=a.getSource().minzoom,n=i=>{let r=a.getTileByID(i);if(r&&r.hasData())return r.getBucket(s)};
111for(let a of[0,-1,1]){if(i.overscaledZ+a<r)continue;let o=n(i.calculateScaledKey(i.overscaledZ+a));if(o)return o}},m=[0,0,0],_=(r,a)=>(m[0]=Math.min(r.min.y,a.min.y),m[1]=Math.max(r.max.y,a.max.y),m[2]=i.an-a.min.x>r.max.x?a.min.x-i.an:r.max.x,m),g=(r,a)=>(m[0]=Math.min(r.min.x,a.min.x),m[1]=Math.max(r.max.x,a.max.x),m[2]=i.an-a.min.y>r.max.y?a.min.y-i.an:r.max.y,m),y=[(i,r)=>_(i,r),(i,r)=>_(r,i),(i,r)=>g(i,r),(i,r)=>g(r,i)],x=(r,a,o,s,h,c,d)=>{if(!l)return 0;let p=[[c?o:r,c?r:o,0],[c?o:a,c?a:o,0]],f=d<0?i.an+d:d,m=[c?f:(r+a)/2,c?(r+a)/2:f,0];return 0===o&&d<0||0!==o&&d>0?l.getForTilePoints(h,[m],!0,s):p.push(m),l.getForTilePoints(n,p,!0,u),Math.max(p[0][2],p[1][2],m[2])/l.exaggeration()};for(let r=0;r<4;r++){let a=o.borderFeatureIndices[r];if(0===a.length)continue;let s=i.dX[r](n),u=f(s);if(!(u&&u instanceof i.dY))continue;let m=l?l.findDEMTileFor(s):null;if(!(m&&m.dem||h)||(l&&m&&m.dem&&o.borderDEMTileTimestamp[r]!==m.dem._timestamp&&(o.borderDoneWithNeighborZ[r]=-1,o.borderDEMTileTimestamp[r]=m.dem._timestamp),o.borderDoneWithNeighborZ[r]===u.canonical.z))continue;0===u.centroidVertexArray.length&&u.createCentroidsBuffer();let _=(r<2?1:5)-r,g=u.borderDoneWithNeighborZ[_]!==o.canonical.z,v=u.borderFeatureIndices[_],b=0;if(o.canonical.z!==u.canonical.z){for(let i of a)o.showCentroid(o.featuresOnBorder[i]);if(g)for(let i of v)u.showCentroid(u.featuresOnBorder[i]);o.borderDoneWithNeighborZ[r]=u.canonical.z,u.borderDoneWithNeighborZ[_]=o.canonical.z;continue}let w=new Map,T=new Set,S=new Set;for(let i=0;i<v.length;i++){let r=u.featuresOnBorder[v[i]];void 0!==r.buildingId&&w.set(r.buildingId,i)}for(let n of a){let a=o.featuresOnBorder[n],l=o.centroidData[a.centroidDataIndex];if(void 0===a.buildingId)continue;let d=w.get(a.buildingId);if(void 0===d)continue;let f=u.featuresOnBorder[v[d]],g=u.centroidData[f.centroidDataIndex];T.add(n),S.add(d),h&&c(l,g);let b=0!==l.groupCentroidPos.x||0!==l.groupCentroidPos.y?l.groupCentroidPos:a.centroid(),I=0!==g.groupCentroidPos.x||0!==g.groupCentroidPos.y?g.groupCentroidPos:f.centroid(),E=r<2?Math.round((b.y+I.y)/2):Math.round((b.x+I.x)/2),A=a.intersectsCount()>1||f.intersectsCount()>1;{let a=0;if(m&&m.dem&&!A){let n=y[r](l,g),o=r%2?i.an-1:0;a=x(n[0],Math.min(i.an-1,n[1]),o,m,s,r<2,n[2])}l.centroidXY=p(a,r,E),g.centroidXY=p(a,_,E)}if(o.writeCentroidToBuffer(l),u.writeCentroidToBuffer(g),void 0!==a.buildingId){for(let i of o.centroidData)i.buildingId===a.buildingId&&i!==l&&(i.centroidXY=l.centroidXY,o.writeCentroidToBuffer(i));for(let i of u.centroidData)i.buildingId===a.buildingId&&i!==g&&(i.centroidXY=g.centroidXY,u.writeCentroidToBuffer(i))}}for(let n of a){let a;if(T.has(n))continue;let l=o.featuresOnBorder[n],p=o.centroidData[l.centroidDataIndex],f=l.borders[r];for(;b<v.length;){if(S.has(b)){b++;continue}let i=(a=u.featuresOnBorder[v[b]]).borders[_];if(i[1]>f[0]+3||i[0]>f[0]-3)break;u.showCentroid(a),b++}if(a&&b<v.length){let n=b,g=0;for(;;)if(S.has(b)){if(++b===v.length)break;a=u.featuresOnBorder[v[b]]}else{if(a.borders[_][0]>f[1]-3||(g++,++b===v.length))break;a=u.featuresOnBorder[v[b]]}for(;n<v.length&&S.has(n);)n++;if(n>=v.length){o.showCentroid(l);continue}a=u.featuresOnBorder[v[n]];let w=!1;if(g>=1){let i=a.borders[_];3>Math.abs(f[0]-i[0])&&3>Math.abs(f[1]-i[1])&&(g=1,w=!0,b=n+1)}else if(0===g){o.showCentroid(l);continue}let T=u.centroidData[a.centroidDataIndex];h&&w&&c(p,T);let I=l.intersectsCount()>1||a.intersectsCount()>1;if(g>1)b=n,p.centroidXY=T.centroidXY=new i.P(0,0);else if(m&&m.dem&&!I){let a=y[r](p,T),n=r%2?i.an-1:0;p.centroidXY=T.centroidXY=d(x(a[0],Math.min(i.an-1,a[1]),n,m,s,r<2,a[2]))}else I?p.centroidXY=T.centroidXY=new i.P(0,0):(p.centroidXY=o.encodeBorderCentroid(l),T.centroidXY=u.encodeBorderCentroid(a));o.writeCentroidToBuffer(p),u.writeCentroidToBuffer(T)}else o.showCentroid(l)}o.borderDoneWithNeighborZ[r]=u.canonical.z,u.borderDoneWithNeighborZ[_]=o.canonical.z}(o.needsCentroidUpdate||!o.centroidVertexBuffer&&0!==o.centroidVertexArray.length)&&o.uploadCentroid(r)}(r.context,a,s,o,n,u,p)}if("shadow"===r.renderPass&&r.shadowRenderer){if(u&&s<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.af)return;let l=r.shadowRenderer.getShadowPassDepthMode();aV(r,a,n,o,l,ir.disabled,it.disabled,p)}else if("translucent"===r.renderPass){let f=!n.paint.get("fill-extrusion-pattern").constantOr(1),m=n.paint.get("fill-extrusion-color").constantOr(i.aq.white);if(!c&&0!==m.a){let i=new ii(r.context.gl.LEQUAL,ii.ReadWrite,r.depthRangeFor3D);1===s&&f?aV(r,a,n,o,i,ir.disabled,it.unblended,p):(aV(r,a,n,o,i,ir.disabled,it.disabled,p),aV(r,a,n,o,i,r.stencilModeFor3D(),r.colorModeForRenderPass(),p),r.resetStencilClippingMasks())}if(r.style.enable3dLights()&&f&&(!u&&"globe"!==r.transform.projection.name||c)){let s=n.paint.get("fill-extrusion-opacity"),f=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),m=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),_=n.paint.get("fill-extrusion-flood-light-intensity"),g="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").
111constantOr("default"),y=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(g?null:n.lut).toArray01().slice(0,3),x=f>0&&m>0,v=_>0,b=(i,r,a)=>(1-a)*i+a*r,w=new aN;w.translate=n.paint.get("fill-extrusion-translate"),w.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),w.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),w.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");let T=l=>{let u=r.depthModeForSublayer(1,ii.ReadOnly,h.LEQUAL,!0),c=b(.1,3,n.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation")),d=r._showOverdrawInspector;d||aj(w,r,a,n,o,u,new ir({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),new it([h.ONE,h.ONE,h.ONE,h.ONE],i.aq.transparent,[!1,!1,!1,!0],h.MIN),ia.disabled,l,"sdf",s,f,m,_,y,c,p,!1);{let g=d?ir.disabled:new ir({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),x=d?r.colorModeForRenderPass():new it([h.ONE_MINUS_DST_ALPHA,h.DST_ALPHA,h.ONE,h.ONE],i.aq.transparent,[!0,!0,!0,!0]);aj(w,r,a,n,o,u,g,x,ia.disabled,l,"color",s,f,m,_,y,c,p,!1)}};if(c){let c=()=>{let r=u.drapeBufferSize[0],a=u.drapeBufferSize[1],n=u.framebufferCopyTexture;return n&&(!n||n.size[0]===r&&n.size[1]===a)||(n&&n.destroy(),n=u.framebufferCopyTexture=new i.T(l,new i.q({width:r,height:a}),h.RGBA8)),n.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,0,0,r,a),n},g=(l,u,g)=>{let x=r.depthModeForSublayer(1,ii.ReadOnly,h.LEQUAL,!1),v=b(.1,3,n.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"));{let c=new it([h.ONE,h.ONE,h.ONE,h.ONE],i.aq.transparent,[!1,!1,!1,!0]);aj(w,r,a,n,o,x,ir.disabled,c,ia.disabled,l,"clear",s,f,m,_,y,v,p,u)}aj(w,r,a,n,o,x,new ir({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),new it([h.ONE,h.ONE,h.ONE,h.ONE],i.aq.transparent,[!1,!1,!1,!0],h.MIN),ia.disabled,l,"sdf",s,f,m,_,y,v,p,u),d&&!l&&(g=c());{let c=l?h.ZERO:h.ONE_MINUS_DST_ALPHA;aj(w,r,a,n,o,x,new ir({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),new it([c,h.DST_ALPHA,h.ONE_MINUS_DST_ALPHA,h.ZERO],i.aq.transparent,[!0,!0,!0,!0]),ia.disabled,l,"color",s,f,m,_,y,v,p,u)}if(!d||l){let c=new it([h.ONE,h.ONE,h.ONE,l?h.ZERO:h.ONE],i.aq.transparent,[!1,!1,!1,!0],l?h.FUNC_ADD:h.MAX);aj(w,r,a,n,o,x,ir.disabled,c,ia.disabled,l,"clear",s,f,m,_,y,v,p,u,g)}else h.drawBuffers([h.NONE,h.COLOR_ATTACHMENT1]),aj(w,r,a,n,o,x,new ir({func:h.EQUAL,mask:255},254,255,h.KEEP,h.DECR,h.DECR),new it([h.ONE,h.ONE,h.ONE,h.ONE],i.aq.transparent,[!0,!1,!1,!1],h.MAX),ia.disabled,l,"emissive",s,f,m,_,y,v,p,u,g),h.drawBuffers([h.COLOR_ATTACHMENT0])};if(x||v){let i;r.prepareDrawTile(),d&&!x||(i=c()),x&&g(!0,!1,i),v&&g(!1,!0,i)}}else x&&T(!0),v&&T(!1),(x||v)&&r.resetStencilClippingMasks()}}},building:function(i,r,a,n){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);let o=a.paint.get("building-ambient-occlusion-ground-intensity"),s=a.paint.get("building-ambient-occlusion-ground-radius"),l=a.paint.get("building-ambient-occlusion-ground-attenuation"),h=a.paint.get("building-opacity");if(h<=0)return;let u=o>0&&s>0,c=!0,d=a.paint.get("building-vertical-scale");if(d<=0)return;i.shadowRenderer||(c=!1);let p=i.conflationActive&&i.style.isLayerClipped(a,r.getSource()),f=i.style.order.indexOf(a.fqid);if(function(i,r,a,n,o,s){for(let l of s){let s=r.getTile(l).getBucket(a);s&&(o&&s.updateReplacement(l,i.replacementSource,n),s.uploadUpdatedIndexBuffer(i.context))}}(i,r,a,f,p,n),function(i,r,a,n){for(let o of n){let n=r.getTile(o).getBucket(a);n&&n.needsEvaluation()&&n.uploadUpdatedColorBuffer(i.context)}}(i,r,a,n),a.resetLayerRenderingStats(i),i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!0),"shadow"===i.renderPass&&i.shadowRenderer){let o=i.shadowRenderer.getShadowPassDepthMode();aZ({painter:i,source:r,layer:a,coords:n,defines:[],blendMode:it.disabled,depthMode:o,opacity:h,verticalScale:d,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if("translucent"===i.renderPass){let f=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];c&&(f=f.concat("RENDER_SHADOWS")),i.shadowRenderer&&i.shadowRenderer.useNormalOffset&&(f=f.concat("NORMAL_OFFSET"));let m=a.paint.get("building-facade-emissive-chance"),_=a.paint.get("building-ambient-occlusion-intensity"),g=a.paint.get("building-flood-light-intensity"),y="none"===a.paint.get("building-flood-light-color-use-theme").
111constantOr("default"),x=a.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(y?null:a.lut).toArray01().slice(0,3),v=a.paint.get("building-flood-light-ground-attenuation"),b=g>0,w=new ii(i.context.gl.LEQUAL,ii.ReadWrite,i.depthRangeFor3D);h<1&&aZ({painter:i,source:r,layer:a,coords:n,defines:f,blendMode:it.disabled,depthMode:w,opacity:h,verticalScale:d,facadeEmissiveChance:m,facadeAOIntensity:_,floodLightIntensity:g,floodLightColor:x,depthOnly:!0});let T=i.colorModeForRenderPass();aZ({painter:i,source:r,layer:a,coords:n,defines:f,blendMode:T,depthMode:w,opacity:h,verticalScale:d,facadeEmissiveChance:m,facadeAOIntensity:_,floodLightIntensity:g,floodLightColor:x});let S=a.paint.get("building-front-cutoff");aU(i.transform.pitch,S,!!i.terrain),u&&aW(i,r,a,n,!0,h,o,s,g,x,l,p),b&&aW(i,r,a,n,!1,h,o,s,g,x,v,p)}else if("light-beam"===i.renderPass){let o=new ii(i.context.gl.LEQUAL,ii.ReadOnly,i.depthRangeFor3D);aZ({painter:i,source:r,layer:a,coords:n,defines:["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],blendMode:it.alphaBlended,depthMode:o,opacity:h,verticalScale:d,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!1),i.resetStencilClippingMasks()},hillshade:function(r,a,n,o){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass||r.style.disableElevatedTerrain)return;let s=r.context,l=r.terrain&&r.terrain.renderingToTexture,[h,u]="translucent"!==r.renderPass||l?[{},o]:r.stencilConfigForOverlap(o);for(let o of u){let s=a.getTile(o);if(s.needsHillshadePrepare&&"offscreen"===r.renderPass)!function(r,a,n){var o;let s,l,h=r.context,u=h.gl;if(!a.dem)return;let c=a.dem;if(h.activeTexture.set(u.TEXTURE1),i9(r,a,c),!a.demTexture)return;a.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);let d=c.dim;h.activeTexture.set(u.TEXTURE0);let p=a.hillshadeFBO;if(!p){let r=new i.T(h,{width:d,height:d,data:null},u.RGBA8);r.bind(u.LINEAR,u.CLAMP_TO_EDGE),(p=a.hillshadeFBO=h.createFramebuffer(d,d,1,"renderbuffer")).colorAttachment0.set(r.texture)}h.bindFramebuffer.set(p.framebuffer),h.viewport.set([0,0,d,d]);let{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=r.getMercatorTileBoundsBuffers(),g=[];r.linearFloatFilteringSupported()&&g.push("TERRAIN_DEM_FLOAT_FORMAT"),r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&g.push("USE_MRT1"),r.getOrCreateProgram("hillshadePrepare",{defines:g}).draw(r,u.TRIANGLES,ii.disabled,ir.disabled,it.unblended,ia.disabled,(o=a.tileID,s=c.stride,l=i.bc(),i.bU(l,0,i.an,-i.an,0,0,1),i.by(l,l,[0,-i.an,0]),{u_matrix:l,u_image:1,u_dimension:[s,s],u_zoom:o.overscaledZ}),n.id,f,m,_),a.needsHillshadePrepare=!1}(r,s,n);else if("translucent"===r.renderPass){let a=r.depthModeForSublayer(0,ii.ReadOnly),u=n.paint.get("hillshade-emissive-strength"),c=r.colorModeForDrapableLayerRenderPass(u),d=l&&r.terrain?r.terrain.stencilModeForRTTOverlap(o):h[o.overscaledZ];!function(r,a,n,o,s,l,h){let u=r.context,c=u.gl,d=n.hillshadeFBO;if(!d)return;r.prepareDrawTile();let p=r.isTileAffectedByFog(a),f=[];r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&f.push("USE_MRT1");let m=r.getOrCreateProgram("hillshade",{overrideFog:p,defines:f});u.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,d.colorAttachment0.get());let _=((r,a,n,o)=>{var s;let l,h,u=n.paint.get("hillshade-shadow-color"),c="none"===n.paint.get("hillshade-shadow-color-use-theme").constantOr("default"),d=n.paint.get("hillshade-highlight-color"),p="none"===n.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),f=n.paint.get("hillshade-accent-color"),m="none"===n.paint.get("hillshade-accent-color-use-theme").constantOr("default"),_=n.paint.get("hillshade-emissive-strength"),g=i.ap(n.paint.get("hillshade-illumination-direction"));if("viewport"===n.paint.get("hillshade-illumination-anchor"))g-=r.transform.angle;else if(r.style&&r.style.enable3dLights()&&r.style.directionalLight){let a=r.style.directionalLight.properties.get("direction"),n=i.cL(a.x,a.y,a.z);g=i.ap(n[1])}let y=!r.options.moving;return{u_matrix:o||r.transform.calculateProjMatrix(a.tileID.toUnwrapped(),y),u_image:0,u_latrange:(l=Math.pow(2,(s=a.tileID).canonical.z),h=s.canonical.y,[new i.ag(0,h/l).toLngLat().lat,new i.ag(0,(h+1)/l).toLngLat().lat]),u_light:[n.paint.get("hillshade-exaggeration"),g],u_shadow:u.toPremultipliedRenderColor(c?null:n.lut),u_highlight:d.toPremultipliedRenderColor(p?null:n.lut),u_emissive_strength:_,u_accent:f.toPremultipliedRenderColor(m?null:n.lut)}})(r,n,o,r.terrain?a.projMatrix:null);r.uploadCommonUniforms(u,m,a.toUnwrapped());let{tileBoundsBuffer:g,tileBoundsIndexBuffer:y,tileBoundsSegments:x}=r.getTileBoundsBuffers(n);m.draw(r,c.TRIANGLES,s,l,h,ia.disabled,_,o.id,g,y,x)}(r,o,s,n,a,d,c)}}s.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,a,n,o,s,l){if("translucent"!==r.renderPass)return;let h=n.paint.get("raster-opacity");if(0===h)return;let u="globe"===r.transform.projection.name,c=0!==n.paint.get("raster-elevation"),d=c&&u,p=r.terrain&&r.terrain.exaggeration()>0&&c&&"ground"===n.paint.get("raster-elevation-reference"),f=!u&&p;if(r.renderElevatedRasterBackface&&!d)return;let m=r.context,_=m.gl,g=a.getSource(),y=function(r,a,n,o,s){let l=a.paint.get("raster-color"),h="raster-array"===r.type,u=[],c=a.paint.get("raster-resampling"),d=a.paint.get("raster-color-mix"),p=a.paint.get("raster-color-range"),f=[d[0],d[1],d[2],0],m=d[3],_="nearest"===c?o.NEAREST:o.LINEAR;if(h&&(u.push("RASTER_ARRAY"),l||u.push("RASTER_COLOR"),"linear"===c&&u.push("RASTER_ARRAY_LINEAR"),_=o.NEAREST,!p&&r.rasterLayers)){let i=r.rasterLayers.find(({id:i})=>i===a.sourceLayer);i&&i.fields&&i.fields.range&&(p=i.fields.range)}if(p=p||[0,1],l){u.push("RASTER_COLOR"),n.activeTexture.set(o.TEXTURE2),a.updateColorRamp(p);let r=a.colorRampTexture;r||(r=a.colorRampTexture=new i.T(n,a.colorRamp,o.RGBA8)),r.bind(_,o.CLAMP_TO_EDGE)}return s&&u.push("USE_MRT1"),{mix:f,range:p,offset:m,defines:u,resampling:_}}(g,n,m,_,r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode);if(g instanceof i.aW&&!o.length&&!u)return;let x=n.paint.get("raster-emissive-strength"),v=r.colorModeForDrapableLayerRenderPass(x),b=r.terrain&&r.terrain.renderingToTexture,w=!r.options.moving,T="nearest"===n.paint.get("raster-resampling")?_.NEAREST:_.LINEAR;if(g instanceof i.aW&&!o.length&&(g.onNorthPole||g.onSouthPole)){let i=c?r.stencilModeFor3D():ir.disabled;return void aY(!!g.onNorthPole,null,r,a,n,x,y,ia.disabled,i)}if(!o.length)return;let[S,I]=g instanceof i.aW||b?[{},o]:r.stencilConfigForOverlap(o),E=I[I.length-1].overscaledZ;d&&y.defines.push("PROJECTION_GLOBE_VIEW"),c&&y.defines.push("RENDER_CUTOFF","ELEVATED"),p&&y.defines.push("ELEVATION_REFERENCE_GROUND");let A=(o,s,I)=>{for(let A of o){let o,C,M,P,D,R=A.toUnwrapped(),L=a.getTile(A);if(b&&(!L||!L.hasData()))continue;m.activeTexture.set(_.TEXTURE0);let z=function(i,r,a,n){if(i)return r instanceof to&&i instanceof td?r.getTextureDescriptor(i,a,!0):{texture:i.texture,mix:aX(n.mix),offset:n.offset,buffer:0,tileSize:1}}(L,g,n,y);if(!z||!z.texture)continue;let{texture:F,mix:O,offset:B,tileSize:k,buffer:V}=z;b?(o=ii.disabled,C=A.projMatrix):c?(o=new ii(_.LEQUAL,ii.ReadWrite,r.depthRangeFor3D),C=u?Float32Array.from(r.transform.expandedFarZProjMatrix):r.transform.calculateProjMatrix(R,w)):(o=r.depthModeForSublayer(A.overscaledZ-E,1===h?ii.ReadWrite:ii.ReadOnly,_.LESS),C=r.transform.calculateProjMatrix(R,w));let N=r.terrain&&b?r.terrain.stencilModeForRTTOverlap(A):S[A.overscaledZ],U=l?0:n.paint.get("raster-fade-duration");L.registerFadeDuration(U);let j=a.findLoadedParent(A,0),G=rq(L,j,a,r.transform,U);!G.isFading&&L.refreshedUponExpiration&&(L.refreshedUponExpiration=!1),r.terrain&&r.terrain.prepareDrawTile(),m.activeTexture.set(_.TEXTURE0),F.bind(T,_.CLAMP_TO_EDGE),m.activeTexture.set(_.TEXTURE1),j?(j.texture&&j.texture.bind(T,_.CLAMP_TO_EDGE),M=Math.pow(2,j.tileID.overscaledZ-L.tileID.overscaledZ
111),P=[L.tileID.canonical.x*M%1,L.tileID.canonical.y*M%1]):F.bind(T,_.CLAMP_TO_EDGE),"useMipmap"in F&&m.extTextureFilterAnisotropic&&r.transform.pitch>20&&_.texParameterf(_.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax);let q=r.transform,$=c?function(i){if(i.isOrthographic)return[0,0,0,0];let r=i._nearZ,a=i.projection.farthestPixelDistance(i),n=a-r,o=.2*i.height,s=r+o;return[r,a,(s-o-r)/n,(s-r)/n]}(q):[0,0,0,0],H,Z,W,X,Y,K=0;if(d&&g instanceof i.aW&&g.coordinates.length>3)H=Float32Array.from(i.dq(i.dr(new i.ci(0,0,0)))),Z=Float32Array.from(q.globeMatrix),W=Float32Array.from(i.dl(q)),X=[i.aH(q.center.lng),i.aL(q.center.lat)],D=g.elevatedGlobePerspectiveTransform,Y=g.elevatedGlobeGridMatrix||new Float32Array(9);else if(d){let r=i.dm(A.canonical);K=i.dn(r.getCenter().lat),H=Float32Array.from(i.dq(i.dr(A.canonical))),Z=Float32Array.from(q.globeMatrix),W=Float32Array.from(i.dl(q)),X=[i.aH(q.center.lng),i.aL(q.center.lat)],D=[0,0],Y=Float32Array.from(i.dp(A.canonical,r,K,q.worldSize/q._pixelsPerMercatorPixel))}else D=g instanceof i.aW?g.perspectiveTransform:[0,0],H=new Float32Array(16),Z=new Float32Array(9),W=new Float32Array(16),X=[0,0],Y=new Float32Array(9);let J=ad(r,C,H,Z,W,Y,P||[0,0],i.al(r.transform.zoom),X,$,M||1,G,n,D,c?n.paint.get("raster-elevation"):0,2,O,B,y.range,k,V,x),Q=r.isTileAffectedByFog(A),ee=r.getOrCreateProgram("raster",{defines:y.defines,overrideFog:Q});if(r.uploadCommonUniforms(m,ee,R),g instanceof i.aW){let a=g.elevatedGlobeVertexBuffer,l=g.elevatedGlobeIndexBuffer;if(b||!u)g.boundsBuffer&&g.boundsSegments&&ee.draw(r,_.TRIANGLES,o,ir.disabled,v,ia.disabled,J,n.id,g.boundsBuffer,r.quadTriangleIndexBuffer,g.boundsSegments);else if(a&&l){let h=q.zoom<=i.cF?g.elevatedGlobeSegments:g.getSegmentsForLongitude(q.center.lng);h&&ee.draw(r,_.TRIANGLES,o,ir.disabled,v,s,J,n.id,a,l,h)}}else if(d){o=new ii(_.LEQUAL,ii.ReadOnly,r.depthRangeFor3D);let i=r.globeSharedBuffers;if(i){p&&(r.terrain.setupElevationDraw(L,ee),r.uploadCommonUniforms(m,ee,L.tileID.toUnwrapped()));let[a,l,h]=i.getGridBuffers(K,!1),u=ee.getAttributeLocation(_,"a_texture_pos");-1!==u&&_.vertexAttribI4ui(u,0,0,0,0),ee.draw(r,_.TRIANGLES,o,I||N,r.colorModeForRenderPass(),s,J,n.id,a,l,h)}}else if(f)o=new ii(_.LEQUAL,ii.ReadWrite,r.depthRangeFor3D),r.terrain.setupElevationDraw(L,ee),r.uploadCommonUniforms(m,ee,L.tileID.toUnwrapped()),q.pitch>20&&ee.draw(r,_.TRIANGLES,o,ir.disabled,it.disabled,ia.frontCCW,J,n.id,r.terrain.gridBuffer,r.terrain.gridIndexBuffer,r.terrain.gridSegments),ee.draw(r,_.TRIANGLES,o,N,v,ia.backCCW,J,n.id,r.terrain.gridBuffer,r.terrain.gridIndexBuffer,r.terrain.gridSegments);else{let{tileBoundsBuffer:i,tileBoundsIndexBuffer:a,tileBoundsSegments:s}=r.getTileBoundsBuffers(L);ee.draw(r,_.TRIANGLES,o,N,v,ia.disabled,J,n.id,i,a,s)}}if(!(g instanceof i.aW)&&d)for(let i of o){let o=i.canonical.y===(1<<i.canonical.z)-1;0===i.canonical.y&&aY(!0,i,r,a,n,x,y,s,I||ir.disabled),o&&aY(!1,i,r,a,n,x,y,s===ia.frontCW?ia.backCW:ia.frontCW,I||ir.disabled)}};d?A(I,r.renderElevatedRasterBackface?ia.backCW:ia.frontCW,r.stencilModeFor3D()):A(I,ia.disabled,void 0),r.resetStencilClippingMasks()},"raster-particle":function(r,a,n,o,s,l){"offscreen"===r.renderPass&&function(r,a,n,o){if(!o.length)return;let s=r.context,l=s.gl,h=a.getSource();if(!(h instanceof to))return;let u=Math.ceil(Math.sqrt(n.paint.get("raster-particle-count"))),c=n.particlePositionRGBAImage;if(!c||c.width!==u){let r=function(r){let a=r*r,n=new Uint8Array(4*a);for(let r=0;r<a;r++){let a=.9090909090909091*(i.e7(2*r+0)+.05),o=.9090909090909091*(i.e7(2*r+1)+.05),s=255*a%1,l=255*o%1,h=o-l/255;n[4*r+0]=255*(a-s/255),n[4*r+1]=255*s,n[4*r+2]=255*h,n[4*r+3]=255*l}return n}(u);c=n.particlePositionRGBAImage=new i.q({width:u,height:u},r)}let d=n.particleFramebuffer;d?d.width!==u&&(d.destroy(),d=n.particleFramebuffer=s.createFramebuffer(u,u,1,null)):d=n.particleFramebuffer=s.createFramebuffer(u,u,1,null);let p=[];for(let r of o){let o=a.getTile(r);if(!(o instanceof td))continue;let l=function(r,a,n){if(!r)return null;let o=a.getTextureDescriptor(r,n,!0);if(!o)return null;let{texture:s,mix:l,offset:h,tileSize:u,buffer:c,format:d}=o;if(!s||!d)return null;let p=!1;return"uint32"===d&&(p=!0,l[3]=0,l=au(i.e6,l,[0,n.paint.get("raster-particle-max-speed")]),h=ac(i.e6,h,[0,n.paint.get("raster-particle-max-speed")])),{texture:s,textureOffset:[c/(u+2*c),u/(u+2*c)],tileSize:u,scalarData:p,scale:l,offset:h,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[d]]}}(o,h,n);if(!l)continue;let d=[o.tileSize,o.tileSize],f=n.tileFramebuffer;f||(f=n.tileFramebuffer=s.createFramebuffer(d[0],d[1],1,null));let m=o.rasterParticleState;m||(m=o.rasterParticleState=new aJ(s,r,d,c));let _=m.update(n.lastInvalidatedAt);m.particleTextureDimension!==u&&m.updateParticleTexture(r,c);let g=m.targetColorTexture;m.targetColorTexture=m.backgroundColorTexture,m.backgroundColorTexture=g;let y=m.particleTexture0;m.particleTexture0=m.particleTexture1,m.particleTexture1=y,p.push([r,l,m,_])}if(0===p.length)return;let f=i.o.now(),m=n.previousDrawTimestamp?.001*(f-n.previousDrawTimestamp):.0167;if(n.previousDrawTimestamp=f,n.hasColorMap()){s.activeTexture.set(l.TEXTURE0+2);let r=n.colorRampTexture;r||(r=n.colorRampTexture=new i.T(s,n.colorRamp,l.RGBA8)),r.bind(l.LINEAR,l.CLAMP_TO_EDGE)}s.bindFramebuffer.set(n.tileFramebuffer.framebuffer),function(r,a,n){var o;let s=r.context,l=s.gl,h=a.tileFramebuffer;s.activeTexture.set(l.TEXTURE0);let u={u_texture:0,u_opacity:1.05*(o=a.paint.get("raster-particle-fade-opacity-factor"))/(o+.
11105)},c=r.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});for(let o of n){let[,,n,d]=o;h.colorAttachment0.set(n.targetColorTexture.texture),s.viewport.set([0,0,h.width,h.height]),s.clear({color:i.aq.transparent}),d&&(n.backgroundColorTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.draw(r,l.TRIANGLES,ii.disabled,ir.disabled,it.alphaBlended,ia.disabled,u,a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments))}}(r,n,p),function(r,a,n,o){let s=r.context,l=s.gl,h=n.tileFramebuffer,u="globe"===r.transform.projection.name,c=n.paint.get("raster-particle-max-speed");for(let d of o){let[o,p,f]=d;s.activeTexture.set(l.TEXTURE0+0),p.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h.colorAttachment0.set(f.targetColorTexture.texture);let m=r.getOrCreateProgram("rasterParticleDraw",{defines:p.defines,overrideFog:!1});s.activeTexture.set(l.TEXTURE0+1);let _=p.scalarData?[]:[0,1,2,3].map(r=>i.dX[r](o));_.push(o);let g=o.canonical.x,y=o.canonical.y;for(let i of _){let s=a.getTile(u?i.wrapped():i);if(!s)continue;let h=s.rasterParticleState;if(!h)continue;let d=i.canonical.x+(1<<i.canonical.z)*(i.wrap-o.wrap),f=i.canonical.y;h.particleTexture0.bind(l.NEAREST,l.CLAMP_TO_EDGE);let _=af(1,h.particleTexture0.size[0],[d-g,f-y],0,p.texture.size,2,c,p.textureOffset,p.scale,p.offset);m.draw(r,l.POINTS,ii.disabled,ir.disabled,it.alphaBlended,ia.disabled,_,n.id,h.particleIndexBuffer,void 0,h.particleSegment)}}}(r,a,n,p),s.bindFramebuffer.set(n.particleFramebuffer.framebuffer),function(r,a,n,o){let s=r.context,l=s.gl,h=a.paint.get("raster-particle-max-speed"),u=o*a.paint.get("raster-particle-speed-factor")*.15,c=Math.pow(.01+ +a.paint.get("raster-particle-reset-rate-factor"),6),d=a.particleFramebuffer;for(let o of(s.viewport.set([0,0,d.width,d.height]),n)){let[,n,p]=o;s.activeTexture.set(l.TEXTURE0+0),n.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE0+1);let f=p.particleTexture0;f.bind(l.NEAREST,l.CLAMP_TO_EDGE);let m=am(1,f.size[0],0,n.texture.size,h,u,c,n.textureOffset,n.scale,n.offset);d.colorAttachment0.set(p.particleTexture1.texture),s.clear({color:i.aq.transparent}),r.getOrCreateProgram("rasterParticleUpdate",{defines:n.defines}).draw(r,l.TRIANGLES,ii.disabled,ir.disabled,it.unblended,ia.disabled,m,a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments)}}(r,n,p,m)}(r,a,n,o),"translucent"===r.renderPass&&(function(r,a,n,o){let s=r.context,l=s.gl,h=a.getSource().tileSize,u=5*(1-i.aj(i.cq,i.cq+1,r.transform.zoom))*h+n.paint.get("raster-particle-elevation"),c=!r.options.moving,d="globe"===r.transform.projection.name;if(!o.length)return;let[p,f]=r.stencilConfigForOverlap(o),m=[];d&&m.push("PROJECTION_GLOBE_VIEW");let _=r.stencilModeFor3D();for(let o of f){let h,f,g,y,x,v,b,w=o.toUnwrapped(),T=a.getTile(o);if(!T.rasterParticleState)continue;let S=T.rasterParticleState;T.registerFadeDuration(100);let I=a.findLoadedParent(o,0),E=rq(T,I,a,r.transform,100);r.terrain&&r.terrain.prepareDrawTile(),s.activeTexture.set(l.TEXTURE0),S.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE1),I&&I.rasterParticleState?(I.rasterParticleState.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h=Math.pow(2,I.tileID.overscaledZ-T.tileID.overscaledZ),f=[T.tileID.canonical.x*h%1,T.tileID.canonical.y*h%1]):S.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE);let A=d?Float32Array.from(r.transform.expandedFarZProjMatrix):r.transform.calculateProjMatrix(w,c),C=r.transform,M=function(i){let r=i._nearZ,a=i.projection.farthestPixelDistance(i),n=a-r,o=.2*i.height,s=r+o;return[r,a,(s-o-r)/n,(s-r)/n]}(C),P=i.dm(o.canonical),D=i.dn(P.getCenter().lat);d?(g=Float32Array.from(i.dq(i.dr(o.canonical))),y=Float32Array.from(C.globeMatrix),x=Float32Array.from(i.dl(C)),v=[i.aH(C.center.lng),i.aL(C.center.lat)],b=Float32Array.from(i.dp(o.canonical,P,D,C.worldSize/C._pixelsPerMercatorPixel))):(g=new Float32Array(16),y=new Float32Array(9),x=new Float32Array(16),v=[0,0],b=new Float32Array(9));let R=ap(A,g,y,x,b,f||[0,0],i.al(r.transform.zoom),v,M,h||1,E,u),L=r.isTileAffectedByFog(o),z=r.getOrCreateProgram("rasterParticle",{defines:m,overrideFog:L});if(r.uploadCommonUniforms(s,z,w),d){let i=new ii(l.LEQUAL,ii.ReadOnly,r.depthRangeFor3D),a=r.globeSharedBuffers;if(a){let[o,s,h]=a.getGridBuffers(D,!1);z.draw(r,l.TRIANGLES,i,_,it.alphaBlended,r.renderElevatedRasterBackface?ia.frontCCW:ia.backCCW,R,n.id,o,s,h)}}else{let i=r.depthModeForSublayer(0,ii.ReadOnly),a=p[o.overscaledZ],{tileBoundsBuffer:s,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=r.getTileBoundsBuffers(T);z.draw(r,l.TRIANGLES,i,a,it.alphaBlended,ia.disabled,R,n.id,s,h,u)}}r.resetStencilClippingMasks()}(r,a,n,o),r.style.map.triggerRepaint())},background:function(r,a,n,o){let s,l=n.paint.get("background-color"),h="none"===n.paint.get("background-color-use-theme").
111constantOr("default"),u=n.paint.get("background-opacity"),c=n.paint.get("background-emissive-strength"),d="viewport"===n.paint.get("background-pitch-alignment");if(0===u)return;let p=r.context,f=p.gl,m=r.transform,_=m.tileSize,g=n.paint.get("background-pattern");if(void 0!==g&&(null===g||!(s=r.imageManager.getPattern(i.I.from(g.toString()),n.scope,r.style.getLut(n.scope)))))return;let y=!g&&1===l.a&&1===u&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==y)return;let x=ir.disabled,v=r.depthModeForSublayer(0,"opaque"===y?ii.ReadWrite:ii.ReadOnly),b=r.colorModeForDrapableLayerRenderPass(c),w=g?"backgroundPattern":"background",T,S=o;S||(S=Object.values(T=r.getBackgroundTiles()).map(i=>i.tileID)),g&&(p.activeTexture.set(f.TEXTURE0),r.imageManager.bind(r.context,n.scope));let I=[];if(r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&I.push("USE_MRT1"),d){let a=r.getOrCreateProgram(w,{overrideFog:!1,overrideRtt:!0,defines:I}),o=new Float32Array(i.ba([])),p=new i.aS(0,0,0,0,0),m=g?ax(o,c,u,r,0,n.scope,s,d,{tileID:p,tileSize:_}):ay(o,c,u,l.toPremultipliedRenderColor(h?null:n.lut));return void a.draw(r,f.TRIANGLES,v,x,b,ia.disabled,m,n.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments)}for(let y of S){let S=r.isTileAffectedByFog(y),E=r.getOrCreateProgram(w,{overrideFog:S,defines:I}),A=y.toUnwrapped(),C=o?y.projMatrix:r.transform.calculateProjMatrix(A);r.prepareDrawTile();let M=a?a.getTile(y):T?T[y.key]:new i.b1(y,_,m.zoom,r),P=g?ax(C,c,u,r,0,n.scope,s,d,{tileID:y,tileSize:_}):ay(C,c,u,l.toPremultipliedRenderColor(h?null:n.lut));r.uploadCommonUniforms(p,E,A);let{tileBoundsBuffer:D,tileBoundsIndexBuffer:R,tileBoundsSegments:L}=r.getTileBoundsBuffers(M);E.draw(r,f.TRIANGLES,v,x,b,ia.disabled,P,n.id,D,R,L)}},sky:function(r,a,n){let o,s,l,h,u,c,d,p,f,m,_,g,y,x,v=r._atmosphere?i.al(r.transform.zoom):1,b=n.paint.get("sky-opacity")*v;if(0===b)return;let w=r.context,T=n.paint.get("sky-type"),S=new ii(w.gl.LEQUAL,ii.ReadOnly,[0,1]),I=r.frameCounter/1e3%1;"atmosphere"===T?"offscreen"===r.renderPass?n.needsSkyboxCapture(r)&&(function(r,a){let n=r.context,o=n.gl,s=a.skyboxFbo;if(!s){s=a.skyboxFbo=n.createFramebuffer(32,32,1,null),a.skyboxGeometry=new nt(n),a.skyboxTexture=n.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,a.skyboxTexture),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR);for(let i=0;i<6;++i)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,o.RGBA,32,32,0,o.RGBA,o.UNSIGNED_BYTE,null)}n.bindFramebuffer.set(s.framebuffer),n.viewport.set([0,0,32,32]);let l=a.getCenter(r,!0),h=r.getOrCreateProgram("skyboxCapture"),u=new Float64Array(16);i.ba(u),i.eb(u,u,-(.5*Math.PI)),ni(r,a,h,u,l,0),i.ba(u),i.eb(u,u,.5*Math.PI),ni(r,a,h,u,l,1),i.ba(u),i.cz(u,u,-(.5*Math.PI)),ni(r,a,h,u,l,2),i.ba(u),i.cz(u,u,.5*Math.PI),ni(r,a,h,u,l,3),i.ba(u),ni(r,a,h,u,l,4),i.ba(u),i.eb(u,u,Math.PI),ni(r,a,h,u,l,5),n.viewport.set([0,0,r.width,r.height])}(r,n),n.markSkyboxValid(r)):"sky"===r.renderPass&&(s=(o=r.context).gl,l=r.transform,h=r.getOrCreateProgram("skybox"),o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,n.skyboxTexture),u={u_matrix:l.skyboxMatrix,u_sun_direction:n.getCenter(r,!1),u_cubemap:0,u_opacity:b,u_temporal_offset:I},r.uploadCommonUniforms(o,h),h.draw(r,s.TRIANGLES,S,ir.disabled,r.colorModeForRenderPass(),ia.backCW,u,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)):"gradient"===T&&"sky"===r.renderPass&&(d=(c=r.context).gl,p=r.transform,f=r.getOrCreateProgram("skyboxGradient"),n.skyboxGeometry||(n.skyboxGeometry=new nt(c)),c.activeTexture.set(d.TEXTURE0),(m=n.colorRampTexture)||(m=n.colorRampTexture=new i.T(c,n.colorRamp,d.RGBA8)),m.bind(d.LINEAR,d.CLAMP_TO_EDGE),_=p.skyboxMatrix,g=n.getCenter(r,!1),y=n.paint.get("sky-gradient-radius"),x={u_matrix:_,u_color_ramp:0,u_center_direction:g,u_radius:i.ap(y),u_opacity:b,u_temporal_offset:I},r.uploadCommonUniforms(c,f),f.draw(r,d.TRIANGLES,S,ir.disabled,r.colorModeForRenderPass(),ia.backCW,x,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment))},custom:function(r,a,n,o){let s=r.context,l=n.implementation;if(!r.transform.projection.unsupportedLayers||!r.transform.projection.unsupportedLayers.includes("custom")||r.terrain&&(r.terrain.renderingToTexture||"offscreen"===r.renderPass)&&n.isDraped(a)){if("offscreen"===r.renderPass){let a=l.prerender;if(a){if(r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),"globe"===r.transform.projection.name){let n=r.transform.pointMerc;a.call(l,s.gl,r.transform.customLayerMatrix(),r.transform.getProjection(),r.transform.globeToMercatorMatrix(),i.al(r.transform.zoom),[n.x,n.y],r.transform.pixelsPerMeterRatio)}else a.call(l,s.gl,r.transform.customLayerMatrix());s.setDirty(),r.setBaseState()}}else if("translucent"===r.renderPass){if(r.terrain&&r.terrain.renderingToTexture){let i=l.renderToTile;if(i){let a=o[0].canonical,n={x:a.x+o[0].wrap*(l.wrapTileId?0:1<<a.z),y:a.y,z:a.z};s.setDepthMode(ii.disabled),s.setStencilMode(ir.disabled),s.setColorMode(r.colorModeForRenderPass()),r.setCustomLayerDefaults(),i.call(l,s.gl,n),s.setDirty(),r.setBaseState()}return}r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),s.setStencilMode(ir.disabled);let a="3d"===l.renderingMode?new ii(r.context.gl.LEQUAL,ii.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,ii.ReadOnly);if(s.setDepthMode(a),"globe"===r.transform.projection.name){let a=r.transform.pointMerc;l.render(s.gl,r.transform.customLayerMatrix(),r.transform.getProjection(),r.transform.globeToMercatorMatrix(),i.al(r.transform.zoom),[a.x,a.y],r.transform.pixelsPerMeterRatio)}else l.render(s.gl,r.transform.customLayerMatrix());s.setDirty(),r.setBaseState(),s.bindFramebuffer.set(null)}}else i.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(r,a,n,o){if("opaque"===r.renderPass)return;let s=n.paint.get("model-opacity").constantOr(1),l=n.paint.get("model-elevation-reference"),h="ground"===l,u="ground"===l;if(0===s)return;let c=n.paint.get("model-cast-shadows");
111if("shadow"===r.renderPass&&(!c||r.terrain&&s<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof i.af))return;let d=r.shadowRenderer,p=n.paint.get("model-receive-shadows");d&&(d.useNormalOffset=!0,p||(d.enabled=!1));let f=()=>{d&&(d.useNormalOffset=!0,p||(d.enabled=!0))},m=a.getSource();if("light-beam"===r.renderPass&&"batched-model"!==m.type)return;if("vector"===m.type||"geojson"===m.type)return function(r,a,n,o,s){let l=r.transform,h="globe"===l.projection.name,u=l.getFreeCameraOptions().position;if(!r.modelManager)return;let c=r.modelManager;n.modelManager=c;let d=r.shadowRenderer;if(!n._unevaluatedLayout._values.hasOwnProperty("model-id"))return;let p=n._unevaluatedLayout._values["model-id"],f=Object.assign({},n.layout.get("model-id").parameters),m=r.style.order.indexOf(n.fqid),_=n.paint.get("model-opacity").constantOr(1);for(let g of o){let o=a.getTile(g).getBucket(n);if(!o||o.projection.name!==l.projection.name)continue;let y=o.getModelUris();(y&&!o.modelsRequested&&(c.addModelsFromBucket(y,s),o.modelsRequested=!0),h)?f.zoom=g.overscaledZ:f.zoom=function(r,a){let n=1<<r.canonical.z,o=a.getFreeCameraOptions().position,s=a.elevation,l=r.canonical.x/n,h=(r.canonical.x+1)/n,u=r.canonical.y/n,c=(r.canonical.y+1)/n,d=a._centerAltitude;if(s){let i=s.getMinMaxForTile(r);i&&i.max>d&&(d=i.max)}let p=i.aC(o.x,l,h)-o.x,f=i.aC(o.y,u,c)-o.y,m=i.bV(d,a.center.lat)-o.z;return a._zoomFromMercatorZ(Math.sqrt(p*p+f*f+m*m))}(g,l);let x=p.possiblyEvaluate(f);if(function(r,a,n){let o=a.updateZoomBasedPaintProperties(),s=function(r,a,n){let o,s,l,h=r.terrain?r.terrain.exaggeration():0;if(r.terrain&&h>0){let a=r.terrain,s=a.findDEMTileFor(n);s&&s.dem?o=i.et.create(a,n,s):h=0}if(0===h&&(a.terrainElevationMin=0,a.terrainElevationMax=0),h===a.validForExaggeration&&(0===h||o&&o._demTile&&o._demTile.tileID===a.validForDEMTile.id&&o._dem._timestamp===a.validForDEMTile.timestamp))return!1;for(let i in a.instancesPerModel){let r=a.instancesPerModel[i];for(let i=0;i<r.instancedDataArray.length;++i){let n=(o?h*o.getElevationAt(0|r.instancedDataArray.float32[16*i],0|r.instancedDataArray.float32[16*i+1],!0,!0):0)+r.instancesEvaluatedElevation[i];r.instancedDataArray.float32[16*i+6]=n,s=s?Math.min(a.terrainElevationMin,n):n,l=l?Math.max(a.terrainElevationMax,n):n}}return a.terrainElevationMin=s||0,a.terrainElevationMax=l||0,a.validForExaggeration=h,a.validForDEMTile=o&&o._demTile?{id:o._demTile.tileID,timestamp:o._dem._timestamp}:{id:void 0,timestamp:0},!0}(r,a,n);(o||s)&&(a.uploaded=!1,a.upload(r.context))}(r,o,g),ng.shadowUniformsInitialized=!1,ng.useSingleShadowCascade=!!d&&0===d.getMaxCascadeForTile(g.toUnwrapped()),"shadow"===r.renderPass&&d){if(1===r.currentShadowCascade&&o.isInsideFirstShadowMapFrustum)continue;let a=l.calculatePosMatrix(g.toUnwrapped(),l.worldSize);if(ng.tileMatrix.set(a),ng.shadowTileMatrix=Float32Array.from(d.calculateShadowPassMatrixFromMatrix(a)),ng.aabb.min=[0,0,0],ng.aabb.max[0]=ng.aabb.max[1]=i.an,ng.aabb.max[2]=0,function(r,a,n,o){if(!n.modelManager)return!0;let s=n.modelManager;if(!n.shadowRenderer)return!0;let l=n.shadowRenderer,h=a.aabb,u=!0,c=r.maxHeight;if(0===c){let i=0;for(let a in r.instancesPerModel){let r=s.getModel(a,o);r?i=Math.max(i,Math.max(Math.max(r.aabb.max[0],r.aabb.max[1]),r.aabb.max[2])):u=!1}c=r.maxScale*i*1.41+r.maxVerticalOffset,u&&(r.maxHeight=c)}h.max[2]=c,h.min[2]+=r.terrainElevationMin,h.max[2]+=r.terrainElevationMax,i.ah(h.min,h.min,a.tileMatrix),i.ah(h.max,h.max,a.tileMatrix);let d=h.intersects(l.getCurrentCascadeFrustum());return 0===n.currentShadowCascade&&(r.isInsideFirstShadowMapFrustum=2===d),0===d}(o,ng,r,n.scope))continue}let v=1<<g.canonical.z,b=[((u.x-g.wrap)*v-g.canonical.x)*i.an,(u.y*v-g.canonical.y)*i.an,u.z*v*i.an];r.conflationActive&&Object.keys(o.instancesPerModel).length>0&&r.style.isLayerClipped(n,a.getSource())&&o.updateReplacement(g,r.replacementSource,m,n.scope)&&(o.uploaded=!1,o.upload(r.context));let w=0,T=[],S=[],I=[];for(let a in o.instancesPerModel){let l=o.instancesPerModel[a];l.features.length>0&&!h&&(a=x.evaluate(l.features[0].feature,{}));let d=c.getModel(a,s);if(d||c.hasURLBeenRequested(a)||o.modelUris.includes(a)||(o.modelUris.push(a),o.modelsRequested=!1),d&&d.uploaded)if(h){let a=i.bK([],[u.x,u.y,u.z],r.transform.worldSize);i.ek(a,a);for(let n=0;n<l.instancedDataArray.length;++n){let s=[0,0,0],h=[1,1,1],u=i.el(),c=l.tileCoordinatesForInstance(n),p=l.transformForInstance(n);i.em(h,p),i.en(u,p),i.eo(s,u);let f=l.translationForInstance(n),m=new i.aV(0,0);i.ep(o.canonical,m,c.x,c.y);let g=i.bc();i.eq(g,d,r.transform,m,s,h,f,!0,!1,!1);let y=l.colorForInstance(n),x=i.ba([]),v=i.d_(m.lat,r.transform.zoom),b=i.bQ([],[1,1,1/v]);for(let n of(i.by(x,x,a),I.push({zScaleMatrix:b,negCameraPosMatrix:x}),d.nodes))np(r,n,g,r.transform.expandedFarZProjMatrix,w,T,S,d.materialOverrides,_,y);++w}}else for(let i of d.nodes)!function i(r,a,n,o,s,l,h){let u=r.context,c="shadow"===r.renderPass,d=r.shadowRenderer,p=c&&d?d.get
111ShadowPassDepthMode():new ii(u.gl.LEQUAL,ii.ReadWrite,r.depthRangeFor3D),f=r.isTileAffectedByFog(l),m="globe"===r.transform.projection.name;if(n.meshes)for(let i of n.meshes){let _,g,y,x=m?[]:["MODEL_POSITION_ON_GPU"],v=[],b=!m&&o.instancedDataArray.length>20;b&&x.push("INSTANCED_ARRAYS");let w=im(r,a.paint.get("model-cutoff-fade-range"));if(w.shouldRenderCutoff&&x.push("RENDER_CUTOFF"),c&&d)_=r.getOrCreateProgram("modelDepth",{defines:x}),g=aw(h.shadowTileMatrix,h.shadowTileMatrix,Float32Array.from(n.globalMatrix)),y=it.disabled;else{nu(x,v,i,r,"none"===a.paint.get("model-color-use-theme").constantOr("default")?null:a.lut),_=r.getOrCreateProgram("model",{defines:x,overrideFog:f});let o=i.material,c=o.pbrMetallicRoughness,p=a.paint.get("model-opacity").constantOr(1),m=a.paint.get("model-emissive-strength").constantOr(0);g=ab(l.expandedProjMatrix,Float32Array.from(n.globalMatrix),new Float32Array(16),null,r,p,c.baseColorFactor,o.emissiveFactor,c.metallicFactor,c.roughnessFactor,o,m,a,s),d&&(h.shadowUniformsInitialized?_.setShadowUniformValues(u,d.getShadowUniformValues()):(d.setupShadows(l.toUnwrapped(),_,"model-tile"),h.shadowUniformsInitialized=!0)),y=w.shouldRenderCutoff||p<1||"OPAQUE"!==o.alphaMode?it.alphaBlended:it.unblended}r.uploadCommonUniforms(u,_,l.toUnwrapped(),null,w);let T=i.material.doubleSided?ia.disabled:ia.backCCW;if(b)v.push(o.instancedDataBuffer),_.draw(r,u.gl.TRIANGLES,p,ir.disabled,y,T,g,a.id,i.vertexBuffer,i.indexBuffer,i.segments,a.paint,r.transform.zoom,void 0,v,o.instancedDataArray.length);else{let n=c?"u_instance":"u_normal_matrix";for(let s=0;s<o.instancedDataArray.length;++s)g[n]=new Float32Array(o.instancedDataArray.arrayBuffer,64*s,16),_.draw(r,u.gl.TRIANGLES,p,ir.disabled,y,T,g,a.id,i.vertexBuffer,i.indexBuffer,i.segments,a.paint,r.transform.zoom,void 0,v)}}if(n.children)for(let u of n.children)i(r,a,u,o,s,l,h)}(r,n,i,l,b,g,ng)}if(h)if("shadow"===r.renderPass){for(let i of S)nf(i.mesh,i.nodeModelMatrix,r,n);for(let i of T)nf(i.mesh,i.nodeModelMatrix,r,n)}else n_(r,n,T,S,I)}}(r,a,n,o,nd(r,n)),void f();if(!m.loaded())return;if("batched-model"===m.type)return function(r,a,n,o){n.resetLayerRenderingStats(r);let s=r.context,l=r.transform,h=r.style.fog,u=r.shadowRenderer;if("mercator"!==l.projection.name)return i.w(`Drawing 3D landmark models for ${l.projection.name} projection is not yet implemented`);let c=r.transform.getFreeCameraOptions().position,d=i.bK([],[c.x,c.y,c.z],r.transform.worldSize),p=i.ek([],d),f=i.ba([]),m=i.d_(l.center.lat,l.zoom),_=i.bQ([],[1,1,1/m]);i.by(f,f,p);let g=n.paint.get("model-opacity").constantOr(1),y=new ii(s.gl.LEQUAL,ii.ReadWrite,r.depthRangeFor3D),x=new ii(s.gl.LEQUAL,ii.ReadOnly,r.depthRangeFor3D),v=new i.cQ([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),b="shadow"===r.renderPass,w=b&&u?u.getCurrentCascadeFrustum():l.getFrustum(l.scaleZoom(l.worldSize)),T=n.paint.get("model-front-cutoff"),S=T[2]<1,I=im(r,n.paint.get("model-cutoff-fade-range")),E=n.getLayerRenderingStats();(function(i,r,a,n){let o=i.terrain?i.terrain.exaggeration():0,s=i.transform.zoom;for(let l of n){let n=r.getTile(l).getBucket(a);n&&(n.setFilter(a.filter),i.conflationActive&&n.updateReplacement(l,i.replacementSource),n.evaluateTransform(i,a),i.terrain&&o>0&&n.elevationUpdate(i.terrain,o,l,a.source),n.needsReEvaluation(i,s,a)&&n.evaluate(a))}})(r,a,n,o),function(){let c,p,A,C=new Map;S?(c=o.length-1,p=-1,A=-1):(c=0,p=o.length,A=1);let M=new Float64Array(16),P=i.cf(),D=new i.P(0,0);for(let R=c;R!==p;R+=A){let c=o[R],p=a.getTile(c).getBucket(n);if(!p||!p.uploaded)continue;let A=!1;u&&(A=0===u.getMaxCascadeForTile(c.toUnwrapped()));let L=l.calculatePosMatrix(c.toUnwrapped(),l.worldSize),z=p.modelTraits;!b&&S&&(i.b8(M,L),i.ah(P,d,M),D.x=P[0],D.y=P[1]);let F=[];for(let a of(p.setFilter(n.filter),p.getNodesInfo())){if(a.hiddenByReplacement||!
111a.node.meshes)continue;let n=a.node,o=0;r.terrain&&n.elevation&&(o=n.elevation*r.terrain.exaggeration());let s=(()=>{let r=a.aabb;return v.min=[...r.min],v.max=[...r.max],v.min[2]+=o,v.max[2]+=o,i.ah(v.min,v.min,L),i.ah(v.max,v.max,L),v})(),h=a.evaluatedScale;if(h[0]<=1&&h[1]<=1&&h[2]<=1&&0===s.intersects(w))continue;if(!b&&S){let r=1/6;a.cameraCollisionOpacity=d[0]>s.min[0]&&d[0]<s.max[0]&&d[1]>s.min[1]&&d[1]<s.max[1]&&d[2]*m<s.max[2]&&n.footprint&&i.bD(D,n.footprint)?Math.max(a.cameraCollisionOpacity-r,0):Math.min(1,a.cameraCollisionOpacity+r)}let u=[...L],p=1/i.cO(c.canonical),f=n.anchor?n.anchor[0]:0,_=n.anchor?n.anchor[1]:0;i.by(u,u,[f*(h[0]-1)+a.evaluatedTranslation[0]*p,_*(h[1]-1)+a.evaluatedTranslation[1]*p,o+a.evaluatedTranslation[2]]),i.c5(h,i.es)||i.cx(u,u,h);let y=i.aD([],u,n.globalMatrix),x=i.aD([],l.expandedFarZProjMatrix,y),E=i.aD([],l.expandedFarZProjMatrix,u),A=i.aE([],[f,_,o,1],x)[2];n.hidden=!1;let C=g;b||(S&&(C*=a.cameraCollisionOpacity*function(r,a,n,o){if(a.pitch<20)return 1;let s=a.getWorldToCameraMatrix();i.aD(s,s,r);let l=i.bu(n.min[0],n.min[1],n.min[2],1),h=i.aE(i.bF(),l,s),u=h,c=h;l[1]=n.max[1],u=(h=i.aE(i.bF(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c,l[0]=n.max[0],u=(h=i.aE(i.bF(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c,l[1]=n.min[1],u=(h=i.aE(i.bF(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c;let d=i.aC(o[0],0,1),p=100*a.pixelsPerMeter*i.aC(o[1],0,1),f=i.aC(o[2],0,1),m=i.eu(i.bF(),u,c,d),_=Math.tan(.5*a.fovX),g=-m[2]*_;if(0===p)return m[1]<-Math.abs(g)?f:1;let y=(-Math.abs(g)-m[1])/p,x=(i,r,a)=>(1-a)*i+a*r,v=i.aC(x(1,f,y),f,1);return x(1,v,i.aC((a.pitch-20)/20,0,1))}(u,l,a.aabb,T)),C*=function(r,a){let n=r.uniformValues.u_cutoff_params[0],o=r.uniformValues.u_cutoff_params[1],s=r.uniformValues.u_cutoff_params[2],l=r.uniformValues.u_cutoff_params[3];return o===n||l===s?1:i.aC(((a-n)/(o-n)-s)/(l-s),0,1)}(I,A)),0!==C?F.push({nodeInfo:a,depth:A,opacity:C,wvpForNode:x,wvpForTile:E,nodeModelMatrix:y,tileModelMatrix:u}):n.hidden=!0}for(let a of(b||F.sort((i,r)=>S&&(1!==i.opacity||1!==r.opacity)?1===i.opacity?-1:1===r.opacity?1:i.depth>r.depth?-1:1:i.depth<r.depth?-1:1),F)){let o=a.nodeInfo,c=o.node;if(r._debugParams.show3DModelFootprints&&c.footprint){let i=c.id||c.name||"footprint";C.has(i)||C.set(i,{node:c,mvp:a.wvpForTile})}let d=i.aD([],_,a.tileModelMatrix);i.aD(d,f,d);let p=i.b8([],d);i.e2(p,p),i.cx(p,p,ny),d=i.aD(d,d,c.globalMatrix);let m="light-beam"===r.renderPass,g="none"===n.paint.get("model-color-use-theme").constantOr("default"),v=z&i.ev.HasMapboxMeshFeatures,w=v?0:o.evaluatedRMEA[0][2];for(let i=0;i<c.meshes.length;++i){let f,_=c.meshes[i],T=i===c.lightMeshIndex,S=a.wvpForNode;if(T){if(!m&&!r.terrain&&r.shadowRenderer){r.currentLayer<r.firstLightBeamLayer&&(r.firstLightBeamLayer=r.currentLayer);continue}S=a.wvpForTile}else if(m)continue;let I={defines:[]},C=[];if(!b&&u&&(u.useNormalOffset=!!_.normalBuffer),nu(I.defines,C,_,r,g?null:n.lut),v||I.defines.push("DIFFUSE_SHADED"),A&&I.defines.push("SHADOWS_SINGLE_CASCADE"),E&&(b?E.numRenderedVerticesInShadowPass+=_.vertexArray.length:E.numRenderedVerticesInTransparentPass+=_.vertexArray.length),b){nf(_,a.nodeModelMatrix,r,n);continue}let M=null;if(h){let i=nh(a.nodeModelMatrix,r.transform);if(M=new Float32Array(i),"globe"!==l.projection.name){let r=_.aabb.min,a=_.aabb.max,[n,o]=h.getOpacityForBounds(i,r[0],r[1],a[0],a[1]);I.overrideFog=n>=.05||o>=.05}}let P=_.material;P.occlusionTexture&&P.occlusionTexture.offsetScale&&(f=P.occlusionTexture.offsetScale,I.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));let D=r.getOrCreateProgram("model",I);!b&&u&&u.setupShadowsFromMatrix(a.tileModelMatrix,D,u.useNormalOffset),r.uploadCommonUniforms(s,D,null,M);let R=P.pbrMetallicRoughness;R.metallicFactor=.9,R.roughnessFactor=.5;let L=ab(new Float32Array(S),new Float32Array(d),new Float32Array(p),new Float32Array(c.globalMatrix),r,a.opacity,R.baseColorFactor,P.emissiveFactor,R.metallicFactor,R.roughnessFactor,P,w,n,[0,0,0],f);!T&&(o.hasTranslucentParts||a.opacity<1)&&D.draw(r,s.gl.TRIANGLES,y,ir.disabled,it.disabled,ia.backCCW,L,n.id,_.vertexBuffer,_.indexBuffer,_.segments,n.paint,r.transform.zoom,void 0,C),D.draw(r,s.gl.TRIANGLES,T?x:y,ir.disabled,T||a.opacity<1||o.hasTranslucentParts?it.alphaBlended:it.unblended,ia.backCCW,L,n.id,_.vertexBuffer,_.indexBuffer,_.segments,n.paint,r.transform.zoom,void 0,C)}}}if(r._debugParams.show3DModelFootprints&&C.size>0)for(let i of Array.from(C.keys()).sort()){let{node:a,mvp:n}=C.get(i);nm(r,0,a,n)}}()}(r,a,n,o),void f();if("model"!==m.type)return;let _=m.getModels(),g=[],y=r.transform.getFreeCameraOptions().position,x=i.bK([],[y.x,y.y,y.z],r.transform.worldSize);i.ek(x,x);let v=[],b=[],w=0;for(let o of _){let s=a.getFeatureState("",o.id),l={type:"Unknown",id:o.id,properties:o.featureProperties},c=n.paint.get("model-rotation").evaluate(l,s),d=n.paint.get("model-scale").evaluate(l,s),p=n.paint.get("model-translation").evaluate(l,s),f=n.paint.get("model-opacity").evaluate(l,s);(function(i,r,a,n,o,s){for(let l of o){let o=Object.assign({},n);o.part=l;let h={type:"Unknown",id:r,properties:o},u={orientation:i.paint.get("model-rotation").evaluate(h,a)};s.set(l,u)}})(n,o.id,s,o.featureProperties,o.nodeOverrideNames,o.nodeOverrides),function(i,r,a,n,o,s){for(let l of o){let o=Object.assign({},n);o.part=l;let h={type:"Unknown",id:r,properties:o},u={color:i.paint.get("model-color").evaluate(h,a),colorMix:i.paint.get("model-color-mix-intensity").evaluate(h,a),opacity:i.paint.get("model-opacity").evaluate(h,a),emissionStrength:i.paint.get("model-emissive-strength").evaluate(h,a)};s.set(l,u)}}(n,o.id,s,o.featureProperties,o.materialOverrideNames,o.materialOverrides),o.nodeOverrides.size>0&&o.computeBoundsAndApplyParent(),o.computeModelMatrix(r,c,d,p,u,h,!1);let m=i.ba([]),_=i.d_(o.position.lat,r.transform.zoom),y=i.bQ([],[1,1,1/_]);for(let a of(i.by(m,m,x),g.push({zScaleMatrix:y,negCameraPosMatrix:m}),o.nodes))np(r,a,o.matrix,r.transform.expandedFarZProjMatrix,w,v,b,o.materialOverrides,f);w++}if(v.sort((i,r)=>r.depth-i.depth),"shadow"!==r.renderPass){if(r._debugParams.show3DModelFootprints){let a=r.transform.projMatrix,n=new Map,o=(r,o)=>{if(r.footprint){let s=r.id||r.name||"footprint";if(!n.has(s)){let l=i.aD([],a,o);n.set(s,{node:r,mvp:l})}}};for(let i of b)o(i.node,i.modelMatrix);for(let i of v)o(i.node,i.modelMatrix);for(let i of Array.from(n.keys()).sort()){let{node:a,mvp:o}=n.get(i);nm(r,0,a,o)}}n_(r,n,v,b,g),f()}else{for(let i of b)nf(i.mesh,i.nodeModelMatrix,r,n);for(let i of v)nf(i.mesh,i.nodeModelMatrix,r,n);f()}}},nF={line:function(i,r,a){if(i.hasElevatedBuckets=!1,i.hasNonElevatedBuckets=!1,void 0!==i._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==i._unevaluatedLayout.getValue("line-z-offset")){if(r)for(let a of r.getVisibleCoordinates()){let n=r.getTile(a).getBucket(i);if(n&&("none"!==n.elevationType?i.hasElevatedBuckets=!0:i.hasNonElevatedBuckets=!0,i.hasElevatedBuckets&&i.hasNonElevatedBuckets))break}}else i.hasNonElevatedBuckets=!0},model:function(i,r,a){let n=r.getSource();if(n.loaded()){if("vector"===n.type||"geojson"===n.type)return void(a.modelManager&&a.modelManager.upload(a,nd(a,i)));if("batched-model"!==n.type&&"model"===n.type)for(let i of n.getModels())i.upload(a.context)}},raster:function(i,r,a){let n=r.getSource();if(!(n instanceof to&&n.loaded()))return;let o=i.sourceLayer||n.rasterLayerIds&&n.rasterLayerIds[0];if(!o)return;let s=i.paint.get("raster-array-band")||n.getInitialBand(o);if(null!=s)for(let a of r.getIds().map(i=>r.getTileByID(i)))a.updateNeeded(i.id,s)&&n.prepareTile(a,o,i.id,s)},"raster-particle":function(i,r,a){let n=r.getSource();if(!(n instanceof to&&n.loaded()))return;let o=i.sourceLayer||n.rasterLayerIds&&n.rasterLayerIds[0];if(!o)return;let s=i.paint.get("raster-particle-array-band")||n.getInitialBand(o);if(null!=s)for(let a of r.getIds().map(i=>r.getTileByID(i)))a.updateNeeded(i.id,s)&&n.prepareTile(a,o,i.id,s)}},nO={fill:aB},nB={fill:function(i,r,a,n){if(!a.layout||"none"===a.layout.get("fill-elevation-reference")||0===a.paint.get("fill-opacity").constantOr(1))return;let o=i.context.gl,s=new ii(o.LEQUAL,ii.ReadOnly,i.depthRangeFor3D),l=new ir({func:o.ALWAYS,mask:255},255,255,o.KEEP,o.KEEP,o.REPLACE),h=i.transform.getFreeCameraOptions().position,u=i.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(let c of n){let n=r.getTile(c),d=n.getBucket(a);if(!d)continue;let p=d.elevatedStructures;if(!p||0===p.depthSegments.segments[0].primitiveLength)continue;let f=aO(c.toUnwrapped(),h),m=ae(i.translatePosMatrix(c.projMatrix,n,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor")),f,0,1,0);u.draw(i,o.TRIANGLES,s,l,it.disabled,ia.disabled,m,a.id,p.vertexBuffer,p.indexBuffer,p.depthSegments,a.paint,i.transform.zoom)}}};
111class nk{constructor(r,a,n,o,s){this.context=new aC(r,a),this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=i.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,show3DModelFootprints:!1,enabledLayers:{}};const l=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const i of l)this._debugParams.enabledLayers[i]=!0;for(const i of l);this.occlusionParams=new nb,this.setup(),this.numSublayers=tm.maxUnderzooming+tm.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new i.eC,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new iy(this),this._wireframeDebugCache=new nv,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const h=new i.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new i.T(this.context,h,r.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=o,this.maxFrontCutoffRawStart=0,this.worldview=s,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(i,r){let a=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(a||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new rW(this,i));let n=this._terrain;this.transform.elevation=a?n:null,n.update(i,this.transform,r),this.transform.elevation&&!n.enabled&&(this.transform.elevation=null)}_updateFog(i){let r=i.fog;if(!r||"globe"===this.transform.projection.name||1>r.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[a,n]=r.getFovAdjustedRange(this.transform._fov);if(a>n)return void(this.transform.fogCullDistSq=null);let o=a+.78*(n-a);this.transform.fogCullDistSq=o*o}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(i){i&&!this._terrain&&(this._terrain=new rW(this,this.style)),this._forceTerrainMode=i}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,a){if(this.width=r*i.o.devicePixelRatio,this.height=a*i.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style.order)this.style._mergedLayers[i].resize()}setup(){let r=this.context,a=new i.dx;a.emplaceBack(0,0),a.emplaceBack(i.an,0),a.emplaceBack(0,i.an),a.emplaceBack(i.an,i.an),this.tileExtentBuffer=r.createVertexBuffer(a,i.dt.members),this.tileExtentSegments=i.du.simpleSegment(0,0,4,2);let n=new i.dx;n.emplaceBack(0,0),n.emplaceBack(i.an,0),n.emplaceBack(0,i.an),n.emplaceBack(i.an,i.an),this.debugBuffer=r.createVertexBuffer(n,i.dt.members),this.debugSegments=i.du.simpleSegment(0,0,4,5);let o=new i.dx;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(-1,1),o.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(o,i.dt.members),this.viewportSegments=i.du.simpleSegment(0,0,4,2);let s=new i.eD;s.emplaceBack(0,0,0,0),s.emplaceBack(i.an,0,i.an,0),s.emplaceBack(0,i.an,0,i.an),s.emplaceBack(i.an,i.an,i.an,i.an),this.mercatorBoundsBuffer=r.createVertexBuffer(s,i.eE.members),this.mercatorBoundsSegments=i.du.simpleSegment(0,0,4,2);let l=new i.dy;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);let h=new i.eF;for(let i of[0,1,3,2,0])h.emplaceBack(i);this.debugIndexBuffer=r.createIndexBuffer(h),this.emptyTexture=new i.T(r,new i.q({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA8),this.identityMat=i.bc();let u=this.context.gl;this.stencilClearMode=new ir({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){let i=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,i.TRIANGLES,ii.disabled,this.stencilClearMode,it.disabled,ia.disabled,rG(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(i,r,a){if(!r||this.currentStencilSource===r.id||!i.isTileClipped()||!a||0===a.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let i=!1;for(let r of a)if(void 0===this._tileClippingMaskIDs[r.key]){i=!0;break}if(!i)return}this.currentStencilSource=r.id;let n=this.context,o=n.gl;this.nextStencilID+a.length>256&&this.clearStencil(),n.setColorMode(it.disabled),n.setDepthMode(ii.disabled);let s=this.getOrCreateProgram("clippingMask");for(let i of(this._tileClippingMaskIDs={},a)){let a=r.getTile(i),n=this._tileClippingMaskIDs[i.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=this.getTileBoundsBuffers(a);s.draw(this,o.TRIANGLES,ii.disabled,new ir({func:o.ALWAYS,mask:0},n,255,o.KEEP,o.KEEP,o.REPLACE),it.disabled,ia.disabled,rG(i.projMatrix),"$clipping",l,h,u)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let i=this.nextStencilID++,r=this.context.gl;return new ir({func:r.NOTEQUAL,mask:255},i,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(i){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(i);let r=this.context.gl;return new ir({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,r.KEEP,r.KEEP,r.REPLACE)}stencilConfigForOverlap(i){let r=this.context.gl,a=i.sort((i,r)=>
111r.overscaledZ-i.overscaledZ),n=a[a.length-1].overscaledZ,o=a[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let i={};for(let a=0;a<o;a++)i[a+n]=new ir({func:r.GEQUAL,mask:255},a+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=o,[i,a]}return[{[n]:ir.disabled},a]}colorModeForRenderPass(){let r=this.context.gl;if(this._showOverdrawInspector){let a=1/8;return new it([r.CONSTANT_COLOR,r.ONE,r.CONSTANT_COLOR,r.ONE],new i.aq(a,a,a,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?it.unblended:it.alphaBlended}colorModeForDrapableLayerRenderPass(r){let a=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&"translucent"===this.renderPass?null!=r&&"mrt-fallback"!==this.emissiveMode||"constant"===this.emissiveMode?new it([a.ONE,a.ONE_MINUS_SRC_ALPHA,a.CONSTANT_ALPHA,a.ONE_MINUS_SRC_ALPHA],new i.aq(0,0,0,null!=r?r:0),[!0,!0,!0,!0]):"dual-source-blending"===this.emissiveMode?new it([a.ONE,a.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,a.ONE_MINUS_SRC_ALPHA],i.aq.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(i,r,a,n=!1){if(this.depthOcclusion)return new ii(this.context.gl.GREATER,ii.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!n)return ii.disabled;let o=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new ii(a||this.context.gl.LEQUAL,r,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){let r=this.context.gl,a=Math.ceil(this.width),n=Math.ceil(this.height),o=this.context.bindFramebuffer.get(),s=r.getParameter(r.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===a&&this.depthFBO.height===n||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==a&&0!==n&&(this.depthFBO=new aA(this.context,a,n,0,"texture"),this.depthTexture=new i.T(this.context,{width:a,height:n,data:null},r.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(o),r.bindTexture(r.TEXTURE_2D,s),this.depthFBO&&(r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),r.blitFramebuffer(0,0,a,n,0,0,a,n,r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(0===this._dt?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((i,r)=>i+r/this._fpsHistory.length,0))}render(r,a){var n,o;let s,l,h=i.o.now();this._dt=h-this._timeStamp,this._timeStamp=h,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=r.map.repaint,this.style=r,this.options=a;let u=this.style._mergedLayers,c=!(!this.terrain||!this.terrain.enabled),d=()=>this.style._getOrder(c).filter(i=>{let r=u[i];return!(r.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[r.type]}),p=d(),f=!1,m=!1,_=null,g=0,y=!1;for(let i of p){let r=u[i];"none"!==r.visibility&&("circle"===r.type?f=!0:"building"===r.type?(_=r,++g):"symbol"===r.type&&(r.hasOcclusionOpacityProperties?m=!0:f=!0))}this.updateEmissiveMode();let x=p.map(i=>u[i]),v=this.style._mergedSourceCaches;for(let a in this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(i.o.now()),this.imageManager.beginFrame(),v){let i=v[a];i.used&&(i.prepare(this.context),i.getSource().usedInConflation&&++g)}let b=!1;for(let i of x)i.isHidden(this.transform.zoom)||("clip"===i.type&&(b=!0),this.prepareLayer(i));let w={},T={},S={},I={},E={};for(let i in v){let r=v[i];w[i]=r.getVisibleCoordinates(),T[i]=w[i].slice().reverse(),S[i]=r.getVisibleCoordinates(!0).reverse(),I[i]=r.getShadowCasterCoordinates(),E[i]=r.sortCoordinatesByDistance(w[i])}let A=i=>{let r=this.style.getLayerSourceCache(i);return r&&r.used?r.getSource():null};if(g||b||this._clippingActiveLastFrame){let r=[],a=[],n=0;for(let i of x)this.isSourceForClippingOrConflation(i,A(i))&&(r.push(i),a.push(n)),n++;if(r&&(b||r.length>1)||this._clippingActiveLastFrame){b=!1;let n=[];for(let o=0;o<r.length;o++){let s=r[o],l=a[o],h=this.style.getLayerSourceCache(s);if(!h||!h.used||!h.getSource().usedInConflation&&"clip"!==s.type&&"building"!==s.type)continue;let u=i.eG,c=i.bB.None,d=[],p=!0;if("building"===s.type)u=i.eI;else if("clip"===s.type)if(u=l,s.isHidden(this.transform.zoom))p=!1;else{if(!s.layout){p=!1;continue}
111for(let r of s.layout.get("clip-layer-types"))c|="model"===r?i.bB.Model:"symbol"===r?i.bB.Symbol:i.bB.FillExtrusion;for(let i of s.layout.get("clip-layer-scope"))d.push(i);b=!0}p&&n.push({layer:s.fqid,cache:h,order:u,clipMask:c,clipScope:d})}this.replacementSource.setSources(n),y=!0}}this._clippingActiveLastFrame=b,y||this.replacementSource.clear(),this.conflationActive=y,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let i=0;i<x.length;i++){let r=x[i];if("none"===r.visibility)continue;let a=r.cutoffRange();if(this.longestCutoffRange=Math.max(a,this.longestCutoffRange),a>0){let i=A(r);i&&(this.minCutoffZoom=Math.max(i.minzoom,this.minCutoffZoom)),r.minzoom&&(this.minCutoffZoom=Math.max(r.minzoom,this.minCutoffZoom))}r.is3D(c)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=i),this._lastOcclusionLayer=i)}let C=this.style&&this.style.fog;C?(this._fogVisible=0!==C.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=C.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(S),this.opaquePassCutoff=0,x=(p=d()).map(i=>u[i]));let M=this._shadowRenderer;if(M)for(let i in M.updateShadowParameters(this.transform,this.style.directionalLight),v)for(let r of w[i]){let i={min:0,max:0};this.terrain&&(i=this.terrain.getMinMaxForTile(r)||i),M.addShadowReceiver(r.toUnwrapped(),i.min,i.max)}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new i.eH(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ns(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let P=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),D=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(P&&!this._snow&&(this._snow=new nL(this)),!P&&this._snow&&(this._snow.destroy(),delete this._snow),D&&!this._rain&&(this._rain=new nD(this)),!D&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),_){this.buildingTileBorderManager||(this.buildingTileBorderManager=new nl);let i=this.style.getLayerSourceCache(_);this.buildingTileBorderManager.updateBorders(i,_)}if(!K.has(this.context.gl))return;for(let i of(this.renderPass="offscreen",x)){let a=r.getLayerSourceCache(i);if(!i.hasOffscreenPass()||i.isHidden(this.transform.zoom))continue;let n=a?T[a.id]:void 0;("custom"===i.type||"raster"===i.type||"raster-particle"===i.type||i.isSky()||n&&n.length)&&this.renderLayer(this,a,i,n)}this.depthRangeFor3D=[0,1-(x.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,I)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);let R="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),L=(()=>{if(a.showOverdrawInspector)return i.aq.black;let r=this.style.fog;if(r&&this.transform.projection.supportsFog){let a=this.style.getLut(r.scope);if(!R){let n="none"===r.properties.get("color-use-theme"),o=r.properties.get("color").toNonPremultipliedRenderColor(n?null:a).toArray01();return new i.aq(...o)}if(R){let n="none"===r.properties.get("space-color-use-theme"),o=r.properties.get("space-color").toNonPremultipliedRenderColor(n?null:a).toArray01();return new i.aq(...o)}}return i.aq.transparent})();if(this.context.clear({color:L,depth:1}),this.clearStencil(),this._showOverdrawInspector=a.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&R&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){let i=x[this.currentLayer],a=r.getLayerSourceCache(i);if(i.isSky())continue;let n=a?(i.is3D(c)?E:T)[a.id]:void 0;this._renderTileClippingMasks(i,a,n),this.renderLayer(this,a,i,n)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&R&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||i.al(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isH
111orizonVisible()))for(this.currentLayer=0;this.currentLayer<p.length;this.currentLayer++){let i=x[this.currentLayer],a=r.getLayerSourceCache(i);i.isSky()&&this.renderLayer(this,a,i,a?T[a.id]:void 0)}function z(i,r){let a;return r&&(a=("symbol"===i.type?S:i.is3D(c)?E:T)[r.id]),a}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<p.length;){let i=x[this.currentLayer];if("raster"===i.type||"raster-particle"===i.type){let a=r.getLayerSourceCache(i);this.renderLayer(this,a,i,z(i,a))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let F=M?M.getGroundShadowLayerIndex():-1,O=!1,B=-1;for(let i=0;i<p.length;++i){let r=x[i];r.isHidden(this.transform.zoom)||r.is3D(c)&&(B=i)}m&&-1===B&&(f=!0);let k=!1;for(;this.currentLayer<p.length;){let i=x[this.currentLayer],a=r.getLayerSourceCache(i);if(i.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(i)){if(i.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!k&&i.is3D(c)&&!c){let i=this.currentLayer,r=i=>{for(this.currentLayer=0;this.currentLayer<x.length;this.currentLayer++){let r=x[this.currentLayer];if(nO[r.type]){let a=this.style.getLayerSourceCache(r);nO[r.type](this,a,r,z(r,a),i)}}};r("initialize"),r("reset"),this.currentLayer=i,k=!0}if(f&&!O&&this.terrain&&!this.transform.isOrthographic&&(O=!0,this.blitDepth()),m&&-1!==B&&this.currentLayer===B+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(i,a,a?w[a.id]:void 0),this.renderLayer(this,a,i,z(i,a)),!this.terrain&&M&&this.currentLayer===F){{this.clearStencil(),this.resetStencilClippingMasks();let i=this.currentLayer;for(this.currentLayer=0;this.currentLayer<x.length;this.currentLayer++){let i=x[this.currentLayer];if(nB[i.type]){let r=this.style.getLayerSourceCache(i);nB[i.type](this,r,i,z(i,r))}}this.currentLayer=i}if(M.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){let i=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=i;this.currentLayer++){let i=x[this.currentLayer];if(!i.hasLightBeamPass())continue;let a=r.getLayerSourceCache(i);this.renderLayer(this,a,i,a?T[a.id]:void 0)}this.currentLayer=i,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){let i=this.currentLayer;for(let i of(this.depthOcclusion=!0,this.layersWithOcclusionOpacity)){this.currentLayer=i;let a=x[this.currentLayer],n=r.getLayerSourceCache(a),o=n?T[n.id]:void 0;this.terrain||this._renderTileClippingMasks(a,n,n?w[n.id]:void 0),this.renderLayer(this,n,a,o)}this.depthOcclusion=!1,this.currentLayer=i,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let a=null;x.forEach(i=>{let n=r.getLayerSourceCache(i);n&&!i.isHidden(this.transform.zoom)&&n.getVisibleCoordinates().length&&(!a||a.getSource().maxzoom<n.getSource().maxzoom)&&(a=n)}),a&&this.options.showTileBoundaries&&a5(this,a,a.getVisibleCoordinates(),i.aq.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&a5(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new i.aq(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&(s=this.transform.padding,a6(this,this.transform.height-(s.top||0),3,aQ),a6(this,s.bottom||0,3,a0),a8(this,s.left||0,3,a1),a8(this,this.transform.width-(s.right||0),3,a2),l=this.transform.centerPoint,n=l.x,a9(this,n-1,(o=this.transform.height-l.y)-10,2,20,a3),a9(this,n-10,o-1,20,2,a3)),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
111anvasCopy()),y||(this.conflationActive=!1)}prepareLayer(i){this.gpuTimingStart(i);let{unsupportedLayers:r}=this.transform.projection,a=!r||!r.includes(i.type);if(nF[i.type]&&(a||this.terrain&&"custom"===i.type)){let r=this.style.getLayerSourceCache(i);nF[i.type](i,r,this)}this.gpuTimingEnd()}renderLayer(i,r,a,n){a.isHidden(this.transform.zoom)||("background"===a.type||"sky"===a.type||"custom"===a.type||"model"===a.type||"raster"===a.type||"raster-particle"===a.type||n&&n.length)&&(this.id=a.id,this.gpuTimingStart(a),i.transform.projection.unsupportedLayers&&i.transform.projection.unsupportedLayers.includes(a.type)&&(!i.terrain||"custom"!==a.type)||"clip"===a.type||nz[a.type](i,r,a,n,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;let r=this.context.extTimerQuery,a=this.context.gl,n=this.gpuTimers[i.id];n||(n=this.gpuTimers[i.id]={calls:0,cpuTime:0,query:a.createQuery()}),n.calls++,a.beginQuery(r.TIME_ELAPSED_EXT,n.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let i=this.context.extTimerQuery,r=this.context.gl,a=r.createQuery();this.deferredRenderGpuTimeQueries.push(a),r.beginQuery(i.TIME_ELAPSED_EXT,a)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){let i=this.gpuTimers;return this.gpuTimers={},i}collectDeferredRenderGpuQueries(){let i=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],i}queryGpuTimers(i){let r={};for(let a in i){let n=i[a],o=this.context.extTimerQuery,s=o.getQueryParameter(n.query,this.context.gl.QUERY_RESULT)/1e6;o.deleteQueryEXT(n.query),r[a]=s}return r}queryGpuTimeDeferredRender(i){if(!this.options.gpuTimingDeferredRender)return 0;let r=this.context.gl,a=0;for(let n of i)a+=r.getQueryParameter(n,r.QUERY_RESULT)/1e6,r.deleteQuery(n);return a}translatePosMatrix(r,a,n,o,s){if(!n[0]&&!n[1])return r;let l=s?"map"===o?this.transform.angle:0:"viewport"===o?-this.transform.angle:0;if(l){let i=Math.sin(l),r=Math.cos(l);n=[n[0]*r-n[1]*i,n[0]*i+n[1]*r]}let h=[s?n[0]:i.aA(a,n[0],this.transform.zoom),s?n[1]:i.aA(a,n[1],this.transform.zoom),0],u=new Float32Array(16);return i.by(u,r,h),u}saveTileTexture(i){if(i.context!==this.context)return;let r=i.size[0],a=this._tileTextures[r];a?a.push(i):this._tileTextures[r]=[i]}getTileTexture(i){let r=this._tileTextures[i];return r&&r.length>0?r.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(i,r,a){let n=void 0===a?this.terrain&&this.terrain.renderingToTexture:a,o=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===i||"terrainRaster"===i?(o.push("LIGHTING_3D_MODE"),o.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):n||o.push("LIGHTING_3D_MODE")),this.terrainRenderModeElevated()&&(o.push("TERRAIN"),this.linearFloatFilteringSupported()&&o.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&o.push("GLOBE"),this._fogVisible&&!n&&(void 0===r||r)&&o.push("FOG"),n&&o.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&o.push("OVERDRAW_INSPECTOR"),o}getOrCreateProgram(i,r){this.cache=this.cache||{};let a=r&&r.defines||[],n=r&&r.config,o=this.currentGlobalDefines(i,r&&r.overrideFog,r&&r.overrideRtt).concat(a),s=rK.cacheKey(i3[i],i,o,n);return this.cache[s]||(this.cache[s]=new rK(this.context,i,i3[i],n,aT[i],o)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
111stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,a){if(this.style.enable3dLights()){let s=this.style.directionalLight,l=this.style.ambientLight;if(s&&l){var n,o;let h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,I,E,A=(n=this.style,h=s.properties.get("direction"),u="none"===s.properties.get("color-use-theme"),c=s.properties.get("color").toNonPremultipliedRenderColor(u?null:n.getLut(s.scope)).toArray01(),d=s.properties.get("intensity"),p="none"===l.properties.get("color-use-theme"),f=l.properties.get("color").toNonPremultipliedRenderColor(p?null:n.getLut(l.scope)).toArray01(),m=l.properties.get("intensity"),_=[h.x,h.y,h.z],g=i.dz(f,m),{u_lighting_ambient_color:g,u_lighting_directional_dir:_,u_lighting_directional_color:y=i.dz(c,d),u_ground_radiance:(o=[0,0,1],x=i.bj(o,_),v=i.bj(y,[.2126,.7152,.0722]),w=(b=(i,r,a)=>(1-a)*i+a*r)(1-.3*Math.min(v,1),1,Math.min(x+1,1)),T=b(.92,1,Math.asin(i.aC(o[2],-1,1))/Math.PI+.5)*w,S=[0,0,0],i.bK(S,g.slice(0,3),T),I=[0,0,0],i.bK(I,y.slice(0,3),_[2]),E=[0,0,0],i.cP(E,S,I),i.cS(E))});a.setLightsUniformValues(r,A)}}}uploadCommonUniforms(r,a,n,o,s){if(this.uploadCommonLightUniforms(r,a),this.terrain&&this.terrain.renderingToTexture)return;let l=this.style.fog;if(l){let s=l.getOpacity(this.transform.pitch),h=((r,a,n,o,s,l,h,u,c,d,p,f)=>{let m=r.transform,_="none"===a.properties.get("color-use-theme"),g=a.properties.get("color").toNonPremultipliedRenderColor(_?null:r.style.getLut(a.scope)).toArray01();g[3]=o;let y=r.frameCounter/1e3%1,[x,v]=a.properties.get("vertical-range");return{u_fog_matrix:n?m.calculateFogTileMatrix(n):f||r.identityMat,u_fog_range:a.getFovAdjustedRange(m._fov),u_fog_color:g,u_fog_horizon_blend:a.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(x,v),v],u_fog_temporal_offset:y,u_frustum_tl:s,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:d,u_viewport:p,u_globe_transition:i.al(m.zoom),u_is_globe:+("globe"===m.projection.name)}})(this,l,n,s,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*i.o.devicePixelRatio,this.transform.height*i.o.devicePixelRatio],o);a.setFogUniformValues(r,h)}s&&a.setCutoffUniformValues(r,s.uniformValues)}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){let i=this.canvasCopy();i&&(this.frameCopies.push(i),this.tileLoaded=!1)}canvasCopy(){let i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}getBackgroundTiles(){let r=this._backgroundTiles,a=this._backgroundTiles={};for(let n of this.transform.coveringTiles({tileSize:512}))a[n.key]=r[n.key]||new i.b1(n,512,this.transform.tileZoom,this,void 0,this.worldview);return a}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(i,r){return!(!i.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==i.type&&"building"!==i.type&&(i.minzoom&&i.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==i.sourceLayer&&"procedural_buildings"!==i.sourceLayer)&&(!r||"batched-model"!==r.type)))}isTileAffectedByFog(i){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let r=this._cachedTileFogOpacities[i.key];return r||(this._cachedTileFogOpacities[i.key]=r=this.style.fog.getOpacityForTile(i)),r[0]>=.05||r[1]>=.05}setupDepthForOcclusion(i,r,a){var n;let o=this.context,s=o.gl,l=!!a;a||(a={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),o.activeTexture.set(s.TEXTURE3),i&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),a.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],a.u_depth_range_unpack=[2/((n=this.depthRangeFor3D)[1]-n[0]),-1-2*n[0]/(n[1]-n[0])],a.u_occluder_half_size=.5*this.occlusionParams.occluderSize,a.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
111DepthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE0),l||r.setTerrainUniformValues(o,a)}updateEmissiveMode(){if(this._forceEmissiveMode)return;let i=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=i?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function nV(i,r){let a=!1,n=null,o=()=>{n=null,a&&(i(),n=setTimeout(o,r),a=!1)};return()=>(a=!0,n||o(),n)}class nN{constructor(r){this._hashName=r&&encodeURIComponent(r),i.a_(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=nV(this._updateHashUnthrottled.bind(this),300)}addTo(i){return this._map=i,window.addEventListener("hashchange",this._onHashChange,!1),i.on("moveend",this._updateHash),this}remove(){return this._map&&(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0),this}getHashString(){let i=this._map;if(!i)return"";let r=nU(i);if(this._hashName){let i=this._hashName,a=!1,n=location.hash.slice(1).split("&").map(n=>{let o=n.split("=")[0];return o===i?(a=!0,`${o}=${r}`):n}).filter(i=>i);return a||n.push(`${i}=${r}`),`#${n.join("&")}`}return`#${r}`}_getCurrentHash(){let i=location.hash.replace("#","");if(this._hashName){let r;return i.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(r=i)}),(r&&r[1]||"").split("/")}return i.split("/")}_onHashChange(){let i=this._map;if(!i)return!1;let r=this._getCurrentHash();if(r.length>=3&&!r.some(i=>isNaN(Number(i)))){let a=i.dragRotate.isEnabled()&&i.touchZoomRotate.isEnabled()?+(r[3]||0):i.getBearing();return i.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:a,pitch:+(r[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function nU(i,r){let a=i.getCenter(),n=Math.round(100*i.getZoom())/100,o=Math.pow(10,Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10)),s=Math.round(a.lng*o)/o,l=Math.round(a.lat*o)/o,h=i.getBearing(),u=i.getPitch(),c=r?`/${s}/${l}/${n}`:`${n}/${l}/${s}`;return(h||u)&&(c+="/"+Math.round(10*h)/10),u&&(c+=`/${Math.round(u)}`),c}let nj={linearity:.3,easing:i.eJ(0,0,.3,1)},nG=Object.assign({deceleration:2500,maxSpeed:1400},nj),nq=Object.assign({deceleration:20,maxSpeed:1400},nj),n$=Object.assign({deceleration:1e3,maxSpeed:360},nj),nH=Object.assign({deceleration:1e3,maxSpeed:90},nj);class nZ{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.o.now(),settings:r})}_drainInertiaBuffer(){let r=this._inertiaBuffer,a=i.o.now();for(;r.length>0&&a-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;let a={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:i}of this._inertiaBuffer)a.zoom+=i.zoomDelta||0,a.bearing+=i.bearingDelta||0,a.pitch+=i.pitchDelta||0,i.panDelta&&a.pan._add(i.panDelta),i.around&&(a.around=i.around),i.pinchAround&&(a.pinchAround=i.pinchAround);let n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(a.pan.mag()){let i=nX(a.pan.mag(),n,Object.assign({},nG,r||{}));o.offset=a.pan.mult(i.amount/a.pan.mag()),o.center=this._map.transform.center,nW(o,i)}if(a.zoom){let i=nX(a.zoom,n,nq);o.zoom=this._map.transform.zoom+i.amount,nW(o,i)}if(a.bearing){let r=nX(a.bearing,n,n$);o.bearing=this._map.transform.bearing+i.aC(r.amount,-179,179),nW(o,r)}if(a.pitch){let i=nX(a.pitch,n,nH);o.pitch=this._map.transform.pitch+i.amount,nW(o,i)}if(o.zoom||o.bearing){let i=void 0===a.pinchAround?a.around:a.pinchAround;o.around=i?this._map.unproject(i):this._map.getCenter()}return this.clear(),o.noMoveStart=!0,o}}function nW(i,r){(!i.duration||i.duration<r.duration)&&(i.duration=r.duration,i.easing=r.easing)}function nX(r,a,n){let{maxSpeed:o,linearity:s,deceleration:l}=n,h=i.aC(r*s/(a/1e3),-o,o),u=Math.abs(h)/(l*s);return{easing:n.easing,duration:1e3*u,amount:u/2*h}}class nY extends i.C{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){const o=S(r.getCanvasContainer(),a),s=r.unproject(o);super(i,Object.assign({point:o,lngLat:s,originalEvent:a}
111,n)),this._defaultPrevented=!1,this.target=r}}class nK extends i.C{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,n){const o="touchend"===r?n.changedTouches:n.touches,s=I(a.getCanvasContainer(),o),l=s.map(i=>a.unproject(i)),h=s.reduce((i,r,a,n)=>i.add(r.div(n.length)),new i.P(0,0));super(r,{points:s,point:h,lngLats:l,lngLat:a.unproject(h),originalEvent:n}),this._defaultPrevented=!1}}class nJ extends i.C{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r){super("wheel",{originalEvent:r}),this._defaultPrevented=!1}}class nQ{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){this._mousedownPos=void 0}wheel(i){return this._firePreventable(new nJ(this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new nY(i.type,this._map,i))}mouseup(i){this._map.fire(new nY(i.type,this._map,i))}preclick(i){let r=new MouseEvent("preclick",i);this._map.fire(new nY(r.type,this._map,r))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new nY(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new nY(i.type,this._map,i))}mouseover(i){this._map.fire(new nY(i.type,this._map,i))}mouseout(i){this._map.fire(new nY(i.type,this._map,i))}touchstart(i){return this._firePreventable(new nK(i.type,this._map,i))}touchmove(i){this._map.fire(new nK(i.type,this._map,i))}touchend(i){this._map.fire(new nK(i.type,this._map,i))}touchcancel(i){this._map.fire(new nK(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class n0{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(i){this._map.fire(new nY(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new nY("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new nY(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class n1{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(v(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active)return;let a=this._startPos,n=this._lastPos;if(!a||!n||n.equals(r)||!this._box&&r.dist(a)<this._clickTolerance)return;this._lastPos=r,this._box||(this._box=_("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));let o=Math.min(a.x,r.x),s=Math.max(a.x,r.x),l=Math.min(a.y,r.y),h=Math.max(a.y,r.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${o}px,${l}px)`,this._box.style.width=s-o+"px",this._box.style.height=h-l+"px")})}mouseupWindow(r,a){if(!this._active)return;let n=this._startPos;if(n&&0===r.button){if(this.reset(),T(),n.x!==a.x||n.y!==a.y)return this._map.fire(new i.C("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(n,a,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(i){this._active&&27===i.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),b(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new i.C(r,{originalEvent:a}))}}function n2(i,r){let a={};for(let n=0;n<i.length;n++)a[i[n].identifier]=r[n];return a}class n3{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,a,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=r.timeStamp),n.length===this.numTouches&&(this.centroid=function(r){let a=new i.P(0,0);for(let i of r)a._add(i);return a.div(r.length)}(a),this.touches=n2(n,a)))}touchmove(i,r,a){if(this.aborted||!this.centroid)return;let n=n2(a,r);for(let i in this.touches){let r=n[i];(!r||r.dist(this.touches[i])>30)&&(this.aborted=!0)}}touchend(i,r,a){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===a.length){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}}class n5{constructor(i){this.singleTap=new n3(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(i,r,a){this.singleTap.touchstart(i,r,a)}touchmove(i,r,a){this.singleTap.touchmove(i,r,a)}touchend(i,r,a){let n=this.singleTap.touchend(i,r,a);if(n){let r=i.timeStamp-this.lastTime<500,a=!this.lastTap||30>this.lastTap.dist(n);if(r&&a||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class n4{constructor(){this._zoomIn=new n5({numTouches:1,numTaps:2}),this._zoomOut=new n5({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,a){this._zoomIn.touchstart(i,r,a),this._zoomOut.touchstart(i,r,a)}touchmove(i,r,a){this._zoomIn.touchmove(i,r,a),this._zoomOut.touchmove(i,r,a)}touchend(i,r,a){let n=this._zoomIn.touchend(i,r,a),o=this._zoomOut.touchend(i,r,a);return n?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(n)},{originalEvent:i})}):o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(o)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let n6={0:1,2:2},n8={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class n9{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(i,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;let a=E(i);this._correctButton(i,a)&&(this._lastPoint=r,this._eventButton=a)}mousemoveWindow(i,r){let a=this._lastPoint;if(a){let n;if(i.preventDefault(),null!=this._eventButton&&(n=n6[this._eventButton],void 0===i.buttons||(i.buttons&n)!==n))this.reset();else if(this._moved||!(r.dist(a)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(a,r)}}mouseupWindow(i){this._lastPoint&&E(i)===this._eventButton&&(this._moved&&T(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class n7 extends n9{mousedown(i,r){super.mousedown(i,r),this._lastPoint&&(this._active=!0)}_correctButton(i,r){return 0===r&&!i.ctrlKey}_move(i,r){return{around:r,panDelta:r.sub(i)}}}class oe extends n9{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?n8[i.pitchRotateKey]:void 0}_correctButton(i,r){return this._pitchRotateKey?0===r&&i[this._pitchRotateKey]:0===r&&i.ctrlKey||2===r}_move(i,r){let a=.8*(r.x-i.x);if(a)return this._active=!0,{bearingDelta:a}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class ot extends n9{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?n8[i.pitchRotateKey]:void 0}_correctButton(i,r){return this._pitchRotateKey?0===r&&i[this._pitchRotateKey]:0===r&&i.ctrlKey||2===r}_move(i,r){let a=-.5*(r.y-i.y);if(a)return this._active=!0,{pitchDelta:a}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class oi{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=a.clickTolerance||1,this.reset(),i.a_(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}touchstart(i,r,a){return this._calculateTransform(i,r,a)}touchmove(r,a,n){if(this._active&&!(n.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===n.length&&!i.eK())return void this._showTouchPanBlockerAlert();
111"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,a,n)}}touchend(i,r,a){this._calculateTransform(i,r,a),this._active&&a.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,a,n){n.length>0&&(this._active=!0);let o=n2(n,a),s=new i.P(0,0),l=new i.P(0,0),h=0;for(let i in o){let r=o[i],a=this._touches[i];a&&(s._add(r),l._add(r.sub(a)),h++,o[i]=r)}if(this._touches=o,h<this._minTouches||!l.mag())return;let u=l.div(h);return this._sum._add(u),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(h),panDelta:u}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=_("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class or{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(i){}_move(i,r,a){return{}}touchstart(i,r,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([r[0],r[1]]))}touchmove(i,r,a){let n=this._firstTwoTouches;if(!n)return;i.preventDefault();let[o,s]=n,l=oa(a,r,o),h=oa(a,r,s);if(!l||!h)return;let u=this._aroundCenter?null:l.add(h).div(2);return this._move([l,h],u,i)}touchend(i,r,a){if(!this._firstTwoTouches)return;let[n,o]=this._firstTwoTouches,s=oa(a,r,n),l=oa(a,r,o);s&&l||(this._active&&T(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function oa(i,r,a){for(let n=0;n<i.length;n++)if(i[n].identifier===a)return r[n]}function on(i,r){return Math.log2(i/r)}class oo extends or{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,r){let a=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(.1>Math.abs(on(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:on(this._distance,a),pinchAround:r}}}function os(i,r){return 180*i.angleWith(r)/Math.PI}class ol extends or{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,r){let a=this._vector;if(this._vector=i[0].sub(i[1]),a&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:os(this._vector,a),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let r=25/(Math.PI*this._minDiameter)*360,a=this._startVector;return!!a&&Math.abs(os(i,a))<r}}function oh(i){return Math.abs(i.y)>Math.abs(i.x)}class ou extends or{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(i){this._lastPoints=i,oh(i[0].sub(i[1]))&&(this._valid=!1)}_move(r,a,n){let o=this._lastPoints;if(!o)return;let s=r[0].sub(o[0]),l=r[1].sub(o[1]);return this._map._cooperativeGestures&&!i.eK()&&n.touches.length<3||(this._val
111id=this.gestureBeginsVertically(s,l,n.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:-((s.y+l.y)/2*.5)})}gestureBeginsVertically(i,r,a){if(void 0!==this._valid)return this._valid;let n=i.mag()>=2,o=r.mag()>=2;if(!n&&!o)return;if(!n||!o)return null==this._firstMove&&(this._firstMove=a),a-this._firstMove<100&&void 0;let s=i.y>0==r.y>0;return oh(i)&&oh(r)&&s}}let oc=100,od=15,op=10;class of{constructor(){this._panStep=oc,this._bearingStep=od,this._pitchStep=op,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,a=0,n=0,o=0,s=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?a=-1:(i.preventDefault(),o=-1);break;case 39:i.shiftKey?a=1:(i.preventDefault(),o=1);break;case 38:i.shiftKey?n=1:(i.preventDefault(),s=-1);break;case 40:i.shiftKey?n=-1:(i.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(a=0,n=0),{cameraAnimation:l=>{let h=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:om,zoom:r?Math.round(h)+r*(i.shiftKey?2:1):h,bearing:l.getBearing()+a*this._bearingStep,pitch:l.getPitch()+n*this._pitchStep,offset:[-o*this._panStep,-s*this._panStep],center:l.getCenter()},{originalEvent:i})}}}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 om(i){return i*(2-i)}let o_=1/450;class og{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._handler=a,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=o_,i.a_(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||i.eK()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let a=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY,n=i.o.now(),o=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==a&&a%4.000244140625==0?this._type="wheel":0!==a&&4>Math.abs(a)?this._type="trackpad":o>400?(this._type=null,this._lastValue=a,this._timeout=window.setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(o*a)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),r.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=r,this._delta-=a,this._active||this._start(r)),r.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=S(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let r=this._map.transform;"wheel"===this._type&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);let a=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==n&&(n=1/n);let o=a(),s=Math.pow(2,o),l="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(l*n))),"wheel"===this._type&&(this._startZoom=o,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}let n="number"==typeof this._targetZoom?this._targetZoom:a(),o=this._startZoom,s=this._easing,l,h=!1;if("wheel"===this._type&&o&&s){let r=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),a=s(r);l=i.am(o,n,a),r<1?this._frameId||(this._frameId=!0):h=!0}else l=n,h=!0;this._active=!0,h&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>
111{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let u=l-a();return u*this._lastDelta<0&&(u=0),{noInertia:!0,needsRenderFrame:!h,zoomDelta:u,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let a=i.eL;if(this._prevEase){let r=this._prevEase,n=(i.o.now()-r.start)/r.duration,o=r.easing(n+.01)-r.easing(n),s=.27/Math.sqrt(o*o+1e-4)*.01,l=Math.sqrt(.0729-s*s);a=i.eJ(s,l,.25,1)}return this._prevEase={start:i.o.now(),duration:r,easing:a},a}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=_("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class oy{constructor(i,r){this._clickZoom=i,this._tapZoom=r}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()}}class ox{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:a.getZoom()+(i.shiftKey?-1:1),around:a.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ov{constructor(){this._tap=new n5({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(i,r,a){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=r[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(i,r,a))}touchmove(i,r,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;let n=r[0],o=n.y-this._swipePoint.y;return this._swipePoint=n,i.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(i,r,a)}touchend(i,r,a){this._tapTime?this._swipePoint&&0===a.length&&this.reset():this._tap.touchend(i,r,a)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ob{constructor(i,r,a){this._el=i,this._mousePan=r,this._touchPan=a}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ow{constructor(i,r,a){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=a}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class oT{constructor(i,r,a,n){this._el=i,this._touchZoom=r,this._touchRotate=a,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let oS=i=>i.zoom||i.drag||i.pitch||i.rotate;class oI extends i.C{}class oE{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,a){let n=i.ax([],a,r);this.radius=i.ai(n[2]<0?i.eN([],n,this.constants):[n[0],n[1],0])}projectRay(r){i.eN(r,r,this.constants),i.ay(r,r),i.eO(r,r,this.constants);let a=i.bK([],r,this.radius);if(a[2]>0){let r=i.bK([],[0,0,1],i.bj(a,[0,0,1])),n=i.bK([],i.ay([],[a[0],a[1],0]),this.radius),o=i.cP([],a,i.bK([],i.ax([],i.cP([],n,r),a),2));a[0]=o[0],a[1]=o[1]}return a}}function oA(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class oC{constructor(r,a){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new nZ(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new oE,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(a),i.a_(["handleEvent","handleWindowEvent"],this);const n=this._el;for(const[i,r,a]of(this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]],this._listeners)){const n=i===document?this.handleWindowEvent:this.handleEvent;i.addEventListener(r,n,a)}}destroy(){for(let[i,r,a]of this._listeners){let n=i===document?this.handleWindowEvent:this.handleEvent;i.removeEventListener(r,n,a)}}_addDefaultHandlers(i){let r=this._map,a=r.getCanvasContainer();this._add("mapEvent",new nQ(r,i));let n=r.boxZoom=new n1(r,i);this._add("boxZoom",n);let o=new n4,s=new ox;r.doubleClickZoom=new oy(s,o),this._add("tapZoom",o),this._add("clickZoom",s);let l=new ov;this._add("tapDragZoom",l);let h=r.touchPitch=new ou(r);this._add("touchPitch",h);let u=new oe(i),c=new ot(i);r.dragRotate=new ow(i,u,c),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);let d=new n7(i),p=new oi(r,i);r.dragPan=new ob(a,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]);let f=new ol,m=new oo;r.touchZoomRotate=new oT(a,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new n0(r));let _=r.scrollZoom=new og(r,this);this._add("scrollZoom",_,["mousePan"]);let g=r.keyboard=new of;
111for(let a of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))i.interactive&&i[a]&&r[a].enable(i[a])}_add(i,r,a){this._handlers.push({handlerName:i,handler:r,allowed:a}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(let{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[],this._originalZoom=void 0}}isActive(){for(let{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!oS(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(i,r,a){for(let n in i)if(n!==a&&(!r||0>r.indexOf(n)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){let r=[];for(let a of i)this._el.contains(a.target)&&r.push(a);return r}handleEvent(i,r){this._updatingCamera=!0;let a="renderFrame"===i.type,n=a?void 0:i,o={needsRenderFrame:!1},s={},l={},h=i.touches?this._getMapTouches(i.touches):void 0,u=h?I(this._el,h):a?void 0:S(this._el,i);for(let{handlerName:a,handler:c,allowed:d}of this._handlers){let p;c.isEnabled()&&(this._blockedByActive(l,d,a)?c.reset():c[r||i.type]&&(p=c[r||i.type](i,u,h),this.mergeHandlerResult(o,s,p,a,n),p&&p.needsRenderFrame&&this._triggerRenderFrame()),(p||c.isActive())&&(l[a]=c))}let c={};for(let i in this._previousActiveHandlers)l[i]||(c[i]=n);this._previousActiveHandlers=l,(Object.keys(c).length||oA(o))&&(this._changes.push([o,s,c]),this._triggerRenderFrame()),(Object.keys(l).length||oA(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:d}=o;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(i,r,a,n,o){if(!a)return;Object.assign(i,a);let s={handlerName:n,originalEvent:a.originalEvent||o};void 0!==a.zoomDelta&&(r.zoom=s),void 0!==a.panDelta&&(r.drag=s),void 0!==a.pitchDelta&&(r.pitch=s),void 0!==a.bearingDelta&&(r.rotate=s)}_applyChanges(){let r={},a={},n={};for(let[o,s,l]of this._changes)o.panDelta&&(r.panDelta=(r.panDelta||new i.P(0,0))._add(o.panDelta)),o.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+o.pitchDelta),void 0!==o.around&&(r.around=o.around),void 0!==o.aroundCoord&&(r.aroundCoord=o.aroundCoord),void 0!==o.pinchAround&&(r.pinchAround=o.pinchAround),o.noInertia&&(r.noInertia=o.noInertia),Object.assign(a,s),Object.assign(n,l);this._updateMapTransform(r,a,n),this._changes=[]}_updateMapTransform(r,a,n){let o,s=this._map,l=s.transform,h=i=>[i.x,i.y,i.z];if((o=this._eventsInProgress.drag)&&!this._handlersById[o.handlerName].isActive()&&!oA(r)){let i=l.zoom;l.cameraElevationReference="sea",null!=this._originalZoom&&l._orthographicProjectionAtLowPitch&&"globe"!==l.projection.name&&0===l.pitch?(l.cameraElevationReference="ground",l.zoom=this._originalZoom):(l.recenterOnTerrain(),l.cameraElevationReference="ground"),i!==l.zoom&&this._map._update(!0)}if(l._isCameraConstrained&&s._stop(!0),!oA(r))return void this._fireEvents(a,n,!0);let{panDelta:u,zoomDelta:c,bearingDelta:d,pitchDelta:p,around:f,aroundCoord:m,pinchAround:_}=r;l._isCameraConstrained&&(c>0&&(c=0),l._isCameraConstrained=!1),void 0!==_&&(f=_),(c||a.drag&&!this._eventsInProgress.drag)&&f&&(this._dragOrigin=h(l.pointCoordinate3D(f)),this._originalZoom=l.zoom,this._trackingEllipsoid.setup(l._camera.position,this._dragOrigin)),l.cameraElevationReference="sea",s._stop(!0),f=f||s.transform.centerPoint,d&&(l.bearing+=d),p&&(l.pitch+=p),l._updateCameraState();let g=[0,0,0];if(u)if("mercator"===l.projection.name){let i=this._trackingEllipsoid.projectRay(l.screenPointToMercatorRay(f).dir),r=this._trackingEllipsoid.projectRay(l.screenPointToMercatorRay(f.sub(u)).dir);g[0]=r[0]-i[0],g[1]=r[1]-i[1]}else{let r=l.pointCoordinate(f);if("globe"===l.projection.name){u=u.rotate(-l.angle);let a=l._pixelsPerMercatorPixel/l.worldSize;g[0]=-u.x*i.eM(i.bW(r.y))*a,g[1]=-u.y*i.eM(l.center.lat)*a}else{let i=l.pointCoordinate(f.sub(u));r&&i&&(g[0]=i.x-r.x,g[1]=i.y-r.y)}}let y=l.zoom,x=[0,0,0];if(c){let r=h(m||l.pointCoordinate3D(f)),a={dir:i.ay([],i.ax([],r,l._camera.position))};if(a.dir[2]<0){let n=l.zoomDeltaToMovement(r,c);i.bK(x,a.dir,n)}}let v=i.cP(g,g,x);l._translateCameraConstrained(v),c&&Math.abs(l.zoom-y)>1e-4&&l.recenterOnTerrain(),l.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(a,n,!0)}
111_fireEvents(r,a,n){let o,s=oS(this._eventsInProgress),l=oS(r),h={};for(let i in r){let{originalEvent:a}=r[i];this._eventsInProgress[i]||(h[`${i}start`]=a),this._eventsInProgress[i]=r[i]}for(let i in!s&&l&&this._fireEvent("movestart",l.originalEvent),h)this._fireEvent(i,h[i]);for(let i in l&&this._fireEvent("move",l.originalEvent),r){let{originalEvent:a}=r[i];this._fireEvent(i,a)}let u={};for(let i in this._eventsInProgress){let{handlerName:r,originalEvent:n}=this._eventsInProgress[i];this._handlersById[r].isActive()||(delete this._eventsInProgress[i],o=a[r]||n,u[`${i}end`]=o)}for(let i in u)this._fireEvent(i,u[i]);let c=oS(this._eventsInProgress);if(n&&(s||l)&&!c){this._updatingCamera=!0;let r=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),a=i=>0!==i&&-this._bearingSnap<i&&i<this._bearingSnap;r?(a(r.bearing||this._map.getBearing())&&(r.bearing=0),this._map.easeTo(r,{originalEvent:o})):(this._map.fire(new i.C("moveend",{originalEvent:o})),a(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,a){this._map.fire(new i.C(r,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{this._frameId=void 0,this.handleEvent(new oI("renderFrame",{timeStamp:i})),this._applyChanges()})}
111_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let oM="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class oP extends i.E{constructor(r,a){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=a.bearingSnap,this._respectPrefersReducedMotion=!1!==a.respectPrefersReducedMotion,i.a_(["_renderFrameCallback"],this)}getCenter(){return new i.aV(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,a,n){return r=i.P.convert(r).mult(-1),this.panTo(this.transform.center,Object.assign({offset:r},a),n)}panTo(i,r,a){return this.easeTo(Object.assign({center:i},r),a)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(i,r,a){return this.easeTo(Object.assign({zoom:i},r),a)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(i,r,a){return this.easeTo(Object.assign({bearing:i},r),a)}resetNorth(i,r){return this.rotateTo(0,Object.assign({duration:1e3},i),r),this}resetNorthPitch(i,r){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},i),r),this}snapToNorth(i,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,r):this}getPitch(){return this.transform.pitch}setPitch(i,r){return this.jumpTo({pitch:i},r),this}cameraForBounds(r,a){r=i.aK.convert(r);let n=a&&a.bearing||0,o=a&&a.pitch||0,s=r.getNorthWest(),l=r.getSouthEast();return this._cameraForBounds(this.transform,s,l,n,o,a)}_extendPadding(i){let r={top:0,right:0,bottom:0,left:0};return null==i?Object.assign({},r,this.transform.padding):"number"==typeof i?{top:i,bottom:i,right:i,left:i}:Object.assign({},r,i)}_extendCameraOptions(i){return(i=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding=this._extendPadding(i.padding),i}_minimumAABBFrustumDistance(i,r){let a=r.max[0]-r.min[0],n=r.max[1]-r.min[1];return a/n>i.aspect?a/(2*Math.tan(.5*i.fovX)*i.aspect):n/(2*Math.tan(.5*i.fovY)*i.aspect)}_cameraForBoundsOnGlobe(r,a,n,o,s,l){let h=r.clone(),u=this._extendCameraOptions(l);h.bearing=o,h.pitch=s;let c=i.aV.convert(a),d=i.aV.convert(n),p=.5*(c.lat+d.lat),f=.5*(c.lng+d.lng),m=i.eP(p,f),_=i.ay([],m),g=i.ay([],i.bi([],_,[0,1,0])),y=i.bi([],g,_),x=[g[0],g[1],g[2],0,y[0],y[1],y[2],0,_[0],_[1],_[2],0,0,0,0,1],v=[m,i.eP(c.lat,c.lng),i.eP(d.lat,c.lng),i.eP(d.lat,d.lng),i.eP(c.lat,d.lng),i.eP(p,c.lng),i.eP(p,d.lng),i.eP(c.lat,f),i.eP(d.lat,f)],b=i.cQ.fromPoints(v.map(r=>[i.bj(g,r),i.bj(y,r),i.bj(_,r)])),w=i.ah([],b.center,x);0===i.eQ(w)&&i.eR(w,0,0,1),i.ay(w,w),i.bK(w,w,i.aF),h.center=i.eS(w);let T=h.getWorldToCameraMatrix(),S=i.b8(new Float64Array(16),T);b=i.cQ.applyTransform(b,i.aD([],T,x));let I=this._extendAABB(b,h,u,o);if(!I)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");b=I,i.ah(w,w,T);let E=.5*(b.max[2]-b.min[2]),A=this._minimumAABBFrustumDistance(h,b),C=i.bK([],[0,0,1],E),M=i.cP(C,w,C),P=A+(0===h.pitch?0:i.bg(w,M)),D=h.globeCenterInViewSpace,R=i.ax([],w,[D[0],D[1],D[2]]);i.ay(R,R),i.bK(R,R,P);let L=i.cP([],w,R);i.ah(L,L,S);let z=i.ez/i.aF,F=i.ai(L),O=i.bV(Math.max(F*z-i.ez,Number.EPSILON),0),B=Math.min(h.zoomFromMercatorZAdjusted(O),u.maxZoom);return B>.5*(i.cF+i.cq)?(h.setProjection({name:"mercator"}),h.zoom=B,this._cameraForBounds(h,a,n,o,s,l)):{center:h.center,zoom:B,bearing:o,pitch:s}}_extendAABB(r,a,n,o){let s=.5*((n.padding.left||0)+(n.padding.right||0)),l=.5*((n.padding.top||0)+(n.padding.bottom||0)),h=a.width-(s+s),u=a.height-(l+l),c=i.ax([],r.max,r.min),d=Math.min(h/c[0],u/c[1]),p=Math.min(a.scaleZoom(a.scale*d),n.maxZoom);if(isNaN(p))return null;let f=a.scale/a.zoomScale(p),m=new i.cQ([r.min[0]-s*f,r.min[1]-l*f,r.min[2]],[r.max[0]+s*f,r.max[1]+l*f,r.max[2]]),_=("number"==typeof n.offset.x&&"number"==typeof n.offset.y?new i.P(n.offset.x,n.offset.y):i.P.convert(n.offset)).rotate(-i.ap(o));return m.center[0]-=_.x*f,m.center[1]+=_.y*f,m}queryTerrainElevation(r,a){let n=this.transform.elevation;return n?(a=Object.assign({},{exaggerated:!0},a),n.getAtPoint(i.ag.fromLngLat(r),null,a.exaggerated)):null}_cameraForBounds(r,a,n,o,s,l){if("globe"===r.projection.name)return this._cameraForBoundsOnGlobe(r,a,n,o,s,l);let h=r.clone(),u=this._extendCameraOptions(l);h.bearing=o,h.pitch=s;let c=i.aV.convert(a),d=i.aV.convert(n),p=new i.aV(c.lng,d.lat),f=new i.aV(d.lng,c.lat),m=h.project(c),_=h.project(d),g=this.queryTerrainElevation(c),y=this.queryTerrainElevation(d),x=this.queryTerrainElevation(p),v=this.queryTerrainElevation(f),b=[[m.x,m.y,Math.min(g||0,y||0,x||0,v||0)],[_.x,_.y,Math.max(g||0,y||0,x||0,v||0)]],w=i.cQ.fromPoints(b),T=h.getWorldToCameraMatrix(),S=i.b8(new Float64Array(16),T);
111w=i.cQ.applyTransform(w,T);let I=this._extendAABB(w,h,u,o);if(!I)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");w=I;let E=.5*i.ax([],w.max,w.min)[2],A=this._minimumAABBFrustumDistance(h,w),C=[0,0,1,0];i.aE(C,C,T),i.eT(C,C);let M=i.bK([],C,A+E),P=i.cP([],w.center,M);i.ah(w.center,w.center,S),i.ah(P,P,S);let D=h.unproject(new i.P(w.center[0],w.center[1])),R=Math.pow(2,i.eU(h.projection,D)),L=Math.min(h._zoomFromMercatorZ(P[2]*h.pixelsPerMeter*R/h.worldSize),u.maxZoom);return h.mercatorFromTransition&&L<.5*(i.cF+i.cq)?(h.setProjection({name:"globe"}),h.zoom=L,this._cameraForBounds(h,a,n,o,s,l)):{center:D,zoom:L,bearing:o,pitch:s}}fitBounds(i,r,a){let n=this.cameraForBounds(i,r);return this._fitInternal(n,r,a)}fitScreenCoordinates(r,a,n,o,s){let l=i.P.convert(r),h=i.P.convert(a),u=new i.P(Math.min(l.x,h.x),Math.min(l.y,h.y)),c=new i.P(Math.max(l.x,h.x),Math.max(l.y,h.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(l,h))return this;let d=this.transform.pointLocation3D(u),p=this.transform.pointLocation3D(c),f=this.transform.pointLocation3D(new i.P(u.x,c.y)),m=this.transform.pointLocation3D(new i.P(c.x,u.y)),_=[Math.min(d.lng,p.lng,f.lng,m.lng),Math.min(d.lat,p.lat,f.lat,m.lat)],g=[Math.max(d.lng,p.lng,f.lng,m.lng),Math.max(d.lat,p.lat,f.lat,m.lat)],y=o&&o.pitch?o.pitch:this.getPitch(),x=this._cameraForBounds(this.transform,_,g,n,y,o);return this._fitInternal(x,o,s)}_fitInternal(i,r,a){return i?(r=Object.assign(i,r)).linear?this.easeTo(r,a):this.flyTo(r,a):this}jumpTo(r,a){this.stop();let n=r.preloadOnly?this.transform.clone():this.transform,o=!1,s=!1,l=!1;"zoom"in r&&n.zoom!==+r.zoom&&(o=!0,n.zoom=+r.zoom),void 0!==r.center&&(n.center=i.aV.convert(r.center)),"bearing"in r&&n.bearing!==+r.bearing&&(s=!0,n.bearing=+r.bearing),"pitch"in r&&n.pitch!==+r.pitch&&(l=!0,n.pitch=+r.pitch);let h="number"==typeof r.padding?this._extendPadding(r.padding):r.padding;
111if(null!=r.padding&&!n.isPaddingEqual(h))if(!1===r.retainPadding){let i=n.clone();i.padding=h,n.setLocationAtPoint(n.center,i.centerPoint)}else n.padding=h;return r.preloadOnly?(this._preloadTiles(n),this):(this.fire(new i.C("movestart",a)).fire(new i.C("move",a)),o&&this.fire(new i.C("zoomstart",a)).fire(new i.C("zoom",a)).fire(new i.C("zoomend",a)),s&&this.fire(new i.C("rotatestart",a)).fire(new i.C("rotate",a)).fire(new i.C("rotateend",a)),l&&this.fire(new i.C("pitchstart",a)).fire(new i.C("pitch",a)).fire(new i.C("pitchend",a)),this.fire(new i.C("moveend",a)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.w(oM),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,a){let n=this.transform;if(!n.projection.supportsFreeCamera)return i.w(oM),this;this.stop();let o=n.zoom,s=n.pitch,l=n.bearing;n.setFreeCameraOptions(r);let h=o!==n.zoom,u=s!==n.pitch,c=l!==n.bearing;return this.fire(new i.C("movestart",a)).fire(new i.C("move",a)),h&&this.fire(new i.C("zoomstart",a)).fire(new i.C("zoom",a)).fire(new i.C("zoomend",a)),c&&this.fire(new i.C("rotatestart",a)).fire(new i.C("rotate",a)).fire(new i.C("rotateend",a)),u&&this.fire(new i.C("pitchstart",a)).fire(new i.C("pitch",a)).fire(new i.C("pitchend",a)),this.fire(new i.C("moveend",a)),this}easeTo(r,a){let n,o,s,l,h;this._stop(!1,r.easeId),(!1===(r=Object.assign({offset:[0,0],duration:500,easing:i.eL},r)).animate||this._prefersReducedMotion(r))&&(r.duration=0);let u=this.transform,c=this.getZoom(),d=this.getBearing(),p=this.getPitch(),f=this.getPadding(),m="zoom"in r?+r.zoom:c,_="bearing"in r?this._normalizeBearing(r.bearing,d):d,g="pitch"in r?+r.pitch:p,y=this._extendPadding(r.padding),x=i.P.convert(r.offset);if("globe"===u.projection.name){let a=i.ag.fromLngLat(u.center),l=x.rotate(-u.angle);a.x+=l.x/u.worldSize,a.y+=l.y/u.worldSize;let h=a.toLngLat(),c=i.aV.convert(r.center||h);this._normalizeCenter(c),n=u.centerPoint.add(l),o=new i.P(a.x,a.y).mult(u.worldSize),s=new i.P(i.aH(c.lng),i.aL(c.lat)).mult(u.worldSize).sub(o)}else{n=u.centerPoint.add(x);let a=u.pointLocation(n),l=i.aV.convert(r.center||a);this._normalizeCenter(l),o=u.project(a),s=u.project(l).sub(o)}let v=u.zoomScale(m-c);r.around&&(l=i.aV.convert(r.around),h=u.locationPoint(l));let b=this._zooming||m!==c,w=this._rotating||d!==_,T=this._pitching||g!==p,S=!u.isPaddingEqual(y),I=!1===r.retainPadding?u.clone():u,E=u=>E=>{if(b&&(u.zoom=i.am(c,m,E)),w&&(u.bearing=i.am(d,_,E)),T&&(u.pitch=i.am(p,g,E)),S&&(I.interpolatePadding(f,y,E),n=I.centerPoint.add(x)),l)u.setLocationAtPoint(l,h);else{let i=u.zoomScale(u.zoom-c),r=Math.pow(m>c?Math.min(2,v):Math.max(.5,v),1-E),a=u.unproject(o.add(s.mult(E*r)).mult(i));u.setLocationAtPoint(u.renderWorldCopies?a.wrap():a,n)}return r.preloadOnly||this._fireMoveEvents(a),u};if(r.preloadOnly){let i=this._emulate(E,r.duration,u);return this._preloadTiles(i),this}let A={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=b,this._rotating=w,this._pitching=T,this._padding=S,this._easeId=r.easeId,this._prepareEase(a,r.noMoveStart,A),this._ease(E(u),i=>{"sea"===u.cameraElevationReference&&u.recenterOnTerrain(),this._afterEase(a,i)},r),this}_prepareEase(r,a,n={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),a||n.moving||this.fire(new i.C("movestart",r)),this._zooming&&!n.zooming&&this.fire(new i.C("zoomstart",r)),this._rotating&&!n.rotating&&this.fire(new i.C("rotatestart",r)),this._pitching&&!n.pitching&&this.fire(new i.C("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.C("move",r)),this._zooming&&this.fire(new i.C("zoom",r)),this._rotating&&this.fire(new i.C("rotate",r)),this._pitching&&this.fire(new i.C("pitch",r))}_afterEase(r,a){if(this._easeId&&a&&this._easeId===a)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let n=this._zooming,o=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new i.C("zoomend",r)),o&&this.fire(new i.C("rotateend",r)),s&&this.fire(new i.C("pitchend",r)),this.fire(new i.C("moveend",r))}flyTo(r,a){if(this._prefersReducedMotion(r)){let n=i.aJ(r,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(n,a)}this.stop(),r=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.eL},r);let n=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.aC(+r.zoom,n.minZoom,n.maxZoom):o,c="bearing"in r?this._normalizeBearing(r.bearing,s):s,d="pitch"in r?+r.pitch:l,p=this._extendPadding(r.padding),f=n.zoomScale(u-o),m=i.P.convert(r.offset),_=n.centerPoint.add(m),g=n.pointLocation(_),y=i.aV.convert(r.center||g);this._normalizeCenter(y);let x=n.project(g),v=n.project(y).sub(x),b=r.curve,w=Math.max(n.width,n.height),T=w/f,S=v.mag();
111if("minZoom"in r){let a=i.aC(Math.min(r.minZoom,o,u),n.minZoom,n.maxZoom);b=Math.sqrt(w/n.zoomScale(a-o)/S*2)}let I=b*b;function E(i){let r=(T*T-w*w+(i?-1:1)*I*I*S*S)/(2*(i?T:w)*I*S);return Math.log(Math.sqrt(r*r+1)-r)}function A(i){return(Math.exp(i)-Math.exp(-i))/2}function C(i){return(Math.exp(i)+Math.exp(-i))/2}let M=E(0),P=function(i){return C(M)/C(M+b*i)},D=function(i){var r;return w*((C(M)*(A(r=M+b*i)/C(r))-A(M))/I)/S},R=(E(1)-M)/b;if(1e-6>Math.abs(S)||!isFinite(R)){if(1e-6>Math.abs(w-T))return this.easeTo(r,a);let i=T<w?-1:1;R=Math.abs(Math.log(T/w))/b,D=function(){return 0},P=function(r){return Math.exp(i*b*r)}}r.duration="duration"in r?+r.duration:1e3*R/("screenSpeed"in r?r.screenSpeed/b:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);let L=s!==c,z=d!==l,F=!n.isPaddingEqual(p),O=!1===r.retainPadding?n.clone():n,B=n=>f=>{let g=f*R,b=1/P(g);n.zoom=1===f?u:o+n.scaleZoom(b),L&&(n.bearing=i.am(s,c,f)),z&&(n.pitch=i.am(l,d,f)),F&&(O.interpolatePadding(h,p,f),_=O.centerPoint.add(m));let w=1===f?y:n.unproject(x.add(v.mult(D(g))).mult(b));return n.setLocationAtPoint(n.renderWorldCopies?w.wrap():w,_),n._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(a),n};if(r.preloadOnly){let i=this._emulate(B,r.duration,n);return this._preloadTiles(i),this}return this._zooming=!0,this._rotating=L,this._pitching=z,this._padding=F,this._prepareEase(a,!1),this._ease(B(n),()=>this._afterEase(a),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(i){}_cancelRenderFrame(i){}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let i=this._onEaseEnd;this._onEaseEnd=void 0,i.call(this,r)}if(!i){let i=this.handlers;i&&i.stop(!1)}return this}_ease(r,a,n){!1===n.animate||0===n.duration?(r(1),a()):(this._easeStart=i.o.now(),this._easeOptions=n,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let r=Math.min((i.o.now()-this._easeStart)/this._easeOptions.duration,1),a=this._onEaseFrame;a&&a(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,a){let n=Math.abs((r=i.bt(r,-180,180))-a);return Math.abs(r-360-a)<n&&(r-=360),Math.abs(r+360-a)<n&&(r+=360),r}_normalizeCenter(i){let r=this.transform;if(r.maxBounds||"globe"!==r.projection.name&&!r.renderWorldCopies)return;let a=i.lng-r.center.lng;i.lng+=a>180?-360:360*(a<-180)}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(r&&r.essential)}_emulate(i,r,a){let n=Math.ceil(15*r/1e3),o=[],s=i(a.clone());for(let i=0;i<=n;i++){let r=s(i/n);o.push(r.clone())}return o}_preloadTiles(i,r){}}class oD{constructor(r={}){this.options=r,i.a_(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){let r=this.options&&this.options.compact,a=i._getUIString("AttributionControl.ToggleAttribution");this._map=i,this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=_("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",a);let n=_("span","mapboxgl-ctrl-icon",this._compactButton);return n.setAttribute("aria-hidden","true"),n.setAttribute("title",a),this._innerContainer=_("div","mapboxgl-ctrl-attrib-inner",this._container),r&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===r&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
111se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));let a=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.e.ACCESS_TOKEN}];if(r){let n=a.reduce((i,r,n)=>(r.value&&(i+=`${r.key}=${r.value}${n<a.length-1?"&":""}`),i),"?");r.href=`${i.e.FEEDBACK_URL}/${n}#${nU(this._map,!0)}`,r.rel="noopener nofollow"}}_updateData(i){i&&("source"===i.dataType&&("metadata"===i.sourceDataType||"visibility"===i.sourceDataType)||"style"===i.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let i=[];if(this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let r=this._map.style._mergedSourceCaches;for(let a in r){let n=r[a];if(n.used){let r=n.getSource();r.attribution&&0>i.indexOf(r.attribution)&&i.push(r.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,a)=>{for(let n=a+1;n<i.length;n++)if(i[n].indexOf(r)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));let a=i.map(i=>{let r;return Array.from((r=(new DOMParser).parseFromString(i,"text/html")).body.querySelectorAll("*")).reverse().forEach(i=>{let a=i.textContent||"";if("A"!==i.tagName)return void i.replaceWith(...i.childNodes);let n=i.getAttribute("href");if(!n||!/^(https?:|mailto:)/i.test(n))return void i.replaceWith(r.createTextNode(a));let o=r.createElement("a");o.href=n,o.textContent=a,o.rel="noopener nofollow";let s=i.getAttribute("class");s&&(o.className=s),i.replaceWith(o)}),r.body.innerHTML}).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,i.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class oR{constructor(){i.a_(["_updateLogo","_updateCompact"],this)}onAdd(i){this._map=i,this._container=_("div","mapboxgl-ctrl");let r=_("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(i){i&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(let r in i){let a=i[r].getSource();if(a.hasOwnProperty("mapbox_logo")&&!a.mapbox_logo)return!1}return!0}_updateCompact(){let i=this._container.children;if(i.length){let r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class oL{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){let r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){let r=this._currentlyRunning;for(let a of r?this._queue.concat(r):this._queue)if(a.id===i)return void(a.cancelled=!0)}run(i=0){let r=this._currentlyRunning=this._queue;for(let a of(this._queue=[],r))if(!a.cancelled&&(a.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class oz{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;let a=i.dj((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-a)+this._end*a}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,r,a){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+a}}let oF={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class oO extends i.C{constructor(i,r,a,n){const{point:o,lngLat:s,originalEvent:l,target:h}=i;super(i.type,{point:o,lngLat:s,originalEvent:l,target:h}),this.preventDefault=()=>{i.preventDefault()},this.id=r,this.interaction=a,this.feature=n}}class oB{constructor(i){this.map=i,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}
111add(r,a){if(this.typeById.has(r))throw Error(`Interaction id "${r}" already exists.`);let n=a.filter,o=a.type;n&&this.filters.set(r,i.dc(n)),"mouseover"===o&&(o="mouseenter"),"mouseout"===o&&(o="mouseleave");let s=this.interactionsByType.get(o)||new Map;"mouseenter"===o||"mouseleave"===o?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(r,a)):0===s.size&&this.map.on(o,this.handleType),0===s.size&&this.interactionsByType.set(o,s),s.set(r,a),this.typeById.set(r,o)}get(i){let r=this.typeById.get(i);if(!r)return;let a=this.interactionsByType.get(r);return a?a.get(i):void 0}remove(i){let r=this.typeById.get(i);if(!r)return;this.typeById.delete(i),this.filters.delete(i);let a=this.interactionsByType.get(r);a&&(a.delete(i),"mouseenter"===r||"mouseleave"===r?(this.delegatedInteractions.delete(i),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===a.size&&this.map.off(r,this.handleType))}queryTargets(i,r){let a=[];for(let[i,n]of r)n.target&&a.push({targetId:i,target:n.target,filter:this.filters.get(i)});return this.map.style.queryRenderedTargets(i,a,this.map.transform)}handleMove(i){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;let r=this.queryTargets(i.point,Array.from(this.delegatedInteractions).reverse());r.length&&(i.type="mouseenter",this.handleType(i,r));let a=new Map;for(let[i,{feature:r}]of this.prevHoveredFeatures)this.hoveredFeatures.has(i)||a.set(r.id,r);a.size&&(i.type="mouseleave",this.handleType(i,Array.from(a.values())))}handleOut(i){let r=Array.from(this.hoveredFeatures.values()).map(({feature:i})=>i);r.length&&(i.type="mouseleave",this.handleType(i,r)),this.hoveredFeatures.clear()}handleType(r,a){let n="mouseenter"===r.type;if(n&&!this.interactionsByType.has(r.type))return void i.w("mouseenter interaction required for mouseleave to work.");let o=Array.from(this.interactionsByType.get(r.type)).reverse(),s=!!a;a=a||this.queryTargets(r.point,o);let l=!1,h=new Set;for(let u of a){for(let[a,c]of o){if(!c.target)continue;let o=u.variants?u.variants[a]:null;if(o){for(let d of o){if(tu(d,u,h,a))continue;let o=new i.de(u,d),p=th(d,u,a);s&&void 0!==o.id&&(o.state=this.map.getFeatureState(o));let f=n?this.prevHoveredFeatures.get(p):null,m=new oO(r,a,c,o),_=f?f.stop:c.handler(m);if(n&&this.hoveredFeatures.set(p,{feature:u,stop:_}),!1!==_){l=!0;break}}if(l)break}}if(l)break}if(!l)for(let[i,a]of o){let{handler:n,target:o}=a;if(!o&&!1!==n(new oO(r,i,a,null)))break}}}let ok={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},oV={showCompass:!0,showZoom:!0,visualizePitch:!1};class oN{constructor(r,a,n=!1){this._clickTolerance=10,this.element=a,this.mouseRotate=new oe({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,n&&(this.mousePitch=new ot({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.a_(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),a.addEventListener("mousedown",this.mousedown),a.addEventListener("touchstart",this.touchstart,{passive:!1}),a.addEventListener("touchmove",this.touchmove),a.addEventListener("touchend",this.touchend),a.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),v()}move(i,r){let a=this.map,n=this.mouseRotate.mousemoveWindow(i,r),o=n&&n.bearingDelta;if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){let n=this.mousePitch.mousemoveWindow(i,r),o=n&&n.pitchDelta;o&&a.setPitch(a.getPitch()+o)}}off(){let i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){b(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(Object.assign({},i,{button:i.button,type:i.type,ctrlKey:!0,preventDefault:()=>i.preventDefault()}),S(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,S(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=I(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=I(this.element,i.targetTouches)[0],this.move({buttons:1,preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function oU(r,a,n){if(r=new i.aV(r.lng,r.lat),a){let o=new i.aV(r.lng-360,r.lat),s=new i.aV(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-n.center.lng)/360),h=n.locationPoint3D(r).distSqr(a),u=a.x<0||a.y<0||a.x>n.width||a.y>n.height;n.locationPoint3D(o).distSqr(a)<h&&(u||Math.abs(o.lng-n.center.lng)<l)?r=o:n.locationPoint3D(s).distSqr(a)<h&&(u||Math.abs(s.lng-n.center.lng)<l)&&(r=s)}for(;Math.abs(r.lng-n.center.lng)>180;){let i=n.locationPoint3D(r);if(i.x>=0&&i.y>=0&&i.x<=n.width&&i.y<=n.height)break;r.lng>n.center.lng?r.lng-=360:r.lng+=360}return r}
111let oj={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},oG="auto",oq="auto";class o$ extends i.E{constructor(r,a){super(),(r instanceof HTMLElement||a)&&(r=Object.assign({element:r},a)),i.a_(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:n="center",color:o="#3FB1CE",scale:s=1,draggable:l=!1,clickTolerance:h=0,rotation:u=0,rotationAlignment:c=oG,pitchAlignment:d=oq,occludedOpacity:p=.2,altitude:f=0}=r||{};this._anchor=n,this._color=o,this._scale=s,this._draggable=l,this._clickTolerance=h,this._rotation=u,this._rotationAlignment=c,this._pitchAlignment=d,this._occludedOpacity=p,this._altitude=f,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),r&&r.element?(this._element=r.element,this._offset=i.P.convert(r&&r.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=i.P.convert(r&&r.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});const m=this._element.classList;for(const i in oj)m.remove(`mapboxgl-marker-anchor-${i}`);m.add(`mapboxgl-marker-anchor-${this._anchor}`);const _=r&&r.className?r.className.trim().split(/\s+/):[];m.add(..._),this._popup=null}_createDefaultMarker(){let i=_("div"),r=g("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},i);if(0===this._altitude){let i=g("radialGradient",{id:"shadowGradient"},g("defs",{},r));g("stop",{offset:"10%","stop-opacity":.4},i),g("stop",{offset:"100%","stop-opacity":.05},i),g("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r)}return g("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},r),g("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},r),g("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),i}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._addMarker(this),this.setDraggable(this._draggable),this._update(),i.on("click",this._onMapClick)),this}remove(){let i=this._map;return i&&(i.off("click",this._onMapClick),i.off("move",this._updateMoving),i.off("moveend",this._update),i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler),i.off("mouseup",this._onUp),i.off("touchend",this._onUp),i.off("mousemove",this._onMove),i.off("touchmove",this._onMove),i.off("remove",this._clearFadeTimer),i._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.aV.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(i){return i===this._altitude||(this._defaultMarker&&(0===this._altitude&&0!==i||0!==this._altitude&&0===i)&&(this._element=this._createDefaultMarker()),this._altitude=i||0,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){let r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
1110,-38.1],"bottom-left":[r,-1*(24.6+r)],"bottom-right":[-r,-1*(24.6+r)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=i,i._marker=this,i._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(i){let r=i.code,a=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==a&&13!==a||this.togglePopup()}_onMapClick(i){let r=i.originalEvent.target,a=this._element;this._popup&&(r===a||a.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let i=this._popup;return i&&(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(i.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_behindTerrain(){let i=this._map,r=this._pos;if(!i||!r)return!1;let a=i.unproject(r,this._altitude),n=i.getFreeCameraOptions();if(!n.position)return!1;let o=n.position.toLngLat();return o.distanceTo(a)<.9*o.distanceTo(this._lngLat)}_evaluateOpacity(){let r,a=this._map;if(!a)return;let n=this._pos;if(!n||n.x<0||n.x>a.transform.width||n.y<0||n.y>a.transform.height)return void this._clearFadeTimer();let o=a.unproject(n,this._altitude);a._showingGlobe()&&i.eX(a.transform,this._lngLat)?r=0:(r=1-a._queryFogOpacity(o),a.transform._terrainEnabled()&&a.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let i=this._pos;if(!i||!this._map)return;let r=this._offset.mult(this._scale);this._element.style.transform=` 112 translate(${i.x}px,${i.y}px) 113 ${oj[this._anchor]} 114 ${this._calculateXYTransform()} ${this._calculateZTransform()} 115 translate(${r.x}px,${r.y}px) 116 `}_calculateXYTransform(){let r=this._pos,a=this._map,n=this.getPitchAlignment();if(!a||!r||"map"!==n)return"";if(!a._showingGlobe()){let i=a.getPitch();return i?`rotateX(${i}deg)`:""}let o=i.cC(i.eY(a.transform,this._lngLat)),s=r.sub(i.eZ(a.transform)),l=Math.abs(s.x)+Math.abs(s.y);if(0===l)return"";let h=o/l;return`rotateX(${-s.y*h}deg) rotateY(${s.x*h}deg)`}_calculateZTransform(){let r=this._pos,a=this._map;if(!a||!r)return"";let n=0,o=this.getRotationAlignment();if("map"===o)if(a._showingGlobe()){let r=a.project(new i.aV(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),o=a.project(new i.aV(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(r);n=i.cC(Math.atan2(o.y,o.x))-90}else n=-a.getBearing();else if("horizon"===o){let o=i.aj(4,6,a.getZoom()),s=i.eZ(a.transform);s.y+=o*a.transform.height;let l=r.sub(s),h=i.cC(Math.atan2(l.y,l.x));n=(h>90?h-270:h+90)*(1-o)}return(n+=this._rotation)?`rotateZ(${n}deg)`:""}_update(i){cancelAnimationFrame(this._updateFrameId);let r=this._map;
116r&&(r.transform.renderWorldCopies&&(this._lngLat=oU(this._lngLat,this._pos,r.transform)),this._pos=r.project(this._lngLat,this._altitude),!0===i?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),r._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(r._showingGlobe()||r.getTerrain()||r.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=i.P.convert(r),this._update(),this}addClassName(i){return this._element.classList.add(i),this}removeClassName(i){return this._element.classList.remove(i),this}toggleClassName(i){return this._element.classList.toggle(i)}_onMove(r){let a=this._map;if(!a)return;let n=this._pointerdownPos,o=this._positionDelta;if(n&&o){if(!this._isDragging){let i=this._clickTolerance||a._clickTolerance;if(r.point.dist(n)<i)return;this._isDragging=!0}this._pos=r.point.sub(o),this._lngLat=a.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.C("dragstart"))),this.fire(new i.C("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new i.C("dragend")),this._state="inactive"}_addDragHandler(i){let r=this._map,a=this._pos;r&&a&&this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(a),this._pointerdownPos=i.point,this._state="pending",r.on("mousemove",this._onMove),r.on("touchmove",this._onMove),r.once("mouseup",this._onUp),r.once("touchend",this._onUp))}setDraggable(i){this._draggable=!!i;let r=this._map;return r&&(i?(r.on("mousedown",this._addDragHandler),r.on("touchstart",this._addDragHandler)):(r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||oG,this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i||oq,this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(i){return this._occludedOpacity=i||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let oH={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},oZ={maxWidth:100,unit:"metric"},oW={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},oX={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0};function oY(r=new i.P(0,0),a="bottom"){if("number"==typeof r){let n=Math.round(Math.sqrt(.5*Math.pow(r,2)));switch(a){case"top":return new i.P(0,r);case"top-left":return new i.P(n,n);case"top-right":return new i.P(-n,n);case"bottom":return new i.P(0,-r);case"bottom-left":return new i.P(n,-n);case"bottom-right":return new i.P(-n,-n);case"left":return new i.P(r,0);case"right":return new i.P(-r,0)}return new i.P(0,0)}return r instanceof i.P||Array.isArray(r)?i.P.convert(r):i.P.convert(r[a]||[0,0])}return{version:h,supported:m.supported,setRTLTextPlugin:i.e$,getRTLTextPluginStatus:i.e_,addTileProvider:function(r,a){if(!r||!a)throw Error("TileProvider name and URL are required");i.e.TILE_PROVIDER_URLS[r]=i.o.resolveURL(a)},Map:class extends oP{constructor(r){c.mark(u.create);const a=r;if(null!=(r=Object.assign({},ok,r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(r.antialias&&i.eV(window)&&(r.antialias=!1,i.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new ip(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies,null,null),r),this._repaint=!!r.repaint,this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileC
116acheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._collectResourceTiming=r.collectResourceTiming,this._language=this._parseLanguage(r.language),this._worldview=r.worldview,this._renderTaskQueue=new oL,this._domRenderTaskQueue=new oL,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.r(),this._locale=Object.assign({},oF,r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._performanceMetricsCollection=r.performanceMetricsCollection,this._tessellationStep=r.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=r.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new oz(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=r.scaleFactor,this._requestManager=new M(r.transformRequest,r.accessToken,r.testMode),this._silenceAuthErrors=!!r.testMode,this._contextCreateOptions=r.contextCreateOptions?Object.assign({},r.contextCreateOptions):{},"string"==typeof r.container){const i=document.getElementById(r.container);if(!i)throw Error(`Container '${r.container.toString()}' not found.`);this._container=i}else{if(!(r.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),r.maxBounds&&this.setMaxBounds(r.maxBounds),this._spriteFormat=r.spriteFormat,i.a_(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new oC(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,(r.style||!r.testMode)&&this.setStyle(r.style||i.e.DEFAULT_STYLE,{config:r.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),r.projection&&this.setProjection(r.projection),r.hash&&(this._hash=new nN("string"==typeof r.hash&&r.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==a.center&&null==a.zoom||(this.transform._unmodified=!1),this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch});const i=r.bounds;i&&(this.resize(),this.fitBounds(i,Object.assign({},r.fitBoundsOptions,{duration:0})))}this.resize(),r.attributionControl&&this.addControl(new oD({customAttribution:r.customAttribution})),this._logoControl=new oR,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.C(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.C(`${r.dataType}dataloading`,r))}),this._interactions=new oB(this)}_getMapId(){return this._mapId}addControl(r,a){if(void 0===a&&(a=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.B(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=r.onAdd(this);this._controls.push(r);let o=this._controlPositions[a];return -1!==a.indexOf("bottom")?o.insertBefore(n,o.firstChild):o.appendChild(n),this}
116removeControl(r){if(!r||!r.onRemove)return this.fire(new i.B(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let a=this._controls.indexOf(r);return a>-1&&this._controls.splice(a,1),r.onRemove(this),this}hasControl(i){return this._controls.indexOf(i)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));let a=!this._moving;return a&&this.fire(new i.C("movestart",r)).fire(new i.C("move",r)),this.fire(new i.C("resize",r)),a&&this.fire(new i.C("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.aK.convert(r)),this._update()}setMinZoom(r){if((r=r??-2)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()<r?this.setZoom(r):this.fire(new i.C("zoomstart")).fire(new i.C("zoom")).fire(new i.C("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(r){if((r=r??22)>=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.C("zoomstart")).fire(new i.C("zoom")).fire(new i.C("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=r??0)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()<r?this.setPitch(r):this.fire(new i.C("pitchstart")).fire(new i.C("pitch")).fire(new i.C("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(r){if((r=r??85)>85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.C("pitchstart")).fire(new i.C("pitch")).fire(new i.C("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(i){return this._scaleFactor=i,this.painter.scaleFactor=i,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(i=>"symbol"===i.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(i){return"auto"===i?navigator.language:Array.isArray(i)?0===i.length?void 0:i.map(i=>"auto"===i?navigator.language:i):i}setLanguage(i){let r=this._parseLanguage(i);if(!this.style||r===this._language)return this;for(let i of(this._language=r,this.style.reloadSources(),this._controls))i._setLanguage&&i._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(i){return this.style&&i!==this._worldview&&(this._worldview=i,this._styleDirty=!0,this.style.setWorldview(i)),this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(i){return this._lazyInitEmptyStyle(),i?"string"==typeof i&&(i={name:i}):i=null,this._useExplicitProjection=!!i,this._prioritizeAndUpdateProjection(i,this.style.projection)}_updateProjectionTransition(){let r;if("globe"!==this.getProjection().name)return;let a=this.transform,n=a.projection.name;"globe"===n&&a.zoom>=i.cq?(a.setMercatorFromTransition(),r=!0):"mercator"===n&&a.zoom<i.cq&&(a.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
116Update(),this._update(!0))}_prioritizeAndUpdateProjection(i,r){return this._updateProjection(i||r||{name:"mercator"})}_updateProjection(r){let a,n=this.transform.mercatorFromTransition;a="globe"===r.name&&this.transform.zoom>=i.cq?this.transform.setMercatorFromTransition():this.transform.setProjection(r),this.style.applyProjectionUpdate();let o="mercator"===this.transform.getProjection().name&&n!==this.transform.mercatorFromTransition;return(a||o)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(r,a){return this.transform.locationPoint3D(i.aV.convert(r),a)}unproject(r,a){return this.transform.pointLocation3D(i.P.convert(r),a)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(i,r,a){let n=i=>{let a=[];if(Array.isArray(r)){let n=r.filter(i=>this.getLayer(i));a=n.length?this.queryRenderedFeatures(i,{layers:n}):[]}else a=this.queryRenderedFeatures(i,{target:r});return a};if("mouseenter"===i||"mouseover"===i){let o=!1,s=r=>{let s=n(r.point);s.length?o||(o=!0,a.call(this,new nY(i,this,r.originalEvent,{features:s}))):o=!1};return{listener:a,targets:r,delegates:{mousemove:s,mouseout:()=>{o=!1}}}}if("mouseleave"===i||"mouseout"===i){let o=!1,s=r=>{n(r.point).length?o=!0:o&&(o=!1,a.call(this,new nY(i,this,r.originalEvent)))},l=r=>{o&&(o=!1,a.call(this,new nY(i,this,r.originalEvent)))};return{listener:a,targets:r,delegates:{mousemove:s,mouseout:l}}}{let o=i=>{let r=n(i.point);r.length&&(i.features=r,a.call(this,i),delete i.features)};return{listener:a,targets:r,delegates:{[i]:o}}}}on(i,r,a){if("function"==typeof r||void 0===a)return super.on(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._createDelegatedListener(i,r,a);for(let r in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(n),n.delegates)this.on(r,n.delegates[r]);return this}once(i,r,a){if("function"==typeof r||void 0===a)return super.once(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._createDelegatedListener(i,r,a);for(let i in n.delegates)this.once(i,n.delegates[i]);return this}off(r,a,n){if("function"==typeof a||void 0===n)return super.off(r,a);if("string"==typeof a&&(a=[a]),!this._areTargetsValid(a))return this;let o=this._delegatedListeners?this._delegatedListeners[r]:void 0;return o&&(r=>{for(let o=0;o<r.length;o++){let s=r[o];if(s.listener===n&&function(r,a){if(Array.isArray(r)&&Array.isArray(a)){let i=new Set(r),n=new Set(a);return i.size===n.size&&r.every(i=>n.has(i))}return i.b7(r,a)}(s.targets,a)){for(let i in s.delegates)this.off(i,s.delegates[i]);return r.splice(o,1),this}}})(o),this}queryRenderedFeatures(r,a){if(!this.style)return[];if(void 0===r||r instanceof i.P||Array.isArray(r)||void 0!==a||(a=r,r=void 0),r=r||[[0,0],[this.transform.width,this.transform.height]],!a){let i=this.style.queryRenderedFeatures(r,void 0,this.transform),a=this.style.queryRenderedFeatureset(r,void 0,this.transform);return i.concat(a)}let n=!0;if(a.target&&(n=this._isTargetValid(a.target))&&!a.layers)return this.style.queryRenderedFeatureset(r,a,this.transform);let o=!0;if(a.layers&&Array.isArray(a.layers)){for(let i of a.layers)if(!this._isValidId(i)){o=!1;break}if(o&&!a.target)return this.style.queryRenderedFeatures(r,a,this.transform)}let s=[];return o&&(s=s.concat(this.style.queryRenderedFeatures(r,a,this.transform))),n&&(s=s.concat(this.style.queryRenderedFeatureset(r,a,this.transform))),s}querySourceFeatures(i,r){return i&&("string"!=typeof i||this._isValidId(i))?this.style.querySourceFeatures(i,r):[]}queryRasterValue(i,r,a){return this._isValidId(i)?this.style.queryRasterValue(i,r,a):Promise.resolve(null)}isPointOnSurface(r){let{name:a}=this.transform.projection;return"globe"!==a&&"mercator"!==a&&i.w(`${a} projection does not support isPointOnSurface, this API may behave unex
116pectedly.`),this.transform.isPointOnSurface(i.P.convert(r))}addInteraction(i,r){return this._interactions.add(i,r),this}removeInteraction(i){return this._interactions.remove(i),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(i){return this._cooperativeGestures=i,this}setStyle(r,a){return a=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},a),this.style&&r&&!1!==a.diff&&a.localFontFamily===this._localFontFamily&&a.localIdeographFontFamily===this._localIdeographFontFamily&&!a.config?(this.style._diffStyle(r,(n,o)=>{if(n){let o="string"==typeof n?n:n instanceof Error?n.message:n.error;i.w(`Unable to perform style diff: ${o}. Rebuilding the style from scratch.`),this._updateStyle(r,a)}else o&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=a.localIdeographFontFamily,this._localFontFamily=a.localFontFamily,this._updateStyle(r,a))}_getUIString(i){let r=this._locale[i];if(null==r)throw Error(`Missing UI string '${i}'`);return r}_updateStyle(i,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),i){let a=Object.assign({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new iF(this,a).load(i),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new iF(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(i.w("There is no style added to the map."),!1)}_isValidId(r){return null==r?(this.fire(new i.B(Error("IDs can't be empty."))),!1):!i.d7(r)||(this.fire(new i.B(Error(`IDs can't contain special symbols: "${r}".`))),!1)}_isTargetValid(i){return"featuresetId"in i?this._isValidId("importId"in i?i.importId:i.featuresetId):"layerId"in i&&this._isValidId(i.layerId)}_areTargetsValid(i){if(Array.isArray(i)){for(let r of i)if(!this._isValidId(r))return!1;return!0}return this._isTargetValid(i)}addSource(i,r){return this._isValidId(i)?(this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)):this}isSourceLoaded(i){return!!this._isValidId(i)&&!!this.style&&this.style._isSourceCacheLoaded(i)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(i,r,a){this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,a)}removeSource(i){return this._isValidId(i)?(this.style.removeSource(i),this._updateTerrain(),this._update(!0)):this}getSource(i){return this._isValidId(i)?this.style.getOwnSource(i):null}addImage(r,a,{pixelRatio:n=1,sdf:o=!1,stretchX:s,stretchY:l,content:h}={}){this._lazyInitEmptyStyle();let u=i.I.from(r);if(a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap){let{width:r,height:c,data:d}=i.o.getImageData(a);this.style.addImage(u,{data:new i.q({width:r,height:c},d),pixelRatio:n,stretchX:s,stretchY:l,content:h,sdf:o,version:0,usvg:!1})}else if(void 0===a.width||void 0===a.height)this.fire(new i.B(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`")));else{let{width:c,height:d}=a;this.style.addImage(u,{data:new i.q({width:c,height:d},new Uint8Array(a.data)),pixelRatio:n,stretchX:s,stretchY:l,content:h,sdf:o,usvg:!1,version:0,userImage:a}),a.onAdd&&a.onAdd(this,r)}}updateImage(r,a){this._lazyInitEmptyStyle();let n=i.I.from(r),o=this.style.getImage(n);if(!o)return void this.fire(new i.B(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:s,height:l,data:h}=a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap?i.o.getImageData(a):a;if(void 0===s||void 0===l)return void this.fire(new i.B(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(s!==(o.usvg?o.icon.usvg_tree.width:o.data.width)||l!==(o.usvg?o.icon.usvg_tree.height:o.data.height))return void this.fire(new i.B(Error(`The width and height of the updated image (${s}, ${l}) 117 must be that same as the previous version of the image 118 (${o.data.width}, ${o.data.height})`)));let u=!(a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap),c=!1;o.usvg?(o.data=new i.q({width:s,height:l},new Uint8Array(h)),o.usvg=!1,o.icon=void 0,c=!0):o.data.replace(h,u),this.style.updateImage(n,o,c)}hasImage(r){return r?!!this.style&&!!this.style.getImage(i.I.from(r)):(this.fire(new i.B(Error("Missing required image id"))),!1)}removeImage(r){this.style.removeImage(i.I.from(r))}loadImage(r,a){i.n(this._requestManager.transformRequest(r,i.R.Image),(i,r)=>{a(i,r)})}listImages(){return this.style.listImages().map(i=>i.name)}addModel(i,r){this._lazyInitEmptyStyle(),this.style.addModel(i,r)}hasModel(r){return r?this.style.hasModel(r):(this.fire(new i.B(Error("Missing required model id"))),!1)}removeModel(i){this.style.removeModel(i)}listModels(){return this.style.listModels()}addLayer(i,r){return this._isValidId(i.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)):this}getSlot(i){let r=this.getLayer(i);return r&&r.slot||null}setSlot(i,r){return this.style.setSlot(i,r),this.style.mergeLayers(),this._update(!0)}
118addImport(r,a){return this.style.addImport(r,a).catch(r=>this.fire(new i.B(Error("Failed to add import",r)))),this}updateImport(i,r){return"string"!=typeof r&&r.id!==i?(this.removeImport(i),this.addImport(r)):(this.style.updateImport(i,r),this._update(!0))}removeImport(i){return this.style.removeImport(i),this}moveImport(i,r){return this.style.moveImport(i,r),this._update(!0)}moveLayer(i,r){return this._isValidId(i)?(this.style.moveLayer(i,r),this._update(!0)):this}removeLayer(i){return this._isValidId(i)?(this.style.removeLayer(i),this._update(!0)):this}getLayer(i){if(!this._isValidId(i))return null;let r=this.style.getOwnLayer(i);return r?"custom"===r.type?r.implementation:r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(i,r,a){return this._isValidId(i)?(this.style.setLayerZoomRange(i,r,a),this._update(!0)):this}setFilter(i,r,a={}){return this._isValidId(i)?(this.style.setFilter(i,r,a),this._update(!0)):this}getFilter(i){return this._isValidId(i)?this.style.getFilter(i):null}setPaintProperty(i,r,a,n={}){return this._isValidId(i)?(this.style.setPaintProperty(i,r,a,n),this._update(!0)):this}getPaintProperty(i,r){return this._isValidId(i)?this.style.getPaintProperty(i,r):null}setLayoutProperty(i,r,a,n={}){return this._isValidId(i)?(this.style.setLayoutProperty(i,r,a,n),this._update(!0)):this}getLayoutProperty(i,r){return this._isValidId(i)?this.style.getLayoutProperty(i,r):null}setLayerProperty(i,r,a,n={}){return this._isValidId(i)?("appearances"===r&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(i,r,a,n),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(i){return this.style.setGlyphsUrl(i),this._update(!0)}getSchema(i){return this.style.getSchema(i)}setSchema(i,r){return this.style.setSchema(i,r),this._update(!0)}getConfig(i){return this.style.getConfig(i)}setConfig(i,r){return this.style.setConfig(i,r),this._update(!0)}getConfigProperty(i,r){return this.style.getConfigProperty(i,r)}setConfigProperty(i,r,a){return this.style.setConfigProperty(i,r,a),this._update(!0)}getFeaturesetDescriptors(i){return this.style.getFeaturesetDescriptors(i)}setLights(i){if(this._lazyInitEmptyStyle(),i&&1===i.length&&"flat"===i[0].type){let r=i[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(i),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){let i=this.style.getLights()||[];return 0===i.length&&i.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),i}setLight(i,r={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:i}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(i){return this._lazyInitEmptyStyle(),this.style.setSnow(i),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(i){return this._lazyInitEmptyStyle(),this.style.setRain(i),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(i){return this._lazyInitEmptyStyle(),this.style.setColorTheme(i),this._update(!0)}setImportColorTheme(i,r){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(i,r),this._update(!0)}setCamera(i){return this.style.setCamera(i),this._triggerCameraUpdate(i)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(i){let r=this.transform.nearClipOffset!==i;return this.transform.nearClipOffset=i,this._update(r)}_triggerCameraUpdate(i){return this._update(this.transform.setOrthogra
118phicProjectionAtLowPitch("orthographic"===i["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.aV.convert(r),this.transform):0}setFeatureState(i,r){return i.source&&!this._isValidId(i.source)?this:(this.style.setFeatureState(i,r),this._update())}removeFeatureState(i,r){return i.source&&!this._isValidId(i.source)?this:(this.style.removeFeatureState(i,r),this._update())}getFeatureState(i){return i.source&&!this._isValidId(i.source)?null:this.style.getFeatureState(i)}_selectIndoorFloor(i){this.style.indoorManager.selectFloor(i)}_setIndoorActiveFloorsVisibility(i){this.style.indoorManager.setActiveFloorsVisibility(i)}getIndoorTileOptions(i,r){return this.style.isIndoorEnabled()?this.style.indoorManager.getIndoorTileOptions(i,r):null}_updateContainerDimensions(){if(!this._container)return;let i=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300,a,n,o,s=this._container;for(;s&&(!n||!o);){let i=window.getComputedStyle(s).transform;i&&"none"!==i&&((a=i.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==a[0]&&"1"!==a[0]&&(n=a[0]),a[3]&&"0"!==a[3]&&"1"!==a[3]&&(o=a[3])),s=s.parentElement}this._containerWidth=n?Math.abs(i/n):i,this._containerHeight=o?Math.abs(r/o):r}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){let i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=_("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();let r=this._canvasContainer=_("div","mapboxgl-canvas-container",i);this._canvas=_("canvas","mapboxgl-canvas",r),this._interactive&&(r.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);let a=this._controlContainer=_("div","mapboxgl-control-container",i),n=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(i=>{n[i]=_("div",`mapboxgl-ctrl-${i}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,a){let n=i.o.devicePixelRatio||1;this._canvas.width=n*Math.ceil(r),this._canvas.height=n*Math.ceil(a),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${a}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){let r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_addPopup(i){this._popups.push(i)}_removePopup(i){let r=this._popups.indexOf(i);-1!==r&&this._popups.splice(r,1)}_setupPainter(){let r=Object.assign({},m.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),a=this._canvas.getContext("webgl2",r);a?(J(a,!0),this.painter=new nk(a,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",i=>{if("source"===i.dataType){let r=this.transform.elevation?this.transform.elevation._source():null;r&&i.sourceCacheId===r.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),i.k.testSupport(a)):this.fire(new i.B(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.C("webglcontextlost",{originalEvent:r}))}_contextRestored(r){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.imageManager.imageAtlasCache.destroyTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new i.C("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let a;this.fire(new i.C("renderstart")),++this._frameId;let n=this.painter.context.extTimerQuery,o=i.o.now(),s=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(a=s.createQuery(),s.beginQuery(n.TIME_ELAPSED_EXT,a)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
118(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjectionTransition();let l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let r=this.transform.zoom,a=this.transform.pitch,n=i.o.now(),o=new i.ae(r,{now:n,fadeDuration:l,pitch:a,transition:this.style.transition,worldview:this._worldview});this.style.update(o)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let h=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),h=this._updateAverageElevation(o),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):h=this._updateAverageElevation(o),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,this.painter.replacementSource)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.C("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.mark(u.load),this.fire(new i.C("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),a){let r=i.o.now()-o;s.endQuery(n.TIME_ELAPSED_EXT),setTimeout(()=>{let n=s.getQueryParameter(a,s.QUERY_RESULT)/1e6;s.deleteQuery(a),this.fire(new i.C("gpu-timing-frame",{cpuTime:r,gpuTime:n}))},50)}if(this.listens("gpu-timing-layer")){let r=this.painter.collectGpuTimers();setTimeout(()=>{let a=this.painter.queryGpuTimers(r);this.fire(new i.C("gpu-timing-layer",{layerTimes:a}))},50)}if(this.listens("gpu-timing-deferred-render")){let r=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let a=this.painter.queryGpuTimeDeferredRender(r);this.fire(new i.C("gpu-timing-deferred-render",{gpuTime:a}))},50)}let d=this._sourcesDirty||this._styleDirty||this._placementDirty||h;if(d||this._repaint)this.triggerRepaint();else{let r=this.idle();if(r&&(h=this._updateAverageElevation(o,!0)),h)this.triggerRepaint();else if(this._triggerFrame(!1),r&&(this.fire(new i.C("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let r=this._calculateSpeedIndex();this.fire(new i.C("speedindexcompleted",{speedIndex:r})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,c.mark(u.fullLoad),this._performanceMetricsCollection&&W(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(i){for(let r of this._markers)i&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(let r of this._popups)!i||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(i,r=!1){let a=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&a(0);let n=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(n||(r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){let r=this.transform.averageElevation,o=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(o)?o=0:this._averageElevationLastSampledAt=i;let s=Math.abs(r-o);if(s>
1181){if(this._isInitialLoad||n)return this._averageElevation.jumpTo(o),a(o);this._averageElevation.easeTo(o,i,300)}else if(s>1e-4)return this._averageElevation.jumpTo(o),a(o)}return!!this._averageElevation.isEasing(i)&&a(this._averageElevation.getValue(i))}_authenticate(){Y(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,r=>{if(r&&(r.message===C||401===r.status)){let r=this.painter.context.gl;J(r,!1),this._logoControl instanceof oR&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.B(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),N(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&j(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&q(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){H(this._requestManager._customAccessToken)}_updateTerrain(){let i=this._isDragging();this.painter.updateTerrain(this.style,i)}_calculateSpeedIndex(){let i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());let a=this.painter.context.gl,n=a.createFramebuffer();function o(i){a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,i,0);let r=new Uint8Array(a.drawingBufferWidth*a.drawingBufferHeight*4);return a.readPixels(0,0,a.drawingBufferWidth,a.drawingBufferHeight,a.RGBA,a.UNSIGNED_BYTE,r),r}return a.bindFramebuffer(a.FRAMEBUFFER,n),this._canvasPixelComparison(o(i),r.canvasCopies.map(o),r.timeStamps)}_canvasPixelComparison(i,r,a){let n=a[1]-a[0],o=i.length/4;for(let s=0;s<r.length;s++){let l=r[s],h=0;for(let r=0;r<l.length;r+=4)l[r]===i[r]&&l[r+1]===i[r+1]&&l[r+2]===i[r+2]&&l[r+3]===i[r+3]&&(h+=1);n+=(a[s+2]-a[s+1])*(1-h/o)}return n}remove(){for(let i of(this._hash&&this._hash.remove(),this._controls))i.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);let r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),K.delete(this.painter.context.gl),X.remove(),V.remove(),this._removed=!0,this.fire(new i.C("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(r){this._renderNextFrame=this._renderNextFrame||r,this.style&&!this._frame&&(this._frame=i.o.frame(i=>{let r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){let a=this.style?this.style.getSourceCaches():[];return i.t(a,(i,a)=>i._preloadTiles(r,a),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(i){this._showParseStatus!==i&&(this._showParseStatus=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(i){this._showLayers2DWireframe!==i&&(this._showLayers2DWireframe=i,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(i){this._showLayers3DWireframe!==i&&(this._showLayers3DWireframe=i,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,this.style&&i?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(i){this._showTileAABBs!==i&&(this._showTileAABBs=i,i&&this._update())}_setCacheLimits(r,a){i.eW(r,a)}get version(){return h}},NavigationControl:class{constructor(r={}){this.options=Object.assign({},oV,r),this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.a_(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>{this._map&&this._map.zoomIn({},{originalEvent:i})}),_("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>{this._map&&this._map.zoomOut({},{originalEvent:i})}),_("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.a_(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{let r=this._map;r&&(this.options.visualizePitch?r.resetNorthPitch({},{originalEvent:i}):r.resetNorth({},{originalEvent:i}))}),this._compassIcon=_("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let i=this._map;if(!i)return;let r=i.getZoom(),a=r===i.getMaxZoom(),n=r===i.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){let i=this._map;if(!i)return;let r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(i.transform.pitch*(Math.PI/180)
118),.5)}) rotateX(${i.transform.pitch}deg) rotateZ(${i.transform.angle*(180/Math.PI)}deg)`:`rotate(${i.transform.angle*(180/Math.PI)}deg)`;i._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(i){return this._map=i,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),i.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&i.on("pitch",this._rotateCompassArrow),i.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new oN(i,this._compass,this.options.visualizePitch)),this._container}onRemove(){let i=this._map;i&&(this._container.remove(),this.options.showZoom&&i.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&i.off("pitch",this._rotateCompassArrow),i.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(i,r){let a=_("button",i,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(i,r){if(!this._map)return;let a=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",a),i.firstElementChild&&i.firstElementChild.setAttribute("title",a)}},GeolocateControl:class extends i.E{constructor(r={}){super();const a=navigator.geolocation;this.options=Object.assign({geolocation:a},oH,r),i.a_(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=nV(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(i){return this._map=i,this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(i){let r=(r=!!this.options.geolocation)=>{this._supportsGeolocation=r,i(r)};void 0!==this._supportsGeolocation?i(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(i=>r("denied"!==i.state)).catch(()=>r()):r()}_isOutOfMapMaxBounds(i){let r=this._map.getMaxBounds(),a=i.coords;return!!r&&(a.longitude<r.getWest()||a.longitude>r.getEast()||a.latitude<r.getSouth()||a.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(r){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.C("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(r),this.options.followUserLocation&&(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(r),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.C("geolocate",Object.assign({coords:r.coords,timestamp:r.timestamp},r.toJSON?{toJSON:r.toJSON.bind(r)}:{}))),this._finish()}}
118_updateCamera(r){let a=new i.aV(r.coords.longitude,r.coords.latitude),n=r.coords.accuracy,o=Object.assign({bearing:this._map.getBearing()},this.options.fitBoundsOptions);this._map.fitBounds(a.toBounds(n),o,{geolocateSource:!0})}_updateMarker(r){if(r){let a=new i.aV(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let r=this._map.transform,a=i.bV(1,r._center.lat)*r.worldSize,n=Math.ceil(2*this._accuracy*a);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(r){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(1===r.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.C("error",{code:r.code,message:r.message,PERMISSION_DENIED:r.PERMISSION_DENIED,POSITION_UNAVAILABLE:r.POSITION_UNAVAILABLE,TIMEOUT:r.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();let i=this.options.positionOptions.timeout;i&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},i))}_clearRequestTimeout(){void 0!==this._requestTimeoutId&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(r){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=_("button","mapboxgl-ctrl-geolocate",this._container),_("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===r){i.w("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=_("div","mapboxgl-user-location"),this._dotElement.appendChild(_("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(_("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new o$({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=_("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new o$({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.showButton||(this._container.style.display="none"),this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.C("trackuserlocationend")))})}}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.C("trackuserlocationstart"));break;
118case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.C("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.C("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let i;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(i={maximumAge:6e5,timeout:0},this._noTimeout=!0):(i=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,i),this._startRequestTimeout(),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._startRequestTimeout(),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}setFollowUserLocation(r){return this.options.followUserLocation=null!=r?r:oH.followUserLocation,this.options.trackUserLocation&&"OFF"!==this._watchState&&(this.options.followUserLocation?"BACKGROUND"!==this._watchState&&"BACKGROUND_ERROR"!==this._watchState||(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.C("trackuserlocationstart"))):"ACTIVE_LOCK"!==this._watchState&&"ACTIVE_ERROR"!==this._watchState||(this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this.fire(new i.C("trackuserlocationend")))),this}_addDeviceOrientationListener(){let i=()=>{let i="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(i,this._onDeviceOrientation)};"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(r=>{"granted"===r&&i()}).catch(console.error):i()}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
118se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:oD,ScaleControl:class{constructor(r={}){this.options=Object.assign({},oZ,r),i.a_(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let i=this.options.maxWidth||100,r=this._map,a=r._containerHeight/2,n=r._containerWidth/2-i/2,o=r.unproject([n,a]),s=r.unproject([n+i,a]),l=o.distanceTo(s);if("imperial"===this.options.unit){let r=3.2808*l;r>5280?this._setScale(i,r/5280,"mile"):this._setScale(i,r,"foot")}else"nautical"===this.options.unit?this._setScale(i,l/1852,"nautical-mile"):l>=1e3?this._setScale(i,l/1e3,"kilometer"):this._setScale(i,l,"meter")}_setScale(i,r,a){this._map._requestDomTask(()=>{var n;let o,s,l,h=(o=Math.pow(10,`${Math.floor(r)}`.length-1),s=r/o,o*(s=s>=10?10:s>=5?5:s>=3?3:s>=2?2:s>=1?1:(l=Math.pow(10,Math.ceil(-Math.log(n=s)/Math.LN10)),Math.round(n*l)/l))),u=h/r;this._container.innerHTML="nautical-mile"!==a?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:a}).format(h):`${h} ${oW[a]}`,this._container.style.width=i*u+"px"})}onAdd(i){return this._map=i,this._language=i.getLanguage(),this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(i){this._language=i,this._update()}setUnit(i){this.options.unit=i,this._update()}},FullscreenControl:class{constructor(r={}){this._fullscreen=!1,r&&r.container&&(r.container instanceof HTMLElement?this._container=r.container:i.w("Full screen control 'container' must be a DOM element.")),i.a_(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){let i=this._fullscreenButton=_("button","mapboxgl-ctrl-fullscreen",this._controlContainer);_("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),i.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:class{constructor(){i.a_(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(i){return this._map=i,this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){let i=this._map.style.indoorManager;i.off("selector-update",this._onIndoorUpdate),i.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(i.getControlState())}}_createButton(i,r){let a=_("button",i,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(i,r){i.setAttribute("aria-label",r),i.textContent=r}onRemove(){this._container&&this._container.remove(),this._map&&(this._map.off("styledata",this._onStyleData),this._map.style&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(i){if(!i||!i.floors||0===i.floors.length)return this._model=i,void(this._container.style.display="none");let r=this._model;this._model=i,this._container.style.display="inline-block";let a=!r||r.floors.length!==i.floors.length||r.floors.some((r,a)=>r.id!==i.floors[a].id);if(a&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),i.selectedFloorId){if(i.selectedFloorId!==this._lastSelectedFloorId||a){let r=i.floors.findIndex(r=>
118r.id===i.selectedFloorId);if(-1!==r){let a,n,o=i.floors.length;o<=5?(a=0,n=o-1):0===this._visibleFloorStart?(a=0,n=3):this._visibleFloorStart>=o-3?(a=o-3-1,n=o-1):(a=this._visibleFloorStart,n=this._visibleFloorStart+3-1),r<a?this._visibleFloorStart=r:r>n&&(this._visibleFloorStart=r-2)}}this._lastSelectedFloorId=i.selectedFloorId}this._render()}_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";let i=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);_("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||i.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(i);let r=this._model.floors,a=r.length;if(a<=5)return void r.forEach(i=>this._createFloorButton(i));let n=0===this._visibleFloorStart,o=this._visibleFloorStart>=a-3;if(n)this._createFloorButton(r[0]);else{let i=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);_("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._container.appendChild(i)}if((n?r.slice(1,4):o?r.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):r.slice(this._visibleFloorStart,this._visibleFloorStart+3)).forEach(i=>this._createFloorButton(i)),o)this._createFloorButton(r[a-1]);else{let i=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);_("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._container.appendChild(i)}}_createFloorButton(i){let r=this._createButton("mapboxgl-ctrl-level-button",()=>{let r=i.id;this._model&&this._model.selectedFloorId===r&&this._model.activeFloorsVisible||this._map&&(this._model&&!this._model.activeFloorsVisible&&this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.setActiveFloorsVisibility(!0),this._map._selectIndoorFloor(r))}),a=(i.name||"").trim(),n=i.zIndex.toString(),o=a?Array.from(a).slice(0,3).join(""):n;this._setButtonTitle(r,o),this._model&&this._model.activeFloorsVisible&&i.id===this._model.selectedFloorId&&r.classList.add("mapboxgl-ctrl-level-button-selected"),this._container&&this._container.appendChild(r)}_toggleIndoor(){this._map&&this._map.style&&this._map.style.indoorManager&&this._model&&this._model.activeFloorsVisible&&this._map.style.indoorManager.setActiveFloorsVisibility(!1)}_scrollUp(){if(this._visibleFloorStart>0){this._visibleFloorStart--,1===this._visibleFloorStart&&(this._visibleFloorStart=0);let i=this._model&&this._model.floors||[];if(i.length>3){let r=i.length-3;this._visibleFloorStart===r-1&&(this._visibleFloorStart=r-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){let i=this._model.floors.length-3;this._visibleFloorStart<i&&(this._visibleFloorStart++,1===this._visibleFloorStart&&(this._visibleFloorStart=2),this._visibleFloorStart===i-1&&(this._visibleFloorStart=i),this._visibleFloorStart>i&&(this._visibleFloorStart=i),this._render())}}},Popup:class extends i.E{constructor(r){super(),this.options=Object.assign(Object.create(oX),r),this._altitude=this.options.altitude,i.a_(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(r&&r.className?r.className.trim().split(/\s+/):[])}addTo(r){return this._map&&this.remove(),this._map=r,this.options.closeOnClick&&r.on("preclick",this._onClose),this.options.closeOnMove&&r.on("move",this._onClose),r.on("remove",this.remove),this._update(),r._addPopup(this),this._focusFirstElement(),this._trackPointer?(r.on("mousemove",this._onMouseEvent),r.on("mouseup",this._onMouseEvent),r._canvasContainer.classList.add("mapboxgl-track-pointer")):r.on("move",this._update),this.fire(new i.C("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let r=this._map;return r&&(r.off("move",this._update),r.off("move",this._onClose),r.off("preclick",this._onClose),r.off("click",this._onClose),r.off("remove",this.remove),r.off("mousemove",this._onMouseEvent),r.off("mouseup",this._onMouseEvent),r.off("drag",this._onMouseEvent),r._canvasContainer&&r._canvasContainer.classList.remove("mapboxgl-track-pointer"),r._removePopup(this),this._map=void 0),this.fire(new i.C("close")),this}getLngLat(){return this._lngLat}setLngLat(r){this._lngLat=i.aV.convert(r),this._pos=null,this._trackPointer=!1,this._update();let a=this._map;return a&&(a.on("move",this._update),a.off("mousemove",this._onMouseEvent),a._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(i){return this._altitude=i,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let i=this._map;return i&&(i.off("move",this._update),i.on("mousemove",this._onMouseEvent),i.on("drag",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(i){return this.setDOMContent(document.createTextNode(i))}setHTML(i){let r,a=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=i;r=n.firstChild;)a.appendChild(r);return this.setDOMContent(a)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=_("div","mapboxgl-popup-content",this._container||void 0);
118if(r.appendChild(i),this.options.closeButton){let i=this._closeButton=_("button","mapboxgl-popup-close-button",r);i.type="button",i.setAttribute("aria-label","Close popup"),i.innerHTML='<span aria-hidden="true">×</span>',i.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._updateClassList(),r}_onMouseEvent(i){this._update(i.point)}_getAnchor(i){if(this.options.anchor)return this.options.anchor;let r=this._map,a=this._container,n=this._pos;if(!r||!a||!n)return"bottom";let o=a.offsetWidth,s=a.offsetHeight,l=n.x<o/2,h=n.x>r.transform.width-o/2;if(n.y+i<s)return l?"top-left":h?"top-right":"top";if(n.y>r.transform.height-s){if(l)return"bottom-left";if(h)return"bottom-right"}return l?"left":h?"right":"bottom"}_updateClassList(){let i=this._container;if(!i)return;let r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),i.className=r.join(" ")}_update(r){let a=this._map,n=this._content;if(!a||!this._lngLat&&!this._trackPointer||!n)return;let o=this._container;if(o||(o=this._container=_("div","mapboxgl-popup",a.getContainer()),this._tip=_("div","mapboxgl-popup-tip",o),o.appendChild(n)),this.options.maxWidth&&o.style.maxWidth!==this.options.maxWidth&&(o.style.maxWidth=this.options.maxWidth),a.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=oU(this._lngLat,this._pos,a.transform)),!this._trackPointer||r){let n=this._pos=this._trackPointer&&r instanceof i.P?r:a.project(this._lngLat,this._altitude),o=oY(this.options.offset),s=this._anchor=this._getAnchor(o.y),l=oY(this.options.offset,s),h=n.add(l).round();a._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${oj[s]} translate(${h.x}px,${h.y}px)`)})}if(!this._marker&&a._showingGlobe()){let r=+!i.eX(a.transform,this._lngLat);this._setOpacity(r)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let i=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._container&&(this._container.style.opacity=`${i}`),this._content&&(this._content.style.pointerEvents=i?"auto":"none")}},Marker:o$,Style:iF,LngLat:i.aV,LngLatBounds:i.aK,Point:i.P,MercatorCoordinate:i.ag,FreeCameraOptions:ih,Evented:i.E,config:i.e,prewarm:function(){ea().acquire(et)},clearPrewarmedResources:function(){let i=a;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(et),a=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return i.e.ACCESS_TOKEN},set accessToken(t){i.e.ACCESS_TOKEN=t},get baseApiUrl(){return i.e.API_URL},set baseApiUrl(t){i.e.API_URL=t},get workerCount(){return ei.workerCount},set workerCount(e){ei.workerCount=e},get maxParallelImageRequests(){return i.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(r){i.f3(r)},get workerUrl(){return ee.workerUrl},set workerUrl(e){ee.workerUrl=e},get workerClass(){return ee.workerClass},set workerClass(e){ee.workerClass=e},get workerParams(){return ee.workerParams},set workerParams(e){ee.workerParams=e},get dracoUrl(){return i.f2()},set dracoUrl(t){i.e.DRACO_URL=i.o.resolveURL(t)},get meshoptUrl(){return i.f1()},set meshoptUrl(t){let r=i.o.resolveURL(t);i.e.MESHOPT_URL=r,i.e.MESHOPT_SIMD_URL=r},get buildingGenUrl(){return i.f0()},set buildingGenUrl(t){i.e.BUILDING_GEN_URL=i.o.resolveURL(t)},setNow:i.o.setNow,restoreNow:i.o.restoreNow}}),n}()}}]); 119//# sourceMappingURL=50d3ae47.23a417c011255937.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.