vendor: 8,826 bytes, line 1
1import{g as FS,c as OS}from"./index-BMP0r8Gt.js";(function(){try{var Ss=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};Ss.SENTRY_RELEASE={id:"a4645fb32bd6db90e00f80d55edb0f84cca541e6"};var Vu=new Ss.Error().stack;Vu&&(Ss._sentryDebugIds=Ss._sentryDebugIds||{},Ss._sentryDebugIds[Vu]="8998cb99-0429-4ee6-8d5f-21b3ae1826f2",Ss._sentryDebugIdIdentifier="sentry-dbid-8998cb99-0429-4ee6-8d5f-21b3ae1826f2")}catch{}})();function BS(Ss,Vu){for(var ha=0;ha<Vu.length;ha++){const Vs=Vu[ha];if(typeof Vs!="string"&&!Array.isArray(Vs)){for(const $a in Vs)if($a!=="default"&&!($a in Ss)){const Nc=Object.getOwnPropertyDescriptor(Vs,$a);Nc&&Object.defineProperty(Ss,$a,Nc.get?Nc:{enumerable:!0,get:()=>Vs[$a]})}}}return Object.freeze(Object.defineProperty(Ss,Symbol.toStringTag,{value:"Module"}))}var Cb={exports:{}};(function(Ss,Vu){(function(ha,Vs){Ss.exports=Vs()})(OS,function(){let ha,Vs,$a;typeof self<"u"&&(self.__mapboxImport=d=>import(d));function Nc(d,L){if(!ha)ha=L;else if(!Vs)Vs=L;else{const To={};ha(void 0,To),$a=L(To);const Kn="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 = {}; self.__mapboxImport = (u) => import(u); ("+ha+")(undefined, sharedChunk); ("+Vs+")(undefined, sharedChunk); self.onerror = null;";typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&($a.workerUrl=window.URL.createObjectURL(new Blob([Kn],{type:"text/javascript"})))}}Nc(["require","exports"],function(d,L){var To="3.28.0",Kn=1e-6,Lr=typeof Float32Array<"u"?Float32Array:Array;function Vc(i,e){var t=e[0],n=e[1],s=e[2],l=e[3],c=t*l-s*n;return c?(i[0]=l*(c=1/c),i[1]=-n*c,i[2]=-s*c,i[3]=t*c,i):null}function Vl(){var i=new Lr(9);return Lr!=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 si(i,e,t){var n=e[0],s=e[1],l=e[2],c=e[3],h=e[4],p=e[5],_=e[6],y=e[7],v=e[8],b=t[0],T=t[1],S=t[2],A=t[3],C=t[4],D=t[5],F=t[6],O=t[7],z=t[8];return i[0]=b*n+T*c+S*_,i[1]=b*s+T*h+S*y,i[2]=b*l+T*p+S*v,i[3]=A*n+C*c+D*_,i[4]=A*s+C*h+D*y,i[5]=A*l+C*p+D*v,i[6]=F*n+O*c+z*_,i[7]=F*s+O*h+z*y,i[8]=F*l+O*p+z*v,i}function Eo(i,e){var t=Math.sin(e),n=Math.cos(e);return i[0]=n,i[1]=t,i[2]=0,i[3]=-t,i[4]=n,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i}function Jn(){var i=new Lr(16);return Lr!=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 Us(i){var e=new Lr(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e}function Uc(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function er(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 Ul(i,e){if(i===e){var t=e[1],n=e[2],s=e[3],l=e[6],c=e[7],h=e[11];i[1]=e[4],i[2]=e[8],i[3]=e[12],i[4]=t,i[6]=e[9],i[7]=e[13],i[8]=n,i[9]=l,i[11]=e[14],i[12]=s,i[13]=c,i[14]=h}else i[0]=e[0],i[1]=e[4],i[2]=e[8],i[3]=e[12],i[4]=e[1],i[5]=e[5],i[6]=e[9],i[7]=e[13],i[8]=e[2],i[9]=e[6],i[10]=e[10],i[11]=e[14],i[12]=e[3],i[13]=e[7],i[14]=e[11],i[15]=e[15];return i}function xn(i,e){var t=e[0],n=e[1],s=e[2],l=e[3],c=e[4],h=e[5],p=e[6],_=e[7],y=e[8],v=e[9],b=e[10],T=e[11],S=e[12],A=e[13],C=e[14],D=e[15],F=t*h-n*c,O=t*p-s*c,z=t*_-l*c,N=n*p-s*h,j=n*_-l*h,te=s*_-l*p,G=y*A-v*S,W=y*C-b*S,K=y*D-T*S,ee=v*C-b*A,le=v*D-T*A,de=b*D-T*C,ve=F*de-O*le+z*ee+N*K-j*W+te*G;return ve?(i[0]=(h*de-p*le+_*ee)*(ve=1/ve),i[1]=(s*le-n*de-l*ee)*ve,i[2]=(A*te-C*j+D*N)*ve,i[3]=(b*j-v*te-T*N)*ve,i[4]=(p*K-c*de-_*W)*ve,i[5]=(t*de-s*K+l*W)*ve,i[6]=(C*z-S*te-D*O)*ve,i[7]=(y*te-b*z+T*O)*ve,i[8]=(c*le-h*K+_*G)*ve,i[9]=(n*K-t*le-l*G)*ve,i[10]=(S*j-A*z+D*F)*ve,i[11]=(v*z-y*j-T*F)*ve,i[12]=(h*W-c*ee-p*G)*ve,i[13]=(t*ee-n*W+s*G)*ve,i[14]=(A*O-S*N-C*F)*ve,i[15]=(y*N-v*O+b*F)*ve,i):null}function zt(i,e,t){var n=e[0],s=e[1],l=e[2],c=e[3],h=e[4],p=e[5],_=e[6],y=e[7],v=e[8],b=e[9],T=e[10],S=e[11],A=e[12],C=e[13],D=e[14],F=e[15],O=t[0],z=t[1],N=t[2],j=t[3];return i[0]=O*n+z*h+N*v+j*A,i[1]=O*s+z*p+N*b+j*C,i[2]=O*l+z*_+N*T+j*D,i[3]=O*c+z*y+N*S+j*F,i[4]=(O=t[4])*n+(z=t[5])*h+(N=t[6])*v+(j=t[7])*A,i[5]=O*s+z*p+N*b+j*C,i[6]=O*l+z*_+N*T+j*D,i[7]=O*c+z*y+N*S+j*F,i[8]=(O=t[8])*n+(z=t[9])*h+(N=t[10])*v+(j=t[11])*A,i[9]=O*s+z*p+N*b+j*C,i[10]=O*l+z*_+N*T+j*D,i[11]=O*c+z*y+N*S+j*F,i[12]=(O=t[12])*n+(z=t[13])*h+(N=t[14])*v+(j=t[15])*A,i[13]=O*s+z*p+N*b+j*C,i[14]=O*l+z*_+N*T+j*D,i[15]=O*c+z*y+N*S+j*F,i}function Wi(i,e,t){var n,s,l,c,h,p,_,y,v,b,T,S,A=t[0],C=t[1],D=t[2];return e===i?(i[12]=e[0]*A+e[4]*C+e[8]*D+e[12],i[13]=e[1]*A+e[5]*C+e[9]*D+e[13],i[14]=e[2]*A+e[6]*C+e[10]*D+e[14],i[15]=e[3]*A+e[7]*C+e[11]*D+e[15]):(s=e[1],l=e[2],c=e[3],h=e[4],p=e[5],_=e[6],y=e[7],v=e[8],b=e[9],T=e[10],S=e[11],i[0]=n=e[0],i[1]=s,i[2]=l,i[3]=c,i[4]=h,i[5]=p,i[6]=_,i[7]=y,i[8]=v,i[9]=b,i[10]=T,i[11]=S,i[12]=n*A+h*C+v*D+e[12],i[13]=s*A+p*C+b*D+e[13],i[14]=l*A+_*C+T*D+e[14],i[15]=c*A+y*C+S*D+e[15]),i}function mr(i,e,t){var n=t[0],s=t[1],l=t[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,i[4]=e[4]*s,i[5]=e[5]*s,i[6]=e[6]*s,i[7]=e[7]*s,i[8]=e[8]*l,i[9]=e[9]*l,i[10]=e[10]*l,i[11]=e[11]*l,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function Is(i,e,t){var n=Math.sin(t),s=Math.cos(t),l=e[4],c=e[5],h=e[6],p=e[7],_=e[8],y=e[9],v=e[10],b=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=l*s+_*n,i[5]=c*s+y*n,i[6]=h*s+v*n,i[7]=p*s+b*n,i[8]=_*s-l*n,i[9]=y*s-c*n,i[10]=v*s-h*n,i[11]=b*s-p*n,i}function So(i,e,t){var n=Math.sin(t),s=Math.cos(t),l=e[0],c=e[1],h=e[2],p=e[3],_=e[8],y=e[9],v=e[10],b=e[11];return e!==i&&(i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=l*s-_*n,i[1]=c*s-y*n,i[2]=h*s-v*n,i[3]=p*s-b*n,i[8]=l*n+_*s,i[9]=c*n+y*s,i[10]=h*n+v*s,i[11]=p*n+b*s,i}function js(i,e,t){var n=Math.sin(t),s=Math.cos(t),l=e[0],c=e[1],h=e[2],p=e[3],_=e[4],y=e[5],v=e[6],b=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=l*s+_*n,i[1]=c*s+y*n,i[2]=h*s+v*n,i[3]=p*s+b*n,i[4]=_*s-l*n,i[5]=y*s-c*n,i[6]=v*s-h*n,i[7]=b*s-p*n,i}function Gs(i,e){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]=e[0],i[13]=e[1],i[14]=e[2],i[15]=1,i}function No(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Qn(i,e,t){var n,s,l,c=t[0],h=t[1],p=t[2],_=Math.sqrt(c*c+h*h+p*p);return _<Kn?null:(c*=_=1/_,h*=_,p*=_,n=Math.sin(e),s=Math.cos(e),i[0]=c*c*(l=1-s)+s,i[1]=h*c*l+p*n,i[2]=p*c*l-h*n,i[3]=0,i[4]=c*h*l-p*n,i[5]=h*h*l+s,i[6]=p*h*l+c*n,i[7]=0,i[8]=c*p*l+h*n,i[9]=h*p*l-c*n,i[10]=p*p*l+s,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i)}function jl(i,e){var t=e[0],n=e[1],s=e[2],l=e[4],c=e[5],h=e[6],p=e[8],_=e[9],y=e[10];return i[0]=Math.sqrt(t*t+n*n+s*s),i[1]=Math.sqrt(l*l+c*c+h*h),i[2]=Math.sqrt(p*p+_*_+y*y),i}function Uu(i,e){var t=new Lr(3);jl(t,e);var n=1/t[0],s=1/t[1],l=1/t[2],c=e[0]*n,h=e[1]*s,p=e[2]*l,_=e[4]*n,y=e[5]*s,v=e[6]*l,b=e[8]*n,T=e[9]*s,S=e[10]*l,A=c+y+S,C=0;return A>0?(C=2*Math.sqrt(A+1),i[3]=.25*C,i[0]=(v-T)/C,i[1]=(b-p)/C,i[2]=(h-_)/C):c>y&&c>S?(C=2*Math.sqrt(1+c-y-S),i[3]=(v-T)/C,i[0]=.25*C,i[1]=(h+_)/C,i[2]=(b+p)/C):y>S?(C=2*Math.sqrt(1+y-c-S),i[3]=(b-p)/C,i[0]=(h+_)/C,i[1]=.25*C,i[2]=(v+T)/C):(C=2*Math.sqrt(1+S-c-y),i[3]=(h-_)/C,i[0]=(b+p)/C,i[1]=(v+T)/C,i[2]=.25*C),i}function qa(i,e){var t=e[0],n=e[1],s=e[2],l=e[3],c=t+t,h=n+n,p=s+s,_=t*c,y=n*c,v=n*h,b=s*c,T=s*h,S=s*p,A=l*c,C=l*h,D=l*p;return i[0]=1-v-S,i[1]=y+D,i[2]=b-C,i[3]=0,i[4]=y-D,i[5]=1-_-S,i[6]=T+A,i[7]=0,i[8]=b+C,i[9]=T-A,i[10]=1-_-v,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}var Gl=function(i,e,t,n,s){var l=1/Math.tan(e/2);if(i[0]=l/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,s!=null&&s!==1/0){var c=1/(n-s);i[10]=(s+n)*c,i[14]=2*s*n*c}else i[10]=-1,i[14]=-2*n;return i},ju=function(i,e,t,n,s,l,c){var h=1/(e-t),p=1/(n-s),_=1/(l-c);return i[0]=-2*h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*_,i[11]=0,i[12]=(e+t)*h,i[13]=(s+n)*p,i[14]=(c+l)*_,i[15]=1,i},Wa=zt;function Qt(){var i=new Lr(3);return Lr!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function Hs(i){var e=new Lr(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e}function Xi(i){var e=i[0],t=i[1],n=i[2];return Math.sqrt(e*e+t*t+n*n)}function Tr(i,e,t){var n=new Lr(3);
vendor: 11,604 bytes, line 1
1return n[0]=i,n[1]=e,n[2]=t,n}function Ni(i,e,t,n){return i[0]=e,i[1]=t,i[2]=n,i}function Yi(i,e,t){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i[2]=e[2]+t[2],i}function eo(i,e,t){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],i}function jc(i,e,t){return i[0]=e[0]*t[0],i[1]=e[1]*t[1],i[2]=e[2]*t[2],i}function Zs(i,e,t){return i[0]=Math.min(e[0],t[0]),i[1]=Math.min(e[1],t[1]),i[2]=Math.min(e[2],t[2]),i}function $s(i,e,t){return i[0]=Math.max(e[0],t[0]),i[1]=Math.max(e[1],t[1]),i[2]=Math.max(e[2],t[2]),i}function oi(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i}function cn(i,e,t,n){return i[0]=e[0]+t[0]*n,i[1]=e[1]+t[1]*n,i[2]=e[2]+t[2]*n,i}function Xa(i,e){var t=e[0]-i[0],n=e[1]-i[1],s=e[2]-i[2];return Math.sqrt(t*t+n*n+s*s)}function qs(i,e){var t=e[0]-i[0],n=e[1]-i[1],s=e[2]-i[2];return t*t+n*n+s*s}function is(i){var e=i[0],t=i[1],n=i[2];return e*e+t*t+n*n}function rs(i,e){return i[0]=-e[0],i[1]=-e[1],i[2]=-e[2],i}function ti(i,e){var t=e[0],n=e[1],s=e[2],l=t*t+n*n+s*s;return l>0&&(l=1/Math.sqrt(l)),i[0]=e[0]*l,i[1]=e[1]*l,i[2]=e[2]*l,i}function Di(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function xr(i,e,t){var n=e[0],s=e[1],l=e[2],c=t[0],h=t[1],p=t[2];return i[0]=s*p-l*h,i[1]=l*c-n*p,i[2]=n*h-s*c,i}function Ws(i,e,t,n){var s=e[0],l=e[1],c=e[2];return i[0]=s+n*(t[0]-s),i[1]=l+n*(t[1]-l),i[2]=c+n*(t[2]-c),i}function hi(i,e,t){var n=e[0],s=e[1],l=e[2],c=t[3]*n+t[7]*s+t[11]*l+t[15];return i[0]=(t[0]*n+t[4]*s+t[8]*l+t[12])/(c=c||1),i[1]=(t[1]*n+t[5]*s+t[9]*l+t[13])/c,i[2]=(t[2]*n+t[6]*s+t[10]*l+t[14])/c,i}function Io(i,e,t){var n=e[0],s=e[1],l=e[2];return i[0]=n*t[0]+s*t[3]+l*t[6],i[1]=n*t[1]+s*t[4]+l*t[7],i[2]=n*t[2]+s*t[5]+l*t[8],i}function da(i,e,t){var n=t[0],s=t[1],l=t[2],c=t[3],h=e[0],p=e[1],_=e[2],y=s*_-l*p,v=l*h-n*_,b=n*p-s*h;return i[0]=h+c*(y+=y)+s*(b+=b)-l*(v+=v),i[1]=p+c*v+l*y-n*b,i[2]=_+c*b+n*v-s*y,i}function Gc(i){return i[0]=0,i[1]=0,i[2]=0,i}function ns(i,e){return i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2]}var Li=eo,Gu=jc,As=Xi;function to(){var i=new Lr(4);return Lr!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0,i[3]=0),i}function Hc(i,e,t,n){var s=new Lr(4);return s[0]=i,s[1]=e,s[2]=t,s[3]=n,s}function Vo(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i}function Hl(i,e){var t=e[0],n=e[1],s=e[2],l=e[3],c=t*t+n*n+s*s+l*l;return c>0&&(c=1/Math.sqrt(c)),i[0]=t*c,i[1]=n*c,i[2]=s*c,i[3]=l*c,i}function ar(i,e,t){var n=e[0],s=e[1],l=e[2],c=e[3];return i[0]=t[0]*n+t[4]*s+t[8]*l+t[12]*c,i[1]=t[1]*n+t[5]*s+t[9]*l+t[13]*c,i[2]=t[2]*n+t[6]*s+t[10]*l+t[14]*c,i[3]=t[3]*n+t[7]*s+t[11]*l+t[15]*c,i}function it(){var i=new Lr(4);return Lr!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function Cn(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function Zl(i,e){var t=2*Math.acos(e[3]),n=Math.sin(t/2);return n>Kn?(i[0]=e[0]/n,i[1]=e[1]/n,i[2]=e[2]/n):(i[0]=1,i[1]=0,i[2]=0),t}function Xs(i,e,t){t*=.5;var n=e[0],s=e[1],l=e[2],c=e[3],h=Math.sin(t),p=Math.cos(t);return i[0]=n*p+c*h,i[1]=s*p+l*h,i[2]=l*p-s*h,i[3]=c*p-n*h,i}function fa(i,e,t){t*=.5;var n=e[0],s=e[1],l=e[2],c=e[3],h=Math.sin(t),p=Math.cos(t);return i[0]=n*p-l*h,i[1]=s*p+c*h,i[2]=l*p+n*h,i[3]=c*p-s*h,i}function Ao(i,e,t){t*=.5;var n=e[0],s=e[1],l=e[2],c=e[3],h=Math.sin(t),p=Math.cos(t);return i[0]=n*p+s*h,i[1]=s*p-n*h,i[2]=l*p+c*h,i[3]=c*p-l*h,i}Qt(),to();var io,Zc,pa,Ya=Hl,Ys=(io=Qt(),Zc=Tr(1,0,0),pa=Tr(0,1,0),function(i,e,t){var n=Di(e,t);return n<-.999999?(xr(io,Zc,e),As(io)<1e-6&&xr(io,pa,e),ti(io,io),function(s,l,c){c*=.5;var h=Math.sin(c);s[0]=h*l[0],s[1]=h*l[1],s[2]=h*l[2],s[3]=Math.cos(c)}(i,io,Math.PI),i):n>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(xr(io,e,t),i[0]=io[0],i[1]=io[1],i[2]=io[2],i[3]=1+n,Ya(i,i))});function Xr(){var i=new Lr(2);return Lr!=Float32Array&&(i[0]=0,i[1]=0),i}function Ks(i,e){var t=new Lr(2);return t[0]=i,t[1]=e,t}function $l(i,e,t){return i[0]=e,i[1]=t,i}function os(i,e,t){return i[0]=e[0]+t[0],i[1]=e[1]+t[1],i}function Js(i,e,t){return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i}function Ka(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i}function ql(i){var e=i[0],t=i[1];return Math.sqrt(e*e+t*t)}function ma(i,e){var t=e[0],n=e[1],s=t*t+n*n;return s>0&&(s=1/Math.sqrt(s)),i[0]=e[0]*s,i[1]=e[1]*s,i}function Ja(i,e){return i[0]*e[0]+i[1]*e[1]}it(),it(),Vl();var ss=Js;function $c(i,e,t,n){const s=3*i,l=3*(t-i)-s,c=1-s-l,h=3*e,p=3*(n-e)-h,_=1-h-p;return function(y,v=1e-6){if(y<=0)return 0;if(y>=1)return 1;let b=y;for(let A=0;A<8;A++){const C=((c*b+l)*b+s)*b-y;if(Math.abs(C)<v)return((_*b+p)*b+h)*b;const D=(3*c*b+2*l)*b+s;if(Math.abs(D)<1e-6)break;b-=C/D}let T=0,S=1;b=y;for(let A=0;A<20;A++){const C=((c*b+l)*b+s)*b;if(Math.abs(C-y)<v)break;y>C?T=b:S=b,b=.5*(T+S)}return((_*b+p)*b+h)*b}}function Le(i,e){this.x=i,this.y=e}function as(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!as(i[t],e[t]))return!1;return!0}if(typeof i=="object"&&i!==null&&e!==null){if(typeof e!="object")return!1;const t=i,n=e;if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const s in t)if(!as(t[s],n[s]))return!1;return!0}return i===e}function Qa(i,e,t=0,n=i.length-1,s=Wl){for(;n>t;){if(n-t>600){const p=n-t+1,_=e-t+1,y=Math.log(p),v=.5*Math.exp(2*y/3),b=.5*Math.sqrt(y*v*(p-v)/p)*(_-p/2<0?-1:1);Qa(i,e,Math.max(t,Math.floor(e-_*v/p+b)),Math.min(n,Math.floor(e+(p-_)*v/p+b)),s)}const l=i[e];let c=t,h=n;for(Qs(i,t,e),s(i[n],l)>0&&Qs(i,t,n);c<h;){for(Qs(i,c,h),c++,h--;s(i[c],l)<0;)c++;for(;s(i[h],l)>0;)h--}s(i[t],l)===0?Qs(i,t,h):(h++,Qs(i,h,n)),h<=e&&(t=h+1),e<=h&&(n=h-1)}}function Qs(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}function Wl(i,e){return i<e?-1:i>e?1:0}function Hu(i){let e=0;for(let t,n,s=0,l=i.length,c=l-1;s<l;c=s++)t=i[s],n=i[c],e+=(n.x-t.x)*(t.y+n.y);return e}function Zu(i,e){return e.area-i.area}function Si(i,e){const t=i.length;if(t<=1)return[i];const n=[];let s,l;for(let c=0;c<t;c++){const h=Hu(i[c]);h!==0&&(i[c].area=Math.abs(h),l===void 0&&(l=h<0),l===h<0?(s&&n.push(s),s=[i[c]]):s.push(i[c]))}if(s&&n.push(s),e>1)for(let c=0;c<n.length;c++){const h=n[c];h.length<=e||(Qa(h,e,1,h.length-1,Zu),n[c]=h.slice(0,e))}return n}function zr(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function el(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function $u(i,e,t){const n=i[0]-e[0],s=i[1]-e[1],l=i[0]-t[0],c=i[1]-t[1];return n*c-l*s===0&&n*l<=0&&s*c<=0}function un(i,e,t){return e[1]>i[1]!=t[1]>i[1]&&i[0]<(t[0]-e[0])*(i[1]-e[1])/(t[1]-e[1])+e[0]}function Un(i,e,t=!1){let n=!1;for(let s=0,l=e.length;s<l;s++){const c=e[s];for(let h=0,p=c.length,_=p-1;h<p;_=h++){const y=c[_],v=c[h];if($u(i,y,v))return t;un(i,y,v)&&(n=!n)}}return n}function qc(i,e,t,n){const s=n[0]-t[0],l=n[1]-t[1],c=(i[0]-t[0])*l-s*(i[1]-t[1]),h=(e[0]-t[0])*l-s*(e[1]-t[1]);return c>0&&h<0||c<0&&h>0}function ea(i,e,t,n){return(s=[n[0]-t[0],n[1]-t[1]])[0]*(l=[e[0]-i[0],e[1]-i[1]])[1]-s[1]*l[0]!==0&&!(!qc(i,e,t,n)||!qc(t,n,i,e));var s,l}function tl(i){const e=new Le(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),t=new Le(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of i[0])e.x>n.x&&(e.x=n.x),e.y>n.y&&(e.y=n.y),t.x<n.x&&(t.x=n.x),t.y<n.y&&(t.y=n.y);return{min:e,max:t}}Xr(),Le.prototype={clone(){return new Le(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)},rotateAround(i,e){return this.clone()._rotateAround(i,e)},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){const e=i.x-this.x,t=i.y-this.y;return e*e+t*t},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,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult(i){const e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,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(){const i=this.y;return this.y=this.x,this.x=-i,this},_rotate(i){const e=Math.cos(i),t=Math.sin(i),n=t*this.x+e*this.y;return this.x=e*this.x-t*this.y,this.y=n,this},_rotateAround(i,e){const t=Math.cos(i),n=Math.sin(i),s=e.y+n*(this.x-e.x)+t*(this.y-e.y);return this.x=e.x+t*(this.x-e.x)-n*(this.y-e.y),this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Le},Le.convert=function(i){if(i instanceof Le)return i;if(Array.isArray(i))return new Le(+i[0],+i[1]);if(i.x!==void 0&&i.y!==void 0)return new Le(+i.x,+i.y);throw new Error("Expected [x, y] or {x, y} point format")};const Wc=Math.PI/180,_a=180/Math.PI,qu=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Bt(i){return i*Wc}function Ur(i){return i*_a}const il=[[0,0],[1,0],[1,1],[0,1]];function ga(i){if(i<=0)return 0;if(i>=1)return 1;const e=i*i,t=e*i;return 4*(i<.5?t:3*(i-e)+t-.75)}const id=$c(.25,.1,.25,1);function yt(i,e,t){return Math.min(t,Math.max(e,i))}function ls(i,e,t){return(t=yt((t-i)/(e-i),0,1))*t*(3-2*t)}function vn(i,e,t){const n=t-e,s=((i-e)%n+n)%n+e;return s===e?t:s}function Cs(i,e,t){if(!i.length)return t(null,[]);let n=i.length;const s=new Array(i.length);let l=null;i.forEach((c,h)=>{e(c,(p,_)=>{p&&(l=p),s[h]=_,--n===0&&t(l,s)})})}function rl(i,e){const t={};for(let n=0;n<e.length;n++){const s=e[n];s in i&&(t[s]=i[s])}return t}let Wu=1;function Xl(){return function i(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function Yl(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log2(i)))}function Kl(i){return!!i&&qu.test(i)}function cs(i,e){i.forEach(t=>{e[t]&&(e[t]=e[t].bind(e))})}function ro(i,e,t){const n={};for(const s in i)n[s]=e.call(this,i[s],s,i);return n}function Xc(i,e,t){const n={};for(const s in i)e.call(this,i[s],s,i)&&(n[s]=i[s]);return n}function jn(i){return Array.isArray(i)?i.map(jn):typeof i=="object"&&i?ro(i,jn):i}function Yc(i,e){for(let t=0;t<i.length;t++)if(e.includes(i[t]))return!0;return!1}const Jl={};function gi(i){Jl[i]||(typeof console<"u"&&console.warn(i),Jl[i]=!0)}function Uo(i,e,t){return(t.y-i.y)*(e.x-i.x)>(e.y-i.y)*(t.x-i.x)}function Kc([i,e,t]){const n=Bt(e+90),s=Bt(t);return{x:i*Math.cos(n)*Math.sin(s),y:i*Math.sin(n)*Math.sin(s),z:i*Math.cos(s),azimuthal:e,polar:t}}function nl(i,e,t){const n=Math.sqrt(i*i+e*e+t*t),s=n>0?Math.acos(t/n)*_a:0;let l=i!==0||e!==0?Math.atan2(-e,-i)*_a+90:0;return l<0&&(l+=360),[n,l,s]}function us(i){return(typeof self<"u"||i!==void 0)&&typeof WorkerGlobalScope<"u"&&(i!==void 0?i:self)instanceof WorkerGlobalScope}function Gn(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,n,s,l)=>{const c=s||l;return e[n]=!c||c.toLowerCase(),""}),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}function jo(i){return i?{cacheControl:i.get("cache-control"),expires:i.get("expires")}
1:{cacheControl:void 0,expires:void 0}}function ya(i){try{const e=self[i];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}}function Fr(i,e){return[i[4*e],i[4*e+1],i[4*e+2],i[4*e+3]]}function no(i,e,t){i[4*e+0]=t[0],i[4*e+1]=t[1],i[4*e+2]=t[2],i[4*e+3]=t[3]}function Xu(i){return[Math.pow(i[0],1/2.2),Math.pow(i[1],1/2.2),Math.pow(i[2],1/2.2)]}function Yu(i){return i>0?1/(1.001-i):1+i}function Ql(i){return i>0?1-1/(1.001-i):-i}function Ku(i,e,t){return(i-e.min)*(t.max-t.min)/(e.max-e.min)+t.min}function Jc(i){return i*i*i*i*i}function ec(i){return i>>>=0,i=Math.imul(2747636419^i,2654435769)>>>0,i=Math.imul(i^i>>>16,2654435769)>>>0,(i=Math.imul(i^i>>>16,2654435769)>>>0)/4294967296}let Qc,ol,H,M,k,$;function J(){return Qc??(Qc=self.OffscreenCanvas&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Qc}const Y={requestIdleCallback:i=>{if(typeof requestIdleCallback<"u")return requestIdleCallback(i);setTimeout(()=>i({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>M!==void 0?M:performance.now(),setNow(i){M=i},restoreNow(){M=void 0},frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const{width:t,height:n}=i;k||(k=document.createElement("canvas"));const s=k.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return(t>k.width||n>k.height)&&(k.width=t,k.height=n),s.clearRect(-e,-e,t+2*e,n+2*e),s.drawImage(i,0,0,t,n),s.getImageData(-e,-e,t+2*e,n+2*e)},resolveURL:i=>(ol||(ol=document.createElement("a")),ol.href=i,ol.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(H??(H=window.matchMedia("(prefers-reduced-motion: reduce)")),H.matches)},hasCanvasFingerprintNoise(){if($!==void 0)return $;if(!J())return $=!1,!1;const i=new OffscreenCanvas(85,1),e=i.getContext("2d",{willReadFrequently:!0});let t=0;for(let s=0;s<i.width;++s)e.fillStyle=`rgba(${t++},${t++},${t++}, 255)`,e.fillRect(s,0,1,1);const n=e.getImageData(0,0,i.width,i.height);t=0;for(let s=0;s<n.data.length;++s)if(s%4!=3&&t++!==n.data[s])return $=!0,!0;return $=!1,!1}};let Q;const ie={API_URL:"https://api.mapbox.com",API_URL_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i,API_TILEJSON_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i,API_SPRITE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i,API_FONTS_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i,API_STYLE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i,API_CDN_URL_REGEX:/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i,get EVENTS_URL(){if(!ie.API_URL)return null;try{const i=new URL(ie.API_URL);return i.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":i.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{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",MESHOPT_URL:"/mapbox-gl-js/meshopt_base_v1.2.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v1.2.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/plugins/mapbox-gl-pmtiles-provider/v0.0.2/mapbox-gl-pmtiles-provider.js"})};function re(){return new URL(ie.DRACO_URL,ie.API_URL).href}function ce(){if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(function(){if(Q===void 0){if(typeof WebAssembly!="object")return!1;const 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]);Q=WebAssembly.validate(i)}return Q}()?ie.MESHOPT_SIMD_URL:ie.MESHOPT_URL,ie.API_URL).href}function ye(){return new URL(ie.BUILDING_GEN_URL,ie.API_URL).href}function Te(i,e){const t=i.indexOf("?"),n=t<0?i:i.slice(0,t),s=new URLSearchParams(t<0?"":i.slice(t));for(const[l,c]of Object.entries(e))s.set(l,c);return`${n}?${s}`}
1function ze(i,e={persistentParams:[]}){const t=i.indexOf("?");if(t<0)return i;const n=new URLSearchParams,s=new URLSearchParams(i.slice(t));for(const c of e.persistentParams){const h=s.get(c);h&&n.set(c,h)}const l=n.toString();return`${i.slice(0,t)}${l.length>0?`?${l}`:""}`}const ke="mapbox-tiles";let Ue=500,ut=50;const nt=["language","worldview","jobid"];let Je;function gt(){try{return caches}catch{}}function at(){const i=gt();i&&Je==null&&(Je=i.open(ke))}let At=1/0;function Nt(i){return ie.API_URL_REGEX.test(i)}function jt(i){return i.indexOf("mapbox:")===0}function Ht(i){return ie.API_CDN_URL_REGEX.test(i)}function Ct(i){return ie.API_SPRITE_REGEX.test(i)}function xi(i){return ie.API_STYLE_REGEX.test(i)&&!Ct(i)}const pi={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(pi);class kt extends Error{constructor(e,t,n){super(),this.url=n,this.statusText=e,this.status=t}get message(){return this.status===401&&Nt(this.url)?`${this.statusText}: you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/guides/#access-tokens-and-token-scopes`:this.statusText}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function Zt(i){return typeof i=="object"&&i!==null&&"status"in i&&i.status===404}const Mt=us()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,$t=/^\w+:/,mi=/[\r\n]+/;async function Ft(i,e){let t;return t=i.type==="arrayBuffer"?await e.arrayBuffer():i.type==="json"?await e.json():await e.text(),{data:t,headers:e.headers}}async function di(i,e){return e&&e.throwIfAborted(),(t=i.url).startsWith("file:")||Mt().startsWith("file:")&&!$t.test(t)?async function(n,s){return new Promise((l,c)=>{const h=new XMLHttpRequest,p=()=>{s.removeEventListener("abort",p),h.abort(),c(s.reason)};s&&s.addEventListener("abort",p),h.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const _ in n.headers)h.setRequestHeader(_,n.headers[_]);n.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=n.credentials==="include",h.onerror=()=>{s&&s.removeEventListener("abort",p),c(new Error(h.statusText))},h.onload=()=>{if(s&&s.removeEventListener("abort",p),(h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let _=h.response;if(n.type==="json")try{_=JSON.parse(h.response)}catch(v){return void c(v)}const y=new Headers;h.getAllResponseHeaders().trim().split(mi).forEach(v=>{const b=v.split(": "),T=b.shift(),S=b.join(": ");T&&y.set(T,S)}),l({data:_,headers:y})}else c(new kt(h.statusText,h.status,n.url))},h.send(n.body)})}(i,e):async function(n,s){const l=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:Mt(),referrerPolicy:n.referrerPolicy,signal:s}),c=(h=l.url).indexOf("sku=")>0&&Nt(h);var h;if(n.type==="json"&&l.headers.set("Accept","application/json"),c){let b=null;try{b=await async function(T){if(at(),Je==null)return null;const S=await Je;
vendor: 11,920 bytes, line 1
1let A=ze(T.url,{persistentParams:nt});const C=T.headers.get("Range");C&&(A=Te(A,{range:C}));const D=await S.match(A);if(!D)return null;const F=function(O){if(!O)return!1;const z=new Date(O.headers.get("expires")||0),N=Gn(O.headers.get("cache-control")||"");return Number(z)>Date.now()&&!N["no-cache"]}(D);return S.delete(A).catch(O=>gi(O.message)),F&&S.put(A,D.clone()).catch(O=>gi(O.message)),{response:D,fresh:F}}(l)}catch(T){T.message!=="SecurityError"&&gi(T.toString())}if(b&&b.fresh)return s&&s.throwIfAborted(),Ft(n,b.response)}const p=Date.now();let _;try{_=await fetch(l)}catch(b){throw b.name==="AbortError"?b:new Error(`${b.message} ${n.url}`,{cause:b})}if(s&&s.throwIfAborted(),!_.ok)throw new kt(_.statusText,_.status,n.url);const y=c?_.clone():null,v=await Ft(n,_);return y&&async function(b,T,S){if(at(),Je==null)return;const A=Gn(T.headers.get("cache-control")||"");if(A["no-store"])return;const C={status:T.status,statusText:T.statusText,headers:new Headers(T.headers)};A["max-age"]&&C.headers.set("Expires",new Date(S+1e3*A["max-age"]).toUTCString());const D=C.headers.get("expires");if(!D||new Date(D).getTime()-S<42e4)return;let F=ze(b.url,{persistentParams:nt});if(T.status===206){const N=b.headers.get("Range");if(!N)return;C.status=200,F=Te(F,{range:N})}const O=new Response((z=T.status)!==200&&z!==404&&[101,103,204,205,304].includes(z)?null:T.body,C);var z;if(at(),Je!=null)try{await(await Je).put(F,O)}catch(N){gi(N.message)}}(l,y,p),v}(i,e);var t}async function vr(i,e){return di(Object.assign(i,{type:"json"}),e)}async function vi(i,e){return di(Object.assign(i,{type:"arrayBuffer"}),e)}function _r(i){const e=document.createElement("a");return e.href=i,e.protocol===location.protocol&&e.host===location.host}let Ki,wi;Ki=[],wi=0;const Fi="01",Ii={create:"create",load:"load",fullLoad:"fullLoad"},tr={mark(i){performance.mark(i)},measure(i,e,t){performance.measure(i,e,t)}};function jr(i){const e=i.name.split("?")[0];return Ht(e)&&e.includes("mapbox-gl.js")?"javascript":Ht(e)&&e.includes("mapbox-gl.css")?"css":function(t){return ie.API_FONTS_REGEX.test(t)}(e)?"fontRange":Ct(e)?"sprite":xi(e)?"style":function(t){return ie.API_TILEJSON_REGEX.test(t)}(e)?"tilejson":"other"}const Gr=/(\.(png|jpg)\d*)(?=$)/,gr=/^.+\/v4\//,oo=/\.[\w]+$/,Ai=/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/,yi=/^access_token=(.*)$/,Yr="NO_ACCESS_TOKEN",Er=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Vt(i){const e=i.match(Er);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function Zi(i){const e=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${e}`}const Or="mapbox.eventData";function Mn(i){if(!i)return null;const e=i.split(".");if(!e||e.length!==3)return null;try{return JSON.parse(decodeURIComponent(atob(e[1]).split("").map(t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}function tn(i){return!(!ie.EVENTS_URL||!i&&!ie.ACCESS_TOKEN)}let Br;const so=/^[\w.+-]+(\/[\w.+-]+)?$/;let ao="other";class Ci{constructor(e){this.type=e,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=!1}getStorageKey(e){const t=Mn(ie.ACCESS_TOKEN);let n="";return n=t&&t.u?btoa(encodeURIComponent(t.u).replace(/%([0-9A-F]{2})/g,(s,l)=>String.fromCharCode(+("0x"+l)))):ie.ACCESS_TOKEN||"",e?`${Or}.${e}:${n}`:`${Or}:${n}`}fetchEventData(){const e=ya("localStorage"),t=this.getStorageKey(),n=this.getStorageKey("uuid"),s=this.getStorageKey("uuidTimestamp");if(e)try{const l=localStorage.getItem(t);l&&(this.eventData=JSON.parse(l));const c=localStorage.getItem(n);c&&(this.anonId=c);const h=localStorage.getItem(s);h&&(this.anonIdTimestamp=Number(h));const p=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<p)&&this.refreshUUID()}catch{gi("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=Xl(),this.anonIdTimestamp=Date.now()}saveEventData(){const e=ya("localStorage"),t=this.getStorageKey(),n=this.getStorageKey("uuid"),s=this.getStorageKey("uuidTimestamp"),l=this.anonId,c=this.anonIdTimestamp;if(e&&l)try{localStorage.setItem(n,l),Object.keys(this.eventData).length>=1&&localStorage.setItem(t,JSON.stringify(this.eventData)),c&&localStorage.setItem(s,c.toString())}catch{gi("Unable to write to LocalStorage")}}processRequests(){}postEvent(e,t,n,s){if(!ie.EVENTS_URL)return;const l=Vt(ie.EVENTS_URL);l.params.push(`access_token=${s||ie.ACCESS_TOKEN||""}`);const c={event:this.type,created:new Date(e).toISOString()},h=t?Object.assign(c,t):c,p={url:Zi(l),headers:{"Content-Type":"text/plain"},body:JSON.stringify([h])};this.pendingRequest=!0,async function(_){return di(Object.assign(_,{method:"POST"}),void 0)}(p).then(()=>{this.pendingRequest=!1,n(null),this.saveEventData(),this.processRequests()}).catch(_=>{this.pendingRequest=!1,n(_),this.saveEventData(),this.processRequests()})}queueRequest(e,t){this.queue.push({...e,customAccessToken:t}),this.processRequests()}}class or extends Ci{constructor(e){super("metrics"),e&&(this.data=e)}postMetricsEvent(e){if(!tn(e))return;this.anonId||this.fetchEventData(),Kl(this.anonId)||this.refreshUUID();const t={...this.data,sessionId:this.anonId};this.queueRequest({timestamp:Date.now(),payload:t},e)}processRequests(){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,payload:t,customAccessToken:n}=this.queue.shift();this.postEvent(e,t,()=>{},n)}}const kr=new class extends Ci{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,e){tn(e)&&Array.isArray(i)&&i.some(t=>jt(t)||Nt(t))&&this.queueRequest({timestamp:Date.now()},e)}processRequests(){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const i=Mn(ie.ACCESS_TOKEN),e=i?i.u:ie.ACCESS_TOKEN;let t=e!==this.eventData.tokenU;Kl(this.anonId)||(this.refreshUUID(),t=!0);const{timestamp:n,customAccessToken:s}=this.queue.shift();if(this.eventData.lastSuccess){const c=new Date(this.eventData.lastSuccess),h=new Date(n),p=(n-this.eventData.lastSuccess)/864e5;t=t||p>=1||p<-1||c.getDate()!==h.getDate()}else t=!0;if(!t)return void this.processRequests();const l={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:To,skuId:Fi,"enabled.telemetry":!1,userId:this.anonId,bundleFormat:"umd",bundleDistribution:ao};Br&&(l.sdkInfo=Br),this.postEvent(n,l,c=>{c||(this.eventData.lastSuccess=n,this.eventData.tokenU=e)},s)}},Rn=kr.postTurnstileEvent.bind(kr),bn=new class extends Ci{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,e,t,n){this.skuToken=e,this.errorCb=n,ie.EVENTS_URL&&(t||ie.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},t):this.errorCb(new Error(Yr)))}processRequests(){if(this.pendingRequest||this.queue.length===0)return;const{id:i,timestamp:e,customAccessToken:t}=this.queue.shift();if(i&&this.success[i])return;this.anonId&&this.anonIdTimestamp||this.fetchEventData(),Kl(this.anonId)||this.refreshUUID();const n={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:To,skuId:Fi,skuToken:this.skuToken,userId:this.anonId,bundleFormat:"umd",bundleDistribution:ao};Br&&(n.sdkInfo=Br),this.postEvent(e,n,s=>{s?this.errorCb(s):i&&(this.success[i]=!0)},t)}remove(){this.errorCb=null}},rn=bn.postMapLoadEvent.bind(bn),Hr=new class extends Ci{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(i){let e=this.mapInstanceIdMap.get(i);return e||(e=Xl(),this.mapInstanceIdMap.set(i,e)),e}getEventId(i){const e=this.eventIdPerMapInstanceMap.get(i)||0;return this.eventIdPerMapInstanceMap.set(i,e+1),e}postStyleLoadEvent(i,e){const{map:t,style:n,importedStyles:s}=e;if(!tn(i))return;const l=this.getMapInstanceId(t),c={mapInstanceId:l,eventId:this.getEventId(l),style:n};s.length&&(c.importedStyles=s),this.queueRequest({timestamp:Date.now(),payload:c},i)}processRequests(){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:i,payload:e,customAccessToken:t}=this.queue.shift();this.postEvent(i,e,()=>{},t)}},lo=Hr.postStyleLoadEvent.bind(Hr),Go=new or({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Hn=Go.postMetricsEvent.bind(Go),ir=new or({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),wn=ir.postMetricsEvent.bind(ir),Bi=new class extends Ci{constructor(){super("gljs.performance")}postPerformanceEvent(i,e){tn(i)&&this.queueRequest({timestamp:Date.now(),performanceData:e},i)}processRequests(){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:i,performanceData:e,customAccessToken:t}=this.queue.shift(),n=function(s){const l=performance.getEntriesByType("resource"),c=performance.getEntriesByType("mark"),h=function(T){const S={};if(T){for(const A in T)if(A!=="other")for(const C of T[A]){const D=`${A}ResolveRangeMin`,F=`${A}ResolveRangeMax`,O=`${A}RequestCount`,z=`${A}RequestCachedCount`;S[D]=Math.min(S[D]||1/0,C.startTime),S[F]=Math.max(S[F]||-1/0,C.responseEnd);const N=j=>{S[j]===void 0&&(S[j]=0),++S[j]};C.transferSize!==void 0&&C.transferSize===0&&N(z),N(O)}}return S}(function(T,S){const A={};if(T)for(const C of T){const D=S(C);A[D]===void 0&&(A[D]=[]),A[D].push(C)}return A}(l,jr)),p=window.devicePixelRatio,_=navigator.connection||navigator.mozConnection||navigator.webkitConnection,y=_?_.effectiveType:void 0,v={counters:[],metadata:[],attributes:[]},b=(T,S,A)=>{A!=null&&T.push({name:S,value:A.toString()})};for(const T in h)b(v.counters,T,h[T]);if(s.interactionRange[0]!==1/0&&s.interactionRange[1]!==-1/0&&(b(v.counters,"interactionRangeMin",s.interactionRange[0]),b(v.counters,"interactionRangeMax",s.interactionRange[1])),c)for(const T of Object.values(Ii)){const S=c.find(A=>A.name===T);S&&b(v.counters,T,S.startTime)}return b(v.counters,"visibilityHidden",s.visibilityHidden),b(v.attributes,"style",function(T){if(T)for(const S of T){const A=S.name.split("?")[0];if(xi(A)){const C=A.split("/").slice(-2);if(C.length===2)return`mapbox://styles/${C[0]}/${C[1]}`}}}(l)),b(v.attributes,"terrainEnabled",s.terrainEnabled?"true":"false"),b(v.attributes,"fogEnabled",s.fogEnabled?"true":"false"),b(v.attributes,"projection",s.projection),b(v.attributes,"zoom",s.zoom),b(v.metadata,"devicePixelRatio",p),b(v.metadata,"connectionEffectiveType",y),b(v.metadata,"navigatorUserAgent",navigator.userAgent),b(v.metadata,"screenWidth",window.screen.width),b(v.metadata,"screenHeight",window.screen.height),b(v.metadata,"windowWidth",window.innerWidth),b(v.metadata,"windowHeight",window.innerHeight),b(v.metadata,"mapWidth",s.width/p),b(v.metadata,"mapHeight",s.height/p),b(v.metadata,"webglRenderer",s.renderer),b(v.metadata,"webglVendor",s.vendor),b(v.metadata,"sdkVersion",To),b(v.metadata,"sdkIdentifier","mapbox-gl-js"),v}(e);for(const s of n.metadata);for(const s of n.counters);for(const s of n.attributes);this.postEvent(i,n,()=>{},t)}},Sr=Bi.postPerformanceEvent.bind(Bi),co=new class extends Ci{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,e,t,n){if(!ie.API_URL||!ie.SESSION_PATH)return;const s=Vt(ie.API_URL+ie.SESSION_PATH);s.params.push(`sku=${e||""}`),s.params.push(`access_token=${n||ie.ACCESS_TOKEN||""}`);const l={url:Zi(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=!0,async function(c){return di(Object.assign(c,{method:"GET"}),void 0)}(l).then(()=>{this.pendingRequest=!1,t(null),this.saveEventData(),this.processRequests()}).catch(c=>{this.pendingRequest=!1,t(c),this.saveEventData(),this.processRequests()})}getSessionAPI(i,e,t,n){this.skuToken=e,this.errorCb=n,ie.EVENTS_URL&&ie.SESSION_PATH&&ie.API_URL&&(t||ie.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},t):this.errorCb(new Error(Yr)))}processRequests(){if(this.pendingRequest||this.queue.length===0)return;const{id:i,timestamp:e,customAccessToken:t}=this.queue.shift();
1i&&this.success[i]||this.getSession(e,this.skuToken,n=>{n?this.errorCb(n):i&&(this.success[i]=!0)},t)}remove(){this.errorCb=null}},Ms=co.getSessionAPI.bind(co),hn=new Set;function sl(i,e=0){const s=i.length,l=s-(3&s);let c,h=0|e,p=0;for(;p<l;)c=255&i.charCodeAt(p)|(255&i.charCodeAt(p+1))<<8|(255&i.charCodeAt(p+2))<<16|(255&i.charCodeAt(p+3))<<24,p+=4,c=Math.imul(c,3432918353),c=c<<15|c>>>17,c=Math.imul(c,461845907),h^=c,h=h<<13|h>>>19,h=Math.imul(h,5)+3864292196|0;c=0;const _=3&s;return _>0&&(_>=3&&(c^=(255&i.charCodeAt(p+2))<<16),_>=2&&(c^=(255&i.charCodeAt(p+1))<<8),c^=255&i.charCodeAt(p),c=Math.imul(c,3432918353),c=c<<15|c>>>17,c=Math.imul(c,461845907),h^=c),h^=s,h^=h>>>16,h=Math.imul(h,2246822507),h^=h>>>13,h=Math.imul(h,3266489909),h^=h>>>16,h>>>0}class Co{constructor(e,...t){Object.assign(this,t[0]||{}),this.type=e}}class Tn extends Co{constructor(e,t={}){super("error",{error:e,...t})}}function Mo(i,e,t){t[i]&&t[i].includes(e)||(t[i]=t[i]||[],t[i].push(e))}function Ho(i,e,t){if(t&&t[i]){const n=t[i].indexOf(e);n!==-1&&t[i].splice(n,1)}}class Pn{on(e,t){return this._listeners=this._listeners||{},Mo(e,t,this._listeners),this}off(e,t){return Ho(e,t,this._listeners),Ho(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Mo(e,t,this._oneTimeListeners),this):new Promise(n=>{this.once(e,n)})}fire(e,t){const n=typeof e=="string"?new Co(e,t):e,s=n.type;if(this.listens(s)){n.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const p of l)p.call(this,n);const c=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const p of c)Ho(s,p,this._oneTimeListeners),p.call(this,n);const h=this._eventedParent;if(h){const p=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(n,p),h.fire(n)}}else n instanceof Tn&&console.error(n.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}class Ir{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new Ir(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[t,n]=e.split("�");return new Ir({name:t,iconsetId:n})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return Ir.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Zo,hs={},Rs=function(){if(Zo)return hs;Zo=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 e(l){return(l=Math.round(l))<0?0:l>255?255:l}function t(l){return e(l[l.length-1]==="%"?parseFloat(l)/100*255:parseInt(l))}function n(l){return(c=l[l.length-1]==="%"?parseFloat(l)/100:parseFloat(l))<0?0:c>1?1:c;var c}function s(l,c,h){return h<0?h+=1:h>1&&(h-=1),6*h<1?l+(c-l)*h*6:2*h<1?c:3*h<2?l+(c-l)*(2/3-h)*6:l}try{hs.parseCSSColor=function(l){var c,h=l.replace(/ /g,"").toLowerCase();if(h in i)return i[h].slice();if(h[0]==="#")return h.length===4?(c=parseInt(h.substr(1),16))>=0&&c<=4095?[(3840&c)>>4|(3840&c)>>8,240&c|(240&c)>>4,15&c|(15&c)<<4,1]:null:h.length===7&&(c=parseInt(h.substr(1),16))>=0&&c<=16777215?[(16711680&c)>>16,(65280&c)>>8,255&c,1]:null;
vendor: 6,324 bytes, line 1
1var p=h.indexOf("("),_=h.indexOf(")");if(p!==-1&&_+1===h.length){var y=h.substr(0,p),v=h.substr(p+1,_-(p+1)).split(","),b=1;switch(y){case"rgba":if(v.length!==4)return null;b=n(v.pop());case"rgb":return v.length!==3?null:[t(v[0]),t(v[1]),t(v[2]),b];case"hsla":if(v.length!==4)return null;b=n(v.pop());case"hsl":if(v.length!==3)return null;var T=(parseFloat(v[0])%360+360)%360/360,S=n(v[1]),A=n(v[2]),C=A<=.5?A*(S+1):A+S-A*S,D=2*A-C;return[e(255*s(D,C,T+1/3)),e(255*s(D,C,T)),e(255*s(D,C,T-1/3)),b];default:return null}}return null}}catch{}return hs}();function lt(i,e,t){return i*(1-t)+e*t}const ta=new Map;class Lt{constructor(e,t,n,s=1){this.r=e,this.g=t,this.b=n,this.a=s}static parse(e){if(!e)return;if(e instanceof Lt)return e;if(typeof e!="string")return;const t=ta.get(e);if(t)return t;const n=Rs.parseCSSColor(e);if(!n)return;const s=new Lt(n[0]/255,n[1]/255,n[2]/255,n[3]);return ta.set(e,s),s}toString(){const{r:e,g:t,b:n,a:s}=this;return`rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*n)},${s})`}toNonPremultipliedRenderColor(e){const{r:t,g:n,b:s,a:l}=this;return new Ju(e,t,n,s,l)}toPremultipliedRenderColor(e){const{r:t,g:n,b:s,a:l}=this;return new Qu(e,t*l,n*l,s*l,l)}clone(){return new Lt(this.r,this.g,this.b,this.a)}}class Ps{constructor(e,t,n,s,l,c=!1){if(this.premultiplied=!1,this.premultiplied=c,e){const h=e.image.height,p=h*h;this.premultiplied?(t=l===0?0:t/l*(h-1),n=l===0?0:n/l*(h-1),s=l===0?0:s/l*(h-1)):(t*=h-1,n*=h-1,s*=h-1),t=Math.max(0,Math.min(h-1,t)),n=Math.max(0,Math.min(h-1,n)),s=Math.max(0,Math.min(h-1,s));const _=Math.floor(t),y=Math.floor(n),v=Math.floor(s),b=Math.ceil(t),T=Math.ceil(n),S=Math.ceil(s),A=t-_,C=n-y,D=s-v,F=e.image.data,O=4*(_+y*p+v*h),z=4*(_+y*p+S*h),N=4*(_+T*p+v*h),j=4*(_+T*p+S*h),te=4*(b+y*p+v*h),G=4*(b+y*p+S*h),W=4*(b+T*p+v*h),K=4*(b+T*p+S*h);this.r=lt(lt(lt(F[O],F[z],D),lt(F[N],F[j],D),C),lt(lt(F[te],F[G],D),lt(F[W],F[K],D),C),A)/255*(this.premultiplied?l:1),this.g=lt(lt(lt(F[O+1],F[z+1],D),lt(F[N+1],F[j+1],D),C),lt(lt(F[te+1],F[G+1],D),lt(F[W+1],F[K+1],D),C),A)/255*(this.premultiplied?l:1),this.b=lt(lt(lt(F[O+2],F[z+2],D),lt(F[N+2],F[j+2],D),C),lt(lt(F[te+2],F[G+2],D),lt(F[W+2],F[K+2],D),C),A)/255*(this.premultiplied?l:1),this.a=l}else this.r=t,this.g=n,this.b=s,this.a=l}toArray(){const{r:e,g:t,b:n,a:s}=this;return[255*e,255*t,255*n,s]}toHslaArray(){let{r:e,g:t,b:n,a:s}=this;if(this.premultiplied){if(s===0)return[0,0,0,0];const S=1/s;e*=S,t*=S,n*=S}const l=Math.min(Math.max(e,0),1),c=Math.min(Math.max(t,0),1),h=Math.min(Math.max(n,0),1),p=Math.min(l,c,h),_=Math.max(l,c,h),y=_-p,v=.5*(p+_);if(y===0)return[0,0,100*v,s];const b=v>.5?y/(2-_-p):y/(_+p);let T;switch(_){case l:T=60*((c-h)/y+(c<h?6:0));break;case c:T=60*((h-l)/y+2);break;default:T=60*((l-c)/y+4)}return[T,100*b,100*v,s]}toArray01(){const{r:e,g:t,b:n,a:s}=this;return[e,t,n,s]}toArray01Scaled(e){const{r:t,g:n,b:s}=this;return[t*e,n*e,s*e]}toArray01Linear(){const{r:e,g:t,b:n,a:s}=this;return[Math.pow(e,2.2),Math.pow(t,2.2),Math.pow(n,2.2),s]}}class Ju extends Ps{constructor(e,t,n,s,l){super(e,t,n,s,l,!1)}}class Qu extends Ps{constructor(e,t,n,s,l){super(e,t,n,s,l,!0)}}function En(i,e,t){return i.map((n,s)=>lt(n,e[s],t))}Lt.black=new Lt(0,0,0,1),Lt.white=new Lt(1,1,1,1),Lt.transparent=new Lt(0,0,0,0),Lt.red=new Lt(1,0,0,1),Lt.blue=new Lt(0,0,1,1);var xa=Object.freeze({__proto__:null,array:En,color:function(i,e,t){return new Lt(lt(i.r,e.r,t),lt(i.g,e.g,t),lt(i.b,e.b,t),lt(i.a,e.a,t))},number:lt});class dn extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class al{constructor(e,t=[]){this.parent=e,this.bindings=Object.create(null);for(const[n,s]of t)this.bindings[n]=s}concat(e){return new al(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const va={kind:"null"},st={kind:"number"},ii={kind:"string"},qt={kind:"boolean"},nn={kind:"color"},Ro={kind:"object"},Yt={kind:"value"},uo={kind:"collator"},ds={kind:"formatted"},ba={kind:"resolvedImage"};function Vi(i,e){return{kind:"array",itemType:i,N:e}}function ki(i){if(i.kind==="array"){const e=ki(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Po=[va,st,ii,qt,nn,ds,Ro,Vi(Yt),ba];function Dn(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Dn(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const t of Po)if(!Dn(t,e))return null}}return`Expected ${ki(i)} but found ${ki(e)} instead.`}function tc(i,e){return e.some(t=>t==="null"?i===null:t==="array"?Array.isArray(i):t==="object"?i&&!Array.isArray(i)&&typeof i=="object":t===typeof i)}function ll(i,e){return i.kind==="array"&&e.kind==="array"?i.N===e.N&&ll(i.itemType,e.itemType):i.kind===e.kind}class ic{constructor(e,t,n){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class wa{constructor(e,t,n,s,l){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=n,this.fontStack=s,this.textColor=l}}class Ar{constructor(e){this.sections=e}static fromString(e){return new Ar([new wa(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof Ar?e:Ar.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){const s=t.image.getPrimary().id.toString();e.push(["image",s]);continue}e.push(t.text);const n={};t.fontStack&&(n["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(n["font-scale"]=t.scale),t.textColor&&(n["text-color"]=["rgba"].concat(t.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(n)}return e}}class ho{constructor(e,t={}){this.id=Ir.from(e),this.params=t.params,this.sx=t.sx||1,this.sy=t.sy||
11}toString(){return JSON.stringify(this)}static parse(e){let t,n,s,l;try{({id:t,params:n,sx:s,sy:l}=JSON.parse(e)||{})}catch{return null}return t?new ho(t,{params:n,sx:s,sy:l}):null}scaleSelf(e,t=e){return this.sx*=e,this.sy*=t,this}}class fn{constructor(e,t,n,s,l=!1){this.primaryId=Ir.from(e),this.primaryOptions=t,n&&(this.secondaryId=Ir.from(n)),this.secondaryOptions=s,this.available=l}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new ho(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new ho(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e!="string"?e:fn.build({name:e})}static build(e,t,n,s){return!e||typeof e=="object"&&!("name"in e)?null:new fn(e,n,t,s)}}function eu(i,e,t,n){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[i,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[i,e,t,n]:[i,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ta(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Lt||i instanceof ic||i instanceof Ar||i instanceof fn)return!0;if(Array.isArray(i)){for(const e of i)if(!Ta(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!Ta(i[e]))return!1;return!0}return!1}function Nr(i){if(i===null)return va;if(typeof i=="string")return ii;if(typeof i=="boolean")return qt;if(typeof i=="number")return st;if(i instanceof Lt)return nn;if(i instanceof ic)return uo;if(i instanceof Ar)return ds;if(i instanceof fn)return ba;if(Array.isArray(i)){const e=i.length;let t;for(const n of i){const s=Nr(n);if(t){if(t===s)continue;t=Yt;break}t=s}return Vi(t||Yt,e)}return Ro}function Do(i){return i===null?"":typeof i=="string"||typeof i=="number"||typeof i=="boolean"?String(i):i instanceof Ar||i instanceof fn||i instanceof Lt?i.toString():JSON.stringify(i)}class fs{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ta(e[1]))return t.error("invalid value");const n=e[1];let s=Nr(n);const l=t.expectedType;return s.kind!=="array"||s.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(s=l),new fs(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Lt?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Ar?this.value.serialize():this.value}}class br{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const rc={string:ii,number:st,boolean:qt,object:Ro};class Et{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n,s=1;const l=e[0];if(l==="array"){let h,p;if(e.length>2){const _=e[1];if(typeof _!="string"||!(_ in rc)||_==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);h=rc[_],s++}else h=Yt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);p=e[2],s++}n=Vi(h,p)}else n=rc[l];const c=[];for(;s<e.length;s++){const h=t.parse(e[s],s,Yt);if(!h)return null;c.push(h)}return new Et(n,c)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(!Dn(this.type,Nr(n)))return n;if(t===this.args.length-1)throw new br(`The expression ${JSON.stringify(this.args[t].serialize())} evaluated to ${ki(Nr(n))} but was expected to be of type ${ki(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,t=[e.kind];if(e.kind==="array"){const n=e.itemType;
vendor: 6,520 bytes, line 1
1if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){t.push(n.kind);const s=e.N;(typeof s=="number"||this.args.length>1)&&t.push(s)}}return t.concat(this.args.map(n=>n.serialize()))}}class Zn{constructor(e){this.type=ds,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.error("First argument must be an image or text section.");const s=[];let l=!1;for(let c=1;c<=e.length-1;++c){const h=e[c];if(l&&typeof h=="object"&&!Array.isArray(h)){l=!1;let p=null;if(h["font-scale"]&&(p=t.parseObjectValue(h["font-scale"],c,"font-scale",st),!p))return null;let _=null;if(h["text-font"]&&(_=t.parseObjectValue(h["text-font"],c,"text-font",Vi(ii)),!_))return null;let y=null;if(h["text-color"]&&(y=t.parseObjectValue(h["text-color"],c,"text-color",nn),!y))return null;const v=s.at(-1);v.scale=p,v.font=_,v.textColor=y}else{const p=t.parse(e[c],c,Yt);if(!p)return null;const _=p.type.kind;if(_!=="string"&&_!=="value"&&_!=="null"&&_!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,s.push({content:p,scale:null,font:null,textColor:null})}}return new Zn(s)}evaluate(e){return new Ar(this.sections.map(t=>{const n=t.content.evaluate(e);return ll(Nr(n),ba)?new wa("",n,null,null,null):new wa(Do(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const n={};t.scale&&(n["font-scale"]=t.scale.serialize()),t.font&&(n["text-font"]=t.font.serialize()),t.textColor&&(n["text-color"]=t.textColor.serialize()),e.push(n)}return e}}class Ea{constructor(e,t,n,s){this._imageWarnHistory={},this.type=ba,this.namePrimary=e,this.nameSecondary=t,n&&(this.paramsPrimary=n.params,this.iconsetIdPrimary=n.iconset?n.iconset.id:void 0),s&&(this.paramsSecondary=s.params,this.iconsetIdSecondary=s.iconset?s.iconset.id:void 0)}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let n=1;const s=[];function l(){if(n<e.length){const h=t.parse(e[n],n++,ii);return h?(s.push({image:h,options:{}}),!0):(t.error(s.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function c(){if(n<e.length){const p=e[n];if((h=p)===null||typeof h!="object"||Array.isArray(h))return!0;const _=p.params,y=p.iconset,v=t.concat(n);if(!_&&!y)return n++,!0;if(_){if(typeof _!="object"||_.constructor!==Object)return v.error('Image options "params" should be an object'),!1;const b={},T=v.concat(void 0,"params");for(const S in _){if(!S)return T.error("Image parameter name should be non-empty"),!1;const A=T.concat(void 0,S).parse(_[S],void 0,nn,void 0,{typeAnnotation:"coerce"});if(!A)return!1;b[S]=A}s.at(-1).options.params=b}if(y){if(typeof y!="object"||y.constructor!==Object)return v.error('Image options "iconset" should be an object'),!1;if(!y.id)return v.error('Image options "iconset" should have an "id" property'),!1;s.at(-1).options.iconset=y}return n++,!0}var h;return!0}for(let h=0;h<2;h++)if(!l()||!c())return;return new Ea(s[0].image,s[1]?s[1].image:void 0,s[0].options,s[1]?s[1].options:void 0)}evaluateParams(e,t){const n={};if(t){for(const s in t)if(t[s])try{n[s]=t[s].evaluate(e)}catch{continue}if(Object.keys(n).length!==0)return{params:n}}}evaluate(e){const t={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},n=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,s=fn.build(t,n,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(s&&e.availableImages){const l=s.getPrimary().id;if(s.available=e.availableImages.some(c=>Ir.isEqual(c,l)),s.available){const c=s.getSecondary()?s.getSecondary().id:null;c&&(s.available=e.availableImages.some(h=>Ir.isEqual(h,c)))}}return s}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t])}outputDefined(){return!1}serializeOptions(e,t){const n={};if(t&&(n.iconset={id:t}),e){n.params={};for(const s in e)e[s]&&(n.params[s]=e[s].serialize())}return Object.keys(n).length>0?n:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t)}return e}}function cl(i){return nc(i)?"string":Ia(i)?"number":tu(i)?"boolean":Array.isArray(i)?"array":i===null?"null":Sa(i)?"object":typeof i}function Sa(i){return i!=null&&!Array.isArray(i)&&typeof i!="function"&&!(i instanceof String||i instanceof Number||i instanceof Boolean)&&typeof i=="object"}function nc(i){return typeof i=="string"||i instanceof String}function Ia(i){return typeof i=="number"||i instanceof Number}function tu(i){return typeof i=="boolean"||i instanceof Boolean}const eh={"to-boolean":qt,"to-color":nn,"to-number":st,"to-string":ii};class Ds{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0],s=[];let l=va;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const c=e[1].length;if(t.expectedType){if(t.expectedType.kind!=="array")return t.error(`Expected ${t.expectedType.kind} but found array.`);l=Vi(t.expectedType.itemType,c)}else{if(!(c>0&&Ta(e[1][0])))return null;l=Vi(Nr(e[1][0]),c)}for(let h=0;h<c;h++){const p=e[1][h];let _;if(Array.isArray(p))_=t.parse(p,void 0,l.itemType);else{const y=cl(p);if(y!==l.itemType.kind)return t.error(`Expected ${l.itemType.kind} but found ${y}.`);_=t.registry.literal.parse(["literal",p===void 0?null:p],t)}if(!_)return null;s.push(_)}}else{if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");l=eh[n];for(let c=1;c<e.length;c++){const h=t.parse(e[c],c,Yt);if(!h)return null;s.push(h)}}return new Ds(l,s)}
1evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let t,n;for(const s of this.args){if(t=s.evaluate(e),n=null,t instanceof Lt)return t;if(typeof t=="string"){const l=e.parseColor(t);if(l)return l}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:eu(t[0],t[1],t[2],t[3]),!n))return new Lt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new br(n||`Could not parse color from value '${typeof t=="string"?t:String(JSON.stringify(t))}'`)}if(this.type.kind==="number"){let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new br(`Could not convert ${JSON.stringify(t)} to number.`)}return this.type.kind==="formatted"?Ar.fromString(Do(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?fn.build(Do(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(t=>t.evaluate(e)):Do(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new Zn([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Ea(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(t=>{e.push(t.serialize())}),e}}const th=["Unknown","Point","LineString","Polygon"];class fo{constructor(e,t,n){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t,this.iconImageUseTheme=n}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?th[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(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:n,y:s}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*t-e[0])+this.featureDistanceData.bearing[1]*(s*t-e[1])}return 0}parseColor(e){return Lt.parse(e)}getConfig(e){return this.options?this.options.get(e):null}}class Sn{constructor(e,t,n,s,l){this.name=e,this.type=t,this._evaluate=n,this.args=s,this._overloadIndex=l}evaluate(e){if(!this._evaluate){const t=Sn.definitions[this.name];this._evaluate=Array.isArray(t)?t[2]:t.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,t){const n=e[0],s=Sn.definitions[n];if(!s)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(s)?s[0]:s.type,c=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,h=[];let p=null,_=-1;for(const[y,v]of c){if(Array.isArray(y)&&y.length!==e.length-1)continue;h.push(y),_++,p===null?p=t._forkForSignature():p.errors.length=0;const b=[];let T=!1;for(let S=1;S<e.length;S++){const A=e[S],C=Array.isArray(y)?y[S-1]:y.type,D=p.parse(A,1+b.length,C);if(!D){T=!0;break}b.push(D)}if(!T)if(Array.isArray(y)&&y.length!==b.length)p.error(`Expected ${y.length} arguments, but found ${b.length} instead.`);else{for(let S=0;S<b.length;S++){const A=Array.isArray(y)?y[S]:y.type;p.checkSubtype(A,b[S].type,S+1)}if(p.errors.length===0)return new Sn(n,l,v,b,_)}}if(h.length===1)t.errors.push(...p.errors);else{const y=(h.length?h:c.map(([b])=>b)).map(ih).join(" | "),v=[];for(let b=1;b<e.length;b++){const T=t.parse(e[b],1+v.length);if(!T)return null;v.push(ki(T.type))}t.error(`Expected arguments of type ${y}, but found (${v.join(", ")}) instead.`)}return null}static register(e,t){Sn.definitions=t;for(const n in t)e[n]=Sn}}function ih(i){return Array.isArray(i)?`(${i.map(ki).join(", ")})`:`(${ki(i.type)}...)`}class Aa{constructor(e,t,n){this.type=uo,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument."),null;const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object."),null;const s=n["case-sensitive"]===void 0?t.parse(!1,1,qt):t.parseObjectValue(n["case-sensitive"],1,"case-sensitive",qt);if(!s)return null;const l=n["diacritic-sensitive"]===void 0?t.parse(!1,1,qt):t.parseObjectValue(n["diacritic-sensitive"],1,"diacritic-sensitive",qt);if(!l)return null;
vendor: 5,537 bytes, line 1
1let c=null;return n.locale&&(c=t.parseObjectValue(n.locale,1,"locale",ii),!c)?null:new Aa(s,l,c)}evaluate(e){return new ic(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function po(i){return(180+i)/360}function $n(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function qn(i){return 360*i-180}function wr(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}const ia=8192;function h_(i,e){const t=po(i[0]),n=$n(i[1]),s=Math.pow(2,e.z);return[Math.round(t*s*ia),Math.round(n*s*ia)]}function Uf(i,e){for(let t=0;t<e.length;t++)if(Un(i,e[t]))return!0;return!1}function jf(i,e,t){for(const n of t)for(let s=0,l=n.length,c=l-1;s<l;c=s++)if(ea(i,e,n[c],n[s]))return!0;return!1}function Gf(i,e){for(let t=0;t<i.length;++t)if(!Un(i[t],e))return!1;for(let t=0;t<i.length-1;++t)if(jf(i[t],i[t+1],e))return!1;return!0}function d_(i,e){for(let t=0;t<e.length;t++)if(Gf(i,e[t]))return!0;return!1}function rd(i,e,t){const n=[];for(let s=0;s<i.length;s++){const l=[];for(let c=0;c<i[s].length;c++){const h=h_(i[s][c],t);zr(e,h),l.push(h)}n.push(l)}return n}function nd(i,e,t){const n=[];for(let s=0;s<i.length;s++){const l=rd(i[s],e,t);n.push(l)}return n}function Hf(i,e,t,n){if(i[0]<t[0]||i[0]>t[2]){const s=.5*n;let l=i[0]-t[0]>s?-n:t[0]-i[0]>s?n:0;l===0&&(l=i[0]-t[2]>s?-n:t[2]-i[0]>s?n:0),i[0]+=l}zr(e,i)}function oc(i,e,t,n){const s=Math.pow(2,n.z)*ia,l=[n.x*ia,n.y*ia],c=[];if(!i)return c;for(const h of i)for(const p of h){const _=[p.x+l[0],p.y+l[1]];Hf(_,e,t,s),c.push(_)}return c}function od(i,e,t,n){const s=Math.pow(2,n.z)*ia,l=[n.x*ia,n.y*ia],c=[];if(!i)return c;for(const p of i){const _=[];for(const y of p){const v=[y.x+l[0],y.y+l[1]];zr(e,v),_.push(v)}c.push(_)}if(e[2]-e[0]<=s/2){(h=e)[0]=h[1]=1/0,h[2]=h[3]=-1/0;for(const p of c)for(const _ of p)Hf(_,e,t,s)}var h;return c}class ul{constructor(e,t){this.type=qt,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ta(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let s=0;s<n.features.length;++s){const l=n.features[s].geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new ul(n,n.features[s].geometry)}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new ul(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new ul(n,n)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(t,n){const s=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],c=t.canonicalID();if(!c)return!1;if(n.type==="Polygon"){const h=rd(n.coordinates,l,c),p=oc(t.geometry(),s,l,c);if(!el(s,l))return!1;for(const _ of p)if(!Un(_,h))return!1}if(n.type==="MultiPolygon"){const h=nd(n.coordinates,l,c),p=oc(t.geometry(),s,l,c);if(!el(s,l))return!1;for(const _ of p)if(!Uf(_,h))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(t,n){const s=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],c=t.canonicalID();if(!c)return!1;if(n.type==="Polygon"){const h=rd(n.coordinates,l,c),p=od(t.geometry(),s,l,c);if(!el(s,l))return!1;for(const _ of p)if(!Gf(_,h))return!1}if(n.type==="MultiPolygon"){const h=nd(n.coordinates,l,c),p=od(t.geometry(),s,l,c);if(!el(s,l))return!1;for(const _ of p)if(!d_(_,h))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}class iu{constructor(e=[],t=(n,s)=>n<s?-1:n>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,s=t[e];for(;e>0;){const l=e-1>>1,c=t[l];if(n(s,c)>=0)break;t[e]=c,e=l}t[e]=s}_down(e){const{data:t,compare:n}=this,s=this.length>>1,l=t[e];for(;e<s;){let c=1+(e<<1);const h=c+1;if(h<this.length&&n(t[h],t[c])<0&&(c=h),n(t[c],l)>=0)break;t[e]=t[c],e=c}t[e]=l}}var We=8192;const sc=1/298.257223563,ru=sc*(2-sc),Zf=Math.PI/180;function sd(i){const e=6378.137*Zf*1e3,t=Math.cos(i*Zf),n=1/(1-ru*(1-t*t)),s=Math.sqrt(n);return[e*s*t,e*s*n*(1-ru)]}function hl(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}function ac(i,e,t,n){const s=hl(i[0]-e[0])*t,l=(i[1]-e[1])*n;return Math.sqrt(s*s+l*l)}function dl(i,e,t,n,s){let l=e[0],c=e[1],h=hl(t[0]-l)*n,p=(t[1]-c)*s;if(h!==0||p!==0){const _=(hl(i[0]-l)*n*h+(i[1]-c)*s*p)/(h*h+p*p);_>1?(l=t[0],c=t[1]):_>0&&(l+=h/n*_,c+=p/s*_)}return h=hl(i[0]-l)*n,p=(i[1]-c)*s,Math.sqrt(h*h+p*p)}function nu(i,e){return e.dist-i.dist}function ou(i){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==i.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==i[t])return!1;return!0}function rh(i){return i[1]-i[0]+1}function $o(i,e){const t=i[1]>=i[0]&&i[1]<e;return t||console.warn("Distance Expression: Index is out of range"),t}function ad(i,e){if(i[0]>
vendor: 4,241 bytes, line 1
1i[1])return[null,null];const t=rh(i);if(e){if(t===2)return[i,null];const n=Math.floor(t/2);return[[i[0],i[0]+n],[i[0]+n,i[1]]]}{if(t===1)return[i,null];const n=Math.floor(t/2)-1;return[[i[0],i[0]+n],[i[0]+n+1,i[1]]]}}function fl(i,e){const t=[1/0,1/0,-1/0,-1/0];if(!$o(e,i.length))return t;for(let n=e[0];n<=e[1];++n)zr(t,i[n]);return t}function nh(i){const e=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;++t)for(let n=0;n<i[t].length;++n)zr(e,i[t][n]);return e}function lc(i,e,t,n){if(ou(i)||ou(e))return NaN;let s=0,l=0;return i[2]<e[0]&&(s=e[0]-i[2]),i[0]>e[2]&&(s=i[0]-e[2]),i[1]>e[3]&&(l=i[1]-e[3]),i[3]<e[1]&&(l=e[1]-i[3]),ac([0,0],[s,l],t,n)}function oh(i,e,t=8192){const n=Math.pow(2,e.z),s=(i.y/t+e.y)/n;return[qn((i.x/t+e.x)/n),wr(s)]}function f_(i,e){const t=[];for(let n=0;n<i.length;++n)t.push(oh(i[n],e));return t}function $f(i,e,t,n){const s=function(l,c,h,p){let _=1/0,y=l[0][0],v=l[0][1];for(let b=0;b<l.length-1;b++){let T=l[b][0],S=l[b][1],A=hl(l[b+1][0]-T)*h,C=(l[b+1][1]-S)*p,D=0;A===0&&C===0||(D=(hl(c[0]-T)*h*A+(c[1]-S)*p*C)/(A*A+C*C),D>1?(T=l[b+1][0],S=l[b+1][1]):D>0&&(T+=A/h*D,S+=C/p*D)),A=hl(c[0]-T)*h,C=(c[1]-S)*p;const F=A*A+C*C;F<_&&(_=F,y=T,v=S)}return[y,v]}(e,i,t,n);return ac(i,s,t,n)}function ld(i,e,t,n,s,l){const c=t.slice(n[0],n[1]+1);let h=1/0;for(let p=e[0];p<=e[1];++p)if((h=Math.min(h,$f(i[p],c,s,l)))===0)return 0;return h}function Ca(i,e,t,n,s,l){const c=Math.min(dl(i,t,n,s,l),dl(e,t,n,s,l)),h=Math.min(dl(t,i,e,s,l),dl(n,i,e,s,l));return Math.min(c,h)}function p_(i,e,t,n,s,l){if(!$o(e,i.length)||!$o(n,t.length))return NaN;let c=1/0;for(let h=e[0];h<e[1];++h)for(let p=n[0];p<n[1];++p){if(ea(i[h],i[h+1],t[p],t[p+1]))return 0;c=Math.min(c,Ca(i[h],i[h+1],t[p],t[p+1],s,l))}return c}function Ls(i,e,t,n,s,l){if(!$o(e,i.length)||!$o(n,t.length))return NaN;let c=1/0;for(let h=e[0];h<=e[1];++h)for(let p=n[0];p<=n[1];++p)if((c=Math.min(c,ac(i[h],t[p],s,l)))===0)return c;return c}function qf(i,e,t,n){if(Un(i,e,!0))return 0;let s=1/0;for(const l of e){const c=l.length;if(c<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(l[0]!==l[c-1]&&(s=Math.min(s,dl(i,l[c-1],l[0],t,n)))===0||(s=Math.min(s,$f(i,l,t,n)))===0)return s}return s}function m_(i,e,t,n,s){if(!$o(e,i.length))return NaN;for(let c=e[0];c<=e[1];++c)if(Un(i[c],t,!0))return 0;let l=1/0;for(let c=e[0];c<e[1];++c)for(const h of t)for(let p=0,_=h.length,y=_-1;p<_;y=p++){if(ea(i[c],i[c+1],h[y],h[p]))return 0;l=Math.min(l,Ca(i[c],i[c+1],h[y],h[p],n,s))}return l}function Wf(i,e){for(const t of i)for(let n=0;n<=t.length-1;++n)if(Un(t[n],e,!0))return!0;return!1}function Xf(i,e,t,n,s=1/0){const l=nh(i),c=nh(e);if(s!==1/0&&lc(l,c,t,n)>=s)return s;if(el(l,c)){if(Wf(i,e))return 0}else if(Wf(e,i))return 0;let h=s;for(const p of i)for(let _=0,y=p.length,v=y-1;_<y;v=_++)for(const b of e)for(let T=0,S=b.length,A=S-1;T<S;A=T++){if(ea(p[v],p[_],b[A],b[T]))return 0;h=Math.min(h,Ca(p[v],p[_],b[A],b[T],t,n))}return h}function cc(i,e,t,n,s,l,c,h){if(c===null||h===null)return;const p=lc(fl(s,c),fl(l,h),t,n);p<e&&i.push({dist:p,range1:c,range2:h})}function __(i,e,t,n,s,l=1/0){let c=Math.min(ac(i[0],t[0][0],n,s),l);if(c===0)return c;const h=new iu([{dist:0,range1:[0,i.length-1],range2:[0,0]}],nu),p=e?50:100,_=nh(t);for(;h.length;){const y=h.pop();if(y.dist>=c)continue;const v=y.range1;if(rh(v)<=p){if(!$o(v,i.length))return NaN;if(e){const b=m_(i,v,t,n,s);if((c=Math.min(c,b))===0)return c}else for(let b=v[0];b<=v[1];++b){const T=qf(i[b],t,n,s);if((c=Math.min(c,T))===0)return c}}else{const b=ad(v,e);if(b[0]!==null){const T=lc(fl(i,b[0]),_,n,s);T<c&&h.push({dist:T,range1:b[0],range2:[0,0]})}if(b[1]!==null){const T=lc(fl(i,b[1]),_,n,s);T<c&&h.push({dist:T,range1:b[1],range2:[0,0]})}}}return c}function Yf(i,e,t,n,s,l,c=1/0){let h=Math.min(c,ac(i[0],t[0],s,l));if(h===0)return h;const p=new iu([{dist:0,range1:[0,i.length-1],range2:[0,t.length-1]}],nu),_=e?50:100,y=n?50:100;for(;p.length;){const v=p.pop();if(v.dist>=h)continue;const b=v.range1,T=v.range2;if(rh(b)<=_&&rh(T)<=y){if(!$o(b,i.length)||!$o(T,t.length))return NaN;if(e&&n?h=Math.min(h,p_(i,b,t,T,s,l)):e||n?e&&!n?h=Math.min(h,ld(t,T,i,b,s,l)):!e&&n&&(h=Math.min(h,ld(i,b,t,T,s,l))):h=Math.min(h,Ls(i,b,t,T,s,l)),h===0)return h}else{const S=ad(b,e),A=ad(T,n);
1cc(p,h,s,l,i,t,S[0],A[0]),cc(p,h,s,l,i,t,S[0],A[1]),cc(p,h,s,l,i,t,S[1],A[0]),cc(p,h,s,l,i,t,S[1],A[1])}}return h}function cd(i,e,t,n,s,l=1/0){let c=l;const h=fl(i,[0,i.length-1]);for(const p of t)if(!(c!==1/0&&lc(h,fl(p,[0,p.length-1]),n,s)>=c)&&(c=Math.min(c,Yf(i,e,p,!0,n,s,c)),c===0))return c;return c}function sh(i,e,t,n,s,l=1/0){let c=l;const h=fl(i,[0,i.length-1]);for(const p of t){if(c!==1/0&&lc(h,nh(p),n,s)>=c)continue;const _=__(i,e,p,n,s,c);if(isNaN(_))return _;if((c=Math.min(c,_))===0)return c}return c}function ud(i){return i==="Point"||i==="MultiPoint"||i==="LineString"||i==="MultiLineString"||i==="Polygon"||i==="MultiPolygon"}class pl{constructor(e,t){this.type=st,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Ta(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let s=0;s<n.features.length;++s)if(ud(n.features[s].geometry.type))return new pl(n,n.features[s].geometry)}else if(n.type==="Feature"){if(ud(n.geometry.type))return new pl(n,n.geometry)}else if(ud(n.type))return new pl(n,n)}return t.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const t=e.geometry(),n=e.canonicalID();if(t!=null&&n!=null){if(e.geometryType()==="Point")return function(s,l,c){const h=[];for(const y of s)for(const v of y)h.push(oh(v,l));const[p,_]=sd(h[0][1]);return c.type==="Point"||c.type==="MultiPoint"||c.type==="LineString"?Yf(h,!1,c.type==="Point"?[c.coordinates]:c.coordinates,c.type==="LineString",p,_):c.type==="MultiLineString"?cd(h,!1,c.coordinates,p,_):c.type==="Polygon"||c.type==="MultiPolygon"?sh(h,!1,c.type==="Polygon"?[c.coordinates]:c.coordinates,p,_):null}(t,n,this.geometries);if(e.geometryType()==="LineString")return function(s,l,c){const h=[];for(const y of s){const v=[];for(const b of y)v.push(oh(b,l));h.push(v)}const[p,_]=sd(h[0][0][1]);if(c.type==="Point"||c.type==="MultiPoint"||c.type==="LineString")return cd(c.type==="Point"?[c.coordinates]:c.coordinates,c.type==="LineString",h,p,_);if(c.type==="MultiLineString"){let y=1/0;for(let v=0;v<c.coordinates.length;v++){const b=cd(c.coordinates[v],!0,h,p,_,y);if(isNaN(b))return b;if((y=Math.min(y,b))===0)return y}return y}if(c.type==="Polygon"||c.type==="MultiPolygon"){let y=1/0;for(let v=0;v<h.length;v++){const b=sh(h[v],!0,c.type==="Polygon"?[c.coordinates]:c.coordinates,p,_,y);if(isNaN(b))return b;if((y=Math.min(y,b))===0)return y}return y}return null}(t,n,this.geometries);if(e.geometryType()==="Polygon")return function(s,l,c){const h=[];for(const y of Si(s,0)){const v=[];for(let b=0;b<y.length;++b)v.push(f_(y[b],l));h.push(v)}const[p,_]=sd(h[0][0][0][1]);if(c.type==="Point"||c.type==="MultiPoint"||c.type==="LineString")return sh(c.type==="Point"?[c.coordinates]:c.coordinates,c.type==="LineString",h,p,_);if(c.type==="MultiLineString"){let y=1/0;for(let v=0;v<c.coordinates.length;v++){const b=sh(c.coordinates[v],!0,h,p,_,y);if(isNaN(b))return b;if((y=Math.min(y,b))===0)return y}return y}return c.type==="Polygon"||c.type==="MultiPolygon"?function(y,v,b,T){let S=1/0;for(const A of y)for(const C of v){const D=Xf(A,C,b,T,S);if(isNaN(D))return D;if((S=Math.min(S,D))===0)return S}return S}(c.type==="Polygon"?[c.coordinates]:c.coordinates,h,p,_):null}(t,n,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 ml(i){if(i instanceof Sn&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||i.name.startsWith("filter-"))||i instanceof ul||i instanceof pl)return!1;if(i instanceof uc)return i.featureConstant;let e=!0;return i.eachChild(t=>{e&&!ml(t)&&(e=!1)}),e}function Ma(i){if(i instanceof Sn&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(t=>{e&&!Ma(t)&&(e=!1)}),e}function hd(i,e){if(i instanceof Sn&&e.has(i.name))return!1;let t=!0;return i.eachChild(n=>{t&&!hd(n,e)&&(t=!1)}),t}function zs(i,e){return hd(i,new Set(e))}
1function Kf(i,e,t){return[i,e,t].filter(Boolean).join("�")}function dd(i,e){switch(i){case"string":return Do(e);case"number":return+e;case"boolean":return!!e;case"color":return Lt.parse(e);case"formatted":return Ar.fromString(Do(e));case"resolvedImage":return fn.build(Do(e))}return e}function fd(i,e,t,n){return n!==void 0&&(i=n*Math.round(i/n)),e!==void 0&&i<e&&(i=e),t!==void 0&&i>t&&(i=t),i}class uc{constructor(e,t,n,s=!1){this.type=e,this.key=t,this.scope=n,this.featureConstant=s}static parse(e,t){let n=t.expectedType;if(n??(n=Yt),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const s=t.parse(e[1],1);if(!(s instanceof fs))return t.error("Key name of 'config' expression must be a string literal.");let l,c=!0;const h=Do(s.value);if(e.length>=3){const p=t.parse(e[2],2);if(!(p instanceof fs))return t.error("Scope of 'config' expression must be a string literal.");l=Do(p.value)}if(t.options){const p=Kf(h,l,t._scope),_=t.options.get(p);_&&(c=ml(_.value||_.default))}return new uc(n,h,l,c)}evaluate(e){const t=Kf(this.key,this.scope,e.scope),n=e.getConfig(t);if(!n)return null;const{type:s,value:l,values:c,minValue:h,maxValue:p,stepValue:_}=n,y=n.default.evaluate(e);let v=y;if(l){const b=e.scope;e.scope=(b||"").split("�").slice(1).join("�"),v=l.evaluate(e),e.scope=b}return s&&(v=dd(s,v)),v===void 0||h===void 0&&p===void 0&&_===void 0||(typeof v=="number"?v=fd(v,h,p,_):Array.isArray(v)&&(v=v.map(b=>typeof b=="number"?fd(b,h,p,_):b))),l!==void 0&&v!==void 0&&c&&!c.includes(v)&&(v=y,s&&(v=dd(s,v))),(s&&s!==this.type||v!==void 0&&!ll(Nr(v),this.type))&&(v=dd(this.type.kind,v)),v}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Fs{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new Fs(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class _l{constructor(e,t=[],n,s=new al,l=[],c,h,p){this.registry=e,this.path=t,this.scope=s,this.errors=l,this.expectedType=n,this._scope=c,this.options=h,this.iconImageUseTheme=p}get key(){let e="";for(let t=0;t<this.path.length;t++){const n=this.path[t];e+=typeof n=="string"?`['${n}']`:`[${n}]`}return e}parse(e,t,n,s,l={}){if(t||n){const c=this.expectedType,h=this.scope;s&&(this.scope=this.scope.concat(s)),this.expectedType=n||null;const p=typeof t=="number";p&&this.path.push(t);const _=this._parse(e,l);return p&&this.path.pop(),this.expectedType=c,this.scope=h,_}return this._parse(e,l)}parseObjectValue(e,t,n,s,l,c={}){const h=this.expectedType,p=this.scope;l&&(this.scope=this.scope.concat(l)),this.expectedType=s||null,this.path.push(t),this.path.push(n);const _=this._parse(e,c);return this.path.pop(),this.path.pop(),this.expectedType=h,this.scope=p,_}_parse(e,t){if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=typeof e[0]=="string"&&Object.hasOwn(this.registry,e[0])?this.registry[e[0]]:void 0;if(n){let s=n.parse(e,this);if(!s)return null;if(this.expectedType){const l=this.expectedType,c=s.type;if(l.kind!=="string"&&l.kind!=="number"&&l.kind!=="boolean"&&l.kind!=="object"&&l.kind!=="array"||c.kind!=="value")if(l.kind!=="color"&&l.kind!=="formatted"&&l.kind!=="resolvedImage"||c.kind!=="value"&&c.kind!=="string"){if(this.checkSubtype(l,c))return null}else s=Jf(s,l,t.typeAnnotation||"coerce");else s=Jf(s,l,t.typeAnnotation||"assert")}if(!(s instanceof fs)&&s.type.kind!=="resolvedImage"&&su(s)){const l=new fo(this._scope,this.options,this.iconImageUseTheme);try{s=new fs(s.type,s.evaluate(l))}catch(c){return this.error(c.message),null}}return s}return Ds.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n,s){const l=s?this.scope.concat(s):this.scope,c=this.path.slice();return typeof e=="number"&&c.push(e),typeof t=="string"&&c.push(t),new _l(this.registry,c,n||null,l,this.errors,this._scope,this.options,this.iconImageUseTheme)}_forkForSignature(){return new _l(this.registry,this.path.slice(),null,this.scope,[],this._scope,this.options,this.iconImageUseTheme)}error(e,...t){const n=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new dn(n,e))}checkSubtype(e,t,n){const s=Dn(e,t);return s&&this.error(s,...typeof n=="number"?[n]:[]),s}}const g_=new Set(["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"]);function Jf(i,e,t){return t==="assert"?new Et(e,[i]):t==="coerce"?new Ds(e,[i]):i}function su(i){if(i instanceof Fs)return su(i.boundExpression);if(i instanceof Sn&&i.name==="error"||i instanceof Aa||i instanceof ul||i instanceof pl||i instanceof uc)return!1;const e=i instanceof Ds||i instanceof Et;let t=!0;return i.eachChild(n=>{t=e?t&&su(n):t&&n instanceof fs}),!!t&&ml(i)&&hd(i,g_)}function au(i,e){const t=i.length-1;let n,s,l=0,c=t,h=0;for(;l<=c;)if(h=Math.floor((l+c)/2),n=i[h],s=i[h+1],n<=e){if(h===t||e<s)return h;l=h+1}else{if(!(n>e))throw new br("Input is not a number.");c=h-1}return 0}class gl{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,l]of n)this.labels.push(s),this.outputs.push(l)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,st);if(!n)return null;const s=[];let l=null;t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let c=1;c<e.length;c+=2){const h=c===1?-1/0:e[c],p=e[c+1],_=c,y=c+1;if(typeof h!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',_);if(s.length&&s.at(-1)[0]>=h)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',_);const v=t.parse(p,y,l);if(!v)return null;l=l||v.type,s.push([h,v])}return new gl(l,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const l=t.length;return s>=t[l-1]?n[l-1].evaluate(e):n[au(t,s)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const Ra=.95047,Qf=1.08883,ep=4/29,hc=6/29,pd=3*hc*hc,y_=hc*hc*hc,$i=Math.PI/180,x_=180/Math.PI;function md(i){return i>y_?Math.pow(i,1/3):i/pd+ep}function _d(i){return i>hc?i*i*i:pd*(i-ep)}function gd(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function yd(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function tp(i){const e=yd(i.r),t=yd(i.g),n=yd(i.b),s=md((.4124564*e+.3575761*t+.1804375*n)/Ra),l=md((.2126729*e+.7151522*t+.072175*n)/1);return{l:116*l-16,a:500*(s-l),b:200*(l-md((.0193339*e+.119192*t+.9503041*n)/Qf)),alpha:i.a}}function ip(i){let e=(i.l+16)/116,t=isNaN(i.a)?e:e+i.a/500,n=isNaN(i.b)?e:e-i.b/200;return e=1*_d(e),t=Ra*_d(t),n=Qf*_d(n),new Lt(gd(3.2404542*t-1.5371385*e-.4985314*n),gd(-.969266*t+1.8760108*e+.041556*n),gd(.0556434*t-.2040259*e+1.0572252*n),i.alpha)}function v_(i,e,t){const n=e-i;return i+t*(n>180||n<-180?n-360*Math.round(n/360):n)}const lu={forward:tp,reverse:ip,interpolate:function(i,e,t){return{l:lt(i.l,e.l,t),a:lt(i.a,e.a,t),b:lt(i.b,e.b,t),alpha:lt(i.alpha,e.alpha,t)}}},cu={forward:function(i){const{l:e,a:t,b:n}=tp(i),s=Math.atan2(n,t)*x_;return{h:s<0?s+360:s,c:Math.sqrt(t*t+n*n),l:e,alpha:i.a}},reverse:function(i){const e=i.h*$i,t=i.c;return ip({l:i.l,a:Math.cos(e)*t,b:Math.sin(e)*t,alpha:i.alpha})},interpolate:function(i,e,t){return{h:v_(i.h,e.h,t),c:lt(i.c,e.c,t),l:lt(i.l,e.l,t),alpha:lt(i.alpha,e.alpha,t)}}};var rp=Object.freeze({__proto__:null,hcl:cu,lab:lu});class Lo{constructor(e,t,n,s,l){this.type=e,this.operator=t,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[c,h]of l)this.labels.push(c),this.outputs.push(h)}static interpolationFactor(e,t,n,s){let l=0;if(e.name==="exponential")l=xd(t,e.base,n,s);else if(e.name==="linear")l=xd(t,1,n,s);else if(e.name==="cubic-bezier"){const c=e.controlPoints;l=$c(c[0],c[1],c[2],c[3])(xd(t,1,n,s))}return l}static parse(e,t){let[n,s,l,...c]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const _=s[1];if(typeof _!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:_}}else{if(s[0]!=="cubic-bezier")return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);{const _=s.slice(1);if(_.length!==4||_.some(y=>typeof y!="number"||y<0||y>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:_}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(l=t.parse(l,2,st),!l)return null;const h=[];let p=null;n==="interpolate-hcl"||n==="interpolate-lab"?p=nn:t.expectedType&&t.expectedType.kind!=="value"&&(p=t.expectedType);for(let _=0;_<c.length;_+=2){const y=c[_],v=c[_+1],b=_+3,T=_+4;if(typeof y!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(h.length&&h.at(-1)[0]>=y)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',b);const S=t.parse(v,T,p);if(!S)return null;p=p||S.type,h.push([y,S])}return p.kind==="number"||p.kind==="color"||p.kind==="array"&&p.itemType.kind==="number"&&typeof p.N=="number"?new Lo(p,n,s,l,h):t.error(`Type ${ki(p)} is not interpolatable.`)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const l=t.length;if(s>=t[l-1])return n[l-1].evaluate(e);const c=au(t,s),h=Lo.interpolationFactor(this.interpolation,s,t[c],t[c+1]),p=n[c].evaluate(e),_=n[c+1].evaluate(e);return this.operator==="interpolate"?xa[this.type.kind.toLowerCase()](p,_,h):this.operator==="interpolate-hcl"?cu.reverse(cu.interpolate(cu.forward(p),cu.forward(_),h)):lu.reverse(lu.interpolate(lu.forward(p),lu.forward(_),h))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)t.push(this.labels[n],this.outputs[n].serialize());return t}}function xd(i,e,t,n){const s=n-t,l=i-t;return s===0?0:e===1?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1)}class ah{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument."),null;let n=null;const s=t.expectedType;s&&s.kind!=="value"&&(n=s);const l=[];for(const h of e.slice(1)){const p=t.parse(h,1+l.length,n,void 0,{typeAnnotation:"omit"});if(!p)return null;n=n||p.type,l.push(p)}const c=s&&l.some(h=>Dn(s,h.type));return new ah(c?Yt:n,l)}
vendor: 4,348 bytes, line 1
1evaluate(e){let t,n=null,s=0;for(const l of this.args){if(s++,n=l.evaluate(e),n&&n instanceof fn&&!n.available&&(t||(t=n),n=null,s===this.args.length))return t;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(t=>{e.push(t.serialize())}),e}}const b_=/[^a-zA-Z0-9_]/;class lh{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let l=1;l<e.length-1;l+=2){const c=e[l];if(typeof c!="string")return t.error(`Expected string, but found ${typeof c} instead.`,l);if(b_.test(c))return t.error("Variable names must contain only alphanumeric characters or '_'.",l);const h=t.parse(e[l+1],l+1);if(!h)return null;n.push([c,h])}const s=t.parse(e.at(-1),e.length-1,t.expectedType,n);return s?new lh(n,s):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[t,n]of this.bindings)e.push(t,n.serialize());return e.push(this.result.serialize()),e}}class vd{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,st),s=t.parse(e[2],2,Vi(t.expectedType||Yt));return n&&s?new vd(s.type.itemType,n,s):null}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new br("Array index out of bounds: negative index");if(t>=n.length)throw new br("Array index out of bounds: index exceeds array size");if(t!==Math.floor(t))throw new br("Array index must be an integer. Use at-interpolated for fractional indices");return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class bd{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,st),s=t.parse(e[2],2,Vi(t.expectedType||Yt));return n&&s?new bd(s.type.itemType,n,s):null}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new br(`Array index out of bounds: ${t} < 0.`);if(t>n.length-1)throw new br(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t===Math.floor(t))return n[t];const s=Math.floor(t),l=Math.ceil(t),c=n[s],h=n[l];if(typeof c!="number"||typeof h!="number")throw new br(`Cannot interpolate between non-number values at index ${t}.`);return lt(c,h,t-s)}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class wd{constructor(e,t,n,s,l,c){this.inputType=e,this.type=t,this.input=n,this.cases=s,this.outputs=l,this.otherwise=c}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let n,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const l={},c=[];for(let _=2;_<e.length-1;_+=2){let y=e[_];const v=e[_+1];if(Array.isArray(y)||(y=[y]),y.length===0)return t.error("Expected at least one branch label.",_);for(const T of y){if(typeof T!="number"&&typeof T!="string")return t.error("Branch labels must be numbers or strings.",_);if(typeof T=="number"&&Math.abs(T)>Number.MAX_SAFE_INTEGER)return t.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`,_);if(typeof T=="number"&&Math.floor(T)!==T)return t.error("Numeric branch labels must be integer values.",_);if(n){if(t.checkSubtype(n,Nr(T),_))return null}else n=Nr(T);if(l[String(T)]!==void 0)return t.error("Branch labels must be unique.",_);l[String(T)]=c.length}const b=t.parse(v,_,s);if(!b)return null;s=s||b.type,c.push(b)}const h=t.parse(e[1],1,Yt);if(!h)return null;const p=t.parse(e.at(-1),e.length-1,s);return p?h.type.kind!=="value"&&t.checkSubtype(n,h.type,1)?null:new wd(n,s,h,l,c,p):null}evaluate(e){const t=this.input.evaluate(e);return(ll(Nr(t),this.inputType)&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}
1eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),n=[],s={};for(const c of t){const h=s[this.cases[c]];h===void 0?(s[this.cases[c]]=n.length,n.push([this.cases[c],[c]])):n[h][1].push(c)}const l=c=>this.inputType.kind==="number"?Number(c):c;for(const[c,h]of n)e.push(h.length===1?l(h[0]):h.map(l)),e.push(this.outputs[c].serialize());return e.push(this.otherwise.serialize()),e}}class Td{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`),null;if(e.length%2!=0)return t.error("Expected an odd number of arguments."),null;let n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const s=[];for(let c=1;c<e.length-1;c+=2){const h=t.parse(e[c],c,qt);if(!h)return null;const p=t.parse(e[c+1],c+1,n);if(!p)return null;s.push([h,p]),n=n||p.type}const l=t.parse(e.at(-1),e.length-1,n);return l?new Td(n,s,l):null}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class ch{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const n=t.parse(e[1],1,Yt),s=t.parse(e[2],2,st);if(!n||!s)return null;if(l=n.type,![Vi(Yt),ii,Yt].some(c=>c.kind===l.kind))return t.error(`Expected first argument to be of type array or string, but found ${ki(n.type)} instead`),null;var l;if(e.length===4){const c=t.parse(e[3],3,st);return c?new ch(n.type,n,s,c):null}return new ch(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!tc(t,["string","array"]))throw new br(`Expected first argument to be of type array or string, but found ${ki(Nr(t))} instead.`);if(this.endIndex){const s=this.endIndex.evaluate(e);return t.slice(n,s)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function np(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function op(i,e,t,n){return n.compare(e,t)===0}function dc(i,e,t){const n=i!=="=="&&i!=="!=";return class Mb{constructor(l,c,h){this.type=qt,this.lhs=l,this.rhs=c,this.collator=h,this.hasUntypedArgument=l.type.kind==="value"||c.type.kind==="value"}static parse(l,c){if(l.length!==3&&l.length!==4)return c.error("Expected two or three arguments.");const h=l[0];let p=c.parse(l[1],1,Yt);if(!p)return null;if(!np(h,p.type))return c.error(`"${h}" comparisons are not supported for type '${ki(p.type)}'.`,1);let _=c.parse(l[2],2,Yt);if(!_)return null;if(!np(h,_.type))return c.error(`"${h}" comparisons are not supported for type '${ki(_.type)}'.`,2);if(p.type.kind!==_.type.kind&&p.type.kind!=="value"&&_.type.kind!=="value")return c.error(`Cannot compare types '${ki(p.type)}' and '${ki(_.type)}'.`);n&&(p.type.kind==="value"&&_.type.kind!=="value"?p=new Et(_.type,[p]):p.type.kind!=="value"&&_.type.kind==="value"&&(_=new Et(p.type,[_])));let y=null;if(l.length===4){if(p.type.kind!=="string"&&_.type.kind!=="string"&&p.type.kind!=="value"&&_.type.kind!=="value")return c.error("Cannot use collator to compare non-string types.");if(y=c.parse(l[3],3,uo),!y)return null}return new Mb(p,_,y)}evaluate(l){const c=this.lhs.evaluate(l),h=this.rhs.evaluate(l);if(n&&this.hasUntypedArgument){const p=Nr(c),_=Nr(h);if(p.kind!==_.kind||p.kind!=="string"&&p.kind!=="number")throw new br(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${p.kind}, ${_.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const p=Nr(c),_=Nr(h);if(p.kind!=="string"||_.kind!=="string")return e(l,c,h)}return this.collator?t(l,c,h,this.collator.evaluate(l)):e(l,c,h)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}serialize(){const l=[i];return this.eachChild(c=>{l.push(c.serialize())}),l}}}const w_=dc("==",function(i,e,t){return e===t},op),T_=dc("!=",function(i,e,t){return e!==t},function(i,e,t,n){return!op(0,e,t,n)}),E_=dc("<",function(i,e,t){return e<t},function(i,e,t,n){return n.compare(e,t)<0}),S_=dc(">",function(i,e,t){return e>t},function(i,e,t,n){return n.compare(e,t)>0}),I_=dc("<=",function(i,e,t){return e<=t},function(i,e,t,n){return n.compare(e,t)<=0}),A_=dc(">=",function(i,e,t){return e>=t},function(i,e,t,n){return n.compare(e,t)>=0});class Ed{constructor(e,t,n,s,l,c){this.type=ii,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=l,this.maxFractionDigits=c}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,st);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let l=null;if(s.locale&&(l=t.parseObjectValue(s.locale,2,"locale",ii),!l))return null;
vendor: 4,234 bytes, line 1
1let c=null;if(s.currency&&(c=t.parseObjectValue(s.currency,2,"currency",ii),!c))return null;let h=null;if(s.unit&&(h=t.parseObjectValue(s.unit,2,"unit",ii),!h))return null;let p=null;if(s["min-fraction-digits"]!==void 0&&(p=t.parseObjectValue(s["min-fraction-digits"],2,"min-fraction-digits",st),!p))return null;let _=null;return s["max-fraction-digits"]===void 0||(_=t.parseObjectValue(s["max-fraction-digits"],2,"max-fraction-digits",st),_)?new Ed(n,l,c,h,p,_):null}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class uu{constructor(e){this.type=st,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`),null;const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?(t.error(`Expected argument of type string or array, but found ${ki(n.type)} instead.`),null):new uu(n):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string"||Array.isArray(t))return t.length;throw new br(`Expected value to be of type string or array, but found ${ki(Nr(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(t=>{e.push(t.serialize())}),e}}function fc(i){return function(){i=1831565813+(i|=0)|0;let e=Math.imul(i^i>>>15,1|i);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const yl={"==":w_,"!=":T_,">":S_,"<":E_,">=":A_,"<=":I_,array:Et,at:vd,"at-interpolated":bd,boolean:Et,case:Td,coalesce:ah,collator:Aa,format:Zn,image:Ea,interpolate:Lo,"interpolate-hcl":Lo,"interpolate-lab":Lo,length:uu,let:lh,literal:fs,match:wd,number:Et,"number-format":Ed,object:Et,slice:ch,step:gl,string:Et,"to-boolean":Ds,"to-color":Ds,"to-number":Ds,"to-string":Ds,var:Fs,within:ul,distance:pl,config:uc};function sp(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const l=s?s.evaluate(i):1,c=eu(e,t,n,l);if(c)throw new br(c);return new Lt(e/255,t/255,n/255,l)}function ap(i,[e,t,n,s]){e=e.evaluate(i),t=t.evaluate(i),n=n.evaluate(i);const l=s?s.evaluate(i):1,c=function(_,y,v,b){return typeof _=="number"&&_>=0&&_<=360?typeof y=="number"&&y>=0&&y<=100&&typeof v=="number"&&v>=0&&v<=100?b===void 0||typeof b=="number"&&b>=0&&b<=1?null:`Invalid hsla value [${[_,y,v,b].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof b=="number"?[_,y,v,b]:[_,y,v]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof b=="number"?[_,y,v,b]:[_,y,v]).join(", ")}]: 'h' must be between 0 and 360.`}(e,t,n,l);if(c)throw new br(c);const h=`hsla(${e}, ${t}%, ${n}%, ${l})`,p=Lt.parse(h);if(!p)throw new br(`Failed to parse HSLA color: ${h}`);return p}function lp(i,e){return i in e}function uh(i,e){const t=e[i];return t===void 0?null:t}function ra(i){return{type:i}}function Pa(i,e){if(!tc(i,["boolean","string","number","null"]))throw new br(`Expected first argument to be of type boolean, string, number or null, but found ${ki(Nr(i))} instead.`);if(!tc(e,["string","array"]))throw new br(`Expected second argument to be of type array or string, but found ${ki(Nr(e))} instead.`)}function hu(i){if(i instanceof uc)return new Set([i.key]);let e=new Set;return i.eachChild(t=>
1{e=new Set([...e,...hu(t)])}),e}function hh(i){if(i instanceof Sn&&i.name==="is-active-floor")return!0;let e=!1;return i.eachChild(t=>{!e&&hh(t)&&(e=!0)}),e}function dh(i){return{result:"success",value:i}}function Da(i){return{result:"error",value:i}}function Sd(i,e){return!!i&&!!i.parameters&&i.parameters.includes(e)}function du(i){return i["property-type"]==="data-driven"}function Id(i){return Sd(i.expression,"measure-light")}function cp(i){return Sd(i.expression,"zoom")}function Ad(i){return!!i.expression&&i.expression.interpolated}function Cd(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function up(i){return i}function Md(i,e){const t=e.type==="color",n=i.stops&&typeof i.stops[0][0]=="object",s=n||!(n||i.property!==void 0),l=i.type||(Ad(e)?"exponential":"interval");if(t&&((i={...i}).stops&&(i.stops=i.stops.map(_=>[_[0],Lt.parse(_[1])])),i.default=Lt.parse(i.default?i.default:e.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!rp[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let c,h,p;if(l==="exponential")c=hp;else if(l==="interval")c=M_;else if(l==="categorical"){c=C_,h=Object.create(null);for(const _ of i.stops)h[_[0]]=_[1];p=typeof i.stops[0][0]}else{if(l!=="identity")throw new Error(`Unknown function type "${l}"`);c=R_}if(n){const _={},y=[];for(let T=0;T<i.stops.length;T++){const S=i.stops[T],A=S[0].zoom;_[A]===void 0&&(_[A]={zoom:A,type:i.type,property:i.property,default:i.default,stops:[]},y.push(A)),_[A].stops.push([S[0].value,S[1]])}const v=[];for(const T of y)v.push([_[T].zoom,Md(_[T],e)]);const b={name:"linear"};return{kind:"composite",interpolationType:b,interpolationFactor:Lo.interpolationFactor.bind(void 0,b),zoomStops:v.map(T=>T[0]),evaluate:({zoom:T},S)=>hp({stops:v,base:i.base},e,T).evaluate(T,S)}}if(s){const _=l==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:_,interpolationFactor:Lo.interpolationFactor.bind(void 0,_),zoomStops:i.stops.map(y=>y[0]),evaluate:({zoom:y})=>c(i,e,y,h,p)}}return{kind:"source",evaluate(_,y){const v=y&&y.properties?y.properties[i.property]:void 0;return v===void 0?pc(i.default,e.default):c(i,e,v,h,p)}}}function pc(i,e,t){return i!==void 0?i:e!==void 0?e:t!==void 0?t:void 0}function C_(i,e,t,n,s){return pc(typeof t===s?n[t]:void 0,i.default,e.default)}function M_(i,e,t){if(!Ia(t))return pc(i.default,e.default);const n=i.stops.length;if(n===1||t<=i.stops[0][0])return i.stops[0][1];if(t>=i.stops[n-1][0])return i.stops[n-1][1];const s=au(i.stops.map(l=>l[0]),t);return i.stops[s][1]}function hp(i,e,t){const n=i.base!==void 0?i.base:1;if(!Ia(t))return pc(i.default,e.default);const s=i.stops.length;if(s===1||t<=i.stops[0][0])return i.stops[0][1];if(t>=i.stops[s-1][0])return i.stops[s-1][1];const l=au(i.stops.map(y=>y[0]),t),c=function(y,v,b,T){const S=T-b,A=y-b;return S===0?0:v===1?A/S:(Math.pow(v,A)-1)/(Math.pow(v,S)-1)}(t,n,i.stops[l][0],i.stops[l+1][0]),h=i.stops[l][1],p=i.stops[l+1][1];let _=xa[e.type]||up;if(i.colorSpace&&i.colorSpace!=="rgb"){const y=rp[i.colorSpace];_=(v,b)=>y.reverse(y.interpolate(y.forward(v),y.forward(b),c))}return typeof h.evaluate=="function"?{evaluate(...y){const v=h.evaluate.apply(void 0,y),b=p.evaluate.apply(void 0,y);if(v!==void 0&&b!==void 0)return _(v,b,c)}}:_(h,p,c)}function R_(i,e,t){return e.type==="color"?t=Lt.parse(t):e.type==="formatted"?t=Ar.fromString(t.toString()):e.type==="resolvedImage"?t=fn.build(t.toString()):cl(t)===e.type||e.type==="enum"&&e.values[t]||(t=void 0),pc(t,i.default,e.default)}Sn.register(yl,{error:[{kind:"error"},[ii],(i,[e])=>{throw new br(e.evaluate(i))}],typeof:[ii,[Yt],(i,[e])=>ki(Nr(e.evaluate(i)))],"to-rgba":[Vi(st,4),[nn],(i,[e])=>e.evaluate(i).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Vi(st,4),[nn],(i,[e])=>e.evaluate(i).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[nn,[st,st,st],sp],rgba:[nn,[st,st,st,st],sp],hsl:[nn,[st,st,st],ap],hsla:[nn,[st,st,st,st],ap],has:{type:qt,overloads:[[[ii],(i,[e])=>lp(e.evaluate(i),i.properties())],[[ii,Ro],(i,[e,t])=>lp(e.evaluate(i),t.evaluate(i))]]},get:{type:Yt,overloads:[[[ii],(i,[e])=>uh(e.evaluate(i),i.properties())],[[ii,Ro],(i,[e,t])=>uh(e.evaluate(i),t.evaluate(i))]]},"feature-state":[Yt,[ii],(i,[e])=>uh(e.evaluate(i),i.featureState||{})],properties:[Ro,[],i=>i.properties()],"geometry-type":[ii,[],i=>i.geometryType()],worldview:[ii,[],i=>i.globals.worldview||""],"is-active-floor":[qt,ra(ii),(i,e)=>{if(!(i.globals&&i.globals.activeFloors&&i.globals.activeFloors.size>0))return!1;if(e.length===0)return!0;const t=i.globals.activeFloors;return e.some(n=>{const s=n.evaluate(i);return t.has(s)})}],id:[Yt,[],i=>i.id()],zoom:[st,[],i=>i.globals.zoom],pitch:[st,[],i=>i.globals.pitch||0],"distance-from-center":[st,[],i=>i.distanceFromCenter()],"measure-light":[st,[ii],(i,[e])=>i.measureLight(e.evaluate(i))],"heatmap-density":[st,[],i=>i.globals.heatmapDensity||0],"line-progress":[st,[],i=>i.globals.lineProgress||0],"raster-value":[st,[],i=>i.globals.rasterValue||0],"raster-particle-speed":[st,[],i=>i.globals.rasterParticleSpeed||0],"sky-radial-progress":[st,[],i=>i.globals.skyRadialProgress||0],accumulated:[Yt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[st,ra(st),(i,e)=>{let t=0;for(const n of e)t+=n.evaluate(i);return t}],"*":[st,ra(st),(i,e)=>{let t=1;for(const n of e)t*=n.evaluate(i);return t}
vendor: 4,142 bytes, line 1
1],"-":{type:st,overloads:[[[st,st],(i,[e,t])=>e.evaluate(i)-t.evaluate(i)],[[st],(i,[e])=>-e.evaluate(i)]]},"/":[st,[st,st],(i,[e,t])=>e.evaluate(i)/t.evaluate(i)],"%":[st,[st,st],(i,[e,t])=>e.evaluate(i)%t.evaluate(i)],ln2:[st,[],()=>Math.LN2],pi:[st,[],()=>Math.PI],e:[st,[],()=>Math.E],"^":[st,[st,st],(i,[e,t])=>Math.pow(e.evaluate(i),t.evaluate(i))],sqrt:[st,[st],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[st,[st],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[st,[st],(i,[e])=>Math.log(e.evaluate(i))],log2:[st,[st],(i,[e])=>Math.log2(e.evaluate(i))],sin:[st,[st],(i,[e])=>Math.sin(e.evaluate(i))],cos:[st,[st],(i,[e])=>Math.cos(e.evaluate(i))],tan:[st,[st],(i,[e])=>Math.tan(e.evaluate(i))],asin:[st,[st],(i,[e])=>Math.asin(e.evaluate(i))],acos:[st,[st],(i,[e])=>Math.acos(e.evaluate(i))],atan:[st,[st],(i,[e])=>Math.atan(e.evaluate(i))],min:[st,ra(st),(i,e)=>Math.min(...e.map(t=>t.evaluate(i)))],max:[st,ra(st),(i,e)=>Math.max(...e.map(t=>t.evaluate(i)))],abs:[st,[st],(i,[e])=>Math.abs(e.evaluate(i))],round:[st,[st],(i,[e])=>{const t=e.evaluate(i);return t<0?-Math.round(-t):Math.round(t)}],floor:[st,[st],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[st,[st],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[qt,[ii,Yt],(i,[e,t])=>i.properties()[e.value]===t.value],"filter-id-==":[qt,[Yt],(i,[e])=>i.id()===e.value],"filter-type-==":[qt,[ii],(i,[e])=>i.geometryType()===e.value],"filter-<":[qt,[ii,Yt],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<s}],"filter-id-<":[qt,[Yt],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[qt,[ii,Yt],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>s}],"filter-id->":[qt,[Yt],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[qt,[ii,Yt],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[qt,[Yt],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[qt,[ii,Yt],(i,[e,t])=>{const n=i.properties()[e.value],s=t.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[qt,[Yt],(i,[e])=>{const t=i.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[qt,[Yt],(i,[e])=>e.value in i.properties()],"filter-has-id":[qt,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[qt,[Vi(ii)],(i,[e])=>e.value.includes(i.geometryType())],"filter-id-in":[qt,[Vi(Yt)],(i,[e])=>e.value.includes(i.id())],"filter-in-small":[qt,[ii,Vi(Yt)],(i,[e,t])=>t.value.includes(i.properties()[e.value])],"filter-in-large":[qt,[ii,Vi(Yt)],(i,[e,t])=>function(n,s,l,c){for(;l<=c;){const h=l+c>>1;if(s[h]===n)return!0;s[h]>n?c=h-1:l=h+1}return!1}(i.properties()[e.value],t.value,0,t.value.length-1)],all:{type:qt,overloads:[[[qt,qt],(i,[e,t])=>e.evaluate(i)&&t.evaluate(i)],[ra(qt),(i,e)=>{for(const t of e)if(!t.evaluate(i))return!1;return!0}]]},any:{type:qt,overloads:[[[qt,qt],(i,[e,t])=>e.evaluate(i)||t.evaluate(i)],[ra(qt),(i,e)=>{for(const t of e)if(t.evaluate(i))return!0;return!1}]]},"!":[qt,[qt],(i,[e])=>!e.evaluate(i)],"is-supported-script":[qt,[ii],(i,[e])=>{const t=i.globals&&i.globals.isSupportedScript;return!t||t(e.evaluate(i))}],upcase:[ii,[ii],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ii,[ii],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ii,ra(Yt),(i,e)=>e.map(t=>Do(t.evaluate(i))).join("")],split:[Vi(ii),[ii,ii],(i,[e,t])=>e.evaluate(i).split(t.evaluate(i))],in:[qt,[Yt,Yt],(i,[e,t])=>{const n=e.evaluate(i),s=t.evaluate(i);return s!=null&&(Pa(n,s),s.includes(n))}],"index-of":{type:st,overloads:[[[Yt,Yt],(i,[e,t])=>{const n=e.evaluate(i),s=t.evaluate(i);return Pa(n,s),s.indexOf(n)}],[[Yt,Yt,st],(i,[e,t,n])=>{const s=e.evaluate(i),l=t.evaluate(i),c=n.evaluate(i);return Pa(s,l),l.indexOf(s,c)}]]},"resolved-locale":[ii,[uo],(i,[e])=>e.evaluate(i).resolvedLocale()],random:[st,[st,st,Yt],(i,e)=>{const[t,n,s]=e.map(c=>c.evaluate(i));if(t>n||t===n)return t;let l;if(typeof s=="string")l=function(c){let h=0;if(c.length===0)return h;for(let p=0;p<c.length;p++)h=(h<<5)-h+c.charCodeAt(p),h&=h;return h}(s);else{if(typeof s!="number")throw new br(`Invalid seed input: ${s}`);l=s}
vendor: 6,907 bytes, line 1
1return t+fc(l)()*(n-t)}]});class Rd{constructor(e,t,n,s,l){this.expression=e,this._warningHistory={},this._scope=n,this._options=s,this._iconImageUseTheme=l,this._evaluator=new fo(n,s,l),this._defaultValue=t?function(c){return c.type==="color"&&(Cd(c.default)||Array.isArray(c.default))?new Lt(0,0,0,0):c.type==="color"?Lt.parse(c.default)||null:c.default===void 0?null:c.default}(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this.configDependencies=hu(e),this.isIndoorDependent=hh(e)}evaluateWithoutErrorHandling(e,t,n,s,l,c,h,p){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=s||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=c,this._evaluator.featureTileCoord=h||null,this._evaluator.featureDistanceData=p||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,s,l,c,h,p,_){this._evaluator||(this._evaluator=new fo(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=s||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=c||null,this._evaluator.featureTileCoord=h||null,this._evaluator.featureDistanceData=p||null,this._evaluator.iconImageUseTheme=_||null;try{const y=this.expression.evaluate(this._evaluator);if(y==null||typeof y=="number"&&y!=y)return this._defaultValue;if(this._enumValues&&!(y in this._enumValues))throw new br(`Expected value to be one of ${Object.keys(this._enumValues).map(v=>JSON.stringify(v)).join(", ")}, but found ${JSON.stringify(y)} instead.`);return y}catch(y){const v=y;return this._warningHistory[v.message]||(this._warningHistory[v.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${v.message}`)),this._defaultValue}}}function fh(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&Object.hasOwn(yl,i[0])}function xl(i,e,t,n,s){const l=new _l(yl,[],e?function(h){const p={color:nn,string:ii,number:st,enum:ii,boolean:qt,formatted:ds,resolvedImage:ba};return h.type==="array"?Vi(p[h.value]||Yt,h.length):p[h.type]}(e):void 0,void 0,void 0,t,n,s),c=l.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return c?dh(new Rd(c,e,t,n,s)):Da(l.errors)}class ph{constructor(e,t,n,s){this.kind=e,this._styleExpression=t,this.isLightConstant=n,this.isLineProgressConstant=s,this.isStateDependent=e!=="constant"&&!Ma(t.expression),this.configDependencies=hu(t.expression),this.isIndoorDependent=hh(t.expression)}evaluateWithoutErrorHandling(e,t,n,s,l,c){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,l,c)}evaluate(e,t,n,s,l,c,h){return this._styleExpression.evaluate(e,t,n,s,l,c,void 0,void 0,h)}}class vl{constructor(e,t,n,s,l,c){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Ma(t.expression),this.isIndoorDependent=hh(t.expression),this.isLightConstant=l,this.isLineProgressConstant=c,this.configDependencies=hu(t.expression),this.interpolationType=s}evaluateWithoutErrorHandling(e,t,n,s,l,c){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,l,c)}evaluate(e,t,n,s,l,c){return this._styleExpression.evaluate(e,t,n,s,l,c)}interpolationFactor(e,t,n){return this.interpolationType?Lo.interpolationFactor(this.interpolationType,e,t,n):0}}function Pd(i,e,t,n,s){if((i=xl(i,e,t,n,s)).result==="error")return i;const l=i.value.expression,c=ml(l);if(!c&&!du(e))return Da([new dn("","data expressions not supported")]);const h=zs(l,["zoom","pitch","distance-from-center"]);if(!h&&!cp(e))return Da([new dn("","zoom expressions not supported")]);const p=zs(l,["measure-light"]);if(!p&&!Id(e))return Da([new dn("","measure-light expression not supported")]);const _=zs(l,["line-progress"]);if(!_&&!function(b){return Sd(b.expression,"line-progress")}(e))return Da([new dn("","line-progress expression not supported")]);const y=e.expression&&e.expression.relaxZoomRestriction,v=pu(l);return v||h||y?v instanceof dn?Da([v]):v instanceof Lo&&!Ad(e)?Da([new dn("",'"interpolate" expressions cannot be used with this property')]):dh(v?new vl(c&&_?"camera":"composite",i.value,v.labels,v instanceof Lo?v.interpolation:void 0,p,_):new ph(c&&_?"constant":"source",i.value,p,_)):Da([new dn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class fu{constructor(e,t){this._parameters=e,this._specification=t,Object.assign(this,Md(this._parameters,this._specification))}static deserialize(e){return new fu(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function pu(i){let e=null;if(i instanceof lh)e=pu(i.result);else if(i instanceof ah){for(const t of i.args)if(e=pu(t),e)break}else(i instanceof gl||i instanceof Lo)&&i.input instanceof Sn&&i.input.name==="zoom"&&(e=i);return e instanceof dn||i.eachChild(t=>{const n=pu(t);n instanceof dn?e=n:e&&n&&e!==n&&(e=new dn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}class mu{constructor(e,t,n){if(this.boxSeen=new Uint32Array(0),this.circleSeen=new Uint32Array(0),this.generation=0,e instanceof ArrayBuffer){const s=new Int32Array(e);this.width=s[0],this.height=s[1],this.xCellCount=s[2],this.yCellCount=s[3],this.boxUid=s[4],this.circleUid=s[5];const l=this.xCellCount*this.yCellCount,c=[];for(let y=0;y<l;y++){const v=s[6+y],b=s[6+y+1];c.push(v===b?null:s.subarray(v,b))}const h=s[6+l],p=[];for(let y=0;y<l;y++){const v=s[h+y],b=s[h+y+1];p.push(v===b?null:s.subarray(v,b))}let _=s[h+l];this.boxCells=c,this.circleCells=p,this.boxKeys=s.subarray(_,_+this.boxUid),_+=this.boxUid,this.circleKeys=s.subarray(_,_+this.circleUid),_+=this.circleUid,this.bboxes=s.subarray(_,_+4*this.boxUid),_+=4*this.boxUid,this.circles=s.subarray(_,_+3*this.circleUid)}else{this.width=e,this.height=t,this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);const s=this.xCellCount*this.yCellCount,l=[],c=[];for(let h=0;h<s;h++)l.push([]),c.push([]);this.boxCells=l,this.circleCells=c,this.boxKeys=[],this.circleKeys=[],this.bboxes=[],this.circles=[],this.boxUid=0,this.circleUid=0}this.xScale=this.xCellCount/this.width,this.yScale=this.yCellCount/this.height}keysLength(){return this.boxKeys.length+this.circleKeys.length}clear(){for(const e of this.boxCells)e&&(e.length=0);for(const e of this.circleCells)e&&(e.length=0);this.circleKeys.length=0,this.boxKeys.length=0,this.bboxes.length=0,this.circles.length=0,this.boxUid=0,this.circleUid=0}insert(e,t,n,s,l){const c=this.boxUid++,h=this._xCell(t),p=this._yCell(n),_=this._xCell(s),y=this._yCell(l);for(let v=h;v<=_;v++)for(let b=p;b<=y;b++)this.boxCells[this.xCellCount*b+v].push(c);this.boxKeys.push(e),this.bboxes.push(t,n,s,l)}
vendor: 6,604 bytes, line 1
1insertCircle(e,t,n,s){const l=this.circleUid++,c=this._xCell(t-s),h=this._yCell(n-s),p=this._xCell(t+s),_=this._yCell(n+s);for(let y=c;y<=p;y++)for(let v=h;v<=_;v++)this.circleCells[this.xCellCount*v+y].push(l);this.circleKeys.push(e),this.circles.push(t,n,s)}query(e,t,n,s,l){const c=[];if(n<0||e>this.width||s<0||t>this.height)return c;const h=this._nextGen(),{boxCells:p,circleCells:_,boxKeys:y,circleKeys:v,bboxes:b,circles:T,boxSeen:S,circleSeen:A,xCellCount:C}=this,D=this._xCell(e),F=this._yCell(t),O=this._xCell(n),z=this._yCell(s);for(let N=D;N<=O;N++)for(let j=F;j<=z;j++){const te=C*j+N,G=p[te];if(G)for(let K=0;K<G.length;K++){const ee=G[K];if(S[ee]===h)continue;S[ee]=h;const le=4*ee,de=b[le],ve=b[le+1],xe=b[le+2],we=b[le+3];e<=xe&&t<=we&&n>=de&&s>=ve&&(!l||l(y[ee]))&&c.push({key:y[ee],x1:de,y1:ve,x2:xe,y2:we})}const W=_[te];if(W)for(let K=0;K<W.length;K++){const ee=W[K];if(A[ee]===h)continue;A[ee]=h;const le=3*ee,de=T[le],ve=T[le+1],xe=T[le+2];!this._circleAndRectCollide(de,ve,xe,e,t,n,s)||l&&!l(v[ee])||c.push({key:v[ee],x1:de-xe,y1:ve-xe,x2:de+xe,y2:ve+xe})}}return c}queryKeys(e,t,n,s,l){const c=[];if(n<0||e>this.width||s<0||t>this.height)return c;const h=this._nextGen(),{boxCells:p,boxKeys:_,bboxes:y,boxSeen:v,xCellCount:b,xScale:T,yScale:S}=this,A=this._xCell(e),C=this._yCell(t),D=this._xCell(n),F=this._yCell(s);for(let O=A;O<=D;O++)for(let z=C;z<=F;z++){if(l&&!l(O/T,z/S,(O+1)/T,(z+1)/S))continue;const N=p[b*z+O];if(N)for(let j=0;j<N.length;j++){const te=N[j];if(v[te]===h)continue;v[te]=h;const G=4*te,W=y[G],K=y[G+1],ee=y[G+2],le=y[G+3];(l?l(W,K,ee,le):e<=ee&&t<=le&&n>=W&&s>=K)&&c.push(_[te])}}return c}hitTest(e,t,n,s,l){if(n<0||e>this.width||s<0||t>this.height)return!1;const c=this._nextGen(),{boxCells:h,circleCells:p,boxKeys:_,circleKeys:y,bboxes:v,circles:b,boxSeen:T,circleSeen:S,xCellCount:A}=this,C=this._xCell(e),D=this._yCell(t),F=this._xCell(n),O=this._yCell(s);for(let z=C;z<=F;z++)for(let N=D;N<=O;N++){const j=A*N+z,te=h[j];if(te)for(let W=0;W<te.length;W++){const K=te[W];if(T[K]===c)continue;T[K]=c;const ee=4*K;if(e<=v[ee+2]&&t<=v[ee+3]&&n>=v[ee]&&s>=v[ee+1]&&(!l||l(_[K])))return!0}const G=p[j];if(G)for(let W=0;W<G.length;W++){const K=G[W];if(S[K]===c)continue;S[K]=c;const ee=3*K;if(this._circleAndRectCollide(b[ee],b[ee+1],b[ee+2],e,t,n,s)&&(!l||l(y[K])))return!0}}return!1}hitTestCircle(e,t,n,s){const l=e-n,c=t-n,h=e+n,p=t+n;if(h<0||l>this.width||p<0||c>this.height)return!1;const _=this._nextGen(),{boxCells:y,circleCells:v,boxKeys:b,circleKeys:T,bboxes:S,circles:A,boxSeen:C,circleSeen:D,xCellCount:F}=this,O=this._xCell(l),z=this._yCell(c),N=this._xCell(h),j=this._yCell(p);for(let te=O;te<=N;te++)for(let G=z;G<=j;G++){const W=F*G+te,K=y[W];if(K)for(let le=0;le<K.length;le++){const de=K[le];if(C[de]===_)continue;C[de]=_;const ve=4*de;if(this._circleAndRectCollide(e,t,n,S[ve],S[ve+1],S[ve+2],S[ve+3])&&(!s||s(b[de])))return!0}const ee=v[W];if(ee)for(let le=0;le<ee.length;le++){const de=ee[le];if(D[de]===_)continue;D[de]=_;const ve=3*de;if(this._circlesCollide(A[ve],A[ve+1],A[ve+2],e,t,n)&&(!s||s(T[de])))return!0}}return!1}static serialize(e,t){const n=e.toArrayBuffer();return t&&t.add(n),{buffer:n}}static deserialize(e){return new mu(e.buffer)}toArrayBuffer(){const e=this.xCellCount*this.yCellCount;let t=0,n=0;for(let h=0;h<e;h++)t+=this.boxCells[h].length,n+=this.circleCells[h].length;const s=new Int32Array(6+(e+1)+t+(e+1)+n+this.boxUid+this.circleUid+4*this.boxUid+3*this.circleUid);s[0]=this.width,s[1]=this.height,s[2]=this.xCellCount,s[3]=this.yCellCount,s[4]=this.boxUid,s[5]=this.circleUid;let l=6+(e+1);for(let h=0;h<e;h++){s[6+h]=l;const p=this.boxCells[h];s.set(p,l),l+=p.length}s[6+e]=l;const c=l;l+=e+1;for(let h=0;h<e;h++){s[c+h]=l;const p=this.circleCells[h];s.set(p,l),l+=p.length}return s[c+e]=l,s.set(this.boxKeys,l),l+=this.boxUid,s.set(this.circleKeys,l),l+=this.circleUid,s.set(this.bboxes,l),l+=4*this.boxUid,s.set(this.circles,l),s.buffer}_xCell(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_yCell(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_nextGen(){return this.boxSeen.length<this.boxUid&&(this.boxSeen=new Uint32Array(this.boxUid)),this.circleSeen.length<this.circleUid&&(this.circleSeen=new Uint32Array(this.circleUid)),this.generation=this.generation+1>>>0,this.generation===0&&(this.boxSeen.fill(0),this.circleSeen.fill(0),this.generation=1),this.generation}_circlesCollide(e,t,n,s,l,c){const h=s-e,p=l-t,_=n+c;return _*_>h*h+p*p}_circleAndRectCollide(e,t,n,s,l,c,h){const p=(c-s)/2,_=Math.abs(e-(s+p));if(_>p+n)return!1;const y=(h-l)/2,v=Math.abs(t-(l+y));if(v>y+n)return!1;if(_<=p||v<=y)return!0;const b=_-p,T=v-y;return b*b+T*T<=n*n}}const ps={};function tt(i,e,t={}){Object.defineProperty(i,"_classRegistryKey",{value:e,writable:!1}),ps[e]={klass:i,omit:t.omit||[]}}tt(Object,"Object"),tt(mu,"Grid"),delete Le.prototype.constructor,tt(Lt,"Color"),tt(Ar,"Formatted"),tt(wa,"FormattedSection"),tt(fn,"ResolvedImage"),tt(fu,"StylePropertyFunction"),tt(Rd,"StyleExpression",{omit:["_evaluator"]}),tt(Ir,"ImageId"),tt(ho,"ImageVariant"),tt(vl,"ZoomDependentExpression"),tt(ph,"ZoomConstantExpression"),tt(Sn,"CompoundExpression",{omit:["_evaluate"]});for(const i in yl)ps[yl[i]._classRegistryKey]||tt(yl[i],`Expression${i}`);function dp(i){return i&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}const bl={Error,TypeError,RangeError,SyntaxError,ReferenceError,URIError,EvalError},fp=new Set(["message","stack","cause","errors","name","class"]);function Wn(i,e){if(i===null)return null;const t=typeof i;if(t!=="object")return t==="bigint"?{$name:"BigInt",value:i.toString()}:i;if(Array.isArray(i)){const c=i.length,h=[];h.length=c;for(let p=0;p<c;p++)h[p]=Wn(i[p],e);return h}if(ArrayBuffer.isView(i))return e&&e.add(i.buffer),i;if(dp(i)||i instanceof ImageBitmap)return e&&e.add(i),i;if(i instanceof ImageData)return e&&e.add(i.data.buffer),i;if(i instanceof Map){const c={$name:"Map",entries:[]};for(const[h,p]of i.entries())c.entries.push(Wn(h),Wn(p,e));return c}if(i instanceof Headers)return{$name:"Headers",entries:[...i]};if(i instanceof Set){const c={$name:"Set"};let h=0;for(const p of i.values())c[++h]=Wn(p);return c}if(i instanceof Date||i instanceof RegExp||i instanceof Boolean||i instanceof Number||i instanceof String)return i;if(i instanceof Error){const c=i,h=c.constructor&&c.constructor.name||"Error",p={$name:"$Error",class:c instanceof kt?"AJAXError":c instanceof DOMException?"DOMException":c instanceof AggregateError?"AggregateError":bl[h]?h:"Error",name:c.name,message:c.message};
1c.stack&&(p.stack=c.stack),"cause"in c&&c.cause!==c&&(p.cause=Wn(c.cause,e)),c instanceof AggregateError&&(p.errors=c.errors.filter(y=>y!==c).map(y=>Wn(y,e)));const _=c;for(const y in _)Object.hasOwn(_,y)&&(fp.has(y)||(p[y]=Wn(_[y],e)));return p}const n=i.constructor||Object,s=n._classRegistryKey;if(!s)throw new Error(`Can't serialize object of unregistered class "${n.name}".`);const l=n.serialize?n.serialize(i,e):{};if(!n.serialize){const c=ps[s].omit,h=i;for(const p in h)Object.hasOwn(h,p)&&(c.includes(p)||(l[p]=Wn(h[p],e)))}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}function qo(i){if(i===null||typeof i!="object")return i;if(Array.isArray(i)){for(let s=0;s<i.length;s++)i[s]=qo(i[s]);return i}if(ArrayBuffer.isView(i)||dp(i)||i instanceof ImageBitmap||i instanceof ImageData||i instanceof Date||i instanceof RegExp||i instanceof Boolean||i instanceof Number||i instanceof String)return i;const e=i.$name||"Object";if(e==="Map"){const s=i.entries||[],l=new Map;for(let c=0;c<s.length;c+=2)l.set(qo(s[c]),qo(s[c+1]));return l}if(e==="Headers")return new Headers(i.entries);if(e==="Set"){const s=new Set;for(const l in i)l!=="$name"&&s.add(qo(i[l]));return s}if(e==="BigInt")return BigInt(i.value);if(e==="$Error"){const s=i.class||"Error",l=i.name||s,c=i.message||"";let h;h=s==="DOMException"?new DOMException(c,l):s==="AggregateError"?new AggregateError((i.errors||[]).map(qo),c):s==="AJAXError"?new kt(i.statusText,i.status,i.url):new(bl[s]||Error)(c),s!=="DOMException"&&(h.name=l),i.stack&&(h.stack=i.stack),"cause"in i&&(h.cause=qo(i.cause));const p=h;for(const _ in i)Object.hasOwn(i,_)&&(_==="$name"||fp.has(_)||(p[_]=qo(i[_])));return h}const{klass:t}=ps[e];if(!t)throw new Error(`Can't deserialize unregistered class "${e}".`);if(t.deserialize)return t.deserialize(i);const n=Object.create(t.prototype);for(const s in i)s!=="$name"&&(n[s]=qo(i[s]));return n}const pp=i=>i>=1536&&i<=1791,mp=i=>i>=1872&&i<=1919,mh=i=>i>=2208&&i<=2303,_h=i=>i>=11904&&i<=12031,gh=i=>i>=12032&&i<=12255,Dd=i=>i>=12272&&i<=12287,yh=i=>i>=12288&&i<=12351,mc=i=>i>=12352&&i<=12447,wl=i=>i>=12448&&i<=12543,xh=i=>i>=12544&&i<=12591,Ld=i=>i>=12704&&i<=12735,zd=i=>i>=12736&&i<=12783,Fd=i=>i>=12784&&i<=12799,vh=i=>i>=12800&&i<=13055,Od=i=>i>=13056&&i<=13311,_u=i=>i>=13312&&i<=19903,Bd=i=>i>=19968&&i<=40959,_p=i=>i>=40960&&i<=42127,gp=i=>i>=42128&&i<=42191,yp=i=>i>=44032&&i<=55215,xp=i=>i>=63744&&i<=64255,Os=i=>i>=64336&&i<=65023,kd=i=>i>=65040&&i<=65055,La=i=>i>=65072&&i<=65103,vp=i=>i>=65104&&i<=65135,Nd=i=>i>=65136&&i<=65279,Vd=i=>i>=65280&&i<=65519;function bp(i){for(const e of i)if(Ud(e.charCodeAt(0)))return!0;return!1}function P_(i){return!(pp(i)||mp(i)||mh(i)||Os(i)||Nd(i))}function Ud(i){return!(i!==746&&i!==747&&(i<4352||!(Ld(i)||xh(i)||La(i)&&!(i>=65097&&i<=65103)||xp(i)||Od(i)||_h(i)||zd(i)||!(!yh(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||_u(i)||Bd(i)||vh(i)||(e=>e>=12592&&e<=12687)(i)||(e=>e>=43360&&e<=43391)(i)||(e=>e>=55216&&e<=55295)(i)||(e=>e>=4352&&e<=4607)(i)||yp(i)||mc(i)||Dd(i)||(e=>e>=12688&&e<=12703)(i)||gh(i)||Fd(i)||wl(i)&&i!==12540||!(!Vd(i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!vp(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||(e=>e>=5120&&e<=5759)(i)||(e=>e>=6320&&e<=6399)(i)||kd(i)||(e=>e>=19904&&e<=19967)(i)||_p(i)||gp(i))))}function wp(i){return!(Ud(i)||function(e){return!!((t=>t>=128&&t<=255)(e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||(t=>t>=8192&&t<=8303)(e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||(t=>t>=8448&&t<=8527)(e)||(t=>t>=8528&&t<=8591)(e)||(t=>t>=8960&&t<=9215)(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||(t=>t>=9216&&t<=9279)(e)&&e!==9251||(t=>t>=9280&&t<=9311)(e)||(t=>t>=9312&&t<=9471)(e)||(t=>t>=9632&&t<=9727)(e)||(t=>t>=9728&&t<=9983)(e)&&!(e>=9754&&e<=9759)||(t=>t>=11008&&t<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||yh(e)||wl(e)||(t=>t>=57344&&t<=63743)(e)||La(e)||vp(e)||Vd(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function _c(i){return i>=1424&&i<=2303||Os(i)||Nd(i)}function bh(i,e){return!(!e&&_c(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||(t=>t>=6016&&t<=6143)(i))}function Tp(i){for(const e of i)if(_c(e.charCodeAt(0)))return!0;return!1}const mo={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let wh=null,Ln=mo.unavailable,za=null;const jd=function(i){i&&(Ln=mo.error),wh&&wh(i)};function gc(){Gd.fire(new Co("pluginStateChange",{pluginStatus:Ln,pluginURL:za}))}const Gd=new Pn,Hd=function(){return Ln},Ep=function(){if(Ln!==mo.deferred||!za)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ln=mo.loading,gc(),za&&vi({url:za}).then(()=>{Ln=mo.loaded,gc()}).catch(i=>{jd(i)})},Fa={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ln===mo.loaded||Fa.applyArabicShaping!=null,isLoading:()=>Ln===mo.loading,setState(i){Ln=i.pluginStatus,za=i.pluginURL},isParsing:()=>Ln===mo.parsing,isParsed:()=>Ln===mo.parsed,getPluginURL:()=>za};class Oi{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness,this.worldview=t.worldview,this.activeFloors=t.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(t,n){for(const s of t)if(!bh(s.charCodeAt(0),n))return!1;return!0}(e,Fa.isLoaded())}}class Tl{constructor(e,t,n,s,l){this.property=e,this.value=t,this.expression=function(c,h,p,_,y){if(Cd(c))return new fu(c,h);if(fh(c)||Array.isArray(c)&&c.length>0){const v=Pd(c,h,p,_,y);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));return v.value}{let v=c;return typeof c=="string"&&h.type==="color"&&(v=Lt.parse(c)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>v}}}(t===void 0?e.specification.default:t,e.specification,n,s,l)}
vendor: 4,714 bytes, line 1
1isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,t,n,s){return this.property.possiblyEvaluate(this,e,t,n,s)}}class yc{constructor(e,t,n,s){this.property=e,this.value=new Tl(e,void 0,t,n,s)}transitioned(e,t){return new gu(this.property,this.value,t,{...e.transition,...this.transition},e.now)}untransitioned(){return new gu(this.property,this.value,null,{},0)}}class _o{constructor(e,t,n,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=n,this._iconImageUseTheme=s,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return jn(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new yc(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new Tl(this._values[e].property,t===null?void 0:jn(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,t){t&&(this._options=t);const n=this._properties.properties;if(e)for(const s in e){const l=e[s];if(s.endsWith("-transition")){const c=s.slice(0,-11);n[c]&&this.setTransition(c,l)}else Object.hasOwn(n,s)&&this.setValue(s,l)}}getTransition(e){return jn(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new yc(this._values[e].property)),this._values[e].transition=jn(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);n!==void 0&&(e[t]=n);const s=this.getTransition(t);s!==void 0&&(e[`${t}-transition`]=s)}return e}transitioned(e,t){const n=new Sp(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].transitioned(e,t._values[s]);return n}untransitioned(){const e=new Sp(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class gu{constructor(e,t,n,s,l){const c=s.delay||0,h=s.duration||0;l=l||0,this.property=e,this.value=t,this.begin=l+c,this.end=this.begin+h,e.specification.transition&&(s.delay||s.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){const s=e.now||0,l=this.value.possiblyEvaluate(e,t,n),c=this.prior;if(c){if(s>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(s<this.begin)return c.possiblyEvaluate(e,t,n);{const h=(s-this.begin)/(this.end-this.begin);return this.property.interpolate(c.possiblyEvaluate(e,t,n),l,ga(h))}}return l}}class Sp{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){const s=new Oa(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].possiblyEvaluate(e,t,n);return s}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Zd{constructor(e,t,n,s){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=t,this._options=n,this._iconImageUseTheme=s,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return jn(this._values[e].value)}setValue(e,t){this._values[e]=new Tl(this._values[e].property,t===null?void 0:jn(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndoorDependent())}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n,s){const l=new Oa(this._properties);for(const c of Object.keys(this._values))l._values[c]=this._values[c].possiblyEvaluate(e,t,n,s);return l}isIndoorDependent(){return this._isIndoorDependent}}class na{constructor(e,t,n,s){this.property=e,this.value=t,this.parameters=n,this.iconImageUseTheme=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,n,s,l){return this.property.evaluate(this.value,this.parameters,e,t,n,s,this.iconImageUseTheme,l)}}class Oa{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class je{constructor(e){this.specification=e}
vendor: 4,067 bytes, line 1
1possiblyEvaluate(e,t){return e.expression.evaluate(t)}interpolate(e,t,n){const s=xa[this.specification.type];return s?s(e,t,n):e}}class Ze{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,s,l){return e.expression.kind==="constant"||e.expression.kind==="camera"?new na(this,{kind:"constant",value:e.expression.evaluate(t,null,{},n,s,void 0,l)},t):new na(this,e.expression,t,l)}interpolate(e,t,n){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new na(this,{kind:"constant",value:void 0},e.parameters);const s=xa[this.specification.type];return s?new na(this,{kind:"constant",value:s(e.value.value,t.value.value,n)},e.parameters):e}evaluate(e,t,n,s,l,c,h,p){return e.kind==="constant"?e.value:e.evaluate(t,n,s,l,c,p,h)}}class oa{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,s){return!!e.expression.evaluate(t,null,{},n,s)}interpolate(){return!1}}class qi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new Oi(0,{});for(const n in e){const s=e[n],l=s.specification;l&&l.overridable&&this.overridableProperties.push(n);const c=this.defaultPropertyValues[n]=new Tl(s,void 0),h=this.defaultTransitionablePropertyValues[n]=new yc(s);this.defaultTransitioningPropertyValues[n]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate(t)}}}tt(Ze,"DataDrivenProperty"),tt(je,"DataConstantProperty"),tt(oa,"ColorRampProperty");var me=JSON.parse('{"expression":1,"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"function":{"type":{"type":"enum","default":"exponential","values":{"identity":1,"exponential":1,"interval":1,"categorical":1}},"default":{"type":"*"},"expression":1,"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"colorSpace":{"type":"enum","default":"rgb","values":{"rgb":1,"lab":1,"hcl":1}}},"$version":8,"$root":{"transition":{"type":"transition"},"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},"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"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"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":{"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1
vendor: 7,743 bytes, line 1
1}},"default":{"type":"*","expression":1},"values":{"type":"array","value":"*"},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}},"id":{"type":"string"},"properties":{"type":"properties"}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1,"parameters":["zoom"]},"transition":1},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","default":"mapbox","values":{"terrarium":1,"mapbox":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"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,"minimum":0,"maximum":512},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"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","default":[0,0,0],"length":3,"value":"number"}},"modelLightOverrides":{"light-ambient-color":{"type":"color"},"light-ambient-intensity":{"type":"number"},"light-directional-color":{"type":"color"},"light-directional-intensity":{"type":"number"}},"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","default":[0,0],"minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"},"lightOverrides":{"type":"modelLightOverrides"},"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":{"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"
vendor: 33,903 bytes, line 1
1clip":{}}},"id":{"type":"string"},"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"}},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_sky":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_model":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"model-id":{"type":"string","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","default":[],"value":"enum","values":{"model":1,"symbol":1},"expression":1},"clip-layer-scope":{"type":"array","default":[],"value":"string","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"expression":1},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-markup":1},"expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_heatmap":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill-extrusion":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","default":3,"minimum":1,"maximum":200,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-unit-width":{"type":"number","default":3.1,"minimum":1,"maximum":20,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-window":{"type":"array","default":[0.9,0.9],"minimum":0.1,"maximum":1,"length":2,"value":"number","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-roof-shape":{"type":"enum","default":"flat","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flip-roof-orientation":{"type":"boolean","default":false,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","default":"butt","values":{"butt":1,"round":1,"square":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-join":{"type":"enum","default":"miter","values":{"bevel":1,"round":1,"miter":1,"none":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["feature","line-progress","zoom"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"line-cross-slope":{"type":"number","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"line-width-unit":{"type":"enum","default":"pixels","values":{"pixels":1,"meters":1},"expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","line-progress","zoom"]},"transition":1,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","default":"point","values":{"point":1,"line":1,"line-center":1},"expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":1,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","default":"auto","values":{"auto":1,"viewport-y":1,"source":1},"expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"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","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"icon-text-fit":{"type":"enum","default":"none","values":{"none":1,"width":1,"height":1,"both":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","default":[0,0,0,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"use-theme":1,"property-type":"data-driven","appearance":1,"tokens":1},"icon-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-anchor":{"type":"enum","default":"center","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":["feature","zoom"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven","tokens":1},"text-font":{"type":"array","default":["Open Sans Regular","Arial Unicode MS Regular"],"value":"string","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-justify":{"type":"enum","default":"center","values":{"auto":1,"left":1,"center":1,"right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"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","default":"center","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":["feature","zoom"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","default":"none","values":{"none":1,"uppercase":1,"lowercase":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster-particle":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_hillshade":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"expression":{"parameters":["distance-from-center","feature","pitch","zoom"]},"property-type":"data-driven"},"filter_fill":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_hillshade":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster-particle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_clip":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_model":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_line":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_circle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_fill-extrusion":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_building":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_heatmap":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"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_stop":{"type":"array","minimum":0,"maximum":24,"length":2,"value":["number","color"]},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"camera":{"camera-projection":{"type":"enum","default":"perspective","values":{"perspective":1,"orthographic":1}}},"colorTheme":{"data":{"type":"string","expression":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"projection":{"name":{"type":"enum","default":"mercator","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1}},"center":{"type":"array","minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"parallels":{"type":"array","minimum":[-90,-90],"maximum":[90,90],"length":2,"value":"number"}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-outline-color":{"type":"color","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","default":"flat","values":{"terrain":1,"flat":1}},"fill-extrusion-base-alignment":{"type":"enum","default":"terrain","values":{"terrain":1,"flat":1}},"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":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-extrusion-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1},"fill-extrusion-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":1},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"use-theme":1,"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"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":1,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"building-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"building-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-dasharray":{"type":"array","minimum":0,"value":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-trim-offset":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number"},"line-trim-fade-range":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-trim-color":{"type":"color","default":"transparent","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-border-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-blend-mode":{"type":"enum","default":"default","values":{"default":1,"multiply":1,"additive":1},"expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}}
1},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"circle-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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"],"expression":{"interpolated":1,"parameters":["heatmap-density"]},"use-theme":1},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"icon-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1,"overridable":1},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"text-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"text-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":1},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven","appearance":1}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-value"]},"use-theme":1},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-range":{"type":"array","length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-hue-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-resampling":{"type":"enum","default":"linear","values":{"linear":1,"nearest":1},"expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-elevation-reference":{"type":"enum","default":"sea","values":{"sea":1,"ground":1},"expression":1}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-particle-speed"]},"use-theme":1},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":1,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"hillshade-shadow-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-accent-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_background":{"background-pitch-alignment":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_sky":{"sky-type":{"type":"enum","default":"atmosphere","values":{"gradient":1,"atmosphere":1},"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","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"],"expression":{"interpolated":1,"parameters":["sky-radial-progress"]},"use-theme":1},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":1},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":1},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-rotation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-scale":{"type":"array","default":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-translation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"model-color-mix-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-type":{"type":"enum","default":"common-3d","values":{"common-3d":1,"location-indicator":1}},"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":1,"parameters":["zoom"]},"transition":1},"model-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"model-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"model-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"model-line-cutout-mode":{"type":"enum","default":"enabled","values":{"enabled":1,"disabled":1,"enabled-above-cutout":1},"expression":1}},"promoteId":{"*":{"type":"*"}}}');function Ip(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Th(i){if(Array.isArray(i))return i.map(Th);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={},t=i;for(const n in t)e[n]=Th(t[n]);return e}ret
1urn Ip(i)}function Eh(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Eh(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function yu(i,e="",t=null,n="fill"){if(i==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Eh(i)||(i=vu(i));const s=i;let l=!0;try{l=function(y){if(!El(y))return y;let v=Th(y);return $d(v),v=Ap(v),v}(s)}catch{console.warn(`Failed to extract static filter. Filter will continue 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(s,null,2)} 7 `)}let c=null,h=null;if(n!=="background"&&n!=="sky"&&n!=="slot"){h=me[`filter_${n}`];const y=xl(l,h,e,t);if(y.result==="error")throw new Error(y.value.map(v=>`${v.key}: ${v.message}`).join(", "));c=(v,b,T)=>y.value.evaluate(v,b,{},T)}let p=null,_=null;if(l!==s){const y=xl(s,h,e,t);if(y.result==="error")throw new Error(y.value.map(v=>`${v.key}: ${v.message}`).join(", "));p=(v,b,T,S,A)=>y.value.evaluate(v,b,{},T,void 0,void 0,S,A),_=!ml(y.value.expression)}return{filter:c,dynamicFilter:p||void 0,needGeometry:xu(l),needFeature:!!_}}function Ap(i){if(!Array.isArray(i))return i;const e=function(t){if(D_.has(t[0])){for(let n=1;n<t.length;n++)if(El(t[n]))return!0}return t}(i);return e===!0?e:e.map(t=>Ap(t))}function $d(i){let e=!1;const t=[];if(i[0]==="case"){for(let n=1;n<i.length-1;n+=2)e=e||El(i[n]),t.push(i[n+1]);t.push(i.at(-1))}else if(i[0]==="match"){e=e||El(i[1]);for(let n=2;n<i.length-1;n+=2)t.push(i[n+1]);t.push(i.at(-1))}else if(i[0]==="step"){e=e||El(i[1]);for(let n=1;n<i.length-1;n+=2)t.push(i[n+1])}e&&(i.length=0,i.push("any",...t));for(let n=1;n<i.length;n++)$d(i[n])}function El(i){if(!Array.isArray(i))return!1;if((e=i[0])==="pitch"||e==="distance-from-center")return!0;var e;
7for(let t=1;t<i.length;t++)if(El(i[t]))return!0;return!1}const D_=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function qd(i,e){return i<e?-1:i>e?1:0}function xu(i){if(!Array.isArray(i))return!1;if(i[0]==="within"||i[0]==="distance")return!0;for(let e=1;e<i.length;e++)if(xu(i[e]))return!0;return!1}function vu(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?Wd(i[1],i[2],"=="):e==="!="?xc(Wd(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Wd(i[1],i[2],e):e==="any"?(t=i.slice(1),["any"].concat(t.map(vu))):e==="all"?["all"].concat(i.slice(1).map(vu)):e==="none"?["all"].concat(i.slice(1).map(vu).map(xc)):e==="in"?Xd(i[1],i.slice(2)):e==="!in"?xc(Xd(i[1],i.slice(2))):e==="has"?Cp(i[1]):e!=="!has"||xc(Cp(i[1]));var t}function Wd(i,e,t){switch(i){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,i,e]}}function Xd(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",i,["literal",e.sort(qd)]]:["filter-in-small",i,["literal",e]]}}function Cp(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function xc(i){return["!",i]}const bu="�";function Sh(i,e){return e?`${i}${bu}${e}`:i}function Mp(i){const e=i.indexOf(bu);return e>=0?i.slice(e+1):""}let Rp;const Yd=()=>Rp||(Rp=new qi({"icon-size":new Ze(me.layout_symbol["icon-size"]),"icon-image":new Ze(me.layout_symbol["icon-image"]),"icon-rotate":new Ze(me.layout_symbol["icon-rotate"]),"icon-offset":new Ze(me.layout_symbol["icon-offset"]),"text-size":new Ze(me.layout_symbol["text-size"]),"text-rotate":new Ze(me.layout_symbol["text-rotate"]),"text-offset":new Ze(me.layout_symbol["text-offset"])}));let Pp;const Dp=()=>Pp||(Pp=new qi({"icon-opacity":new Ze(me.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ze(me.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ze(me.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ze(me.paint_symbol["text-emissive-strength"]),"icon-color":new Ze(me.paint_symbol["icon-color"]),"icon-halo-color":new Ze(me.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ze(me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ze(me.paint_symbol["icon-halo-blur"]),"icon-translate":new Ze(me.paint_symbol["icon-translate"]),"text-opacity":new Ze(me.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ze(me.paint_symbol["text-occlusion-opacity"]),"text-color":new Ze(me.paint_symbol["text-color"],{runtimeType:nn,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Ze(me.paint_symbol["text-halo-color"]),"text-halo-width":new Ze(me.paint_symbol["text-halo-width"]),"text-halo-blur":new Ze(me.paint_symbol["text-halo-blur"]),"text-translate":new Ze(me.paint_symbol["text-translate"]),"symbol-z-offset":new Ze(me.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}));class L_{constructor(e,t,n,s,l,c){this._conditionSpec=e,this._propertiesSpec=n;const h=xl(e,me.appearance.condition);if(h.result==="success"&&(this.condition=h.value),this.name=t,n){this.layoutProperties=new Oa(Yd()),this.unevaluatedLayout=new Zd(Yd(),s,l,c),this.paintProperties=new Oa(Dp()),this.unevaluatedPaint=new Zd(Dp(),s,l,"");for(const p in n)p in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(p,n[p]):p in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(p,n[p])}}isActive(e){return!(this.condition||!e.isHidden||this.name!=="hidden")||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}
vendor: 18,937 bytes, line 7
7getName(){return this.name}getLayoutProperty(e){return this.layoutProperties.get(e)}getPaintProperty(e){return this.paintProperties.get(e)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(e){return this.unevaluatedLayout._values[e]}getUnevaluatedPaintProperty(e){return this.unevaluatedPaint._values[e]}recalculate(e,t,n){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,t,n)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(e,void 0,t,""))}serialize(){const e={};e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name);const t={...this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},...this.unevaluatedPaint?this.unevaluatedPaint.serialize():{}};return Object.keys(t).length>0&&(e.properties=t),e}hasIconLayoutProperties(){const e=this.hasLayoutProperty("icon-image"),t=this.hasLayoutProperty("icon-size"),n=this.hasLayoutProperty("icon-offset"),s=this.hasLayoutProperty("icon-rotate");return e||t||n||s}hasTextLayoutProperties(){const e=this.hasLayoutProperty("text-size"),t=this.hasLayoutProperty("text-offset"),n=this.hasLayoutProperty("text-rotate");return e||t||n}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("icon-")||e==="symbol-z-offset")&&this.hasPaintProperty(e))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("text-")||e==="symbol-z-offset")&&this.hasPaintProperty(e))}hasLayoutProperty(e){return this.unevaluatedLayout&&this.unevaluatedLayout._values[e].value!==void 0}hasPaintProperty(e){return this.unevaluatedPaint&&this.unevaluatedPaint._values[e].value!==void 0}}const Lp="-transition",z_=new Set(["fill","line","background","hillshade","raster"]);class zn extends Pn{constructor(e,t,n,s,l,c){if(super(),this.id=e.id,this.fqid=Sh(this.id,n),this.type=e.type,this.scope=n,this.lut=s,this.options=l,this.iconImageUseTheme=c,this.appearances=new Array,this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),t.layout&&(this._unevaluatedLayout=new Zd(t.layout,this.scope,l,this.iconImageUseTheme)),t.paint)){this._transitionablePaint=new _o(t.paint,this.scope,l);for(const h in e.paint)this.setPaintProperty(h,e.paint[h]);for(const h in e.layout)this.setLayoutProperty(h,e.layout[h]);this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Oa(t.paint)}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&z_.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if(this.type==="custom"&&e==="visibility")return void(this.visibility=t);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,t),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(t=>{this.appearances.push(new L_(t.condition,t.name,t.properties,this.scope,this.options,this.iconImageUseTheme))}),this.appearancesVersion++}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Lp)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,t){const n=this._transitionablePaint,s=n._properties.properties;if(e.endsWith(Lp)){const v=e.slice(0,-11);return s[v]&&n.setTransition(v,t||void 0),!1}if(!s[e])return!1;const l=n._values[e],c=l.value.isDataDriven(),h=l.value;n.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const p=n._values[e].value,_=p.isDataDriven(),y=e.endsWith("pattern")||e==="line-dasharray";return _||c||y||this._handleOverridablePaintPropertyUpdate(e,h,p)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,n){return null}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={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 this.appearances.length!==0&&(e.appearances=this.appearances.map(t=>t.serialize())),Xc(e,(t,n)=>!(t===void 0||n==="layout"&&!Object.keys(t).length||n==="paint"&&!Object.keys(t).length))}is3D(e){return!1}hasElevation(){return!1}mayUse(e){return!1}prepare(){return Promise.resolve()}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(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof na&&du(t.property.specification)&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}for(const e of this.appearances)if(!Ma(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=yu(this.filter,this.scope,e),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(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,t,n){return{}}queryRadius(e){}queryIntersectsFeature(e,t,n,s,l,c,h,p,_,y){}}function Ih(i,e,t){if(!i._unevaluatedLayout)return!1;const n=i._unevaluatedLayout.getValue(e);return n!==void 0&&(typeof n!="string"||t(n))}function vc(i,e,t=2){const n=e&&e.length,s=n?e[0]*t:i.length;let l=zp(i,0,s,t,!0);const c=[];if(!l||l.next===l.prev)return c;let h,p,_;if(n&&(l=function(y,v,b,T){const S=[];for(let A=0,C=v.length;A<C;A++){const D=zp(y,v[A]*T,A<C-1?v[A+1]*T:y.length,T,!1);D===D.next&&(D.steiner=!0),S.push(Bp(D))}S.sort(B_);for(let A=0;A<S.length;A++)b=k_(S[A],b);return b}(i,e,l,t)),i.length>80*t){h=i[0],p=i[1];let y=h,v=p;for(let b=t;b<s;b+=t){const T=i[b],S=i[b+1];T<h&&(h=T),S<p&&(p=S),T>y&&(y=T),S>v&&(v=S)}_=Math.max(y-h,v-p),_=_!==0?32767/_:0}return wu(l,c,t,h,p,_,0),c}function zp(i,e,t,n,s){let l;if(s===function(c,h,p,_){let y=0;for(let v=h,b=p-_;v<p;v+=_)y+=(c[b]-c[v])*(c[v+1]+c[b+1]),b=v;return y}(i,e,t,n)>0)for(let c=e;c<t;c+=n)l=Ph(c/n|0,i[c],i[c+1],l);else for(let c=t-n;c>=e;c-=n)l=Ph(c/n|0,i[c],i[c+1],l);return l&&bc(l,l.next)&&(Su(l),l=l.next),l}function Bs(i,e){if(!i)return i;e||(e=i);let t,n=i;do if(t=!1,n.steiner||!bc(n,n.next)&&Cr(n.prev,n,n.next)!==0)n=n.next;else{if(Su(n),n=e=n.prev,n===n.next)break;t=!0}while(t||n!==e);return e}function wu(i,e,t,n,s,l,c){if(!i)return;!c&&l&&function(p,_,y,v){let b=p;do b.z===0&&(b.z=Ch(b.x,b.y,_,y,v)),b.prevZ=b.prev,b.nextZ=b.next,b=b.next;while(b!==p);b.prevZ.nextZ=null,b.prevZ=null,function(T){let S,A=1;do{let C,D=T;T=null;let F=null;for(S=0;D;){S++;let O=D,z=0;for(let j=0;j<A&&(z++,O=O.nextZ,O);j++);let N=A;for(;z>0||N>0&&O;)z!==0&&(N===0||!O||D.z<=O.z)?(C=D,D=D.nextZ,z--):(C=O,O=O.nextZ,N--),F?F.nextZ=C:T=C,C.prevZ=F,F=C;D=O}F.nextZ=null,A*=2}while(S>1)}(b)}(i,n,s,l);let h=i;for(;i.prev!==i.next;){const p=i.prev,_=i.next;if(l?Ah(i,n,s,l):F_(i))e.push(p.i,i.i,_.i),Su(i),i=_.next,h=_.next;else if((i=_)===h){c?c===1?wu(i=O_(Bs(i),e),e,t,n,s,l,2):c===2&&Fp(i,e,t,n,s,l):wu(Bs(i),e,t,n,s,l,1);break}}}function F_(i){const e=i.prev,t=i,n=i.next;if(Cr(e,t,n)>=0)return!1;const s=e.x,l=t.x,c=n.x,h=e.y,p=t.y,_=n.y,y=Math.min(s,l,c),v=Math.min(h,p,_),b=Math.max(s,l,c),T=Math.max(h,p,_);let S=n.next;for(;S!==e;){if(S.x>=y&&S.x<=b&&S.y>=v&&S.y<=T&&Tu(s,h,l,p,c,_,S.x,S.y)&&Cr(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function Ah(i,e,t,n){const s=i.prev,l=i,c=i.next;if(Cr(s,l,c)>=0)return!1;const h=s.x,p=l.x,_=c.x,y=s.y,v=l.y,b=c.y,T=Math.min(h,p,_),S=Math.min(y,v,b),A=Math.max(h,p,_),C=Math.max(y,v,b),D=Ch(T,S,e,t,n),F=Ch(A,C,e,t,n);let O=i.prevZ,z=i.nextZ;for(;O&&O.z>=D&&z&&z.z<=F;){if(O.x>=T&&O.x<=A&&O.y>=S&&O.y<=C&&O!==s&&O!==c&&Tu(h,y,p,v,_,b,O.x,O.y)&&Cr(O.prev,O,O.next)>=0||(O=O.prevZ,z.x>=T&&z.x<=A&&z.y>=S&&z.y<=C&&z!==s&&z!==c&&Tu(h,y,p,v,_,b,z.x,z.y)&&Cr(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;O&&O.z>=D;){if(O.x>=T&&O.x<=A&&O.y>=S&&O.y<=C&&O!==s&&O!==c&&Tu(h,y,p,v,_,b,O.x,O.y)&&Cr(O.prev,O,O.next)>=0)return!1;O=O.prevZ}for(;z&&z.z<=F;){if(z.x>=T&&z.x<=A&&z.y>=S&&z.y<=C&&z!==s&&z!==c&&Tu(h,y,p,v,_,b,z.x,z.y)&&Cr(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function O_(i,e){let t=i;do{const n=t.prev,s=t.next.next;!bc(n,s)&&Vp(n,t,t.next,s)&&Eu(n,s)&&Eu(s,n)&&(e.push(n.i,t.i,s.i),Su(t),Su(t.next),t=i=s),t=t.next}while(t!==i);return Bs(t)}function Fp(i,e,t,n,s,l){let c=i;do{let h=c.next.next;for(;h!==c.prev;){if(c.i!==h.i&&Np(c,h)){let p=Kd(c,h);return c=Bs(c,c.next),p=Bs(p,p.next),wu(c,e,t,n,s,l,0),void wu(p,e,t,n,s,l,0)}h=h.next}c=c.next}while(c!==i)}function B_(i,e){let t=i.x-e.x;return t===0&&(t=i.y-e.y,t===0)&&(t=(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)),t}function k_(i,e){const t=function(s,l){let c=l;const h=s.x,p=s.y;let _,y=-1/0;if(bc(s,c))return c;do{if(bc(s,c.next))return c.next;if(p<=c.y&&p>=c.next.y&&c.next.y!==c.y){const A=c.x+(p-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(A<=h&&A>y&&(y=A,_=c.x<c.next.x?c:c.next,A===h))return _}c=c.next}while(c!==l);if(!_)return null;const v=_,b=_.x,T=_.y;let S=1/0;c=_;do{if(h>=c.x&&c.x>=b&&h!==c.x&&kp(p<T?h:y,p,b,T,p<T?y:h,p,c.x,c.y)){const A=Math.abs(p-c.y)/(h-c.x);Eu(c,s)&&(A<S||A===S&&(c.x>_.x||c.x===_.x&&Op(_,c)))&&(_=c,S=A)}c=c.next}while(c!==v);return _}(i,e);if(!t)return e;const n=Kd(t,i);return Bs(n,n.next),Bs(t,t.next)}function Op(i,e){return Cr(i.prev,i,e.prev)<0&&Cr(e.next,i,i.next)<0}function Ch(i,e,t,n,s){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-t)*s|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Bp(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function kp(i,e,t,n,s,l,c,h){return(s-c)*(e-h)>=(i-c)*(l-h)&&(i-c)*(n-h)>=(t-c)*(e-h)&&(t-c)*(l-h)>=(s-c)*(n-h)}function Tu(i,e,t,n,s,l,c,h){return!(i===c&&e===h)&&kp(i,e,t,n,s,l,c,h)}function Np(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(t,n){let s=t;do{if(s.i!==t.i&&s.next.i!==t.i&&s.i!==n.i&&s.next.i!==n.i&&Vp(s,s.next,t,n))return!0;s=s.next}while(s!==t);return!1}(i,e)&&(Eu(i,e)&&Eu(e,i)&&function(t,n){let s=t,l=!1;const c=(t.x+n.x)/2,h=(t.y+n.y)/2;do s.y>h!=s.next.y>h&&s.next.y!==s.y&&c<(s.next.x-s.x)*(h-s.y)/(s.next.y-s.y)+s.x&&(l=!l),s=s.next;while(s!==t);return l}(i,e)&&(Cr(i.prev,i,e.prev)||Cr(i,e.prev,e))||bc(i,e)&&Cr(i.prev,i,i.next)>0&&Cr(e.prev,e,e.next)>0)}function Cr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function bc(i,e){return i.x===e.x&&i.y===e.y}function Vp(i,e,t,n){const s=Rh(Cr(i,e,t)),l=Rh(Cr(i,e,n)),c=Rh(Cr(t,n,i)),h=Rh(Cr(t,n,e));return s!==l&&c!==h||!(s!==0||!Mh(i,t,e))||!(l!==0||!Mh(i,n,e))||!(c!==0||!Mh(t,i,n))||!(h!==0||!Mh(t,e,n))}function Mh(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Rh(i){return i>0?1:i<0?-1:0}function Eu(i,e){return Cr(i.prev,i,i.next)<0?Cr(i,e,i.next)>=0&&Cr(i,i.prev,e)>=0:Cr(i,e,i.prev)<0||Cr(i,i.next,e)<0}function Kd(i,e){const t=Wo(i.i,i.x,i.y),n=Wo(e.i,e.x,e.y),s=i.next,l=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,n.next=t,t.prev=n,l.next=n,n.prev=l,n}function Ph(i,e,t,n){const s=Wo(i,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Su(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 Wo(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Dh(i,e,t=1){if(!i)return null;const n=typeof i=="string"?fn.from(i).getPrimary():i.getPrimary(),s=typeof i=="string"?null:i.getSecondary();for(const l of[n,s]){if(!l)continue;const c=l.id.toString();e.has(c)||e.set(c,[]),l.scaleSelf(t),e.get(c).push(l)}return{primary:n.toString(),secondary:s?s.toString():null}}function Jd(i,e,t,n){const s=n.patternDependencies;let l=!1;for(const c of e){const h=c.paint.get(`${i}-pattern`);h.isConstant()||(l=!0),Dh(h.constantOr(null),s,t)&&(l=!0)}return l}function wc(i,e,t,n,s,l){const c=l.patternDependencies;for(const h of e){const p=h.paint.get(`${i}-pattern`).value;if(p.kind!=="constant"){const _=Dh(p.evaluate({zoom:n},t,{},void 0,l.availableImages),c,s);if(!_)continue;const{primary:y,secondary:v}=_;y&&(t.patterns[h.id]=[y,v].filter(Boolean))}}return t}const Fn=We/Math.PI/2,Xo=64,Qd=[Xo,32,16],Yo=-Fn,Ko=Fn;function Tc(i,e,t,n=Fn){return t=Bt(t),[i*Math.sin(t)*n,-e*n,i*Math.cos(t)*n]}function Sl(i,e,t){return Tc(Math.cos(Bt(i)),Math.sin(Bt(i)),e,t)}const Il=63710088e-1,Iu=2*Math.PI*Il;class Wt{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Wt(vn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,n=this.lat*t,s=e.lat*t,l=Math.sin(n)*Math.sin(s)+Math.cos(n)*Math.cos(s)*Math.cos((e.lng-this.lng)*t);return Il*Math.acos(Math.min(l,1))}toBounds(e=0){const t=360*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return new a({lng:this.lng-n,lat:this.lat-t},{lng:this.lng+n,lat:this.lat+t})}toEcef(e){return Sl(this.lat,this.lng,Fn+e*Fn/Il)}static convert(e){if(e instanceof Wt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Wt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Wt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class a{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Wt?new Wt(e.lng,e.lat):Wt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Wt?new Wt(e.lng,e.lat):Wt.convert(e),this}extend(e){const t=this._sw,n=this._ne;let s,l;if(e instanceof Wt)s=e,l=e;else{if(!(e instanceof a))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(a.convert(e)):this.extend(Wt.convert(e)):typeof e=="object"&&e!==null&&Object.hasOwn(e,"lat")&&(Object.hasOwn(e,"lon")||Object.hasOwn(e,"lng"))?this.extend(Wt.convert(e)):this;if(s=e._sw,l=e._ne,!s||!l)return this}return t||n?(t.lng=Math.min(s.lng,t.lng),t.lat=Math.min(s.lat,t.lat),n.lng=Math.max(l.lng,n.lng),n.lat=Math.max(l.lat,n.lat)):(this._sw=new Wt(s.lng,s.lat),this._ne=new Wt(l.lng,l.lat)),this}getCenter(){return new Wt((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 Wt(this.getWest(),this.getNorth())}getSouthEast(){return new Wt(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(e){const{lng:t,lat:n}=Wt.convert(e);let s=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&s}static convert(e){if(e)return e instanceof a?e:new a(e)}}function r(i){return Iu*Math.cos(i*Math.PI/180)}function o(i,e){return i/r(e)}function u(i,e){return i*r(wr(e))}const f=85.051129;function m(i){return Math.cos(Bt(yt(i,-85.051129,f)))}function g(i,e){const t=yt(e,0,25.5),n=Math.pow(2,t);return m(i)*Iu/(512*n)}function x(i){return 1/Math.cos(i*Math.PI/180)}function w(i,e=0){const t=Math.exp(Math.PI*(1-(i.y+e/We)/(1<<i.z)*2));return 80150034*t/(t*t+1)/We/(1<<i.z)}class E{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){const n=Wt.convert(e);return new E(po(n.lng),$n(n.lat),o(t,n.lat))}toLngLat(){return new Wt(qn(this.x),wr(this.y))}toAltitude(){return u(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Iu*x(wr(this.y))}}function I(i,e,t,n,s,l,c,h,p){const _=(e+n)/2,y=(t+s)/2,v=new Le(_,y);h(v),function(b,T,S,A,C,D){const F=S-C,O=A-D;return Math.abs((A-T)*F-(S-b)*O)/Math.hypot(F,O)}(v.x,v.y,l.x,l.y,c.x,c.y)>=p?(I(i,e,t,_,y,l,v,h,p),I(i,_,y,n,s,v,c,h,p)):i.push(c)}function P(i,e,t){let n=i[0],s=n.x,l=n.y;e(n);const c=[n];for(let h=1;h<i.length;h++){const p=i[h],{x:_,y}=p;e(p),I(c,s,l,_,y,n,p,e,t),s=_,l=y,n=p}return c}function R(i,e,t,n){if(n(e,t)){const s=e.add(t)._mult(.5);R(i,e,s,n),R(i,s,t,n)}else i.push(t)}function B(i,e){let t=i[0];const n=[t];for(let s=1;s<i.length;s++){const l=i[s];R(n,t,l,e),t=l}return n}const V=Math.pow(2,14)-1,U=-V-1;function Z(i,e){const t=Math.round(i.x*e),n=Math.round(i.y*e);return i.x=yt(t,U,V),i.y=yt(n,U,V),(t<i.x||t>i.x+1||n<i.y||n>i.y+1)&&gi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),i}function q(i,e,t){const n=i.loadGeometry(),s=i.extent,l=We/s;if(e&&t&&t.projection.isReprojectedInTileSpace){const c=1<<e.z,{scale:h,x:p,y:_,projection:y}=t,v=b=>{const T=qn((e.x+b.x/s)/c),S=wr((e.y+b.y/s)/c),A=y.project(T,S);
vendor: 11,866 bytes, line 7
7b.x=(A.x*h-p)*s,b.y=(A.y*h-_)*s};for(let b=0;b<n.length;b++)if(i.type!==1)n[b]=P(n[b],v,1);else{const T=[];for(const S of n[b])S.x<0||S.x>=s||S.y<0||S.y>=s||(v(S),T.push(S));n[b]=T}}for(const c of n)for(const h of c)Z(h,l);return n}function X(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?q(i):[]}}const ne={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class oe{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const _e=new ArrayBuffer(0);class ae{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,t){return e._trim(),t&&e.arrayBuffer&&t.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,e.arrayBuffer?t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement:(t.capacity=0,t.arrayBuffer=_e),t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}resizeExact(e){this.reserveExact(e),this.length=e}reserve(e){e>this.capacity&&this._allocate(Math.max(e,Math.floor(5*this.capacity),128))}reserveExact(e){(e>this.capacity||!this.arrayBuffer)&&this._allocate(e)}_allocate(e){this._reallocCount++,this.capacity=e,this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new 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 ue(i,e=1){let t=0,n=0;return{members:i.map(s=>{const l=ne[s.type].BYTES_PER_ELEMENT,c=t=he(t,Math.max(e,l)),h=s.components||1;return n=Math.max(n,l),t+=l*h,{name:s.name,type:s.type,components:h,offset:c}}),size:he(t,Math.max(n,e)),alignment:e}}function he(i,e){return Math.ceil(i/e)*e}class fe extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.int16[s+0]=t,this.int16[s+1]=n,e}}fe.prototype.bytesPerElement=4,tt(fe,"StructArrayLayout2i4");class be extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const l=3*e;return this.int16[l+0]=t,this.int16[l+1]=n,this.int16[l+2]=s,e}}be.prototype.bytesPerElement=6,tt(be,"StructArrayLayout3i6");class Re extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,s)}emplace(e,t,n,s,l){const c=4*e;return this.int16[c+0]=t,this.int16[c+1]=n,this.uint16[c+2]=s,this.uint16[c+3]=l,e}}Re.prototype.bytesPerElement=8,tt(Re,"StructArrayLayout2i2ui8");class Ae extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Ae.prototype.bytesPerElement=4,tt(Ae,"StructArrayLayout1f4");class Ce extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const l=4*e,c=2*e;return this.int16[l+0]=t,this.int16[l+1]=n,this.float32[c+1]=s,e}}Ce.prototype.bytesPerElement=8,tt(Ce,"StructArrayLayout2i1f8");class Ee extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const l=4*e;return this.int16[l+0]=t,this.int16[l+1]=n,this.int16[l+2]=s,e}}Ee.prototype.bytesPerElement=8,tt(Ee,"StructArrayLayout3i8");class Ye extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,s)}emplace(e,t,n,s,l){const c=4*e;return this.int16[c+0]=t,this.int16[c+1]=n,this.int16[c+2]=s,this.int16[c+3]=l,e}}Ye.prototype.bytesPerElement=8,tt(Ye,"StructArrayLayout4i8");class De extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s,l)}emplace(e,t,n,s,l,c){const h=5*e;return this.int16[h+0]=t,this.int16[h+1]=n,this.int16[h+2]=s,this.int16[h+3]=l,this.int16[h+4]=c,e}}De.prototype.bytesPerElement=10,tt(De,"StructArrayLayout5i10");class Ve extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,l,c,h)}emplace(e,t,n,s,l,c,h,p){const _=6*e,y=12*e,v=3*e;return this.int16[_+0]=t,this.int16[_+1]=n,this.uint8[y+4]=s,this.uint8[y+5]=l,this.uint8[y+6]=c,this.uint8[y+7]=h,this.float32[v+2]=p,e}}Ve.prototype.bytesPerElement=12,tt(Ve,"StructArrayLayout2i4ub1f12");class $e extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const l=3*e;return this.float32[l+0]=t,this.float32[l+1]=n,this.float32[l+2]=s,e}}$e.prototype.bytesPerElement=12,tt($e,"StructArrayLayout3f12");class ot extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s,l)}emplace(e,t,n,s,l,c){const h=6*e,p=3*e;return this.uint16[h+0]=t,this.uint16[h+1]=n,this.uint16[h+2]=s,this.uint16[h+3]=l,this.float32[p+2]=c,e}}ot.prototype.bytesPerElement=12,tt(ot,"StructArrayLayout4ui1f12");class et extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,s)}emplace(e,t,n,s,l){const c=4*e;return this.uint16[c+0]=t,this.uint16[c+1]=n,this.uint16[c+2]=s,this.uint16[c+3]=l,e}}et.prototype.bytesPerElement=8,tt(et,"StructArrayLayout4ui8");class Xe extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,s,l,c)}emplace(e,t,n,s,l,c,h){const p=6*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=s,this.int16[p+3]=l,this.int16[p+4]=c,this.int16[p+5]=h,e}}Xe.prototype.bytesPerElement=12,tt(Xe,"StructArrayLayout6i12");class mt extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c,h,p,_,y,v,b){const T=this.length;return this.resize(T+1),this.emplace(T,e,t,n,s,l,c,h,p,_,y,v,b)}emplace(e,t,n,s,l,c,h,p,_,y,v,b,T){const S=12*e;return this.int16[S+0]=t,this.int16[S+1]=n,this.int16[S+2]=s,this.int16[S+3]=l,this.uint16[S+4]=c,this.uint16[S+5]=h,this.uint16[S+6]=p,this.uint16[S+7]=_,this.int16[S+8]=y,this.int16[S+9]=v,this.int16[S+10]=b,this.int16[S+11]=T,e}}mt.prototype.bytesPerElement=24,tt(mt,"StructArrayLayout4i4ui4i24");class qe extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,s,l,c)}emplace(e,t,n,s,l,c,h){const p=10*e,_=5*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=s,this.float32[_+2]=l,this.float32[_+3]=c,this.float32[_+4]=h,e}}qe.prototype.bytesPerElement=20,tt(qe,"StructArrayLayout3i3f20");class Ge extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,s)}emplace(e,t,n,s,l){const c=4*e;return this.float32[c+0]=t,this.float32[c+1]=n,this.float32[c+2]=s,this.float32[c+3]=l,e}}Ge.prototype.bytesPerElement=16,tt(Ge,"StructArrayLayout4f16");class Qe extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Qe.prototype.bytesPerElement=4,tt(Qe,"StructArrayLayout1ul4");class dt extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.uint16[s+0]=t,this.uint16[s+1]=n,e}}dt.prototype.bytesPerElement=4,tt(dt,"StructArrayLayout2ui4");class rt extends ae{_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(e,t,n,s,l,c,h,p,_,y,v,b,T){const S=this.length;return this.resize(S+1),this.emplace(S,e,t,n,s,l,c,h,p,_,y,v,b,T)}emplace(e,t,n,s,l,c,h,p,_,y,v,b,T,S){const A=20*e,C=10*e;return this.int16[A+0]=t,this.int16[A+1]=n,this.int16[A+2]=s,this.int16[A+3]=l,this.int16[A+4]=c,this.float32[C+3]=h,this.float32[C+4]=p,this.float32[C+5]=_,this.float32[C+6]=y,this.int16[A+14]=v,this.uint32[C+8]=b,this.uint16[A+18]=T,this.uint16[A+19]=S,e}}rt.prototype.bytesPerElement=40,tt(rt,"StructArrayLayout5i4f1i1ul2ui40");class ct extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,l,c,h)}emplace(e,t,n,s,l,c,h,p){const _=8*e;return this.int16[_+0]=t,this.int16[_+1]=n,this.int16[_+2]=s,this.int16[_+4]=l,this.int16[_+5]=c,this.int16[_+6]=h,this.int16[_+7]=p,e}}ct.prototype.bytesPerElement=16,tt(ct,"StructArrayLayout3i2i2i16");class _t extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s,l)}emplace(e,t,n,s,l,c){const h=4*e,p=8*e;return this.float32[h+0]=t,this.float32[h+1]=n,this.float32[h+2]=s,this.int16[p+6]=l,this.int16[p+7]=c,e}}_t.prototype.bytesPerElement=16,tt(_t,"StructArrayLayout2f1f2i16");class Dt extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,s,l,c)}
vendor: 11,662 bytes, line 7
7emplace(e,t,n,s,l,c,h){const p=20*e,_=5*e;return this.uint8[p+0]=t,this.uint8[p+1]=n,this.float32[_+1]=s,this.float32[_+2]=l,this.float32[_+3]=c,this.float32[_+4]=h,e}}Dt.prototype.bytesPerElement=20,tt(Dt,"StructArrayLayout2ub4f20");class bt extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const l=3*e;return this.uint16[l+0]=t,this.uint16[l+1]=n,this.uint16[l+2]=s,e}}bt.prototype.bytesPerElement=6,tt(bt,"StructArrayLayout3ui6");class Kt extends ae{_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(e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O,z,N){const j=this.length;return this.resize(j+1),this.emplace(j,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O,z,N)}emplace(e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O,z,N,j){const te=30*e,G=15*e,W=60*e;return this.int16[te+0]=t,this.int16[te+1]=n,this.int16[te+2]=s,this.float32[G+2]=l,this.float32[G+3]=c,this.uint16[te+8]=h,this.uint16[te+9]=p,this.uint32[G+5]=_,this.uint32[G+6]=y,this.uint32[G+7]=v,this.uint16[te+16]=b,this.uint16[te+17]=T,this.uint16[te+18]=S,this.float32[G+10]=A,this.float32[G+11]=C,this.uint8[W+48]=D,this.uint8[W+49]=F,this.uint8[W+50]=O,this.uint32[G+13]=z,this.int16[te+28]=N,this.uint8[W+58]=j,e}}Kt.prototype.bytesPerElement=60,tt(Kt,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Ti extends ae{_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(e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O,z,N,j,te,G,W,K,ee,le,de,ve,xe,we,Fe){const se=this.length;return this.resize(se+1),this.emplace(se,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O,z,N,j,te,G,W,K,ee,le,de,ve,xe,we,Fe)}emplace(e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O,z,N,j,te,G,W,K,ee,le,de,ve,xe,we,Fe,se){const pe=20*e,ge=40*e,Se=80*e;return this.float32[pe+0]=t,this.float32[pe+1]=n,this.int16[ge+4]=s,this.int16[ge+5]=l,this.int16[ge+6]=c,this.int16[ge+7]=h,this.int16[ge+8]=p,this.int16[ge+9]=_,this.int16[ge+10]=y,this.int16[ge+11]=v,this.int16[ge+12]=b,this.uint16[ge+13]=T,this.uint16[ge+14]=S,this.uint16[ge+15]=A,this.uint16[ge+16]=C,this.uint16[ge+17]=D,this.uint16[ge+18]=F,this.uint16[ge+19]=O,this.uint16[ge+20]=z,this.uint16[ge+21]=N,this.uint16[ge+22]=j,this.uint16[ge+23]=te,this.uint16[ge+24]=G,this.uint16[ge+25]=W,this.uint16[ge+26]=K,this.uint16[ge+27]=ee,this.uint32[pe+14]=le,this.float32[pe+15]=de,this.float32[pe+16]=ve,this.float32[pe+17]=xe,this.float32[pe+18]=we,this.uint8[Se+76]=Fe,this.uint16[ge+39]=se,e}}Ti.prototype.bytesPerElement=80,tt(Ti,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ai extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,s,l,c)}emplace(e,t,n,s,l,c,h){const p=6*e;return this.float32[p+0]=t,this.float32[p+1]=n,this.float32[p+2]=s,this.float32[p+3]=l,this.float32[p+4]=c,this.float32[p+5]=h,e}}ai.prototype.bytesPerElement=24,tt(ai,"StructArrayLayout6f24");class Ot extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s,l)}emplace(e,t,n,s,l,c){const h=5*e;return this.float32[h+0]=t,this.float32[h+1]=n,this.float32[h+2]=s,this.float32[h+3]=l,this.float32[h+4]=c,e}}Ot.prototype.bytesPerElement=20,tt(Ot,"StructArrayLayout5f20");class Tt extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,l,c,h)}emplace(e,t,n,s,l,c,h,p){const _=7*e;return this.float32[_+0]=t,this.float32[_+1]=n,this.float32[_+2]=s,this.float32[_+3]=l,this.float32[_+4]=c,this.float32[_+5]=h,this.float32[_+6]=p,e}}Tt.prototype.bytesPerElement=28,tt(Tt,"StructArrayLayout7f28");class Ei extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c,h,p,_,y,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,n,s,l,c,h,p,_,y,v)}emplace(e,t,n,s,l,c,h,p,_,y,v,b){const T=11*e;return this.float32[T+0]=t,this.float32[T+1]=n,this.float32[T+2]=s,this.float32[T+3]=l,this.float32[T+4]=c,this.float32[T+5]=h,this.float32[T+6]=p,this.float32[T+7]=_,this.float32[T+8]=y,this.float32[T+9]=v,this.float32[T+10]=b,e}}Ei.prototype.bytesPerElement=44,tt(Ei,"StructArrayLayout11f44");class Ji extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c,h,p,_){const y=this.length;return this.resize(y+1),this.emplace(y,e,t,n,s,l,c,h,p,_)}emplace(e,t,n,s,l,c,h,p,_,y){const v=9*e;return this.float32[v+0]=t,this.float32[v+1]=n,this.float32[v+2]=s,this.float32[v+3]=l,this.float32[v+4]=c,this.float32[v+5]=h,this.float32[v+6]=p,this.float32[v+7]=_,this.float32[v+8]=y,e}}Ji.prototype.bytesPerElement=36,tt(Ji,"StructArrayLayout9f36");class Ui extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.float32[s+0]=t,this.float32[s+1]=n,e}}Ui.prototype.bytesPerElement=8,tt(Ui,"StructArrayLayout2f8");class Ut extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,s)}emplace(e,t,n,s,l){const c=6*e;return this.uint32[3*e+0]=t,this.uint16[c+2]=n,this.uint16[c+3]=s,this.uint16[c+4]=l,e}}Ut.prototype.bytesPerElement=12,tt(Ut,"StructArrayLayout1ul3ui12");class Mi extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Mi.prototype.bytesPerElement=2,tt(Mi,"StructArrayLayout1ui2");class _i extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C){const D=this.length;return this.resize(D+1),this.emplace(D,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C)}emplace(e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D){const F=16*e;return this.float32[F+0]=t,this.float32[F+1]=n,this.float32[F+2]=s,this.float32[F+3]=l,this.float32[F+4]=c,this.float32[F+5]=h,this.float32[F+6]=p,this.float32[F+7]=_,this.float32[F+8]=y,this.float32[F+9]=v,this.float32[F+10]=b,this.float32[F+11]=T,this.float32[F+12]=S,this.float32[F+13]=A,this.float32[F+14]=C,this.float32[F+15]=D,e}}_i.prototype.bytesPerElement=64,tt(_i,"StructArrayLayout16f64");class ni extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,l,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,l,c,h)}emplace(e,t,n,s,l,c,h,p){const _=10*e,y=5*e;return this.uint16[_+0]=t,this.uint16[_+1]=n,this.uint16[_+2]=s,this.uint16[_+3]=l,this.float32[y+2]=c,this.float32[y+3]=h,this.float32[y+4]=p,e}}ni.prototype.bytesPerElement=20,tt(ni,"StructArrayLayout4ui3f20");class lr extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}lr.prototype.bytesPerElement=2,tt(lr,"StructArrayLayout1i2");class cr extends ae{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}cr.prototype.bytesPerElement=1,tt(cr,"StructArrayLayout1ub1");class Ri extends oe{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]}}Ri.prototype.size=40;class li extends rt{get(e){return new Ri(this,e)}}tt(li,"CollisionBoxArray");class rr extends oe{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]}get 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(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}rr.prototype.size=60;class Zr extends Kt{get(e){return new rr(this,e)}}tt(Zr,"PlacedSymbolArray");class Jo extends oe{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]}
vendor: 4,681 bytes, line 7
7get 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(e){this._structArray.uint32[this._pos4+14]=e}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(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Jo.prototype.size=80;class In extends Ti{get(e){return new Jo(this,e)}}tt(In,"SymbolInstanceArray");class ms extends Ae{getoffsetX(e){return this.float32[1*e+0]}}tt(ms,"GlyphOffsetArray");class bi extends fe{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}tt(bi,"SymbolLineVertexArray");class Pi extends oe{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]}}Pi.prototype.size=12;class Jt extends Ut{get(e){return new Pi(this,e)}}tt(Jt,"FeatureIndexArray");class sr extends dt{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}tt(sr,"FillExtrusionCentroidArray");class $r extends oe{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]}}$r.prototype.size=6;class Pt extends be{get(e){return new $r(this,e)}}tt(Pt,"FillExtrusionWallArray");const nr=ue([{name:"a_pos",components:2,type:"Int16"}],4),pn=ue([{name:"a_road_z_offset",components:1,type:"Float32"}],4),Xn=ue([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),_s=ue([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);class fi{constructor(e=[]){this.segments=e}_prepareSegment(e,t,n,s,l){let c=this.segments.at(-1);return e>fi.MAX_VERTEX_ARRAY_LENGTH&&gi(`Max vertices per segment is ${fi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!c||c.vertexLength+e>fi.MAX_VERTEX_ARRAY_LENGTH||c.sortKey!==s||l!==void 0&&c&&c.batchIndex!==void 0&&c.batchIndex!==l)&&(c={vertexOffset:t,primitiveOffset:n,vertexLength:0,primitiveLength:0},s!==void 0&&(c.sortKey=s),l!==void 0&&(c.batchIndex=l),this.segments.push(c)),c}prepareSegment(e,t,n,s,l){return this._prepareSegment(e,t.length,n.length,s,l)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,s){return new fi([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:s,vaos:{},sortKey:0}])}}function On(i,e){return 256*(i=yt(Math.floor(i),0,255))+yt(Math.floor(e),0,255)}fi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,tt(fi,"SegmentVector");const zo=ue([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Al=ue([{name:"a_pattern_b",components:4,type:"Uint16"}]),gs=ue([{name:"a_dash",components:4,type:"Uint16"}]);class ys{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
vendor: 5,678 bytes, line 7
7add(e,t,n,s){this.ids.push(Lh(e)),this.positions.push(t,n,s)}eachPosition(e,t){const n=Lh(e);let s=0,l=this.ids.length-1;for(;s<l;){const c=s+l>>1;this.ids[c]>=n?l=c:s=c+1}for(;this.ids[s]===n;)t(this.positions[3*s],this.positions[3*s+1],this.positions[3*s+2]),s++}static serialize(e,t){const n=new Float64Array(e.ids),s=new Uint32Array(e.positions);return Ec(n,s,0,n.length-1),t&&(t.add(n.buffer),t.add(s.buffer)),{ids:n,positions:s}}static deserialize(e){const t=new ys;let n;t.ids=e.ids,t.positions=e.positions;for(const s of t.ids)s!==n&&t.uniqueIds.push(s),n=s;return t.indexed=!0,t}}function Lh(i){const e=+i;return Number.isSafeInteger(e)?e:sl(String(i))}function Ec(i,e,t,n){for(;t<n;){const s=i[t+n>>1];let l=t-1,c=n+1;for(;;){do l++;while(i[l]<s);do c--;while(i[c]>s);if(l>=c)break;Sc(i,l,c),Sc(e,3*l,3*c),Sc(e,3*l+1,3*c+1),Sc(e,3*l+2,3*c+2)}c-t<n-c?(Ec(i,e,t,c),t=c+1):(Ec(i,e,c+1,n),n=c)}}function Sc(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}tt(ys,"FeaturePositionMap");class Qo{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}set(e,t,n){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class hr extends Qo{constructor(e){super(e),this.current=0}set(e,t,n){this.fetchUniformLocation(e,t)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}class St extends Qo{constructor(e){super(e),this.current=0}set(e,t,n){this.fetchUniformLocation(e,t)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class Mr extends Qo{constructor(e){super(e),this.current=[0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}class dr extends Qo{constructor(e){super(e),this.current=[0,0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}}class ef extends Qo{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4ui(this.location,n[0],n[1],n[2],n[3])))}}class ks extends Qo{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class tf extends Qo{constructor(e){super(e),this.current=Lt.transparent.toPremultipliedRenderColor(null)}set(e,t,n){this.fetchUniformLocation(e,t)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}class Kr extends Qo{constructor(e){super(e),this.current=new Float32Array(16)}set(e,t,n){if(!this.fetchUniformLocation(e,t))return;const s=this.current;if(n[12]!==s[12]||n[0]!==s[0])return s.set(n),void this.gl.uniformMatrix4fv(this.location,!1,s);for(let l=1;l<16;l++)if(n[l]!==s[l]){s.set(n),this.gl.uniformMatrix4fv(this.location,!1,s);break}}}class N_ extends Qo{constructor(e){super(e),this.current=new Float32Array(4)}set(e,t,n){if(!this.fetchUniformLocation(e,t))return;const s=this.current;for(let l=0;l<4;l++)if(n[l]!==s[l]){s.set(n),this.gl.uniformMatrix2fv(this.location,!1,s);break}}}function V_(i){return[On(255*i.r,255*i.g),On(255*i.b,255*i.a)]}function Up(i,e,t,n,s,l,c,h){return!!i&&(i.kind==="composite"||i.kind==="source"?i.evaluate(new Oi(0,{brightness:l,worldview:h}),e,t,s,n,c)==="none":i.value==="none")}class jp{constructor(e,t,n,s){this.value=e,this.uniformNames=t.map(l=>`u_${l}`),this.type=n,this.context=s}setUniform(e,t,n,s,l){const c=s.constantOr(this.value);t.set(e,l,c instanceof Lt?c.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):c)}getBinding(e,t){return this.type==="color"?new tf(e):new St(e)}}class rf{constructor(e,t){this.uniformNames=t.map(n=>`u_${n}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,t){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=t?t.tl.concat(t.br):this.pattern}setUniform(e,t,n,s,l){let c=null;l!=="u_pattern"&&l!=="u_dash"||(c=this.pattern),l==="u_pattern_b"&&(c=this.patternTransition),l==="u_pixel_ratio"&&(c=this.pixelRatio),c&&t.set(e,l,c)}getBinding(e,t){return t==="u_pattern"||t==="u_pattern_b"||t==="u_dash"?new ef(e):new St(e)}}class Cl{constructor(e,t,n,s){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map(l=>({name:`a_${l}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new s}populatePaintArray(e,t,n,s,l,c,h,p){const _=this.paintVertexArray.length,y=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Oi(0,{brightness:c,worldview:p}),t,{},l,s,h):this.expression.kind==="constant"&&this.expression.value,v=Up(this.lutExpression,t,{},s,l,c,h,p);this.paintVertexArray.resize(e),this._setPaintValue(_,e,y,v?null:this.context.lut)}updatePaintArray(e,t,n,s,l,c,h,p){const _=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:h,worldview:p},n,s,void 0,l):this.expression.kind==="constant"&&this.expression.value,y=Up(this.lutExpression,n,s,l,void 0,h,void 0,p);this._setPaintValue(e,t,_,y?null:this.context.lut)}
vendor: 9,591 bytes, line 7
7_setPaintValue(e,t,n,s){if(this.type==="color"){const l=V_(n.toPremultipliedRenderColor(s));for(let c=e;c<t;c++)this.paintVertexArray.emplace(c,l[0],l[1])}else{for(let l=e;l<t;l++)this.paintVertexArray.emplace(l,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ba{constructor(e,t,n,s,l,c){this.expression=e,this.uniformNames=t.map(h=>`u_${h}_t`),this.type=n,this.useIntegerZoom=s,this.context=l,this.maxValue=0,this.paintVertexAttributes=t.map(h=>({name:`a_${h}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,t,n,s,l,c,h,p){const _=this.expression.evaluate(new Oi(this.context.zoom,{brightness:c,worldview:p}),t,{},l,s,h),y=this.expression.evaluate(new Oi(this.context.zoom+1,{brightness:c,worldview:p}),t,{},l,s,h),v=Up(this.lutExpression,t,{},s,l,c,h,p),b=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(b,e,_,y,v?null:this.context.lut)}updatePaintArray(e,t,n,s,l,c,h,p){const _=this.expression.evaluate({zoom:this.context.zoom,brightness:h,worldview:p},n,s,void 0,l),y=this.expression.evaluate({zoom:this.context.zoom+1,brightness:h,worldview:p},n,s,void 0,l),v=Up(this.lutExpression,n,s,l,void 0,h,void 0,p);this._setPaintValue(e,t,_,y,v?null:this.context.lut)}_setPaintValue(e,t,n,s,l){if(this.type==="color"){const c=V_(n.toPremultipliedRenderColor(l)),h=V_(s.toPremultipliedRenderColor(l));for(let p=e;p<t;p++)this.paintVertexArray.emplace(p,c[0],c[1],h[0],h[1])}else{for(let c=e;c<t;c++)this.paintVertexArray.emplace(c,n,s);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t,n,s,l){const c=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,h=yt(this.expression.interpolationFactor(c,this.context.zoom,this.context.zoom+1),0,1);t.set(e,l,h)}getBinding(e,t){return new St(e)}}class ka{constructor(e,t,n,s,l){this.expression=e,this.layerId=l,this.paintVertexAttributes=(n==="array"?gs:zo).members;for(let c=0;c<t.length;++c);this.paintVertexArray=new s,this.paintTransitionVertexArray=new et}populatePaintArray(e,t,n,s){const l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(l,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,s,l,c,h){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],c)}_setPaintValues(e,t,n,s){if(!s||!n)return;const l=s[n[0]],c=s[n[1]];if(l){if(l){const{tl:h,br:p,pixelRatio:_}=l;for(let y=e;y<t;y++)this.paintVertexArray.emplace(y,h[0],h[1],p[0],p[1],_)}if(c){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:h,br:p}=c;for(let _=e;_<t;_++)this.paintTransitionVertexArray.emplace(_,h[0],h[1],p[0],p[1])}}}upload(e){const t=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,t)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Al.members,t))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Au{constructor(e,t,n=()=>!0){this.binders={},this._buffers=[],this.context=t;const s=[],l=e;for(const c in e.paint._values){const h=l.paint.get(c);if(c.endsWith("-use-theme")||!n(c)||!(h instanceof na&&du(h.property.specification)))continue;const p=Lb(c,e.type),_=h.value,y=h.property.specification.type,v=!!h.property.useIntegerZoom,b=c==="line-dasharray"||c.endsWith("pattern"),T=l.paint.get(`${c}-use-theme`),S=c==="line-dasharray"&&l.layout.get("line-cap").value.kind!=="constant"||T&&T.value.kind!=="constant";if(_.kind!=="constant"||S)if(_.kind==="source"||S||b){const A=Ny(c,y,"source");this.binders[c]=b?new ka(_,p,y,A,e.id):new Cl(_,p,y,A),s.push(`/a_${c}`)}else{const A=Ny(c,y,"composite");this.binders[c]=new Ba(_,p,y,v,t,A),s.push(`/z_${c}`)}else this.binders[c]=b?new rf(_.value,p):new jp(_.value,p,y,t),s.push(`/u_${c}`);T&&(this.binders[c].lutExpression=T.value)}this.cacheKey=s.sort().join("")}updateExpressions(e){const t=e;for(const n in this.binders){const s=this.binders[n];if(s instanceof Cl||s instanceof Ba||s instanceof ka){const l=t.paint.get(n);s.expression=l.value}}}getMaxValue(e){const t=this.binders[e];return t instanceof Cl||t instanceof Ba?t.maxValue:0}populatePaintArrays(e,t,n,s,l,c,h,p){for(const _ in this.binders){const y=this.binders[_];y.context=this.context,(y instanceof Cl||y instanceof Ba||y instanceof ka)&&y.populatePaintArray(e,t,n,s,l,c,h,p)}}setConstantPatternPositions(e,t){for(const n in this.binders){const s=this.binders[n];s instanceof rf&&s.setConstantPatternPositions(e,t)}}getPatternTransitionVertexBuffer(e){const t=this.binders[e];return t instanceof ka?t.paintTransitionVertexBuffer:null}updatePaintArrays(e,t,n,s,l,c,h,p,_,y){let v=!1;const b=Object.keys(e),T=b.length!==0&&!p,S=T?b:t.uniqueIds;this.context.lut=l.lut;for(const A in this.binders){const C=this.binders[A];if(C.context=this.context,(C instanceof Cl||C instanceof Ba||C instanceof ka)&&C.expression&&C.expression.kind&&C.expression.kind!=="constant"&&(C.expression.isStateDependent===!0||C.expression.isLightConstant===!1)){const D=l.paint.get(A);C.expression=D.value;for(const F of S){const O=e[F.toString()];t.eachPosition(F,(z,N,j)=>{const te=s.feature(z);C.updatePaintArray(N,j,te,O,c,h,_,y)})}if(!T)for(const F of n.uniqueIds){const O=e[F.toString()];n.eachPosition(F,(z,N,j)=>{const te=s.feature(z);C.updatePaintArray(N,j,te,O,c,h,_,y)})}v=!0}}return v}defines(){const e=[];for(const t in this.binders){const n=this.binders[t];(n instanceof jp||n instanceof rf)&&e.push(...n.uniformNames.map(s=>`#define HAS_UNIFORM_${s}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const n in this.binders){const s=this.binders[n];if(s instanceof jp||s instanceof rf||s instanceof Ba)for(const l of s.uniformNames)t.push({name:l,property:n,binding:s.getBinding(e,l)})}return t}setUniforms(e,t,n,s,l){for(const{name:c,property:h,binding:p}of n)this.binders[h].setUniform(e,p,l,s.get(h),c)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof Cl||t instanceof Ba||t instanceof ka)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer),t instanceof ka&&t.paintTransitionVertexBuffer&&this._buffers.push(t.paintTransitionVertexBuffer)}}upload(e){for(const t in this.binders){const n=this.binders[t];(n instanceof Cl||n instanceof Ba||n instanceof ka)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Cl||t instanceof Ba||t instanceof ka)&&t.destroy()}}}class sa{constructor(e,t,n=()=>!0){this.programConfigurations={};for(const s of e)this.programConfigurations[s.id]=new Au(s,t,n);this.needsUpload=!1,this._featureMap=new ys,this._featureMapWithoutIds=new ys,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,n,s,l,c,h,p,_){for(const y in this.programConfigurations)this.programConfigurations[y].populatePaintArrays(e,t,s,l,c,h,p,_);t.id!==void 0?this._featureMap.add(t.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,s,l,c,h,p){for(const _ of n)this.needsUpload=this.programConfigurations[_.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,_,s,l,c,h||0,p)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}updateExpressions(e){const t=new Set;for(const n of e){const s=this.programConfigurations[n.id];s&&(s.updateExpressions(n),t.add(n.id))}for(const n in this.programConfigurations)t.has(n)||delete this.programConfigurations[n]}}const Db={"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"]};function Lb(i,e){return Db[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}const zb={"line-pattern":{source:ot,composite:ot},"fill-pattern":{source:ot,composite:ot},"fill-extrusion-pattern":{source:ot,composite:ot},"line-dasharray":{source:et,composite:et}},Fb={color:{source:Ui,composite:Ge},number:{source:Ae,composite:Ui}};function Ny(i,e,t){const n=zb[i];return n&&n[t]||Fb[e][t]}tt(jp,"ConstantBinder"),tt(rf,"PatternConstantBinder"),tt(Cl,"SourceExpressionBinder",{omit:["expression"]}),tt(ka,"PatternCompositeBinder",{omit:["expression"]}),tt(Ba,"CompositeExpressionBinder",{omit:["expression"]}),tt(Au,"ProgramConfiguration",{omit:["_buffers"]}),tt(sa,"ProgramConfigurationSet");class U_{constructor(e,t,n){this.layoutVertexArray=new fe,this.indexArray=new bt,this.lineIndexArray=new dt,this.triangleSegments=new fi,this.lineSegments=new fi,this.programConfigurations=new sa(e,{zoom:t,lut:n}),this.uploaded=!1}update(e,t,n,s,l,c,h,p){this.programConfigurations.updatePaintArrays(e,t,l,n,s,c,h,p)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nr.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,t,n,s,l,c,h){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,n,s,l,c,void 0,h)}}tt(U_,"FillBufferData");class j_{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new U_(e.layers,e.zoom,e.lut),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.projection=e.projection,this.sourceLayerIndex=e.sourceLayerIndex,this.sourceLayerName=e.sourceLayerName||"",this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){this.hasPattern=Jd("fill",this.layers,this.pixelRatio,t);const l=this.layers[0].layout.get("fill-sort-key"),c=[];for(const{feature:h,id:p,index:_,sourceLayerIndex:y}of e){const v=this.layers[0]._featureFilter.needGeometry,b=X(h,v);if(!this.layers[0]._featureFilter.filter(new Oi(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),b,n))continue;const T=l?l.evaluate(b,{},n,t.availableImages):void 0,S={id:p,properties:h.properties,type:h.type,sourceLayerIndex:y,index:_,geometry:v?b.geometry:q(h,n,s),patterns:{},sortKey:T};c.push(S)}l&&c.sort((h,p)=>h.sortKey-p.sortKey);for(const h of c){const{geometry:p,index:_,sourceLayerIndex:y}=h;if(this.hasPattern){const v=wc("fill",this.layers,h,this.zoom,this.pixelRatio,t);this.patternFeatures.push(v)}else this.addFeature(h,p,_,n,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[_].feature,p,_,y,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}update(e,t,n,s,l,c,h){this.bufferData.update(e,t,n,s,l,c,h,this.worldview),this.hdExt&&this.hdExt.update(e,t,n,s,l,c,h,this.worldview)}updateExpressions(e){this.bufferData.programConfigurations.updateExpressions(e),this.hdExt&&this.hdExt.updateExpressions(e)}addFeatures(e,t,n,s,l,c){for(const h of this.patternFeatures)this.addFeature(h,h.geometry,h.index,t,n,s,c,e.elevationFeatures);this.hdExt&&this.hdExt.buildFrcSegments(this)}isEmpty(){return this.bufferData.isEmpty()&&(!this.hdExt||this.hdExt.isEmpty())}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.hdExt!=null&&this.hdExt.needsUpload()}upload(e){this.bufferData.upload(e),this.hdExt&&this.hdExt.upload(e)}destroy(){this.bufferData.destroy(),this.hdExt&&this.hdExt.destroy()}
vendor: 4,097 bytes, line 7
7addFeature(e,t,n,s,l,c=[],h,p){const _=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,y=this.bufferData.indexArray.length,v=Si(t,500);this.hdExt!=null&&this.hdExt.handleFeature(e,v,n,s,p,this)||this.addGeometry(v,this.bufferData),this.bufferData.populatePaintArrays(e,n,l,c,s,h,this.worldview),this.hdExt&&this.hdExt.populatePaintArrays(e,n,l,c,s,h,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,y,this.bufferData.indexArray.length,_)}addGeometry(e,t,n,s){let l=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,h=null;n&&(h=n.elevationSampler.constantElevation(n.elevation,n.bias),h!=null&&(l=h,c=h));const p=n?t:null,_=(y,v,b)=>{if(n!=null)if(v.push(y),h!=null)p.elevatedLayoutVertexArray.emplaceBack(h),b.push(h);else{const T=n.elevationSampler.pointElevation(y,n.elevation,n.bias);p.elevatedLayoutVertexArray.emplaceBack(T),b.push(T),l=Math.min(l,T),c=Math.max(c,T)}};for(const y of e){let v=0;for(const N of y)v+=N.length;const b=t.triangleSegments.prepareSegment(v,t.layoutVertexArray,t.indexArray),T=b.vertexLength,S=[],A=[],C=[],D=[],F=[],O=t.layoutVertexArray.length;for(const N of y){if(N.length===0)continue;N!==y[0]&&A.push(S.length/2);const j=t.lineSegments.prepareSegment(N.length,t.layoutVertexArray,t.lineIndexArray),te=j.vertexLength;n&&F.push(t.layoutVertexArray.length-O),_(N[0],C,D),t.layoutVertexArray.emplaceBack(N[0].x,N[0].y),t.lineIndexArray.emplaceBack(te+N.length-1,te),S.push(N[0].x),S.push(N[0].y);for(let G=1;G<N.length;G++)_(N[G],C,D),t.layoutVertexArray.emplaceBack(N[G].x,N[G].y),t.lineIndexArray.emplaceBack(te+G-1,te+G),S.push(N[G].x),S.push(N[G].y);j.vertexLength+=N.length,j.primitiveLength+=N.length}const z=vc(S,A);for(let N=0;N<z.length;N+=3)t.indexArray.emplaceBack(T+z[N],T+z[N+1],T+z[N+2]);if(z.length>0&&n&&s){const N=n.elevation.isTunnel(),j=n.elevation.safeArea,te=s.addVertices(C,D);s.addTriangles(z,te,N);const G=F.length;if(G>0){for(let W=0;W<G-1;W++)s.addRenderableRing(n.index,F[W]+te,F[W+1]-F[W],N,j,n.featureInfo);s.addRenderableRing(n.index,F[G-1]+te,C.length-F[G-1],N,j,n.featureInfo)}}b.vertexLength+=v,b.primitiveLength+=z.length/3}return[l,c]}}tt(j_,"FillBucket",{omit:["layers","patternFeatures"]});const Ob=ue([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),Bb=ue([{name:"a_z_offset_width",components:4,type:"Float32"}],4),kb=ue([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),Nb=ue([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:Vb}=Ob,Ub=ue([{name:"a_packed",components:3,type:"Float32"}]),{members:jb}=Ub,Gb=ue([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Hb}=Gb;class Ic{constructor(e,t,n,s,l){for(this.properties=Object.create(null),this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=s,this._values=l;e.pos<t;){const c=e.readVarint();if(c===8)this.id=e.readVarint();else if(c===18){const h=e.readVarint()+e.pos;for(;e.pos<h;){const p=s[e.readVarint()],_=l[e.readVarint()];this.properties[p]=_}}else c===24?this.type=e.readVarint():(c===34&&(this._geometry=e.pos),e.skip(c))}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,n=[];let s,l=1,c=0,h=0,p=0;for(;e.pos<t;){if(c<=0){const _=e.readVarint();if(l=7&_,c=_>>3,c===0)continue}if(c--,l===1)h+=e.readSVarint(),p+=e.readSVarint(),s&&n.push(s),s=[new Le(h,p)];else if(l===2)h+=e.readSVarint(),p+=e.readSVarint(),s&&s.push(new Le(h,p));else{if(l!==7)throw new Error(`unknown command ${l}`);s&&s.push(s[0].clone())}}return s&&n.push(s),n}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let n=1,s=0,l=0,c=0,h=1/0,p=-1/0,_=1/0,y=-1/0;for(;e.pos<t;){if(s<=0){const v=e.readVarint();if(n=7&v,s=v>>3,s===0)continue}if(s--,n===1||n===2)l+=e.readSVarint(),c+=e.readSVarint(),l<h&&(h=l),l>p&&(p=l),c<_&&(_=c),c>y&&(y=c);else if(n!==7)throw new Error(`unknown command ${n}`)}return[h,_,p,y]}
vendor: 9,588 bytes, line 7
7toGeoJSON(e,t,n){const s=this.extent*Math.pow(2,n),l=this.extent*e,c=this.extent*t,h=this.loadGeometry();function p(b){return[360*(b.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((1-2*(b.y+c)/s)*Math.PI))-90]}function _(b){return b.map(p)}let y;if(this.type===1){const b=[];for(const S of h)b.push(S[0]);const T=_(b);y=b.length===1?{type:"Point",coordinates:T[0]}:{type:"MultiPoint",coordinates:T}}else if(this.type===2){const b=h.map(_);y=b.length===1?{type:"LineString",coordinates:b[0]}:{type:"MultiLineString",coordinates:b}}else{if(this.type!==3)throw new Error("unknown feature type");{const b=function(S){const A=S.length;if(A<=1)return[S];const C=[];let D,F;for(let O=0;O<A;O++){const z=Zb(S[O]);z!==0&&(F===void 0&&(F=z<0),F===z<0?(D&&C.push(D),D=[S[O]]):D&&D.push(S[O]))}return D&&C.push(D),C}(h),T=[];for(const S of b)T.push(S.map(_));y=T.length===1?{type:"Polygon",coordinates:T[0]}:{type:"MultiPolygon",coordinates:T}}}const v={type:"Feature",geometry:y,properties:this.properties};return this.id!=null&&(v.id=this.id),v}}function Zb(i){let e=0;for(let t,n,s=0,l=i.length,c=l-1;s<l;c=s++)t=i[s],n=i[c],e+=(n.x-t.x)*(t.y+n.y);return e}Ic.types=["Unknown","Point","LineString","Polygon"];class $b{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],t===void 0&&(t=e.length);e.pos<t;){const n=e.readVarint();n===10?this.name=e.readString():n===18?(this._features.push(e.pos),e.skip(n)):n===26?this._keys.push(e.readString()):n===34?this._values.push(qb(e)):n===40?this.extent=e.readVarint():n===120?this.version=e.readVarint():e.skip(n)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Ic(this._pbf,t,this.extent,this._keys,this._values)}}function qb(i){let e=null;const t=i.readVarint()+i.pos;for(;i.pos<t;){const n=i.readVarint();e=n===10?i.readString():n===21?i.readFloat():n===25?i.readDouble():n===32?i.readVarint(!0):n===40?i.readVarint():n===48?i.readSVarint():n===56?i.readBoolean():(i.skip(n),null)}if(e==null)throw new Error("unknown feature value");return e}class G_{constructor(e,t=e.length){const n=Object.create(null);for(;e.pos<t;){const s=e.readVarint();if(s===26){const l=new $b(e,e.readVarint()+e.pos);l.length&&(n[l.name]=l)}else e.skip(s)}this.layers=n}}function H_(i,e){for(let t=0;t<i.length;t++)if(Ac(e,i[t]))return!0;for(let t=0;t<e.length;t++)if(Ac(i,e[t]))return!0;return!!$_(i,e)}function Wb(i,e,t){return!!Ac(i,e)||!!W_(e,i,t)}function Z_(i,e){if(i.length===1)return Uy(e,i[0]);for(let t=0;t<e.length;t++){const n=e[t];for(let s=0;s<n.length;s++)if(Ac(i,n[s]))return!0}for(let t=0;t<i.length;t++)if(Uy(e,i[t]))return!0;for(let t=0;t<e.length;t++)if($_(i,e[t]))return!0;return!1}function Xb(i,e,t){if(i.length>1){if($_(i,e))return!0;for(let n=0;n<e.length;n++)if(W_(e[n],i,t))return!0}for(let n=0;n<i.length;n++)if(W_(i[n],e,t))return!0;return!1}function $_(i,e){if(i.length===0||e.length===0)return!1;for(let t=0;t<i.length-1;t++){const n=i[t],s=i[t+1];for(let l=0;l<e.length-1;l++)if(Yb(n,s,e[l],e[l+1]))return!0}return!1}function Yb(i,e,t,n){return Uo(i,t,n)!==Uo(e,t,n)&&Uo(i,e,t)!==Uo(i,e,n)}function q_(i,e,t){return(i.x-t.x)*(e.y-t.y)-(i.y-t.y)*(e.x-t.x)}function Kb(i,e,t,n){const s=q_(i,e,n),l=q_(i,e,t);if(Math.sign(s)===Math.sign(l))return;const c=q_(t,n,i),h=c+l-s;return Math.sign(c)!==Math.sign(h)?[c/(c-h),l/(l-s)]:void 0}function W_(i,e,t){const n=t*t;if(e.length===1)return i.distSqr(e[0])<n;for(let s=1;s<e.length;s++)if(Vy(i,e[s-1],e[s])<n)return!0;return!1}function Vy(i,e,t){const n=e.distSqr(t);if(n===0)return i.distSqr(e);const s=((i.x-e.x)*(t.x-e.x)+(i.y-e.y)*(t.y-e.y))/n;return i.distSqr(s<0?e:s>1?t:t.sub(e)._mult(s)._add(e))}function Uy(i,e){let t,n,s,l=!1;for(let c=0;c<i.length;c++){t=i[c];for(let h=0,p=t.length-1;h<t.length;p=h++)n=t[h],s=t[p],n.y>e.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(l=!l)}return l}function Ac(i,e){let t=!1;for(let n=0,s=i.length-1;n<i.length;s=n++){const l=i[n],c=i[s];l.y>e.y!=c.y>e.y&&e.x<(c.x-l.x)*(e.y-l.y)/(c.y-l.y)+l.x&&(t=!t)}return t}function X_(i,e,t,n,s){for(const c of i)if(e<=c.x&&t<=c.y&&n>=c.x&&s>=c.y)return!0;const l=[new Le(e,t),new Le(e,s),new Le(n,s),new Le(n,t)];if(i.length>2){for(const c of l)if(Ac(i,c))return!0}for(let c=0;c<i.length-1;c++)if(zh(i[c],i[c+1],l))return!0;return!1}function zh(i,e,t){const n=t[0],s=t[2];if(i.x<n.x&&e.x<n.x||i.x>s.x&&e.x>s.x||i.y<n.y&&e.y<n.y||i.y>s.y&&e.y>s.y)return!1;const l=Uo(i,e,t[0]);return l!==Uo(i,e,t[1])||l!==Uo(i,e,t[2])||l!==Uo(i,e,t[3])}function Fh(i,e,t,n,s,l){let c=e.y-i.y,h=i.x-e.x;if(l=l||0){const p=c*c+h*h;if(p===0)return!0;const _=Math.sqrt(p);c/=_,h/=_}return!((t.x-i.x)*c+(t.y-i.y)*h-l<0||(n.x-i.x)*c+(n.y-i.y)*h-l<0||(s.x-i.x)*c+(s.y-i.y)*h-l<0)}function Y_(i,e,t,n,s,l,c){return!(Fh(i,e,n,s,l,c)||Fh(e,t,n,s,l,c)||Fh(t,i,n,s,l,c)||Fh(n,s,i,e,t,c)||Fh(s,l,i,e,t,c)||Fh(l,n,i,e,t,c))}class Cu extends Le{constructor(e,t,n){super(e,t),this.z=n}}class jy extends Cu{constructor(e,t,n,s){super(e,t,n),this.w=s}}function Gy(i,e,t,n){const s=t==="x"?"y":"x",l=(n-i[t])/(e[t]-i[t]);i[s]=Math.round(i[s]+(e[s]-i[s])*l),i[t]=n,Object.hasOwn(i,"z")&&(i.z=lt(i.z,e.z,l)),Object.hasOwn(i,"w")&&(i.w=lt(i.w,e.w,l))}function Hy(i,e,t,n){const s=t,l=n;for(const c of["x","y"]){let h=i,p=e;h[c]>=p[c]&&(h=e,p=i),h[c]<s&&p[c]>s&&Gy(h,p,c,s),h[c]<l&&p[c]>l&&Gy(p,h,c,l)}}function K_(i,e,t,n,s,l){const c=[];for(let h=0;h<i.length;h++){const p=i[h];let _;const y=c.length;let v=0;for(let b=0;b<p.length-1;b++){let T=p[b],S=p[b+1],A=0;const C=v;let D,F;l&&(A=Math.hypot(S.x-T.x,S.y-T.y),v+=A,D=T,F=S),T.x<e&&S.x<e||(T.x<e?T=new Le(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x<e&&(S=new Le(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y<t&&S.y<t||(T.y<t?T=new Le(T.x+(t-T.y)/(S.y-T.y)*(S.x-T.x),t)._round():S.y<t&&(S=new Le(T.x+(t-T.y)/(S.y-T.y)*(S.x-T.x),t)._round()),T.x>=n&&S.x>=n||(T.x>=n?T=new Le(n,T.y+(n-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x>=n&&(S=new Le(n,T.y+(n-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y>=s&&S.y>=s||(T.y>=s?T=new Le(T.x+(s-T.y)/(S.y-T.y)*(S.x-T.x),s)._round():S.y>=s&&(S=new Le(T.x+(s-T.y)/(S.y-T.y)*(S.x-T.x),s)._round()),_&&T.equals(_.at(-1))||(_=[T],c.push(_),l&&l.push({progress:{min:C+Zy(D,F,T)*A,max:1},parentIndex:h,prevPoint:D,nextPoint:F})),_.push(S),l&&(l.at(-1).progress.max=C+Zy(D,F,S)*A,l.at(-1).nextPoint=F)))))}if(l&&v>0)for(let b=y;b<c.length;b++)l[b].progress.min/=v,l[b].progress.max/=v}return c}function Jb(i,e,t,n,s){if(i.length<2)return void n.push(i);const l=[];for(;e.valid();){const[_,y]=e.get();for(let v=0;v<i.length-1;v++){const b=i[v],T=i[v+1],S=Kb(b,T,_,y);if(S){const[A]=S,C=new Le(lt(b.x,T.x,A),lt(b.y,T.y,A));l.push({t:v+A,distance:0,point:C})}}e.next()}if(l.length===0)return void n.push(i);l.sort((_,y)=>_.t-y.t);let c=0,h=0,p=[];for(n.push(p);c!==i.length;){if(h===l.length){for(;c!==i.length;)p.length!==0&&p.at(-1).equals(i[c])||p.push(i[c]),c++;break}l[h].t<=c?(p.length!==0&&p.at(-1).equals(l[h].point)||p.push(l[h].point),Math.trunc(l[h].t),h++):(p.length!==0&&p.at(-1).equals(i[c])||p.push(i[c]),c++)}}function Zy(i,e,t){return i.x!==e.x?(t.x-i.x)/(e.x-i.x):i.y!==e.y?(t.y-i.y)/(e.y-i.y):0}function $y(i,{width:e,height:t},n,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==e*t*n)throw new RangeError("mismatched image size")}else s=new Uint8Array(e*t*n);return i.width=e,i.height=t,i.data=s,i}function qy(i,e,t){const{width:n,height:s}=e;n===i.width&&s===i.height||(J_(i,e,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,n),height:Math.min(i.height,s)},t,null),i.width=n,i.height=s,i.data=e.data)}function J_(i,e,t,n,s,l,c,h){if(s.width===0||s.height===0)return e;if(s.width>i.width||s.height>i.height||t.x>i.width-s.width||t.y>i.height-s.height)throw new RangeError("out of range source coordinates for image copy");if(s.width>e.width||s.height>e.height||n.x>e.width-s.width||n.y>e.height-s.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,_=e.data,y=l===4&&h;for(let v=0;v<s.height;v++){const b=((t.y+v)*i.width+t.x)*l,T=((n.y+v)*e.width+n.x)*l;if(y)for(let S=0;S<s.width;S++){const A=b+S*l+3,C=T+S*l;_[C+0]=255,_[C+1]=255,_[C+2]=255,_[C+3]=p[A]}else if(c)for(let S=0;S<s.width;S++){const A=b+S*l,C=T+S*l,D=new Lt(p[A+0]/255,p[A+1]/255,p[A+2]/255,p[A+3]).toNonPremultipliedRenderColor(c).toArray();_[C+0]=D[0],_[C+1]=D[1],_[C+2]=D[2],_[C+3]=D[3]}else for(let S=0;S<s.width*l;S++)_[T+S]=p[b+S]}return e}class Cc{constructor(e,t){$y(this,e,1,t)}resize(e){qy(this,new Cc(e),1)}clone(){return new Cc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,s,l){J_(e,t,n,s,l,1,null)}}class An{constructor(e,t){$y(this,e,4,t)}resize(e){qy(this,new An(e),4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new An({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,s,l,c,h){J_(e,t,n,s,l,4,c,h)}}class Wy{constructor(e,t){this.width=e.width,this.height=e.height,this.data=t instanceof Uint8Array?new Float32Array(t.buffer):t}}tt(Cc,"AlphaImage"),tt(An,"RGBAImage");class Xy{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Cc({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const n=this.getKey(e,t);return this.positions[n]}trim(){const e=this.width,t=this.height=Yl(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}
vendor: 8,716 bytes, line 7
7getDashRanges(e,t,n){const s=[];let l=e.length%2==1?-e.at(-1)*n:0,c=e[0]*n,h=!0;s.push({left:l,right:c,isDash:h,zeroLength:e[0]===0});let p=e[0];for(let _=1;_<e.length;_++){h=!h;const y=e[_];l=p*n,p+=y,c=p*n,s.push({left:l,right:c,isDash:h,zeroLength:y===0})}return s}addRoundDash(e,t,n){const s=t/2;for(let l=-n;l<=n;l++){const c=this.width*(this.nextRow+n+l);let h=0,p=e[h];for(let _=0;_<this.width;_++){_/p.right>1&&(p=e[++h]);const y=Math.abs(_-p.left),v=Math.abs(_-p.right),b=Math.min(y,v);let T;const S=l/n*(s+1);if(p.isDash){const A=s-Math.abs(S);T=Math.sqrt(b*b+A*A)}else T=s-Math.sqrt(b*b+S*S);this.image.data[c+_]=Math.max(0,Math.min(255,T+128))}}}addRegularDash(e,t){for(let p=e.length-1;p>=0;--p){const _=e[p],y=e[p+1];_.zeroLength?e.splice(p,1):y&&y.isDash===_.isDash&&(y.left=_.left,e.splice(p,1))}const n=e[0],s=e.at(-1);n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const l=this.width*this.nextRow;let c=0,h=e[c];for(let p=0;p<this.width;p++){p/h.right>1&&(h=e[++c]);const _=Math.abs(p-h.left),y=Math.abs(p-h.right),v=Math.min(_,y);this.image.data[l+p]=Math.max(0,Math.min(255,(h.isDash?v:-v)+t+128))}}addDash(e,t){const n=this.getKey(e,t);if(this.positions[n])return this.positions[n];const s=t==="round",l=s?7:0,c=2*l+1;if(this.nextRow+c>this.height)return gi("LineAtlas out of space"),null;e.length===0&&e.push(1);let h=0;for(let v=0;v<e.length;v++)e[v]<0&&(gi("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),h+=e[v];if(h!==0){const v=this.width/h,b=this.getDashRanges(e,this.width,v);s?this.addRoundDash(b,v,l):this.addRegularDash(b,t==="square"?.5*v:0)}const p=this.nextRow+l;this.nextRow+=c;const _=Math.floor(h),y={tl:[p,l],br:[_,Math.round(65535*(h-_))]};return this.positions[n]=y,y}}tt(Xy,"LineAtlas");const Ml="3d_elevation_id",Yy="level",Qb=Ic.types,ew=Math.cos(Math.PI/180*37.5),tw=Math.cos(Math.PI/180*5);class Q_{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,this.terrainEnabled=!1,this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.borderGradients={},this.layers.forEach(t=>{this.gradients[t.id]={},this.borderGradients[t.id]={}}),this.layoutVertexArray=new Ve,this.layoutVertexArray2=new $e,this.patternVertexArray=new $e,this.indexArray=new bt,this.programConfigurations=new sa(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new fi,this.sourceLayerName=e.sourceLayerName||"",this.maxLineLength=0,this.zOffsetVertexArray=new Ge,this.elevationIdColVertexArray=new $e,this.elevationGroundScaleVertexArray=new Ae,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){this.showElevationIdDebug=t.showElevationIdDebug,this.terrainEnabled=t.terrainEnabled,this.hasPattern=Jd("line",this.layers,this.pixelRatio,t);const l=this.layers[0].layout.get("line-sort-key");this.tileToMeter=w(n);const c=this.layers[0].layout.get("line-elevation-reference");if(c==="hd-road-markup")this.elevationType="road";else{const b=this.layers[0].layout.get("line-z-offset"),T=b.isConstant()&&!b.constantOr(0);this.elevationType=c!=="sea"&&c!=="ground"&&T?"none":"offset",this.elevationType==="offset"&&c==="none"&&gi(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference=c==="sea"}const h=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&h!==void 0;const p=[];for(const{feature:b,id:T,index:S,sourceLayerIndex:A}of e){const C=this.layers[0]._featureFilter.needGeometry,D=X(b,C);if(!this.layers[0]._featureFilter.filter(new Oi(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),D,n))continue;const F=l?l.evaluate(D,{},n):void 0,O={id:T,properties:b.properties,type:b.type,sourceLayerIndex:A,index:S,geometry:C?D.geometry:q(b,n,s),patterns:{},sortKey:F};p.push(O)}l&&p.sort((b,T)=>b.sortKey-T.sortKey);const{lineAtlas:_,featureIndex:y}=t,v=this.addConstantDashes(_);for(const b of p){const{geometry:T,index:S,sourceLayerIndex:A}=b;if(v&&this.addFeatureDashes(b,_),this.hasPattern){const C=wc("line",this.layers,b,this.zoom,this.pixelRatio,t);this.patternFeatures.push(C)}else this.addFeature(b,T,S,n,_.positions,t.availableImages,t.brightness,t.elevationFeatures,t.elevationParams,t.crossSourceElevationEnabled);y.insert(e[S].feature,T,S,A,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this),this.hdExt&&this.hdExt.endPopulate()}addConstantDashes(e){let t=!1;for(const n of this.layers){const s=n.paint.get("line-dasharray").value,l=n.layout.get("line-cap").value;if(s.kind!=="constant"||l.kind!=="constant")t=!0;else{const c=l.value,h=s.value;if(!h)continue;e.addDash(h,c)}}return t}addFeatureDashes(e,t){const n=this.zoom;for(const s of this.layers){const l=s.paint.get("line-dasharray").value,c=s.layout.get("line-cap").value;if(l.kind==="constant"&&c.kind==="constant")continue;let h,p;if(l.kind==="constant"){if(h=l.value,!h)continue}else h=l.evaluate({zoom:n},e);p=c.kind==="constant"?c.value:c.evaluate({zoom:n},e),t.addDash(h,p),e.patterns[s.id]=[t.getKey(h,p)]}}update(e,t,n,s,l,c,h,p,_){this.programConfigurations.updatePaintArrays(e,t,l,n,s,c,h,_)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}addFeatures(e,t,n,s,l,c){for(const h of this.patternFeatures)this.addFeature(h,h.geometry,h.index,t,n,s,c,e.elevationFeatures,e.elevationParams,e.crossSourceElevationEnabled);this.hdExt&&(this.hdExt.buildFrcSegments(this),this.hdExt.endPopulate())}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,jb)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Hb)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Bb.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=e.createVertexBuffer(this.elevationIdColVertexArray,kb.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,Nb.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vb),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationIdColVertexBuffer&&this.elevationIdColVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,t){let n,s;if(t&&t>0?(n=`mapbox_clip_start_${t}`,s=`mapbox_clip_end_${t}`):(n="mapbox_clip_start",s="mapbox_clip_end"),e.properties&&Object.hasOwn(e.properties,n)&&Object.hasOwn(e.properties,s))return{start:+e.properties[n],end:+e.properties[s]}}addFeature(e,t,n,s,l,c,h,p,_,y){const v=this.layers[0].layout,b=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,T=this.indexArray.length,S=v.get("line-join").evaluate(e,{}),A=v.get("line-cap").evaluate(e,{}),C=v.get("line-miter-limit"),D=v.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const F=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=v.get("line-z-offset").value;const O=this.layers[0].paint,z=O.get("line-width").value;z.kind!=="constant"&&z.isLineProgressConstant===!1&&(this.variableWidthValue=z);const N=O.get("line-emissive-strength").value;if(N.kind!=="constant"&&N.isLineProgressConstant===!1&&(this.variableEmissiveStrengthValue=N),this.isSeaLevelReference){const j=v.get("line-elevation-ground-scale").value;j.kind==="constant"&&j.value===0||(this.elevationGroundScaleValue=j)}
vendor: 4,196 bytes, line 7
7if(this.hdExt==null||!this.hdExt.handleFeature(e,t,s,p,_,!!y,S,A,C,D,this))for(let j=0;j<t.length;j++)this.addLine(t[j],e,s,S,A,C,D,void 0,F&&j>0?j:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,c,s,h,void 0,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,T,this.indexArray.length,b)}fillNonElevatedRoadSegment(e){for(let t=Math.max(e,this.zOffsetVertexArray.length);t<this.layoutVertexArray.length;t++)this.zOffsetVertexArray.emplaceBack(0,0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}addLine(e,t,n,s,l,c,h,p,_){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=_?this.lineFeatureClips(t,_):this.lineClips;const y=s==="none";this.patternJoinNone=this.hasPattern&&y,this.currentLineJoinType=s,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const v=p&&p.progress.min>0,b=p&&p.progress.max<1;if(this.lineClips){let W={min:this.lineClips.start,max:this.lineClips.end},K=1;if(p){const de=this.lineClips.end-this.lineClips.start;W=function(ve,xe,we){return{min:Ku(ve.min,xe,we),max:Ku(ve.max,xe,we)}}(p.progress,{min:0,max:1},W),de>0&&(K=(W.max-W.min)/de)}const ee=+t.properties.mapbox_clip_feature_len,le=+t.properties.mapbox_clip_seg_len;if(Number.isNaN(ee)||Number.isNaN(le)){for(let ve=0;ve<e.length-1;ve++)this.totalDistance+=e[ve].dist(e[ve+1]);const de=this.totalDistance/(W.max-W.min);this.totalFeatureLength=Number.isFinite(de)?de:0,this.lineClips.start=W.min,this.lineClips.end=W.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=ee,this.distance=le*K,this.lineClips.start=W.min,this.lineClips.end=W.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const T=Qb[t.type]==="Polygon";let S=e.length;for(;S>=2&&e[S-1].equals(e[S-2]);)S--;let A=0;for(;A<S-1&&e[A].equals(e[A+1]);)A++;if(S<(T?3:2))return;s==="bevel"&&(c=1.05);const C=this.segments.prepareSegment(10*S,this.layoutVertexArray,this.indexArray);let D,F,O,z,N,j,te,G;p&&p.prevDir&&(j=p.prevDir.perp()),p&&p.nextDir&&(te=p.nextDir.perp()),this.e1=this.e2=-1,T&&(D=e[S-2],N=e[A].sub(D)._unit()._perp());for(let W=A;W<S;W++){if(O=W===S-1?T?e[A+1]:void 0:e[W+1],O&&e[W].equals(O))continue;N&&(z=N),D&&(F=D),D=e[W],G=this.evaluateLineProgressFeatures(F?F.dist(D):0),N=O?O.sub(D)._unit()._perp():z,z=z||N;const K=F&&O;let ee=K?s:T||y?"butt":l;const le=z.x*N.x+z.y*N.y;if(y){const ge=function(Se){if(Se.patternJoinNone){const Me=Se.segmentPoints.length/2,Pe=Se.lineSoFar-Se.segmentStart;for(let Ie=0;Ie<Me;++Ie){const Oe=Se.segmentPoints[2*Ie+1],Be=Math.round(Se.segmentPoints[2*Ie])+.5+.25*Oe;Se.patternVertexArray.emplaceBack(Be,Pe,Se.segmentStart),Se.patternVertexArray.emplaceBack(Be,Pe,Se.segmentStart)}Se.segmentPoints.length=0}Se.e1=Se.e2=-1};if(K&&le<tw){this.updateDistance(F,D),this.addCurrentVertex(D,z,1,1,C,G),ge(this),this.addCurrentVertex(D,N,-1,-1,C,G);continue}if(F){if(!O){this.updateDistance(F,D),this.addCurrentVertex(D,z,1,1,C,G),ge(this);continue}ee="miter"}}let de=z.add(N);de.x===0&&de.y===0||de._unit();const ve=de.x*N.x+de.y*N.y,xe=ve!==0?1/ve:1/0,we=2*Math.sqrt(2-2*ve),Fe=ve<ew&&F&&O,se=z.x*N.y-z.y*N.x>0,pe=this.overscaling<=16?122880/(512*this.overscaling):0;if(K&&ee==="round"){if(xe<h)ee="miter";else if(xe<=2){const ge=eg(D,-10,8202);ee=this.elevationType==="offset"&&(ge||this.hasCrossSlope)?"miter":"fakeround"}}if(ee==="miter"&&xe>c&&(ee="bevel"),ee==="bevel"&&(xe>2&&(ee="flipbevel"),xe<c&&(ee="miter")),F&&!(ee==="miter"&&Fe)&&this.updateDistance(F,D),ee==="miter")if(Fe){const ge=D.dist(F);if(ge>2*pe){const Me=D.sub(D.sub(F)._mult(pe/ge)._round());this.updateDistance(F,Me),this.addCurrentVertex(Me,z,0,0,C,G),F=Me}this.updateDistance(F,D),de._mult(xe),this.addCurrentVertex(D,de,0,0,C,G);const Se=D.dist(O);if(Se>2*pe){const Me=D.add(O.sub(D)._mult(pe/Se)._round());this.updateDistance(D,Me),this.addCurrentVertex(Me,N,0,0,C,G),D=Me}}else de._mult(xe),this.addCurrentVertex(D,de,0,0,C,G);else if(ee==="flipbevel"){if(xe>100)de=N.mult(-1);
7else{const ge=xe*z.add(N).mag()/z.sub(N).mag();de._perp()._mult(ge*(se?-1:1))}this.addCurrentVertex(D,de,0,0,C,G),this.addCurrentVertex(D,de.mult(-1),0,0,C,G)}else if(ee==="bevel"||ee==="fakeround"){const ge=D.dist(F);let Se=1;if(this.elevationType==="offset"&&ee==="bevel"&&this.currentLineJoinType!=="round"&&!this.patternJoinNone&&G!=null&&F&&O){const Ke=4*pe;ge<Ke&&(Se=Math.max(0,ge/Ke))}G!=null&&F&&this.addCurrentVertex(D,te||z,-Se,-Se,C,G);const Me=ge<=2*pe&&ee!=="bevel",Pe=de.mult(se?1:-1);Pe._mult(xe);const Ie=N.mult(se?-1:1),Oe=z.mult(se?-1:1),Be=this.evaluateLineProgressFeatures(this.distance);if(G==null&&(this.addHalfVertex(D,Pe.x,Pe.y,!1,!se,0,C,Be),Me||this.addHalfVertex(D,Pe.x+2*Oe.x,Pe.y+2*Oe.y,!1,se,0,C,Be)),ee==="fakeround"){const Ke=Math.round(180*we/Math.PI/20);this.addHalfVertex(D,Oe.x,Oe.y,!1,se,0,C,Be);for(let Ne=0;Ne<Ke;Ne++){let He=Ne/Ke;if(He!==.5){const pt=He-.5;He+=He*pt*(He-1)*((1.0904+le*(le*(3.55645-1.43519*le)-3.2452))*pt*pt+(.848013+le*(.215638*le-1.06021)))}const ft=Ie.sub(Oe)._mult(He)._add(Oe)._unit();this.addHalfVertex(D,ft.x,ft.y,!1,se,0,C,Be)}this.addHalfVertex(D,Ie.x,Ie.y,!1,se,0,C,Be)}Me||G!=null||this.addHalfVertex(D,Pe.x+2*Ie.x,Pe.y+2*Ie.y,!1,se,0,C,Be),G!=null&&O&&this.addCurrentVertex(D,j||N,Se,Se,C,G)}else if(ee==="butt")this.addCurrentVertex(D,de,0,0,C,G);else if(ee==="square"){if(!F){const ge=v?0:-1;this.addCurrentVertex(D,de,ge,ge,C,G)}if(this.addCurrentVertex(D,de,0,0,C,G),F){const ge=b?0:1;this.addCurrentVertex(D,de,ge,ge,C,G)}}else if(ee==="round"){if(F){const ge=!K&&te?te:z;this.addCurrentVertex(D,ge,0,0,C,G),!K&&b||this.addCurrentVertex(D,ge,1,1,C,G,!0)}if(O){const ge=!K&&j?j:N;!K&&v||this.addCurrentVertex(D,ge,-1,-1,C,G,!0),this.addCurrentVertex(D,ge,0,0,C,G)}}}}addVerticesTo(e,t,n,s,l,c,h,p,_,y){const v=(t.w-e.w)/this.tessellationStep|0;let b=0;const T=this.scaledDistance;if(v>1){this.lineSoFar=e.w;const A=(t.x-e.x)/v,C=(t.y-e.y)/v,D=(t.z-e.z)/v,F=(t.w-e.w)/v,O=t.x-e.x,z=t.y-e.y,N=Math.sqrt(O*O+z*z);if(N===0)return;const j=-z/N,te=O/N,G=j,W=te,K=-j,ee=-te;for(let le=1;le<v;++le){e.x+=A,e.y+=C,e.z+=D,this.lineSoFar+=F,b+=F;const de=this.evaluateLineProgressFeatures(this.prevDistance+b);this.scaledDistance=(this.prevDistance+b)/this.totalDistance,this.addHalfVertex(e,G,W,y,!1,0,_,de),this.addHalfVertex(e,K,ee,y,!0,0,_,de)}}this.lineSoFar=t.w,this.scaledDistance=T;const S=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(t,n,s,y,!1,h,_,S),this.addHalfVertex(t,l,c,y,!0,-p,_,S)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&!this.variableEmissiveStrengthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):gi(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let t=0;this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(t=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,t*=.5);let n=0;this.variableEmissiveStrengthValue&&this.variableEmissiveStrengthValue.kind!=="constant"&&(n=this.variableEmissiveStrengthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);const s=this.evaluateElevationGroundScale();return this.elevationType!=="offset"?{zOffset:0,variableWidth:t,elevationGroundScale:s,variableEmissiveStrength:n}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:t,elevationGroundScale:s,variableEmissiveStrength:n}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:t,elevationGroundScale:s,variableEmissiveStrength:n}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?this.elevationGroundScaleValue.kind==="constant"?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(e,t,n,s,l,c,h=!1){const p=t.x+t.y*n,_=t.y-t.x*n,y=t.y*s-t.x,v=-t.y-t.x*s;if(c!=null){const b=this.elevationType==="offset",T=this.elevationType==="offset"?2:10,S=-T,A=We+T,C=c.zOffset,D=new jy(e.x,e.y,C,this.lineS
vendor: 4,327 bytes, line 7
7oFar),F=!!b&&eg(e,S,A),O=this.lineSoFar,z=this.distance;if(this.currentVertex)if(F){const N=this.currentVertexIsOutside,j=this.currentVertex,te=new jy(e.x,e.y,C,this.lineSoFar);if(Hy(j,te,S,A),!eg(te,S,A)){if(N){this.e1=this.e2=-1,this.distance-=j.dist(D),this.lineSoFar=j.w;const G=this.evaluateLineProgressFeatures(j.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(j,p,_,h,!1,n,l,G),this.addHalfVertex(j,y,v,h,!0,-s,l,G),this.prevDistance=this.distance}this.distance=this.prevDistance+j.dist(te),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(j,te,p,_,y,v,n,s,l,h),this.distance=z,this.scaledDistance=this.distance/this.totalDistance}}else{const N=this.currentVertex;if(this.currentVertexIsOutside){Hy(N,D,S,A),this.e1=this.e2=-1,this.distance-=N.dist(D),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=N.w;const j=this.evaluateLineProgressFeatures(N.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(N,p,_,h,!1,n,l,j),this.addHalfVertex(N,y,v,h,!0,-s,l,j),this.prevDistance=this.distance,this.distance=z,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(N,D,p,_,y,v,n,s,l,h)}else F||(this.addHalfVertex(e,p,_,h,!1,n,l,c),this.addHalfVertex(e,y,v,h,!0,-s,l,c));this.currentVertex=D,this.currentVertexIsOutside=F,this.lineSoFar=O}else this.addHalfVertex(e,p,_,h,!1,n,l,c),this.addHalfVertex(e,y,v,h,!0,-s,l,c)}addHalfVertex({x:e,y:t},n,s,l,c,h,p,_){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),c||this.segmentPoints.push(this.lineSoFar-this.segmentStart,h)),this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(t<<1)+(c?1:0),Math.round(63*n)+128,Math.round(63*s)+128,1+(h===0?0:h<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const v=lt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,v)}const y=p.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,y),p.primitiveLength++),c?this.e2=y:this.e1=y,_!=null&&(this.zOffsetVertexArray.emplaceBack(_.zOffset,_.variableWidth,_.variableWidth,_.variableEmissiveStrength),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){const v=_?_.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(v)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function eg(i,e,t){return i.x<e||i.x>t||i.y<e||i.y>t}tt(Q_,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const iw=ue([{name:"a_pos",components:2,type:"Int16"}],4),rw=ue([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),nw=ue([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Gp{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new fe,this.indexArray=new bt,this.segments=new fi,this.programConfigurations=new sa(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){const l=this.layers[0],c=[];let h=null;l.type==="circle"&&(h=l.layout.get("circle-sort-key"));for(const{feature:_,id:y,index:v,sourceLayerIndex:b}of e){const T=this.layers[0]._featureFilter.needGeometry,S=X(_,T);if(!this.layers[0]._featureFilter.filter(new Oi(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),S,n))continue;const A=h?h.evaluate(S,{},n):void 0,C={id:y,properties:_.properties,type:_.type,sourceLayerIndex:b,index:v,geometry:T?S.geometry:q(_,n,s),patterns:{},sortKey:A};c.push(C)}h&&c.sort((_,y)=>
vendor: 6,257 bytes, line 7
7_.sortKey-y.sortKey);let p=null;s.projection.name==="globe"&&(this.globeExtVertexArray=new Xe,p=s.projection);for(const _ of c){const{geometry:y,index:v,sourceLayerIndex:b}=_,T=e[v].feature;this.addFeature(_,y,v,t.availableImages,n,p,t.brightness,t.elevationFeatures),t.featureIndex.insert(T,y,v,b,this.index)}this.hdExt&&this.hdExt.finalize()}update(e,t,n,s,l,c,h){this.programConfigurations.updatePaintArrays(e,t,l,n,s,c,h,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,iw.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,nw.members)),this.hdExt&&this.hdExt.upload(e)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.hdExt&&this.hdExt.destroy())}addFeature(e,t,n,s,l,c,h,p){this.hdExt&&this.hdExt.beginFeature(e,p,l);for(const _ of t)for(const y of _){const v=y.x,b=y.y;if(v<0||v>=We||b<0||b>=We)continue;if(c){const A=c.projectTilePoint(v,b,l),C=c.upVector(l,v,b);this.addGlobeExtVertex(A,C),this.addGlobeExtVertex(A,C),this.addGlobeExtVertex(A,C),this.addGlobeExtVertex(A,C)}const T=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),S=T.vertexLength;this.addCircleVertex(v,b,-1,-1),this.addCircleVertex(v,b,1,-1),this.addCircleVertex(v,b,1,1),this.addCircleVertex(v,b,-1,1),this.hdExt&&this.hdExt.writeVertexQuad(v,b),this.indexArray.emplaceBack(S,S+1,S+2),this.indexArray.emplaceBack(S,S+2,S+3),T.vertexLength+=4,T.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},s,l,h,void 0,this.worldview)}addCircleVertex(e,t,n,s){this.layoutVertexArray.emplaceBack(2*e+(n+1)/2,2*t+(s+1)/2)}addGlobeExtVertex(e,t){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,t[0]*16384,t[1]*16384,t[2]*16384)}}tt(Gp,"CircleBucket",{omit:["layers"]});const ow=ue([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),sw=ue([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),aw=ue([{name:"a_projected_pos",components:4,type:"Float32"}],4);ue([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const lw=ue([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),cw=ue([{name:"a_feature_index",components:1,type:"Float32"}],4),uw=ue([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),hw=ue([{name:"a_texb",components:2,type:"Uint16"}]),dw=ue([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),fw=ue([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);ue([{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"}]);const Ky=ue([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),pw=ue([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ue([{name:"triangle",components:3,type:"Uint16"}]),ue([{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"}]),ue([{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"}
vendor: 8,469 bytes, line 7
7]),ue([{type:"Float32",name:"offsetX"}]),ue([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const Jy=new Float32Array(1),mw=new Uint32Array(Jy.buffer);function Hp(i){return Jy[0]=i,mw[0]}const Oh=class td{static getBlockIndices(e){let t=td._blockIndicesTemplate;if(!t){t=td._blockIndicesTemplate=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=n}return t}constructor(e,t,n,s){this.batchIndex=t,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=e||null,this.propsDwords=n,this.totalBytes=4*this.propsDwords,this.headerData=s,this.propertiesData=new Float32Array(this.propsDwords),this._headerDirty=!0,this._propsDirtyMin=-1,this._propsDirtyMax=-1,this._blockIndicesDirty=!0,e&&this._initBuffers(e)}_initBuffers(e){const t=e.gl;if(this.totalBytes>e.maxUniformBlockSize)throw new Error(`UBO size ${this.totalBytes} exceeds device limit ${e.maxUniformBlockSize}`);if(this.headerBuffer=t.createBuffer(),!this.headerBuffer)throw new Error("Failed to create header UBO buffer");if(t.bindBuffer(t.UNIFORM_BUFFER,this.headerBuffer),t.bufferData(t.UNIFORM_BUFFER,td.HEADER_BYTES,t.DYNAMIC_DRAW),this.propertiesBuffer=t.createBuffer(),!this.propertiesBuffer)throw new Error("Failed to create properties UBO buffer");if(t.bindBuffer(t.UNIFORM_BUFFER,this.propertiesBuffer),t.bufferData(t.UNIFORM_BUFFER,this.totalBytes,t.DYNAMIC_DRAW),this.blockIndicesBuffer=t.createBuffer(),!this.blockIndicesBuffer)throw new Error("Failed to create block-indices UBO buffer");t.bindBuffer(t.UNIFORM_BUFFER,this.blockIndicesBuffer),t.bufferData(t.UNIFORM_BUFFER,this.totalBytes,t.DYNAMIC_DRAW),t.bindBuffer(t.UNIFORM_BUFFER,null)}markHeaderDirty(){this._headerDirty=!0}writeDataDrivenBlock(e,t){const n=this.headerData,s=4*n[2];if(s===0)return;const l=t*s;if(l+s>this.propertiesData.length)throw new Error(`UBO write out of bounds: feature index ${t} exceeds propertiesData capacity`);const c=n[0];for(let p=0;p<9;p++)c&1<<p&&this._copyFromFlat(l+4*n[3+p],p,e);(this._propsDirtyMin===-1||l<this._propsDirtyMin)&&(this._propsDirtyMin=l);const h=l+s;h>this._propsDirtyMax&&(this._propsDirtyMax=h)}rightSizeForTransfer(){const e=this._propsDirtyMax===-1?0:this._propsDirtyMax;e<this.propertiesData.length&&(this.propertiesData=this.propertiesData.slice(0,e))}_copyFromFlat(e,t,n){let s=4;(t<2||t===8)&&(s=this.headerData[1]>>>t&1?8:4);const l=td.EVAL_FLAT_OFFSETS[t];this.propertiesData.set(n.subarray(l,l+s),e)}upload(e){this.context||(this.context=e);const t=e.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(e);let n=!1;if(this._headerDirty&&(t.bindBuffer(t.UNIFORM_BUFFER,this.headerBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.headerData),this._headerDirty=!1,n=!0),this._propsDirtyMin!==-1){const s=this._propsDirtyMin,l=this._propsDirtyMax;t.bindBuffer(t.UNIFORM_BUFFER,this.propertiesBuffer),t.bufferSubData(t.UNIFORM_BUFFER,4*s,this.propertiesData,s,l-s),this._propsDirtyMin=-1,this._propsDirtyMax=-1,n=!0}this._blockIndicesDirty&&(t.bindBuffer(t.UNIFORM_BUFFER,this.blockIndicesBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,td.getBlockIndices(this.propsDwords)),this._blockIndicesDirty=!1,n=!0),n&&t.bindBuffer(t.UNIFORM_BUFFER,null)}bind(e,t){const n=e.gl,s=(c,h,p)=>{if(!h)return;const _=n.getUniformBlockIndex(t,c);_!==n.INVALID_INDEX&&(n.uniformBlockBinding(t,_,p),n.bindBufferBase(n.UNIFORM_BUFFER,p,h))},l=3*this.batchIndex;s("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,l),s("SymbolPaintPropertiesUniform",this.propertiesBuffer,l+1),s("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,l+2)}destroy(){if(this.context){const e=this.context.gl;this.headerBuffer&&(e.deleteBuffer(this.headerBuffer),this.headerBuffer=null),this.propertiesBuffer&&(e.deleteBuffer(this.propertiesBuffer),this.propertiesBuffer=null),this.blockIndicesBuffer&&(e.deleteBuffer(this.blockIndicesBuffer),this.blockIndicesBuffer=null)}}};Oh.HEADER_DWORDS=16,Oh.HEADER_BYTES=64,Oh.EVAL_FLAT_OFFSETS=[0,8,16,20,24,28,32,36,40],Oh.EVAL_FLAT_TOTAL=48,Oh._blockIndicesTemplate=null;let nf=Oh;function Qy(i,e,t,n,s,l,c,h){return!!i&&(i.kind==="constant"?i.value==="none":i.evaluate({zoom:0,brightness:l,worldview:h},e,t,s,n,c)==="none")}function ex(i){if(!(i instanceof na))return!1;const e=i.value;return(e.kind==="source"||e.kind==="composite")&&e.isStateDependent}tt(nf,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});const of=["icon","text"].map(i=>[`${i}-color`,`${i}-halo-color`,`${i}-opacity`,`${i}-halo-width`,`${i}-halo-blur`,`${i}-emissive-strength`,`${i}-occlusion-opacity`,"symbol-z-offset",`${i}-translate`]),ur=new Float32Array(nf.EVAL_FLAT_TOTAL),_w=[0,0],tx=new WeakMap;class tg{constructor(e,t,n,s,l="",c,h){this.layer=e,this.zoom=t,this.lut=n,this.isText=s,this.worldview=l,this.maxUniformBufferBindings=c||24,this.uboSizeDwords=h||4096,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.allFormattedSections=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.ubos=[],this.featureCount=0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.cachedConstantPaint=null,this.activeAppearanceByVtIndex=null,this.zoomDependency=new Uint8Array(9),this.sharedZoomRanges=new Float32Array(18),this._zoomRangeScratch=new Float32Array(2),this._floorZoom=Math.floor(this.zoom),this.header=new Uint32Array(nf.HEADER_DWORDS),this.updateHeader(),this.isAllConstant=this.header[0]===0;const p=4*this.header[2];this.maxFeaturesPerBatch=p===0?Number.MAX_SAFE_INTEGER:Math.floor(this.uboSizeDwords/p)}updateHeader(){const e=this.layer.paint;let t=0,n=0,s=0,l=0,c=!0;const h=this._floorZoom,p=of[+this.isText];for(let _=0;_<9;_++){const y=p[_],v=_<2,b=e.get(y),T=!(!b||typeof b.isConstant!="function"||b.isConstant()),S=this._appearancesHavePaintProperties(y);if(!T&&!S){const N=this._layerUnevaluated(y);N&&N.expression&&N.expression.kind==="camera"&&(s|=1<<_);continue}t|=1<<_;const A=this._collectZoomSignatures(y,h),C=A.hasZoom,D=A.differs,F=_===8;this.zoomDependency[_]=D?2:C?1:0;const O=D||F&&C;O&&(n|=1<<_);const z=b&&b.value;z&&z.isLightConstant===!1&&(c=!1),this.header[3+_]=l,l+=O?2:1,C&&!D&&A.representative&&(this._computeZoomRange(A.representative,h,this.sharedZoomRanges,2*_),v&&(this.header[12+2*_]=Hp(this.sharedZoomRanges[2*_]),this.header[12+2*_+1]=Hp(this.sharedZoomRanges[2*_+1])))}this.header[0]=t,this.header[1]=n,this.header[2]=l,this.isLightConstant=c,this.cameraMask=s}_recomputeSharedRanges(){const e=this._floorZoom,t=of[+this.isText];let n=0,s=!1;for(let l=0;l<9;l++){const c=t[l],h=this.zoomDependency[l];if(this.header[0]&1<<l){if(h!==0&&h!==2){const p=this._collectZoomSignatures(c,e);p.representative&&(this._computeZoomRange(p.representative,e,this.sharedZoomRanges,2*l),l<2&&(this.header[12+2*l]=Hp(this.sharedZoomRanges[2*l]),this.header[12+2*l+1]=Hp(this.sharedZoomRanges[2*l+1]),s=!0))}}else{const p=this._layerUnevaluated(c);p&&p.expression&&p.expression.kind==="camera"&&(n|=1<<l)}}if(this.cameraMask=n,s)for(const l of this.ubos)l.markHeaderDirty()}_collectZoomSignatures(e,t){let n=!1,s=!1,l=null,c=0,h=0;const p=_=>{if(!_)return;this._computeZoomRange(_,t,this._zoomRangeScratch,0);const y=this._zoomRangeScratch[0],v=this._zoomRangeScratch[1];n?y===c&&v===h||(s=!0):(n=!0,c=y,h=v,l=_)};p(this._zoomExprOf(this._layerUnevaluated(e)));for(const _ of this.layer.getAppearances()||[])_.hasPaintProperty(e)&&p(this._zoomExprOf(_.getUnevaluatedPaintProperty(e)));return{hasZoom:n,differs:s,representative:l}}evaluateAllProperties(e,t,n,s,l,c,h){const p={brightness:l,worldview:this.worldview},_={feature:e,featureState:t,canonical:n,availableImages:s,params:new Oi(this.zoom,p),paramsNext:new Oi(this.zoom+1,p),formattedSection:c,activeAppearance:h},y=of[+this.isText];for(let v=0;v<9;v++){const b=y[v],T=v<2,S=v===8,A=this.zoomDependency[v],C=A!==0,D=A===2,F=nf.EVAL_FLAT_OFFSETS[v],O=F+(T||S?4:2);T?this._evaluateColorValue(b,v,C,D,O,_,F):S?this._evaluateTranslateValue(b,v,C,D,O,_,F):this._evaluateFloatValue(b,v,C,D,O,_,F)}return ur}_resolveProp(e,t,n=!1,s){const l=this.layer.paint,c=l.get(e),h=e,p=!(!t||!t.hasPaintProperty(h)),_=p?s&&c&&c.property.overrides&&c.property.overrides.hasOverride(s)?c:t.paintProperties.get(h):l.get(e);if(n||!_||typeof _.isConstant!="function"||!_.isConstant())return _;const y=p?t.getUnevaluatedPaintProperty(h):this._layerUnevaluated(e);return this._unbakeCamera(_,y)}_unbakeCamera(e,t){const n=t&&t.expression;
vendor: 6,336 bytes, line 7
7if(!n||n.kind!=="camera")return e;let s=tx.get(t);return s||(s=new na(e.property,n,e.parameters,e.iconImageUseTheme),tx.set(t,s)),s}_layerUnevaluated(e){const t=this.layer._transitionablePaint._values[e];return t&&t.value}_zoomExprOf(e){const t=e&&e.expression;return!t||t.kind!=="composite"&&t.kind!=="camera"?null:t}_evalAt(e,t,n){return e.property.evaluate(e.value,t,n.feature,n.featureState,n.canonical,n.availableImages,e.iconImageUseTheme,n.formattedSection)}_evaluateColorValue(e,t,n,s,l,c,h){const p=this._resolveProp(e,c.activeAppearance,!1,c.formattedSection);if(this._writePropertyZoomRange(t,n,s,p,l),!p)return ur[h]=0,ur[h+1]=0,ur[h+2]=0,void(ur[h+3]=1);const _=this._resolveProp(`${e}-use-theme`,c.activeAppearance,!0),y=Qy(_&&typeof _!="string"?_.value:void 0,c.feature,c.featureState,c.availableImages,c.canonical,c.params.brightness,c.formattedSection,this.worldview)?null:this.lut,v=(p.isConstant()?p.constantOr(Lt.transparent):this._evalAt(p,c.params,c)||Lt.transparent).toNonPremultipliedRenderColor(y);if(ur[h]=On(255*v.r,255*v.g),ur[h+1]=On(255*v.b,255*v.a),n){const b=(this._evalAt(p,c.paramsNext,c)||Lt.transparent).toNonPremultipliedRenderColor(y);ur[h+2]=On(255*b.r,255*b.g),ur[h+3]=On(255*b.b,255*b.a)}else ur[h+2]=ur[h],ur[h+3]=ur[h+1]}_computeZoomRange(e,t,n,s){let l=0,c=1;const h=!e||e.kind!=="composite"&&e.kind!=="camera"?null:e.zoomStops;if(h&&h.length>0)if(e.interpolationType==null){l=c=1;for(const p of h)if(p>t&&p<t+1){l=c=p-t;break}}else h[0]>t&&h[0]<t+1&&(l=h[0]-t);n[s]=l,n[s+1]=c}_writeZoomRange(e,t){this._computeZoomRange(e&&e.value,this._floorZoom,ur,t)}_writePropertyZoomRange(e,t,n,s,l){n?this._writeZoomRange(s,l):t?(ur[l]=this.sharedZoomRanges[2*e],ur[l+1]=this.sharedZoomRanges[2*e+1]):(ur[l]=0,ur[l+1]=0)}_evaluateFloatValue(e,t,n,s,l,c,h){const p=e.endsWith("opacity")?1:0,_=this._resolveProp(e,c.activeAppearance);this._writePropertyZoomRange(t,n,s,_,l);const y=(_?_.isConstant()?_.constantOr(p):this._evalAt(_,c.params,c):p)??p;if(ur[h]=y,n){const v=this._evalAt(_,c.paramsNext,c);ur[h+1]=v??p}else ur[h+1]=y}_evaluateTranslateValue(e,t,n,s,l,c,h){const p=this._resolveProp(e,c.activeAppearance);this._writePropertyZoomRange(t,n,s,p,l);const _=!!p&&typeof p.isConstant=="function"&&!p.isConstant(),y=p?typeof p.isConstant!="function"?p:_?this._evalAt(p,c.params,c):p.constantOr(_w):void 0;if(ur[h]=y?y[0]:0,ur[h+1]=y?y[1]:0,n){const v=_?this._evalAt(p,c.paramsNext,c):y;ur[h+2]=v?v[0]:0,ur[h+3]=v?v[1]:0}else ur[h+2]=ur[h],ur[h+3]=ur[h+1]}_appearancesHavePaintProperties(e){return this.layer.getAppearances().some(t=>t.hasPaintProperty(e))}hasStateDependentPaint(e){const t=e.paint,n=of[+this.isText];for(const s of n)if(ex(t.get(s)))return!0;for(const s of e.getAppearances()||[])for(const l of n){const c=l;if(s.hasPaintProperty(c)&&ex(s.paintProperties.get(c)))return!0}return!1}hasPerFeatureTranslate(){return!!(256&this.header[0])}getCurrentBatchIndex(){return this.maxFeaturesPerBatch===0?0:Math.floor(this.featureCount/this.maxFeaturesPerBatch)}_writeFeatureBlock(e,t){const n=this.isAllConstant?0:e;let s=Math.floor(n/this.maxFeaturesPerBatch),l=n%this.maxFeaturesPerBatch;this._batchExceedsDeviceLimit(s)&&(s=0,l=0);const c=this.ubos[s];return!!c&&(c.writeDataDrivenBlock(t,l),!0)}_batchExceedsDeviceLimit(e){return 3*e+2>=this.maxUniformBufferBindings}_reevaluateAt(e,t,n,s,l,c){if(!t)return;const h=this.allFeatureVtIndices[e],p=t.feature(h);if(!p)return;const _=this.allFeatureIds[e],y=_!=null&&l[_]||{},v={type:p.type,id:_,properties:p.properties||{},geometry:[]},b=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(h):void 0,T=this.evaluateAllProperties(v,y,n,s,c,(this.allFormattedSections?this.allFormattedSections[e]:void 0)||void 0,b);this._writeFeatureBlock(e,T)}_ensureRangeMaps(){if(!this.featureVertexRangesFromId){this.featureVertexRangesFromId=new Map,this.featureVertexRangesFromVtIndex=new Map;for(let e=0;e<this.allFeatureVtIndices.length;e++){const t=this.allFeatureIds[e];if(t!=null){let l=this.featureVertexRangesFromId.get(t);l||this.featureVertexRangesFromId.set(t,l=[]),l.push(e)}const n=this.allFeatureVtIndices[e];let s=this.featureVertexRangesFromVtIndex.get(n);s||this.featureVertexRangesFromVtIndex.set(n,s=[]),s.push(e)}}}populateUBO(e,t,n,s,l,c){const h=e.id,p=this.header,_=this.evaluateAllProperties(e,{},n,s,l,c);let y,v;this.isAllConstant?(y=0,v=this.featureCount===0,v&&(this.featureCount=1)):(y=this.featureCount++,v=!0);let b=Math.floor(y/this.maxFeaturesPerBatch),T=y%this.maxFeaturesPerBatch;return v&&(this._batchExceedsDeviceLimit(b)?(gi(`Too many symbol features: batch ${b} requires binding points up to ${3*b+2}, device limit ${this.maxUniformBufferBindings}. Some features will render incorrectly.`),b=0,T=0):(this.ubos[b]||(this.ubos[b]=new nf(null,b,this.uboSizeDwords,p)),this.ubos[b].writeDataDrivenBlock(_,T))),this.allFeatureVtIndices.push(t),this.allFeatureIds.push(h),this.allFormattedSections.push(c||null),T}updateFeatures(e,t,n,s,l,c,h){this.layer=t,this.cachedConstantUniforms=null,this._ensureRangeMaps();for(const p of e){const _=this.featureVertexRangesFromId.get(p);if(_)for(const y of _)this._reevaluateAt(y,n,s,l,c,h)}}updateDynamicExpressions(e,t,n,s,l,c){if(this.layer=e,this.cachedConstantUniforms=null,this._recomputeSharedRanges(),this.header[0]!==0)for(let h=0;h<this.allFeatureVtIndices.length;h++)this._reevaluateAt(h,t,n,s,l,c)}updateFeaturePaintForAppearance(e,t,n,s,l,c,h){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(e,h||null),this.header[0]===0))return!1;this._ensureRangeMaps();const p=this.featureVertexRangesFromVtIndex.get(e);if(!p)return!1;let _=!1;for(const y of p){const v=this.evaluateAllProperties(t,n,s,l,c,(this.allFormattedSections?this.allFormattedSections[y]:void 0)||void 0,h);_=this._writeFeatureBlock(y,v)||_}return _}getConstantUniformValues(e,t){const n=!!this.cameraMask;if(this.cachedConstantUniforms&&this.cachedConstantPaint===this.layer.paint&&this.cachedConstantBrightness===t&&(!n||this.cachedConstantRenderZoom===e))return this.cachedConstantUniforms;const s=this.layer.paint,l=n?new Oi(e,{brightness:t,worldview:this.worldview}):null,c={type:1,id:void 0,properties:{},geometry:[]},h=of[+this.isText],p=v=>{const b=h[v],T=s.get(b);if(!T)return[0,0,0,1];const S=s.get(`${b}
7-use-theme`),A=Qy(S&&typeof S!="string"?S.value:void 0,c,{},[],void 0,t,void 0,this.worldview)?null:this.lut;return(this.cameraMask&1<<v&&l?T.property.evaluate(T.value,l,c,{},void 0,[])||Lt.transparent:T.constantOr(Lt.transparent)).toNonPremultipliedRenderColor(A).toArray01()},_=(v,b)=>{const T=s.get(h[v]);return T?this.cameraMask&1<<v&&l?T.property.evaluate(T.value,l,c,{},void 0,[])??b:T.constantOr(b):b},y={fill_np_color:p(0),halo_np_color:p(1),opacity:_(2,1),halo_width:_(3,0),halo_blur:_(4,0),emissive_strength:_(5,0),occlusion_opacity:_(6,1),z_offset:_(7,0)};return this.cachedConstantUniforms=y,this.cachedConstantRenderZoom=e,this.cachedConstantBrightness=t,this.cachedConstantPaint=this.layer.paint,y}finalize(){for(const e of this.ubos)e.rightSizeForTransfer()}upload(e){for(const t of this.ubos)t.upload(e)}bind(e,t,n=0){this.ubos[n]&&this.ubos[n].bind(e,t)}destroy(){for(const e of this.ubos)e.destroy();this.ubos=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureCount=0,this.maxFeaturesPerBatch=0}}tt(tg,"SymbolPropertyBinderUBO",{omit:["layer","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","cachedConstantPaint","activeAppearanceByVtIndex","featureVertexRangesFromId","featureVertexRangesFromVtIndex"]});const Bh=24;function gw(i,e,t){return i.sections.forEach(n=>{n.text=function(s,l,c){const h=l.layout.get("text-transform").evaluate(c,{});return h==="uppercase"?s=s.toLocaleUpperCase():h==="lowercase"&&(s=s.toLocaleLowerCase()),Fa.applyArabicShaping&&(s=Fa.applyArabicShaping(s)),s}(n.text,e,t)}),i}const Rl={horizontal:1,vertical:2,horizontalOnly:3};function ix(i){let e=.5,t=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":t=1;break;case"top":case"top-right":case"top-left":t=0}return{horizontalAlign:e,verticalAlign:t}}function rx(i,e,t,n){const{horizontalAlign:s,verticalAlign:l}=ix(n),c=t[0]-i.displaySize[0]*s,h=t[1]-i.displaySize[1]*l;return{imagePrimary:i,imageSecondary:e,top:h,bottom:h+i.displaySize[1],left:c,right:c+i.displaySize[0]}}function nx(i,e,t,n,s,l){const c=i.imagePrimary;let h;if(c.content){const C=c.content,D=c.pixelRatio||1;h=[C[0]/D,C[1]/D,c.displaySize[0]-C[2]/D,c.displaySize[1]-C[3]/D]}const p=e.left*l,_=e.right*l;let y,v,b,T;t==="width"||t==="both"?(T=s[0]+p-n[3],v=s[0]+_+n[1]):(T=s[0]+(p+_-c.displaySize[0])/2,v=T+c.displaySize[0]);const S=e.top*l,A=e.bottom*l;return t==="height"||t==="both"?(y=s[1]+S-n[0],b=s[1]+A+n[2]):(y=s[1]+(S+A-c.displaySize[1])/2,b=y+c.displaySize[1]),{imagePrimary:c,imageSecondary:void 0,top:y,right:v,bottom:b,left:T,collisionPadding:h}}const sf={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"};function yw(i){return i==="︶"||i==="ï¹"||i==="︸"||i==="ï¹"||i==="ï¹"||i==="︾"||i==="︼"||i==="︺"||i==="ï¸"||i==="ï¹"||i==="ï¸"||i==="ï¸"||i==="ï¸"||i==="ï½"||i==="ï¿£"||i==="ï¸"||i==="ï¸"}function xw(i){return i==="︵"||i==="ï¹"||i==="︷"||i==="ï¹"||i==="ï¹"||i==="︽"||i==="︻"||i==="︹"||i==="ï¸"||i==="︿"}const Mc=128;function kh(i,e,t,n){const{expression:s}=e;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new Oi(i+1,{worldview:t}),void 0,void 0,void 0,n)};if(s.kind==="source")return{kind:"source"};{const{zoomStops:l,interpolationType:c}=s;let h=0;for(;h<l.length&&l[h]<=i;)h++;h=Math.max(0,h-1);let p=h;for(;p<l.length&&l[p]<i+1;)p++;p=Math.min(l.length-1,p);const _=l[h],y=l[p];return s.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:y,interpolationType:c}:{kind:"camera",minZoom:_,maxZoom:y,minSize:s.evaluate(new Oi(_,{worldview:t}),void 0,void 0,void 0,n),maxSize:s.evaluate(new Oi(y,{worldview:t}),void 0,void 0,void 0,n),interpolationType:c}}}function Zp(i,{uSize:e,uSizeT:t},{lowerSize:n,upperSize:s}){return i.kind==="source"?n/Mc:i.kind==="composite"?lt(n/Mc,s/Mc,t):e}function Mu(i,e,t=1){let n=0,s=0;if(i.kind==="constant")s=i.layoutSize*t;else if(i.kind!=="source"){const{interpolationType:l,minZoom:c,maxZoom:h}=i,p=l?yt(Lo.interpolationFactor(l,e,c,h),0,1):0;
vendor: 8,923 bytes, line 7
7i.kind==="camera"?s=lt(i.minSize,i.maxSize,p)*t:n=p*t}return{uSizeT:n,uSize:s}}const vw=Number.POSITIVE_INFINITY,bw=Math.sqrt(2),Ru=32640;function Nh(i,e,t,n,s,l,c){const h=i.hasLayoutProperty(s)?e.getAppearanceValueAndResolveTokens(i,s,t,n,[]):null;return(Array.isArray(l)?Array.isArray(h):typeof h==typeof l)?c?c(h):h:l}function ox(i,e,t,n,s,l,c,h){return{appearanceIconOffset:Nh(i,e,t,n,"icon-offset",s),appearanceIconRotate:Nh(i,e,t,n,"icon-rotate",l),appearanceIconSize:Nh(i,e,t,n,"icon-size",c,p=>p*h)}}function sx(i,e,t,n,s,l,c){return{appearanceTextOffset:Nh(i,e,t,n,"text-offset",s,([p,_])=>[p*Bh,_*Bh]),appearanceTextRotate:Nh(i,e,t,n,"text-rotate",l),appearanceTextSize:Nh(i,e,t,n,"text-size",c)}}function ax(i,e,t,n,s,l,c,h,p,_){if(!i)return;const y=function(v,b,T,S,A,C,D){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const F=b.possiblyEvaluate(new Oi(v.maxZoom,{worldview:C}),T,D).evaluate(A,{},T,D),O=b.possiblyEvaluate(new Oi(v.minZoom,{worldview:C}),T,D).evaluate(A,{},T,D);return Math.max(F,O)}return b.possiblyEvaluate(new Oi(S,{worldview:C}),T,D).evaluate(A,{},T,D)}(e,t,n,s,l,p,_);return i.scaleSelf(y*h*c)}function ig(i,e,t,n,s,l,c,h,p,_){return{iconPrimary:ax(i.getPrimary(),e,t,n,s,l,c,h,p,_),iconSecondary:ax(i.getSecondary(),e,t,n,s,l,c,h,p,_)}}function lx(i,e){return i*e/24}function cx(i,e,t,n,s,l){let c=null;return e.kind==="source"?(c=[Mc*t*n],c[0]>Ru&&gi(`${i}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`)):e.kind==="composite"&&(c=[Mc*s*n,Mc*l*n],(c[0]>Ru||c[1]>Ru)&&gi(`${i}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`)),c}const ww=ue([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:$p}=ww,Tw=ue([{name:"a_pos_3",components:3,type:"Int16"}]);var rg=ue([{name:"a_pos",type:"Int16",components:2}]);class Ew{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,n){const s=Ja(t,this.dir);if(Math.abs(s)<1e-6)return!1;const l=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1])/s;return n[0]=this.pos[0]+this.dir[0]*l,n[1]=this.pos[1]+this.dir[1]*l,!0}}class qp{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,n){const s=Di(t,this.dir);if(Math.abs(s)<1e-6)return!1;const l=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/s;return n[0]=this.pos[0]+this.dir[0]*l,n[1]=this.pos[1]+this.dir[1]*l,n[2]=this.pos[2]+this.dir[2]*l,!0}closestPointOnSphere(e,t,n){if(function(T,S){var A=T[0],C=T[1],D=T[2],F=S[0],O=S[1],z=S[2];return Math.abs(A-F)<=Kn*Math.max(1,Math.abs(A),Math.abs(F))&&Math.abs(C-O)<=Kn*Math.max(1,Math.abs(C),Math.abs(O))&&Math.abs(D-z)<=Kn*Math.max(1,Math.abs(D),Math.abs(z))}(this.pos,e)||t===0)return n[0]=n[1]=n[2]=0,!1;const[s,l,c]=this.dir,h=this.pos[0]-e[0],p=this.pos[1]-e[1],_=this.pos[2]-e[2],y=s*s+l*l+c*c,v=2*(h*s+p*l+_*c),b=v*v-4*y*(h*h+p*p+_*_-t*t);if(b<0){const T=Math.max(-v/2,0),S=h+s*T,A=p+l*T,C=_+c*T,D=Math.hypot(S,A,C);return n[0]=S*t/D,n[1]=A*t/D,n[2]=C*t/D,!1}{const T=(-v-Math.sqrt(b))/(2*y);if(T<0){const S=Math.hypot(h,p,_);return n[0]=h*t/S,n[1]=p*t/S,n[2]=_*t/S,!1}return n[0]=h+s*T,n[1]=p+l*T,n[2]=_+c*T,!0}}}class ng{constructor(e,t,n,s,l){this.TL=e,this.TR=t,this.BR=n,this.BL=s,this.horizon=l}static fromInvProjectionMatrix(e,t,n){const s=[-1,1,1],l=[1,1,1],c=[1,-1,1],h=[-1,-1,1],p=hi(s,s,e),_=hi(l,l,e),y=hi(c,c,e),v=hi(h,h,e);return new ng(p,_,y,v,t/n)}}function og(i,e,t,n){const s=e[0],l=e[1],c=e[2],h=t[0],p=t[1],_=t[2];let y=1/0,v=-1/0;for(let b=0;b<i.length;b++){const T=i[b],S=(T[0]-s)*h+(T[1]-l)*p+(T[2]-c)*_;S<y&&(y=S),S>v&&(v=S)}return n[0]=y,n[1]=v,n}function ux(i,e){let t=!0;for(let n=0;n<i.planes.length;n++){const s=i.planes[n];let l=0;for(let c=0;c<e.length;c++)l+=+(Di(s,e[c])+s[3]>=0);if(l===0)return 0;l!==e.length&&(t=!1)}return t?2:1}const Sw=[0,0];function hx(i,e){for(const t of i.projections){const n=og(e,i.points[0],t.axis,Sw);if(t.projection[1]<n[0]||t.projection[0]>n[1])return 0}return 1}function dx(i,e){const t=e[0],n=e[1],s=e[2],l=e[3];for(let c=0;c<i.length;c++){const h=i[c];if(t*h[0]+n*h[1]+s*h[2]+l>=0)return!0}return!1}class Pl{constructor(e,t){this.points=e||new Array(8).fill([0,0,0]),this.planes=t||new Array(6).fill([0,0,0,0]),this.bounds=zi.fromPoints(this.points),this.projections=[],this.frustumEdges=[Li([],this.points[2],this.points[3]),Li([],this.points[0],this.points[3]),Li([],this.points[4],this.points[0]),Li([],this.points[5],this.points[1]),Li([],this.points[6],this.points[2]),Li([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const s=[0,-n[2],n[1]],l=[n[2],0,-n[0]];this.projections.push({axis:s,projection:og(this.points,this.points[0],s,[0,0])}),this.projections.push({axis:l,projection:og(this.points,this.points[0],l,[0,0])})}}static fromInvProjectionMatrix(e,t,n,s){const l=Math.pow(2,n),c=[[-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(_=>{const y=ar([],_,e),v=1/y[3]/t*l;return(b=y)[0]=(T=y)[0]*(S=[v,v,s?1/y[3]:v,v])[0],b[1]=T[1]*S[1],b[2]=T[2]*S[2],b[3]=T[3]*S[3],b;var b,T,S}),h=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=ti([],xr([],Li([],c[_[0]],c[_[1]]),Li([],c[_[2]],c[_[1]]))),v=-Di(y,c[_[1]]);return y.concat(v)}),p=[];for(let _=0;_<c.length;_++)p.push([c[_][0],c[_][1],c[_][2]]);return new Pl(p,h)}intersectsPrecise(e,t,n){for(let p=0;p<t.length;p++)if(!dx(e,t[p]))return 0;for(let p=0;p<this.planes.length;p++)if(!dx(e,this.planes[p]))return 0;const s=this.points,l=s[0][0],c=s[0][1],h=s[0][2];for(const p of n)for(const _ of this.frustumEdges){const y=p[1]*_[2]-p[2]*_[1],v=p[2]*_[0]-p[0]*_[2],b=p[0]*_[1]-p[1]*_[0];if(y===0&&v===0&&b===0)continue;let T=1/0,S=-1/0;for(let D=0;D<s.length;D++){const F=s[D],O=(F[0]-l)*y+(F[1]-c)*v+(F[2]-h)*b;O<T&&(T=O),O>S&&(S=O)}let A=1/0,C=-1/0;for(let D=0;D<e.length;D++){const F=e[D],O=(F[0]-l)*y+(F[1]-c)*v+(F[2]-h)*b;O<A&&(A=O),O>C&&(C=O)}if(T>C||A>S)return 0}return 1}containsPoint(e){for(const t of this.planes){const n=t[3];if(Di([t[0],t[1],t[2]],e)+n<0)return!1}return!0}}class zi{static fromPoints(e){const t=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const s of e)Zs(t,t,s),$s(n,n,s);return new zi(t,n)}static fromTileIdAndHeight(e,t,n){const s=1<<e.canonical.z,l=e.canonical.x,c=e.canonical.y;return new zi([l/s,c/s,t],[(l+1)/s,(c+1)/s,n])}static applyTransform(e,t){const n=e.getCorners();for(let s=0;s<n.length;++s)hi(n[s],n[s],t);return zi.fromPoints(n)}static applyTransformFast(e,t){const n=[t[12],t[13],t[14]],s=[...n];for(let l=0;l<3;l++)for(let c=0;c<3;c++){const h=t[4*c+l],p=h*e.min[c],_=h*e.max[c];n[l]+=Math.min(p,_),s[l]+=Math.max(p,_)}return new zi(n,s)}static projectAabbCorners(e,t){const n=e.getCorners();for(let s=0;s<n.length;++s)hi(n[s],n[s],t);return n}constructor(e,t){this.min=e,this.max=t,this.center=oi([],Yi([],this.min,this.max),.5)}quadrant(e){const t=[e%2==0,e<2],n=Hs(this.min),s=Hs(this.max);for(let l=0;l<t.length;l++)n[l]=t[l]?this.min[l]:this.center[l],s[l]=t[l]?this.center[l]:this.max[l];return s[2]=this.max[2],new zi(n,s)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?ux(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?ux(e,[[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(e,t){return t||this.intersects(e)?hx(e,this.getCorners()):0}intersectsPreciseFlat(e,t){return t||this.intersectsFlat(e)?hx(e,[[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(e){for(let t=0;t<3;++t)if(this.min[t]>e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function Wp(i){return i*Fn/Il}tt(zi,"Aabb");const Iw=[new zi([Yo,Yo,Yo],[Ko,Ko,Ko]),new zi([Yo,Yo,Yo],[0,0,Ko]),new zi([0,Yo,Yo],[Ko,0,Ko]),new zi([Yo,0,Yo],[0,Ko,Ko]),new zi([0,0,Yo],[Ko,Ko,Ko])];function fx(i,e,t,n=!0){const s=oi([],i._camera.position,i.worldSize),l=[e,t,1,1];ar(l,l,i.pixelMatrixInverse),Vo(l,l,1/l[3]);
vendor: 5,072 bytes, line 7
7const c=ti([],Li([],l,s)),h=i.globeMatrix,p=[h[12],h[13],h[14]],_=Li([],p,s),y=Xi(_),v=ti([],_),b=i.worldSize/(2*Math.PI),T=Di(v,c),S=Math.asin(b/y);if(S<Math.acos(T)){if(!n)return null;const K=[],ee=[];oi(K,c,y/T),ti(ee,Li(ee,K,_)),ti(c,Yi(c,_,oi(c,ee,Math.tan(S)*y)))}const A=[];new qp(s,c).closestPointOnSphere(p,b,A);const C=ti([],Fr(h,0)),D=ti([],Fr(h,1)),F=ti([],Fr(h,2)),O=Di(C,A),z=Di(D,A),N=Di(F,A),j=Ur(Math.asin(-z/b));let te=Ur(Math.atan2(O,N));te=i.center.lng+function(K,ee){const le=(ee-K+180)%360-180;return le<-180?le+360:le}(i.center.lng,te);const G=po(te),W=yt($n(j),0,1);return new E(G,W)}class Aw{constructor(e,t,n){this.a=Li([],e,n),this.b=Li([],t,n),this.center=n;const s=ti([],this.a),l=ti([],this.b);this.angle=Math.acos(Di(s,l))}}function sg(i,e){if(i.angle===0)return null;let t;return t=i.a[e]===0?1/i.angle*.5*Math.PI:1/i.angle*Math.atan(i.b[e]/i.a[e]/Math.sin(i.angle)-1/Math.tan(i.angle)),t<0||t>1?null:function(n,s,l,c){const h=Math.sin(l);return n*(Math.sin((1-c)*l)/h)+s*(Math.sin(c*l)/h)}(i.a[e],i.b[e],i.angle,yt(t,0,1))+i.center[e]}function Na(i){if(i.z<=1)return Iw[i.z+2*i.y+i.x];const e=lg(Xp(i));return zi.fromPoints(e)}function Dl(i,e,t){return oi(i,i,1-t),cn(i,i,e,t)}function px(i,e,t){for(const n of i)hi(n,n,e),oi(n,n,t)}function ag(i,e,t,n){const s=e/i.worldSize,l=i.globeMatrix;if(t.z<=1){const W=Na(t).getCorners();return px(W,l,s),zi.fromPoints(W)}const c=Xp(t,n),h=lg(c,Fn+Wp(i._tileCoverLift));px(h,l,s);const p=Number.MAX_VALUE,_=[-p,-p,-p],y=[p,p,p];if(c.contains(i.center)){for(const ee of h)Zs(y,y,ee),$s(_,_,ee);_[2]=0;const W=i.point,K=[W.x*s,W.y*s,0];return Zs(y,y,K),$s(_,_,K),new zi(y,_)}if(i._tileCoverLift>0){for(const W of h)Zs(y,y,W),$s(_,_,W);return new zi(y,_)}const v=[l[12]*s,l[13]*s,l[14]*s],b=c.getCenter(),T=yt(i.center.lat,-85.051129,f),S=yt(b.lat,-85.051129,f),A=po(i.center.lng),C=$n(T);let D=A-po(b.lng);const F=C-$n(S);D>.5?D-=1:D<-.5&&(D+=1);let O=0;Math.abs(D)>Math.abs(F)?O=D>=0?1:3:(O=F>=0?0:2,cn(v,v,[l[4]*s,l[5]*s,l[6]*s],-Math.sin(Bt(F>=0?c.getSouth():c.getNorth()))*Fn));const z=h[O],N=h[(O+1)%4],j=new Aw(z,N,v),te=[sg(j,0)||z[0],sg(j,1)||z[1],sg(j,2)||z[2]],G=Ll(i.zoom);if(G>0){const W=function({x:ee,y:le,z:de},ve,xe,we,Fe){const se=1/(1<<de);let pe=ee*se,ge=pe+se,Se=le*se,Me=Se+se,Pe=0;const Ie=(pe+ge)/2-we;return Ie>.5?Pe=-1:Ie<-.5&&(Pe=1),pe=((pe+Pe)*ve-(we*=ve))*xe+we,ge=((ge+Pe)*ve-we)*xe+we,Se=(Se*ve-(Fe*=ve))*xe+Fe,Me=(Me*ve-Fe)*xe+Fe,[[pe,Me,0],[ge,Me,0],[ge,Se,0],[pe,Se,0]]}(t,e,i._pixelsPerMercatorPixel,A,C);for(let ee=0;ee<h.length;ee++)Dl(h[ee],W[ee],G);const K=Yi([],W[O],W[(O+1)%4]);oi(K,K,.5),Dl(te,K,G)}for(const W of h)Zs(y,y,W),$s(_,_,W);return y[2]=Math.min(z[2],N[2]),Zs(y,y,te),$s(_,_,te),new zi(y,_)}function Xp({x:i,y:e,z:t},n=!1){const s=1/(1<<t),l=new Wt(qn(i*s),e===(1<<t)-1&&n?-90:wr((e+1)*s)),c=new Wt(qn((i+1)*s),e===0&&n?90:wr(e*s));return new a(l,c)}function lg(i,e=Fn){const t=Bt(i.getNorth()),n=Bt(i.getSouth()),s=Math.cos(t),l=Math.cos(n),c=Math.sin(t),h=Math.sin(n),p=i.getWest(),_=i.getEast();return[Tc(l,h,p,e),Tc(l,h,_,e),Tc(s,c,_,e),Tc(s,c,p,e)]}function af(i,e,t,n){const s=1<<t.z,l=(i/We+t.x)/s;return Sl(wr((e/We+t.y)/s),qn(l),n)}function Yp({min:i,max:e}){return 16383/Math.max(e[0]-i[0],e[1]-i[1],e[2]-i[2])}const Kp=new Float64Array(16);function Jp(i){const e=Yp(i),t=No(Kp,[e,e,e]);return Wi(t,t,rs([],i.min))}function cg(i){const e=1/Yp(i);return Gs(Kp,i.min),mr(Kp,Kp,[e,e,e])}function ug(i){const e=We/(2*Math.PI);return i/(2*Math.PI)/e}function mx(i,e){return We/(512*Math.pow(2,i))*Yp(Na(e))}function _x(i,e,t,n,s){const l=ug(t),c=[i,e,-t/(2*Math.PI)],h=er(new Float64Array(16));return Wi(h,h,c),mr(h,h,[l,l,l]),Is(h,h,Bt(-s)),So(h,h,Bt(-n)),h}function Ll(i){return ls(5,6,i)}function gx(i,e){const t=Sl(e.lat,e.lng),n=function(S){const A=Sl(S._center.lat,S._center.lng);let C=xr([],Tr(0,1,0),A);const D=Qn([],-S.angle,A);C=hi(C,C,D),Qn(D,-S._pitch,C);const F=ti([],A);return oi(F,F,Wp(S.cameraToCenterDistance/S.pixelsPerMeter)),hi(F,F,D),Yi([],A,F)}(i);return c=(s=eo([],n,t))[0],h=s[1],p=s[2],_=(l=t)[0],y=l[1],v=l[2],T=(b=Math.sqrt((c*c+h*h+p*p)*(_*_+y*y+v*v)))&&Di(s,l)/b,Math.acos(Math.min(Math.max(T,-1),1));var s,l,c,h,p,_,y,v,b,T}function hg(i,e){return gx(i,e)>Math.PI/2*1.01}const yx=Bt(85),Cw=Math.cos(yx),Mw=Math.sin(yx);function xx(i,e){const t=i.fovAboveCenter,n=i.elevation?i.elevation.getMinElevationBelowMSL()*e:0,s=Math.min(n,i.isOrthographic?-10*e:0),l=(i._camera.position[2]*i.worldSize-s)/Math.cos(i._pitch),c=Math.sin(t)*l/Math.sin(Math.max(Math.PI/2-i._pitch-t,.01));let h=Math.sin(i._pitch)*c+l;const p=l*(1/i._horizonShift);if(!i.elevation||i.elevation.exaggeration()===0){let _=Math.max(i.zoom-17,0);i.isOrthographic&&(_/=10),h*=1+_}return Math.min(1.01*h,p)}class Rc{constructor(e,t,n){this.z=e,this.x=t,this.y=n,this.key=Pc(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const t=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>t&&e.y===this.y>>t}url(e,t){const n=function(l,c,h){const p=2**h,_=2*Math.PI*6378137,y=_*(l/p-.5),v=_*(.5-(c+1)/p);return`${y},${v}
7,${y+_/p},${v+_/p}`}(this.x,this.y,this.z),s=function(l,c,h){let p,_="";for(let y=l;y>0;y--)p=1<<y-1,_+=(c&p?1:0)+(h&p?2:0);return _}(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(t==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",s).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Qp{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Pc(e,t.z,t.z,t.x,t.y)}}class qr{constructor(e,t,n,s,l){this.overscaledZ=e,this.wrap=t,this.canonical=new Rc(n,+s,+l),this.key=t===0&&e===n?this.canonical.key:Pc(t,e,n,s,l)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const t=this.canonical.z-e;return e>this.canonical.z?new qr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new qr(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Pc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return Pc(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new qr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,n=2*this.canonical.x,s=2*this.canonical.y;return[new qr(t,this.wrap,t,n,s),new qr(t,this.wrap,t,n+1,s),new qr(t,this.wrap,t,n,s+1),new qr(t,this.wrap,t,n+1,s+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new qr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new qr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Qp(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Pc(i,e,t,n,s){const l=1<<Math.min(t,22);let c=l*(s%l)+n%l;return i&&t<22&&(c+=l*l*((i<0?-2*i-1:2*i)%(1<<2*(22-t)))),16*(32*c+t)+(e-t)}const vx=[i=>{let e=i.canonical.x-1,t=i.wrap;return e<0&&(e=(1<<i.canonical.z)-1,t--),new qr(i.overscaledZ,t,i.canonical.z,e,i.canonical.y)},i=>{let e=i.canonical.x+1,t=i.wrap;return e===1<<i.canonical.z&&(e=0,t++),new qr(i.overscaledZ,t,i.canonical.z,e,i.canonical.y)},i=>new qr(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,(i.canonical.y===0?1<<i.canonical.z:i.canonical.y)-1),i=>new qr(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y===(1<<i.canonical.z)-1?0:i.canonical.y+1)];function dg(i,e){if(!e.isReprojectedInTileSpace)return{scale:1<<i.z,x:i.x,y:i.y,x2:i.x+1,y2:i.y+1,projection:e};const t=Math.pow(2,-i.z),n=i.x*t,s=(i.x+1)*t,l=i.y*t,c=(i.y+1)*t,h=qn(n),p=qn(s),_=wr(l),y=wr(c),v=e.project(h,_),b=e.project(p,_),T=e.project(p,y),S=e.project(h,y);let A=Math.min(v.x,b.x,T.x,S.x),C=Math.min(v.y,b.y,T.y,S.y),D=Math.max(v.x,b.x,T.x,S.x),F=Math.max(v.y,b.y,T.y,S.y);const O=t/16;function z(j,te,G,W,K,ee){const le=(G+K)/2,de=(W+ee)/2,ve=e.project(qn(le),wr(de)),xe=Math.max(0,A-ve.x,C-ve.y,ve.x-D,ve.y-F);A=Math.min(A,ve.x),D=Math.max(D,ve.x),C=Math.min(C,ve.y),F=Math.max(F,ve.y),xe>O&&(z(j,ve,G,W,le,de),z(ve,te,le,de,K,ee))}z(v,b,n,l,s,l),z(b,T,s,l,s,c),z(T,S,s,c,n,c),z(S,v,n,c,n,l),A-=O,C-=O,D+=O,F+=O;const N=1/Math.max(D-A,F-C);return{scale:N,x:A*N,y:C*N,x2:D*N,y2:F*N,projection:e}}function bx(i,e,t,n,s,l,c,h,p){if(p.name==="globe")return ag(i,e,new Rc(t,n,s),!1);const _=dg({z:t,x:n,y:s},p);return new zi([(l+_.x/_.scale)*e,e*(_.y/_.scale),c],[(l+_.x2/_.scale)*e,e*(_.y2/_.scale),h
vendor: 4,323 bytes, line 7
7])}tt(Rc,"CanonicalTileID"),tt(qr,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Rw=er(new Float32Array(16));class Dc{constructor(e){this.spec=e,this.name=e.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(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new Wt(0,0)}projectTilePoint(e,t,n){return{x:e,y:t,z:0}}locationPoint(e,t,n,s=!0){return e._coordinatePoint(e.locationCoordinate(t,n),s)}pixelsPerMeter(e,t){return o(1,e)*t}pixelSpaceConversion(e,t,n){return 1}farthestPixelDistance(e){return xx(e,e.pixelsPerMeter)}pointCoordinate(e,t,n,s){const l=e.horizonLineFromTop(!1),c=new Le(t,Math.max(l,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(c,s))}pointCoordinate3D(e,t,n){const s=new Le(t,n);if(e.elevation)return e.elevation.pointCoordinate(s);{const l=this.pointCoordinate(e,s.x,s.y,0);return[l.x,l.y,l.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const n=e.horizonLineFromTop();return t.y<n}createInversionMatrix(e,t){return Rw}createTileMatrix(e,t,n){let s,l,c;const h=n.canonical,p=er(new Float64Array(16));if(this.isReprojectedInTileSpace){const _=dg(h,this);s=1,l=_.x+n.wrap*_.scale,c=_.y,mr(p,p,[s/_.scale,s/_.scale,e.pixelsPerMeter/t])}else s=t/e.zoomScale(h.z),l=(h.x+Math.pow(2,h.z)*n.wrap)*s,c=h.y*s;return Wi(p,p,[l,c,0]),mr(p,p,[s/We,s/We,1]),p}upVector(e,t,n){return[0,0,1]}upVectorScale(e,t,n){return{metersToTile:1}}}class Pw extends Dc{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[t,n]=this.parallels=e.parallels||[29.5,45.5],s=Math.sin(Bt(t));this.n=(s+Math.sin(Bt(n)))/2,this.c=1+s*(2*this.n-s),this.r0=Math.sqrt(this.c)/this.n}project(e,t){const{n,c:s,r0:l}=this,c=Bt(e-this.center[0]),h=Bt(t),p=Math.sqrt(s-2*n*Math.sin(h))/n;return{x:p*Math.sin(c*n),y:p*Math.cos(c*n)-l,z:0}}unproject(e,t){const{n,c:s,r0:l}=this,c=l+t;let h=Math.atan2(e,Math.abs(c))*Math.sign(c);c*n<0&&(h-=Math.PI*Math.sign(e)*Math.sign(c));const p=Bt(this.center[0])*n;h=vn(h,-Math.PI-p,Math.PI-p);const _=yt(Ur(h/n)+this.center[0],-180,180),y=Math.asin(yt((s-(e*e+c*c)*n*n)/(2*n),-1,1)),v=yt(Ur(y),-85.051129,f);return new Wt(_,v)}}const lf=1.340264,cf=-.081106,uf=893e-6,hf=.003796,em=Math.sqrt(3)/2;class Dw extends Dc{project(e,t){t=t/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(em*Math.sin(t)),s=n*n,l=s*s*s;return{x:.5*(e*Math.cos(n)/(em*(lf+3*cf*s+l*(7*uf+9*hf*s)))/Math.PI+.5),y:1-.5*(n*(lf+cf*s+l*(uf+hf*s))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let n=t=(2*(1-t)-1)*Math.PI,s=n*n,l=s*s*s;for(let y,v,b,T=0;T<12&&(v=n*(lf+cf*s+l*(uf+hf*s))-t,b=lf+3*cf*s+l*(7*uf+9*hf*s),y=v/b,n=yt(n-y,-Math.PI/3,Math.PI/3),s=n*n,l=s*s*s,!(Math.abs(y)<1e-12));++T);const c=em*e*(lf+3*cf*s+l*(7*uf+9*hf*s))/Math.cos(n),h=Math.asin(Math.sin(n)/em),p=yt(180*c/Math.PI,-180,180),_=yt(180*h/Math.PI,-85.051129,f);return new Wt(p,_)}}class Lw extends Dc{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}unproject(e,t){const n=360*(e-.5),s=yt(360*(.5-t),-85.051129,f);return new Wt(n,s)}}const Vh=Math.PI/2;function tm(i){return Math.tan((Vh+i)/2)}class zw extends Dc{constructor(e){super(e),this.center=e.center||[0,30];const[t,n]=this.parallels=e.parallels||[30,30];let s=Bt(t),l=Bt(n);this.southernCenter=s+l<0,this.southernCenter&&(s=-s,l=-l);const c=Math.cos(s),h=tm(s);this.n=s===l?Math.sin(s):Math.log(c/Math.cos(l))/Math.log(tm(l)/h),this.f=c*Math.pow(tm(s),this.n)/this.n}project(e,t){t=Bt(t),this.southernCenter&&(t=-t),e=Bt(e-this.center[0]);const n=1e-6,{n:s,f:l}=this;l>0?t<-Vh+n&&(t=-Vh+n):t>Vh-n&&(t=Vh-n);const c=l/Math.pow(tm(t),s);let h=c*Math.sin(s*e),p=l-c*Math.cos(s*e);return h=.5*(h/Math.PI+.5),p=.5*(p/Math.PI+.5),{x:h,y:this.southernCenter?p:1-p,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n,f:s}=this,l=s-t,c=Math.sign(l),h=Math.sign(n)*Math.sqrt(e*e+l*l);let p=Math.atan2(e,Math.abs(l))*c;l*n<0&&(p-=Math.PI*Math.sign(e)*c);const _=yt(Ur(p/n)+this.center[0],-180,180),y=yt(Ur(2*Math.atan(Math.pow(s/h,1/n))-Vh
vendor: 20,740 bytes, line 7
7),-85.051129,f);return new Wt(_,this.southernCenter?-y:y)}}class wx extends Dc{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:po(e),y:$n(t),z:0}}unproject(e,t){const n=qn(e),s=wr(t);return new Wt(n,s)}}const Tx=Bt(f);class Fw extends Dc{project(e,t){const n=(t=Bt(t))*t,s=n*n;return{x:.5*((e=Bt(e))*(.8707-.131979*n+s*(s*(.003971*n-.001529*s)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+n*(.015085+s*(.028874*n-.044475-.005916*s)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let n=t=(2*(1-t)-1)*Math.PI,s=25,l=0,c=n*n;do{c=n*n;const _=c*c;l=(n*(1.007226+c*(.015085+_*(.028874*c-.044475-.005916*_)))-t)/(1.007226+c*(.045255+_*(.259866*c-.311325-.005916*11*_))),n=yt(n-l,-Tx,Tx)}while(Math.abs(l)>1e-6&&--s>0);c=n*n;const h=yt(Ur(e/(.8707+c*(c*(c*c*c*(.003971-.001529*c)-.013791)-.131979))),-180,180),p=Ur(n);return new Wt(h,p)}}const Ex=Bt(f);class Ow extends Dc{project(e,t){t=Bt(t),e=Bt(e);const n=Math.cos(t),s=2/Math.PI,l=Math.acos(n*Math.cos(e/2)),c=Math.sin(l)/l,h=.5*(e*s+2*n*Math.sin(e/2)/c)||0,p=.5*(t+Math.sin(t)/c)||0;return{x:.5*(h/Math.PI+.5),y:1-.5*(p/Math.PI+1),z:0}}unproject(e,t){let n=e=(2*e-.5)*Math.PI,s=t=(2*(1-t)-1)*Math.PI,l=25;const c=1e-6;let h=0,p=0;do{const _=Math.cos(s),y=Math.sin(s),v=2*y*_,b=y*y,T=_*_,S=Math.cos(n/2),A=Math.sin(n/2),C=2*S*A,D=A*A,F=1-T*S*S,O=F?1/F:0,z=F?Math.acos(_*S)*Math.sqrt(1/F):0,N=.5*(2*z*_*A+2*n/Math.PI)-e,j=.5*(z*y+s)-t,te=.5*O*(T*D+z*_*S*b)+1/Math.PI,G=O*(C*v/4-z*y*A),W=.125*O*(v*A-z*y*T*C),K=.5*O*(b*S+z*D*_)+.5,ee=G*W-K*te;h=(j*G-N*K)/ee,p=(N*W-j*te)/ee,n=yt(n-h,-Math.PI,Math.PI),s=yt(s-p,-Ex,Ex)}while((Math.abs(h)>c||Math.abs(p)>c)&&--l>0);return new Wt(Ur(n),Ur(s))}}class Sx extends Dc{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Bt(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:n,cosPhi:s}=this;return{x:Bt(e)*s*n+.5,y:-Math.sin(Bt(t))/s*n+.5,z:0}}unproject(e,t){const{scale:n,cosPhi:s}=this,l=-(t-.5)/n,c=yt(Ur((e-.5)/n)/s,-180,180),h=Math.asin(yt(l*s,-1,1)),p=yt(Ur(h),-85.051129,f);return new Wt(c,p)}}class Bw extends wx{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,n){const s=af(e,t,n);return hi(s,s,Jp(Na(n))),{x:s[0],y:s[1],z:s[2]}}locationPoint(e,t,n){const s=Sl(t.lat,t.lng),l=ti([],s),c=n?e._centerAltitude+n:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;cn(s,s,l,o(1,0)*We*c);const h=er(new Float64Array(16));return zt(h,e.pixelMatrix,e.globeMatrix),hi(s,s,h),new Le(s[0],s[1])}pixelsPerMeter(e,t){return o(1,0)*t}pixelSpaceConversion(e,t,n){const s=o(1,e)*t,l=lt(o(1,45)*t,s,n);return this.pixelsPerMeter(e,t)/l}createTileMatrix(e,t,n){const s=cg(Na(n.canonical));return zt(new Float64Array(16),e.globeMatrix,s)}createInversionMatrix(e,t){const{center:n}=e,s=Jp(Na(t));return So(s,s,Bt(n.lng)),Is(s,s,Bt(n.lat)),mr(s,s,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(s)}pointCoordinate(e,t,n,s){return fx(e,t,n,!0)||new E(0,0)}pointCoordinate3D(e,t,n){const s=this.pointCoordinate(e,t,n,0);return[s.x,s.y,s.z]}isPointAboveHorizon(e,t){return!fx(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(s,l){const c=s.cameraToCenterDistance,h=s._centerAltitude*l,p=s._camera,_=s._camera.forward(),y=Yi([],oi([],_,-c),[0,0,h]),v=s.worldSize/(2*Math.PI),b=[0,0,-v],T=s.width/s.height,S=Math.tan(s.fovAboveCenter),A=oi([],p.up(),S),C=oi([],p.right(),S*T),D=ti([],Yi([],Yi([],_,A),C)),F=[];let O;if(new qp(y,D).closestPointOnSphere(b,v,F)){const z=Yi([],F,b),N=Li([],z,y);O=Math.cos(s.fovAboveCenter)*Xi(N)}else{const z=Li([],y,b),N=Li([],b,y);ti(N,N);const j=Xi(z)-v;O=Math.sqrt(j*(j+2*v));const te=Math.acos(O/(v+j))-Math.acos(Di(_,N));O*=Math.cos(te)}return 1.01*O}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Ll(e.zoom);if(n>0){const s=xx(e,o(1,e.center.lat)*e.worldSize),l=e.worldSize/(2*Math.PI),c=Math.max(e.width,e.height)/e.worldSize*Math.PI;return lt(t,s+l*(1-Math.cos(c)),Math.pow(n,10))}return t}upVector(e,t,n){return af(t,n,e,1)}upVectorScale(e){return{metersToTile:Wp(Yp(Na(e)))}}}function im(i){const e=i.parallels,t=!!e&&Math.abs(e[0]+e[1])<.01;switch(i.name){case"mercator":return new wx(i);case"equirectangular":return new Lw(i);case"naturalEarth":return new Fw(i);case"equalEarth":return new Dw(i);case"winkelTripel":return new Ow(i);case"albers":return t?new Sx(i):new Pw(i);case"lambertConformalConic":return t?new Sx(i):new zw(i);case"globe":return new Bw(i)}throw new Error(`Invalid projection name: ${i.name}`)}const df=Number.MAX_SAFE_INTEGER,kw=df-1;function Ix(i,e,t,n){return i.order<e||i.order===df||!(i.clipMask&t)||function(s,l){if(l.length===0)return!1;let c=s;for(;c!=="";){if(l.includes(c))return!1;c=Mp(c)}return!0}(n,i.clipScope)}function rm(i,e){return i.x-e.x||i.y-e.y}function Ax(i,e){return rm(i.min,e.min)===0&&rm(i.max,e.max)===0}function fg(i,e){return!(i.min.x>e.max.x||i.max.x<e.min.x||i.min.y>e.max.y||i.max.y<e.min.y)}function nm(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(i[t].sourceId!==e[t].sourceId||!Ax(i[t],e[t])||i[t].order!==e[t].order||i[t].clipMask!==e[t].clipMask||!as(i[t].clipScope,e[t].clipScope))return!1;return!0}function Cx(i,e,t){const n=1/We,s=1/(1<<t.canonical.z),l=(e.x*n+t.canonical.x)*s+t.wrap,c=(e.y*n+t.canonical.y)*s;return{min:new Le((i.x*n+t.canonical.x)*s+t.wrap,(i.y*n+t.canonical.y)*s),max:new Le(l,c)}}function Nw(i,e,t){const n=1<<t.canonical.z,s=((e.x-t.wrap)*n-t.canonical.x)*We,l=(e.y*n-t.canonical.y)*We;return{min:new Le(((i.x-t.wrap)*n-t.canonical.x)*We,(i.y*n-t.canonical.y)*We),max:new Le(s,l)}}function pg(i,e,t,n,s,l,c){const h=i.indices,p=i.vertices,_=[];for(let y=n;y<n+s;y+=3){const v=e[t[y+0]+l],b=e[t[y+1]+l],T=e[t[y+2]+l],S=Math.min(v.x,b.x,T.x),A=Math.max(v.x,b.x,T.x),C=Math.min(v.y,b.y,T.y),D=Math.max(v.y,b.y,T.y);_.length=0,i.grid.query(new Le(S,C),new Le(A,D),_);for(let F=0;F<_.length;F++){const O=_[F];if(Y_(p[h[3*O+0]],p[h[3*O+1]],p[h[3*O+2]],v,b,T,c))return!0}}return!1}function Mx(i,e,t,n){if(!i||!t)return!1;let s=i.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(t.vertices.length<i.vertices.length)return Mx(t,n,i,e);const l=e.canonical,c=n.canonical,h=Math.pow(2,c.z-l.z);s=i.vertices.map(p=>new Le((p.x+l.x*We)*h-c.x*We,(p.y+l.y*We)*h-c.y*We))}return pg(t,s,i.indices,0,i.indices.length,0,0)}function Rx(i,e,t,n){const s=Math.pow(2,n.z-t.z);return new Le((i+t.x*We)*s-n.x*We,(e+t.y*We)*s-n.y*We)}function mg(i,e){const t=[];e.grid.queryPoint(i,t);const n=e.indices,s=e.vertices;for(let l=0;l<t.length;l++){const c=t[l];if(Ac([s[n[3*c+0]],s[n[3*c+1]],s[n[3*c+2]]],i))return!0}return!1}const _g=4294967296,Px=1/_g,Dx=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class om{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,n=this.length){let s;for(;s=this.nextField(n);)e(s,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*_g;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*_g;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf,n=t[this.pos++];if(n<128)return n;let s,l=127&n;return s=t[this.pos++],l|=(127&s)<<7,s<128?l:(s=t[this.pos++],l|=(127&s)<<14,s<128?l:(s=t[this.pos++],l|=(127&s)<<21,s<128?l:(s=t[this.pos],l|=(15&s)<<28,function(c,h,p){const _=p.buf;let y,v;if(v=_[p.pos++],y=(112&v)>>4,v<128||(v=_[p.pos++],y|=(127&v)<<3,v<128)||(v=_[p.pos++],y|=(127&v)<<10,v<128)||(v=_[p.pos++],y|=(127&v)<<17,v<128)||(v=_[p.pos++],y|=(127&v)<<24,v<128)||(v=_[p.pos++],y|=(1&v)<<31,v<128))return Uh(c,y,h);throw new Error("Expected varint not more than 10 bytes")}(l,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Dx?Dx.decode(this.buf.subarray(t,e)):function(n,s,l){let c="",h=s;for(;h<l;){const p=n[h];let _,y,v,b=null,T=p>239?4:p>223?3:p>191?2:1;if(h+T>l)break;T===1?p<128&&(b=p):T===2?(_=n[h+1],(192&_)==128&&(b=(31&p)<<6|63&_,b<=127&&(b=null))):T===3?(_=n[h+1],y=n[h+2],(192&_)==128&&(192&y)==128&&(b=(15&p)<<12|(63&_)<<6|63&y,(b<=2047||b>=55296&&b<=57343)&&(b=null))):T===4&&(_=n[h+1],y=n[h+2],v=n[h+3],(192&_)==128&&(192&y)==128&&(192&v)==128&&(b=(15&p)<<18|(63&_)<<12|(63&y)<<6|63&v,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,T=1):b>65535&&(b-=65536,c+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),c+=String.fromCharCode(b),h+=T}return c}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){const t=7&e;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else{if(t!==1)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}}function Uh(i,e,t){return t?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Lx(i,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));t.realloc(n),t.buf.copyWithin(i+n,i,t.pos)}function Vw(i,e){const t=i.length;let n=e.buf,s=e.pos,l=e.length;for(let c=0;c<t;c++){let h=i[c];if(h<0||s+10>l)e.pos=s,e.writeVarint(h),n=e.buf,s=e.pos,l=e.length;else{for(;h>127;)n[s++]=h%128|128,h=Math.floor(h/128);n[s++]=h}}e.pos=s}function Uw(i,e){for(let t=0;t<i.length;t++)e.writeSVarint(i[t])}function jw(i,e){for(let t=0;t<i.length;t++)e.writeFloat(i[t])}function Gw(i,e){for(let t=0;t<i.length;t++)e.writeDouble(i[t])}function Hw(i,e){for(let t=0;t<i.length;t++)e.writeBoolean(i[t])}function Zw(i,e){for(let t=0;t<i.length;t++)e.writeFixed32(i[t])}function $w(i,e){for(let t=0;t<i.length;t++)e.writeSFixed32(i[t])}function qw(i,e){for(let t=0;t<i.length;t++)e.writeFixed64(i[t])}function Ww(i,e){for(let t=0;t<i.length;t++)e.writeSFixed64(i[t])}function Xw(i,e,t){let n;for(;n=i.nextField(e);)n===3?t.glyphs.push(Yw(i,i.readVarint()+i.pos)):n===4?t.ascender=i.readSVarint():n===5&&(t.descender=i.readSVarint())}function Yw(i,e){let t,n,s=0,l=0,c=0,h=0,p=0,_=0;for(;n=i.nextField(e);)n===1?s=i.readVarint():n===2?t=i.readBytes():n===3?l=i.readVarint():n===4?c=i.readVarint():n===5?h=i.readSVarint():n===6?p=i.readSVarint():n===7&&(_=i.readVarint());return{id:s,bitmap:new Cc({width:l+6,height:c+6},t),metrics:{width:l,height:c,left:h,top:p,advance:_}}}function zx(i){let e=0,t=0;for(const c of i)e+=c.w*c.h,t=Math.max(t,c.w);i.sort((c,h)=>h.h-c.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),t),h:1/0}];let s=0,l=0;for(const c of i)for(let h=n.length-1;h>=0;h--){const p=n[h];if(!(c.w>p.w||c.h>p.h)){if(c.x=p.x,c.y=p.y,l=Math.max(l,c.y+c.h),s=Math.max(s,c.x+c.w),c.w===p.w&&c.h===p.h){const _=n.pop();_&&h<n.length&&(n[h]=_)}else c.h===p.h?(p.x+=c.w,p.w-=c.w):c.w===p.w?(p.y+=c.h,p.h-=c.h):(n.push({x:p.x+c.w,y:p.y,w:p.w-c.w,h:c.h}),p.y+=c.h,p.h-=c.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}function sm(i,e){return i.id<e.id?-1:i.id>e.id?1:i.version<e.version?-1:i.version>e.version?1:i.sx<e.sx?-1:i.sx>e.sx?1:i.sy<e.sy?-1:i.sy>e.sy?1:0}function am(i){let e=0;for(let t=0;t<i.length;t++)e=(e<<5)-e+i.charCodeAt(t),e&=e;return e}function xs(i,e){return(i<<5)-i+e}function Fx(i,e,t,n){for(const[s]of i.entries()){const l=n&&n.get(s)||ho.parse(s),c=l.id.toString(),h=e.get(c)||0;t.push({id:s,version:h,sx:l.sx,sy:l.sy})}}class gg{constructor(e,t,n,s,l="",c){this.scope=l,this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=t.size>0,Fx(e,n,this.iconDescriptors,c),Fx(t,n,this.patternDescriptors,c),this.iconDescriptors.sort(sm),this.patternDescriptors.sort(sm);let h=0;h=xs(h,am(l)),h=xs(h,1);const p=s?s.data:"";p&&(h=xs(h,am(p))),h=xs(h,1);for(const _ of this.iconDescriptors)h=xs(h,am(_.id)),h=xs(h,_.version),h=xs(h,_.sx),h=xs(h,_.sy);h=xs(h,1);for(const _ of this.patternDescriptors)h=xs(h,am(_.id)),h=xs(h,_.version),h=xs(h,_.sx),h=xs(h,_.sy);this.hash=h}subsetOf(e){return this.scope===e.scope&&this.isSubsetArray(this.iconDescriptors,e.iconDescriptors,sm)&&this.isSubsetArray(this.patternDescriptors,e.patternDescriptors,sm)}isSubsetArray(e,t,n){let s=0,l=0;if(e.length>t.length)return!1;for(;s<e.length&&l<t.length;){const c=n(e[s],t[l]);if(c===0)s++,l++;else{if(c<0)return!1;l++}}return s===e.length}}function yg(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 xg(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}}tt(gg,"AtlasContentDescriptor");class lm{constructor(e,t,n,s){this.context=e,this.format=n,this.useMipmap=s&&s.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:s&&s.premultiply})}update(e,t){const n=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,s=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:l}=this,{gl:c}=l,{x:h,y:p}=t&&t.position?t.position:{x:0,y:0},_=h+n,y=p+s;this.size&&(this.size[0]!==_||this.size[1]!==y)&&(!t||t.recreateWhenResize===void 0||t.recreateWhenResize)&&(c.bindTexture(c.TEXTURE_2D,null),c.deleteTexture(this.texture),this.texture=c.createTexture(),this.size=null),c.bindTexture(c.TEXTURE_2D,this.texture),l.pixelStoreUnpackFlipY.set(!1),l.pixelStoreUnpack.set(1),l.pixelStoreUnpackPremultiplyAlpha.set(this.format===c.RGBA8&&(!t||t.premultiply!==!1));const v=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&_>0&&y>0){const b=this.useMipmap?Math.floor(Math.log2(Math.max(_,y)))+1:1;c.texStorage2D(c.TEXTURE_2D,b,this.format,_,y),this.size=[_,y]}this.size&&(v?c.texSubImage2D(c.TEXTURE_2D,0,h,p,yg(this.format),xg(this.format),e):"data"in e&&e.data&&c.texSubImage2D(c.TEXTURE_2D,0,h,p,n,s,yg(this.format),xg(this.format),e.data)),this.useMipmap&&c.generateMipmap(c.TEXTURE_2D)}bind(e,t,n=!1){const{context:s}=this,{gl:l}=s;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,t),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,n,s,l){const{context:c}=this,{gl:h}=c;h.bindTexture(h.TEXTURE_2D,this.texture),t!==this.magFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,n),this.wrapS=n),s!==this.wrapT&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,s),this.wrapT=s),l!==this.compareMode&&(l?(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_COMPARE_MODE,h.COMPARE_REF_TO_TEXTURE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_COMPARE_FUNC,l)):h.texParameteri(h.TEXTURE_2D,h.TEXTURE_COMPARE_MODE,h.NONE),this.compareMode=l)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Ox{constructor(e,t,n,s){this.context=e,this.format=s,this.size=n,this.texture=e.gl.createTexture();const[l,c,h]=this.size,{gl:p}=e;p.bindTexture(p.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in t&&t.data&&p.texImage3D(p.TEXTURE_3D,0,this.format,l,c,h,0,yg(this.format),xg(this.format),t.data)}bind(e,t){const{context:n}=this,{gl:s}=n;s.bindTexture(s.TEXTURE_3D,this.texture),e!==this.minFilter&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MAG_FILTER,e),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_S,t),s.texParameteri(s.TEXTURE_3D,s.TEXTURE_WRAP_T,t),this.wrapS=t)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class ff{static getImagePositionScale(e,t,n){if(t&&e){const{sx:s,sy:l}=e;return{x:s,y:l}}return{x:n,y:n}}constructor(e,t,n,s){this.paddedRect=e;const{pixelRatio:l,version:c,stretchX:h,stretchY:p,content:_,sdf:y,usvg:v}=t;this.pixelRatio=l,this.stretchX=h,this.stretchY=p,this.content=_,this.version=c,this.padding=n,this.sdf=y,this.usvg=v,this.scale=ff.getImagePositionScale(s,v,l)}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 Bx(i,e,t){const n=ho.parse(i),s=function(l,c,h=[1,1]){return{x:0,y:0,w:(l.data?l.data.width:l.width*h[0])+2*c,h:(l.data?l.data.height:l.height*h[1])+2*c}}(e,t,[n.sx,n.sy]);return{bin:s,imagePosition:new ff(s,e,t,n),imageVariant:n}}function vg(i,e){const t=[];for(const[s,l]of i.entries()){const c=ho.parse(s);c&&(t.push({key:s,value:l,variant:c}),e&&e.set(s,c))}t.sort((s,l)=>{const c=s.variant.id.toString().localeCompare(l.variant.id.toString());return c!==0?c:s.variant.sx!==l.variant.sx?s.variant.sx-l.variant.sx:s.variant.sy!==l.variant.sy?s.variant.sy-l.variant.sy:s.key.localeCompare(l.key)});const n=new Map;for(const s of t)n.set(s.key,s.value);return n}class kx{constructor(e){this.sourceAtlasHash=e}}class Nx{constructor(e,t,n,s,l=""){const c=new Map,h=new Map;this.haveRenderCallbacks=[];const p=[],_=s!==void 0,y=_?new Map:void 0,v=_?vg(e,y):e,b=_?vg(t,y):t;this.addImages(v,c,1,p),this.addImages(b,h,2,p);const{w:T,h:S}=zx(p),A=new An({width:T||1,height:S||1});for(const[C,D]of v.entries()){const F=c.get(C).paddedRect;An.copy(D.data,A,{x:0,y:0},{x:F.x+1,y:F.y+1},D.data,null,D.sdf)}for(const[C,D]of b.entries()){const F=h.get(C),O=F.paddedRect;let z=F.padding;const N=O.x+z,j=O.y+z,te=D.data.width,G=D.data.height;z=z>
vendor: 4,534 bytes, line 7
71?z-1:z,An.copy(D.data,A,{x:0,y:0},{x:N,y:j},D.data,n),An.copy(D.data,A,{x:0,y:G-z},{x:N,y:j-z},{width:te,height:z},n),An.copy(D.data,A,{x:0,y:0},{x:N,y:j+G},{width:te,height:z},n),An.copy(D.data,A,{x:te-z,y:0},{x:N-z,y:j},{width:z,height:G},n),An.copy(D.data,A,{x:0,y:0},{x:N+te,y:j},{width:z,height:G},n),An.copy(D.data,A,{x:te-z,y:G-z},{x:N-z,y:j-z},{width:z,height:z},n),An.copy(D.data,A,{x:0,y:G-z},{x:N+te,y:j-z},{width:z,height:z},n),An.copy(D.data,A,{x:0,y:0},{x:N+te,y:j+G},{width:z,height:z},n),An.copy(D.data,A,{x:te-z,y:0},{x:N-z,y:j+G},{width:z,height:z},n)}this.lut=n,this.image=A,this.iconPositions=c,this.patternPositions=h,_&&(this.contentDescriptor=new gg(v,b,s,n,l,y))}addImages(e,t,n,s){for(const[l,c]of e.entries()){const{bin:h,imagePosition:p,imageVariant:_}=Bx(l,c,n);t.set(l,p),s.push(h),c.hasRenderCallback&&this.haveRenderCallbacks.push(_.id)}}patchUpdatedImages(e,t,n,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(l=>e.hasImage(l,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const l of e.getUpdatedImages(n)){for(const c of this.iconPositions.keys()){const h=ho.parse(c);if(Ir.isEqual(h.id,l)){const p=e.getImage(l,n);this.patchUpdatedImage(this.iconPositions.get(c),p,t,null)}}for(const c of this.patternPositions.keys()){const h=ho.parse(c);if(Ir.isEqual(h.id,l)){const p=e.getImage(l,n);this.patchUpdatedImage(this.patternPositions.get(c),p,t,s||this.lut)}}}}patchUpdatedImage(e,t,n,s=null){if(!e||!t||e.version===t.version)return;e.version=t.version;const[l,c]=e.tl,h=e.sdf;if(this.lut||h){const p={width:t.data.width,height:t.data.height},_=new An(p);An.copy(t.data,_,{x:0,y:0},{x:0,y:0},p,s,h),n.update(_,{position:{x:l,y:c},recreateWhenResize:!1})}else n.update(t.data,{position:{x:l,y:c},recreateWhenResize:!1})}}tt(ff,"ImagePosition"),tt(Nx,"ImageAtlas",{omit:["lut"]}),tt(kx,"ImageAtlasReference");class pf{constructor(e){this.pendingRequests=new Map,this.cachedRanges=new Map,this.fontstackCompositing=e&&e.fontstackCompositing||"client"}loadGlyphRange(e,t,n,s,l){if(this.fontstackCompositing==="server")return void pf.loadGlyphRange(e,t,n,s,l);const c=e.split(",").map(h=>h.trim()).filter(h=>h.length>0);c.length!==0?c.length!==1?this._loadMultipleFonts(c,t,n,s,l):this._loadFont(c[0],t,n,s,l):l(new Error("Empty fontstack"))}_loadMultipleFonts(e,t,n,s,l){const c=e.map(()=>null),h={completed:0,firstError:null,callbackCalled:!1},p=(_,y,v)=>{if(!h.callbackCalled&&(y&&!h.firstError&&(h.firstError=y),v&&(c[_]=v),h.completed++,h.completed===e.length)){h.callbackCalled=!0;const b=c.filter(S=>S!==null);if(b.length===0)return void l(h.firstError||new Error("All fonts failed to load"));const T=this._composeGlyphs(b);l(null,T)}};for(let _=0;_<e.length;_++)this._loadFont(e[_],t,n,s,(y,v)=>{p(_,y,v)})}_loadFont(e,t,n,s,l){const c=`${e}:${t}`;if(this.cachedRanges.has(c)){const p=this.cachedRanges.get(c);return void Y.frame(()=>l(null,p))}const h=this.pendingRequests.get(c);h?h.push(l):(this.pendingRequests.set(c,[l]),pf.loadGlyphRange(e,t,n,s,(p,_)=>{p||this.cachedRanges.set(c,_||null);const y=this.pendingRequests.get(c);if(this.pendingRequests.delete(c),y)for(const v of y)v(p,_)}))}_composeGlyphs(e){const t={};let n,s;for(const l of e)if(n===void 0&&l.ascender!==void 0&&(n=l.ascender),s===void 0&&l.descender!==void 0&&(s=l.descender),l.glyphs)for(const c in l.glyphs)t[c]===void 0&&(t[c]=l.glyphs[c]);return{glyphs:t,ascender:n,descender:s}}}pf.loadGlyphRange=async function(i,e,t,n,s){const l=256*e,c=l+255;let h;try{const p=await n.transformRequest(n.normalizeGlyphsURL(t).replace("{fontstack}",i).replace("{range}",`${l}-${c}`),pi.Glyphs),{data:_}=await vi(p),y={},v=function(b){return function(T){const S={glyphs:[]};let A;for(;A=T.nextField();)A===1&&Xw(T,T.readVarint()+T.pos,S);return S}(new om(b))}(_);for(const b of v.glyphs)y[b.id]=b;h={glyphs:y,ascender:v.ascender,descender:v.descender}}catch(p){return s(p)}s(null,h)};const mf=1e20,bg=new Float64Array(256);for(let i=0;i<256;i++){const e=.5-Math.pow(i/255,.45454545454545453);bg[i]=e*Math.abs(e)}function Vx(i,e,t,n,s,l,c,h,p){for(let _=e;_<e+n;_++)Ux(i,t*l+_,l,s,c,h,p);for(let _=t;_<t+s;_++)Ux(i,_*l+e,1,n,c,h,p)}function Ux(i,e,t,n,s,l,c){l[0]=0,c[0]=-mf,c[1]=mf,s[0]=i[e];for(let h=1,p=0,_=0;h<n;h++){s[h]=i[e+h*t];const y=h*h;do{const v=l[p];_=(s[h]-s[v]+y-v*v)/(h-v)/2}while(_<=c[p]&&--p>-1);p++,l[p]=h,c[p]=_,c[p+1]=mf}for(let h=0,p=0;h<n;h++){for(;c[p+1]<h;)p++;const _=l[p],y=h-_;i[e+h*t]=s[_]+y*y}}bg[255]=-mf;const Kw=/bold/i,Jw=/medium/i,Qw=/light/i,wg={none:0,ideographs:1,all:2};
vendor: 8,960 bytes, line 7
7class cm{constructor(e,t,n,s){this.requestManager=e,this.localGlyphMode=t,this.localFontFamily=n,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}},this.glyphLoader=new pf({fontstackCompositing:s})}setURL(e){this.url=e}prefetchRange(e,t){const n=this.url||ie.GLYPHS_URL;if(!n)return;let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}}),s.ranges[t]||s.requests[t]||(s.requests[t]=[],this.glyphLoader.loadGlyphRange(e,t,n,this.requestManager,(l,c)=>{if(c){s.ascender=c.ascender,s.descender=c.descender;for(const h in c.glyphs)this._doesCharSupportLocalGlyph(+h)||(s.glyphs[+h]=c.glyphs[+h]);s.ranges[t]=!0}for(const h of s.requests[t]||[])h(l,c);delete s.requests[t]}))}getGlyphs(e,t){const n=[],s=this.url||ie.GLYPHS_URL;for(const l in e)for(const c of e[l])n.push({stack:l,id:c});Cs(n,({stack:l,id:c},h)=>{let p=this.entries[l];p||(p=this.entries[l]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let _=p.glyphs[c];if(_!==void 0)return void h(null,{stack:l,id:c,glyph:_});if(_=this._tinySDF(p,l,c),_)return p.glyphs[c]=_,void h(null,{stack:l,id:c,glyph:_});const y=Math.floor(c/256);if(256*y>65535)return gi("glyphs > 65535 not supported"),void h(null,{stack:l,id:c,glyph:_});if(p.ranges[y])return void h(null,{stack:l,id:c,glyph:_});let v=p.requests[y];v||(v=p.requests[y]=[],this.glyphLoader.loadGlyphRange(l,y,s,this.requestManager,(b,T)=>{if(T){p.ascender=T.ascender,p.descender=T.descender;for(const S in T.glyphs)this._doesCharSupportLocalGlyph(+S)||(p.glyphs[+S]=T.glyphs[+S]);p.ranges[y]=!0}for(const S of v)S(b,T);delete p.requests[y]})),v.push((b,T)=>{b?h(b):T&&h(null,{stack:l,id:c,glyph:T.glyphs[c]||null})})},(l,c)=>{if(l)t(l);else if(c){const h={};for(const{stack:p,id:_,glyph:y}of c)h[p]===void 0&&(h[p]={}),h[p].glyphs===void 0&&(h[p].glyphs={}),h[p].glyphs[_]=y&&{id:y.id,bitmap:y.bitmap.clone(),metrics:y.metrics},h[p].ascender=this.entries[p].ascender,h[p].descender=this.entries[p].descender;t(null,h)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==wg.none&&(this.localGlyphMode===wg.all?!!this.localFontFamily:!!this.localFontFamily&&(Bd(e)||yp(e)||mc(e)||wl(e)||yh(e)||_u(e)||(t=e)>=131072&&t<=173791||(n=>n>=66736&&n<=66815)(e)));var t}_tinySDF(e,t,n){const s=this.localFontFamily;if(!s||!this._doesCharSupportLocalGlyph(n))return;let l=e.tinySDF;if(!l){let C="400";Kw.test(t)?C="900":Jw.test(t)?C="500":Qw.test(t)&&(C="200"),l=e.tinySDF=new cm.TinySDF({fontFamily:s,fontWeight:C,fontSize:48,buffer:6,radius:16}),l.fontWeight=C}const c=l.fontWeight;if(this.localGlyphs[c][n])return this.localGlyphs[c][n];const h=String.fromCodePoint(n),{data:p,width:_,height:y,glyphWidth:v,glyphHeight:b,glyphLeft:T,glyphTop:S,glyphAdvance:A}=l.draw(h);return this.localGlyphs[c][n]={id:n,bitmap:new Cc({width:_,height:y},p),metrics:{width:v/2,height:b/2,left:T/2,top:S/2-27,advance:A/2,localGlyph:!0}}}}function jx(i,e){return i+e[1]-e[0]}function Gx(i,e,t,n,s=1){const l=[],c=i.imagePrimary,h=c.pixelRatio,p=c.paddedRect.w-2,_=c.paddedRect.h-2,y=(i.right-i.left)*s,v=(i.bottom-i.top)*s,b=c.stretchX||[[0,p]],T=c.stretchY||[[0,_]],S=b.reduce(jx,0),A=T.reduce(jx,0),C=p-S,D=_-A;let F=0,O=S,z=0,N=A,j=0,te=C,G=0,W=D;if(c.content&&n){const ee=c.content;F=um(b,0,ee[0]),z=um(T,0,ee[1]),O=um(b,ee[0],ee[2]),N=um(T,ee[1],ee[3]),j=ee[0]-F,G=ee[1]-z,te=ee[2]-ee[0]-O,W=ee[3]-ee[1]-N}const K=(ee,le,de,ve)=>{const xe=hm(ee.stretch-F,O,y,i.left*s),we=dm(ee.fixed-j,te,ee.stretch,S),Fe=hm(le.stretch-z,N,v,i.top*s),se=dm(le.fixed-G,W,le.stretch,A),pe=hm(de.stretch-F,O,y,i.left*s),ge=dm(de.fixed-j,te,de.stretch,S),Se=hm(ve.stretch-z,N,v,i.top*s),Me=dm(ve.fixed-G,W,ve.stretch,A),Pe=new Le(xe,Fe),Ie=new Le(pe,Fe),Oe=new Le(pe,Se),Be=new Le(xe,Se),Ke=new Le(we/h,se/h),Ne=new Le(ge/h,Me/h),He=e*Math.PI/180;if(He){const vt=Math.sin(He),ri=Math.cos(He),Gt=[ri,-vt,vt,ri];Pe._matMult(Gt),Ie._matMult(Gt),Be._matMult(Gt),Oe._matMult(Gt)}const ft=ee.stretch+ee.fixed,pt=de.stretch+de.fixed,xt=le.stretch+le.fixed,ht=ve.stretch+ve.fixed,wt=i.imageSecondary;return{tl:Pe,tr:Ie,bl:Be,br:Oe,texPrimary:{x:c.paddedRect.x+1+ft,y:c.paddedRect.y+1+xt,w:pt-ft,h:ht-xt},texSecondary:wt?{x:wt.paddedRect.x+1+ft,y:wt.paddedRect.y+1+xt,w:pt-ft,h:ht-xt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ke,pixelOffsetBR:Ne,minFontScaleX:te/h/y,minFontScaleY:W/h/v,isSDF:t}};if(c.stretchX||c.stretchY){const ee=Hx(b,C,S),le=Hx(T,D,A);for(let de=0;de<ee.length-1;de++){const ve=ee[de],xe=ee[de+1];for(let we=0;we<le.length-1;we++)l.push(K(ve,le[we],xe,le[we+1]))}}else l.push(K({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:p+1},{fixed:0,stretch:_+1}));return l}function um(i,e,t){let n=0;for(const s of i)n+=Math.max(e,Math.min(t,s[1]))-Math.max(e,Math.min(t,s[0]));return n}function Hx(i,e,t){const n=[{fixed:-1,stretch:0}];for(const[s,l]of i){const c=n.at(-1);n.push({fixed:s-c.stretch,stretch:c.stretch}),n.push({fixed:s-c.stretch,stretch:c.stretch+(l-s)})}return n.push({fixed:e+1,stretch:t}),n}function Zx(i){return 2*i.length+1}function hm(i,e,t,n){return i/e*t+n}function dm(i,e,t,n){return i-e*t/n}function eT(i,e,t,n){const s=e+i.positionedLines[n].lineOffset;return n===0?t+s/2:t+(s+(e+i.positionedLines[n-1].lineOffset))/2}function $x(i,e,t,n,s,l,c,h,p,_=1){const y=[];if(e.positionedLines.length===0)return y;const v=(p!==void 0?p:n.layout.get("text-rotate").evaluate(l,{}))*Math.PI/180,b=function(D){const F=D[0],O=D[1],z=F*O;return z>0?[F,-O]:z<0?[-F,O]:F===0?[O,F]:[O,-F]}(t);let T=Math.abs(e.top-e.bottom);for(const D of e.positionedLines)T-=D.lineOffset;const S=e.positionedLines.length,A=T/S;let C=e.top-t[1];for(let D=0;D<S;++D){const F=e.positionedLines[D];C=eT(e,A,C,D);for(const O of F.positionedGlyphs){if(!O.rect)continue;const z=O.rect||{};let N=4,j=!0,te=1,G=0;if(O.image){const Oe=c.get(O.image.toString());if(!Oe)continue;if(Oe.sdf){gi("SDF images are not supported in formatted text and will be ignored.");continue}j=!1,te=Oe.pixelRatio,N=1/te,Oe.usvg||(te/=_)}const W=(s||h)&&O.vertical,K=O.metrics.advance*O.scale/2,ee=O.metrics,le=O.rect;if(le===null)continue;h&&e.verticalizable&&(G=O.image?K-O.metrics.width*O.scale/2:0);const de=s?[O.x+K,O.y]:[0,0];let ve=[0,0],xe=[0,0],we=!1;s||(W?(xe=[O.x+K+b[0],O.y+b[1]-G],we=!0):ve=[O.x+K+t[0],O.y+t[1]-G]);const Fe=le.w*O.scale/(te*(O.localGlyph?2:1)),se=le.h*O.scale/(te*(O.localGlyph?2:1));let pe,ge,Se,Me;if(W){const Oe=O.y-C,Be=new Le(-K,K-Oe),Ke=-Math.PI/2,Ne=new Le(...xe);pe=new Le(-K+ve[0],ve[1]),pe._rotateAround(Ke,Be)._add(Ne),pe.x+=-Oe+K,pe.y-=(ee.left-N)*O.scale;const He=O.image?ee.advance*O.scale:Bh*O.scale,ft=String.fromCodePoint(O.glyph);yw(ft)?pe.x+=(1-N)*O.scale:xw(ft)?pe.x+=He-ee.height*O.scale+(-N-1)*O.scale:pe.x+=O.image||ee.width+2*N===le.w&&ee.height+2*N===le.h?(He-se)/2:(He-(ee.height+2*N)*O.scale)/2,ge=new Le(pe.x,pe.y-Fe),Se=new Le(pe.x+se,pe.y),Me=new Le(pe.x+se,pe.y-Fe)}else{const Oe=(ee.left-N)*O.scale-K+ve[0],Be=(-ee.top-N)*O.scale+ve[1],Ke=Oe+Fe,Ne=Be+se;pe=new Le(Oe,Be),ge=new Le(Ke,Be),Se=new Le(Oe,Ne),Me=new Le(Ke,Ne)}if(v){let Oe;Oe=s?new Le(0,0):we?new Le(b[0],b[1]):new Le(t[0],t[1]),pe._rotateAround(v,Oe),ge._rotateAround(v,Oe),Se._rotateAround(v,Oe),Me._rotateAround(v,Oe)}const Pe=new Le(0,0),Ie=new Le(0,0);y.push({tl:pe,tr:ge,bl:Se,br:Me,texPrimary:z,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:de,sectionIndex:O.sectionIndex,isSDF:j,pixelOffsetTL:Pe,pixelOffsetBR:Ie,minFontScaleX:0,minFontScaleY:0})}}return y}cm.TinySDF=class{constructor({fontSize:i=24,buffer:e=3,radius:t=8,cutoff:n=.25,fontFamily:s="sans-serif",fontWeight:l="normal",fontStyle:c="normal",lang:h=null}={}){this.buffer=e,this.radius=t,this.cutoff=n,this.lang=h;const p=this.size=i+4*e,_=this._createCanvas(p),y=this.ctx=_.getContext("2d",{willReadFrequently:!0});y.font=`${c} ${l} ${i}px ${s}`,y.textBaseline="alphabetic",y.textAlign="left",y.fillStyle="black",this.gridOuter=new Float64Array(p*p),this.gridInner=new Float64Array(p*p),this.f=new Float64Array(p),this.z=new Float64Array(p+1),this.v=new Uint16Array(p)}_createCanvas(i){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(i,i);const e=document.createElement("canvas");return e.width=e.height=i,e}draw(i){const{width:e,actualBoundingBoxAscent:t,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:l}=this.ctx.measureText(i),c=Math.ceil(t),h=Math.floor(-s),p=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(l)-h)),_=Math.max(0,Math.min(this.size-this.buffer,c+Math.ceil(n))),y=p+2*this.buffer,v=_+2*this.buffer,b=Math.max(y*v,0),T=new Uint8ClampedArray(b),S={data:T,width:y,height:v,glyphWidth:p,glyphHeight:_,glyphTop:c,glyphLeft:h,glyphAdvance:e};if(p===0||_===0)return S;const{ctx:A,buffer:C,gridInner:D,gridOuter:F}=this;this.lang&&(A.lang=this.lang),A.clearRect(C,C,p,_),A.fillText(i,C-h,C+c);const O=A.getImageData(C,C,p,_);F.fill(mf,0,b),D.fill(0,0,b);let z=3;for(let G=0;G<_;G++){let W=(G+C)*y+C;for(let K=0;K<p;K++,z+=4,W++){const ee=O.data[z];
vendor: 4,140 bytes, line 7
7if(ee===0)continue;const le=bg[ee];F[W]=Math.max(0,le),D[W]=Math.max(0,-le)}}Vx(F,0,0,y,v,y,this.f,this.v,this.z);const N=Math.min(C,1);Vx(D,C-N,C-N,p+2*N,_+2*N,y,this.f,this.v,this.z);const j=255/this.radius,te=255*(1-this.cutoff);for(let G=0;G<b;G++){const W=Math.sqrt(F[G])-Math.sqrt(D[G]);T[G]=Math.round(te-j*W)}return S}};class tT{constructor(e,t){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=t,this.appearances=e;const n=e.map(s=>function(l){if(!l.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};const c=l.condition.expression;return{featureDependent:!ml(c),stateDependent:!Ma(c),zoomDependent:!zs(c,["zoom"]),pitchDependent:!zs(c,["pitch"]),brightnessDependent:!zs(c,["brightness","measure-light"]),worldviewDependent:!zs(c,["worldview"])}}(s));this.anyFeatureDependent=n.some(s=>s.featureDependent),this.anyStateDependent=n.some(s=>s.stateDependent)}update(e,t){const n=this.lastParams,s=!n||n.zoom!==e.zoom||n.pitch!==(e.pitch||0)||n.brightness!==(e.brightness||0)||n.worldview!==e.worldview;this.lastParams={zoom:e.zoom,pitch:e.pitch||0,brightness:e.brightness||0,worldview:e.worldview};const l=t&&this.anyStateDependent;if(!s&&!l&&this.lastAllFeaturesIndex!==-2)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!l){const c=this.evaluateAllFeatures(e);return c===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=c,{kind:"all-features",appearanceIndex:c})}return{kind:"per-feature"}}evaluateAllFeatures(e){for(let t=0;t<this.appearances.length;t++){const n=this.appearances[t];if(n.condition&&n.condition.evaluate(e,void 0,void 0,void 0))return t}return-1}}const iT=Ic.types,rT=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function _f(i,e,t,n,s,l,c,h,p,_,y,v,b){const T=h?Math.min(Ru,Math.round(h[0])):0,S=h?Math.min(Ru,Math.round(h[1])):0;i.emplaceBack(e,t,Math.round(32*n),Math.round(32*s),l,c,(T<<1)+(p?1:0),0+(S<<1),16*_,16*y,256*v,256*b)}function gf(i,e,t){i.emplaceBack(e,t)}function yf(i,e,t,n,s,l,c){i.emplaceBack(e,t,n,s,l,c)}function fm(i,e,t,n,s){const l=5*e+2;i.float32[l+0]=t,i.float32[l+1]=n,i.float32[l+2]=s}function Pu(i,e,t,n,s){i.emplaceBack(e,t,n,s),i.emplaceBack(e,t,n,s),i.emplaceBack(e,t,n,s),i.emplaceBack(e,t,n,s)}function nT(i){for(const e of i.sections)if(Tp(e.text))return!0;return!1}const jh=12;class Tg{constructor(e){this.layoutVertexArray=new mt,this.indexArray=new bt,this.programConfigurations=e,this.segments=new fi,this.dynamicLayoutVertexArray=new Ge,this.opacityVertexArray=new Qe,this.placedSymbolArray=new Zr,this.iconTransitioningVertexArray=new dt,this.globeExtVertexArray=new qe,this.zOffsetVertexArray=new Ae,this.orientationVertexArray=new ai,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new Ae,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getBatchGrouping(e){const t=e.get().length===this.segments.get().length;if(t&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};const n=new Map;for(const c of e.get()){const h=c.batchIndex!==void 0?c.batchIndex:0;n.has(h)||n.set(h,[]),n.get(h).push(c)}const s=Array.from(n.keys()).sort((c,h)=>c-h),l=new Map;for(const c of s){const h=n.get(c);l.set(c,new fi(h))}return t&&(this.cachedBatchIndices=s,this.cachedBatchSegments=l),{batchIndices:s,batchSegments:l}}snapshotSymbolVertexData(e,t){const n=e*jh;return this.layoutVertexArray.uint16.slice(n,n+t*jh)}restoreSymbolVertexData(e,t){this.layoutVertexArray.uint16.set(t,e*jh)}snapshotIconTransitioningVertexData(e,t){const n=2*e;return this.iconTransitioningVertexArray.uint16.slice(n,n+2*t)}restoreIconTransitioningVertexData(e,t){this.iconTransitioningVertexArray.uint16.set(t,2*e)}updateSymbolVertexData(e,t,n,s,l,c,h,p,_,y,v,b,T){const S=this.layoutVertexArray.uint16,A=e*jh;
vendor: 2,779 bytes, line 7
7S[A]=t,S[A+1]=n,S[A+2]=s,S[A+3]=l,S[A+4]=c,S[A+5]=h,S[A+6]=p,S[A+7]=_,S[A+8]=y,S[A+9]=v,S[A+10]=b,S[A+11]=T}upload(e,t,n,s,l,c){this.isEmpty()||(n&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ow.members,!!c),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,aw.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,rT,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,hw.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,sw.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||l)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,lw.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,uw.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray.length>0&&(this.featureIdBuffer=e.createVertexBuffer(this.featureIdArray,cw.members,!1))),(n||s)&&(this.programConfigurations.upload(e),this.uboBinder&&this.uboBinder.upload(e)))}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())}}tt(Tg,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class Eg{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new fi,this.collisionVertexArray=new Dt,this.collisionVertexArrayExt=new Ge}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,dw.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,fw.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
vendor: 10,298 bytes, line 7
7stroy())}}tt(Eg,"CollisionBuffers");class pm{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(c=>c.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=er([]),this.placementViewportMatrix=er([]);const t=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=e.maxUniformBlockSizeDwords,this.textSizeData=kh(this.zoom,t["text-size"],this.worldview,e.availableImages),this.iconSizeData=kh(this.zoom,t["icon-size"],this.worldview,e.availableImages);const n=this.layers[0].layout,s=n.get("symbol-sort-key"),l=n.get("symbol-z-order");this.lut=e.lut,this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&s.constantOr(1)!==void 0,this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(c=>Rl[c]),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.featureAppearances=null,this.featureAppearanceData=new Map}hasAnyAppearanceLayoutProperty(e){const t=this.layers[0].getAppearances();if(!t||t.length===0)return!1;const n=Array.isArray(e)?e:[e];return t.some(s=>n.some(l=>s.hasLayoutProperty(l)))}getAppearanceFeatureData(e){return this.featureAppearanceData.get(e)}createArrays(){this.text=new Tg(new sa(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new Tg(new sa(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.text.uboBinder=new tg(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new tg(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.glyphOffsetArray=new ms,this.lineVertexArray=new bi,this.symbolInstances=new In}calculateGlyphDependencies(e,t,n,s,l){for(const c of e){const h=c.codePointAt(0);if(h===void 0)break;if(t[h]=!0,s&&l&&h<=65535){const p=sf[c];p&&(t[p.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,t,n,s,l,c,h){if(!e.hasLayoutProperty("icon-size"))return h*c;let p=1;const _=e.getUnevaluatedLayoutProperty("icon-size"),y=kh(this.zoom,_,this.worldview,l),v=Mu(y,t);if(y.kind!=="constant"&&y.kind!=="camera"||(p=v.uSize),y.kind==="composite"){const{minZoom:b,maxZoom:T}=y,S=_.possiblyEvaluate(new Oi(b,{worldview:this.worldview}),s),A=_.possiblyEvaluate(new Oi(T,{worldview:this.worldview}),s),C=S.evaluate(n,{},s,l);p=C+(A.evaluate(n,{},s,l)-C)*v.uSizeT}return y.kind==="source"&&(p=_.possiblyEvaluate(new Oi(this.zoom,{worldview:this.worldview}),s).evaluate(n,{},s,l)),p*c}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!nm(this.activeReplacements,n)&&(this.activeReplacements=n,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?fn.build(e):e}populate(e,t,n,s){const l=this.layers[0],c=l.layout,h=this.projection.name==="globe",p=c.get("text-font"),_=c.get("text-field"),y=c.get("icon-image"),[v,b]=c.get("icon-size-scale-range"),T=yt(t.scaleFactor||1,v,b),[S,A]=c.get("text-size-scale-range"),C=yt(t.scaleFactor||1,S,A),D=(_.value.kind!=="constant"||_.value.value instanceof Ar&&!_.value.value.isEmpty()||_.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),F=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,O=this.hasAnyAppearanceLayoutProperty("icon-image"),z=c.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!D&&!F&&!O)return;const N=t.iconDependencies,j=t.glyphDependencies,te=t.availableImages,G=new Oi(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),W=K=>{const ee=K.id.toString();N.has(ee)?N.get(ee).push(K):N.set(ee,[K])};for(const K of e){const{feature:ee,id:le,index:de,sourceLayerIndex:ve}=K,xe=l._featureFilter.needGeometry,we=X(ee,xe);if(!l._featureFilter.filter(G,we,n))continue;if(xe||(we.geometry=q(ee,n,s)),h&&ee.type!==1&&n.z<=5){const Ie=we.geometry,Oe=.98078528056,Be=(Ke,Ne)=>Di(af(Ke.x,Ke.y,n,1),af(Ne.x,Ne.y,n,1))<Oe;for(let Ke=0;Ke<Ie.length;Ke++)Ie[Ke]=B(Ie[Ke],Be)}let Fe,se;if(D){const Ie=l.getValueAndResolveTokens("text-field",we,n,te),Oe=Ar.factory(Ie);nT(Oe)&&(this.hasRTLText=!0),(!this.hasRTLText||Hd()==="unavailable"||this.hasRTLText&&Fa.isParsed())&&(Fe=gw(Oe,l,we))}if(F){const Ie=l.getValueAndResolveTokens("icon-image",we,n,te);se=this.getResolvedImageFromTokens(Ie)}const pe=this.layers[0];let ge=!1;if(!se&&O){const Ie=pe.getAppearances();for(const Oe of Ie)if(Oe.getLayoutProperty("icon-image")){const Be=pe.getAppearanceValueAndResolveTokens(Oe,"icon-image",we,n,te);if(Be){se=this.getResolvedImageFromTokens(Be),ge=!0;break}}}if(!Fe&&!se)continue;const Se=this.sortFeaturesByKey?z.evaluate(we,{},n):void 0,Me={id:le,text:Fe,icon:se,index:de,sourceLayerIndex:ve,geometry:we.geometry,properties:ee.properties,type:iT[ee.type],sortKey:Se};if(this.features.push(Me),this.featureAppearanceData.set(de,{id:le,properties:ee.properties,usesAppearanceIconAsPlaceholder:ge}),se){const Ie=pe._unevaluatedLayout._values,{iconPrimary:Oe,iconSecondary:Be}=ig(se,this.iconSizeData,Ie["icon-size"],n,this.zoom,Me,this.pixelRatio,T,this.worldview,te);W(Oe),Be&&(this.hasAnySecondaryIcon=!0,W(Be))}const Pe=pe.getAppearances();if(Pe.length!==0&&Pe.forEach(Ie=>{if(!Ie.getLayoutProperty("icon-image"))return;const{iconPrimary:Oe,iconSecondary:Be}=this.getCombinedIconVariants(Ie,pe,we,n,te,Me,T);Oe&&(W(Oe),Be&&(this.hasAnySecondaryIcon=!0,W(Be)))}),Fe){const Ie=p.evaluate(we,{},n).join(","),Oe=c.get("text-rotation-alignment")==="map"&&c.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(Rl.vertical);for(const Be of Fe.sections)if(Be.image){const Ke=Be.image.getPrimary().scaleSelf(this.pixelRatio*C),Ne=Ke.id.toString(),He=N.get(Ne)||[];He.push(Ke),N.set(Ne,He)}else{const Ke=bp(Fe.toString()),Ne=Be.fontStack||Ie,He=j[Ne]=j[Ne]||{};this.calculateGlyphDependencies(Be.text,He,Oe,this.allowVerticalPlacement,Ke)}}}c.get("symbol-placement")==="line"&&(this.features=function(K){const ee={},le={},de=[];let ve=0;function xe(pe){de.push(K[pe]),ve++}function we(pe,ge,Se){const Me=le[pe];return delete le[pe],le[ge]=Me,de[Me].geometry[0].pop(),de[Me].geometry[0]=de[Me].geometry[0].concat(Se[0]),Me}function Fe(pe,ge,Se){const Me=ee[ge];return delete ee[ge],ee[pe]=Me,de[Me].geometry[0].shift(),de[Me].geometry[0]=Se[0].concat(de[Me].geometry[0]),Me}function se(pe,ge,Se){const Me=Se?ge[0].at(-1):ge[0][0];return`${pe}:${Me.x}:${Me.y}`}for(let pe=0;pe<K.length;pe++){const ge=K[pe],Se=ge.geometry,Me=ge.text?ge.text.toString():null;if(!Me||Se.length>1){xe(pe);continue}const Pe=se(Me,Se,!1),Ie=se(Me,Se,!0);if(Pe in le&&Ie in ee&&le[Pe]!==ee[Ie]){const Oe=Fe(Pe,Ie,Se),Be=we(Pe,Ie,de[Oe].geometry);delete ee[Pe],delete le[Ie],le[se(Me,de[Be].geometry,!0)]=Be,de[Oe].geometry=null}else Pe in le?we(Pe,Ie,Se):Ie in ee?Fe(Pe,Ie,Se):(xe(pe),ee[Pe]=ve-1,le[Ie]=ve-1)}return de.filter(pe=>pe.geometry)}(this.features)),c.get("symbol-elevation-reference")==="hd-road-markup"?(this.elevationType="road",this.hdExt&&(this.hdExt.configureCrossSource(n,t.elevationParams,t.crossSourceElevationEnabled,t.terrainEnabled),t.elevationFeatures&&t.elevationFeatures.length>0&&this.hdExt.addElevationFeatures(t.elevationFeatures,n))):c.get("symbol-z-elevate")&&(this.elevationType="offset"),this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((K,ee)=>K.sortKey-ee.sortKey)}getCombinedIconVariants(e,t,n,s,l,c,h){let p;if(e.hasLayoutProperty("icon-image")){const _=t.getAppearanceValueAndResolveTokens(e,"icon-image",n,s,l);p=this.getResolvedImageFromTokens(_)}else{const _=t.getValueAndResolveTokens("icon-image",n,s,l);p=this.getResolvedImageFromTokens(_)}if(p){const _=e.hasLayoutProperty("icon-size")?e.getUnevaluatedLayoutProperty("icon-size"):t._unevaluatedLayout._values["icon-size"],y=kh(this.zoom,_,this.worldview,l),{iconPrimary:v,iconSecondary:b}=ig(p,y,_,s,this.zoom,c,this.pixelRatio,h,this.worldview,l);return{iconPrimary:v,iconSecondary:b}}return{iconPrimary:void 0,iconSecondary:void 0}}getCombinedIconPrimary(e,t,n,s,l,c,h){return this.getCombinedIconVariants(e,t,n,s,l,c,h).iconPrimary}updateSymbolInstanceIconVertices(e,t,n,s,l,c){const{canonical:h,availableImages:p,globalProperties:_,layer:y,iconScaleFactor:v,featureState:b,layoutIconOffset:T,layoutIconSize:S,layoutIconRotate:A}=c;if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(t.activeAppearanceIndex===n)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};const C=n>=0?y.appearances[n]:null;if(C){const D={sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:t.properties,type:"Point",id:t.id},{iconPrimary:F,iconSecondary:O}=this.getCombinedIconVariants(C,y,s,h,p,D,v);if(!F)return{vertexOffsetDelta:0,hasChanges:!1};const z=F.toString(),N=this.iconAtlasPositions&&this.iconAtlasPositions.get(z);if(N){const{appearanceIconOffset:j,appearanceIconRotate:te}=ox(C,y,s,h,T,A,S,v),G=y.layout.get("icon-anchor").evaluate(s,b,h);let W=rx(N,O?this.iconAtlasPositions&&this.iconAtlasPositions.get(O.toString()):void 0,j,G);const K=N.sdf,ee=y.layout.get("icon-text-fit").constantOr("none");ee!=="none"&&t.textShaping&&t.iconTextFitPadding&&t.fontScale&&(W=nx(W,t.textShaping,ee,t.iconTextFitPadding,j,t.fontScale));
vendor: 9,168 bytes, line 7
7const le=this.calculateEffectiveAppearanceIconSize(C,_.zoom,s,h,p,v,S),de=0,ve=1+(Math.min(Ru,Math.round(le*Mc))<<1),xe=Gx(W,te,K,ee!=="none",v),we=this.icon.iconTransitioningVertexArray.length>0;t.isUsingAppearanceIconVertexData||(t.isUsingAppearanceIconVertexData=!0,t.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(l,e.numIconVertices),we&&(t.layoutBasedIconTransitioningVertexData=this.icon.snapshotIconTransitioningVertexData(l,e.numIconVertices)));const Fe=Math.floor(e.numIconVertices/4),se=Math.min(xe.length,Fe);let pe=l;const ge=we?this.icon.iconTransitioningVertexArray.uint16:null;for(let Me=0;Me<se;++Me){const Pe=xe[Me],Ie=t.layoutBasedIconVertexData[0]||e.tileAnchorX,Oe=t.layoutBasedIconVertexData[1]||e.tileAnchorY,Be=16*Pe.pixelOffsetTL.x,Ke=16*Pe.pixelOffsetTL.y,Ne=16*Pe.pixelOffsetBR.x,He=16*Pe.pixelOffsetBR.y,ft=16*Pe.minFontScaleX,pt=16*Pe.minFontScaleY;if(this.icon.updateSymbolVertexData(pe,Ie,Oe,Math.round(32*Pe.tl.x),Math.round(32*Pe.tl.y),Pe.texPrimary.x,Pe.texPrimary.y,de,ve,Be,Ke,ft,pt),this.icon.updateSymbolVertexData(pe+1,Ie,Oe,Math.round(32*Pe.tr.x),Math.round(32*Pe.tr.y),Pe.texPrimary.x+Pe.texPrimary.w,Pe.texPrimary.y,de,ve,Ne,Ke,ft,pt),this.icon.updateSymbolVertexData(pe+2,Ie,Oe,Math.round(32*Pe.bl.x),Math.round(32*Pe.bl.y),Pe.texPrimary.x,Pe.texPrimary.y+Pe.texPrimary.h,de,ve,Be,He,ft,pt),this.icon.updateSymbolVertexData(pe+3,Ie,Oe,Math.round(32*Pe.br.x),Math.round(32*Pe.br.y),Pe.texPrimary.x+Pe.texPrimary.w,Pe.texPrimary.y+Pe.texPrimary.h,de,ve,Ne,He,ft,pt),ge){const xt=Pe.texSecondary?Pe.texSecondary:Pe.texPrimary,ht=2*pe;ge[ht]=xt.x,ge[ht+1]=xt.y,ge[ht+2]=xt.x+xt.w,ge[ht+3]=xt.y,ge[ht+4]=xt.x,ge[ht+5]=xt.y+xt.h,ge[ht+6]=xt.x+xt.w,ge[ht+7]=xt.y+xt.h}pe+=4}const Se=e.numIconVertices-4*se;for(let Me=0;Me<Se;++Me)this.icon.updateSymbolVertexData(pe+Me,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else{if(t.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(l,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(l+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(l+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(l+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0};if(t.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(l,t.layoutBasedIconVertexData),t.layoutBasedIconTransitioningVertexData&&this.icon.restoreIconTransitioningVertexData(l,t.layoutBasedIconTransitioningVertexData),t.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:t.layoutBasedIconVertexData.length/jh,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,t,n,s,l,c){const{canonical:h,layer:p,textScaleFactor:_,imageMap:y,featureState:v,layoutTextOffset:b,layoutTextSize:T,layoutTextRotate:S,layoutMinZoomSize:A,layoutMaxZoomSize:C,layoutTextSizeMinZoom:D,layoutTextSizeMaxZoom:F,availableImages:O}=c,z=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!z)return{vertexOffsetDelta:z?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(t.activeAppearanceIndex===n)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};const N=n>=0?p.appearances[n]:null;if(N&&t.textShaping){const{appearanceTextOffset:j,appearanceTextRotate:te,appearanceTextSize:G}=sx(N,p,s,h,b,S,T);t.fontScale=lx(G,t.textScaleFactor);const W=N.getUnevaluatedLayoutProperty("text-size");let K=this.textSizeData,ee=D,le=F;N.hasLayoutProperty("text-size")&&(K=kh(this.zoom,W,this.worldview,O),ee=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,le=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0);const de=t.textShaping.bottom-b[1],ve=t.textShaping.left-b[0],xe=t.textShaping.right-b[0];t.textShaping.top=j[1]+(t.textShaping.top-b[1]),t.textShaping.bottom=j[1]+de,t.textShaping.left=j[0]+ve,t.textShaping.right=j[0]+xe;const we=$x(0,t.textShaping,j,p,!1,s,y,this.allowVerticalPlacement,te),Fe=G&&K.kind==="composite"?W.possiblyEvaluate(new Oi(ee,{}),h).evaluate(s,v,h):A,se=G&&K.kind==="composite"?W.possiblyEvaluate(new Oi(le,{}),h).evaluate(s,v,h):C,pe=cx(N.name,K,G,_,Fe,se),ge=Array.isArray(pe)?pe[1]:G,Se=0,Me=1+(Math.min(Ru,Math.round(ge*Mc))<<1);t.isUsingAppearanceTextVertexData||(t.isUsingAppearanceTextVertexData=!0,t.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(l,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let Pe=0;Pe<we.length&&Pe<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++Pe){const Ie=we[Pe],Oe=Ie.glyphOffset[1],Be=e.tileAnchorX,Ke=e.tileAnchorY,Ne=l+4*Pe;this.text.updateSymbolVertexData(Ne,Be,Ke,Math.round(32*Ie.tl.x),Math.round(32*(Oe+Ie.tl.y)),Ie.texPrimary.x,Ie.texPrimary.y,Se,Me,Ie.pixelOffsetTL.x,Ie.pixelOffsetTL.y,Ie.minFontScaleX,Ie.minFontScaleY),this.text.updateSymbolVertexData(Ne+1,Be,Ke,Math.round(32*Ie.tr.x),Math.round(32*(Oe+Ie.tr.y)),Ie.texPrimary.x+Ie.texPrimary.w,Ie.texPrimary.y,Se,Me,Ie.pixelOffsetBR.x,Ie.pixelOffsetTL.y,Ie.minFontScaleX,Ie.minFontScaleY),this.text.updateSymbolVertexData(Ne+2,Be,Ke,Math.round(32*Ie.bl.x),Math.round(32*(Oe+Ie.bl.y)),Ie.texPrimary.x,Ie.texPrimary.y+Ie.texPrimary.h,Se,Me,Ie.pixelOffsetTL.x,Ie.pixelOffsetBR.y,Ie.minFontScaleX,Ie.minFontScaleY),this.text.updateSymbolVertexData(Ne+3,Be,Ke,Math.round(32*Ie.br.x),Math.round(32*(Oe+Ie.br.y)),Ie.texPrimary.x+Ie.texPrimary.w,Ie.texPrimary.y+Ie.texPrimary.h,Se,Me,Ie.pixelOffsetBR.x,Ie.pixelOffsetBR.y,Ie.minFontScaleX,Ie.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}return t.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(l,t.layoutBasedTextVertexData),t.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:t.layoutBasedTextVertexData.length/jh,hasChanges:!0}):{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}updateExpressions(e){this.text&&this.text.programConfigurations.updateExpressions(e),this.icon&&this.icon.programConfigurations.updateExpressions(e)}update(e,t,n,s,l,c,h,p){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(e,t,l,n,s,c,h,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(e,t,l,n,s,c,h,this.worldview),p){if(c)for(const _ of[this.text.uboBinder,this.icon.uboBinder])_&&!_.isLightConstant&&_.updateDynamicExpressions(l[0],t,p,n,e,h);else if(Object.keys(e).length>0){const _=l[0],y=[this.text.uboBinder,this.icon.uboBinder].filter(v=>v&&v.hasStateDependentPaint(_));if(y.length>0){const v=new Set(Object.keys(e).map(b=>{const T=Number(b);return!isNaN(T)&&Number.isSafeInteger(T)&&String(T)===b?T:b}));for(const b of y)b.updateFeatures(v,_,t,p,n,e,h)}}}}updateZOffset(){const e=(l,c,h)=>{n+=c,n>l.length&&l.resize(n);for(let p=-c;p<0;p++)l.emplace(p+n,h)},t=(l,c,h)=>{s+=c,s>l.length&&l.resize(s);for(let p=-c;p<0;p++)l.emplace(p+s,h)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,s=0;for(let l=0;l<this.symbolInstances.length;l++){const c=this.symbolInstances.get(l),{numHorizontalGlyphVertices:h,numVerticalGlyphVertices:p,numIconVertices:_}=c,y=c.zOffset,v=_>0;if((h>0||p>0)&&(e(this.text.zOffsetVertexArray,h,y),e(this.text.zOffsetVertexArray,p,y)),v){const{placedIconSymbolIndex:b,verticalPlacedIconSymbolIndex:T}=c;b>=0&&t(this.icon.zOffsetVertexArray,_,y),T>=0&&t(this.icon.zOffsetVertexArray,c.numVerticalIconVertices,y)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,t,n,s,l){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(c=>c.appearances&&c.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,t,n,s,l,c=!1){const h={hasLayoutChanges:!1,hasUboChanges:!1};if(!e||!n||!this.featureAppearanceData)return h;const p=t||{},_=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,y=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!_&&!y)return h;const v=this.layers[0],b=v.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===v.appearancesVersion||(this.featureAppearances=new tT(v.appearances,v.appearancesVersion));const T=this.featureAppearances.update(s,c);if(T.kind==="no-changes")return h;let S=1,A=0,C=!1,D=!1;if(_){const[te,G]=b.get("icon-size-scale-range");S=yt(1,te,G)}let F=1,O=0,z=!1;
vendor: 5,267 bytes, line 7
7if(y){const[te,G]=b.get("text-size-scale-range");F=yt(1,te,G)}const N=new Map;if(l&&n)for(const te of n){const G=l.getImage(te,v.scope);if(G){const W=new ho(te.toString());N.set(W.toString(),G)}}const j=[this.text.uboBinder,this.icon.uboBinder];for(let te=0;te<this.symbolInstances.length;te++){const G=this.symbolInstances.get(te),W=this.getAppearanceFeatureData(G.featureIndex);if(!W)continue;const K=W.id,ee=K!==void 0?p[String(K)]:void 0,le={type:"Point",id:W.id,properties:W.properties,geometry:[]};let de;if(T.kind==="all-features")de=T.appearanceIndex;else{const xe=v.appearances?v.appearances.findIndex(we=>we.isActive({globals:s,feature:le,canonical:e,featureState:ee})):-1;de=xe>=0?xe:-1}const ve=W.activeAppearanceIndex!==de;if(y){const xe=b.get("text-size"),we=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,Fe=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0,se={canonical:e,layer:v,featureState:ee,availableImages:n,textScaleFactor:F,imageMap:N,layoutTextOffset:b.get("text-offset").evaluate(le,ee,e).map(ge=>ge*Bh),layoutTextSize:xe.evaluate(le,ee,e),layoutTextRotate:b.get("text-rotate").evaluate(le,ee,e),layoutMinZoomSize:xe.evaluate(le,{zoom:we},e),layoutMaxZoomSize:xe.evaluate(le,{zoom:Fe},e),layoutTextSizeMinZoom:we,layoutTextSizeMaxZoom:Fe},pe=this.updateSymbolInstanceTextVertices(G,W,de,le,O,se);O+=pe.vertexOffsetDelta,z=z||pe.hasChanges}if(_){const xe={canonical:e,layer:v,featureState:ee,availableImages:n,globalProperties:s,iconScaleFactor:S,layoutIconOffset:b.get("icon-offset").evaluate(le,ee,e),layoutIconSize:b.get("icon-size").evaluate(le,ee,e,n),layoutIconRotate:b.get("icon-rotate").evaluate(le,ee,e)},we=this.updateSymbolInstanceIconVertices(G,W,de,le,A,xe);A+=we.vertexOffsetDelta,C=C||we.hasChanges}if(ve){const xe=G.featureIndex,we=s?s.brightness:null,Fe=ee||{},se=de>=0?v.appearances[de]:null;for(const pe of j)pe&&(pe.layer=v,D=pe.updateFeaturePaintForAppearance(xe,le,Fe,e,n,we,se)||D)}W.activeAppearanceIndex=de}return C&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),C&&this.icon.iconTransitioningVertexBuffer&&this.icon.iconTransitioningVertexArray.length>0&&this.icon.iconTransitioningVertexArray.length===this.icon.iconTransitioningVertexBuffer.length&&this.icon.iconTransitioningVertexBuffer.updateData(this.icon.iconTransitioningVertexArray),z&&this.text.layoutVertexBuffer&&this.text.layoutVertexArray.arrayBuffer!==null&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:C||z,hasUboChanges:D}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=im(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:s,y:l}of t)this.lineVertexArray.emplaceBack(s,l);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F){const O=e.indexArray,z=e.layoutVertexArray,N=e.globeExtVertexArray,j=F,te=e.uboBinder?e.uboBinder.getCurrentBatchIndex():void 0,G=e.segments.prepareSegment(4*j,z,O,this.canOverlap?c.sortKey:void 0,te),W=this.glyphOffsetArray.length,K=G.vertexLength,ee=this.allowVerticalPlacement&&h===Rl.vertical?Math.PI/2:0,le=c.text&&c.text.sections;let de=z.length,ve=-1;for(let Fe=0;Fe<t.length;Fe++){const{tl:se,tr:pe,bl:ge,br:Se,texPrimary:Me,texSecondary:Pe,pixelOffsetTL:Ie,pixelOffsetBR:Oe,minFontScaleX:Be,minFontScaleY:Ke,glyphOffset:Ne,isSDF:He,sectionIndex:ft}=t[Fe],pt=G.vertexLength,xt=Ne[1];if(_f(z,_.x,_.y,se.x,xt+se.y,Me.x,Me.y,n,He,Ie.x,Ie.y,Be,Ke),_f(z,_.x,_.y,pe.x,xt+pe.y,Me.x+Me.w,Me.y,n,He,Oe.x,Ie.y,Be,Ke),_f(z,_.x,_.y,ge.x,xt+ge.y,Me.x,Me.y+Me.h,n,He,Ie.x,Oe.y,Be,Ke),_f(z,_.x,_.y,Se.x,xt+Se.y,Me.x+Me.w,Me.y+Me.h,n,He,Oe.x,Oe.y,Be,Ke),p){const{x:ht,y:wt,z:vt}=p.anchor,[ri,Gt,ei]=p.up;yf(N,ht,wt,vt,ri,Gt,ei),yf(N,ht,wt,vt,ri,Gt,ei),yf(N,ht,wt,vt,ri,Gt,ei),yf(N,ht,wt,vt,ri,Gt,ei),Pu(e.dynamicLayoutVertexArray,ht,wt,vt,ee)}else Pu(e.dynamicLayoutVertexArray,_.x,_.y,_.z,ee);if(C){const ht=Pe||Me;gf(e.iconTransitioningVertexArray,ht.x,ht.y),gf(e.iconTransitioningVertexArray,ht.x+ht.w,ht.y),gf(e.iconTransitioningVertexArray,ht.x,ht.y+ht.h),gf(e.iconTransitioningVertexArray,ht.x+ht.w,ht.y+ht.h)}if(O.emplaceBack(pt,pt+1,pt+2),O.emplaceBack(pt+1,pt+2,pt+3),G.vertexLength+=4,G.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ne[0]),(Fe===t.length-1||ft!==t[Fe+1].sectionIndex)&&(e.uboBinder||e.programConfigurations.populatePaintArrays(z.length,c,c.index,{},T,S,A,le&&le[ft],this.worldview),e.uboBinder)){const ht=e.uboBinder.populateUBO(c,c.index,S,T,A,le&&le[ft]);ve=ht;const wt=z.length-de;for(let vt=0;vt<wt;vt++)e.featureIdArray.emplaceBack(ht);de=z.length}}const xe=F-t.length;if(xe!==0&&(this._addNullVertices(xe,z,n,p,N,e,C,G,O),e.uboBinder&&ve>=0)){const Fe=4*xe;for(let se=0;se<Fe;se++)e.featureIdArray.emplaceBack(ve)}
vendor: 7,225 bytes, line 7
7const we=p?p.anchor:_;e.placedSymbolArray.emplaceBack(we.x,we.y,we.z,_.x,_.y,W,this.glyphOffsetArray.length-W,K,y,v,_.segment,n?n[0]:0,n?n[1]:0,s[0],s[1],h,0,0,0,b,0),e.symbolInstanceIndices.push(D)}_addNullVertices(e,t,n,s,l,c,h,p,_){for(let y=0;y<e;y++){for(let b=0;b<4;b++)_f(t,0,0,0,0,0,0,n,!1,0,0,0,0),s&&yf(l,0,0,0,0,0,0),Pu(c.dynamicLayoutVertexArray,0,0,0,0),h&&gf(c.iconTransitioningVertexArray,0,0);const v=p.vertexLength;_.emplaceBack(v,v+1,v+2),_.emplaceBack(v+1,v+2,v+3),p.vertexLength+=4,p.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,t,n,s,l,c,h){e.emplaceBack(t,n,s,l,c,Math.round(h.x),Math.round(h.y))}_addCollisionDebugVertices(e,t,n,s,l,c,h){const p=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),_=p.vertexLength,y=h.tileAnchorX,v=h.tileAnchorY;for(let T=0;T<4;T++)n.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(n.collisionVertexArrayExt,t,e.padding,h.zOffset),this._commitLayoutVertex(n.layoutVertexArray,s,l,c,y,v,new Le(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,l,c,y,v,new Le(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,l,c,y,v,new Le(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,s,l,c,y,v,new Le(e.x1,e.y2)),p.vertexLength+=4;const b=n.indexArray;b.emplaceBack(_,_+1),b.emplaceBack(_+1,_+2),b.emplaceBack(_+2,_+3),b.emplaceBack(_+3,_),p.primitiveLength+=4}_addTextDebugCollisionBoxes(e,t,n,s,l,c){for(let h=s;h<l;h++){const p=n.get(h),_=this.getSymbolInstanceTextSize(e,c,t,h);this._addCollisionDebugVertices(p,_,this.textCollisionBox,p.projectedAnchorX,p.projectedAnchorY,p.projectedAnchorZ,c)}}_addIconDebugCollisionBoxes(e,t,n,s,l,c){for(let h=s;h<l;h++){const p=n.get(h),_=this.getSymbolInstanceIconSize(e,t,c.placedIconSymbolIndex);this._addCollisionDebugVertices(p,_,this.iconCollisionBox,p.projectedAnchorX,p.projectedAnchorY,p.projectedAnchorZ,c)}}generateCollisionDebugBuffers(e,t,n){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Eg(ct,Ky.members,dt),this.iconCollisionBox=new Eg(ct,Ky.members,dt);const s=Mu(this.iconSizeData,e),l=Mu(this.textSizeData,e,n);for(let c=0;c<this.symbolInstances.length;c++){const h=this.symbolInstances.get(c);this._addTextDebugCollisionBoxes(l,e,t,h.textBoxStartIndex,h.textBoxEndIndex,h),this._addTextDebugCollisionBoxes(l,e,t,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h),this._addIconDebugCollisionBoxes(s,e,t,h.iconBoxStartIndex,h.iconBoxEndIndex,h),this._addIconDebugCollisionBoxes(s,e,t,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h)}}getSymbolInstanceTextSize(e,t,n,s){const l=this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex>=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:s),c=Zp(this.textSizeData,e,l)/Bh;return this.tilePixelRatio*c}getSymbolInstanceIconSize(e,t,n){const s=this.icon.placedSymbolArray.get(n),l=Zp(this.iconSizeData,e,s);return this.tilePixelRatio*l}_commitDebugCollisionVertexUpdate(e,t,n,s){e.emplaceBack(t,-n,-n,s),e.emplaceBack(t,n,-n,s),e.emplaceBack(t,n,n,s),e.emplaceBack(t,-n,n,s)}_updateTextDebugCollisionBoxes(e,t,n,s,l,c,h){for(let p=s;p<l;p++){const _=n.get(p),y=this.getSymbolInstanceTextSize(e,c,t,p);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,y,_.padding,c.zOffset)}}_updateIconDebugCollisionBoxes(e,t,n,s,l,c,h){for(let p=s;p<l;p++){const _=n.get(p),y=this.getSymbolInstanceIconSize(e,t,c.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,y,_.padding,c.zOffset)}}updateCollisionDebugBuffers(e,t,n,s){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const l=Mu(this.iconSizeData,e,s),c=Mu(this.textSizeData,e,n);for(let h=0;h<this.symbolInstances.length;h++){const p=this.symbolInstances.get(h);this._updateTextDebugCollisionBoxes(c,e,t,p.textBoxStartIndex,p.textBoxEndIndex,p,n),this._updateTextDebugCollisionBoxes(c,e,t,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p,n),this._updateIconDebugCollisionBoxes(l,e,t,p.iconBoxStartIndex,p.iconBoxEndIndex,p,s),this._updateIconDebugCollisionBoxes(l,e,t,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex,p,s)}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(e,t,n,s,l,c,h,p,_){const y={};if(t<n){const{x1:v,y1:b,x2:T,y2:S,padding:A,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:O,tileAnchorY:z,featureIndex:N}=e.get(t);y.textBox={x1:v,y1:b,x2:T,y2:S,padding:A,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:O,tileAnchorY:z},y.textFeatureIndex=N}if(s<l){const{x1:v,y1:b,x2:T,y2:S,padding:A,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:O,tileAnchorY:z,featureIndex:N}=e.get(s);y.verticalTextBox={x1:v,y1:b,x2:T,y2:S,padding:A,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:O,tileAnchorY:z},y.verticalTextFeatureIndex=N}if(c<h){const{x1:v,y1:b,x2:T,y2:S,padding:A,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:O,tileAnchorY:z,featureIndex:N}=e.get(c);y.iconBox={x1:v,y1:b,x2:T,y2:S,padding:A,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:O,tileAnchorY:z},y.iconFeatureIndex=N}if(p<_){const{x1:v,y1:b,x2:T,y2:S,padding:A,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:O,tileAnchorY:z,featureIndex:N}=e.get(p);y.verticalIconBox={x1:v,y1:b,x2:T,y2:S,padding:A,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:F,tileAnchorX:O,tileAnchorY:z},y.verticalIconFeatureIndex=N}return y}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const n=e.placedSymbolArray.get(t),s=n.vertexStartIndex+4*n.numGlyphs;for(let l=n.vertexStartIndex;l<s;l+=4)e.indexArray.emplaceBack(l,l+1,l+2),e.indexArray.emplaceBack(l+1,l+2,l+3)}
vendor: 5,409 bytes, line 7
7getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const t=Math.sin(e),n=Math.cos(e),s=[],l=[],c=[];for(let h=0;h<this.symbolInstances.length;++h){c.push(h);const p=this.symbolInstances.get(h);s.push(0|Math.round(t*p.tileAnchorX+n*p.tileAnchorY)),l.push(p.featureIndex)}return c.sort((h,p)=>s[h]-s[p]||l[p]-l[h]),c}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,t)=>this.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,t){const n=this.sortKeyRanges.at(-1);n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesByY=!1;else{this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const n=this.symbolInstances.get(t);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,leftJustifiedTextSymbolIndex:c,verticalPlacedTextSymbolIndex:h,placedIconSymbolIndex:p,verticalPlacedIconSymbolIndex:_}=n;s>=0&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&l!==s&&this.addIndicesForPlacedSymbol(this.text,l),c>=0&&c!==l&&c!==s&&this.addIndicesForPlacedSymbol(this.text,c),h>=0&&this.addIndicesForPlacedSymbol(this.text,h),p>=0&&this.addIndicesForPlacedSymbol(this.icon,p),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}tt(pm,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),pm.addDynamicAttributes=Pu;class qx extends U_{constructor(e,t,n){super(e,t,n),this.elevatedLayoutVertexArray=new Ae}upload(e){const t=this.uploaded;super.upload(e),!t&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,pn.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),super.destroy()}}tt(qx,"ElevatedFillBufferData");class zl{constructor(){this.portals=[]}static isOnBorder(e,t){return e<=0&&t<=0||e>=We&&t>=We}static evaluate(e){if(e.length===0)return new zl;let t=[];for(const p of e)t.push(...p.portals);if(t.length===0)return new zl;for(const p of t){const _=p.va,y=p.vb;(zl.isOnBorder(_.x,y.x)||zl.isOnBorder(_.y,y.y))&&(p.type="border")}const n=t.filter(p=>p.type!=="unevaluated"),s=t.filter(p=>p.type==="unevaluated");if(s.length===0)return new zl;s.sort((p,_)=>p.hash===_.hash?p.isTunnel===_.isTunnel?0:p.isTunnel?-1:1:p.hash<_.hash?1:-1),t=n.concat(s);let l=n.length,c=l,h=l;do if(c++,c===t.length||t[l].hash!==t[c].hash){if(c-l===2){h<l&&(t[h]=t[l],t[l]=null);const p=t[h],_=t[c-1];p.type=p.isTunnel!==_.isTunnel?"tunnel":"polygon",p.connection={a:p.connection.a,b:_.connection.a},h++}l=c}while(l!==t.length);return t.splice(h),t.sort((p,_)=>p.hash<_.hash?1:-1),{portals:t}}}tt(zl,"ElevationPortalGraph");class oT{constructor(e,t,n){this.outPositions=e,this.outNormals=t,this.outIndices=n,this.vertexLookup=new Map}addVertex(e,t,n){let s=e[2];n!=null&&(s*=n);const l=`${e[0]},${e[1]},${e[2]},${t[0]},${t[1]},${t[2]}`,c=this.vertexLookup.get(l);if(c!=null)return c;const h=this.outPositions.length;this.vertexLookup.set(l,h);const p=Math.trunc(16384*t[0]),_=Math.trunc(16384*t[1]),y=Math.trunc(16384*t[2]);return this.outPositions.emplaceBack(e[0],e[1],s),this.outNormals.emplaceBack(p,_,y),h}addTriangle(e,t,n){this.outIndices.emplaceBack(e,t,n)}addTriangles(e,t,n,s=0){if(e.length===0)return;const l=Qt(),c=Qt();for(let h=0;h<e.length;h+=3){const p=t[e[h+0]],_=t[e[h+1]],y=t[e[h+2]],v=n[e[h+1]]+s,b=n[e[h+2]]+s;Ni(l,p.x,p.y,n[e[h+0]]+s);const T=this.addVertex(l,c);Ni(l,_.x,_.y,v);const S=this.addVertex(l,c);Ni(l,y.x,y.y,b);const A=this.addVertex(l,c);this.outIndices.emplaceBack(T,S,A)}}addQuad(e,t,n,s,l,c){const h=this.addVertex(e,l,c),p=this.addVertex(t,l,c),_=this.addVertex(n,l,c),y=this.addVertex(s,l,c);this.addTriangle(h,p,_),this.addTriangle(_,y,h)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class Fo{constructor(e,t,n,s){this.unevaluatedPortals=new zl,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Ce,this.vertexNormals=new Ee,this.indexArray=new bt,this.tileToMeters=w(e),this.bridgeProgramConfigurations=new sa(t,{zoom:n,lut:s},l=>l!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new sa(t,{zoom:n,lut:s},l=>l!=="fill-bridge-guard-rail-color")}addVertices(e,t){const n=this.unevalVertices.length;for(let s=0;s<e.length;s++)this.unevalVertices.push(e[s]),this.unevalHeights.push(t[s]);return n}
vendor: 9,822 bytes, line 7
7addTriangles(e,t,n){const s=n?this.unevalTunnelTriangles:this.unevalTriangles;for(const l of e)s.push(l+t)}addRenderableRing(e,t,n,s,l,c){const h=[new Le(l.min.x,l.min.y),new Le(l.max.x,l.min.y),new Le(l.max.x,l.max.y),new Le(l.min.x,l.max.y)];for(let p=0;p<n-1;p++){const _=t+p,y=_+1,v=this.unevalVertices[_],b=this.unevalVertices[y];if(!(v.x>=l.min.x&&v.x<=l.max.x&&v.y>=l.min.y&&v.y<=l.max.y||b.x>=l.min.x&&b.x<=l.max.x&&b.y>=l.min.y&&b.y<=l.max.y||zh(v,b,h))||this.isOnBorder(v.x,b.x)||this.isOnBorder(v.y,b.y))continue;const T=Fo.computeEdgeHash(this.unevalVertices[_],this.unevalVertices[y]);let S,A=this.vertexHashLookup.get(Fo.computePosHash(v));A!=null?S=A.next:(A=this.vertexHashLookup.get(Fo.computePosHash(b)),S=A!=null?A.prev:T),this.unevalEdges.push({polygonIdx:e,a:_,b:y,hash:T,portalHash:S,isTunnel:s,type:"unevaluated",featureInfo:c})}}addPortalCandidates(e,t,n,s,l){if(t.length!==0){this.vertexHashLookup.clear();for(const c of t){if(c.length===0)continue;const h=c[0];let p=Fo.computeEdgeHash(h[h.length-2],h.at(-1));for(let _=0;_<h.length-1;_++){const y=h[_+0],v=h[_+1],b=Ks(v.x-y.x,v.y-y.y),T=ql(b);if(T===0)continue;let S="unevaluated";const A=s.pointElevation(y),C=s.pointElevation(v);Math.abs(A)<.01&&Math.abs(C)<.01?S="entrance":(this.isOnBorder(y.x,v.x)||this.isOnBorder(y.y,v.y))&&(S="border");const D=Fo.computeEdgeHash(y,v);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:y,vb:v,vab:b,length:T,hash:D,isTunnel:n,type:S});const F=Fo.computePosHash(y);this.vertexHashLookup.set(F,{prev:p,next:D}),p=D}}}}construct(e){if(this.unevalVertices.length===0)return;const t=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),n=b=>{b.primitiveLength=this.indexArray.length-b.primitiveOffset},s=new oT(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const l=t(),c=t(),h=t(),p=(b,T)=>{b.sort((A,C)=>A.type===T&&C.type!==T?-1:A.type!==T&&C.type===T?1:0);const S=b.findIndex(A=>A.type!==T);return S>=0?S:b.length};let _=0;this.unevalEdges.length>0&&(_=p(this.unevalEdges,"none"),this.constructBridgeStructures(s,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:_},this.tileToMeters)),n(h);const y=t(),v=t();if(this.unevalEdges.length>0){const b=this.unevalEdges.splice(_),T=p(b,"tunnel")+_;this.unevalEdges.push(...b),this.constructTunnelStructures(s,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:_},{min:_,max:T})}n(y),s.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),n(v),s.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),n(c),s.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights,4),n(l),this.maskSegments=fi.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.depthSegments=fi.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.renderableBridgeSegments=fi.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableTunnelSegments=fi.simpleSegment(0,y.primitiveOffset,0,y.primitiveLength),this.shadowCasterSegments=fi.simpleSegment(0,l.primitiveOffset,0,l.primitiveLength)}update(e,t,n,s,l,c,h,p){this.bridgeProgramConfigurations.updatePaintArrays(e,t,l,n,s,c,h,p),this.tunnelProgramConfigurations.updatePaintArrays(e,t,l,n,s,c,h,p)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,Xn.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,_s.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}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(e,t,n,s,l){const c=(h,p)=>{for(let _=0;_<p.length-1;_++){const y=p[_].featureIndex,v=p[_+1].vertexStart,b=e.feature(y);h.populatePaintArrays(v,b,y,{},n,t,s,void 0,l)}};c(this.bridgeProgramConfigurations,this.bridgeFeatureSections),c(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,t,n,s,l){const c=new Map;for(let h=s;h<l;h++){const p=n[h],_=p.a,y=p.b,v=Fo.computePosHash(e[_]),b=Fo.computePosHash(e[y]);let T=c.get(v);T||(T={},c.set(v,T));let S=c.get(b);S||(S={},c.set(b,S)),t[_]<=0&&t[y]<=0||(T.to=y,S.from=_)}return c}isTerminalVertex(e,t){const n=Fo.computePosHash(this.unevalVertices[e]),s=t.get(n);return!s||!s.from||!s.to}constructBridgeStructures(e,t,n,s,l,c){e.clearVertexLookup();const h=this.computeVertexConnections(t,n,s,l.min,l.max),p=1/c,_=.5*p,y=(xe,we)=>Ni(xe,t[we].x,t[we].y,n[we]*p),v=Qt(),b=Qt(),T=Qt(),S=Qt(),A=Qt(),C=(xe,we)=>{const Fe=h.get(Fo.computePosHash(t[we])),se=Fe.from,pe=Fe.to;if(!se||!pe)return;y(v,se),y(b,we),y(T,pe),Gc(S),ns(v,b)||(Li(A,b,v),ti(S,A)),ns(T,b)||(Li(A,T,b),Yi(S,S,ti(A,A)));const ge=As(S);return ge>0?oi(xe,S,1/ge):void 0};let D=Number.POSITIVE_INFINITY;this.sortSubarray(s,l.min,l.max,(xe,we)=>xe.featureInfo.featureIndex-we.featureInfo.featureIndex);const F=Qt(),O=Qt(),z=Qt(),N=Qt(),j=Qt(),te=Qt(),G=Qt(),W=Qt(),K=Qt(),ee=[Qt(),Qt(),Qt(),Qt()],le=[Qt(),Qt(),Qt(),Qt()],de=[{coord:new Le(0,0),height:0},{coord:new Le(0,0),height:0}],ve=(xe,we)=>xe>we;for(let xe=l.min;xe<l.max;xe++){const we=s[xe];if(!we.featureInfo.guardRailEnabled||!this.prepareEdgePoints(de,t,n,we,ve))continue;const[Fe,se]=de;if(Ni(F,Fe.coord.x,Fe.coord.y,p*Fe.height),Ni(O,se.coord.x,se.coord.y,p*se.height),ns(F,O))continue;Li(z,O,F),ti(z,z);const pe=C(W,we.a)||z,ge=C(K,we.b)||z;Ni(N,pe[1],-pe[0],0),ti(N,N),Ni(j,ge[1],-ge[0],0),ti(j,j),xr(W,N,pe),ti(te,W),xr(W,j,ge),ti(G,W),Yi(ee[0],F,oi(W,Li(W,N,te),_)),Yi(ee[1],F,oi(W,Yi(W,N,te),_)),Yi(ee[2],F,oi(W,te,_)),ee[3]=F,Yi(le[0],O,oi(W,Li(W,j,G),_)),Yi(le[1],O,oi(W,Yi(W,j,G),_)),Yi(le[2],O,oi(W,G,_)),le[3]=O,D=this.addFeatureSection(we.featureInfo.featureIndex,D,this.bridgeFeatureSections,e);const Se=e.addVertex(ee[0],N,c),Me=e.addVertex(ee[1],N,c),Pe=e.addVertex(le[0],j,c),Ie=e.addVertex(le[1],j,c);e.addTriangle(Se,Me,Pe),e.addTriangle(Me,Ie,Pe);const Oe=e.addVertex(ee[1],te,c),Be=e.addVertex(ee[2],te,c),Ke=e.addVertex(le[1],G,c),Ne=e.addVertex(le[2],G,c);e.addTriangle(Oe,Be,Ke),e.addTriangle(Be,Ne,Ke),rs(N,N),rs(j,j);const He=e.addVertex(ee[2],N,c),ft=e.addVertex(ee[3],N,c),pt=e.addVertex(le[2],j,c),xt=e.addVertex(le[3],j,c);e.addTriangle(He,ft,pt),e.addTriangle(ft,xt,pt);const ht=this.isTerminalVertex(we.a,h),wt=this.isTerminalVertex(we.b,h);Fe.height<.01&&ht&&e.addQuad(ee[3],ee[2],ee[1],ee[0],rs(pe,pe),c),se.height<.01&&wt&&e.addQuad(le[0],le[1],le[2],le[3],ge,c)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,t,n,s,l,c){e.clearVertexLookup();let h=Number.POSITIVE_INFINITY;const p=(D,F)=>D.featureInfo.featureIndex-F.featureInfo.featureIndex;this.sortSubarray(s,l.min,l.max,p),this.sortSubarray(s,c.min,c.max,p);const _=D=>ti(D,D),y=[{coord:new Le(0,0),height:0},{coord:new Le(0,0),height:0}],v=(D,F)=>D<F,b=Qt(),T=Qt(),S=Qt(),A=Qt(),C=Qt();for(let D=l.min;D<l.max;D++){if(!this.prepareEdgePoints(y,t,n,s[D],v))continue;const[F,O]=y,z=_(Ni(C,-(O.coord.y-F.coord.y),O.coord.x-F.coord.x,0));h=this.addFeatureSection(s[D].featureInfo.featureIndex,h,this.tunnelFeatureSections,e),e.addQuad(Ni(b,F.coord.x,F.coord.y,F.height),Ni(T,O.coord.x,O.coord.y,O.height),Ni(S,O.coord.x,O.coord.y,s[D].isTunnel?O.height+4:0),Ni(A,F.coord.x,F.coord.y,s[D].isTunnel?F.height+4:0),z)}for(let D=c.min;D<c.max;D++){const F=s[D];F.isTunnel&&([F.a,F.b]=[F.b,F.a]);const O=t[F.a],z=t[F.b],N=_(Ni(C,-(z.y-O.y),z.x-O.x,0));h=this.addFeatureSection(F.featureInfo.featureIndex,h,this.tunnelFeatureSections,e),e.addQuad(Ni(b,z.x,z.y,0),Ni(T,O.x,O.y,0),Ni(S,O.x,O.y,n[F.a]+4),Ni(A,z.x,z.y,n[F.b]+4),N),e.addQuad(Ni(b,O.x,O.y,0),Ni(T,z.x,z.y,0),Ni(S,z.x,z.y,n[F.b]+4),Ni(A,O.x,O.y,n[F.a]+4),N)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,t,n,s){e.coord.x=t,e.coord.y=n,e.height=s}prepareEdgePoints(e,t,n,s,l){let c=t[s.a].x,h=t[s.a].y,p=t[s.b].x,_=t[s.b].y,y=n[s.a],v=n[s.b];const b=l(y,0),T=l(v,0);if(b&&T)return this.setElevatedPoint(e[0],c,h,y),this.setElevatedPoint(e[1],p,_,v),!0;if(!b&&!T)return!1;if(b){if(!T){const S=v/(v-y);p=lt(p,c,S),_=lt(_,h,S),v=lt(v,y,S)}}else{const S=y/(y-v);c=lt(c,p,S),h=lt(h,_,S),y=lt(y,v,S)}return this.setElevatedPoint(e[0],c,h,y),this.setElevatedPoint(e[1],p,_,v),!0}prepareEdges(e,t){if(t.length===0)return;t.sort((h,p)=>h.hash===p.hash?p.polygonIdx-h.polygonIdx:p.hash>h.hash?1:-1);let n=0,s=0,l=0,c=t[n].polygonIdx;do s++,(s===t.length||t[n].hash!==t[s].hash)&&((s-n===1||t[s-1].polygonIdx!==c)&&(l<n&&(t[l]=t[n],t[n]=null),t[l].type="none",l++),n=s,n!==t.length&&(c=t[n].polygonIdx));while(n!==t.length);if(t.splice(l),t.length!==0&&e.length!==0){t.sort((_,y)=>_.portalHash<y.portalHash?1:-1);let h=0,p=0;for(;h!==t.length&&p!==e.length;){const _=t[h],y=e[p];_.portalHash>y.hash?h++:y.hash>_.portalHash?p++:(_.type=y.type,h++)}}}isOnBorder(e,t){return e<=0&&t<=0||e>=We&&t>=We}addFeatureSection(e,t,n,s){return e!==t&&(t=e,n.push({featureIndex:e,vertexStart:s.getVertexCount()}),s.clearVertexLookup()),t}sortSubarray(e,t,n,s){const l=e.slice(t,n);l.sort(s),e.splice(t,l.length,...l)}static computeEdgeHash(e,t){return(e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(Fo.computePosHash(e))<<32n|BigInt(Fo.computePosHash(t))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}
vendor: 5,623 bytes, line 7
7class sT{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,t){return this._valid&&e(t(this._geometry)),this}require(e,t,n){return this.get(e,!0,t,n)}optional(e,t,n){return this.get(e,!1,t,n)}success(){return this._valid}get(e,t,n,s){const l=Object.hasOwn(this.feature.properties,e)?+this.feature.properties[e]:void 0;return this._valid&&l!==void 0&&!Number.isNaN(l)?n(s?s(l):l):t&&(this._valid=!1),this}}class Wx{constructor(e,t){this.featureFunc=e,this.vertexFunc=t}parseFeature(e,t,n){return this.featureFunc(e,t,n)}parseVertex(e,t,n){return this.vertexFunc(e,t,n)}}const aT=new Wx((i,e,t)=>i.reset(e).require(Ml,n=>{t.id=n}).optional("fixed_height_relative",n=>{t.constantHeight=n},Fl.decodeRelativeHeight).geometry(n=>{t.bounds=n},tl).success(),(i,e,t)=>i.reset(e).require(Ml,n=>{t.id=n}).require("elevation_idx",n=>{t.idx=n}).require("extent",n=>{t.extent=n}).require("height_relative",n=>{t.height=n},Fl.decodeRelativeHeight).geometry(n=>{t.position=n},Fl.getPoint).success()),lT=new Wx((i,e,t)=>i.reset(e).require(Ml,n=>{t.id=n}).optional("fixed_height",n=>{t.constantHeight=n},Fl.decodeMetricHeight).geometry(n=>{t.bounds=n},tl).success(),(i,e,t)=>i.reset(e).require(Ml,n=>{t.id=n}).require("elevation_idx",n=>{t.idx=n}).require("extent",n=>{t.extent=n}).require("height",n=>{t.height=n},Fl.decodeMetricHeight).geometry(n=>{t.position=n},Fl.getPoint).success());class Fl{static getPoint(e){return Ks(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?e==="1.0.1"?lT:void 0:aT}static parse(e){const t=[],n=[],s=e.length,l=new sT;for(let c=0;c<s;c++){const h=e.feature(c),p=h.properties.version,_=Fl.getVersionSchema(p);if(_===void 0){gi(`Unknown elevation feature version number ${p||"(unknown)"}`);continue}const y=h.properties.type;if(!y)continue;const v=Ic.types[h.type];if(v==="Point"&&y==="curve_point"){const b={};_.parseVertex(l,h,b)&&t.push(b)}else if(v==="Polygon"&&y==="curve_meta"){const b={};_.parseFeature(l,h,b)&&n.push(b)}}return{vertices:t,features:n}}}const cT=[Xr(),Xr(),Xr(),Xr(),Xr(),Xr(),Xr()],Du=Xr(),Lu=Xr();function mm(i){return[i[0],i[1]]}function _m(i){return Ks(i[0],i[1])}class Xx{constructor(e,t,n=null){this.feature=e,this.metersToTile=t,this.sampler=n,this.index=0}get(){const e=this.feature.vertices[this.index],t=this.feature.vertexProps[this.index].dir,n=t[1],s=-t[0],l=(e.extent+1)*this.metersToTile,c=this.sampler?this.sampler.pointTransform(e.position):e.position;return[new Le(Math.trunc(c[0]+n*l),Math.trunc(c[1]+s*l)),new Le(Math.trunc(c[0]-n*l),Math.trunc(c[1]-s*l))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class Ol{constructor(e,t,n,s,l,c){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:n,max:n},this.safeArea=t,this.constantHeight=n,this.constantHeight==null&&(this.constantHeight!=null||s.length!==0)){this.vertices=s,this.edges=l;for(let h=0;h<this.vertices.length;h++)this.vertices[h].index=this.vertices[h].index!==void 0?this.vertices[h].index:h;this.edges=this.edges.filter(h=>{return h.a<this.vertices.length&&h.b<this.vertices.length&&!((p=this.vertices[h.a].position)[0]===(_=this.vertices[h.b].position)[0]&&p[1]===_[1]);var p,_}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const h of this.vertices)this.vertexProps.push({dir:Ks(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,h.height),this.heightRange.max=Math.max(this.heightRange.max,h.height);for(const h of this.edges){const p=this.vertices[h.a].position,_=this.vertices[h.b].position,y=Js(Xr(),_,p),v=ql(y),b=Ka(Xr(),y,1/v);this.edgeProps.push({vec:y,dir:b,len:v});const T=this.vertexProps[h.a].dir,S=this.vertexProps[h.b].dir;os(T,T,b),os(S,S,b)}for(const h of this.vertexProps)h.dir[0]===0&&h.dir[1]===0||ma(h.dir,h.dir);this.tessellate(c)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const t=this.getClosestEdge(e);if(t==null)return 0;const[n,s]=t;return lt(this.vertices[this.edges[n].a].height,this.vertices[this.edges[n].b].height,s)}computeSlopeNormal(e,t){const n=this.getClosestEdge(e);if(!n)return Tr(0,0,1);const s=n[0],l=this.edges[s],c=this.edgeProps[s].vec,h=Tr(c[0],c[1],(this.vertices[l.b].height-this.vertices[l.a].height)*t),p=Tr(h[1],-h[0],0);xr(p,p,h);const _=Xi(p);return _>0?oi(p,p,1/_):Ni(p,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let t=0,n=Number.POSITIVE_INFINITY,s=0;const[l,c,h,p,_,y,v]=cT;$l(v,e.x,e.y);const b=new Ew(v,null);for(let T=0;T<this.edges.length;T++){const S=this.edges[T],A=this.edgeProps[T].dir;b.dir=A;const C=this.vertices[S.a].position,D=this.vertices[S.b].position,F=b.intersectsPlane(C,this.vertexProps[S.a].dir,l),O=b.intersectsPlane(D,this.vertexProps[S.b].dir,c);if(!F||!O)continue;Js(h,c,l),Js(p,v,l);const z=Ja(h,h),N=z>0?Ja(p,h)/z:0,j=yt(N,0,1),te=Math.abs((N-j)*this.edgeProps[T].len);Js(_,v,C),$l(y,A[1],-A[0]);const G=te+Math.abs(Ja(_,y));G<n&&(t=T,n=G,s=j)}return[t,s]}tessellate(e){const t=Qt(),n=Qt(),s=Qt(),l=Qt();for(let c=this.edges.length-1;c>=0;--c){const h=this.edges[c].a,p=this.edges[c].b,{position:_,height:y,extent:v}=this.vertices[h],{position:b,height:T,extent:S}=this.vertices[p],A=this.vertexProps[h].dir,C=this.vertexProps[p].dir;if(Ni(t,_[0]/e,_[1]/e,y),Ni(n,b[0]/e,b[1]/e,T),Ni(s,A[1],-A[0],0
vendor: 4,764 bytes, line 7
7),oi(s,s,v),Ni(l,C[1],-C[0],0),oi(l,l,S),this.distSqLines(Tr(t[0]+.5*s[0],t[1]+.5*s[1],t[2]+.5*s[2]),Tr(n[0]-.5*l[0],n[1]-.5*l[1],n[2]-.5*l[2]),Tr(t[0]-.5*s[0],t[1]-.5*s[1],t[2]-.5*s[2]),Tr(n[0]+.5*l[0],n[1]+.5*l[1],n[2]+.5*l[2]))<=.0025000000000000005)continue;const D=this.vertices.length,F=os(Xr(),_,b);this.vertices.push({position:Ka(F,F,.5),height:.5*(y+T),extent:.5*(v+S),index:.5*((this.vertices[h].index!==void 0?this.vertices[h].index:h)+(this.vertices[p].index!==void 0?this.vertices[p].index:p))});const O=os(Xr(),A,C);this.vertexProps.push({dir:ma(O,O)}),this.edges.splice(c,1),this.edgeProps.splice(c,1),this.edges.push({a:h,b:D}),this.edges.push({a:D,b:p});const z=Js(Xr(),this.vertices[D].position,_),N=ql(z),j={vec:z,dir:Ka(Xr(),z,1/N),len:N};this.edgeProps.push(j),this.edgeProps.push(j)}}distSqLines(e,t,n,s){const l=eo(Qt(),t,e),c=eo(Qt(),s,n),h=eo(Qt(),e,n),p=Di(l,l),_=Di(l,c),y=Di(l,h),v=Di(c,c),b=Di(c,h),T=p*v-_*_;if(T===0)return qs(Ws(l,n,s,Di(h,c)/Di(c,c)),e);const S=(p*b-_*y)/T;return qs(Ws(l,e,t,(_*b-y*v)/T),Ws(c,n,s,S))}static serialize(e,t){const n={id:e.id,heightRange:{min:e.heightRange.min,max:e.heightRange.max},safeArea:(s=e.safeArea,{min:{x:s.min.x,y:s.min.y},max:{x:s.max.x,y:s.max.y}})};var s;return e.constantHeight!=null?(n.constantHeight=e.constantHeight,n):e.vertices.length===0?(n.vertices=[],n.vertexProps=[],n.edges=[],n.edgeProps=[],n):(n.vertices=e.vertices.map(l=>({position:mm(l.position),height:l.height,extent:l.extent,index:l.index})),n.vertexProps=e.vertexProps.map(l=>({dir:mm(l.dir)})),n.edges=e.edges.map(l=>({a:l.a,b:l.b})),n.edgeProps=e.edgeProps.map(l=>({vec:mm(l.vec),dir:mm(l.dir),len:l.len})),n)}static deserialize(e){const t=function(s){return{min:new Le(s.min.x,s.min.y),max:new Le(s.max.x,s.max.y)}}(e.safeArea);if(e.constantHeight!=null)return new Ol(e.id,t,e.constantHeight);if(!e.vertices||e.vertices.length===0){const s=Object.create(Ol.prototype);return s.id=e.id,s.constantHeight=void 0,s.heightRange={min:e.heightRange.min,max:e.heightRange.max},s.safeArea=t,s.vertices=[],s.vertexProps=[],s.edges=[],s.edgeProps=[],s}const n=Object.create(Ol.prototype);return n.id=e.id,n.constantHeight=void 0,n.heightRange={min:e.heightRange.min,max:e.heightRange.max},n.safeArea=t,n.vertices=e.vertices.map(s=>({position:_m(s.position),height:s.height,extent:s.extent,index:s.index})),n.vertexProps=(e.vertexProps||[]).map(s=>({dir:_m(s.dir)})),n.edges=(e.edges||[]).map(s=>({a:s.a,b:s.b})),n.edgeProps=(e.edgeProps||[]).map(s=>({vec:_m(s.vec),dir:_m(s.dir),len:s.len})),n}}class Gh{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*We,this.yOffset=(e.y*this.zScale-t.y)*We)}pointTransform(e){return Ks(e[0]*this.zScale+this.xOffset,e[1]*this.zScale+this.yOffset)}pointTransformInPlace(e){e[0]=e[0]*this.zScale+this.xOffset,e[1]=e[1]*this.zScale+this.yOffset}constantElevation(e,t){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,n){const s=this.constantElevation(t,n);return s??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),n))}computeBiasedHeight(e,t){return t<=0?e:e+t*ls(0,t,e>=0?e:Math.abs(.5*e))}}function uT(i){if(i===0)return[0,0,0];const e=fc(i);return[e(),e(),e()]}function Yx(i,e){let t=0,n=i.length-1;for(;t<=n;){const s=t+n>>1;i[s].feature.id<e?t=s+1:n=s-1}return t<i.length&&i[t].feature.id===e?t:-1}function xf(i,e,t,n){if(!i.properties)return;const s=+i.properties[Ml];if(Number.isNaN(s))return;if(e){const c=e.find(h=>h.id===s);if(c&&n)return{tileId:n,feature:c}}if(!t||t.length===0)return;const l=Yx(t,s);if(!(l<0)){if(n){for(let c=l;c<t.length&&t[c].feature.id===s;c++)if(t[c].tileId.key===n.key)return t[c]}return t[l]}}function hT(i,e){return i>e?1:i<e?-1:0}tt(Ol,"ElevationFeature");class Sg{constructor(e=hT,t=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!t}rotateLeft(e){var t=e.right;t&&(e.right=t.left,t.left&&(t.left.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.left=e),e.parent=t}rotateRight(e){var t=e.left;t&&(e.left=t.right,t.right&&(t.right.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.right=e),e.parent=t}_splay(e){for(;e.parent;){var t=e.parent;t.parent?t.left===e&&t.parent.left===t?(this.rotateRight(t.parent),this.rotateRight(t)):t.right===e&&t.parent.right===t?(this.rotateLeft(t.parent),this.rotateLeft(t)):t.left===e&&t.parent.right===t?(this.rotateRight(t),this.rotateLeft(t)):(this.rotateLeft(t),this.rotateRight(t)):t.left===e?this.rotateRight(t):this.rotateLeft(t)}}splay(e){for(var t,n,s,l,c;e.parent;
vendor: 4,504 bytes, line 7
7)(n=(t=e.parent).parent)&&n.parent?((s=n.parent).left===n?s.left=e:s.right=e,e.parent=s):(e.parent=null,this._root=e),l=e.left,c=e.right,e===t.left?(n&&(n.left===t?(t.right?(n.left=t.right,n.left.parent=n):n.left=null,t.right=n,n.parent=t):(l?(n.right=l,l.parent=n):n.right=null,e.left=n,n.parent=e)),c?(t.left=c,c.parent=t):t.left=null,e.right=t,t.parent=e):(n&&(n.right===t?(t.left?(n.right=t.left,n.right.parent=n):n.right=null,t.left=n,n.parent=t):(c?(n.left=c,c.parent=n):n.left=null,e.right=n,n.parent=e)),l?(t.right=l,l.parent=t):t.right=null,e.left=t,t.parent=e)}replace(e,t){e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,t){var n=this._root,s=null,l=this._compare;if(this._noDuplicates)for(;n;){if(s=n,l(n.key,e)===0)return;n=l(n.key,e)<0?n.right:n.left}else for(;n;)s=n,n=l(n.key,e)<0?n.right:n.left;return n={key:e,data:t,left:null,right:null,parent:s},s?l(s.key,n.key)<0?s.right=n:s.left=n:this._root=n,this.splay(n),this._size++,n}find(e){for(var t=this._root,n=this._compare;t;){var s=n(t.key,e);if(s<0)t=t.right;else{if(!(s>0))return t;t=t.left}}return null}contains(e){for(var t=this._root,n=this._compare;t;){var s=n(e,t.key);if(s===0)return!0;t=s<0?t.left:t.right}return!1}remove(e){var t=this.find(e);if(!t)return!1;if(this.splay(t),t.left)if(t.right){var n=this.minNode(t.right);n.parent!==t&&(this.replace(n,n.right),n.right=t.right,n.right.parent=n),this.replace(t,n),n.left=t.left,n.left.parent=n}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var t=this.minNode(e.right);t.parent!==e&&(this.replace(t,t.right),t.right=e.right,t.right.parent=t),this.replace(e,t),t.left=e.left,t.left.parent=t}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var t=this.find(e);if(t){this.splay(t);var n=t.left,s=t.right,l=null;n&&(n.parent=null,l=this.maxNode(n),this.splay(l),this._root=l),s&&(n?l.right=s:this._root=s,s.parent=l),this._size--}}pop(){var e=this._root,t=null;if(e){for(;e.left;)e=e.left;t={key:e.key,data:e.data},this.remove(e.key)}return t}next(e){var t=e;if(t)if(t.right)for(t=t.right;t&&t.left;)t=t.left;else for(t=e.parent;t&&t.right===e;)e=t,t=t.parent;return t}prev(e){var t=e;if(t)if(t.left)for(t=t.left;t&&t.right;)t=t.right;else for(t=e.parent;t&&t.left===e;)e=t,t=t.parent;return t}forEach(e){for(var t=this._root,n=[],s=!1,l=0;!s;)t?(n.push(t),t=t.left):n.length>0?(e(t=n.pop(),l++),t=t.right):s=!0;return this}range(e,t,n,s){const l=[],c=this._compare;let h,p=this._root;for(;l.length!==0||p;)if(p)l.push(p),p=p.left;else{if(p=l.pop(),h=c(p.key,t),h>0)break;if(c(p.key,e)>=0&&n.call(s,p))return this;p=p.right}return this}keys(){for(var e=this._root,t=[],n=[],s=!1;!s;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),n.push(e.key),e=e.right):s=!0;return n}values(){for(var e=this._root,t=[],n=[],s=!1;!s;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),n.push(e.data),e=e.right):s=!0;return n}at(e){for(var t=this._root,n=[],s=!1,l=0;!s;)if(t)n.push(t),t=t.left;else if(n.length>0){if(t=n.pop(),l===e)return t;l++,t=t.right}else s=!0;return null}load(e=[],t=[],n=!1){if(this._size!==0)throw new Error("bulk-load: tree is not empty");const s=e.length;return n&&Ag(e,t,0,s-1,this._compare),this._root=Ig(null,e,t,0,s),this._size=s,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return this._root===null}get size(){return this._size}static createTree(e,t,n,s,l){return new Sg(n,l).load(e,t,s)}}function Ig(i,e,t,n,s){const l=s-n;if(l>0){const c=n+Math.floor(l/2),h={key:e[c],data:t[c],parent:i};return h.left=Ig(h,e,t,n,c),h.right=Ig(h,e,t,c+1,s),h}return null}function Ag(i,e,t,n,s){if(t>=n)return;const l=i[t+n>>1];let c=t-1,h=n+1;for(;;){do c++;while(s(i[c],l)<0);do h--;while(s(i[h],l)>0);if(c>=h)break;let p=i[c];i[c]=i[h],i[h]=p,p=e[c],e[c]=e[h],e[h]=p}Ag(i,e,t,h,s),Ag(i,e,h+1,n,s)}const Kx=11102230246251565e-32,go=134217729,dT=(3+8*Kx)*Kx;function Cg(i,e,t,n,s){let l,c,h,p,_=e[0],y=n[0],v=0,b=0;y>_==y>-_?(l=_,_=e[++v]):(l=y,y=n[++b]);let T=0;if(v<i&&b<t)for(y>_==y>-_?(c=_+l,h=l-(c-_),_=e[++v]):(c=y+l,h=l-(c-y),y=n[++b]),l=c,h!==0&&(s[T++]=h);v<i&&b<t;)y>_==y>-_?(c=l+_,p=c-l,h=l-(c-p)+(_-p),_=e[++v]):(c=l+y,p=c-l,h=l-(c-p)+(y-p),y=n[++b]),l=c,h!==0&&(s[T++]=h);for(;
vendor: 4,151 bytes, line 7
7v<i;)c=l+_,p=c-l,h=l-(c-p)+(_-p),_=e[++v],l=c,h!==0&&(s[T++]=h);for(;b<t;)c=l+y,p=c-l,h=l-(c-p)+(y-p),y=n[++b],l=c,h!==0&&(s[T++]=h);return l===0&&T!==0||(s[T++]=l),T}function vf(i){return new Float64Array(i)}const Hh=vf(4),Jx=vf(8),Qx=vf(12),ev=vf(16),Oo=vf(4);function bf(i,e,t){e===null?(i.inOut=!1,i.otherInOut=!0):(i.isSubject===e.isSubject?(i.inOut=!e.inOut,i.otherInOut=e.otherInOut):(i.inOut=!e.otherInOut,i.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(i.prevInResult=!tv(e,t)||e.isVertical()?e.prevInResult:e)),i.resultTransition=tv(i,t)?function(n,s){let l,c=!n.inOut,h=!n.otherInOut;switch(s){case 0:l=c&&h;break;case 1:l=c||h;break;case 3:l=c!==h;break;case 2:l=n.isSubject?c&&!h:h&&!c}return l?1:-1}(i,t):0}function tv(i,e){switch(i.type){case 0:switch(e){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 e===0||e===1;case 3:return e===2;case 1:return!1}return!1}class Zh{constructor(e,t,n,s,l){this.left=t,this.point=e,this.otherEvent=n,this.isSubject=s??!1,this.type=l||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(e){const t=this.point,n=this.otherEvent.point;return this.left?(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])>0:(n[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(n[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return this.resultTransition!==0}clone(){const e=new Zh(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e}}function Va(i,e){return i[0]===e[0]&&i[1]===e[1]}function Mg(i,e,t){const n=function(s,l,c,h,p,_){const y=(l-_)*(c-p),v=(s-p)*(h-_),b=y-v;if(y===0||v===0||y>0!=v>0)return b;const T=Math.abs(y+v);return Math.abs(b)>=33306690738754716e-32*T?b:-function(S,A,C,D,F,O,z){let N,j,te,G,W,K,ee,le,de,ve,xe,we,Fe,se,pe,ge,Se,Me;const Pe=S-F,Ie=C-F,Oe=A-O,Be=D-O;se=Pe*Be,K=go*Pe,ee=K-(K-Pe),le=Pe-ee,K=go*Be,de=K-(K-Be),ve=Be-de,pe=le*ve-(se-ee*de-le*de-ee*ve),ge=Oe*Ie,K=go*Oe,ee=K-(K-Oe),le=Oe-ee,K=go*Ie,de=K-(K-Ie),ve=Ie-de,Se=le*ve-(ge-ee*de-le*de-ee*ve),xe=pe-Se,W=pe-xe,Hh[0]=pe-(xe+W)+(W-Se),we=se+xe,W=we-se,Fe=se-(we-W)+(xe-W),xe=Fe-ge,W=Fe-xe,Hh[1]=Fe-(xe+W)+(W-ge),Me=we+xe,W=Me-we,Hh[2]=we-(Me-W)+(xe-W),Hh[3]=Me;let Ke=function(xt,ht){let wt=ht[0];for(let vt=1;vt<4;vt++)wt+=ht[vt];return wt}(0,Hh),Ne=22204460492503146e-32*z;if(Ke>=Ne||-Ke>=Ne||(W=S-Pe,N=S-(Pe+W)+(W-F),W=C-Ie,te=C-(Ie+W)+(W-F),W=A-Oe,j=A-(Oe+W)+(W-O),W=D-Be,G=D-(Be+W)+(W-O),N===0&&j===0&&te===0&&G===0)||(Ne=11093356479670487e-47*z+dT*Math.abs(Ke),Ke+=Pe*G+Be*N-(Oe*te+Ie*j),Ke>=Ne||-Ke>=Ne))return Ke;se=N*Be,K=go*N,ee=K-(K-N),le=N-ee,K=go*Be,de=K-(K-Be),ve=Be-de,pe=le*ve-(se-ee*de-le*de-ee*ve),ge=j*Ie,K=go*j,ee=K-(K-j),le=j-ee,K=go*Ie,de=K-(K-Ie),ve=Ie-de,Se=le*ve-(ge-ee*de-le*de-ee*ve),xe=pe-Se,W=pe-xe,Oo[0]=pe-(xe+W)+(W-Se),we=se+xe,W=we-se,Fe=se-(we-W)+(xe-W),xe=Fe-ge,W=Fe-xe,Oo[1]=Fe-(xe+W)+(W-ge),Me=we+xe,W=Me-we,Oo[2]=we-(Me-W)+(xe-W),Oo[3]=Me;const He=Cg(4,Hh,4,Oo,Jx);se=Pe*G,K=go*Pe,ee=K-(K-Pe),le=Pe-ee,K=go*G,de=K-(K-G),ve=G-de,pe=le*ve-(se-ee*de-le*de-ee*ve),ge=Oe*te,K=go*Oe,ee=K-(K-Oe),le=Oe-ee,K=go*te,de=K-(K-te),ve=te-de,Se=le*ve-(ge-ee*de-le*de-ee*ve),xe=pe-Se,W=pe-xe,Oo[0]=pe-(xe+W)+(W-Se),we=se+xe,W=we-se,Fe=se-(we-W)+(xe-W),xe=Fe-ge,W=Fe-xe,Oo[1]=Fe-(xe+W)+(W-ge),Me=we+xe,W=Me-we,Oo[2]=we-(Me-W)+(xe-W),Oo[3]=Me;const ft=Cg(He,Jx,4,Oo,Qx);se=N*G,K=go*N,ee=K-(K-N),le=N-ee,K=go*G,de=K-(K-G),ve=G-de,pe=le*ve-(se-ee*de-le*de-ee*ve),ge=j*te,K=go*j,ee=K-(K-j),le=j-ee,K=go*te,de=K-(K-te),ve=te-de,Se=le*ve-(ge-ee*de-le*de-ee*ve),xe=pe-Se,W=pe-xe,Oo[0]=pe-(xe+W)+(W-Se),we=se+xe,W=we-se,Fe=se-(we-W)+(xe-W),xe=Fe-ge,W=Fe-xe,Oo[1]=Fe-(xe+W)+(W-ge),Me=we+xe,W=Me-we,Oo[2]=we-(Me-W)+(xe-W),Oo[3]=Me;const pt=Cg(ft,Qx,4,Oo,ev);return ev[pt-1]}(s,l,c,h,p,_,T)}(i[0],i[1],e[0],e[1],t[0],t[1]);return n>0?-1:n<0?1:0}
vendor: 5,964 bytes, line 7
7function Lc(i,e){const t=i.point,n=e.point;return t[0]>n[0]?1:t[0]<n[0]?-1:t[1]!==n[1]?t[1]>n[1]?1:-1:function(s,l,c){return s.left!==l.left?s.left?1:-1:Mg(c,s.otherEvent.point,l.otherEvent.point)!==0?s.isBelow(l.otherEvent.point)?-1:1:!s.isSubject&&l.isSubject?1:-1}(i,e,t)}function zc(i,e,t){const n=new Zh(e,!1,i,i.isSubject),s=new Zh(e,!0,i.otherEvent,i.isSubject);return Va(i.point,i.otherEvent.point)&&console.warn("what is that, a collapsed segment?",i),n.contourId=s.contourId=i.contourId,Lc(s,i.otherEvent)>0&&(i.otherEvent.left=!0,s.left=!1),i.otherEvent.otherEvent=s,i.otherEvent=n,t.push(s),t.push(n),t}function gm(i,e){return i[0]*e[1]-i[1]*e[0]}function Rg(i,e){return i[0]*e[0]+i[1]*e[1]}function Pg(i,e,t){const n=function(p,_,y,v){const b=[_[0]-p[0],_[1]-p[1]],T=[v[0]-y[0],v[1]-y[1]];function S(te,G,W){return[te[0]+G*W[0],te[1]+G*W[1]]}const A=[y[0]-p[0],y[1]-p[1]];let C=gm(b,T),D=C*C;const F=Rg(b,b);if(D>0){const te=gm(A,T)/C;if(te<0||te>1)return null;const G=gm(A,b)/C;return G<0||G>1?null:te===0||te===1?[S(p,te,b)]:G===0||G===1?[S(y,G,T)]:[S(p,te,b)]}if(C=gm(A,b),D=C*C,D>0)return null;const O=Rg(b,A)/F,z=O+Rg(b,T)/F,N=Math.min(O,z),j=Math.max(O,z);return N<=1&&j>=0?N===1?[S(p,N>0?N:0,b)]:j===0?[S(p,j<1?j:1,b)]:[S(p,N>0?N:0,b),S(p,j<1?j:1,b)]:null}(i.point,i.otherEvent.point,e.point,e.otherEvent.point),s=n?n.length:0;if(s===0||s===1&&(Va(i.point,e.point)||Va(i.otherEvent.point,e.otherEvent.point))||s===2&&i.isSubject===e.isSubject)return 0;if(s===1)return!Va(i.point,n[0])&&!Va(i.otherEvent.point,n[0])&&zc(i,n[0],t),!Va(e.point,n[0])&&!Va(e.otherEvent.point,n[0])&&zc(e,n[0],t),1;const l=[];let c=!1,h=!1;return Va(i.point,e.point)?c=!0:Lc(i,e)===1?l.push(e,i):l.push(i,e),Va(i.otherEvent.point,e.otherEvent.point)?h=!0:Lc(i.otherEvent,e.otherEvent)===1?l.push(e.otherEvent,i.otherEvent):l.push(i.otherEvent,e.otherEvent),c&&h||c?(e.type=1,i.type=e.inOut===i.inOut?2:3,c&&!h&&zc(l[1].otherEvent,l[0].point,t),2):h?(zc(l[0],l[1].point,t),3):l[0]!==l[3].otherEvent?(zc(l[0],l[1].point,t),zc(l[1],l[2].point,t),3):(zc(l[0],l[1].point,t),zc(l[3].otherEvent,l[2].point,t),3)}function fT(i,e){if(i===e)return 0;if(Mg(i.point,i.otherEvent.point,e.point)!==0||Mg(i.point,i.otherEvent.point,e.otherEvent.point)!==0)return Va(i.point,e.point)?i.isBelow(e.otherEvent.point)?-1:1:i.point[0]===e.point[0]?i.point[1]<e.point[1]?-1:1:Lc(i,e)===1?e.isAbove(i.point)?-1:1:i.isBelow(e.point)?-1:1;if(i.isSubject!==e.isSubject)return i.isSubject?-1:1;{let t=i.point,n=e.point;if(t[0]===n[0]&&t[1]===n[1])return t=i.otherEvent.point,n=e.otherEvent.point,t[0]===n[0]&&t[1]===n[1]?0:(i.contourId??0)>(e.contourId??0)?1:-1}return Lc(i,e)===1?1:-1}class pT{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return this.holeOf==null}}function mT(i,e,t,n){let s,l=i+1,c=e[i].point;const h=e.length;for(l<h&&(s=e[l].point);l<h&&s[0]===c[0]&&s[1]===c[1];){if(!t[l])return l;l++,l<h&&(s=e[l].point)}for(l=i-1;t[l]&&l>n;)l--;return l}function _T(i,e,t){const n=new pT;if(i.prevInResult!=null){const s=i.prevInResult,l=s.outputContourId;if(s.resultTransition>0){const c=e[l];if(c.holeOf!=null){const h=c.holeOf;e[h].holeIds.push(t),n.holeOf=h,n.depth=e[l].depth}else e[l].holeIds.push(t),n.holeOf=l,n.depth=e[l].depth+1}else n.holeOf=null,n.depth=e[l].depth}else n.holeOf=null,n.depth=0;return n}const iv=Math.max,rv=Math.min;let ym=0;function nv(i,e,t,n,s,l){let c,h,p,_,y,v;for(c=0,h=i.length-1;c<h;c++){if(p=i[c],_=i[c+1],y=new Zh(p,!1,void 0,e),v=new Zh(_,!1,y,e),y.otherEvent=v,p[0]===_[0]&&p[1]===_[1])continue;y.contourId=v.contourId=t,l||(y.isExteriorRing=!1,v.isExteriorRing=!1),Lc(y,v)>0?v.left=!0:y.left=!0;const b=p[0],T=p[1];s[0]=rv(s[0],b),s[1]=rv(s[1],T),s[2]=iv(s[2],b),s[3]=iv(s[3],T),n.push(y),n.push(v)}}const xm=[];function ov(i,e,t){let n=i,s=e;typeof i[0][0][0]=="number"&&(n=[i]),typeof e[0][0][0]=="number"&&(s=[e]);let l=function(b,T,S){let A=null;return b.length*T.length===0&&(S===0?A=xm:S===2?A=b:(S===1||S===3)&&(A=b.length===0?T:b)),A}(n,s,t);if(l)return l===xm?null:l;const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=function(b,T,S,A,C){const D=new iu(void 0,Lc);let F,O,z,N,j,te;for(z=0,N=b.length;z<N;z++)for(F=b[z],j=0,te=F.length;j<te;j++)O=j===0,O&&ym++,nv(F[j],!0,ym,D,S,O);for(z=0,N=T.length;z<N;z++)for(F=T[z],j=0,te=F.length;j<te;j++)O=j===0,C===2&&(O=!1),O&&ym++,nv(F[j],!1,ym,D,A,O);return D}(n,s,c,h,t);if(l=function(b,T,S,A,C){let D=null;return(S[0]>A[2]||A[0]>S[2]||S[1]>A[3]||A[1]>S[3])&&(C===0?D=xm:C===2?D=b:(C===1||C===3)&&(D=b.concat(T))),D}(n,s,c,h,t),l)return l===xm?null:l;const _=function(b,T,S,A,C,D){const F=new Sg(fT),O=[],z=Math.min(A[2],C[2]);let N,j,te;for(;b.length!==0;){let G=b.pop();if(O.push(G),D===0&&G.point[0]>z||D===2&&G.point[0]>A[2])break;if(G.left){j=N=F.insert(G),te=F.minNode(),N=N!==te?F.prev(N):null,j=F.next(j);const W=N?N.key:null;let K;if(bf(G,W,D),j&&Pg(G,j.key,b)===2&&(bf(G,W,D),bf(j.key,G,D)),N&&Pg(N.key,G,b)===2){let ee=N;ee=ee!==te?F.prev(ee):null,K=ee?ee.key:null,bf(W,K,D),bf(G,W,D)}}else G=G.otherEvent,j=N=F.find(G),N&&j&&(N=N!==te?F.prev(N):null,j=F.next(j),F.remove(G),j&&N&&Pg(N.key,j.key,b))}return O}(p,0,0,c,h,t),y=function(b){let T,S;const A=function(F){let O,z,N,j,te;const G=[];for(z=0,N=F.length;z<N;z++)O=F[z],(O.left&&O.inResult||!O.left&&O.otherEvent.inResult)&&G.push(O);let W=!1;for(;!W;)for(W=!0,z=0,N=G.length;z<N;z++)z+1<N&&Lc(G[z],G[z+1])===1&&(j=G[z],G[z]=G[z+1],G[z+1]=j,W=!1);for(z=0,N=G.length;z<N;z++)O=G[z],O.otherPos=z;for(z=0,N=G.length;z<N;z++)O=G[z],O.left||(te=O.otherPos,O.otherPos=O.otherEvent.otherPos,O.otherEvent.otherPos=te);return G}(b),C={},D=[];for(T=0,S=A.length;T<S;T++){if(C[T])continue;const F=D.length,O=_T(A[T],D,F),z=te=>{C[te]=!0,te<A.length&&A[te]&&(A[te].outputContourId=F)};let N=T,j=T;for(O.points.push(A[T].point);z(N),N=A[N].otherPos,z(N),O.points.push(A[N].point),N=mT(N,A,C,j),!(N==j||N>=A.length)&&A[N];);D.push(O)}return D}(_),v=[];for(let b=0;b<y.length;b++){let T=y[b];
vendor: 19,895 bytes, line 7
7if(T.isExterior()){let S=[T.points];for(let A=0;A<T.holeIds.length;A++)S.push(y[T.holeIds[A]].points);v.push(S)}}return v}function gT(i,e){const t=ov(Dg(i),Dg([e]),0);return t==null?[]:av(t)}function yT(i,e,t=0){let s=Dg(i,65536);const l=[];for(;e.valid();e.next()){const[c,h]=e.get();let p=c.x*65536,_=c.y*65536,y=h.x*65536,v=h.y*65536;const b=y-p,T=v-_,S=Math.hypot(b,T);if(S===0)continue;p-=b*t,_-=T*t,y+=b*t,v+=T*t;const A=Math.trunc(T/S*3),C=-Math.trunc(b/S*3);l.push([[[p,_],[y,v],[y+A,v+C],[p+A,_+C],[p,_]]])}return l.length>0&&(s=ov(s,l,2)),av(s,1/65536,.001)}function Dg(i,e=1){return[i.map(t=>t.map(n=>[n.x*e,n.y*e]))]}function sv(i,e){const t=Math.floor(i)+.5;return Math.abs(i-t)<=e?Math.round(t):Math.round(i)}class xT{constructor(e){this.xs=[],this.ys=[],this.ixs=[],this.iys=[],this.buckets=new Map,this.tolerance=e}canonicalize(e,t){const n=this.tolerance,s=Math.floor(e/n),l=Math.floor(t/n);for(let p=-1;p<=1;p++){const _=this.buckets.get(s+p);if(_)for(let y=-1;y<=1;y++){const v=_.get(l+y);if(v){for(const b of v)if(Math.abs(this.xs[b]-e)<=n&&Math.abs(this.ys[b]-t)<=n){const T=this.ixs[b],S=this.iys[b];return this.xs[b]===e&&this.ys[b]===t||this.store(e,t,T,S,s,l),[T,S]}}}}const c=sv(e,n),h=sv(t,n);return this.store(e,t,c,h,s,l),[c,h]}store(e,t,n,s,l,c){const h=this.xs.length;this.xs.push(e),this.ys.push(t),this.ixs.push(n),this.iys.push(s);let p=this.buckets.get(l);p||(p=new Map,this.buckets.set(l,p));let _=p.get(c);_||(_=[],p.set(c,_)),_.push(h)}}function av(i,e=1,t){const n=t!=null?new xT(t):null;return i.map(s=>s.map((l,c)=>{const h=l.map(p=>{const _=p[0]*e,y=p[1]*e;if(n){const[v,b]=n.canonicalize(_,y);return new Le(v,b)}return new Le(Math.round(_),Math.round(y))});return c>0&&h.reverse(),h}))}class Lg{constructor(){this.frcCoverage=new Set,this.featureTriSegments=[],this.frcPerLevel=new Map,this.frcNonRoadSegments=new fi}empty(){return this.frcCoverage.size===0}}function lv(i,e,t){if(i.frcCoverage.size===0||i.featureTriSegments.length===0)return;const n=t.get(),s=e.uint16,l=[];i.featureTriSegments.sort((v,b)=>v.segIdx!==b.segIdx?v.segIdx-b.segIdx:v.frc===null&&b.frc===null?0:v.frc===null?-1:b.frc===null?1:b.frc-v.frc);const c=new Map;let h=0,p=i.featureTriSegments[0].frc,_={vertexOffset:n[h].vertexOffset,primitiveOffset:0,vertexLength:n[h].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0};const y=()=>{_.primitiveLength>0&&(c.has(p)||c.set(p,[]),c.get(p).push({..._}))};for(const v of i.featureTriSegments){v.segIdx!==h&&(y(),h=v.segIdx,p=v.frc,_={vertexOffset:n[h].vertexOffset,primitiveOffset:l.length/3,vertexLength:n[h].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0}),v.frc!==p&&(y(),p=v.frc,_={..._,primitiveOffset:l.length/3,primitiveLength:0});for(let b=v.start;b<v.end;b++)l.push(s[b]);_.primitiveLength+=(v.end-v.start)/3}y();for(let v=0;v<l.length;v++)s[v]=l[v];for(const[v,b]of c)v!==null?i.frcPerLevel.set(v,new fi(b)):i.frcNonRoadSegments=new fi(b);i.featureTriSegments=[]}tt(Lg,"FrcSegmentData");const vT={motorway:0,motorway_link:0,trunk:1,trunk_link:1,primary:2,primary_link:2,secondary:3,secondary_link:3,tertiary:4,tertiary_link:4,unclassified:5,unclassified_link:5,street:6,street_limited:6,residential:6,service:7,living_street:7,pedestrian:8,track:8,path:8,footway:8,cycleway:8,sidewalk:8,crossing:8};function vm(i){for(const e of["class","incident_class"]){const t=i[e];if(typeof t!="string")continue;const n=vT[t];if(n!==void 0)return n}return null}function zg(i,e,t){for(const n of i)if(n.startsWith("(")){const s=n.indexOf(")");if(s===-1)continue;if(n.slice(1,s)===e&&n.slice(s+1)===t)return!0}else if(n===t)return!0;return!1}class cv{constructor(e,t,n){this.elevationMode=t,t&&(this.elevationBufferData=new qx(e.layers,e.zoom,e.lut)),n&&(this.frcData=new Lg)}isEmpty(){const e=!this.elevationBufferData||this.elevationBufferData.isEmpty(),t=!this.frcData||this.frcData.empty();return e&&t}needsUpload(){return!!this.elevationBufferData&&this.elevationBufferData.needsUpload()}trackFeatureFrc(e){if(!this.frcData)return null;const t=vm(e||{});return t!==null&&this.frcData.frcCoverage.add(t),t}recordFeatureRange(e,t,n,s){if(!this.frcData||n<=t)return;const l=e.bufferData.triangleSegments.get();this.frcData.featureTriSegments.push({start:3*t,end:3*n,segIdx:l.length>0?l.length-1:0,frc:s})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&lv(this.frcData,e.bufferData.indexArray,e.bufferData.triangleSegments)}handleFeature(e,t,n,s,l,c){const h=new Array;if(!this.elevationMode)return!1;const p=xf(e,l,void 0,s);if(!p)return!1;{const y=this.clipPolygonsToTile(t,1);y.length>0&&h.push({polygons:y,elevationFeature:p.feature,elevationTileID:p.tileId})}const _={guardRailEnabled:c.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},s),featureIndex:n};for(const y of h)if(y.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Fo(y.elevationTileID,c.layers,c.zoom,c.lut));const b=y.elevationFeature.isTunnel();let T=0;Object.hasOwn(e.properties,Yy)&&(T=+e.properties[Yy]),this.elevatedStructures.addPortalCandidates(y.elevationFeature.id,y.polygons,b,y.elevationFeature,T)}y.elevationFeature.constantHeight==null&&(y.polygons=this.prepareElevatedPolygons(y.polygons,y.elevationFeature,y.elevationTileID));const v=new Gh(s,y.elevationTileID);this.addElevatedGeometry(c,y.polygons,v,y.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,n,_)}return!0}populatePaintArrays(e,t,n,s,l,c,h){this.elevationBufferData&&this.elevationBufferData.populatePaintArrays(e,t,n,s,l,c,h)}update(e,t,n,s,l,c,h,p){this.elevationBufferData&&this.elevationBufferData.update(e,t,n,s,l,c,h,p),this.elevatedStructures&&this.elevatedStructures.update(e,t,n,s,l,c,h,p)}updateExpressions(e){this.elevationBufferData&&this.elevationBufferData.programConfigurations.updateExpressions(e),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(e),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(e))}upload(e){this.elevationBufferData&&this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.elevationBufferData&&this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,t,n,s,l,c){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(t,n,s,l,c))}addElevatedGeometry(e,t,n,s,l,c,h){const p={elevation:s,elevationSampler:n,bias:l,index:c,featureInfo:h},[_,y]=e.addGeometry(t,this.elevationBufferData,p,this.elevatedStructures);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:_,max:y}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,_),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,y))}prepareElevatedPolygons(e,t,n){const s=1/w(n),l=[];for(const c of e){const h=yT(c,new Xx(t,s),.1);l.push(...h)}return l}clipPolygonsToTile(e,t){const n=-t,s=-t,l=We+t,c=We+t;let h=0;const p=[],_=[];for(;h<e.length;h++){const b=e[h],T=tl(b);(T.min.x>=n&&T.max.x<=l&&T.min.y>=s&&T.max.y<=c?p:_).push(b)}if(p.length===e.length)return e;const y=[new Le(n,s),new Le(l,s),new Le(l,c),new Le(n,c),new Le(n,s)],v=p;for(const b of _)v.push(...gT(b,y));return v}}function bT(i,e){return i.nextPoint.sub(e.at(-2)).unit()}function wT(i,e){return e[1].sub(i.prevPoint).unit()}tt(cv,"FillHDExtension"),tt(Fo,"ElevatedStructures");class uv{constructor(e,t){this.elevationEnabled=e,this.hasDeferredElevationFeatures=!1,t&&(this.frcData=new Lg)}isEmpty(){const e=!this.elevationEnabled||this.heightRange===void 0,t=!this.frcData||this.frcData.empty();return e&&t}trackFeatureFrc(e){if(!this.frcData)return null;const t=vm(e||{});return t!==null&&this.frcData.frcCoverage.add(t),t}recordFeatureRange(e,t,n,s){if(!this.frcData||n<=t)return;const l=e.segments.get();this.frcData.featureTriSegments.push({start:3*t,end:3*n,segIdx:l.length>0?l.length-1:0,frc:s})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&lv(this.frcData,e.indexArray,e.segments)}handleFeature(e,t,n,s,l,c,h,p,_,y,v){if(!this.elevationEnabled)return!1;if(!v.terrainEnabled){const C=xf(e,s,l?l.registry:void 0,n),D=e.properties!=null&&Object.hasOwn(e.properties,Ml)&&!Number.isNaN(+e.properties[Ml]);if(!C&&D&&c&&(!l||!l.allProvidersReady))return this.hasDeferredElevationFeatures=!0,!0;if(C){let F=C.feature,O=C.tileId;if(!C.tileId.equals(n)){const j=this.mergedFeatureCache?this.mergedFeatureCache.get(F.id):void 0;if(j)F=j,O=n;else{const te=function(G,W,K){if(!G.properties||!W||W.length===0)return[];const ee=+G.properties[Ml];if(Number.isNaN(ee))return[];const le=Yx(W,ee);if(le<0)return[];const de=[];for(let ve=le;ve<W.length&&W[ve].feature.id===ee;ve++){const xe=W[ve];(xe.tileId.isChildOf(K)||K.isChildOf(xe.tileId)||xe.feature.constantHeight!=null)&&de.push(xe)}return de}(e,l?l.registry:void 0,n);te.length>1&&(F=function(G,W){const K=W.slice().sort((se,pe)=>pe.tileId.z-se.tileId.z),ee=new Le(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),le=new Le(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),de=[];for(const se of K){const pe=new Gh(se.tileId,G);for(const Se of se.feature.vertices)de.push({position:pe.pointTransform(Se.position),height:Se.height,extent:Se.extent,index:Se.index});const ge=se.feature.safeArea;Du[0]=ge.min.x,Du[1]=ge.min.y,Lu[0]=ge.max.x,Lu[1]=ge.max.y,pe.pointTransformInPlace(Du),pe.pointTransformInPlace(Lu),ee.x=Math.min(ee.x,Du[0],Lu[0]),ee.y=Math.min(ee.y,Du[1],Lu[1]),le.x=Math.max(le.x,Du[0],Lu[0]),le.y=Math.max(le.y,Du[1],Lu[1])}const ve={min:ee,max:le};if(K[0].feature.constantHeight!=null)return new Ol(K[0].feature.id,ve,K[0].feature.constantHeight);de.sort((se,pe)=>se.index-pe.index);const xe=[];for(const se of de)xe.length!==0&&xe.at(-1).index===se.index||xe.push(se);const we=[];for(let se=1;se<xe.length;se++)xe[se].index-xe[se-1].index<=1&&we.push({a:se-1,b:se});const Fe=1/w(G);return new Ol(K[0].feature.id,ve,void 0,xe,we,Fe)}(n,te),O=n,this.mergedFeatureCache||(this.mergedFeatureCache=new Map),this.mergedFeatureCache.set(F.id,F))}}const z=K_(t,-1,-1,8193,8193),N=this.prepareElevatedLines(z,F,O,n);for(const j of N){const te=v.layoutVertexArray.length;v.addLine(j,e,n,h,p,_,y);const G=new Gh(n,O),W=v.showElevationIdDebug?uT(F.id):null;for(let K=te;K<v.layoutVertexArray.length;K++){const ee=new Le(v.layoutVertexArray.int16[6*K]>>1,v.layoutVertexArray.int16[6*K+1]>>1),le=G.pointElevation(ee,F,.05);this.updateHeightRange(le),K<v.zOffsetVertexArray.length?v.zOffsetVertexArray.float32[4*K]=le:v.zOffsetVertexArray.emplaceBack(le,0,0,0),W?K<v.elevationIdColVertexArray.length?(v.elevationIdColVertexArray.float32[3*K]=W[0],v.elevationIdColVertexArray.float32[3*K+1]=W[1],v.elevationIdColVertexArray.float32[3*K+2]=W[2]):v.elevationIdColVertexArray.emplaceBack(W[0],W[1],W[2]):v.showElevationIdDebug&&(K<v.elevationIdColVertexArray.length?(v.elevationIdColVertexArray.float32[3*K]=0,v.elevationIdColVertexArray.float32[3*K+1]=0,v.elevationIdColVertexArray.float32[3*K+2]=0):v.elevationIdColVertexArray.emplaceBack(0,0,0))}}return!0}if(D&&c&&l&&l.allProvidersReady&&l.hasCoveringTile)return!0}const b=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics,T=v.layoutVertexArray.length,S=[],A=K_(t,-1,-1,8193,8193,S);for(let C=0;C<A.length;C++){const D=A[C],F=S[C],O={progress:{min:F.progress.min,max:F.progress.max},nextDir:bT(F,D),prevDir:wT(F,D)};v.addLine(D,e,n,h,p,_,y,O,b&&F.parentIndex>0?F.parentIndex:null)}return v.fillNonElevatedRoadSegment(T),!0}prepareElevatedLines(e,t,n,s){if(t.constantHeight!=null)return e;const l=[],c=1/w(s),h=n.equals(s)?null:new Gh(n,s);for(const p of e)Jb(p,new Xx(t,c,h),0,l);return l}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}endPopulate(){this.mergedFeatureCache=void 0}}tt(uv,"LineHDExtension");class hv{constructor(){this.elevatedLayoutVertexArray=new Ae,this.hasElevation=!1}beginFeature(e,t,n){const s=xf(e,t,void 0,n);this.currentFeatureElevation=s?s.feature:void 0}writeVertexQuad(e,t){const n=this.currentFeatureElevation?this.currentFeatureElevation.pointElevation(new Le(e,t)):0;this.hasElevation=this.hasElevation||n!==0;for(let s=0;s<4;s++)this.elevatedLayoutVertexArray.emplaceBack(n)}finalize(){this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}upload(e){this.elevatedLayoutVertexArray&&!this.elevatedLayoutVertexBuffer&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,rw.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy()}}tt(hv,"CircleHDExtension");const bm=(i,e,t,n)=>{for(let s=0;s<e;s++)i.emplaceBack(t[0],t[1],t[2],n[0],n[1],n[2])};class dv{constructor(){this.elevationFeatures=[],this.elevationFeatureTileIds=[],this.elevationFeatureIdToIndex=new Map,this.elevationStateComplete=!1,this.hasDeferredElevationFeatures=!1,this.elevationParams=null,this.crossSourceElevationEnabled=!1,this.terrainEnabled=!1}configureCrossSource(e,t,n,s){this.consumerCanonical=e,this.elevationParams=t,this.crossSourceElevationEnabled=n,this.terrainEnabled=s}addElevationFeatures(e,t){for(const n of e)this.elevationFeatureIdToIndex.set(n.id,this.elevationFeatures.length),this.elevationFeatures.push(n),this.elevationFeatureTileIds.push(t)}resolveRoadElevation(e,t){const n=this.elevationFeatureIdToIndex.get(t);if(n!==void 0)return n;if(this.terrainEnabled||!this.crossSourceElevationEnabled)return 65535;const s=xf(e,void 0,this.elevationParams?this.elevationParams.registry:void 0,this.consumerCanonical);if(s){const l=this.elevationFeatures.length;return this.elevationFeatureIdToIndex.set(t,l),this.elevationFeatures.push(s.feature),this.elevationFeatureTileIds.push(s.tileId),l}return this.elevationParams&&this.elevationParams.allProvidersReady?65535:(this.hasDeferredElevationFeatures=!0,"defer")}getElevationFeatureSampler(e,t){if(t.equals(e))return new Gh(e,t);this.elevationFeatureSamplerCache||(this.elevationFeatureSamplerCache=new Map);let n=this.elevationFeatureSamplerCache.get(t.key);return n||(n=new Gh(e,t),this.elevationFeatureSamplerCache.set(t.key,n)),n}isCrossTileRoadElevation(e,t){if(e===65535||e>=this.elevationFeatures.length)return!1;const n=this.elevationFeatureTileIds[e];return n!=null&&!n.equals(t)}getRoadFeatureHeightAtAnchor(e,t,n){if(e===65535||e>=this.elevationFeatures.length)return null;const s=this.elevationFeatures[e],l=this.elevationFeatureTileIds[e];return l.equals(n)?s.pointElevation(t):this.getElevationFeatureSampler(n,l).pointElevation(new Le(t.x,t.y),s,0)}sampleRoadFeatureHeight(e,t,n){const s=this.getRoadFeatureHeightAtAnchor(e,t,n);return s===null?void 0:s}clearWorkerState(){this.consumerCanonical=void 0,this.elevationParams=null,this.crossSourceElevationEnabled=!1,this.terrainEnabled=!1,this.elevationFeatureIdToIndex.clear()}updateRoadElevation(e,t){if(this.elevationStateComplete)return;this.elevationStateComplete=!0,e.hasAnyZOffset=!1;let n=!1;const s=w(t),l=1/s;let c=!1,h=!1;for(let p=0;p<e.symbolInstances.length;p++){const _=e.symbolInstances.get(p),y=Tr(1,0,0),v=Tr(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:T,numIconVertices:S,numVerticalIconVertices:A}=_,C=b>0||T>0,D=S>0,F=_.elevationFeatureIndex,O=F<this.elevationFeatures.length?this.elevationFeatures[F]:void 0;if(O){const z=new Le(_.tileAnchorX,_.tileAnchorY),N=this.sampleRoadFeatureHeight(F,z,t),j=N!==void 0?.075+N:.075;_.zOffset!==j&&(n=!0,_.zOffset=j),j!==0&&(e.hasAnyZOffset=!0);const te=O.computeSlopeNormal(z,l),G=Ys(it(),Tr(0,0,1),te);da(y,y,G),da(v,v,G),y[2]*=s,v[2]*=s,y[0]===1&&y[1]===0&&y[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(c=c||C,h=h||D)}if(C&&(bm(e.text.orientationVertexArray,b,y,v),bm(e.text.orientationVertexArray,T,y,v)),D){const{placedIconSymbolIndex:z,verticalPlacedIconSymbolIndex:N}=_;z>=0&&bm(e.icon.orientationVertexArray,S,y,v),N>=0&&bm(e.icon.orientationVertexArray,A,y,v)}}c||(e.text.orientationVertexArray=void 0),h||(e.icon.orientationVertexArray=void 0),n&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}getRoadFeatureHeightForPlacedSymbol(e,t,n,s,l){const c=e.symbolInstances.get(t.symbolInstanceIndices[n]);return this.getRoadFeatureHeightAtAnchor(c.elevationFeatureIndex,s,l)}getElevationFeatureForPlacedSymbol(e,t,n){const s=e.symbolInstances.get(t.symbolInstanceIndices[n]).elevationFeatureIndex;if(s<this.elevationFeatures.length)return this.elevationFeatures[s]}makeRoadSymbolElevationParams(e,t,n,s,l,c,h,p,_){const y=this.getElevationFeatureForPlacedSymbol(e,t,n),v=y!==void 0?y:null,b=e.symbolInstances.get(t.symbolInstanceIndices[n]);return this.isCrossTileRoadElevation(b.elevationFeatureIndex,s.canonical)?{getElevation:T=>{const S=this.getRoadFeatureHeightForPlacedSymbol(e,t,n,T,s.canonical);return function(A,C,D,F,O,z){const N=F.upVector(C,D.x,D.y);return oi(N,N,A*F.upVectorScale(C,O,z).metersToTile),[N[0],N[1],N[2]]}(S!==null?S:0,s.canonical,T,h,p,_)},elevation:c,elevationFeature:null}:{getElevation:l,elevation:c,elevationFeature:v}}}tt(dv,"SymbolHDExtension",{omit:["consumerCanonical","elevationParams","crossSourceElevationEnabled","terrainEnabled","hasDeferredElevationFeatures","elevationFeatureIdToIndex"]});let aa=null,wm=null,Fg=null,Tm=null;const fv=5120,pv=5121,mv=5122,_v=5123,gv=5125,yv=5126,Em={[fv]:Int8Array,[pv]:Uint8Array,[mv]:Int16Array,[_v]:Uint16Array,[gv]:Uint32Array,[yv]:Float32Array},TT={[fv]:"DT_INT8",[pv]:"DT_UINT8",[mv]:"DT_INT16",[_v]:"DT_UINT16",[gv]:"DT_UINT32",[yv]:"DT_FLOAT32"},wf={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function xv(i,e,t){const n=t.json.bufferViews.length,s=t.buffers.length;e.bufferView=n,t.json.bufferViews[n]={buffer:s,byteLength:i.byteLength},t.buffers[s]=i}const Og="KHR_draco_mesh_compression";function ET(i,e){const t=i.extensions&&i.extensions[Og];if(!t)return;const n=new aa.Decoder,s=Tv(e,t.bufferView),l=new aa.Mesh;if(!n.DecodeArrayToMesh(s,s.byteLength,l))throw new Error("Failed to decode Draco mesh");const c=e.json.accessors[i.indices],h=Em[c.componentType],p=c.count*h.BYTES_PER_ELEMENT,_=aa._malloc(p);h===Uint16Array?n.GetTrianglesUInt16Array(l,p,_):n.GetTrianglesUInt32Array(l,p,_),xv(aa.memory.buffer.slice(_,_+p),c,e),aa._free(_);for(const y of Object.keys(t.attributes)){const v=n.GetAttributeByUniqueId(l,t.attributes[y]),b=e.json.accessors[i.attributes[y]],T=TT[b.componentType],S=b.count*wf[b.type]*Em[b.componentType].BYTES_PER_ELEMENT,A=aa._malloc(S);n.GetAttributeDataArrayForAllPoints(l,v,aa[T],S,A),xv(aa.memory.buffer.slice(A,A+S),b,e),aa._free(A)}n.destroy(),l.destroy(),delete i.extensions[Og]}const Sm="EXT_meshopt_compression";function ST(i,e){if(!i.extensions||!i.extensions[Sm])return;const t=i.extensions[Sm],n=new Uint8Array(e.buffers[t.buffer],t.byteOffset||0,t.byteLength||0),s=new Uint8Array(t.count*t.byteStride);Fg.decodeGltfBuffer(s,t.count,t.byteStride,n,t.mode,t.filter),i.buffer=e.buffers.length,i.byteOffset=0,e.buffers[i.buffer]=s.buffer,delete i.extensions[Sm]}const vv=1179937895,bv=new TextDecoder("utf8");function wv(i,e){return new URL(i,e).href}async function IT(i,e,t,n,s){const l=await fetch(wv(i.uri,n),{signal:s}),c=await l.arrayBuffer();e.buffers[t]=c}function Tv(i,e){const t=i.json.bufferViews[e];return new Uint8Array(i.buffers[t.buffer],t.byteOffset||0,t.byteLength)}async function AT(i,e,t,n,s){if(i.uri){const l=wv(i.uri,n),c=await fetch(l,{signal:s}),h=await c.blob(),p=await createImageBitmap(h);e.images[t]=p}else if(i.bufferView!==void 0){const l=Tv(e,i.bufferView),c=new Blob([l],{type:i.mimeType}),h=await createImageBitmap(c);e.images[t]=h}}async function Ev(i,e=0,t,n){const s={json:null,images:[],buffers:[]};
vendor: 17,359 bytes, line 7
7if(new Uint32Array(i,e,1)[0]===vv){const T=new Uint32Array(i,e);let S=2;const A=(T[S++]>>2)-3,C=T[S++]>>2;if(S++,s.json=JSON.parse(bv.decode(T.subarray(S,S+C))),S+=C,S<A){const D=T[S++];S++;const F=e+(S<<2);s.buffers[0]=i.slice(F,F+D)}}else s.json=JSON.parse(bv.decode(new Uint8Array(i,e)));const{buffers:l,images:c,meshes:h,extensionsUsed:p,bufferViews:_}=s.json;if(l){const T=[];for(let S=0;S<l.length;S++){const A=l[S];A.uri?T.push(IT(A,s,S,t,n)):s.buffers[S]||(s.buffers[S]=null)}await Promise.all(T)}n&&n.throwIfAborted();const y=[],v=p&&p.includes(Og),b=p&&p.includes(Sm);if(v&&y.push(function(){if(!aa)return wm!=null||(wm=function(T){let S,A=null;function C(){S=new Uint8Array(A.buffer)}function D(){throw new Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(T,{a:{a:D,d:function(F,O,z){return S.copyWithin(F,O,O+z)},c:function(F){const O=S.length,z=Math.max(F>>>0,Math.ceil(1.2*O)),N=Math.ceil((z-O)/65536);try{return A.grow(N),C(),!0}catch{return!1}},b:D}}).then(F=>{const{Rb:O,Qb:z,P:N,T:j,X:te,Ja:G,La:W,Qa:K,Va:ee,Wa:le,eb:de,jb:ve,f:xe,e:we,yb:Fe,zb:se,Ab:pe,Bb:ge,Db:Se,Gb:Me}=F.instance.exports;A=we;const Pe=(()=>{let Ie=0,Oe=0,Be=0,Ke=0;return Ne=>{Be&&(O(Ke),O(Ie),Oe+=Be,Be=Ie=0),Ie||(Oe+=128,Ie=z(Oe));const He=Ne.length+7&-8;let ft=Ie;He>=Oe&&(Be=He,ft=Ke=z(He));for(let pt=0;pt<Ne.length;pt++)S[ft+pt]=Ne[pt];return ft}})();return C(),xe(),{memory:we,_free:O,_malloc:z,Mesh:class{constructor(){this.ptr=N()}destroy(){j(this.ptr)}},Decoder:class{constructor(){this.ptr=G()}destroy(){ve(this.ptr)}DecodeArrayToMesh(Ie,Oe,Be){const Ke=Pe(Ie),Ne=W(this.ptr,Ke,Oe,Be.ptr);return!!te(Ne)}GetAttributeByUniqueId(Ie,Oe){return{ptr:K(this.ptr,Ie.ptr,Oe)}}GetTrianglesUInt16Array(Ie,Oe,Be){ee(this.ptr,Ie.ptr,Oe,Be)}GetTrianglesUInt32Array(Ie,Oe,Be){le(this.ptr,Ie.ptr,Oe,Be)}GetAttributeDataArrayForAllPoints(Ie,Oe,Be,Ke,Ne){de(this.ptr,Ie.ptr,Oe.ptr,Be,Ke,Ne)}},DT_INT8:Fe(),DT_UINT8:se(),DT_INT16:pe(),DT_UINT16:ge(),DT_UINT32:Se(),DT_FLOAT32:Me()}})}(fetch(re())).then(T=>{aa=T,wm=null})),wm}()),b&&y.push(function(){var T;if(!Fg)return Tm!=null||(Tm=(T=fetch(ce()),WebAssembly.instantiateStreaming(T,{}).then(S=>{const{sbrk:A,memory:C,meshopt_decodeVertexBuffer:D,meshopt_decodeIndexBuffer:F,meshopt_decodeIndexSequence:O,meshopt_decodeFilterOct:z,meshopt_decodeFilterQuat:N,meshopt_decodeFilterExp:j}=S.instance.exports,te={ATTRIBUTES:D,TRIANGLES:F,INDICES:O},G={OCTAHEDRAL:z,QUATERNION:N,EXPONENTIAL:j};return S.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(W,K,ee,le,de,ve){const xe=K+3&-4,we=A(xe*ee),Fe=A(le.length),se=new Uint8Array(C.buffer);se.set(le,Fe);const pe=te[de](we,K,ee,Fe,le.length);if(pe===0&&G[ve]&&G[ve](we,xe,ee),W.set(se.subarray(we,we+K*ee)),A(we-A(0)),pe!==0)throw new Error(`Malformed buffer data: ${pe}`)}}})).then(S=>{Fg=S,Tm=null})),Tm}()),c)for(let T=0;T<c.length;T++)y.push(AT(c[T],s,T,t,n));if(y.length&&await Promise.all(y),n&&n.throwIfAborted(),v&&h)for(const{primitives:T}of h)for(const S of T)ET(S,s);if(b&&h&&_)for(const T of _)ST(T,s);return s}async function Sv(i,e){const{data:t}=await vi({url:i},e);return Ev(t,0,i,e)}class Im{constructor(e,t,n,s){if(this.triangleCount=t.length/3,this.min=new Le(0,0),this.max=new Le(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[l,c]=[e[0].clone(),e[0].clone()];for(let v=1;v<e.length;++v){const b=e[v];l.x=Math.min(l.x,b.x),l.y=Math.min(l.y,b.y),c.x=Math.max(c.x,b.x),c.y=Math.max(c.y,b.y)}if(s){const v=Math.ceil(Math.max(c.x-l.x,c.y-l.y)/s);n=Math.max(n,v)}if(n===0)return;this.min=l,this.max=c;const h=this.max.sub(this.min);h.x=Math.max(h.x,1),h.y=Math.max(h.y,1);const p=Math.max(h.x,h.y)/n;this.cellsX=Math.max(1,Math.ceil(h.x/p)),this.cellsY=Math.max(1,Math.ceil(h.y/p)),this.xScale=1/p,this.yScale=1/p;const _=[];for(let v=0;v<this.triangleCount;v++){const b=e[t[3*v+0]].sub(this.min),T=e[t[3*v+1]].sub(this.min),S=e[t[3*v+2]].sub(this.min),A=Ua(Math.floor(Math.min(b.x,T.x,S.x)),this.xScale,this.cellsX),C=Ua(Math.floor(Math.max(b.x,T.x,S.x)),this.xScale,this.cellsX),D=Ua(Math.floor(Math.min(b.y,T.y,S.y)),this.yScale,this.cellsY),F=Ua(Math.floor(Math.max(b.y,T.y,S.y)),this.yScale,this.cellsY),O=new Le(0,0),z=new Le(0,0),N=new Le(0,0),j=new Le(0,0);for(let te=D;te<=F;++te){O.y=z.y=te*p,N.y=j.y=(te+1)*p;for(let G=A;G<=C;++G)O.x=N.x=G*p,z.x=j.x=(G+1)*p,(Y_(b,T,S,O,z,j)||Y_(b,T,S,O,j,N))&&_.push({cellIdx:te*this.cellsX+G,triIdx:v})}}if(_.length===0)return;_.sort((v,b)=>v.cellIdx-b.cellIdx||v.triIdx-b.triIdx);let y=0;for(;y<_.length;){const v=_[y].cellIdx,b={start:this.payload.length,len:0};for(;y<_.length&&_[y].cellIdx===v;)++b.len,this.payload.push(_[y++].triIdx);this.cells[v]=b}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,t){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const n=Ua(e.x-this.min.x,this.xScale,this.cellsX),s=Ua(e.y-this.min.y,this.yScale,this.cellsY),l=this.cells[s*this.cellsX+n];if(l){this._lazyInitLookup();for(let c=0;c<l.len;c++){const h=this.payload[l.start+c],p=Math.floor(h/8),_=1<<h%8;if(!(this.lookup[p]&_)&&(this.lookup[p]|=_,t.push(h),t.length===this.triangleCount))return}}}query(e,t,n){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>t.x||e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const s=Ua(e.x-this.min.x,this.xScale,this.cellsX),l=Ua(t.x-this.min.x,this.xScale,this.cellsX),c=Ua(e.y-this.min.y,this.yScale,this.cellsY),h=Ua(t.y-this.min.y,this.yScale,this.cellsY);for(let p=c;p<=h;p++)for(let _=s;_<=l;_++){const y=this.cells[p*this.cellsX+_];if(y)for(let v=0;v<y.len;v++){const b=this.payload[y.start+v],T=Math.floor(b/8),S=1<<b%8;if(!(this.lookup[T]&S)&&(this.lookup[T]|=S,n.push(b),n.length===this.triangleCount))return}}}}function Ua(i,e,t){return Math.max(0,Math.min(t-1,Math.floor(i*e)))}tt(Im,"TriangleGridIndex");const CT=ue([{name:"a_pos_3f",components:3,type:"Float32"}]),MT=ue([{name:"a_color_3f",components:3,type:"Float32"}]),RT=ue([{name:"a_color_4f",components:4,type:"Float32"}]),PT=ue([{name:"a_uv_2f",components:2,type:"Float32"}]),DT=ue([{name:"a_normal_3f",components:3,type:"Float32"}]),LT=ue([{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"}]),zT=ue([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Iv(i,e){const t=Tf(i.projection,i.zoom,i.width,i.height),n=function(l,c,h,p,_){const y=new Wt(h.lng-180*Fc,h.lat),v=new Wt(h.lng+180*Fc,h.lat),b=l.project(y.lng,y.lat),T=l.project(v.lng,v.lat),S=-Math.atan2(T.y-b.y,T.x-b.x),A=E.fromLngLat(h);A.y=yt(A.y,-1+Fc,1-Fc);const C=A.toLngLat(),D=l.project(C.lng,C.lat),F=E.fromLngLat(C);F.x+=Fc;const O=F.toLngLat(),z=l.project(O.lng,O.lat),N=Cv(z.x-D.x,z.y-D.y,S),j=E.fromLngLat(C);j.y+=Fc;const te=j.toLngLat(),G=l.project(te.lng,te.lat),W=Cv(G.x-D.x,G.y-D.y,S),K=Math.abs(N.x)/Math.abs(W.y),ee=er([]);js(ee,ee,-S*(1-(_?0:p)));const le=er([]);return mr(le,le,[1,1-(1-K)*p,1]),le[4]=-W.x/W.y*p,js(le,le,S),zt(le,ee,le),le}(i.projection,0,i.center,t,e),s=Av(i);return mr(n,n,[s,s,1]),n}function Av(i){const e=i.projection,t=Tf(i.projection,i.zoom,i.width,i.height),n=Bg(e,i.center),s=Bg(e,Wt.convert(e.center));return Math.pow(2,n*t+(1-t)*s)}function Tf(i,e,t,n,s=1/0){const l=i.range;if(!l)return 0;const c=Math.min(s,Math.max(t,n)),h=Math.log2(c/1024);return ls(l[0]+h,l[1]+h,e)}const Fc=1/4e4;function Bg(i,e){const t=yt(e.lat,-85.051129,f),n=new Wt(e.lng-180*Fc,t),s=new Wt(e.lng+180*Fc,t),l=i.project(n.lng,t),c=i.project(s.lng,t),h=E.fromLngLat(n),p=E.fromLngLat(s),_=c.x-l.x,y=c.y-l.y,v=p.x-h.x,b=p.y-h.y,T=Math.sqrt((v*v+b*b)/(_*_+y*y));return Math.log2(T)}function Cv(i,e,t){const n=Math.cos(t),s=Math.sin(t);return{x:i*n-e*s,y:i*s+e*n}}const FT=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function Mv(i,e,t){er(i),js(i,i,Bt(e[2])),Is(i,i,Bt(e[0])),So(i,i,Bt(e[1])),mr(i,i,t),zt(i,i,FT)}function Am(i,e,t,n,s,l,c,h){const p=[t[0]-e[0],t[1]-e[1],0],_=[n[0]-e[0],n[1]-e[1],0];if(Xi(p)<1e-12||Xi(_)<1e-12)return Cn(i);const y=xr([],p,_);ti(y,y),eo(_,n,e),p[2]=(l-s)*h,_[2]=(c-s)*h;const v=p;return xr(v,p,_),ti(v,v),Ys(i,y,v)}function Cm(i,e,t=!1){const n=Ll(e.zoom),s=function(l,c,h){const p=c.worldSize,_=[l[12],l[13],l[14]],y=wr(_[1]/p),v=qn(_[0]/p),b=er([]),T=o(1,y)*p,S=o(1,0)*p*g(y,c.zoom),A=1/ug(p);let C=S*A;if(h){const z=Tf(c.projection,c.zoom,c.width,c.height,1024);C=A*c.projection.pixelSpaceConversion(c.center.lat,p,z)}const D=Sl(y,v);Yi(D,D,oi([],ti([],D),T*C*_[2]));const F=function(z){const N=[z[0],z[1],z[2]];let j=[0,1,0];const te=xr([],j,N);return xr(j,N,te),is(j)===0&&(j=[0,1,0],xr(te,N,j)),ti(te,te),ti(j,j),ti(N,N),[te[0],te[1],te[2],0,j[0],j[1],j[2],0,N[0],N[1],N[2],0,z[0],z[1],z[2],1]}(D);mr(b,b,[C,C,C*T]),Wi(b,b,[-_[0],-_[1],-_[2]]);const O=zt([],c.globeMatrix,F);return zt(O,O,b),zt(O,O,l),O}(i,e,t);if(n>0){const l=function(c,h){const p=h.worldSize,_=o(1,0)*p*g(h.center.lat,h.zoom)/ug(p),y=o(1,h.center.lat)*p,v=er([]);So(v,v,Bt(h.center.lng)),Is(v,v,Bt(h.center.lat)),Wi(v,v,[0,0,Fn]),mr(v,v,[_,_,_*y]);const b=h.point;return Wi(v,v,[-b.x,-b.y,0]),zt(v,v,c),zt(v,h.globeMatrix,v)}(i,e);return function(c,h,p){const _=(S,A,C)=>{const D=Xi(S),F=Xi(A),O=Dl(S,A,C);return oi(O,O,1/Xi(O)*lt(D,F,C))},y=_([c[0],c[1],c[2]],[h[0],h[1],h[2]],p),v=_([c[4],c[5],c[6]],[h[4],h[5],h[6]],p),b=_([c[8],c[9],c[10]],[h[8],h[9],h[10]],p),T=Dl([c[12],c[13],c[14]],[h[12],h[13],h[14]],p);return[y[0],y[1],y[2],0,v[0],v[1],v[2],0,b[0],b[1],b[2],0,T[0],T[1],T[2],1]}(s,l,n)}return s}function kg(i,e,t,n){const s=zi.projectAabbCorners(n,t);let l=Number.MAX_VALUE;for(let h=0;h<s.length;++h){const p=s[h];p[0]=(.5*p[0]+.5)*e.width,p[1]=(.5-.5*p[1])*e.height,p[2]<l&&(l=p[2])}const c=function(h){const p=[];let _=0;for(let T=1;T<h.length;T++)(h[T][0]<h[_][0]||h[T][0]===h[_][0]&&h[T][1]<h[_][1])&&(_=T);let y,v=_;const b=new Uint8Array(h.length);do{if(b[v])break;p.push(new Le(h[v][0],h[v][1])),b[v]=1,y=(v+1)%h.length;for(let T=0;T<h.length;T++){if(h[T][0]===h[y][0]&&h[T][1]===h[y][1]||h[T][0]===h[v][0]&&h[T][1]===h[v][1])continue;const S=[h[T][0]-h[v][0],h[T][1]-h[v][1]],A=[h[y][0]-h[v][0],h[y][1]-h[v][1]],C=S[0]*A[1]-S[1]*A[0];(C>0||C===0&&S[0]*A[0]+S[1]*A[1]>=0&&S[0]*S[0]+S[1]*S[1]>A[0]*A[0]+A[1]*A[1])&&(y=T)}v=y}while(v!==_);return p.length>0&&p.push(p[0]),p}(s);if(H_(i,c))return l}const zu=64,OT=[1,1,1];function Mm(i,e,t,n,s,l,c,h,p,_=!1){const y=t.zoom,v=t.project(n),b=g(n.lat,y),T=1/b;er(i),Wi(i,i,[v.x+c[0]*T,v.y+c[1]*T,c[2]]);let S=1,A=1;const C=t.worldSize;if(_){if(t.projection.name==="mercator"){let z=0;t.elevation&&(z=t.elevation.getAtPointOrZero(new E(v.x/C,v.y/C),0));const N=ar([],[v.x,v.y,z,1],t.projMatrix)[3]/t.cameraToCenterDistance;S=N,A=N*g(t.center.lat,y)}else if(t.projection.name==="globe"){const z=Cm(i,t),N=[0,0,0,1];ar(N,N,zt([],t.projMatrix,z));const j=N[3]/t.cameraToCenterDistance,te=Ll(y),G=t.projection.pixelsPerMeter(n.lat,C)*g(n.lat,y),W=t.projection.pixelsPerMeter(t.center.lat,C)*g(t.center.lat,y);S=j/lt(G,m(t.center.lat),te),A=j*b/G,S*=W,A*=W}}else S=T;mr(i,i,[S,S,A]);const D=[...i],F=e.orientation,O=[];if(Mv(O,[F[0]+(s?s[0]:0),F[1]+(s?s[1]:0),F[2]+(s?s[2]:0)],l),zt(i,D,O),h&&t.elevation){let z=0;const N=[];if(p&&t.elevation){z=function(te,G,W,K,ee){const le=G.elevation;if(!le)return 0;const de=zi.projectAabbCorners(W,K),ve=o(1,ee.lat)*G.worldSize,xe=function(Be,Ke){const Ne=[0,0,1],He=[{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(const ft of He){const pt=Be[ft.corners[0]],xt=Be[ft.corners[1]],ht=Be[ft.corners[2]],wt=[xt[0]-pt[0],xt[1]-pt[1],Ke*(xt[2]-pt[2])],vt=xr(wt,wt,[ht[0]-pt[0],ht[1]-pt[1],Ke*(ht[2]-pt[2])]);ti(vt,vt),ft.dotProductWithUp=Di(vt,Ne)}return He.sort((ft,pt)=>ft.dotProductWithUp-pt.dotProductWithUp),He[0].corners}(de,ve),we=de[xe[0]],Fe=de[xe[1]],se=de[xe[2]],pe=de[xe[3]],ge=le.getAtPointOrZero(new E(we[0]/G.worldSize,we[1]/G.worldSize),0),Se=le.getAtPointOrZero(new E(Fe[0]/G.worldSize,Fe[1]/G.worldSize),0),Me=le.getAtPointOrZero(new E(se[0]/G.worldSize,se[1]/G.worldSize),0),Pe=le.getAtPointOrZero(new E(pe[0]/G.worldSize,pe[1]/G.worldSize),0),Ie=(ge+Pe)/2,Oe=(Se+Me)/2;return Ie>Oe?Se<Me?Am(te,Fe,pe,we,Se,Pe,ge,ve):Am(te,se,we,pe,Me,ge,Pe,ve):ge<Pe?Am(te,we,Fe,se,ge,Se,Me,ve):Am(te,pe,se,Fe,Pe,Me,Se,ve),Math.max(Ie,Oe)}(N,t,e.aabb,i,n);const j=zt([],qa([],N),O);zt(i,D,j)}else z=t.elevation.getAtPointOrZero(new E(v.x/C,v.y/C),0);z!==0&&(i[14]+=z)}}class Rv{constructor(e,t,n,s,l){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=t,this.position=n!=null?new Wt(n[0],n[1]):new Wt(0,0),this.orientation=s??[0,0,0],this.nodes=l,this.uploaded=!1,this.aabb=new zi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){zt(e.globalMatrix,t,e.localMatrix);const n=this.nodeOverrides.get(e.name);if(n!==void 0){if(n.orientation){const c=[];l=n.orientation,er(s=c),So(s,s,Bt(l[1])),js(s,s,Bt(l[2])),Is(s,s,Bt(l[0])),zt(e.globalMatrix,e.globalMatrix,c)}n.minZoom&&(e.minZoom=n.minZoom),n.maxZoom&&(e.maxZoom=n.maxZoom)}var s,l;if(e.meshes)for(const c of e.meshes){const h=zi.applyTransformFast(c.aabb,e.globalMatrix);this.aabb.encapsulate(h)}if(e.children)for(const c of e.children)this._applyTransformations(c,e.globalMatrix)}computeBoundsAndApplyParent(){const e=er([]);this.aabb=new zi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,n,s,l,c,h=!1){Mm(this.matrix,this,e.transform,this.position,t,n,s,l,c,h)}upload(e){if(!this.uploaded){for(const t of this.nodes)Ng(t,e);for(const t of this.nodes)Rm(t);this.uploaded=!0}}destroy(){for(const e of this.nodes)Vg(e)}}function Ef(i,e,t=!1){i.uploaded||(i.gfxTexture=new lm(e,i.image,t?e.gl.R8:e.gl.RGBA8,{useMipmap:i.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),i.uploaded=!0,i.image=null)}function Pv(i,e,t){i.indexBuffer=e.createIndexBuffer(i.indexArray,!1,!0),i.vertexBuffer=e.createVertexBuffer(i.vertexArray,CT.members,!1,!0),i.normalArray&&(i.normalBuffer=e.createVertexBuffer(i.normalArray,DT.members,!1,!0)),i.texcoordArray&&(i.texcoordBuffer=e.createVertexBuffer(i.texcoordArray,PT.members,!1,!0)),i.colorArray&&(i.colorBuffer=e.createVertexBuffer(i.colorArray,(i.colorArray.bytesPerElement===12?MT:RT).members,!1,!0)),i.featureArray&&(i.pbrBuffer=e.createVertexBuffer(i.featureArray,zT.members,!0)),i.segments=fi.simpleSegment(0,0,i.vertexArray.length,i.indexArray.length);const n=i.material;n.pbrMetallicRoughness.baseColorTexture&&Ef(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&Ef(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&Ef(n.normalTexture,e),n.occlusionTexture&&Ef(n.occlusionTexture,e,t),n.emissionTexture&&Ef(n.emissionTexture,e)}function Ng(i,e,t){if(i.meshes)for(const n of i.meshes)Pv(n,e,t);if(i.lodMeshes)for(const n of i.lodMeshes)Pv(n,e,t);if(i.children)for(const n of i.children)Ng(n,e,t)}function Dv(i){i.indexArray.destroy(),i.vertexArray.destroy(),i.colorArray&&i.colorArray.destroy(),i.normalArray&&i.normalArray.destroy(),i.texcoordArray&&i.texcoordArray.destroy(),i.featureArray&&i.featureArray.destroy()}function Rm(i){if(i.meshes)for(const e of i.meshes)Dv(e);if(i.lodMeshes)for(const e of i.lodMeshes)Dv(e);if(i.children)for(const e of i.children)Rm(e)}function Lv(i){var e;i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()))}function Vg(i){if(i.meshes)for(const e of i.meshes)Lv(e);if(i.lodMeshes)for(const e of i.lodMeshes)Lv(e);if(i.footprintDebugMesh&&(i.footprintDebugMesh.vertexBuffer.destroy(),i.footprintDebugMesh.indexBuffer.destroy(),i.footprintDebugMesh.segments.destroy()),i.children)for(const e of i.children)Vg(e)}function Ug(i,e,t,n){return i[0]<=n[0]&&e[0]>=t[0]&&i[1]<=n[1]&&e[1]>=t[1]&&i[2]<=n[2]&&e[2]>=t[2]}function BT(i,e,t,n,s,l,c,h,p,_,y){const v=.5*(_[0]+y[0]),b=.5*(_[1]+y[1]),T=.5*(_[2]+y[2]),S=.5*(y[0]-_[0]),A=.5*(y[1]-_[1]),C=.5*(y[2]-_[2]),D=i-v,F=e-b,O=t-T,z=n-v,N=s-b,j=l-T,te=c-v,G=h-b,W=p-T,K=z-D,ee=N-F,le=j-O,de=te-z,ve=G-N,xe=W-j,we=D-te,Fe=F-G,se=O-W;let pe,ge,Se,Me,Pe,Ie;
7if(pe=O*ee-F*le,ge=j*ee-N*le,Se=W*ee-G*le,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(le)*A+Math.abs(ee)*C,Me>Ie||Pe<-Ie||(pe=O*ve-F*xe,ge=j*ve-N*xe,Se=W*ve-G*xe,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(xe)*A+Math.abs(ve)*C,Me>Ie||Pe<-Ie)||(pe=O*Fe-F*se,ge=j*Fe-N*se,Se=W*Fe-G*se,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(se)*A+Math.abs(Fe)*C,Me>Ie||Pe<-Ie)||(pe=D*le-O*K,ge=z*le-j*K,Se=te*le-W*K,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(le)*S+Math.abs(K)*C,Me>Ie||Pe<-Ie)||(pe=D*xe-O*de,ge=z*xe-j*de,Se=te*xe-W*de,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(xe)*S+Math.abs(de)*C,Me>Ie||Pe<-Ie)||(pe=D*se-O*we,ge=z*se-j*we,Se=te*se-W*we,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(se)*S+Math.abs(we)*C,Me>Ie||Pe<-Ie)||(pe=F*K-D*ee,ge=N*K-z*ee,Se=G*K-te*ee,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(ee)*S+Math.abs(K)*A,Me>Ie||Pe<-Ie)||(pe=F*de-D*ve,ge=N*de-z*ve,Se=G*de-te*ve,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(ve)*S+Math.abs(de)*A,Me>Ie||Pe<-Ie)||(pe=F*we-D*Fe,ge=N*we-z*Fe,Se=G*we-te*Fe,Me=Math.min(pe,ge,Se),Pe=Math.max(pe,ge,Se),Ie=Math.abs(Fe)*S+Math.abs(we)*A,Me>Ie||Pe<-Ie)||(Me=Math.min(D,z,te),Pe=Math.max(D,z,te),Me>S||Pe<-S)||(Me=Math.min(F,N,G),Pe=Math.max(F,N,G),Me>A||Pe<-A)||(Me=Math.min(O,j,W),Pe=Math.max(O,j,W),Me>C||Pe<-C))return!1;const Oe=ee*xe-le*ve,Be=le*de-K*xe,Ke=K*ve-ee*de,Ne=-(Oe*D+Be*F+Ke*O);return Ie=S*Math.abs(Oe)+A*Math.abs(Be)+C*Math.abs(Ke),!(Math.abs(Ne)>Ie)}const kT=[];class zv{serializeFromGltf(e,t,n,s){if(e.length<7)return;let l=0;if(e[l++]!==109||e[l++]!==98||e[l++]!==120||e[l++]!==98||e[l++]!==118||e[l++]!==104||e[l++]!==43)return;const c=new DataView(e.buffer,e.byteOffset),h=c.getUint16(l,!0);if(l+=2,h===0)return;this._nodes=[];let p=0;for(let y=0;y<h;y++){const v=[t[3*p],t[3*p+1],t[3*p+2]],b=[n[3*p],n[3*p+1],n[3*p+2]];p++;const T=c.getUint16(l,!0);l+=2;let S=0,A=0;T===65535&&(S=c.getUint16(l,!0),l+=2,A=c.getUint32(l,!0),l+=4),this._nodes.push({aabbMin:v,aabbMax:b,backChild:T,indexCount:S,indexOffset:A})}const _=c.getUint32(l,!0);this._indices=s.slice(0,_)}setVertices(e){this._vertices=e}findHighestPoint(e,t){if(!this._nodes||this._nodes.length===0||!Ug(this._nodes[0].aabbMin,this._nodes[0].aabbMax,e,t))return null;const n=kT;n.length=0,n.push(0);let s=-1/0;for(;n.length>0;){const l=n.pop(),c=this._nodes[l];if(c.aabbMax[2]<=s)continue;if(c.backChild===65535){for(let T=0;T<c.indexCount;T+=3){const S=3*this._indices[c.indexOffset+T],A=3*this._indices[c.indexOffset+T+1],C=3*this._indices[c.indexOffset+T+2];BT(this._vertices[S],this._vertices[S+1],this._vertices[S+2],this._vertices[A],this._vertices[A+1],this._vertices[A+2],this._vertices[C],this._vertices[C+1],this._vertices[C+2],e,t)&&(s=Math.max(s,this._vertices[S+2],this._vertices[A+2],this._vertices[C+2]))}continue}const h=l+1,p=c.backChild,_=this._nodes[h],y=this._nodes[p],v=Ug(_.aabbMin,_.aabbMax,e,t),b=Ug(y.aabbMin,y.aabbMax,e,t);v&&b?_.aabbMax[2]<y.aabbMax[2]?(n.push(h),n.push(p)):(n.push(p),n.push(h)):v?n.push(h):b&&n.push(p)}return s>=0?s:null}}function Fu(i,e){const t=i.json.bufferViews[e.bufferView],n=Em[e.componentType];return new n(i.buffers[t.buffer],(e.byteOffset||0)+(t.byteOffset||0),e.count*(t.byteStride&&t.byteStride!==wf[e.type]*n.BYTES_PER_ELEMENT?t.byteStride/n.BYTES_PER_ELEMENT:wf[e.type]))}function jg(i,e,t,n){const s=Em[e.componentType],l=function(v){switch(v){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(s),c=i.json.bufferViews[e.bufferView],h=c.byteStride?c.byteStride/s.BYTES_PER_ELEMENT:wf[e.type],p=t.float32,_=p.length/t.capacity,y=e.count*h;for(let v=0,b=0;v<y;v+=h,b+=_)for(let T=0;T<_;T++)p[b+T]=n[v+T]*l}function NT(i,e,t){const n=i.indices,s=i.attributes,l={};l.indexArray=new bt;const c=e.json.accessors[n],h=Fu(e,c);l.indexArray.resizeExact(c.count/3),l.indexArray.uint16.set(h),l.vertexArray=new $e;const p=e.json.accessors[s.POSITION],_=Fu(e,p);l.vertexArray.resizeExact(p.count),l.vertexArray.float32.set(_),l.aabb=new zi(p.min,p.max);const[y,v,b]=p.min,[T,S,A]=p.max;if(l.centroid=[.5*(y+T),.5*(v+S),.5*(b+A)],s.COLOR_0!==void 0){const D=e.json.accessors[s.COLOR_0],F=wf[D.type],O=Fu(e,D);l.colorArray=F===3?new $e:new Ge,l.colorArray.resizeExact(D.count),jg(e,D,l.colorArray,O)}if(s.NORMAL!==void 0){l.normalArray=new $e;const D=e.json.accessors[s.NORMAL];l.normalArray.resizeExact(D.count);const F=Fu(e,D);jg(e,D,l.normalArray,F)}if(s.TEXCOORD_0!==void 0&&t.length>0){l.texcoordArray=new Ui;const D=e.json.accessors[s.TEXCOORD_0];l.texcoordArray.resizeExact(D.count);const F=Fu(e,D);jg(e,D,l.texcoordArray,F)}if(s._FEATURE_ID_RGBA4444!==void 0){const D=e.json.accessors[s._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(l.featureData=Fu(e,D))}s._FEATURE_RGBA4444!==void 0&&(l.featureData=new Uint32Array(Fu(e,e.json.accessors[s._FEATURE_RGBA4444]).buffer));const C=i.material;return l.material=function(D,F){const{emissiveFactor:O=[0,0,0],alphaMode:z="OPAQUE",alphaCutoff:N=.5,normalTexture:j,occlusionTexture:te,emissiveTexture:G,doubleSided:W,name:K}=D,{baseColorFactor:ee=[1,1,1,1],metallicFactor:le=1,roughnessFactor:de=1,baseColorTexture:ve,metallicRoughnessTexture:xe}=D.pbrMetallicRoughness||{},we=te?F[te.index]:void 0;if(te&&te.extensions&&te.extensions.KHR_texture_transform&&we){const Fe=te.extensions.KHR_texture_transform;we.offsetScale=[Fe.offset[0],Fe.offset[1],Fe.scale[0],Fe.scale[1]]}return{name:K,pbrMetallicRoughness:{baseColorFactor:new Lt(...ee),metallicFactor:le,roughnessFactor:de,baseColorTexture:ve?F[ve.index]:void 0,metallicRoughnessTexture:xe?F[xe.index]:void 0},doubleSided:W,emissiveFactor:new Lt(...O),alphaMode:z,alphaCutoff:N,normalTexture:j?F[j.index]:void 0,occlusionTexture:we,emissionTexture:G?F[G.index]:void 0,defined:D.defined===void 0}}(C!==void 0?e.json.materials[C]:{defined:!1},t),l}function Gg(i,e,t){const{matrix:n,rotation:s,translation:l,scale:c,mesh:h,extras:
vendor: 5,111 bytes, line 7
7p,children:_,name:y}=i,v={};if(v.name=y,v.localMatrix=n||function(b,T,S,A){var C=T[0],D=T[1],F=T[2],O=T[3],z=C+C,N=D+D,j=F+F,te=C*z,G=C*N,W=C*j,K=D*N,ee=D*j,le=F*j,de=O*z,ve=O*N,xe=O*j,we=A[0],Fe=A[1],se=A[2];return b[0]=(1-(K+le))*we,b[1]=(G+xe)*we,b[2]=(W-ve)*we,b[3]=0,b[4]=(G-xe)*Fe,b[5]=(1-(te+le))*Fe,b[6]=(ee+de)*Fe,b[7]=0,b[8]=(W+ve)*se,b[9]=(ee-de)*se,b[10]=(1-(te+K))*se,b[11]=0,b[12]=S[0],b[13]=S[1],b[14]=S[2],b[15]=1,b}([],s||[0,0,0,1],l||[0,0,0],c||[1,1,1]),v.globalMatrix=Us(v.localMatrix),h!==void 0){v.meshes=t[h];const b=v.anchor=[0,0];for(const T of v.meshes){const{min:S,max:A}=T.aabb;b[0]+=S[0]+A[0],b[1]+=S[1]+A[1]}b[0]=Math.floor(b[0]/v.meshes.length/2),b[1]=Math.floor(b[1]/v.meshes.length/2)}if(p&&(p.id&&(v.id=p.id),p.lights&&(v.lights=function(b){if(!b.length)return[];const T=function(F){const O=atob(F),z=new Uint8Array(O.length);for(let N=0;N<O.length;N++)z[N]=O.codePointAt(N);return z}(b),S=[],A=T.length/24,C=new Uint16Array(T.buffer),D=new Float32Array(T.buffer);for(let F=0;F<A;F++){const O=C[2*F*6]/30,z=C[2*F*6+1]/30,N=C[2*F*6+10]/100,j=D[6*F+1],te=D[6*F+2],G=D[6*F+3],W=D[6*F+4],K=G-j,ee=W-te,le=Math.hypot(K,ee);S.push({pos:[j+.5*K,te+.5*ee,z],normal:[ee/le,-K/le,0],width:le,height:O,depth:N,points:[j,te,G,W]})}return S}(p.lights)),p.MAPBOX_geometry_bloom&&(v.isGeometryBloom=p.MAPBOX_geometry_bloom),p.MAPBOX_zoom_min&&(v.minZoom=p.MAPBOX_zoom_min),p.MAPBOX_zoom_max&&(v.maxZoom=p.MAPBOX_zoom_max)),_){const b=[];for(const T of _)b.push(Gg(e.json.nodes[T],e,t));v.children=b}if(i.extensions&&i.extensions.mbx_bvh&&(v.meshBVH=function(b,T,S){const A=T.binaryAccessor,C=T.positionMinAccessor,D=T.positionMaxAccessor,F=T.indexAccessor;if(!(Number.isInteger(A)&&Number.isInteger(C)&&Number.isInteger(D)&&Number.isInteger(F)))return null;const O=b.json.accessors;if(A>=O.length||C>=O.length||D>=O.length||F>=O.length)return null;const z=O[A],N=O[C],j=O[D],te=O[F];if(z.bufferView===void 0||N.bufferView===void 0||j.bufferView===void 0||te.bufferView===void 0)return null;const G=b.json.bufferViews;if(z.bufferView>=G.length||N.bufferView>=G.length||j.bufferView>=G.length||te.bufferView>=G.length)return null;const W=G[z.bufferView],K=G[N.bufferView],ee=G[j.bufferView],le=G[te.bufferView];if(W.buffer>=b.buffers.length||K.buffer>=b.buffers.length||ee.buffer>=b.buffers.length||le.buffer>=b.buffers.length)return null;const de=(Pe,Ie,Oe)=>Pe>=0&&Pe<=Oe&&Ie<=Oe-Pe,ve=z.byteOffset||0,xe=N.byteOffset||0,we=j.byteOffset||0,Fe=te.byteOffset||0;if(!(de(ve,0,W.byteLength)&&de(xe,3*N.count*4,K.byteLength)&&de(we,3*j.count*4,ee.byteLength)&&de(Fe,4*te.count,le.byteLength)))return null;const se=new Uint8Array(b.buffers[W.buffer],(W.byteOffset||0)+ve,W.byteLength-ve),pe=new Float32Array(b.buffers[K.buffer],(K.byteOffset||0)+xe,3*N.count),ge=new Float32Array(b.buffers[ee.buffer],(ee.byteOffset||0)+we,3*j.count),Se=new Uint32Array(b.buffers[le.buffer],(le.byteOffset||0)+Fe,te.count),Me=new zv;if(Me.serializeFromGltf(se,pe,ge,Se),S!==void 0&&b.json.meshes&&b.json.meshes[S]){const Pe=b.json.meshes[S].primitives[0];if(Pe&&Pe.attributes.POSITION!==void 0&&Pe.attributes.POSITION<O.length){const Ie=O[Pe.attributes.POSITION];if(Ie.bufferView!==void 0&&Ie.bufferView<G.length){const Oe=G[Ie.bufferView];if(Oe.buffer<b.buffers.length){const Be=Ie.byteOffset||0,Ke=Oe.byteStride?Oe.byteStride/4:3;if(de(Be,Ie.count*Ke*4,Oe.byteLength)){const Ne=(Oe.byteOffset||0)+Be;if(Ke===3)Me.setVertices(new Float32Array(b.buffers[Oe.buffer],Ne,3*Ie.count));else{const He=new Float32Array(b.buffers[Oe.buffer],Ne,Ie.count*Ke),ft=new Float32Array(3*Ie.count);for(let pt=0;pt<Ie.count;pt++)ft[3*pt]=He[pt*Ke],ft[3*pt+1]=He[pt*Ke+1],ft[3*pt+2]=He[pt*Ke+2];Me.setVertices(ft)}}}}}}return Me}(e,i.extensions.mbx_bvh,h)),!v.meshBVH&&v.children){for(const b of v.children)if(b.meshBVH){v.meshBVH=b.meshBVH;break}}return v}function VT(i){if(i.vertices.length===0||i.indices.length===0)return null;const e=new Im(i.vertices,i.indices,8,256),[t,n]=[e.min.clone(),e.max.clone()];return{vertices:i.vertices,indices:i.indices,grid:e,min:t,max:n}}function UT(i){if(!i.extras||!i.extras.ground)return null;const e=i.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const t=e[0];if(!t||!Array.isArray(t)||t.length===0)return null;const n=[];for(const c of t){if(!Array.isArray(c)||c.length!==2)continue;const h=c[0],p=c[1];typeof h=="number"&&typeof p=="number"&&n.push(new Le(h,p))}if(n.length<3)return null;n.length>1&&n.at(-1).equals(n[0])&&n.pop();let s=0;for(let c=0;c<n.length;c++){const h=n[c],p=n[(c+1)%n.length],_=n[(c+2)%n.length];s+=(h.x-p.x)*(_.y-p.y)-(_.x-p.x)*(h.y-p.y)}s>0&&n.reverse();const l=vc(n.flatMap(c=>[c.x,c.y]),[]);return l.length===0?null:{vertices:n,indices:l}}function jT(i,e){const t=[],n=[];let s=0;const l=[];for(const c of i){s=t.length;const h=c.vertexArray.float32,p=c.indexArray.uint16;for(let _=0;_<c.vertexArray.length;_++)l[0]=h[3*_+0],l[1]=h[3*_+1],l[2]=h[3*_+2],hi(l,l,e),t.push(new Le(l[0],l[1]));for(let _=0;_<3*c.indexArray.length;_++)n.push(p[_]+s)}if(n.length%3!=0)return null;for(let c=0;c<n.length;c+=3){const h=t[n[c+0]],p=t[n[c+1]],_=t[n[c+2]];
vendor: 10,529 bytes, line 7
7(h.x-p.x)*(_.y-p.y)-(_.x-p.x)*(h.y-p.y)>0&&([n[c+1],n[c+2]]=[n[c+2],n[c+1]])}return{vertices:t,indices:n}}function Fv(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}function Hg(i){const e=function(y,v){const b=[],T=WebGL2RenderingContext;if(y.json.textures)for(const S of y.json.textures){const A={magFilter:T.LINEAR,minFilter:T.NEAREST,wrapS:T.REPEAT,wrapT:T.REPEAT};S.sampler!==void 0&&Object.assign(A,y.json.samplers[S.sampler]),b.push({image:v[S.source],sampler:A,uploaded:!1})}return b}(i,i.images),t=function(y,v){const b=[];if(!y.json.meshes)return b;for(const T of y.json.meshes){const S=[];for(const A of T.primitives)S.push(NT(A,y,v));b.push(S)}return b}(i,e),{scenes:n,scene:s,nodes:l}=i.json;let c=n?Fv(n,"Default Scene"):-1;c<0&&(c=s||0);const h=n&&n[c]?n[c].nodes||[]:[...l.keys()],p=[];for(const y of h)p.push(Gg(l[y],i,t));(function(y,v,b){const T={},S=new Set;for(let A=0;A<y.length;A++){const C=b[v[A]];if(!C.extras)continue;const D=C.extras["mapbox:footprint:version"],F=C.extras["mapbox:footprint:id"];(D||F)&&S.add(A),D==="1.0.0"&&F&&(T[F]=A)}for(let A=0;A<y.length;A++){if(S.has(A))continue;const C=y[A],D=b[v[A]];if(!D.extras)continue;let F=null;C.id in T&&(F=jT(y[T[C.id]].meshes,C.localMatrix)),F||(F=UT(D)),F&&(C.footprint=VT(F))}if(S.size>0){const A=Array.from(S.values()).sort((C,D)=>C-D);for(let C=A.length-1;C>=0;C--)y.splice(A[C],1)}})(p,h,i.json.nodes);const _=n?Fv(n,"LOD"):-1;if(_>=0){const y=n[_].nodes,v=new Map;for(const b of y){const T=Gg(l[b],i,t);T.id&&v.set(T.id,T)}for(const b of p)if(b.id){const T=v.get(b.id);T&&T.meshes&&(b.lodMeshes=T.meshes,T.meshBVH&&(b.meshBVH=T.meshBVH))}}return p}function GT(i){i.heightmap=new Float32Array(4096),i.heightmap.fill(-1);const e=i.vertexArray.float32,t=i.aabb.min[0]-1,n=i.aabb.min[1]-1,s=zu/(i.aabb.max[0]-t+2),l=zu/(i.aabb.max[1]-n+2);for(let c=0;c<e.length;c+=3){const h=e[c+2],p=(e[c+0]-t)*s|0,_=(e[c+1]-n)*l|0;h>i.heightmap[_*zu+p]&&(i.heightmap[_*zu+p]=h)}}function Ov(i,e,t,n,s){t.reserve(t.length+4*i.length),n.reserve(n.length+10*i.length),s.reserve(s.length+10*i.length);let l=n.length;for(const c of i){const h=Math.min(10,Math.max(4,1.3*c.height))*e,p=[-c.normal[1],c.normal[0],0],_=Math.min(.29,.1*c.width/c.depth),y=c.width-2*c.depth*e*(_+.01),v=cn([],c.pos,p,y/2),b=cn([],c.pos,p,-y/2),T=[v[0],v[1],v[2]+c.height],S=[b[0],b[1],b[2]+c.height],A=cn([],c.normal,p,_);oi(A,A,h);const C=cn([],c.normal,p,-_);oi(C,C,h),Yi(A,v,A),Yi(C,b,C),v[2]+=.1,b[2]+=.1,n.emplaceBack(A[0],A[1],A[2]),n.emplaceBack(C[0],C[1],C[2]),n.emplaceBack(v[0],v[1],v[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(T[0],T[1],T[2]),n.emplaceBack(S[0],S[1],S[2]),n.emplaceBack(v[0],v[1],v[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(A[0],A[1],A[2]),n.emplaceBack(C[0],C[1],C[2]);const D=y/h/2;s.emplaceBack(-D-_,-1,D,.8),s.emplaceBack(D+_,-1,D,.8),s.emplaceBack(-D,0,D,1.3),s.emplaceBack(D,0,D,1.3),s.emplaceBack(D+_,-.8,D,.7),s.emplaceBack(D+_,-.8,D,.7),s.emplaceBack(0,0,D,1.3),s.emplaceBack(0,0,D,1.3),s.emplaceBack(D+_,-1.2,D,.8),s.emplaceBack(D+_,-1.2,D,.8),t.emplaceBack(6+l,4+l,8+l),t.emplaceBack(7+l,9+l,5+l),t.emplaceBack(0+l,1+l,2+l),t.emplaceBack(1+l,3+l,2+l),l+=10}}function HT(i,e){const t={};t.indexArray=new bt,t.vertexArray=new $e,t.colorArray=new Ge,t.indexArray.reserveExact(4*i.length),t.vertexArray.reserveExact(10*i.length),t.colorArray.reserveExact(10*i.length),Ov(i,e,t.indexArray,t.vertexArray,t.colorArray);const n={defined:!0};n.emissiveFactor=Lt.black;const s={};return s.baseColorFactor=Lt.white,n.pbrMetallicRoughness=s,t.material=n,t.aabb=new zi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),t}tt(zv,"ModelBVH");const Bv=ue([{name:"a_pos_3f",components:3,type:"Float32"}]),ZT=ue([{name:"a_normal_3",components:3,type:"Int16"}]),$T=ue([{name:"a_centroid_3",components:3,type:"Int16"}]),kv=ue([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),qT=ue([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),WT=ue([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),XT=ue([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),YT=ue([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),KT=ue([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),JT=ue([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),QT=ue([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),eE=ue([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),tE=ue([{name:"a_centroid_pos",components:2,type:"Uint16"}]),iE=ue([{name:"a_join_normal_inside",components:3,type:"Int16"}]),rE=ue([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),nE=ue([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:oE}=JT;function Pm(i,e,t,n){const s=[],l=n===0?(c,h,p,_,y,v)=>{c.push(new Le(v,p+(v-h)/(_-h)*(y-p)))}:(c,h,p,_,y,v)=>{c.push(new Le(h+(v-p)/(y-p)*(_-h),v))};for(const c of i){const h=[];for(const p of c){if(p.length<=2)continue;const _=[];for(let b=0;b<p.length-1;b++){const T=p[b].x,S=p[b].y,A=p[b+1].x,C=p[b+1].y,D=n===0?T:S,F=n===0?A:C;D<e?F>e&&l(_,T,S,A,C,e):D>t?F<t&&l(_,T,S,A,C,t):_.push(p[b]),F<e&&D>=e&&l(_,T,S,A,C,e),F>t&&D<=t&&l(_,T,S,A,C,t)}let y=p.at(-1);const v=n===0?y.x:y.y;v>=e&&v<=t&&_.push(y),_.length&&(y=_.at(-1),_[0].x===y.x&&_[0].y===y.y||_.push(_[0]),h.push(_))}h.length&&s.push(h)}return s}const Dm={None:0,Model:1,Symbol:2,FillExtrusion:4},Zg=[new Le(0,0),new Le(We,0),new Le(We,We),new Le(0,We)];function Nv(i,e){const t=[];let n=[];if(!e||i.length<2)return[i];if(i.length===2)return zh(i[0],i[1],Zg)?[i]:[];for(let s=0;s<i.length+2;s++){const l=s===0?i.at(-1):i[(s-1)%i.length],c=i[s%i.length],h=i[(s+1)%i.length],p=zh(l,c,Zg),_=zh(c,h,Zg),y=p||_;y&&n.push(c),y&&_||n.length>0&&(n.length>1&&t.push(n),n=[])}return n.length>1&&t.push(n),t}const $g=Ic.types,sE=["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"],aE=["fill-extrusion-flood-light-ground-radius"],lE=Math.pow(2,13),cE=Math.pow(2,15)-1,Lm=new Le(0,1),Bl=2147483648,zm=1073741824;function Sf(i,e,t,n,s,l,c,h){i.emplaceBack((e<<1)+c,(t<<1)+l,(Math.floor(n*lE)<<1)+s,Math.round(h))}function If(i,e,t){i.emplaceBack(e.x*We,e.y*We,t?1:0)}function Fm(i,e,t,n,s,l){i.emplaceBack(e.x,e.y,(t.x<<1)+n,(t.y<<1)+s,l)}function Af(i,e,t){i.emplaceBack(e.x,e.y,e.z,t[0]*16384,t[1]*16384,t[2]*16384)}class Vv{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Om{constructor(){this.data=[]}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}static serialize(e,t){const n=e.data.length,s=new Uint32Array(4*n),l=[];l.length=n;for(let c=0;c<n;c++){const h=e.data[c],p=4*c;s[p]=h.vertexOffset,s[p+1]=h.vertexCount,s[p+2]=h.indexOffset,s[p+3]=h.indexCount,l[c]=h.ringIndices}return t&&t.add(s.buffer),{scalars:s,rings:l}}static deserialize(e){const{scalars:t,rings:n}=e,s=t.length/4,l=new Om,c=[];c.length=s,l.data=c;for(let h=0;h<s;h++){const p=4*h,_=new Vv;_.vertexOffset=t[p],_.vertexCount=t[p+1],_.indexOffset=t[p+2],_.indexCount=t[p+3],_.ringIndices=n[h],l.data[h]=_}return l}}class Bm{constructor(){this.centroidXY=new Le(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 Le(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Le(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new Le(0,0)}span(){return new Le(this.max.x-this.min.x,this.max.y-this.min.y)}}class km{constructor(){this.data=[],this.buffer=null}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}find(e){return this.data.find(e)}[Symbol.iterator](){return this.data[Symbol.iterator]()}static serialize(e,t){const n=e.data.length,s=new Float64Array(15*n);for(let l=0;l<n;l++){const c=e.data[l],h=15*l;s[h]=c.centroidXY.x,s[h+1]=c.centroidXY.y,s[h+2]=c.min.x,s[h+3]=c.min.y,s[h+4]=c.max.x,s[h+5]=c.max.y,s[h+6]=c.groupCentroidPos.x,s[h+7]=c.groupCentroidPos.y,s[h+8]=c.vertexArrayOffset,s[h+9]=c.vertexCount,s[h+10]=c.groundVertexArrayOffset,s[h+11]=c.groundVertexCount,s[h+12]=c.footprintSegLen,s[h+13]=c.height,s[h+14]=c.buildingId}return t&&t.add(s.buffer),{buffer:s}}static deserialize(e){const t=e.buffer,n=t.length/15,s=new km;s.buffer=t;const l=[];l.length=n,s.data=l;let c=0;for(let h=0;h<n;h++){const p=15*h,_=new Bm;_.centroidXY=new Le(t[p],t[p+1]),_.min=new Le(t[p+2],t[p+3]),_.max=new Le(t[p+4],t[p+5]),_.groupCentroidPos=new Le(t[p+6],t[p+7]),_.vertexArrayOffset=t[p+8],_.vertexCount=t[p+9],_.groundVertexArrayOffset=t[p+10],_.groundVertexCount=t[p+11],_.footprintSegLen=t[p+12],_.height=t[p+13],_.buildingId=t[p+14],_.footprintSegIdx=c,c+=_.footprintSegLen,s.data[h]=_}return s}}class qg{constructor(){this.acc=new Le(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,n){this.accCount++,this.acc._add(t);let s=!!this.borders;t.x<e.min.x?(e.min.x=t.x,s=!0):t.x>e.max.x&&(e.max.x=t.x,s=!0),t.y<e.min.y?(e.min.y=t.y,s=!0):t.y>e.max.y&&(e.max.y=t.y,s=!0),((t.x===0||t.x===We)&&t.x===n.x)!=((t.y===0||t.y===We)&&t.y===n.y)&&this.processBorderOverlap(t,n),s&&this.checkBorderIntersection(t,n)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,lt(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>We!=e.x>We&&this.addBorderIntersection(1,lt(t.y,e.y,(We-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,lt(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>We!=e.y>We&&this.addBorderIntersection(3,lt(t.x,e.x,(We-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){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]]);const n=this.borders[e];t<n[0]&&(n[0]=t),t>n[1]&&(n[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,t.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,t.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new Le(0,0):new Le(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((e,t)=>
vendor: 5,160 bytes, line 7
7e+ +(t[0]!==Number.MAX_VALUE),0):0}}function Uv(i,e){const t=i.add(e)._unit(),n=yt(i.x*t.x+i.y*t.y,-1,1);var s,l,c;return c=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(c)))/4*cE*((s=i).x*(l=e).y-s.y*l.x<0?-1:1)}const uE=[i=>i.x<0,i=>i.x>We,i=>i.y<0,i=>i.y>We];function hE(i,e,t,n){const s=[4];if(n===0)return s;t._mult(n);const l=i.sub(t),c=e.sub(t),h=[i,e,l,c];for(let p=0;p<4;p++)for(const _ of h)if(uE[p](_)){s.push(p);break}return s}class Wg{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new De,this.indexArray=new bt,this.programConfigurations=new sa(e.layers,{zoom:e.zoom,lut:e.lut},t=>aE.includes(t)),this._segments=new fi,this.hiddenByLandmarkVertexArray=new cr,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new fi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,t,n,s=!1){const l=e.length;if(l>2){let c=Math.max(0,this._segments.get().length-1);const h=this._segments._prepareSegment(4*l,this.vertexArray.length,2*this._segmentToGroundQuads[c].length);let p;c!==this._segments.get().length-1&&(c++,this._segmentToGroundQuads[c]=[],this._segmentToRegionTriCounts[c]=[0,0,0,0,0]);{const _=e[0],y=e[1];p=Uv(_.sub(e[l-1])._perp()._unit(),y.sub(_)._perp()._unit())}for(let _=0;_<l;_++){const y=_===l-1?0:_+1,v=e[_],b=e[y],T=e[y===l-1?0:y+1],S=b.sub(v)._perp()._unit(),A=Uv(S,T.sub(b)._perp()._unit()),C=p,D=A;if(Yg(v,b,t)||s&&Hv(v,t)&&Hv(b,t)){p=A;continue}const F=h.vertexLength;Fm(this.vertexArray,v,b,1,1,C),Fm(this.vertexArray,v,b,1,0,C),Fm(this.vertexArray,v,b,0,1,D),Fm(this.vertexArray,v,b,0,0,D),h.vertexLength+=4;const O=hE(v,b,S,n);for(const z of O)this._segmentToGroundQuads[c].push({id:F,region:z}),this._segmentToRegionTriCounts[c][z]+=2,h.primitiveLength+=2;p=A}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),t=e.length;for(let n=0;n<t;n++)this._segmentToGroundQuads[n].sort((s,l)=>s.region-l.region);for(let n=0;n<t;n++){const s=this._segmentToGroundQuads[n],l=e[n],c=this._segmentToRegionTriCounts[n];c.reduce((p,_)=>p+_,0);let h=0;for(let p=0;p<=4;p++){const _=c[p];if(_!==0){let y=this.regionSegments[p];y||(y=this.regionSegments[p]=new fi);const v={vertexOffset:l.vertexOffset,primitiveOffset:l.primitiveOffset+h,vertexLength:l.vertexLength,primitiveLength:_};y.get().push(v)}h+=_}for(let p=0;p<s.length;p++){const _=s[p].id;this.indexArray.emplaceBack(_,_+1,_+3),this.indexArray.emplaceBack(_,_+3,_+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,t,n,s,l,c,h){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,t,n,s,l,c,void 0,h)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,QT.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,eE.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,t,n,s,l,c,h,p){this.hasData()&&this.programConfigurations.updatePaintArrays(e,t,n,s,l,c,h,p)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Bl||e.flags&zm))}updateHiddenByLandmarkRange(e,t,n){if(!this.hasData())return;const s=t+e;if(t!==0){for(let l=e;l<s;++l)this.hiddenByLandmarkVertexArray.emplace(l,n?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,rE.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 e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class Nm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=new km,this.footprintIndices=new bt,this.footprintVertices=new fe,this.footprintSegments=new Om,this.layoutVertexArray=new Ye,this.centroidVertexArray=new sr,this.wallVertexArray=new Pt,this.indexArray=new bt,this.programConfigurations=new sa(e.layers,{zoom:e.zoom,lut:e.lut},t=>sE.includes(t)),this.segments=new fi,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>
vendor: 10,250 bytes, line 7
7t.id),this.groundEffect=new Wg(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){this.features=[],this.hasPattern=Jd("fill-extrusion",this.layers,this.pixelRatio,t),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=w(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:l,id:c,index:h,sourceLayerIndex:p}of e){const _=this.layers[0]._featureFilter.needGeometry,y=X(l,_);if(!this.layers[0]._featureFilter.filter(new Oi(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),y,n))continue;const v={id:c,sourceLayerIndex:p,index:h,geometry:_?y.geometry:q(l,n,s),properties:l.properties,type:l.type,patterns:{}},b=this.layoutVertexArray.length,T=$g[v.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:l.id,feature:wc("fill-extrusion",this.layers,v,this.zoom,this.pixelRatio,t)});else if(this.wallMode)for(const S of v.geometry)for(const A of Nv(S,T))this.addFeature(l.id,v,[A],h,n,{},t.availableImages,s,t.brightness);else this.addFeature(l.id,v,v.geometry,h,n,{},t.availableImages,s,t.brightness);t.featureIndex.insert(l,v.geometry,h,p,this.index,b)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,n,s,l,c){for(const{featureId:h,feature:p}of this.features){const _=$g[p.type]==="Polygon",{geometry:y}=p;if(this.wallMode)for(const v of y)for(const b of Nv(v,_))this.addFeature(h,p,[b],p.index,t,n,s,l,c);else this.addFeature(h,p,y,p.index,t,n,s,l,c)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,t,n,s,l,c,h){this.programConfigurations.updatePaintArrays(e,t,l,n,s,c,h,this.worldview),this.groundEffect.update(e,t,l,n,s,c,h,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,oE),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,iE.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,nE.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,tE.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(e,t,n,s,l,c,h,p,_){const y=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,v=[new Le(0,0),new Le(We,We)],b=p.projection,T=b.name==="globe",S=this.wallMode||$g[t.type]==="Polygon",A=new qg;A.centroidDataIndex=this.centroidData.length;const C=new Bm;C.buildingId=e,t.properties&&Object.hasOwn(t.properties,"building_id")&&(C.buildingId=Number(t.properties.building_id)),A.buildingId=C.buildingId;const D=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},l)<=0,F=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},l);let O;if(C.height=F,C.vertexArrayOffset=this.layoutVertexArray.length,C.groundVertexArrayOffset=this.groundEffect.vertexArray.length,T&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Xe),this.wallMode){if(T)return void gi("Non zero fill-extrusion-line-width is not yet supported on globe.");if(n.length!==1)return;O=function(K){const ee=K[0].x===K.at(-1).x&&K[0].y===K.at(-1).y;(function(Oe){let Be=0;const Ke=Oe.length;for(let Ne=0;Ne<Ke;Ne++)Be+=(Oe[(Ne+1)%Ke].x-Oe[Ne].x)*(Oe[(Ne+1)%Ke].y+Oe[Ne].y);return Be>=0})(K)||(K=K.reverse());const de={geometry:[],joinNormals:[],indices:[]},ve=[],xe=[],we=[];let Fe=K.length;for(;Fe>=2&&K[Fe-1].equals(K[Fe-2]);)Fe--;if(Fe<(ee?3:2))return de;let se,pe,ge,Se,Me,Pe=0;for(;Pe<Fe-1&&K[Pe].equals(K[Pe+1]);)Pe++;ee&&(se=K[Fe-2],Me=K[Pe].sub(se)._unit()._perp());for(let Oe=Pe;Oe<Fe;Oe++){if(ge=Oe===Fe-1?ee?K[Pe+1]:void 0:K[Oe+1],ge&&K[Oe].equals(ge))continue;Me&&(Se=Me),se&&(pe=se),se=K[Oe],Me=ge?ge.sub(se)._unit()._perp():Se,Se=Se||Me;let Be=Se.add(Me);Be.x===0&&Be.y===0||Be._unit();const Ke=Be.x*Me.x+Be.y*Me.y,Ne=Ke!==0?1/Ke:1/0,He=Se.x*Me.y-Se.y*Me.x>0;let ft="miter";const pt=2;ft==="miter"&&Ne>pt&&(ft="bevel"),ft==="bevel"&&(Ne>100&&(ft="flipbevel"),Ne<pt&&(ft="miter"));const xt=(ht,wt,vt,ri)=>{const Gt=new Le(ht.x,ht.y),ei=new Le(ht.x,ht.y);Gt.x+=wt.x*ri,Gt.y+=wt.y*ri,ei.x-=wt.x*Math.max(vt,1),ei.y-=wt.y*Math.max(vt,1),we.push(wt),ve.push(Gt),xe.push(ei)};if(ft==="miter")Be._mult(Ne),xt(se,Be,0,0);else if(ft==="flipbevel")Be=Me.mult(-1),xt(se,Be,0,0),xt(se,Be.mult(-1),0,0);else{const ht=-Math.sqrt(Ne*Ne-1),wt=He?ht:0,vt=He?0:ht;pe&&xt(se,Se,wt,vt),ge&&xt(se,Me,wt,vt)}}de.geometry=[...ve,...xe.reverse(),ve[0]],de.joinNormals=[...we,...we.reverse(),we.at(-1)];const Ie=de.geometry.length-1;for(let Oe=0;Oe<Ie/2;Oe++)if(Oe+1<Ie/2){let Be=Oe,Ke=Oe+1,Ne=Ie-1-Oe,He=Ie-2-Oe;Be=Be===0?Ie-1:Be-1,Ke=Ke===0?Ie-1:Ke-1,Ne=Ne===0?Ie-1:Ne-1,He=He===0?Ie-1:He-1,de.indices.push(Ne),de.indices.push(Ke),de.indices.push(Be),de.indices.push(Ne),de.indices.push(He),de.indices.push(Ke)}return de}(n[0]),n=[O.geometry]}const z=(K,ee)=>K<(ee.length-1)/2||K===ee.length-1,N=this.wallMode?[n]:Si(n,500);for(let K=N.length-1;K>=0;K--){const ee=N[K];(ee.length===0||pE(ee[0]))&&N.splice(K,1)}let j;if(T)j=Wv(N,v,l);else{j=[];for(const K of N)j.push({polygon:K,bounds:v})}const te=S?this.edgeRadius:0,G=te>0&&this.zoom<17,W=(K,ee)=>{if(K.length===0)return!1;const le=K.at(-1);return ee.x===le.x&&ee.y===le.y};for(const{polygon:K,bounds:ee}of j){let le=0,de=0;for(const Fe of K)S&&!Fe[0].equals(Fe.at(-1))&&Fe.push(Fe[0]),de+=S?Fe.length-1:Fe.length;const ve=this.segments.prepareSegment((S?5:4)*de,this.layoutVertexArray,this.indexArray);C.footprintSegIdx<0&&(C.footprintSegIdx=this.footprintSegments.length),C.polygonSegIdx<0&&(C.polygonSegIdx=this.polygonSegments.length);const xe={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},we=new Vv;if(we.vertexOffset=this.footprintVertices.length,we.indexOffset=3*this.footprintIndices.length,we.ringIndices=[],S){const Fe=[],se=[];le=ve.vertexLength;for(let ge=0;ge<K.length;ge++){const Se=K[ge];Se.length&&ge!==0&&se.push(Fe.length/2);const Me=[];let Pe,Ie;Pe=Se[1].sub(Se[0])._perp()._unit(),we.ringIndices.push(Se.length-1);for(let Oe=1;Oe<Se.length;Oe++){const Be=Se[Oe],Ke=Se[Oe===Se.length-1?1:Oe+1],Ne=Be.clone();if(te){Ie=Vm(Be,Ke,Pe);const He=jv(Pe,Ie),ft=Xg(Pe,Ie),pt=te*Math.min(4,1/ft);Ne.x+=pt*He.x,Ne.y+=pt*He.y,Ne.x=Math.round(Ne.x),Ne.y=Math.round(Ne.y),Pe=Ie}if(!D||te!==0&&!G||W(Me,Ne)||Me.push(Ne),Sf(this.layoutVertexArray,Ne.x,Ne.y,0,0,1,1,0),this.wallMode){const He=z(Oe,Se);If(this.wallVertexArray,O.joinNormals[Oe],!He)}ve.vertexLength++,this.footprintVertices.emplaceBack(Be.x,Be.y),Fe.push(Be.x,Be.y),T&&Af(this.layoutVertexExtArray,b.projectTilePoint(Ne.x,Ne.y,l),b.upVector(l,Ne.x,Ne.y))}D&&(te===0||G)&&(Me.length!==0&&W(Me,Me[0])&&Me.pop(),this.groundEffect.addData(Me,ee,y))}const pe=this.wallMode?O.indices:vc(Fe,se);for(let ge=0;ge<pe.length;ge+=3)this.footprintIndices.emplaceBack(we.vertexOffset+pe[ge+0],we.vertexOffset+pe[ge+1],we.vertexOffset+pe[ge+2]),this.indexArray.emplaceBack(le+pe[ge],le+pe[ge+2],le+pe[ge+1]),ve.primitiveLength++;we.indexCount+=pe.length,we.vertexCount+=this.footprintVertices.length-we.vertexOffset}for(let Fe=0;Fe<K.length;Fe++){const se=K[Fe];A.startRing(C,se[0]);let pe=se.length>4&&Zv(se[se.length-2],se[0],se[1]),ge=te?fE(se[se.length-2],se[0],se[1],te):0;const Se=[];let Me,Pe,Ie;Pe=se[1].sub(se[0])._perp()._unit();let Oe=!0;for(let Be=1,Ke=0;Be<se.length;Be++){let Ne=se[Be-1],He=se[Be];const ft=se[Be===se.length-1?1:Be+1];if(A.appendEdge(C,He,Ne),Yg(He,Ne,ee)){te&&(Pe=ft.sub(He)._perp()._unit(),Oe=!Oe);continue}const pt=He.sub(Ne)._perp(),xt=pt.x/(Math.abs(pt.x)+Math.abs(pt.y)),ht=pt.y>0?1:0,wt=Ne.dist(He);if(Ke+wt>32768&&(Ke=0),te){Ie=Vm(He,ft,Pe);let ei=Gv(Ne,He,ft,Xg(Pe,Ie),te);isNaN(ei)&&(ei=0);const ui=dE(Ne,He,new Le(0,0));Ne=Ne.add(ui.mult(ge))._round(),He=He.add(ui.mult(-ei))._round(),ge=ei,Pe=Ie,D&&this.zoom>=17&&(W(Se,Ne)||Se.push(Ne),W(Se,He)||Se.push(He))}const vt=ve.vertexLength,ri=se.length>4&&Zv(Ne,He,ft);let Gt=$v(Ke,pe,Oe);if(Sf(this.layoutVertexArray,Ne.x,Ne.y,xt,ht,0,0,Gt),Sf(this.layoutVertexArray,Ne.x,Ne.y,xt,ht,0,1,Gt),this.wallMode){const ei=z(Be-1,se),ui=O.joinNormals[Be-1];If(this.wallVertexArray,ui,ei),If(this.wallVertexArray,ui,ei)}if(Ke+=wt,Gt=$v(Ke,ri,!Oe),pe=ri,Sf(this.layoutVertexArray,He.x,He.y,xt,ht,0,0,Gt),Sf(this.layoutVertexArray,He.x,He.y,xt,ht,0,1,Gt),this.wallMode){const ei=z(Be,se),ui=O.joinNormals[Be];If(this.wallVertexArray,ui,ei),If(this.wallVertexArray,ui,ei)}if(ve.vertexLength+=4,this.indexArray.emplaceBack(vt+0,vt+1,vt+2),this.indexArray.emplaceBack(vt+1,vt+3,vt+2),ve.primitiveLength+=2,te){const ei=le+(Be===1?se.length-2:
vendor: 11,024 bytes, line 7
7Be-2),ui=Be===1?le:ei+1;if(this.indexArray.emplaceBack(vt+1,ei,vt+3),this.indexArray.emplaceBack(ei,ui,vt+3),ve.primitiveLength+=2,Me===void 0&&(Me=vt),!Yg(ft,se[Be],ee)){const Pr=Be===se.length-1?Me:ve.vertexLength;this.indexArray.emplaceBack(vt+2,vt+3,Pr),this.indexArray.emplaceBack(vt+3,Pr+1,Pr),this.indexArray.emplaceBack(vt+3,ui,Pr+1),ve.primitiveLength+=3}Oe=!Oe}if(T){const ei=this.layoutVertexExtArray,ui=b.projectTilePoint(Ne.x,Ne.y,l),Pr=b.projectTilePoint(He.x,He.y,l),Bo=b.upVector(l,Ne.x,Ne.y),fr=b.upVector(l,He.x,He.y);Af(ei,ui,Bo),Af(ei,ui,Bo),Af(ei,Pr,fr),Af(ei,Pr,fr)}}S&&(le+=se.length-1),D&&te&&this.zoom>=17&&(Se.length!==0&&W(Se,Se[0])&&Se.pop(),this.groundEffect.addData(Se,ee,y,te>0))}this.footprintSegments.push(we),xe.triangleCount=this.indexArray.length-xe.triangleArrayOffset,this.polygonSegments.push(xe),++C.footprintSegLen,++C.polygonSegLen}if(C.vertexCount=this.layoutVertexArray.length-C.vertexArrayOffset,C.groundVertexCount=this.groundEffect.vertexArray.length-C.groundVertexArrayOffset,C.vertexCount!==0){if(C.centroidXY=A.borders?Lm:this.encodeCentroid(A,C),t.properties&&Object.hasOwn(t.properties,"building_id")){const K=C.buildingId;let ee=this.buildingGroups.get(K);ee||(ee={accX:0,accY:0,accCount:0,mergedMin:new Le(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new Le(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(K,ee)),ee.accX+=A.acc.x,ee.accY+=A.acc.y,ee.accCount+=A.accCount,ee.mergedMin.x=Math.min(ee.mergedMin.x,C.min.x),ee.mergedMin.y=Math.min(ee.mergedMin.y,C.min.y),ee.mergedMax.x=Math.max(ee.mergedMax.x,C.max.x),ee.mergedMax.y=Math.max(ee.mergedMax.y,C.max.y),ee.partIndices.push(this.centroidData.length)}if(this.centroidData.push(C),A.borders){this.featuresOnBorder.push(A);const K=this.featuresOnBorder.length-1;for(let ee=0;ee<A.borders.length;ee++)A.borders[ee][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[ee].push(K)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,c,h,l,_,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(t,s,c,h,l,_,this.worldview),this.maxHeight=Math.max(this.maxHeight,F)}}_finalizeBuildingGroups(){for(const[,e]of this.buildingGroups){if(e.partIndices.length===0)continue;const t=new qg;t.acc=new Le(e.accX,e.accY),t.accCount=e.accCount;const n=new Bm;n.min=e.mergedMin,n.max=e.mergedMax;const s=this.encodeCentroid(t,n),l=t.centroid();for(const c of e.partIndices){const h=this.centroidData.get(c);h.centroidXY.x===Lm.x&&h.centroidXY.y===Lm.y||(h.centroidXY=s),h.min=e.mergedMin,h.max=e.mergedMax,h.groupCentroidPos=l}}this.buildingGroups.clear()}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((t,n)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let h=0;h<this.centroidData.length;h++){const p=this.centroidData.get(h),_=+(p.min.y+p.max.y>We),y=2*_+(+(p.min.x+p.max.x>We)^_);for(let v=0;v<p.polygonSegLen;v++){const b=p.polygonSegIdx+v;e.push({centroidIdx:h,subtile:y,polygonSegmentIdx:b,triangleSegmentIdx:this.polygonSegments[b].triangleSegIdx})}}const t=new bt;e.sort((h,p)=>h.triangleSegmentIdx===p.triangleSegmentIdx?h.subtile-p.subtile:h.triangleSegmentIdx-p.triangleSegmentIdx);let n=0,s=0,l=0;for(const h of e){if(h.triangleSegmentIdx!==n)break;l++}const c=e.length;for(;s!==e.length;){n=e[s].triangleSegmentIdx;let h=0,p=s,_=s;for(let y=p;y<l&&e[y].subtile===h;y++)_++;for(;p!==l;){const y=e[p];h=y.subtile;const v=this.centroidData.get(y.centroidIdx).min.clone(),b=this.centroidData.get(y.centroidIdx).max.clone(),T={vertexOffset:this.segments.segments[n].vertexOffset,primitiveOffset:t.length,vertexLength:this.segments.segments[n].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let S=p;S<_;S++){const A=e[S],C=this.polygonSegments[A.polygonSegmentIdx],D=this.centroidData.get(A.centroidIdx).min,F=this.centroidData.get(A.centroidIdx).max,O=this.indexArray.uint16;for(let z=C.triangleArrayOffset;z<C.triangleArrayOffset+C.triangleCount;z++)t.emplaceBack(O[3*z],O[3*z+1],O[3*z+2]);T.primitiveLength+=C.triangleCount,v.x=Math.min(v.x,D.x),v.y=Math.min(v.y,D.y),b.x=Math.max(b.x,F.x),b.y=Math.max(b.y,F.y)}T.primitiveLength>0&&this.triangleSubSegments.push({segment:T,min:v,max:b}),p=_;for(let S=p;S<l&&e[S].subtile===e[p].subtile;S++)_++}s=l;for(let y=s;y<c&&e[y].triangleSegmentIdx===e[s].triangleSegmentIdx;y++)l++}t._trim(),this.indexArray=t}getVisibleSegments(e,t,n){const s=new fi;if(this.wallMode){for(const A of this.triangleSubSegments)s.segments.push(A.segment);return s}let l=0,c=0;const h=1<<e.canonical.z;if(t){const A=t.getMinMaxForTile(e);A&&(l=A.min,c=A.max)}c+=this.maxHeight;const p=e.toUnwrapped();let _;const y=[p.canonical.x/h+p.wrap,p.canonical.y/h],v=[(p.canonical.x+1)/h+p.wrap,(p.canonical.y+1)/h],b=(A,C,D)=>[lt(A[0],C[0],D[0]),lt(A[1],C[1],D[1])],T=[],S=[];for(const A of this.triangleSubSegments){T[0]=A.min.x/We,T[1]=A.min.y/We,S[0]=A.max.x/We,S[1]=A.max.y/We;const C=b(y,v,T),D=b(y,v,S);if(new zi([C[0],C[1],l],[D[0],D[1],c]).intersectsPrecise(n)===0){_&&(s.segments.push(_),_=void 0);continue}const F=A.segment;_&&_.vertexOffset!==F.vertexOffset&&(s.segments.push(_),_=void 0),_?(_.vertexLength+=F.vertexLength,_.primitiveLength+=F.primitiveLength):_={vertexOffset:F.vertexOffset,primitiveLength:F.primitiveLength,vertexLength:F.vertexLength,primitiveOffset:F.primitiveOffset,sortKey:void 0,vaos:{}}}return _&&s.segments.push(_),s}encodeCentroid(e,t){const n=e.centroid(),s=t.span(),l=Math.min(7,Math.round(s.x*this.tileToMeter/10)),c=Math.min(6,Math.round(s.y*this.tileToMeter/10));return new Le(yt(n.x,1,8191)<<3|l,yt(n.y,1,8191)<<3|c)}encodeBorderCentroid(e){if(!e.borders)return new Le(0,0);const t=e.borders,n=Number.MAX_VALUE;if(t[0][0]!==n||t[1][0]!==n){const s=t[0][0]!==n?0:1;return new Le(6|(t[0][0]!==n?0:65528),(t[s][0]+t[s][1])/2<<3|6)}{const s=t[2][0]!==n?2:3;return new Le((t[s][0]+t[s][1])/2<<3|6,6|(t[2][0]!==n?0:65528))}}showCentroid(e){const t=this.centroidData.get(e.centroidDataIndex);if(t.flags&=Bl,t.groupCentroidPos.x!==0||t.groupCentroidPos.y!==0){const n=t.span(),s=Math.min(7,Math.round(n.x*this.tileToMeter/10)),l=Math.min(6,Math.round(n.y*this.tileToMeter/10));t.centroidXY=new Le(yt(t.groupCentroidPos.x,1,8191)<<3|s,yt(t.groupCentroidPos.y,1,8191)<<3|l)}else t.centroidXY=new Le(0,0);this.writeCentroidToBuffer(t)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,s=-1073741824&e.flags?Lm:e.centroidXY,l=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==s.y||l!==s.x){for(let c=t;c<n;++c)this.centroidVertexArray.emplace(c,s.x,s.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,t,n){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const s=t.getReplacementRegionsForTile(e.toUnwrapped());if(nm(this.activeReplacements,s))return;if(this.activeReplacements=s,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const c of this.centroidData)c.flags&=1073741823;const l=[];for(const c of this.activeReplacements){if(c.order<n)continue;const h=Math.max(1,Math.pow(2,c.footprintTileId.canonical.z-e.canonical.z));if(c.footprint.buildingIds)for(const p of this.centroidData)p.flags&Bl||p.flags&zm||c.min.x>p.max.x||p.min.x>c.max.x||c.min.y>p.max.y||p.min.y>c.max.y||c.footprint.buildingIds.has(p.buildingId)&&(p.flags|=c.clipMask!==Dm.None?-1073741824:Bl);else for(const p of this.centroidData)if(!(p.flags&Bl||p.flags&zm||c.min.x>p.max.x||p.min.x>c.max.x||c.min.y>p.max.y||p.min.y>c.max.y))for(let _=0;_<p.footprintSegLen;_++){const y=this.footprintSegments.get(p.footprintSegIdx+_);if(l.length=0,mE(this.footprintVertices,y.vertexOffset,y.vertexCount,c.footprintTileId.canonical,e.canonical,l),pg(c.footprint,l,this.footprintIndices.uint16,y.indexOffset,y.indexCount,-y.vertexOffset,-h)){p.flags|=c.clipMask!==Dm.None?-1073741824:Bl;break}}}for(const c of this.centroidData)this.writeCentroidToBuffer(c);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,t,n){let s=!1;for(let l=0;l<n.footprintSegLen;l++){const c=this.footprintSegments.get(n.footprintSegIdx+l);let h=0;for(const p of c.ringIndices){for(let _=h,y=p+h-1;_<p+h;y=_++){const v=this.footprintVertices.int16[2*(_+c.vertexOffset)+0],b=this.footprintVertices.int16[2*(_+c.vertexOffset)+1],T=this.footprintVertices.int16[2*(y+c.vertexOffset)+1];b>t!=T>t&&e<(this.footprintVertices.int16[2*(y+c.vertexOffset)+0]-v)*(t-b)/(T-b)+v&&(s=!s)}h=p}}return s}getHeightAtTileCoord(e,t){let n=Number.NEGATIVE_INFINITY,s=!0;const l=4*(e+We)*We+(t+We);if(Object.hasOwn(this.partLookup,l)){const p=this.partLookup[l];return p?{height:p.height,hidden:!!(p.flags&Bl)}:void 0}const c=this.centroidData.buffer,h=this.centroidData.length;for(let p=0;p<h;p++){const _=15*p;if(e>c[_+4]||c[_+2]>e||t>c[_+5]||c[_+3]>t)continue;const y=c[_+13];if(y<=n)continue;const v=this.centroidData.get(p);this.footprintContainsPoint(e,t,v)&&(n=y,this.partLookup[l]=v,s=!!(v.flags&Bl))}if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:s};this.partLookup[l]=void 0}}function dE(i,e,t){return i.equals(e)?t:e.sub(i)._unit()}function Vm(i,e,t){return i.equals(e)?t:e.sub(i)._perp()._unit()}function jv(i,e){const t=i.add(e),n=t.mag();return n===0?i:t.div(n)}function Xg(i,e){const t=jv(i,e);return i.x*t.x+i.y*t.y}function fE(i,e,t,n){let s,l;return i.equals(e)?(l=Vm(e,t,new Le(0,0)),s=l):(s=e.sub(i)._perp()._unit(),l=Vm(e,t,s)),Gv(i,e,t,Xg(s,l),n)}function Gv(i,e,t,n,s){const l=Math.sqrt(1-n*n);return Math.min(i.dist(e)/3,e.dist(t)/3,s*l/n)}function Yg(i,e,t){return i.x<t[0].x&&e.x<t[0].x||i.x>t[1].x&&e.x>t[1].x||i.y<t[0].y&&e.y<t[0].y||i.y>t[1].y&&e.y>t[1].y}function Hv(i,e){return i.x<e[0].x||i.x>e[1].x||i.y<e[0].y||i.y>e[1].y}function pE(i){return i.every(e=>e.x<=0)||i.every(e=>e.x>=We)||i.every(e=>e.y<=0)||i.every(e=>e.y>=We)}function Zv(i,e,t){if(i.x<0||i.x>=We||e.x<0||e.x>=We||t.x<0||t.x>=We)return!1;const n=t.sub(e),s=n.perp(),l=i.sub(e);return(n.x*l.x+n.y*l.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(l.x*l.x+l.y*l.y))>-.866&&s.x*l.x+s.y*l.y<0}function $v(i,e,t){const n=e?2|i:-3&i;return t?1|n:-2&n}function qv(){const i=Math.PI/32,e=Math.tan(i),t=Il;return t*Math.sqrt(1+2*e*e)-t}function Wv(i,e,t){const n=1<<t.z,s=qn(t.x/n),l=qn((t.x+1)/n),c=wr(t.y/n),h=wr((t.y+1)/n);return function(p,_,y,v,b=0,T){const S=[];if(!p.length||!y||!v)return S;const A=(j,te)=>{for(const G of j)S.push({polygon:G,bounds:te})},C=Math.ceil(Math.log2(y)),D=Math.ceil(Math.log2(v)),F=C-D,O=[];for(let j=0;j<Math.abs(F);j++)O.push(F>0?0:1);for(let j=0;j<Math.min(C,D);j++)O.push(0),O.push(1);let z=p;if(z=Pm(z,_[0].y-b,_[1].y+b,1),z=Pm(z,_[0].x-b,_[1].x+b,0),!z.length)return S;const N=[];
vendor: 4,617 bytes, line 7
7for(O.length?N.push({polygons:z,bounds:_,depth:0}):A(z,_);N.length;){const j=N.pop(),te=j.depth,G=O[te],W=j.bounds[0],K=j.bounds[1],ee=G===0?W.x:W.y,le=G===0?K.x:K.y,de=T?T(G,ee,le):.5*(ee+le),ve=Pm(j.polygons,ee-b,de+b,G),xe=Pm(j.polygons,de-b,le+b,G);if(ve.length){const we=[W,new Le(G===0?de:K.x,G===1?de:K.y)];O.length>te+1?N.push({polygons:ve,bounds:we,depth:te+1}):A(ve,we)}if(xe.length){const we=[new Le(G===0?de:W.x,G===1?de:W.y),K];O.length>te+1?N.push({polygons:xe,bounds:we,depth:te+1}):A(xe,we)}}return S}(i,e,Math.ceil((l-s)/11.25),Math.ceil((c-h)/11.25),1,(p,_,y)=>{if(p===0)return .5*(_+y);{const v=wr((t.y+_/We)/n);return($n(.5*(wr((t.y+y/We)/n)+v))*n-t.y)*We}})}function mE(i,e,t,n,s,l){const c=Math.pow(2,n.z-s.z);for(let h=0;h<t;h++){let p=i.int16[2*(h+e)+0],_=i.int16[2*(h+e)+1];p=(p+s.x*We)*c-n.x*We,_=(_+s.y*We)*c-n.y*We,l.push(new Le(p,_))}}tt(Nm,"FillExtrusionBucket",{omit:["layers","features"]}),tt(Bm,"PartData"),tt(km,"PartDataArray"),tt(Om,"FootprintSegmentArray"),tt(qg,"BorderCentroidData"),tt(Wg,"GroundEffect");const Kg=4096;class _E{constructor(e){this.module=e,this.memoryStack=this.module.malloc(Kg),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Kg?-1:(new Int32Array(this.module.heap32.buffer,t,e.length).set(e),t)}createFloatArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Kg?-1:(new Float32Array(this.module.heapF32.buffer,t,e.length).set(e),t)}readStringBuffer(e){let t="";for(;this.module.heapU8[e]!==0;)t+=String.fromCharCode(this.module.heapU8[e]),++e;return t}setStyle(e){const t=e.normalScale;this.module.setStyle(t[0],t[1],t[2],e.tileToMeters)}setAOOptions(e,t){this.module.setAOOptions(e?1:0,t)}setMetricOptions(e,t){this.module.setMetricOptions(e?1:0,t)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,t){this.module.setFacadeOptions(e,t?1:0)}setFauxFacadeOptions(e,t,n){this.module.setFauxFacadeOptions(e?1:0,t?1:0,n)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,t){this.memoryStackNextFree=this.memoryStack;for(const h of e){const p=this.createIntArray(h.ringIndices),_=this.createFloatArray(h.coordinates);if(p===-1||_===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(h.id,h.sourceId,h.minHeight,h.height,h.roofType,_,p,h.ringIndices.length-1)}for(const h of t){let p;p=h.entrances?JSON.parse(h.entrances):[];const _=this.createFloatArray(p),y=this.createFloatArray(h.coordinates);if(_===-1||y===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(h.sourceId,h.crossPerc,h.distanceToRoad,_,p.length,y,h.coordinates.length)}if(!this.module.generateMesh()){const h=this.module.getLastError();return this.readStringBuffer(h)}const n=this.module.getMeshCount(),s=new Array(n);for(let h=0;h<n;h++){const p=this.module.getPositionsPtr(h),_=this.module.getPositionsLength(h),y=new Float32Array(this.module.heapF32.buffer,p,_),v=this.module.getNormalsPtr(h),b=this.module.getNormalsLength(h),T=new Float32Array(this.module.heapF32.buffer,v,b),S=this.module.getAOPtr(h),A=this.module.getAOLength(h),C=new Float32Array(this.module.heapF32.buffer,S,A),D=this.module.getUVPtr(h),F=this.module.getUVLength(h),O=new Float32Array(this.module.heapF32.buffer,D,F),z=this.module.getFauxFacadePtr(h),N=this.module.getFauxFacadeLength(h),j=new Uint8Array(this.module.heapU8.buffer,z,N),te=this.module.getIndicesPtr(h),G=this.module.getIndicesLength(h),W=new Int16Array(this.module.heap16.buffer,te,G),K=this.module.getBuildingPart(h);s[h]={positions:y,normals:T,ao:C,uv:O,isFauxFacade:j,indices:W,buildingPart:K}}const l=this.module.getRingCount(),c=[];for(let h=0;h<l;h++){const p=this.module.getRingPtr(h),_=this.module.getRingLength(h),y=new Float32Array(this.module.heapF32.buffer,p,_);c.push(y)}return{meshes:s,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:c}}}const Xv=Ic.types,Um=32767;function gE(i,e){const t=We+e;for(const n of i)for(const s of n)if(s.x<-e||s.x>t||s.y<-e||s.y>t)return!1;return!0}function yE(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 new Error(`Unknown roof shape: ${i}`)}}let Yv,Kv,$h=null,Jv=null,vs=null;
vendor: 25,886 bytes, line 7
7class Jg{constructor(){this.layoutVertexArray=new $e,this.layoutAttenuationArray=new Ge,this.layoutColorArray=new dt,this.indexArray=new bt,this.indexArrayForConflation=new bt,this.segmentsBucket=new fi}}class Qg{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new fi,this.entranceBloom=new Jg;const t=66560;this.layoutVertexArray=new $e,this.layoutVertexArray.reserve(t),this.layoutNormalArray=new be,this.layoutNormalArray.reserve(t),this.layoutCentroidArray=new be,this.layoutCentroidArray.reserve(t),this.layoutColorArray=new dt,this.layoutColorArray.reserve(t),this.layoutFloodLightDataArray=new lr,this.layoutFloodLightDataArray.reserve(t),this.layoutAOArray=new cr,this.layoutAOArray.reserve(t),this.indexArray=new bt,this.indexArray.reserve(66560),this.indexArrayForConflation=new bt,this.segmentsBucket=new fi,this.entranceBloom=new Jg,e&&(this.layoutFacadePaintArray=new dt,this.layoutFacadeDataArray=new et,this.layoutFacadeVerticalRangeArray=new dt)}reserve(e,t,n){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(t),n&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class Qv{constructor(e){this.requiresHDRuntime=!0,this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Ui,this.footprintsIndices=new Mi,this.footprintsMin=new Le(1/0,1/0),this.footprintsMax=new Le(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Qg(!1),this.buildingWithFacade=new Qg(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new sa(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.projection=e.projection,this.groundEffect=new Wg(e),this.groundEffect.groundRadiusArray=new Ae,this.hasAppearances=null}updateFootprints(e,t){const n=new Im([],[],1),s={vertices:[],indices:new Uint32Array(0),grid:n,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};t.push({footprint:s,id:e})}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){if(!vs)return;const l=w(n);this.tileToMeter=l,this.brightness=t.brightness,vs.setStyle({normalScale:[1,-1,l],tileToMeters:l}),vs.setAOOptions(!1,.3),vs.setMetricOptions(!1,16),vs.setStructuralOptions(!0),vs.setFacadeClassifierOptions(3);const c=new Map,h=new Map;let p=0;for(const{feature:C}of e){if(Xv[C.type]!=="LineString"){c.set(C.id,C.properties.source_id);continue}const D=this.layers[0]._featureFilter.needGeometry;if(D&&!this.layers[0]._featureFilter.filter(new Oi(this.zoom),C,n))continue;const F=X(C,D);if(!D&&!this.layers[0]._featureFilter.filter(new Oi(this.zoom),F,n))continue;const O=D?F.geometry:q(C,n,s),z=[];for(const G of O)for(const W of G)z.push(W.x),z.push(W.y);const N={coordinates:z,crossPerc:C.properties.cross_perc,distanceToRoad:C.properties.distance_to_road,entrances:C.properties.entrances,sourceId:0},j=C.properties.source_id;let te=h.get(j);te||(te=[],h.set(j,te)),te.push(N),++p}this.maxHeight=0;const _=new Array,y=new Set,v=C=>{C!=null&&y.add(C)},b=(C,D)=>{C!=null&&_.push({buildingId:C,footprintIndex:D})},T=64*(e.length-p),S=T/2;this.buildingWithFacade.reserve(T,S,!0),this.buildingWithoutFacade.reserve(2*T,2*S,!1),this.footprintsIndices.reserve(16*(e.length-p)),this.footprintsVertices.reserve(8*(e.length-p));for(const{feature:C,id:D,index:F,sourceLayerIndex:O}of e){if(Xv[C.type]==="LineString")continue;const z=this.layers[0]._featureFilter.needGeometry;if(z&&!this.layers[0]._featureFilter.filter(new Oi(this.zoom),C,n))continue;let N=null;if(C.properties&&Object.hasOwn(C.properties,"building_id")&&(N=Number(C.properties.building_id),y.has(N)))continue;const j=X(C,z);if(!z&&!this.layers[0]._featureFilter.filter(new Oi(this.zoom),j,n))continue;const te=z?j.geometry:q(C,n,s),G=Si(te,500);let W=!1;for(const Rt of G)if(Rt.length!==1){W=!0;break}if(W){v(N);continue}if(!gE(te,163)){v(N);continue}const K=this.layers[0],ee=yE(K.layout.get("building-roof-shape").evaluate(C,{},n)),le=K.layout.get("building-base").evaluate(C,{},n),de=K.layout.get("building-height").evaluate(C,{},n),ve=K.layout.get("building-flood-light-ground-radius").evaluate(C,{},n),xe=K.paint.get("building-ambient-occlusion-intensity"),we=ve/this.tileToMeter;C.properties["building-part"]="roof";const Fe=K.paint.get("building-color").evaluate(C,{},this.canonical).toPremultipliedRenderColor(this.lut),se=K.paint.get("building-emissive-strength").evaluate(C,{},this.canonical);C.properties["building-part"]="wall";const pe=K.paint.get("building-color").evaluate(C,{},this.canonical).toPremultipliedRenderColor(this.lut),ge=K.paint.get("building-emissive-strength").evaluate(C,{},this.canonical);C.properties["building-part"]="window";const Se=K.paint.get("building-color").evaluate(C,{},this.canonical).toPremultipliedRenderColor(this.lut),Me=K.paint.get("building-emissive-strength").evaluate(C,{},this.canonical);C.properties["building-part"]="door";const Pe=K.paint.get("building-color").evaluate(C,{},this.canonical).toPremultipliedRenderColor(this.lut),Ie=K.paint.get("building-emissive-strength").evaluate(C,{},this.canonical);let Oe=K.layout.get("building-flood-light-wall-radius").evaluate(C,{},n);Oe=yt(Oe,0,2048);const Be=Oe/2048*Um,Ke=c.get(D),Ne=h.get(Ke)||[],He=Ne.length!==0&&K.layout.get("building-facade").evaluate(C,{},n);vs.setFacadeOptions(4,!0),vs.setFauxFacadeOptions(He,!1,1);let ft=0,pt=0,xt=0,ht=0,wt=0,vt=0,ri=0,Gt=0,ei=0,ui=0,Pr=0;if(He){let Rt=Math.round(K.layout.get("building-facade-floors").evaluate(C,{},n));if(le===0){Rt=Math.max(1,Rt-(Ne.length>0?1:0));let Hi=4;if(de>100){const pr=[10,13,15];Hi=pr[C.id?C.id%pr.length:0]}else de<=10&&(Hi=3);vs.setFacadeOptions(Hi,!0),wt=(de<15?1.3:1.61803)*Hi/l}else wt=le/l;vt=de/l,wt=Math.min(wt,vt),xt=K.layout.get("building-facade-unit-width").evaluate(C,{},n)/l,ht=(vt-wt)/Rt,vs.setFauxFacadeOptions(!0,!0,xt);const Wr=K.layout.get("building-facade-window").evaluate(C,{},n);ft=Wr[0],pt=Wr[1],ri=Math.floor(65535*Math.min(1,wt/We)),Gt=Math.floor(65535*Math.min(1,vt/We)),ei=Math.floor(255*ft)<<8|Math.floor(255*pt),ui=Math.floor(65535*Math.min(1,xt/We)),Pr=Math.floor(65535*Math.min(1,ht/We))}const Bo=Array(G.length),fr={x:1/0,y:1/0},Xt={x:-1/0,y:-1/0},ji={x:0,y:0};let yr=0;for(let Rt=0;Rt<G.length;Rt++){const Wr=G[Rt];if(Wr.length>0){const Hi=[],pr=Array(Wr.length+1);pr[0]=0;for(let Ts=0;Ts<Wr.length;Ts++){const an=Wr[Ts];for(let ts=0;ts<an.length;ts++){const Es=an[an.length-ts-1];fr.x=Math.min(fr.x,Es.x),fr.y=Math.min(fr.y,Es.y),Xt.x=Math.max(Xt.x,Es.x),Xt.y=Math.max(Xt.y,Es.y),ji.x+=Es.x,ji.y+=Es.y,yr++,Hi.push(Es.x),Hi.push(Es.y)}pr[Ts+1]=Hi.length}Bo[Rt]={id:C.id?C.id:0,height:de,minHeight:le,sourceId:0,roofType:ee,coordinates:Hi,ringIndices:pr}}}ji.x/=yr||1,ji.y/=yr||1;const Dr=vs.generateMesh(Bo,Ne);if(typeof Dr=="string"){gi(`Unable to generate building ${C.id}: ${Dr}`),v(N);continue}if(Dr.meshes.length===0||Dr.modifiedPolygonRings.length===0){v(N);continue}const It=He?this.buildingWithFacade:this.buildingWithoutFacade;let Jr=0;for(const Rt of Dr.meshes)Jr+=Rt.positions.length/3;const Qr=It.segmentsBucket.prepareSegment(Jr,It.layoutVertexArray,It.indexArray),Bn=[];let kn=null,yo=0,xo=-1;const gn=It.layoutVertexArray.length,on=gn+Jr;It.layoutVertexArray.resize(on),It.layoutCentroidArray.resize(on),It.layoutNormalArray.resize(on),It.layoutAOArray.resize(on),It.layoutColorArray.resize(on),It.layoutFloodLightDataArray.resize(on),He&&(It.layoutFacadePaintArray.resize(on),It.layoutFacadeDataArray.resize(on),It.layoutFacadeVerticalRangeArray.resize(on));const yn=It.indexArray.length;let vo=0,Gi=gn;for(const Rt of Dr.meshes){let Wr,Hi;if(Rt.buildingPart===1)Wr=Fe,Hi=se;else if(Rt.buildingPart===0)Wr=pe,Hi=ge;else if(Rt.buildingPart===2)Wr=Se,Hi=Me;else{if(Rt.buildingPart!==3)continue;Wr=Pe,Hi=Ie}if(Hi=yt(Hi,0,1),Rt.buildingPart===3){const en=new Array;for(let ko=0;ko<Rt.positions.length;ko+=12){const ed=Rt.positions[ko+0],Nu=Rt.positions[ko+1],u_=Rt.positions[ko+3],Ib=Rt.positions[ko+4],Ab=Rt.positions[ko+2],LS=Rt.positions[ko+8]-Ab,zS=1,Fy=u_-ed,Oy=Ib-Nu,By=Math.hypot(Fy,Oy);en.push({pos:[ed+.5*Fy,Nu+.5*Oy,Ab],normal:[Oy/By,-Fy/By,0],width:By,height:LS,depth:zS,points:[ed,Nu,u_,Ib]})}const Vn=It.entranceBloom.segmentsBucket.prepareSegment(10*en.length,It.entranceBloom.layoutVertexArray,It.entranceBloom.indexArray),ln=It.entranceBloom.layoutVertexArray.length;yo=It.entranceBloom.indexArray.length,Ov(en,.5/this.tileToMeter,It.entranceBloom.indexArray,It.entranceBloom.layoutVertexArray,It.entranceBloom.layoutAttenuationArray);const Za=It.entranceBloom.layoutVertexArray.length-ln;xo=It.entranceBloom.indexArray.length-yo;for(let ko=0;ko<Za;ko++)It.entranceBloom.layoutColorArray.emplaceBack(255*Pe.r<<8|255*Pe.g,255*Pe.b<<8|51*Ie);Vn.vertexLength+=Za,Vn.primitiveLength+=xo,kn={part:Rt.buildingPart,vertexOffset:ln,vertexLength:Za}}It.layoutVertexArray.float32.set(Rt.positions,3*Gi);const pr=Rt.positions.length/3;for(let en=0;en<pr;++en){const Vn=3*en;vo=Math.max(vo,Rt.positions[Vn+2]);const ln=Rt.normals[Vn+1]*Um,Za=Rt.normals[Vn+2]*Um,ko=3*(Gi+en);It.layoutNormalArray.int16[ko]=Rt.normals[Vn]*Um,It.layoutNormalArray.int16[ko+1]=ln,It.layoutNormalArray.int16[ko+2]=Za;const ed=Rt.ao[en];It.layoutAOArray.uint8[Gi+en]=255*ed;const Nu=1+(ed-1)*xe,u_=255*Wr.b*Nu<<8|255*Hi;It.layoutColorArray.uint16[2*(Gi+en)]=255*Wr.r*Nu<<8|255*Wr.g*Nu,It.layoutColorArray.uint16[2*(Gi+en)+1]=u_}const Ts=Math.min(8191,Math.max(0,Math.floor(ji.x))),an=Math.min(8191,Math.max(0,Math.floor(ji.y))),ts=Math.floor(de),Es=20,Ly=4*Ts+Math.min(3,Math.round((Xt.x-fr.x)*this.tileToMeter/Es)),DS=4*an+Math.min(3,Math.round((Xt.y-fr.y)*this.tileToMeter/Es));for(let en=0;en<pr;++en){const Vn=3*(Gi+en);It.layoutCentroidArray.int16[Vn]=Ly,It.layoutCentroidArray.int16[Vn+1]=DS,It.layoutCentroidArray.int16[Vn+2]=ts}if(It.layoutFloodLightDataArray.int16.fill(Rt.buildingPart===0?Be:0,Gi,Gi+pr),He){const en=255*Se.r<<8|255*Se.g,Vn=255*Se.b<<8|255*Me;for(let ln=0;ln<pr;++ln){const Za=2*(Gi+ln);It.layoutFacadePaintArray.uint16[Za]=en,It.layoutFacadePaintArray.uint16[Za+1]=Vn}for(let ln=0;ln<pr;++ln)if(Rt.isFauxFacade[ln]){const Za=Math.min(65535,Math.floor(Rt.uv[2*ln]*Dr.outerRingLength));It.layoutFacadeDataArray.emplace(Gi+ln,1|Za,ei,ui,Pr),It.layoutFacadeVerticalRangeArray.emplace(Gi+ln,ri,Gt)}else It.layoutFacadeDataArray.emplace(Gi+ln,0,0,0,0),It.layoutFacadeVerticalRangeArray.emplace(Gi+ln,0,0)}const zy=Qr.vertexLength,Eb=Rt.indices.length/3,Sb=It.indexArray.length;It.indexArray.resize(Sb+Eb);for(let en=0;en<Eb;++en){const Vn=3*en,ln=3*Sb+Vn;It.indexArray.uint16[ln]=zy+Rt.indices[Vn],It.indexArray.uint16[ln+1]=zy+Rt.indices[Vn+1],It.indexArray.uint16[ln+2]=zy+Rt.indices[Vn+2]}Rt.buildingPart!==1&&Rt.buildingPart!==0&&Rt.buildingPart!==2&&Rt.buildingPart!==3||Bn.push({part:Rt.buildingPart,vertexOffset:Gi,vertexLength:Rt.positions.length/3}),Gi+=pr,Qr.vertexLength+=pr,Qr.primitiveLength+=Rt.indices.length/3}this.maxHeight=Math.max(this.maxHeight,vo);const bo=It.indexArray.length-yn,wo=this.footprintsIndices.length,sn=this.footprintsVertices.length,Ha=[],es=new Le(1/0,1/0),Nn=new Le(-1/0,-1/0),Nl=this.groundEffect.vertexArray.length;for(const Rt of Dr.modifiedPolygonRings){const Wr=[],Hi=new Le(1/0,1/0),pr=new Le(-1/0,-1/0);for(let Ts=0;Ts<Rt.length;Ts+=2){const an=Rt.length-Ts-2;Hi.x=Math.min(Hi.x,Rt[an]),Hi.y=Math.min(Hi.y,Rt[an+1]),pr.x=Math.max(pr.x,Rt[an]),pr.y=Math.max(pr.y,Rt[an+1]);const ts=new Le(Rt[an],Rt[an+1]);Wr.push(ts),Ha.push(ts.x,ts.y),this.footprintsVertices.emplaceBack(ts.x,ts.y)}es.x=Math.min(es.x,Hi.x),es.y=Math.min(es.y,Hi.y),Nn.x=Math.max(Nn.x,pr.x),Nn.y=Math.max(Nn.y,pr.y),this.groundEffect.addData(Wr,[Hi,pr],we)}const ua=this.groundEffect.vertexArray.length-Nl;this.groundEffect.groundRadiusArray.reserveForAdditional(ua);for(let Rt=0;Rt<ua;Rt++)this.groundEffect.groundRadiusArray.emplaceBack(ve);(fr.x<0||Xt.x>We||fr.y<0||Xt.y>We)&&this.featuresOnBorder.push({featureId:C.id,footprintIndex:this.footprints.length});{const Rt=vc(Ha,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Rt.length),this.footprintsIndices.uint16.set(Rt,wo),this.buildingIds.add(N??C.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,es.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,es.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Nn.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Nn.y);const Wr={footprintVertexOffset:sn,footprintVertexLength:this.footprintsVertices.length-sn,footprintIndexOffset:wo,footprintIndexLength:this.footprintsIndices.length-wo,min:es,max:Nn,hiddenFlags:0,indicesOffset:yn,indicesLength:bo,bloomIndicesOffset:yo,bloomIndicesLength:xo,groundEffectVertexOffset:Nl,groundEffectVertexLength:ua,hasFauxFacade:He,height:vo,promoteId:D,feature:j,parts:Bn,buildingBloom:kn},Hi=this.footprints.length;C.id!==void 0&&this.featureFootprintLookup.set(C.id,Hi),b(N,Hi),this.footprints.push(Wr)}this.programConfigurations.populatePaintArrays(It.layoutVertexArray.length,C,F,{},t.availableImages,n,t.brightness),this.groundEffect.addPaintPropertiesData(C,F,{},t.availableImages,n,t.brightness),t.featureIndex.insert(C,te,F,O,this.index,gn)}_.forEach(({buildingId:C,footprintIndex:D})=>{y.has(C)&&(this.footprints[D].hiddenFlags|=4)});const A=new Set;this.buildingIds.forEach((C,D,F)=>{y.has(C)||A.add(C)}),this.buildingIds=A,this.groundEffect.prepareBorderSegments()}update(e,t,n,s,l,c,h){this.programConfigurations.updatePaintArrays(e,t,l,n,s,c,h),this.groundEffect.update(e,t,l,n,s,c,h),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const t=n=>{n.layoutVertexBuffer=e.createVertexBuffer(n.layoutVertexArray,Bv.members),n.layoutNormalBuffer=e.createVertexBuffer(n.layoutNormalArray,ZT.members),n.layoutCentroidBuffer=e.createVertexBuffer(n.layoutCentroidArray,$T.members),n.layoutFloodLightDataBuffer=e.createVertexBuffer(n.layoutFloodLightDataArray,KT.members),n.layoutFacadeDataArray&&n.layoutFacadeDataArray.length&&(n.layoutFacadeDataBuffer=e.createVertexBuffer(n.layoutFacadeDataArray,WT.members)),n.layoutFacadeVerticalRangeArray&&n.layoutFacadeVerticalRangeArray.length&&(n.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(n.layoutFacadeVerticalRangeArray,XT.members)),n.entranceBloom.layoutVertexArray.length&&(n.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(n.entranceBloom.layoutVertexArray,Bv.members),n.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(n.entranceBloom.layoutAttenuationArray,YT.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=t=>{t.layoutVertexBuffer&&(t.layoutVertexBuffer.destroy(),t.layoutNormalBuffer.destroy(),t.layoutColorBuffer.destroy(),t.segmentsBucket.destroy(),t.indexBuffer&&t.indexBuffer.destroy(),t.entranceBloom.layoutVertexBuffer&&(t.entranceBloom.layoutVertexBuffer.destroy(),t.entranceBloom.layoutColorBuffer.destroy(),t.entranceBloom.layoutAttenuationBuffer.destroy(),t.entranceBloom.indexBuffer.destroy(),t.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,t,n=!0){let s=!1;const l=n?t:0,c=0|(n?-1:~t);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const h of e){const p=this.footprints[h],_=p.hiddenFlags&c|l;p.hiddenFlags!==_&&(p.hiddenFlags=_,s=!0,this.groundEffect.updateHiddenByLandmarkRange(p.groundEffectVertexOffset,p.groundEffectVertexLength,p.hiddenFlags!==0))}return s&&(this.indexArrayForConflationUploaded=!1),s}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const t=s=>{s.indexArray.length!==0&&(s.indexArrayForConflation.resize(s.indexArray.length),s.indexArrayForConflation.uint16.set(s.indexArray.uint16),s.entranceBloom.indexArrayForConflation.resize(s.entranceBloom.indexArray.length),s.entranceBloom.indexArrayForConflation.uint16.set(s.entranceBloom.indexArray.uint16))};t(this.buildingWithoutFacade),t(this.buildingWithFacade);for(const s of this.footprints){const l=s.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,c=s.indicesOffset+s.indicesLength;if(s.hiddenFlags!==0){for(let p=s.indicesOffset;p<c;p++)l.indexArrayForConflation.uint16[3*p+0]=0,l.indexArrayForConflation.uint16[3*p+1]=0,l.indexArrayForConflation.uint16[3*p+2]=0;const h=s.bloomIndicesOffset+s.bloomIndicesLength;for(let p=s.bloomIndicesOffset;p<h;p++)l.entranceBloom.indexArrayForConflation.uint16[3*p+0]=0,l.entranceBloom.indexArrayForConflation.uint16[3*p+1]=0,l.entranceBloom.indexArrayForConflation.uint16[3*p+2]=0}}const n=s=>{s.indexArray.length!==0&&(s.indexBuffer?s.indexBuffer.updateData(s.indexArrayForConflation):s.indexBuffer=e.createIndexBuffer(s.indexArrayForConflation,!0),s.entranceBloom.indexBuffer?s.entranceBloom.indexBuffer.updateData(s.entranceBloom.indexArrayForConflation):s.entranceBloom.indexBuffer=e.createIndexBuffer(s.entranceBloom.indexArrayForConflation,!0))};n(this.buildingWithoutFacade),n(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const t=n=>{n.layoutColorBuffer?n.layoutColorBuffer.updateData(n.layoutColorArray):n.layoutColorBuffer=e.createVertexBuffer(n.layoutColorArray,kv.members,!0),n.layoutFacadePaintArray&&(n.layoutFacadePaintBuffer?n.layoutFacadePaintBuffer.updateData(n.layoutFacadePaintArray):n.layoutFacadePaintBuffer=e.createVertexBuffer(n.layoutFacadePaintArray,qT.members,!0)),n.entranceBloom.layoutColorBuffer?n.entranceBloom.layoutColorBuffer.updateData(n.entranceBloom.layoutColorArray):n.entranceBloom.layoutColorBuffer=e.createVertexBuffer(n.entranceBloom.layoutColorArray,kv.members,!0)};t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,t){const n=e.paint.get("building-ambient-occlusion-intensity");for(const s of this.footprints){if(4&s.hiddenFlags)continue;const l=t[s.promoteId],c=s.feature;c.properties["building-part"]="roof";const h=e.paint.get("building-color").evaluate(c,l,this.canonical).toPremultipliedRenderColor(this.lut),p=e.paint.get("building-emissive-strength").evaluate(c,l,this.canonical);c.properties["building-part"]="wall";const _=e.paint.get("building-color").evaluate(c,l,this.canonical).toPremultipliedRenderColor(this.lut),y=e.paint.get("building-emissive-strength").evaluate(c,l,this.canonical);c.properties["building-part"]="window";const v=e.paint.get("building-color").evaluate(c,l,this.canonical).toPremultipliedRenderColor(this.lut),b=e.paint.get("building-emissive-strength").evaluate(c,l,this.canonical);c.properties["building-part"]="door";const T=e.paint.get("building-color").evaluate(c,l,this.canonical).toPremultipliedRenderColor(this.lut),S=e.paint.get("building-emissive-strength").evaluate(c,l,this.canonical),A=s.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const D of s.parts){let F,O=h;D.part===1?(O=h,F=p):D.part===0?(O=_,F=y):D.part===2?(O=v,F=b):D.part===3&&(O=T,F=S),F=yt(F,0,1);for(let z=0;z<D.vertexLength;z++){const N=D.vertexOffset+z,j=1+(A.layoutAOArray.uint8[N]/255-1)*n;A.layoutColorArray.emplace(N,O.r*j*255<<8|O.g*j*255,O.b*j*255<<8|255*F),s.hasFauxFacade&&A.layoutFacadePaintArray.emplace(N,255*v.r<<8|255*v.g,255*v.b<<8|255*b)}}const C=s.buildingBloom;if(C)for(let D=0;D<C.vertexLength;D++)A.entranceBloom.layoutColorArray.emplace(C.vertexOffset+D,255*T.r<<8|255*T.g,255*T.b<<8|51*S)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,t,n){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const s=t.getReplacementRegionsForTile(e.toUnwrapped());if(nm(this.activeReplacements,s))return;this.activeReplacements=s;for(const c of this.footprints)c.hiddenFlags&=-2;const l=[];for(const c of this.activeReplacements){if(c.order<n)continue;const h=Math.max(1,Math.pow(2,c.footprintTileId.canonical.z-e.canonical.z));for(const p of this.footprints)p.min.x>c.max.x||p.max.x<c.min.x||p.min.y>c.max.y||p.max.y<c.min.y||(l.length=0,vE(this.footprintsVertices,p.footprintVertexOffset,p.footprintVertexLength,c.footprintTileId.canonical,e.canonical,l),pg(c.footprint,l,this.footprintsIndices.uint16,p.footprintIndexOffset,p.footprintIndexLength,0,-h)&&(p.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const c of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(c.groundEffectVertexOffset,c.groundEffectVertexLength,c.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(e.id!==void 0){const t=this.featureFootprintLookup.get(e.id);return this.footprints[t]}return null}getHeightAtTileCoord(e,t){let n=Number.NEGATIVE_INFINITY,s=!0;const l=4*(e+We)*We+(t+We);if(Object.hasOwn(this.footprintLookup,l)){const h=this.footprintLookup[l];return h?{height:h.height,hidden:h.hiddenFlags!==0}:void 0}const c=new Le(e,t);for(const h of this.footprints)e>h.max.x||h.min.x>e||t>h.max.y||h.min.y>t||h.height<=n||xE(c,this.footprintsVertices.float32.subarray(2*h.footprintVertexOffset,2*(h.footprintVertexOffset+h.footprintVertexLength)),this.footprintsIndices.uint16.subarray(h.footprintIndexOffset,h.footprintIndexOffset+h.footprintIndexLength))&&(n=h.height,this.footprintLookup[l]=h,s=h.hiddenFlags!==0);if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:s};this.footprintLookup[l]=void 0}}function xE(i,e,t){for(let n=0;n<t.length;n+=3){const s=t[n],l=t[n+1],c=t[n+2],h=e[2*s+0],p=e[2*s+1],_=e[2*l+0],y=e[2*l+1],v=e[2*c+0],b=e[2*c+1],T=(h-v)*(i.y-b)-(p-b)*(i.x-v),S=(_-h)*(i.y-p)-(y-p)*(i.x-h);if(T<0!=S<0&&T!==0&&S!==0)continue;const A=(v-_)*(i.y-y)-(b-y)*(i.x-_);if(A===0||A<0==T+S<=0)return!0}return!1}function vE(i,e,t,n,s,l){const c=Math.pow(2,n.z-s.z);for(let h=0;h<t;h++){let p=i.float32[2*(h+e)+0],_=i.float32[2*(h+e)+1];p=(p+s.x*We)*c-n.x*We,_=(_+s.y*We)*c-n.y*We,l.push(new Le(p,_))}}tt(Qv,"BuildingBucket",{omit:["layers"]}),tt(Qg,"BuildingGeometry"),tt(Jg,"BuildingBloomGeometry");class e0{constructor(e=0,t=[]){this.frcMask=e,this.rings=t}hasGeometry(){return this.rings.length>0&&this.rings[0].length>0}}async function jm(){}function qh(i,e,t){const n=e.paint.get(i).value;return n.kind==="constant"?n.value:t.programConfigurations.get(e.id).getMaxValue(i)}function Gm(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function t0(i,e,t,n,s){if(!e[0]&&!e[1])return i;const l=Le.convert(e)._mult(s);t==="viewport"&&l._rotate(-n);const c=[];for(let h=0;h<i.length;h++)c.push(i[h].sub(l));return c}function i0(i,e,t,n){const s=Le.convert(i)._mult(n);return e==="viewport"&&s._rotate(-t),s}tt(e0,"FrcCoveragePolygon");const bE=Jn(),r0=i=>{const e=[];return i.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),i.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function n0(i,e,t,n,s,l,c,h,p){if(l&&i.queryGeometry.isAboveHorizon)return!1;l&&(p*=i.pixelToTileUnitsFactor);const _=i.tileID.canonical,y=t.projection.upVectorScale(_,t.center.lat,t.worldSize).metersToTile;for(const v of e)for(const b of v){const T=b.add(h),S=s&&t.elevation?t.elevation.exaggeration()*s.getElevationAt(T.x,T.y,!0):0,A=t.projection.projectTilePoint(T.x,T.y,_);if(S>0){const O=t.projection.upVector(_,T.x,T.y);A.x+=O[0]*y*S,A.y+=O[1]*y*S,A.z+=O[2]*y*S}const C=l?T:wE(A.x,A.y,A.z,n),D=l?i.tilespaceRays.map(O=>EE(O,S)):i.queryGeometry.screenGeometry,F=ar([],[A.x,A.y,A.z,1],n);if(!c&&l?p*=F[3]/t.cameraToCenterDistance:c&&!l&&(p*=t.cameraToCenterDistance/F[3]),l){const O=wr((b.y/We+_.y)/(1<<_.z));p/=t.projection.pixelsPerMeter(O,1)/o(1,O)}if(Wb(D,C,p))return!0}return!1}function wE(i,e,t,n){const s=ar([],[i,e,t,1],n);return new Le(s[0]/s[3],s[1]/s[3])}const o0=Tr(0,0,0),TE=Tr(0,0,1);function EE(i,e){const t=Qt();return o0[2]=e,i.intersectsPlane(o0,TE,t),new Le(t[0],t[1])}class s0 extends Gp{}let a0,l0,c0,u0,h0,d0,f0,p0,m0,_0,g0,y0,x0,v0;function Cf(i){const e={},t=i.resolution||256,n=i.clips?i.clips.length:1,s=i.image||new An({width:t,height:n}),l=i.lut||null,c=(h,p,_)=>{e[i.evaluationKey]=_;const y=i.expression.evaluate(e),v=y?y.toNonPremultipliedRenderColor(l):null;v&&(s.data[h+p+0]=Math.floor(255*v.r),s.data[h+p+1]=Math.floor(255*v.g),s.data[h+p+2]=Math.floor(255*v.b),s.data[h+p+3]=Math.floor(255*v.a))};if(i.clips)for(let h=0,p=0;h<n;++h,p+=4*t)for(let _=0,y=0;_<t;_++,y+=4){const v=_/(t-1),{start:b,end:T}=i.clips[h];c(p,y,lt(b,T,v))}else for(let h=0,p=0;h<t;h++,p+=4)c(0,p,h/(t-1));return s}tt(s0,"Hea
7tmapBucket",{omit:["layers"]});class b0{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){for(const n of this.footprints)t.push({footprint:n,id:e})}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){const l=[];for(const{feature:c,id:h,index:p,sourceLayerIndex:_}of e){const y=this.layers[0]._featureFilter.needGeometry,v=X(c,y);if(!this.layers[0]._featureFilter.filter(new Oi(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),v,n))continue;const b={id:h,properties:c.properties,type:c.type,sourceLayerIndex:_,index:p,geometry:y?v.geometry:q(c,n,s),patterns:{}};l.push(b)}for(const c of l){const{geometry:h,index:p,sourceLayerIndex:_}=c;this.addFeature(c,h,p,n,{},t.availableImages,t.brightness),t.featureIndex.insert(e[p].feature,h,p,_,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,t,n,s,l,c,h){}destroy(){}addFeature(e,t,n,s,l,c=[],h){for(const p of Si(t,2)){const _=[],y=[],v=[],b=new Le(1/0,1/0),T=new Le(-1/0,-1/0);for(const C of p)if(C.length!==0){C!==p[0]&&v.push(y.length/2);for(let D=0;D<C.length;D++)y.push(C[D].x),y.push(C[D].y),_.push(C[D]),b.x=Math.min(b.x,C[D].x),b.y=Math.min(b.y,C[D].y),T.x=Math.max(T.x,C[D].x),T.y=Math.max(T.y,C[D].y)}const S=vc(y,v),A=new Im(_,S,8,256);this.footprints.push({vertices:_,indices:S,grid:A,min:b,max:T})}}}function Mf(i,e){return i.x*e.x+i.y*e.y}function w0(i,e){if(i.length===1){let t=0;const n=e[t++];let s;for(;!s||n.equals(s);)if(s=e[t++],!s)return 1/0;for(;t<e.length;t++){const l=e[t],c=i[0],h=s.sub(n),p=l.sub(n),_=c.sub(n),y=Mf(h,h),v=Mf(h,p),b=Mf(p,p),T=Mf(_,h),S=Mf(_,p),A=y*b-v*v,C=(b*T-v*S)/A,D=(y*S-v*T)/A,F=n.z*(1-C-D)+s.z*C+l.z*D;if(isFinite(F))return F}return 1/0}{let t=1/0;for(const n of e)t=Math.min(t,n.z);return t}}function T0(i,e,t){let n=1/0;Z_(t,e)&&(n=w0(t,e[0]));for(let s=0;s<e.length;s++){const l=e[s],c=i[s];for(let h=0;h<l.length-1;h++){const p=l[h],_=[p,l[h+1],c[h+1],c[h],p];H_(t,_)&&(n=Math.min(n,w0(t,_)))}}return n!==1/0&&n}function E0(i,e,t,n,s,l,c,h,p,_,y){return i.projection.name==="globe"?function(v,b,T,S,A,C,D,F,O,z,N){const j=[],te=[],G=v.projection.upVectorScale(N,v.center.lat,v.worldSize).metersToTile,W=[0,0,0,1],K=[0,0,0,1],ee=(de,ve,xe,we)=>{de[0]=ve,de[1]=xe,de[2]=we,de[3]=1},le=qv();T>0&&(T+=le),S+=le;for(const de of b){const ve=[],xe=[];for(const we of de){const Fe=we.x+A.x,se=we.y+A.y,pe=v.projection.projectTilePoint(Fe,se,N),ge=v.projection.upVector(N,we.x,we.y);let Se=T,Me=S;if(D){const Pe=S0(Fe,se,T,S,D,F,O,z);Se+=Pe.base,Me+=Pe.top}T!==0?ee(W,pe.x+ge[0]*G*Se,pe.y+ge[1]*G*Se,pe.z+ge[2]*G*Se):ee(W,pe.x,pe.y,pe.z),ee(K,pe.x+ge[0]*G*Me,pe.y+ge[1]*G*Me,pe.z+ge[2]*G*Me),hi(W,W,C),hi(K,K,C),ve.push(new Cu(W[0],W[1],W[2])),xe.push(new Cu(K[0],K[1],K[2]))}j.push(ve),te.push(xe)}return[j,te]}(i,e,t,n,s,l,c,h,p,_,y):c?function(v,b,T,S,A,C,D,F,O){const z=[],N=[],j=[0,0,0,1];for(const te of v){const G=[],W=[];for(const K of te){const ee=K.x+S.x,le=K.y+S.y,de=S0(ee,le,b,T,C,D,F,O);j[0]=ee,j[1]=le,j[2]=de.base,j[3]=1,ar(j,j,A),j[3]=Math.max(j[3],1e-5);const ve=new Cu(j[0]/j[3],j[1]/j[3],j[2]/j[3]);j[0]=ee,j[1]=le,j[2]=de.top,j[3]=1,ar(j,j,A),j[3]=Math.max(j[3],1e-5);const xe=new Cu(j[0]/j[3],j[1]/j[3],j[2]/j[3]);G.push(ve),W.push(xe)}z.push(G),N.push(W)}return[z,N]}(e,t,n,s,l,c,h,p,_):function(v,b,T,S,A){const C=[],D=[],F=A[8]*b,O=A[9]*b,z=A[10]*b,N=A[11]*b,j=A[8]*T,te=A[9]*T,G=A[10]*T,W=A[11]*T;for(const K of v){const ee=[],le=[];for(const de of K){const ve=de.x+S.x,xe=de.y+S.y,we=A[0]*ve+A[4]*xe+A[12],Fe=A[1]*ve+A[5]*xe+A[13],se=A[2]*ve+A[6]*xe+A[14],pe=A[3]*ve+A[7]*xe+A[15],ge=we+F,Se=Fe+O,Me=se+z,Pe=Math.max(pe+N,1e-5),Ie=we+j,Oe=Fe+te,Be=se+G,Ke=Math.max(pe+W,1e-5);ee.push(new Cu(ge/Pe,Se/Pe,Me/Pe)),le.push(new Cu(Ie/Ke,Oe/Ke,Be/Ke))}C.push(ee),D.push(le)}return[C,D]}(e,t,n,s,l)}function S0(i,e,t,n,s,l,c,h){const p=c*s.getElevationAt(i,e,!0,!0),_=l[0]!==0,y=_?l[1]===0?c*(l[0]/7-450):c*function(v,b,T){const S=Math.floor(b[0]/8),A=Math.floor(b[1]/8),C=10*(b[0]-8*S),D=10*(b[1]-8*A),F=v.getElevationAt(S,A,!0,!0),O=v.getMeterToDEM(T),z=Math.floor(.5*(C*O-1)),N=Math.floor(.5*(D*O-1)),j=v.tileCoordToPixel(S,A),te=2*z+1,G=2*N+1,W=function(xe,we,Fe,se,pe){return[xe.getElevationAtPixel(we,Fe,!0),xe.getElevationAtPixel(we+pe,Fe,!0),xe.getElevationAtPixel(we,Fe+pe,!0),xe.getElevationAtPixel(we+se,Fe+pe,!0)]}(v,j.x-z,j.y-N,te,G),K=Math.abs(W[0]-W[1]),ee=Math.abs(W[2]-W[3]),le=Math.abs(W[0]-W[2])+Math.abs(W[1]-W[3]),de=Math.min(.25,.5*O*(K+ee)/te),ve=Math.min(.25,.5*O*le/G);return F+Math.max(de*C,ve*D)}(s,l,h):p;return{base:p+(t===0?-1:t),top:_?Math.max(y+n,p+t+2):p+n}}function Rf(i,e,t){return e*(We/(i.tileSize*Math.pow(2,t-i.tileID.overscaledZ
vendor: 10,198 bytes, line 7
7)))}function I0(i,e){return 1/Rf(i,1,e.tileZoom)}function A0(i,e,t,n){return i.translatePosMatrix(n||e.tileID.projMatrix,e,t.paint.get("line-translate"),t.paint.get("line-translate-anchor"))}tt(b0,"ClipBucket",{omit:["layers"]});const C0=i=>{const e=[];M0(i)&&e.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT"),i.paint.get("line-blend-mode")==="multiply"&&e.push("LINE_BLEND_MULTIPLY"),i.paint.get("line-blend-mode")==="additive"&&e.push("LINE_BLEND_ADDITIVE");const t=i.paint.get("line-trim-offset");t[0]===0&&t[1]===0||e.push("RENDER_LINE_TRIM_OFFSET");const n=i.paint.get("line-border-width").constantOr(1)!==0;n&&e.push("RENDER_LINE_BORDER"),n&&i.paint.get("line-border-gradient")&&e.push("RENDER_LINE_BORDER_GRADIENT");const s=i.layout.get("line-join").constantOr("miter")==="none",l=!!i.paint.get("line-pattern").constantOr(1);return s&&l&&e.push("LINE_JOIN_NONE"),e};function M0(i){const e=i.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let ey;const R0=()=>ey||(ey={layout:x0||(x0=new qi({"line-cap":new Ze(me.layout_line["line-cap"]),"line-join":new Ze(me.layout_line["line-join"]),"line-miter-limit":new je(me.layout_line["line-miter-limit"]),"line-round-limit":new je(me.layout_line["line-round-limit"]),"line-sort-key":new Ze(me.layout_line["line-sort-key"]),"line-z-offset":new Ze(me.layout_line["line-z-offset"]),"line-elevation-reference":new je(me.layout_line["line-elevation-reference"]),"line-cross-slope":new je(me.layout_line["line-cross-slope"]),visibility:new je(me.layout_line.visibility),"line-width-unit":new je(me.layout_line["line-width-unit"]),"line-elevation-ground-scale":new Ze(me.layout_line["line-elevation-ground-scale"])})),paint:v0||(v0=new qi({"line-opacity":new Ze(me.paint_line["line-opacity"]),"line-color":new Ze(me.paint_line["line-color"]),"line-translate":new je(me.paint_line["line-translate"]),"line-translate-anchor":new je(me.paint_line["line-translate-anchor"]),"line-width":new Ze(me.paint_line["line-width"]),"line-gap-width":new Ze(me.paint_line["line-gap-width"]),"line-offset":new Ze(me.paint_line["line-offset"]),"line-blur":new Ze(me.paint_line["line-blur"]),"line-dasharray":new Ze(me.paint_line["line-dasharray"]),"line-pattern":new Ze(me.paint_line["line-pattern"]),"line-pattern-cross-fade":new je(me.paint_line["line-pattern-cross-fade"]),"line-gradient":new oa(me.paint_line["line-gradient"]),"line-trim-offset":new je(me.paint_line["line-trim-offset"]),"line-trim-fade-range":new je(me.paint_line["line-trim-fade-range"]),"line-trim-color":new je(me.paint_line["line-trim-color"]),"line-emissive-strength":new Ze(me.paint_line["line-emissive-strength"]),"line-border-width":new Ze(me.paint_line["line-border-width"]),"line-border-color":new Ze(me.paint_line["line-border-color"]),"line-border-gradient":new oa(me.paint_line["line-border-gradient"]),"line-occlusion-opacity":new je(me.paint_line["line-occlusion-opacity"]),"line-blend-mode":new je(me.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new je(me.paint_line["line-blend-additive-clamp"]),"line-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"line-border-gradient-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},ey);class SE extends Ze{possiblyEvaluate(e,t){return t=new Oi(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition,worldview:t.worldview}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,s){return t={...t,zoom:Math.floor(t.zoom)},super.evaluate(e,t,n,s)}}let Pf,P0,D0,ty;function L0(i,e){return e>0?e+2*i:i}function z0(i,e){return e.replace(/{([^{}]+)}/g,(t,n)=>n in i?String(i[n]):"")}class F0{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:va,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}tt(F0,"FormatSectionOverride",{omit:["defaultValue"]});const iy=()=>ty||(ty={layout:P0||(P0=new qi({"symbol-placement":new je(me.layout_symbol["symbol-placement"]),"symbol-spacing":new je(me.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new je(me.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ze(me.layout_symbol["symbol-sort-key"]),"symbol-z-order":new je(me.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new je(me.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new je(me.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new je(me.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new je(me.layout_symbol["icon-ignore-placement"]),"icon-optional":new je(me.layout_symbol["icon-optional"]),"icon-rotation-alignment":new je(me.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ze(me.layout_symbol["icon-size"]),"icon-size-scale-range":new je(me.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ze(me.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ze(me.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ze(me.layout_symbol["icon-image"]),"icon-image-use-theme":new je({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ze(me.layout_symbol["icon-rotate"]),"icon-padding":new je(me.layout_symbol["icon-padding"]),"icon-keep-upright":new je(me.layout_symbol["icon-keep-upright"]),"icon-offset":new Ze(me.layout_symbol["icon-offset"]),"icon-anchor":new Ze(me.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new je(me.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new je(me.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new je(me.layout_symbol["text-rotation-alignment"]),"text-field":new Ze(me.layout_symbol["text-field"]),"text-font":new Ze(me.layout_symbol["text-font"]),"text-size":new Ze(me.layout_symbol["text-size"]),"text-size-scale-range":new je(me.layout_symbol["text-size-scale-range"]),"text-max-width":new Ze(me.layout_symbol["text-max-width"]),"text-line-height":new Ze(me.layout_symbol["text-line-height"]),"text-letter-spacing":new Ze(me.layout_symbol["text-letter-spacing"]),"text-justify":new Ze(me.layout_symbol["text-justify"]),"text-radial-offset":new Ze(me.layout_symbol["text-radial-offset"]),"text-variable-anchor":new je(me.layout_symbol["text-variable-anchor"]),"text-anchor":new Ze(me.layout_symbol["text-anchor"]),"text-max-angle":new je(me.layout_symbol["text-max-angle"]),"text-writing-mode":new je(me.layout_symbol["text-writing-mode"]),"text-rotate":new Ze(me.layout_symbol["text-rotate"]),"text-padding":new je(me.layout_symbol["text-padding"]),"text-keep-upright":new je(me.layout_symbol["text-keep-upright"]),"text-transform":new Ze(me.layout_symbol["text-transform"]),"text-offset":new Ze(me.layout_symbol["text-offset"]),"text-allow-overlap":new je(me.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new je(me.layout_symbol["text-ignore-placement"]),"text-optional":new je(me.layout_symbol["text-optional"]),visibility:new je(me.layout_symbol.visibility)})),paint:D0||(D0=new qi({"icon-opacity":new Ze(me.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ze(me.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ze(me.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ze(me.paint_symbol["text-emissive-strength"]),"icon-color":new Ze(me.paint_symbol["icon-color"]),"icon-halo-color":new Ze(me.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ze(me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ze(me.paint_symbol["icon-halo-blur"]),"icon-translate":new je(me.paint_symbol["icon-translate"]),"icon-translate-anchor":new je(me.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new je(me.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ze(me.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ze(me.paint_symbol["text-occlusion-opacity"]),"text-color":new Ze(me.paint_symbol["text-color"],{runtimeType:nn,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Ze(me.paint_symbol["text-halo-color"]),"text-halo-width":new Ze(me.paint_symbol["text-halo-width"]),"text-halo-blur":new Ze(me.paint_symbol["text-halo-blur"]),"text-translate":new je(me.paint_symbol["text-translate"]),"text-translate-anchor":new je(me.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new je(me.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new je(me.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new je(me.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new je(me.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ze(me.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},ty);class Hm extends zn{constructor(e,t,n,s){super(e,iy(),t,n,s,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=er([]),this.hasOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){e!=="icon-occlusion-opacity"&&e!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,t){super.recalculate(e,t),this.appearances&&this.appearances.forEac
7h(s=>{s.recalculate(e,t,this.iconImageUseTheme)}),this.appearances.length!==0&&delete this.layout._values["text-variable-anchor"],this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const s=[];for(const l of n)s.includes(l)||s.push(l);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,n,s){return this._saturation===e&&this._contrast===t&&this._brightnessMin===n&&this._brightnessMax===s||(this._colorAdjustmentMatrix=function(l,c,h,p){l=Ql(l),c=Yu(c);const _=Jn(),y=l/3,v=1-2*y,b=[v,y,y,0,y,v,y,0,y,y,v,0,0,0,0,1],T=.5-.5*c,S=p-h;return zt(_,[S,0,0,0,0,S,0,0,0,0,S,0,h,h,h,1],[c,0,0,0,0,c,0,0,0,0,c,0,T,T,T,1]),zt(_,_,b),_}(e,t,n,s),this._saturation=e,this._contrast=t,this._brightnessMin=n,this._brightnessMax=s),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,n,s){const l=this.layout.get(e).evaluate(t,{},n,s),c=this._unevaluatedLayout._values[e];return c.isDataDriven()||fh(c.value)||!l?l:z0(t.properties,l)}getAppearanceValueAndResolveTokens(e,t,n,s,l){const c=e.getLayoutProperty(t);if(!c)return;const h=c.evaluate(n,{},s,l),p=e.getUnevaluatedLayoutProperties()._values[t];return p.isDataDriven()||fh(p.value)||!h||typeof h!="string"?h:z0(n.properties,h)}createBucket(e){return new pm(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of iy().paint.overridableProperties){if(!Hm.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),n=new F0(t),s=new Rd(n,t.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let l=null;l=t.value.kind==="constant"||t.value.kind==="source"?new ph("source",s):new vl("composite",s,t.value.zoomStops,t.value.interpolationType),this.paint._values[e]=new na(t.property,l,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&Hm.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const n=e.get("text-field"),s=iy().paint.properties[t];let l=!1;const c=h=>{for(const p of h)if(s.overrides&&s.overrides.hasOverride(p))return void(l=!0)};if(n.value.kind==="constant"&&n.value.value instanceof Ar)c(n.value.value.sections);else if(n.value.kind==="source"){const h=_=>{l||(_ instanceof fs&&Nr(_.value)===ds?c(_.value.sections):_ instanceof Zn?c(_.sections):_.eachChild(h))},p=n.value;p._styleExpression&&h(p._styleExpression.expression)}return l}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,n){return{config:new Au(this,{zoom:t,lut:n}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}mayUse(e){return e==="HD"&&Ih(this,"symbol-elevation-reference",t=>t==="hd-road-markup")}prepare(){return this.mayUse("HD")?jm():Promise.resolve()}}let O0,B0,k0,N0;const ry=1024,IE=(Math.pow(ry,2)-1)/268170240;class V0 extends zn{constructor(e,t,n,s){super(e,{layout:k0||(k0=new qi({visibility:new je(me.layout_raster.visibility)})),paint:N0||(N0=new qi({"raster-opacity":new je(me.paint_raster["raster-opacity"]),"raster-color":new oa(me.paint_raster["raster-color"]),"raster-color-mix":new je(me.paint_raster["raster-color-mix"]),"raster-color-range":new je(me.paint_raster["raster-color-range"]),"raster-hue-rotate":new je(me.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new je(me.paint_raster["raster-brightness-min"]),"raster-brightness-max":new je(me.paint_raster["raster-brightness-max"]),"raster-saturation":new je(me.paint_raster["raster-saturation"]),"raster-contrast":new je(me.paint_raster["raster-contrast"]),"raster-resampling":new je(me.paint_raster["raster-resampling"]),"raster-fade-duration":new je(me.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new je(me.paint_raster["raster-emissive-strength"]),"raster-array-band":new je(me.paint_raster["raster-array-band"]),"raster-elevation":new je(me.paint_raster["raster-elevation"]),"raster-elevation-reference":new je(me.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},t,n,s),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(e){const t=e?e._source:null;return(!t||t.type!=="image"&&t.type!=="video"&&t.type!=="canvas"||!t.onNorthPole&&!t.onSouthPole)&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}
vendor: 18,482 bytes, line 7
7updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const t=this._transitionablePaint._values["raster-color"].value.expression,[n,s]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(n)&&isNaN(s)||n===this._curRampRange[0]&&s===this._curRampRange[1]||(this.colorRamp=Cf({expression:t,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:n,end:s}],resolution:ry}),this.colorRampTexture=null,this._curRampRange=[n,s])}is3D(e){return this.paint.get("raster-elevation")>0}}let U0,j0,G0,H0,Z0,$0,q0;class W0 extends zn{constructor(e,t,n,s){super(e,{layout:U0||(U0=new qi({visibility:new je(me["layout_raster-particle"].visibility)})),paint:j0||(j0=new qi({"raster-particle-array-band":new je(me["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new je(me["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new oa(me["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new je(me["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new je(me["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new je(me["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new je(me["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new je(me["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},t,n,s),this._updateColorRamp(),this.lastInvalidatedAt=Y.now()}mayUse(e){return e==="HD"}_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(e){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 this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,t=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Cf({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:t}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Y.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class AE extends zn{constructor(e,t){super(e,{},t,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function ny(i,e,t){const n=[0,0,1],s=Cn([]);return fa(s,s,t?-Bt(i)+Math.PI:Bt(i)),Xs(s,s,-Bt(e)),da(n,n,s),ti(n,n)}class X0{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Y0{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new _i,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const t=16*e,n=this.instancedDataArray.float32;let s=Math.floor(n[t+2]);const l=1.05*(n[t+2]-s);return s/=100,[n[t]%1*1.05,n[t+1]%1*1.05,l,s]}tileCoordinatesForInstance(e){const t=16*e,n=this.instancedDataArray.float32;let s=n[t+0];return s=s>We?s-We:s,new Le(Math.trunc(s),Math.trunc(n[t+1]))}translationForInstance(e){const t=16*e,n=this.instancedDataArray.float32;return[n[t+4],n[t+5],n[t+6]]}rotationScaleForInstance(e){const t=16*e,n=this.instancedDataArray.float32;return[n[t+7],n[t+8],n[t+9],n[t+10],n[t+11],n[t+12],n[t+13],n[t+14],n[t+15]]}transformForInstance(e){const t=16*e,n=this.instancedDataArray.float32;return[n[t+7],n[t+8],n[t+9],n[t+4],n[t+10],n[t+11],n[t+12],n[t+5],n[t+13],n[t+14],n[t+15],n[t+6],0,0,0,1]}}class oy{constructor(e){this.requiresStandardRuntime=!0,this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.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=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){this.tileToMeter=w(n);const l=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const c=this.layers[0].paint.get("model-elevation-reference")==="hd-road-markup"?t.elevationFeatures:void 0;for(const{feature:h,id:p,index:_,sourceLayerIndex:y}of e){const v=p??(h.properties&&Object.hasOwn(h.properties,"id")?h.properties.id:void 0),b=X(h,l);if(!this.layers[0]._featureFilter.filter(new Oi(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),b,n))continue;const T={id:v,sourceLayerIndex:y,index:_,geometry:l?b.geometry:q(h,n,s),properties:h.properties,type:h.type,patterns:{}},S=this.addFeature(T,T.geometry,b,c,n);S&&t.featureIndex.insert(h,T.geometry,_,y,this.index,this.instancesPerModel[S].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,t=this.layers[0].scope;let n=0;for(const s of this.modelUris){const l=e.getModel(s,t);if(!l)continue;const c=this.instancesPerModel[s];if(c){const h=.5*Xa(l.aabb.max,l.aabb.min)*c.maxScale+c.maxXYTranslationDistance,p=Math.min(We,Math.max(h/this.tileToMeter,256));n=Math.max(p,n)}}return n}update(e,t,n,s){for(const l in this.instancesPerModel){const c=this.instancesPerModel[l];for(const h in e)Object.hasOwn(c.idToFeaturesIndex,h)&&(this.evaluate(c.features[c.idToFeaturesIndex[h]],e[h],c,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const n=this.instancesPerModel[t];for(const s of n.features){const l=this.layers[0],c=s.feature,h=this.canonical,p=l.paint.get("model-rotation").evaluate(c,{},h),_=l.paint.get("model-scale").evaluate(c,{},h),y=l.paint.get("model-translation").evaluate(c,{},h);ns(s.rotation,p)&&ns(s.scale,_)&&ns(s.translation,y)||(this.evaluate(s,s.featureStates,n,!0),e=!0)}}return e}updateReplacement(e,t,n,s){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const l=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(nm(this.activeReplacements,l))return!1;this.activeReplacements=l;let c=!1;for(const h in this.instancesPerModel){const p=this.instancesPerModel[h],_=p.instancedDataArray;for(const y of p.features){const v=y.instancedDataOffset,b=y.instancedDataCount;for(let T=0;T<b;T++){const S=16*(T+v);let A=_.float32[S+0];const C=A>We;A=C?A-We:A;const D=Math.floor(A),F=Math.floor(_.float32[S+1]);let O=!1;for(const z of this.activeReplacements)if(!Ix(z,n,Dm.Model,s)&&!(z.min.x>D||D>z.max.x||z.min.y>F||F>z.max.y)&&(O=mg(Rx(D,F,e.canonical,z.footprintTileId.canonical),z.footprint),O))break;_.float32[S]=O?A+We:A,c=c||O!==C}}}return c}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const n=this.instancesPerModel[t];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,LT.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const n in this.instancesPerModel){const s=this.instancesPerModel[n];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const t=this.layers[0].modelManager;if(e&&t&&this.modelUris&&this.modelsRequested)for(const n of this.modelUris)t.removeModel(n,"",!0)}addFeature(e,t,n,s,l){const c=this.layers[0],h=c.layout.get("model-id"),p=c.layout.get("model-allow-density-reduction"),_=h.evaluate(n,{},this.canonical);if(!_)return gi(`modelId is not evaluated for layer ${c.id} and it is not going to get rendered.`),_;!_.includes("://")&&!this.styleDefinedModelURLs[_]||this.modelUris.includes(_)||this.modelUris.push(_),this.instancesPerModel[_]||(this.instancesPerModel[_]=new Y0);const y=this.instancesPerModel[_],v=y.instancedDataArray,b=new X0(n,v.length);let T;if(s){const S=xf(e,s,void 0,l);T=S?S.feature:void 0}for(const S of t)for(const A of S){if(A.x<0||A.x>=We||A.y<0||A.y>=We)continue;if(this.lookupDim!==0&&p){const D=(this.lookupDim-1)/We,F=this.lookupDim*(A.y*D|0)+A.x*D|0;if(this.lookup){if(this.lookup[F]!==0)continue;this.lookup[F]=1}}this.instanceCount++;const C=v.length;if(v.resize(C+1),s){y.instancesRoadElevation||(y.instancesRoadElevation=[]);const D=T?T.pointElevation(new Le(A.x,A.y)):0;y.instancesRoadElevation.push(D)}y.instancesEvaluatedElevation.push(0),v.float32[16*C]=A.x,v.float32[16*C+1]=A.y}return b.instancedDataCount=y.instancedDataArray.length-b.instancedDataOffset,b.instancedDataCount>0&&(e.id&&(y.idToFeaturesIndex[e.id]=y.features.length),y.features.push(b),this.evaluate(b,{},y,!1)),_}getModelUris(){return this.modelUris}evaluate(e,t,n,s){const l=this.layers[0],c=e.feature,h=this.canonical,p=e.rotation=l.paint.get("model-rotation").evaluate(c,t,h),_=e.scale=l.paint.get("model-scale").evaluate(c,t,h),y=e.translation=l.paint.get("model-translation").evaluate(c,t,h),{r:v,g:b,b:T}=l.paint.get("model-color").evaluate(c,t,h),S=l.paint.get("model-color-mix-intensity").evaluate(c,t,h),A=[];this.maxVerticalOffset<y[2]&&(this.maxVerticalOffset=y[2]);const C=y[0]*y[0]+y[1]*y[1],D=C>0?Math.sqrt(C):0;n.maxScale=Math.max(Math.max(n.maxScale,_[0]),Math.max(_[1],_[2])),n.maxXYTranslationDistance=Math.max(n.maxXYTranslationDistance,D),this.maxScale=Math.max(Math.max(this.maxScale,_[0]),Math.max(_[1],_[2])),Mv(A,p,_);const F=Math.round(100*S)+T/1.05;for(let O=0;O<e.instancedDataCount;++O){const z=e.instancedDataOffset+O,N=16*z,j=n.instancedDataArray.float32;let te=0;s&&(te=j[N+6]-n.instancesEvaluatedElevation[z]);const G=0|j[N+1];j[N]=(0|j[N])+v/1.05,j[N+1]=G+b/1.05,j[N+2]=F,j[N+3]=1/(h.z>10?this.tileToMeter:w(h,G)),j[N+4]=y[0],j[N+5]=y[1],j[N+6]=y[2]+(n.instancesRoadElevation?n.instancesRoadElevation[z]:0)+te,j[N+7]=A[0],j[N+8]=A[1],j[N+9]=A[2],j[N+10]=A[4],j[N+11]=A[5],j[N+12]=A[6],j[N+13]=A[8],j[N+14]=A[9],j[N+15]=A[10],n.instancesEvaluatedElevation[z]=y[2]}}}tt(oy,"ModelBucket",{omit:["layers"]}),tt(Y0,"PerModelAttributes"),tt(X0,"ModelFeature");class Wh{constructor(e,t,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=n}static create(e,t,n){const s=n||e.findDEMTileFor(t);if(!s||!s.dem)return;const l=s.dem,c=s.tileID,h=1<<t.canonical.z-c.canonical.z;return new Wh(s,l.dim/We/h,[(t.canonical.x/h-c.canonical.x)*l.dim,(t.canonical.y/h-c.canonical.y)*l.dim])}tileCoordToPixel(e,t){const n=t*this._scale+this._offset[1];return new Le(Math.floor(e*this._scale+this._offset[0]),Math.floor(n))}getElevationAt(e,t,n,s){const l=e*this._scale+this._offset[0],c=t*this._scale+this._offset[1],h=Math.floor(l),p=Math.floor(c),_=this._dem;return s=!!s,n?lt(lt(_.get(h,p,s),_.get(h,p+1,s),c-p),lt(_.get(h+1,p,s),_.get(h+1,p+1,s),c-p),l-h):_.get(h,p,s)}getElevationAtPixel(e,t,n){return this._dem.get(e,t,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*o(1,e)*this._dem.stride}}const sy=new Float32Array(262144),Ou=new Uint8Array(262144),Zm=[0,0,0],$m=[0,0,0];function K0(i){let e=0;if(i.meshes)for(const t of i.meshes)e=Math.max(e,t.aabb.max[2]);if(i.children)for(const t of i.children)e=Math.max(e,K0(t));return e}function J0(i,e,t){if(i.meshes)for(const n of i.meshes){if(n.aabb.min[0]===1/0)continue;const s=zi.applyTransform(n.aabb,i.globalMatrix);t.insert(e,s.min[0],s.min[1],s.max[0],s.max[1])}if(i.children)for(const n of i.children)J0(n,e,t)}const qm=["","wall","door","roof","window","lamp","logo"];class Q0{constructor(e){this.node=e,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.targetLod=-1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:K0(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new zi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const t=new zi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&(n.transformedAabb=zi.applyTransformFast(n.aabb,this.node.globalMatrix),t.encapsulate(n.transformedAabb)),e++;this.aabb=t}return this.aabb}}class e1{constructor(e,t,n,s,l,c,h,p){this.requiresStandardRuntime=!0,this.isTiled3dModelBucket=!0,this.id=n,this.layers=e,this.layerIds=this.layers.map(_=>_.fqid),this.stateDependentLayerIds=this.layers.filter(_=>_.isStateDependent()).map(_=>_.id),this.modelTraits|=1,this.uploaded=!1,this.hasPattern=!1,s&&(this.modelTraits|=4),l&&(this.modelTraits|=8),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=c,this.worldview=p,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const _ of t)this.nodesInfo.push(new Q0(_)),J0(_,h.featureIndexArray.length,h.grid),h.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,h.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,t){for(const n of this.getNodesInfo()){const s=n.node;s.footprint&&t.push({footprint:s.footprint,id:e})}}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(e){const t=Object.keys(e).length!==0;if(t&&!this.stateDependentLayers.length)return;const n=t?this.stateDependentLayers:this.layers;if(!as(e,this.states))for(const s of n)this.evaluate(s,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const n of t){const s=n.node;this.uploaded?this.updatePbrBuffer(s):Ng(s,e,!0)}for(const n of t)Rm(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),t=!0);if(e.lodMeshes)for(const n of e.lodMeshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),t=!0);return t}needsReEvaluation(e,t,n){const s=e.transform.projectionOptions,l=e.style.getBrightness(),c=this.brightness!==l;if(!this.uploaded||this.dirty||s.name!==this.projection.name||Df(n.paint.get("model-color").value,c)||Df(n.paint.get("model-color-mix-intensity").value,c)||Df(n.paint.get("model-roughness").value,c)||Df(n.paint.get("model-emissive-strength").value,c)||Df(n.paint.get("model-height-based-emissive-strength-multiplier").value,c)){this.projection=s,this.brightness=l;const h=this.getNodesInfo();for(const p of h)p.state=null;return!0}return!1}evaluateTransform(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),s=this.id.canonical;for(const l of n){const c=l.feature;l.evaluatedTranslation=t.paint.get("model-translation").evaluate(c,{},s),l.evaluatedScale=t.paint.get("model-scale").evaluate(c,{},s)}}evaluate(e,t){const n=this.getNodesInfo();for(const s of n){if(!s.node.meshes)continue;const l=s.feature,c=t&&t[l.id];if(as(c,s.state))continue;s.state=structuredClone(c);const h=s.node.meshes&&s.node.meshes[0].featureData,p=s.evaluatedColor[2],_=s.evaluatedRMEA[2],y=this.id.canonical;if(s.hasTranslucentParts=!1,h){for(let v=0;v<qm.length;v++){const b=qm[v];b.length&&(l.properties.part=b);const T=e.paint.get("model-color").evaluate(l,c,y).toPremultipliedRenderColor(null),S=e.paint.get("model-color-mix-intensity").evaluate(l,c,y);s.evaluatedColor[v]=[T.r,T.g,T.b,S],s.evaluatedRMEA[v][0]=e.paint.get("model-roughness").evaluate(l,c,y),s.evaluatedRMEA[v][2]=e.paint.get("model-emissive-strength").evaluate(l,c,y),s.evaluatedRMEA[v][3]=T.a,s.emissionHeightBasedParams[v]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(l,c,y),!s.hasTranslucentParts&&T.a<1&&(s.hasTranslucentParts=!0)}delete l.properties.part,ME(s,p!==s.evaluatedColor[2]||_!==s.evaluatedRMEA[2],this.modelTraits)}else s.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(l,c,y);s.evaluatedTranslation=e.paint.get("model-translation").evaluate(l,c,y),s.evaluatedScale=e.paint.get("model-scale").evaluate(l,c,y),this.updatePbrBuffer(s.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,t,n,s){const l=e.findDEMTileFor(n);if(l&&(l.tileID.canonical!==this.terrainTile||t!==this.terrainExaggeration)){if
7(l.dem&&l.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=l.tileID.overscaledZ;const c=Wh.create(e,n,l);if(!c)return;4&this.modelTraits&&this.updateDEM(e,c,n,s);for(const h of this.getNodesInfo()){const p=h.node;if(!p.footprint||!p.footprint.vertices||!p.footprint.vertices.length)continue;const _=p.footprint.vertices;let y=c.getElevationAt(_[0].x,_[0].y,!0,!0);for(let v=1;v<_.length;v++)y=Math.min(y,c.getElevationAt(_[v].x,_[v].y,!0,!0));p.elevation=y}}this.terrainTile=l.tileID.canonical,this.terrainExaggeration=t}}updateDEM(e,t,n,s){let l=t._dem._modifiedForSources[s];if(l===void 0&&(t._dem._modifiedForSources[s]=[],l=t._dem._modifiedForSources[s]),l.includes(n.canonical))return;const c=t._dem.dim;l.push(n.canonical);let h=!1;for(const p of this.getNodesInfo()){const _=p.node;if(!_.footprint||!_.footprint.grid)continue;const y=_.footprint.grid,v=t.tileCoordToPixel(y.min.x,y.min.y),b=t.tileCoordToPixel(y.max.x,y.max.y),T=Math.min(Math.min(c-b.y,v.x),Math.min(v.y,c-b.x));if(T<0)continue;const S=yt(T,2,5);let A=Math.max(0,v.x-S),C=Math.max(0,v.y-S),D=Math.min(b.x+S,c-1),F=Math.min(b.y+S,c-1);for(let j=C;j<=F;++j)for(let te=A;te<=D;++te)Ou[j*c+te]=255;let O=0,z=0;for(let j=0;j<y.cellsY;++j)for(let te=0;te<y.cellsX;++te){if(!y.cells[j*y.cellsX+te])continue;const G=t.tileCoordToPixel(y.min.x+te/y.xScale,y.min.y+j/y.yScale),W=t.tileCoordToPixel(y.min.x+(te+1)/y.xScale,y.min.y+(j+1)/y.yScale);for(let K=G.y;K<=Math.min(W.y+1,c-1);++K)for(let ee=G.x;ee<=Math.min(W.x+1,c-1);++ee)Ou[K*c+ee]===255&&(Ou[K*c+ee]=0,O+=t.getElevationAtPixel(ee,K),z++)}const N=O/z;A=Math.max(1,v.x-S),C=Math.max(1,v.y-S),D=Math.min(b.x+S,c-2),F=Math.min(b.y+S,c-2),h=!0;for(let j=C;j<=F;++j)for(let te=A;te<=D;++te)Ou[j*c+te]===0&&(sy[j*c+te]=t._dem.set(te,j,N));for(let j=1;j<S;++j){A=Math.max(1,v.x-j),C=Math.max(1,v.y-j),D=Math.min(b.x+j,c-2),F=Math.min(b.y+j,c-2);for(let te=C;te<=F;++te)for(let G=A;G<=D;++G){const W=te*c+G;if(Ou[W]===255){let K=0,ee=0,le=-1,de=-1;for(let ve=-1;ve<=1;++ve)for(let xe=-1;xe<=1;++xe){const we=(te+ve)*c+G+xe;if(Ou[we]>=j)continue;const Fe=sy[we],se=Math.abs(Fe);se>ee&&(K=Fe,ee=se,le=xe,de=ve)}if(ee>.1){const ve=1-(j+.5*Math.abs(le*de))/S;let xe=t._dem.get(G,te)+K*ve;const we=t._dem.get(G+le,te+de),Fe=t._dem.get(G-le,te-de,!0);(xe-we)*(xe-Fe)>0&&(xe=(we+Fe)/2),sy[W]=t._dem.set(G,te,xe),Ou[W]=j}}}}}h&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=Y.now())}setFilter(e){this.filter=e?yu(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Oi(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)Rm(t.node),Vg(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped());for(const s of this.getNodesInfo()){const l=s.node.footprint;s.hiddenByReplacement=!!l&&!n.some(c=>c.footprint===l)}}getHeightAtTileCoord(e,t){const n=[0,0,0],s=er([]);for(const l of this.getNodesInfo()){const c=l.node.meshes[0],h=c.transformedAabb;if(e<h.min[0]||t<h.min[1]||e>h.max[0]||t>h.max[1])continue;if(l.node.hidden===!0)return{height:1/0,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]};if(xn(s,l.node.globalMatrix),n[0]=e,n[1]=t,n[2]=0,hi(n,n,s),l.node.meshBVH){const v=n[0],b=n[1];Zm[0]=v-1,Zm[1]=b-1,Zm[2]=-1e3,$m[0]=v+1,$m[1]=b+1,$m[2]=1e3;const T=l.node.meshBVH.findHighestPoint(Zm,$m);if(T!==null)return{height:T,maxHeight:l.feature.properties.height,hidden:l.hiddenByReplacement,verticalScale:l.evaluatedScale[2]};continue}const p=(n[0]-c.aabb.min[0])/(c.aabb.max[0]-c.aabb.min[0])*zu|0,_=Math.min(63,(n[1]-c.aabb.min[1])/(c.aabb.max[1]-c.aabb.min[1])*zu|0)*zu+Math.min(63,p),y=c.heightmap[_];if(y<0&&l.node.footprint){const v=[];if(l.node.footprint.grid.query(new Le(e,t),new Le(e,t),v),v.length>0)return{height:void 0,maxHeight:l.feature.properties.height,hidden:l.hiddenByReplacement,verticalScale:l.evaluatedScale[2]};continue}return l.hiddenByReplacement?void 0:{height:y,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]}}}}function Df(i,e){return i instanceof ph&&!i.isLightConstant&&e}function CE(i){const e=yt(i,0,2);return Math.min(Math.round(.5*e*255),255)}const t1=new Float64Array(10*qm.length);function i1(i,e,t,n,s,l){if(!i.featureData)return;const c=i.featureArray=new ni;c.reserveExact(i.featureData.length),function(y,v,b){const T=b-v;for(let S=0;S<qm.length;S++){const A=y.evaluatedRMEA[S],C=y.evaluatedColor[S],D=y.emissionHeightBasedParams[S],F=yt(D[0],0,1),O=yt(D[1],0,1);let z=65535,N=0,j=1,te=1;if(F!==O&&T!==0){const K=yt(D[2],0,1),ee=yt(D[3],0,1),le=T*(O-F);N=1/le,j=-(v+T*F)/le,te=Math.pow(10,yt(D[4],-1,1)),z=255*K<<8|255*ee}const G=t1,W=10*S;G[W]=255*C[0],G[W+1]=255*C[1],G[W+2]=255*C[2],G[W+3]=C[3],G[W+4]=Math.floor(255*A[3]),G[W+5]=CE(A[2])<<8|15*A[0]<<4|15*A[1],G[W+6]=z,G[W+7]=N,G[W+8]=j,G[W+9]=te}}(e,i.aabb.min[2],i.aabb.max[2]);const h=t1,p=e.node;let _=s&&!!p.lights;for(const y of i.featureData){const v=y>>t&65535,b=y>>n&15,T=b<8?b:0,S=10*T;let A=(61440&v|(61440&v)>>4)>>8,C=(3840&v|(3840&v)>>4)>>4,D=240&v|(240&v)>>4;const F=(15&v|(15&v)<<4)/255,O=h[S+3];O>0&&(A=lt(A,h[S],O),C=lt(C,h[S+1],O),D=lt(D,h[S+2],O)),l&&(A*=F,C*=F,D*=F);const z=A<<8|C,N=D<<8|h[S+4],j=h[S+5],te=h[S+6],G=h[S+7],W=h[S+8],K=h[S+9];if(c.emplaceBack(z,N,j,te,G,W,K),_&&T===2){_=!1;const ee=10*p.lights.length,le=new ni;le.reserveExact(ee);for(let de=0;de<ee;de++)le.emplaceBack(z,N,j,te,G,W,K);p.meshes[p.lightMeshIndex].featureArray=le}}}function ME(i,e,t){const n=i.node,s=8&t,l=s?0:16,c=s?16:0;for(let h=0;h<n.meshes.length;h++)n.lights&&n.lightMeshIndex===h||i1(n.meshes[h],i,l,c,e,!1);if(n.lodMeshes)for(const h of n.lodMeshes)i1(h,i,l,c,!1,!0)}tt(e1,"Tiled3dModelBucket",{omit:["layers"]}),tt(Q0,"Tiled3dModelFeature");class r1{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const RE=["id","tile","layer","source","sourceLayer","state"];class Bu{constructor(e,t,n,s,l){this.type="Feature",this._vectorTileFeature=e,this._z=t,this._x=n,this._y=s,this.properties=e?e.properties:{},this.id=l}clone(){const e=new Bu(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state={...this.state}),this.layer&&(e.layer={...this.layer}),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const t of RE)this[t]!==void 0&&(e[t]=this[t]);return e}}const Yn={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11},ay=new Float32Array(er([])),n1=[0,0,0],ly=(i,e,t,n,s,l,c,h,p,_,y,v,b,T=[0,0,0],S,A,C,D=1,F=!1)=>{let O=n1,z=0,N=n1;if(!F){const W=s.style.light,K=W.properties.get("position");if(O=[-K.x,-K.y,K.z],W.properties.get("anchor")==="viewport"){const le=Vl();Eo(le,-s.transform.angle),Io(O,O,le)}const ee=W.properties.get("color").toNonPremultipliedRenderColor(null);z=W.properties.get("intensity"),N=[ee.r,ee.g,ee.b]}const j=y.alphaMode==="MASK",te=b.paint.get("model-ambient-occlusion-intensity"),G=b.paint.get("model-color").constantOr(Lt.white).toNonPremultipliedRenderColor(null);return G.a=b.paint.get("model-color-mix-intensity").constantOr(0),C&&
vendor: 11,893 bytes, line 7
7(G.r=C[0],G.g=C[1],G.b=C[2],G.a=C[3]),A&&(G.r=A.color.r,G.g=A.color.g,G.b=A.color.b,G.a=A.colorMix,v=A.emissionStrength,l*=A.opacity),{u_matrix:i,u_lighting_matrix:e,u_normal_matrix:t,u_node_matrix:n||ay,u_lightpos:O,u_lightintensity:z,u_lightcolor:N,u_camera_pos:T,u_opacity:l,u_baseTextureIsAlpha:0,u_alphaMask:+j,u_alphaCutoff:y.alphaCutoff,u_baseColorFactor:c.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:h.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:p,u_roughnessFactor:_,u_baseColorTexture:Yn.BaseColor,u_metallicRoughnessTexture:Yn.MetallicRoughness,u_normalTexture:Yn.Normal,u_occlusionTexture:Yn.Occlusion,u_emissionTexture:Yn.Emission,u_lutTexture:Yn.LUT,u_color_mix:G.toArray01(),u_aoIntensity:te,u_emissive_strength:v,u_occlusionTextureTransform:S||[0,0,0,0],u_dithered_discard_threshold:D}},o1=(i,e=ay,t=ay)=>({u_matrix:i,u_instance:e,u_node_matrix:t}),cy=7680;class bs{constructor(e,t,n,s,l,c){this.test=e,this.ref=t,this.mask=n,this.fail=s,this.depthFail=l,this.pass=c}}bs.disabled=new bs({func:519,mask:0},0,0,cy,cy,cy);const Wm=770,Xh=771;class Qi{constructor(e,t,n,s){this.blendFunction=e,this.blendColor=t.toNonPremultipliedRenderColor(null),this.mask=n,this.blendEquation=s}}Qi.Replace=[1,0,1,0],Qi.disabled=new Qi(Qi.Replace,Lt.transparent,[!1,!1,!1,!1]),Qi.unblended=new Qi(Qi.Replace,Lt.transparent,[!0,!0,!0,!0]),Qi.alphaBlended=new Qi([1,Xh,1,Xh],Lt.transparent,[!0,!0,!0,!0]),Qi.alphaBlendedNonPremultiplied=new Qi([Wm,Xh,Wm,Xh],Lt.transparent,[!0,!0,!0,!0]),Qi.multiply=new Qi([774,0,774,0],Lt.transparent,[!0,!0,!0,!0]),Qi.multiplyAccumulateAlpha=new Qi([774,0,1,Xh],Lt.transparent,[!0,!0,!0,!0]),Qi.additive=new Qi([1,1,1,1],Lt.transparent,[!0,!0,!0,!0]),Qi.additiveAlphaWeighted=new Qi([Wm,1,773,1],Lt.transparent,[!0,!0,!0,!0]),Qi.additiveAlphaWeightedUnboundedAlpha=new Qi([Wm,1,1,1],Lt.transparent,[!0,!0,!0,!0]);class mn{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}}mn.ReadOnly=!1,mn.ReadWrite=!0,mn.disabled=new mn(519,mn.ReadOnly,[0,1]);const uy=1029,hy=2305;class _n{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}}_n.disabled=new _n(!1,uy,hy),_n.backCCW=new _n(!0,uy,hy),_n.backCW=new _n(!0,uy,2304),_n.frontCW=new _n(!0,1028,2304),_n.frontCCW=new _n(!0,1028,hy);class dy{constructor(e=0,t=0,n=0,s=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=n,this.right=s}interpolate(e,t,n){return t.top!=null&&e.top!=null&&(this.top=lt(e.top,t.top,n)),t.bottom!=null&&e.bottom!=null&&(this.bottom=lt(e.bottom,t.bottom,n)),t.left!=null&&e.left!=null&&(this.left=lt(e.left,t.left,n)),t.right!=null&&e.right!=null&&(this.right=lt(e.right,t.right,n)),this}getCenter(e,t){return new Le(yt((this.left+e-this.right)/2,0,e),yt((this.top+t-this.bottom)/2,0,t))}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new dy(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function s1(i,e){const t=Fr(i,3);qa(i,e),no(i,3,t)}function fy(i,e){const t=Cn([]);return Ao(t,t,-e),Xs(t,t,-i),t}function a1(i,e){const t=[i[0],i[1],0],n=[e[0],e[1],0];if(Xi(t)>=1e-15){const c=ti([],t);oi(n,c,Di(n,c)),e[0]=n[0],e[1]=n[1]}const s=xr([],e,i);if(As(s)<1e-15)return null;const l=Math.atan2(-s[1],s[0]);return fy(Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2]),l)}class l1{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(e){if(e){const t=e instanceof E?e:new E(e[0],e[1],e[2]);this._renderWorldCopies&&(t.x=vn(t.x,0,1)),this._position=t}else this._position=null}lookAtPoint(e,t,n){if(this.orientation=null,!this.position)return;const s=this.position,l=n||(this._elevation?this._elevation.getAtPointOrZero(E.fromLngLat(e)):0),c=E.fromLngLat(e,l),h=[c.x-s.x,c.y-s.y,c.z-s.z];t||(t=[0,0,1]),t[2]=Math.abs(t[2]),this.orientation=a1(h,t)}setPitchBearing(e,t){this.orientation=fy(Bt(e),Bt(-t))}}class Xm{constructor(e,t){this._transform=er([]),this.orientation=t,this.position=e}get mercatorPosition(){const e=this.position;return new E(e[0],e[1],e[2])}get position(){const e=Fr(this._transform,3);return[e[0],e[1],e[2]]}set position(e){var t;e&&no(this._transform,3,[(t=e)[0],t[1],t[2],1])}get orientation(){return this._orientation}set orientation(e){this._orientation=e||Cn([]),e&&s1(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=fy(e,t),s1(this._transform,this._orientation)}forward(){const e=Fr(this._transform,2);return[-e[0],-e[1],-e[2]]}up(){const e=Fr(this._transform,1);return[-e[0],-e[1],-e[2]]}right(){const e=Fr(this._transform,0);return[e[0],e[1],e[2]]}getCameraToWorld(e,t){const n=new Float64Array(16);return xn(n,this.getWorldToCamera(e,t)),n}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(e,t,n){const s=this.position;oi(s,s,-e);const l=new Float64Array(16);return No(l,[n,n,n]),Wi(l,l,s),l[10]*=t,l}getWorldToCamera(e,t){const n=new Float64Array(16),s=new Float64Array(4),l=this.position;var c,h;return(c=s)[0]=-(h=this._orientation)[0],c[1]=-h[1],c[2]=-h[2],c[3]=h[3],oi(l,l,-e),qa(n,s),Wi(n,n,l),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=t,n[9]*=t,n[10]*=t,n[11]*=t,n}getCameraToClipPerspective(e,t,n,s){const l=new Float64Array(16);return Gl(l,e,t,n,s),l}getCameraToClipOrthographic(e,t,n,s,l,c){const h=new Float64Array(16);return ju(h,e,t,n,s,l,c),h}getDistanceToElevation(e,t=!1){const n=e===0?0:o(e,t?wr(this.position[1]):this.position[1]),s=this.forward();return(n-this.position[2])/s[2]}clone(){return new Xm([...this.position],[...this.orientation])}}const PE=Math.tan(85*Math.PI/180);function py(i,e,t,n,s,l,c){const h=Jn();if(t)if(l.name==="globe"){const p=function(_,y){const{x:v,y:b}=_.point,T=_x(v,b,_.worldSize/_._pixelsPerMercatorPixel,0,0);return zt(T,T,cg(Na(y)))}(s,e);zt(h,h,p)}else{const p=Vc([],c);h[0]=p[0],h[1]=p[1],h[4]=p[2],h[5]=p[3],n||js(h,h,s.angle)}else zt(h,s.labelPlaneMatrix,i);return h}function Oc(i,e,t,n){const s=[i,e,t,1];t?ar(s,s,n):_1(s,s,n);const l=s[3];return s[0]/=l,s[1]/=l,s[2]/=l,s}function c1(i,e){return Math.min(.5+i/e*.5,1.5)}function DE(i,e){const t=i[0]/i[3],n=i[1]/i[3];return t>=-e[0]&&t<=e[0]&&n>=-e[1]&&n<=e[1]}function u1(i,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D){const{lineStartIndex:F,glyphStartIndex:O,segment:z}=h,N=O+h.numGlyphs,j=F+h.lineLength,te=e.getoffsetX(O),G=e.getoffsetX(N-1),W=Ym(i*te,t,n,s,l,c,z,F,j,p,_,y,v,b,!0,T,S,A,C,D);if(!W)return null;const K=Ym(i*G,t,n,s,l,c,z,F,j,p,_,y,v,b,!0,T,S,A,C,D);return K?{first:W,last:K}:null}function h1(i,e,t,n){return i===Rl.horizontal&&Math.abs(n)>Math.abs(t)?{useVertical:!0}:i===Rl.vertical?n>0?{needsFlipping:!0}:null:e!==0&&function(s,l){return s===0||Math.abs(l/s)>PE}(t,n)?e===1?{needsFlipping:!0}:null:t<0?{needsFlipping:!0}:null}function d1(i,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O,z){const N=e/24,j=i.lineOffsetX*N,te=i.lineOffsetY*N,{lineStartIndex:G,glyphStartIndex:W,numGlyphs:K,segment:ee,writingMode:le,flipState:de}=i,ve=G+i.lineLength,xe=we=>{if(y){const[ge,Se,Me]=we.up,Pe=_.length;fm(y,Pe+0,ge,Se,Me),fm(y,Pe+1,ge,Se,Me),fm(y,Pe+2,ge,Se,Me),fm(y,Pe+3,ge,Se,Me)}const[Fe,se,pe]=we.point;Pu(_,Fe,se,pe,we.angle)};if(K>1){const we=u1(N,h,j,te,t,v,b,i,p,l,T,A,!1,C,D,F,O,z);if(!we)return{notEnoughRoom:!0};if(n&&!t){let[Fe,se,pe]=we.first.point,[ge,Se,Me]=we.last.point;[Fe,se]=Oc(Fe,se,pe,c),[ge,Se]=Oc(ge,Se,Me,c);const Pe=h1(le,de,(ge-Fe)*S,Se-se);if(i.flipState=Pe&&Pe.needsFlipping?1:2,Pe)return Pe}xe(we.first);for(let Fe=W+1;Fe<W+K-1;Fe++){const se=Ym(N*h.getoffsetX(Fe),j,te,t,v,b,ee,G,ve,p,l,T,A,!1,!1,C,D,F,O,z);if(!se)return _.length-=4*(Fe-W),{notEnoughRoom:!0};xe(se)}xe(we.last)}else{if(n&&!t){const Fe=Oc(b.x,b.y,0,s),se=G+ee+1,pe=new Le(p.getx(se),p.gety(se)),ge=Oc(pe.x,pe.y,0,s),Se=ge[3]>0?ge:m1(b,pe,Fe,1,s,void 0,C,D.canonical),Me=h1(le,de,(Se[0]-Fe[0])*S,Se[1]-Fe[1]);if(i.flipState=Me&&Me.needsFlipping?1:2,Me)return Me}const we=Ym(N*h.getoffsetX(W),j,te,t,v,b,ee,G,ve,p,l,T,A,!1,!1,C,D,F,O,z);if(!we)return{notEnoughRoom:!0};xe(we)}return{}}function f1(i,e,t){const n=1<<e.z;let s=(i.x/We+e.x)/n-t.mercCenter[0];const l=(i.y/We+e.y)/n-t.mercCenter[1];s-=Math.round(s);const c=[s*We,l*We,We/(2*Math.PI),1];return ar(c,c,t.invMatrix),[c[0],c[1],c[2]]}function p1(i,e,t,n,s,l){let{x:c,y:h,z:p}=n.projectTilePoint(i.x,i.y,e);if(l){const[b,T,S]=f1(i,e,l);c+=(b-c)*l.t,h+=(T-h)*l.t,p+=(S-p)*l.t}if(!s)return Oc(c,h,p,t);const[_,y,v]=s.getElevation(i,s.elevation,s.elevationFeature);return Oc(c+_,h+y,p+v,t)}function m1(i,e,t,n,s,l,c,h,p){const _=p1(i.sub(e)._unit()._add(i),h,s,c,l,p);return Li(_,t,_),ti(_,_),cn(_,t,_,n)}function Ym(i,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O){const z=n?i-e:i+e;let N=z>0?1:-1,j=0;n&&(N*=-1,j=Math.PI),N<0&&(j+=Math.PI);let te=h+c+(N>0?0:1)|0,G=s,W=s,K=0,ee=0;const le=Math.abs(z),de=[],ve=[];let xe=l,we=xe,Fe=Gc([]);const se=()=>m1(we,xe,W,le-K+1,y,b,A,C.canonical,O);for(;K+ee<=le;){if(te+=N,te<h||te>=p)return null;if(W=G,we=xe,de.push(W),T&&ve.push(we),xe=new Le(_.getx(te),_.gety(te)),G=v[te],!G){const Ne=p1(xe,C.canonical,y,A,b,O);G=Ne[3]>0?v[te]=Ne:se()}K+=ee;const Be=Li([],G,W),Ke=Xa(W,G);if(t&&Ke>0&&ee>0&&Di(Fe,Be)/(ee*Ke)<F)return null;ee=Ke,Fe=Be}S&&b&&(v[te]&&(G=se(),ee=Xa(W,G),Fe=Li([],G,W)),v[te]=G);const pe=(le-K)/ee,ge=xe.sub(we)._mult(pe)._add(we),Se=cn([],W,Fe,pe);let Me=[0,0,1],Pe=Fe[0],Ie=Fe[1];if(D&&(Me=A.upVector(C.canonical,ge.x,ge.y),Me[0]!==0||Me[1]!==0||Me[2]!==1)){const Be=[Me[2],0,-Me[0]],Ke=xr([],Me,Be);ti(Be,Be),ti(Ke,Ke),Pe=Di(Fe,Be),Ie=Di(Fe,Ke)}if(t){const Be=xr([],Me,Fe);ti(Be,Be),cn(Se,Se,Be,t*N)}const Oe=j+Math.atan2(Ie,Pe);return de.push(Se),T&&ve.push(ge),{point:Se,angle:Oe,path:de,tilePath:ve,up:Me}}function Lf(i,e){const t=e.length,n=t+4*i;e.resize(n),e.float32.fill(-1/0,4*t,4*n)}function _1(i,e,t){const n=e[0],s=e[1];return i[0]=t[0]*n+t[4]*s+t[12],i[1]=t[1]*n+t[5]*s+t[13],i[3]=t[3]*n+t[7]*s+t[15],i}const Yh=15;class my{constructor(e,t,n,s,l,c,h){this.tileSize=512,this._renderWorldCopies=l===void 0||l,this._minZoom=e||0,this._maxZoom=t||22,this._minPitch=n??0,this._maxPitch=s??60,this.setProjection(c),this.setMaxBounds(h),this.width=0,this.height=0,this._center=new Wt(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 dy,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Xm,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,this.mercatorMatrix=new Float64Array(16),this.mercatorFogMatrix=new Float32Array(16),this.invProjMatrix=new Float64Array(16),this._expandedFarZProjMatrixBuf=new Float64Array(16),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf,this.starsProjMatrix=new Float32Array(16),this.skyboxMatrix=new Float32Array(16),this._mat4Scratch=new Float64Array(16),this.alignedProjMatrix=new Float64Array(16),this.labelPlaneMatrix=new Float32Array(16),this.glCoordMatrix=new Float32Array(16),this.pixelMatrix=new Float64Array(16),this.pixelMatrixInverse=new Float64Array(16)}clone(){const e=new my(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForE
vendor: 1,403 bytes, line 7
7xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._nearClipOffset=this._nearClipOffset,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e._allowWorldUnderZoom=this._allowWorldUnderZoom,e}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Yh}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get nearClipOffset(){return this._nearClipOffset}set nearClipOffset(e){this._nearClipOffset=e,this._calcMatrices()}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(e,t=!1){const n=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
vendor: 52,511 bytes, lines 7-36
7xaggeration;(this._seaLevelZoom==null||n)&&this._updateCameraOnTerrain(),(e||n)&&this._constrainCamera(t),this._calcMatrices()}getProjection(){return rl(this.projection,["name","center","parallels"])}setProjection(e){this.projectionOptions=e||{name:"mercator"};const t=this.projection?this.getProjection():void 0;this.projection=im(this.projectionOptions);const n=!as(t,this.getProjection());return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){const e=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=im({name:"mercator"});const t=e!==this.projection.name;return t&&this._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return o(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Le(this.width,this.height)}get bearing(){return vn(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(e){const t=-e*Math.PI/180;if(this.angle===t)return;this._unmodified=!1,this.angle=t,this._calcMatrices();const n=Math.sin(this.angle),s=Math.cos(this.angle);this.rotationMatrix=[s,n,-n,s]}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const t=yt(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==t&&(this._unmodified=!1,this._pitch=t,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=Bt(e),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}get horizontalFov(){return Ur(2*Math.atan(Math.tan(.5*this._fov)*this.aspect))}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){const e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,t=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const n=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&n.exaggeration()&&this._centerAltitudeValidForExaggeration!==n.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*n.exaggeration(),this._centerAltitudeValidForExaggeration=n.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=n.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const e=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(e)}sampleAverageElevation(){if(!this._elevation)return 0;const e=this._elevation,t=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],n=this.horizonLineFromTop();let s=0,l=0;for(let c=0;c<t.length;c++){const h=new Le(t[c][0]*this.width,n+t[c][1]*(this.height-n)),p=e.pointCoordinate(h);if(!p)continue;const _=1/Math.hypot(p[0]-this._camera.position[0],p[1]-this._camera.position[1]);s+=p[3]*_,l+=_}return l===0?NaN:s/l}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const e=this._seaLevelZoom,t=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),n=this.pixelsPerMeter/this.worldSize*t,s=this._mercatorZfromZoom(e),l=this._mercatorZfromZoom(this._maxZoom),c=Math.max(s-n,l);this._setZoom(this._zoomFromMercatorZ(c))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}equals(e){const t=this.elevation,n=e.elevation,s=t!=null!=(n!=null)||t&&n&&t.exaggeration()!==n.exaggeration();return this.width===e.width&&this.height===e.height&&this.center.lng===e.center.lng&&this.center.lat===e.center.lat&&this.zoom===e.zoom&&this.bearing===e.bearing&&this.pitch===e.pitch&&this.fov===e.fov&&this.projection.name===e.projection.name&&this._edgeInsets.equals(e.padding)&&!s}computeZoomRelativeTo(e){const t=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,e.toAltitude()));let n;n=e.z<this._camera.position[2]?[t.x,t.y,t.z]:[e.x,e.y,e.z];const s=Xi(Li([],this._camera.position,n));return yt(this._zoomFromMercatorZ(s),this._minZoom,this._maxZoom)}setFreeCameraOptions(e){if(!this.height||!e.position&&!e.orientation)return;this._updateCameraState();let t=!1;if(e.orientation&&!((n=e.orientation)[0]===(s=this._camera.orientation)[0]&&n[1]===s[1]&&n[2]===s[2]&&n[3]===s[3])&&(t=this._setCameraOrientation(e.orientation)),e.position){const l=[e.position.x,e.position.y,e.position.z];ns(l,this._camera.position)||(this._setCameraPosition(l),t=!0)}var n,s;t&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const e=this._camera.position,t=new l1;return t.position=new E(e[0],e[1],e[2]),t.orientation=this._camera.orientation,t._elevation=this.elevation,t._renderWorldCopies=this.renderWorldCopies,t}_setCameraOrientation(e){if(!function(l){var c=l[0],h=l[1],p=l[2],_=l[3];return Math.sqrt(c*c+h*h+p*p+_*_)}(e))return!1;Ya(e,e);const t=da([],[0,0,-1],e),n=da([],[0,-1,0],e);if(n[2]<0)return!1;const s=a1(t,n);return!!s&&(this._camera.orientation=s,!0)}_setCameraPosition(e){const t=this.zoomScale(this.minZoom)*this.tileSize,n=this.zoomScale(this.maxZoom)*this.tileSize,s=this.cameraToCenterDistance;e[2]=yt(e[2],s/n,s/t),this._camera.position=e}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,n){this._unmodified=!1,this._edgeInsets.interpolate(e,t,n),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(e){const t=[new Qp(0,e)];if(this.renderWorldCopies){const n=this.pointCoordinate(new Le(0,0)),s=this.pointCoordinate(new Le(this.width,0)),l=this.pointCoordinate(new Le(this.width,this.height)),c=this.pointCoordinate(new Le(0,this.height)),h=Math.floor(Math.min(n.x,s.x,l.x,c.x)),p=Math.floor(Math.max(n.x,s.x,l.x,c.x)),_=1;for(let y=h-_;y<=p+_;y++)y!==0&&t.push(new Qp(y,e))}return t}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(e,t,n,s){let l=[];const c=n!=null,h=!c;if(h&&this.zoom<t||c&&n[0]===0&&n[1]===0)return l;const p=new Set,_=(v,b,T,S,A)=>{const C=Pc(b,v,T,S,A);p.has(C)||(l.push(new qr(v,b,T,S,A)),p.add(C))};for(let v=0;v<e.length;v++){const b=e[v];if(h&&b.canonical.z!==t||c&&s!==void 0&&s>b.canonical.z)continue;const T=b.canonical,S=b.overscaledZ,A=b.wrap,C=1<<T.z,D=T.x+1<C,F=T.x>0,O=T.y+1<C,z=T.y>0,N=b.wrap-(F?0:1),j=b.wrap+(D?0:1),te=F?T.x-1:C-1,G=D?T.x+1:0;if(c)n[0]<0?(_(S,j,T.z,G,T.y),n[1]<0&&O&&(_(S,A,T.z,T.x,T.y+1),_(S,j,T.z,G,T.y+1)),n[1]>0&&z&&(_(S,A,T.z,T.x,T.y-1),_(S,j,T.z,G,T.y-1))):n[0]>0?(_(S,N,T.z,te,T.y),n[1]<0&&O&&(_(S,A,T.z,T.x,T.y+1),_(S,N,T.z,te,T.y+1)),n[1]>0&&z&&(_(S,A,T.z,T.x,T.y-1),_(S,N,T.z,te,T.y-1))):n[1]<0&&O?_(S,A,T.z,T.x,T.y+1):z&&_(S,A,T.z,T.x,T.y-1);else{const W=b.visibleQuadrants;1&W&&(_(S,N,T.z,te,T.y),z&&(_(S,A,T.z,T.x,T.y-1),_(S,N,T.z,te,T.y-1))),2&W&&(_(S,j,T.z,G,T.y),z&&(_(S,A,T.z,T.x,T.y-1),_(S,j,T.z,G,T.y-1))),4&W&&(_(S,N,T.z,te,T.y),O&&(_(S,A,T.z,T.x,T.y+1),_(S,N,T.z,te,T.y+1))),8&W&&(_(S,j,T.z,G,T.y),O&&(_(S,A,T.z,T.x,T.y+1),_(S,j,T.z,G,T.y+1)))}}const y=[];for(const v of l)l.some(b=>v.isChildOf(b))||y.push(v);if(l=y.filter(v=>!e.some(b=>!!(v.overscaledZ<t&&b.isChildOf(v))||v.equals(b)||v.isChildOf(b))),h){const v=1<<t,b=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),T=[v*b.x,v*b.y],S=4,A=S*S;l=l.filter(C=>{const D=C.canonical.x+.5-T[0],F=C.canonical.y+.5-T[1];return D*D+F*F<A})}return l}extendTileCoverToNearPlane(e,t,n){const s=[],l=new Set;for(const F of e)l.add(F.key);const c=(F,O,z,N,j)=>{const te=Pc(O,F,z,N,j);l.has(te)||(s.push(new qr(F,O,z,N,j)),l.add(te))},h=e.reduce((F,O)=>Math.max(F,O.overscaledZ),n),p=1<<n,_=[new Le(0,0),new Le(We,0),new Le(We,We),new Le(0,We)],y=new Le(0,0),v=new Le(0,0),b=(F,O)=>{const z=Math.floor(F[0]),N=Math.floor(F[1]),j=(F[0]-z)*We,te=(F[1]-N)*We,G=Math.floor(O[0]),W=Math.floor(O[1]),K=(O[0]-G)*We,ee=(O[1]-W)*We;for(let le=-1;le<=1;le++){const de=z+le;if(!(de<0||de>=p)){y.x=j-le*We,v.x=K-(de-G)*We;for(let ve=-1;ve<=1;ve++){const xe=N+ve;y.y=te-ve*We,v.y=ee-(xe-W)*We,zh(y,v,_)&&c(h,0,n,de,xe)}}}},T=t.points,S=T[3],A=T[2],C=this._projectToGround(S,T[7]),D=this._projectToGround(A,T[6]);return b(S,C),b(A,D),s}_projectToGround(e,t){return Ws(Qt(),e,t,e[2]/(e[2]-t[2]))}_projectToZ(e,t,n){const s=e[2]-t[2];return Math.abs(s)<1e-6?Hs(e):Ws(Qt(),e,t,(e[2]-n)/s)}extendTileCoverForTunnels(e,t,n,s){if(n<18)return[];const l=t.points,c=l[0],h=l[1],p=l[4],_=l[5];if(p[2]>=0&&_[2]>=0||c[2]<=0||h[2]<=0)return[];const y=p[2]<0?this._projectToZ(c,p,0):p,v=_[2]<0?this._projectToZ(h,_,0):_,b=-s,T=p[2]<b?this._projectToZ(c,p,b):p,S=_[2]<b?this._projectToZ(h,_,b):_,A=this._findExtensionTilesInQuad(e,n,[S,T,v,y],[.5*(y[0]+v[0]),.5*(y[1]+v[1])]);return A.length>3&&(A.length=3),A}_findExtensionTilesInQuad(e,t,n,s){const l=[],c=new Set;for(const G of e)c.add(G.key);const h=e.reduce((G,W)=>Math.max(G,W.overscaledZ),t),p=1<<t,_=[new Le(n[0][0],n[0][1]),new Le(n[1][0],n[1][1]),new Le(n[3][0],n[3][1]),new Le(n[2][0],n[2][1]),new Le(n[0][0],n[0][1])],y=n[0][0],v=n[1][0],b=n[2][0],T=n[3][0],S=n[0][1],A=n[1][1],C=n[2][1],D=n[3][1],F=Math.max(0,Math.floor(Math.min(y,v,b,T))),O=Math.min(p-1,Math.ceil(Math.max(y,v,b,T))-1),z=Math.max(0,Math.floor(Math.min(S,A,C,D))),N=Math.min(p-1,Math.ceil(Math.max(S,A,C,D))-1);for(let G=z;G<=N;G++)for(let W=F;W<=O;W++){if(!X_(_,W,G,W+1,G+1))continue;const K=Pc(0,h,t,W,G);c.has(K)||(l.push(new qr(h,0,t,W,G)),c.add(K))}const j=s[0],te=s[1];return l.sort((G,W)=>{const K=G.canonical.x+.5-j,ee=G.canonical.y+.5-te,le=W.canonical.x+.5-j,de=W.canonical.y+.5-te;return K*K+ee*ee-(le*le+de*de)||G.canonical.x-W.canonical.x||G.canonical.y-W.canonical.y}),l}coveringTiles(e){let t=this.coveringZoomLevel(e);const n=t,s=this.elevation&&this.elevation.exaggeration(),l=s&&!e.isTerrainDEM,c=this.projection.name==="mercator";if(e.minzoom!==void 0&&t<e.minzoom)return[];e.maxzoom!==void 0&&t>e.maxzoom&&(t=e.maxzoom);const h=this.locationCoordinate(this.center),p=this.center.lat,_=1<<t,y=[_*h.x,_*h.y,0],v=this.projection.name==="globe",b=!v,T=Pl.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,b),S=v?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),A=_*o(1,this.center.lat),C=this._camera.position[2]/o(1,this.center.lat),D=[_*S.x,_*S.y,C*(b?1:A)],F=v||s,O=this.cameraToCenterDistance/e.tileSize*(e.roundZoom?1:.502),z=this.isLODDisabled(!0)?t:0;let N;if(this._elevation&&e.isTerrainDEM)N=1e4*this._elevation.exaggeration();else if(this._elevation){const se=this._elevation.getMinMaxForVisibleTiles();N=se?se.max:this._centerAltitude}else N=this._centerAltitude;const j=e.isTerrainDEM?-N:this._elevation?this._elevation.getMinElevationBelowMSL():0,te=this.projection.isReprojectedInTileSpace?Av(this):1,G=se=>{const ge=new E(se.x+25e-6,se.y,se.z),Se=new E(se.x,se.y+25e-6,se.z),Me=se.toLngLat(),Pe=ge.toLngLat(),Ie=Se.toLngLat(),Oe=this.locationCoordinate(Me),Be=this.locationCoordinate(Pe),Ke=this.locationCoordinate(Ie),Ne=Math.hypot(Be.x-Oe.x,Be.y-Oe.y),He=Math.hypot(Ke.x-Oe.x,Ke.y-Oe.y);return Math.sqrt(Ne*He)*te/25e-6},W=se=>{const pe=N,ge=j;return{aabb:bx(this,_,0,0,0,se,ge,pe,this.projection),zoom:0,x:0,y:0,minZ:ge,maxZ:pe,wrap:se,fullyVisible:!1}},K=[];let ee=[];const le=t,de=e.reparseOverscaled?n:t,ve=(C-this._centerAltitude)*A,xe=se=>{if(!this._elevation||!se.tileID||!c)return;const pe=this._elevation.getMinMaxForTile(se.tileID),ge=se.aabb;pe?(ge.min[2]=pe.min,ge.max[2]=pe.max,ge.center[2]=(ge.min[2]+ge.max[2])/2):(se.shouldSplit=Fe(se),se.shouldSplit||(ge.min[2]=ge.max[2]=ge.center[2]=this._centerAltitude))},we=(se,pe)=>{if(.707*pe<se)return 1;const ge=pe/se;return ge/(1.4144271570014144+(Math.pow(1.1,ge-1.4144271570014144+1)-1)/(1.1-1)-1)},Fe=se=>{if(se.zoom<z)return!0;if(se.zoom===le)return!1;if(se.shouldSplit!=null)return se.shouldSplit;const pe=se.aabb.distanceX(D),ge=se.aabb.distanceY(D);let Se=ve,Me=1;if(v){Se=se.aabb.distanceZ(D);const He=Math.pow(2,se.zoom),ft=wr((se.y+1)/He),pt=wr(se.y/He),xt=Math.min(Math.max(p,ft),pt),ht=r(xt)/r(p);if(Me=xt===p?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,ht/this._mercatorScaleRatio),this.zoom<=5&&se.zoom===le-1&&ht>=.9)return!0}else if(l&&(Se=se.aabb.distanceZ(D)*A),this.projection.isReprojectedInTileSpace&&n<=5){const He=Math.pow(2,se.zoom),ft=G(new E((se.x+.5)/He,(se.y+.5)/He));Me=ft>.85?1:ft}if(!c&&!v){const He=Math.sqrt(pe*pe+ge*ge+Se*Se);let ft=(1<<le-se.zoom)*O*Me;return ft*=we(Math.max(Se,ve),He),He<ft}let Pe=Number.MAX_VALUE,Ie=0;const Oe=se.aabb.getCorners(),Be=[0,0,0];for(const He of Oe){Li(Be,He,D),v||(l?Be[2]*=A:Be[2]=ve);const ft=Di(Be,this._camera.forward());ft<Pe&&(Pe=ft,Ie=Math.abs(Be[2]))}let Ke=(1<<le-se.zoom)*O*Me;if(Ke*=we(Math.max(Ie,ve),Pe),Pe<Ke)return!0;const Ne=se.aabb.closestPoint(y);return Ne[0]===y[0]&&Ne[1]===y[1]};if(this.renderWorldCopies)for(let se=1;se<=3;se++)K.push(W(-se)),K.push(W(se));for(K.push(W(0));K.length>0;){const se=K.pop(),pe=se.x,ge=se.y;let Se=se.fullyVisible;const Me=()=>this.projection.name==="globe"&&(se.y===0||se.y===(1<<se.zoom)-1);if(!Se){let Pe=F?se.aabb.intersects(T):se.aabb.intersectsFlat(T);if(Pe===0&&Me()){const Ie=new Rc(se.zoom,pe,ge);Pe=ag(this,_,Ie,!0).intersects(T)}if(Pe===0)continue;Se=Pe===2}if(se.zoom===le||!Fe(se)){const Pe=se.zoom===le?de:se.zoom;if(e.minzoom&&e.minzoom>Pe)continue;let Ie=0;if(!Se){let Ne=F?se.aabb.intersectsPrecise(T):se.aabb.intersectsPreciseFlat(T);if(Ne===0&&Me()){const He=new Rc(se.zoom,pe,ge);Ne=ag(this,_,He,!0).intersectsPrecise(T)}if(Ne===0)continue;if(e.calculateQuadrantVisibility)if(T.containsPoint(se.aabb.center))Ie=15;else for(let He=0;He<4;He++)se.aabb.quadrant(He).intersects(T)!==0&&(Ie|=1<<He)}const Oe=y[0]-(.5+pe+(se.wrap<<se.zoom))*(1<<t-se.zoom),Be=y[1]-.5-ge,Ke=se.tileID?se.tileID:new qr(Pe,se.wrap,se.zoom,pe,ge);e.calculateQuadrantVisibility&&(Ke.visibleQuadrants=Ie),ee.push({tileID:Ke,distanceSq:Oe*Oe+Be*Be});continue}for(let Pe=0;Pe<4;Pe++){const Ie=(pe<<1)+Pe%2,Oe=(ge<<1)+(Pe>>1),Be={aabb:c?se.aabb.quadrant(Pe):bx(this,_,se.zoom+1,Ie,Oe,se.wrap,se.minZ,se.maxZ,this.projection),zoom:se.zoom+1,x:Ie,y:Oe,wrap:se.wrap,fullyVisible:Se,tileID:void 0,shouldSplit:void 0,minZ:se.minZ,maxZ:se.maxZ};l&&!v&&(Be.tileID=new qr(se.zoom+1===le?de:se.zoom+1,se.wrap,se.zoom+1,Ie,Oe),xe(Be)),K.push(Be)}}if(this.fogCullDistSq){const se=this.fogCullDistSq,pe=this.horizonLineFromTop();ee=ee.filter(ge=>{const Se=[0,0,0,1],Me=[We,We,0,1],Pe=this.calculateFogTileMatrix(ge.tileID.toUnwrapped());ar(Se,Se,Pe),ar(Me,Me,Pe);const Ie=(Ne=Se,He=Me,(Ke=[])[0]=Math.min(Ne[0],He[0]),Ke[1]=Math.min(Ne[1],He[1]),Ke[2]=Math.min(Ne[2],He[2]),Ke[3]=Math.min(Ne[3],He[3]),Ke),Oe=function(xt,ht,wt){return xt[0]=Math.max(ht[0],wt[0]),xt[1]=Math.max(ht[1],wt[1]),xt[2]=Math.max(ht[2],wt[2]),xt[3]=Math.max(ht[3],wt[3]),xt}([],Se,Me),Be=function(xt,ht){let wt=0;for(let vt=0;vt<2;++vt)xt[vt]>0&&(wt+=(xt[vt]-0)*(xt[vt]-0)),ht[vt]<0&&(wt+=(0-ht[vt])*(0-ht[vt]));return wt}(Ie,Oe);var Ke,Ne,He;if(Be===0)return!0;let ft=!1;const pt=this._elevation;if(pt&&Be>se&&pe!==0){const xt=this.calculateProjMatrix(ge.tileID.toUnwrapped());let ht;e.isTerrainDEM||(ht=pt.getMinMaxForTile(ge.tileID)),ht||(ht={min:j,max:N});const wt=function(ri){const Gt=Math.round((ri+45+360)%360/90)%4;return il[Gt]}(this.rotation),vt=[wt[0]*We,wt[1]*We,ht.max];hi(vt,vt,xt),ft=(1-vt[1])*this.height*.5<pe}return Be<se||ft})}return ee.sort((se,pe)=>se.distanceSq-pe.distanceSq).map(se=>se.tileID)}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log2(e)}project(e){const t=yt(e.lat,-85.051129,f),n=this.projection.project(e.lng,t);return new Le(n.x*this.worldSize,n.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/o(1,this.center.lat)/this.worldSize}setLocationAtPoint(e,t){let n,s;const l=this.centerPoint;if(this.projection.name==="globe"){const h=this.worldSize;n=(t.x-l.x)/h,s=(t.y-l.y)/h}else{const h=this.pointCoordinate(t),p=this.pointCoordinate(l);n=h.x-p.x,s=h.y-p.y}const c=this.locationCoordinate(e);this.setLocation(new E(c.x-n,c.y-s))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e,t){return this.projection.locationPoint(this,e,t)}locationPoint3D(e,t){return this.projection.locationPoint(this,e,t,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e,t){return this.coordinateLocation(this.pointCoordinate3D(e,t))}locationCoordinate(e,t){const n=t?o(t,e.lat):void 0,s=this.projection.project(e.lng,e.lat);return new E(s.x,s.y,n)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(e,t){const n=t??this._centerAltitude,s=[e.x,e.y,0,1],l=[e.x,e.y,1,1];ar(s,s,this.pixelMatrixInverse),ar(l,l,this.pixelMatrixInverse);const c=l[3];Vo(s,s,1/s[3]),Vo(l,l,1/c);const h=s[2],p=l[2];return{p0:s,p1:l,t:h===p?0:(n-h)/(p-h)}}screenPointToMercatorRay(e){const t=[e.x,e.y,0,1],n=[e.x,e.y,1,1];return ar(t,t,this.pixelMatrixInverse),ar(n,n,this.pixelMatrixInverse),Vo(t,t,1/t[3]),Vo(n,n,1/n[3]),t[2]=o(t[2],this._center.lat)*this.worldSize,n[2]=o(n[2],this._center.lat)*this.worldSize,Vo(t,t,1/this.worldSize),Vo(n,n,1/this.worldSize),new qp([t[0],t[1],t[2]],ti([],Li([],n,t)))}rayIntersectionCoordinate(e){const{p0:t,p1:n,t:s}=e,l=o(t[2],this._center.lat),c=o(n[2],this._center.lat);return new E(lt(t[0],n[0],s)/this.worldSize,lt(t[1],n[1],s)/this.worldSize,lt(l,c,s))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(e,t){if(!this.elevation)return this.pointCoordinate(e,t);let n=this.projection.pointCoordinate3D(this,e.x,e.y);if(n)return new E(n[0],n[1],n[2]);let s=0,l=this.horizonLineFromTop();if(e.y>l)return this.pointCoordinate(e,t);const c=.02*l,h=e.clone();for(let p=0;p<10&&l-s>c;p++){h.y=lt(s,l,.66);const _=this.projection.pointCoordinate3D(this,h.x,h.y);_?(l=h.y,n=_):s=h.y}return n?new E(n[0],n[1],n[2]):this.pointCoordinate(e)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(e){if(e.y<0||e.y>this.height||e.x<0||e.x>this.width)return!1;if(this.elevation||this.zoom>=6)return!this.isPointAboveHorizon(e);const t=this.pointCoordinate(e);return t.y>=0&&t.y<=1}_coordinatePoint(e,t){const n=t&&this.elevation?this.elevation.getAtPointOrZero(e,this._centerAltitude):this._centerAltitude,s=[e.x*this.worldSize,e.y*this.worldSize,n+e.toAltitude(),1];return ar(s,s,this.pixelMatrix),s[3]>0?new Le(s[0]/s[3],s[1]/s[3]):new Le(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:e,left:t}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,l=this.pointLocation3D(new Le(t,e)),c=this.pointLocation3D(new Le(s,e)),h=this.pointLocation3D(new Le(s,n)),p=this.pointLocation3D(new Le(t,n));let _=Math.min(l.lng,c.lng,h.lng,p.lng),y=Math.max(l.lng,c.lng,h.lng,p.lng),v=Math.min(l.lat,c.lat,h.lat,p.lat),b=Math.max(l.lat,c.lat,h.lat,p.lat);const T=Math.pow(2,-this.zoom)/16*270,S=this.projection.name==="globe"?1:4,A=(C,D,F,O,z)=>{const N=(C+F)/2,j=(D+O)/2,te=new Le(N,j),{lng:G,lat:W}=this.pointLocation3D(te),K=Math.max(0,_-G,v-W,G-y,W-b);_=Math.min(_,G),y=Math.max(y,G),v=Math.min(v,W),b=Math.max(b,W),(z<S||K>T)&&(A(C,D,N,j,z+1),A(N,j,F,O,z+1))};if(A(t,e,s,e,1),A(s,e,s,n,1),A(s,n,t,n,1),A(t,n,t,e,1),this.projection.name==="globe"){const[C,D]=function(F){const O=er(new Float64Array(16));zt(O,F.pixelMatrix,F.globeMatrix);const z=[0,Yo,0],N=[0,Ko,0];return hi(z,z,O),hi(N,N,O),[z[0]>0&&z[0]<=F.width&&z[1]>0&&z[1]<=F.height&&!hg(F,new Wt(F.center.lat,90)),N[0]>0&&N[0]<=F.width&&N[1]>0&&N[1]<=F.height&&!hg(F,new Wt(F.center.lat,-90))]}(this);C?(b=90,y=180,_=-180):D&&(v=-90,y=180,_=-180)}return new a(new Wt(_,v),new Wt(y,b))}_getBoundsRectangular(e,t){const{top:n,left:s}=this._edgeInsets,l=this.height-this._edgeInsets.bottom,c=this.width-this._edgeInsets.right,h=new Le(s,n),p=new Le(c,n),_=new Le(c,l),y=new Le(s,l);let v=this.pointCoordinate(h,e),b=this.pointCoordinate(p,e);const T=this.pointCoordinate(_,t),S=this.pointCoordinate(y,t),A=(C,D)=>(D.y-C.y)/(D.x-C.x);return v.y>1&&b.y>=0?v=new E((1-S.y)/A(S,v)+S.x,1):v.y<0&&b.y<=1&&(v=new E(-S.y/A(S,v)+S.x,0)),b.y>1&&v.y>=0?b=new E((1-T.y)/A(T,b)+T.x,1):b.y<0&&v.y<=1&&(b=new E(-T.y/A(T,b)+T.x,0)),new a().extend(this.coordinateLocation(v)).extend(this.coordinateLocation(b)).extend(this.coordinateLocation(S)).extend(this.coordinateLocation(T))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce((n,s)=>{if(s.dem){const l=s.dem.tree;n.min=Math.min(n.min,l.minimums[0]),n.max=Math.max(n.max,l.maximums[0])}return n},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,n=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,n):n}getMaxBounds(){return this.maxBounds}setMaxBounds(e){this.maxBounds=e,this.minLat=-85.051129,this.maxLat=f,this.minLng=-180,this.maxLng=180,e&&(this.minLat=e.getSouth(),this.maxLat=e.getNorth(),this.minLng=e.getWest(),this.maxLng=e.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=po(this.minLng)*this.tileSize,this.worldMaxX=po(this.maxLng)*this.tileSize,this.worldMinY=$n(this.maxLat)*this.tileSize,this.worldMaxY=$n(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,t){return this.projection.createTileMatrix(this,t,e)}calculateDistanceTileData(e){const t=e.key,n=this._distanceTileDataCache;if(n[t])return n[t];const s=e.canonical,l=1/this.height,c=this.cameraWorldSize,h=c/this.zoomScale(s.z),p=(s.x+Math.pow(2,s.z)*e.wrap)*h,_=s.y*h,y=this.point;y.x*=c/this.worldSize,y.y*=c/this.worldSize;const v=this.angle,b=Math.sin(-v),T=-Math.cos(-v);return n[t]={bearing:[b,T],center:[(y.x-p)*l,(y.y-_)*l],scale:h/We*l},n[t]}calculateFogTileMatrix(e){const t=e.key,n=this._fogTileMatrixCache;if(n[t])return n[t];const s=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,e);return zt(s,this.worldToFogMatrix,s),n[t]=new Float32Array(s),n[t]}calculateProjMatrix(e,t=!1,n=!1){const s=e.key;let l;if(l=n?this._expandedProjMatrixCache:t?this._alignedProjMatrixCache:this._projMatrixCache,l[s])return l[s];const c=this.calculatePosMatrix(e,this.worldSize);let h;return h=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:n?this.expandedFarZProjMatrix:t?this.alignedProjMatrix:this.projMatrix,zt(c,h,c),l[s]=new Float32Array(c),l[s]}calculatePixelsToTileUnitsMatrix(e){const t=e.tileID.key,n=this._pixelsToTileUnitsCache;if(n[t])return n[t];const s=function(l,c){const{scale:h}=l.tileTransform,p=h*We/(l.tileSize*Math.pow(2,c.zoom-l.tileID.overscaledZ+l.tileID.canonical.z)),_=c.inverseAdjustmentMatrix;return new Float32Array([_[0]*p,_[1]*p,_[2]*p,_[3]*p])}(e,this);return n[t]=s,n[t]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const e=1/this.worldSize,t=No([],[e,e,e]);return zt(t,t,this.globeMatrix),t}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const e=this._elevation;this._updateCameraState();const t=o(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(t),s=this._camera.forward(),l=o(1,this._center.lat);n[2]/=l,s[2]/=l,ti(s,s);const c=e.raycast(n,s,e.exaggeration());if(c){const h=cn([],n,s,c),p=new E(h[0],h[1],o(h[2],wr(h[1]))),_=(p.z+Xi([p.x-n[0],p.y-n[1],p.z-n[2]*l]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(_),this._centerAltitude=p.toAltitude(),this._center=this.coordinateLocation(p),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(e=!1){if(!this._elevation)return;const t=this._elevation,n=o(1,this._center.lat)*this.worldSize,s=this._computeCameraPosition(n),l=t.getAtPointOrZero(new E(...s)),c=this.pixelsPerMeter/this.worldSize*l,h=this._minimumHeightOverTerrain(),p=s[2]-c;if(p<=h)if(p<0||e){const _=this.locationCoordinate(this._center,this._centerAltitude),y=[s[0],s[1],_.z-s[2]],v=Xi(y);y[2]-=(h-p)/this._pixelsPerMercatorPixel;const b=Xi(y);if(b===0)return;oi(y,y,v/b*this._pixelsPerMercatorPixel),this._camera.position=[s[0],s[1],_.z*this._pixelsPerMercatorPixel-y[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const e=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||e){const b=this.center;return b.lat=yt(b.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!e)&&(b.lng=yt(b.lng,this.minLng,this.maxLng)),this.center=b,void(this._constraining=!1)}const t=this._unmodified,{x:n,y:s}=this.point;let l=0,c=n,h=s;const p=this.width/2,_=this.height/2,y=this.worldMinY*this.scale,v=this.worldMaxY*this.scale;if(s-_<y&&(h=y+_),s+_>v&&(h=v-_),v-y<this.height&&(l=Math.max(l,this.height/(v-y)),h=(v+y)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const b=this.worldMinX*this.scale,T=this.worldMaxX*this.scale,S=this.worldSize/2-(b+T)/2;c=(n+S+this.worldSize)%this.worldSize-S,c-p<b&&(c=b+p),c+p>T&&(c=T-p),T-b<this.width&&(l=Math.max(l,this.width/(T-b)),c=(T+b)/2)}c===n&&h===s||this._allowWorldUnderZoom||(this.center=this.unproject(new Le(c,h))),l&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(l)),this._constrainCamera(),this._unmodified=t,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,t=this.projection.name==="globe",n=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=o(1,this.center.lat)/o(1,45));const s=Tf(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;const l=this.projection.zAxisUnit==="meters"?n:1,c=this._camera.getWorldToCamera(this.worldSize,l);let h;const p=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(p[8]=2*-e.x/this.width,p[9]=2*e.y/this.height,this.isOrthographic){let N=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),j=N*this.aspect,te=-j,G=-N;j-=e.x,te-=e.x,N+=e.y,G+=e.y,h=this._camera.getCameraToClipOrthographic(te,j,G,N,this._nearZ+this._nearClipOffset,this._farZ),((W,K,ee,le)=>{for(let de=0;de<16;de++)W[de]=lt(K[de],ee[de],le)})(h,h,p,Jc(this.pitch>=Yh?1:this.pitch/Yh))}else h=p;const _=Wa([],p,c),y=Wa([],h,c);if(this.projection.isReprojectedInTileSpace){const N=this.locationCoordinate(this.center);er(this._mat4Scratch);const j=this._mat4Scratch;Wi(j,j,[N.x*this.worldSize,N.y*this.worldSize,0]),zt(j,j,Iv(this)),Wi(j,j,[-N.x*this.worldSize,-N.y*this.worldSize,0]),zt(y,y,j),zt(_,_,j),this.inverseAdjustmentMatrix=function(te){const G=Iv(te,!0);return Vc([],[G[0],G[1],G[4],G[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(mr(this.mercatorMatrix,y,[this.worldSize,this.worldSize,this.worldSize/l,1]),this.projMatrix=y,xn(this.invProjMatrix,this.projMatrix),t){const N=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);N[8]=2*-e.x/this.width,N[9]=2*e.y/this.height,Wa(this._expandedFarZProjMatrixBuf,N,c),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf}else this.expandedFarZProjMatrix=this.projMatrix;xn(this._mat4Scratch,h),this.frustumCorners=ng.fromInvProjectionMatrix(this._mat4Scratch,this.horizonLineFromTop(),this.height),this.cameraFrustum=Pl.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!t),No(this.skyboxMatrix,[1,-1,1]),Is(this.skyboxMatrix,this.skyboxMatrix,this._pitch),js(this.skyboxMatrix,this.skyboxMatrix,this.angle),Gl(this.starsProjMatrix,this._fov,this.width/this.height,this._nearZ,this._farZ);const v=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;Uc(this._mat4Scratch,this.starsProjMatrix),this._mat4Scratch[8]=2*-e.x/this.width,this._mat4Scratch[9]=2*(e.y+v)/this.height,zt(this.skyboxMatrix,this._mat4Scratch,this.skyboxMatrix);const b=this.point,T=b.x,S=b.y,A=this.width%2/2,C=this.height%2/2,D=Math.cos(this.angle),F=Math.sin(this.angle),O=T-Math.round(T)+D*A+F*C,z=S-Math.round(S)+D*C+F*A;if(Uc(this.alignedProjMatrix,y),Wi(this.alignedProjMatrix,this.alignedProjMatrix,[O>.5?O-1:O,z>.5?z-1:z,0]),No(this.labelPlaneMatrix,[this.width/2,-this.height/2,1]),Wi(this.labelPlaneMatrix,this.labelPlaneMatrix,[1,-1,0]),No(this.glCoordMatrix,[1,-1,1]),Wi(this.glCoordMatrix,this.glCoordMatrix,[-1,-1,0]),mr(this.glCoordMatrix,this.glCoordMatrix,[2/this.width,2/this.height,1]),zt(this.pixelMatrix,this.labelPlaneMatrix,_),this._calcFogMatrices(),this._distanceTileDataCache={},!xn(this.pixelMatrixInverse,this.pixelMatrix))throw new Error("failed to invert matrix");if(this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=function(j){const{x:te,y:G}=j.point,{lng:W,lat:K}=j._center;return _x(te,G,j.worldSize,W,K)}(this);const N=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=hi(N,N,c),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=this.pixelMatrixInverse;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const e=this.cameraWorldSizeForFog,t=this.cameraPixelsPerMeter,n=this._camera.position,s=1/this.height/this._pixelsPerMercatorPixel,l=[e,e,t];oi(l,l,s),oi(n,n,-1),jc(n,n,l),Gs(this.mercatorFogMatrix,n),mr(this.mercatorFogMatrix,this.mercatorFogMatrix,l),this.worldToFogMatrix=this._camera.getWorldToCameraPosition(e,t,s)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,n=this._camera.forward(),s=this.point,l=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[s.x/this.worldSize-n[0]*l,s.y/this.worldSize-n[1]*l,e/this.worldSize*this._centerAltitude-n[2]*l]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(e){const t=this._maxCameraBoundsDistance()*Math.cos(this._pitch),n=this._camera.position[2],s=e[2];let l=1;this.projection.wrap&&(this.center=this.center.wrap()),s>0&&(l=Math.min((t-n)/s,1)),this._camera.position=cn([],this._camera.position,e,l),this._updateStateFromCamera()}_updateStateFromCamera(){const e=this._camera.position,t=this._camera.forward(),{pitch:n,bearing:s}=this._camera.getPitchBearing(),l=o(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,c=this._mercatorZfromZoom(this._maxZoom)*Math.cos(Bt(this._maxPitch)),h=Math.max((e[2]-l)/Math.cos(n),c),p=this._zoomFromMercatorZ(h);cn(e,e,t,h),this._pitch=yt(n,Bt(this.minPitch),Bt(this.maxPitch)),this.angle=vn(s,-Math.PI,Math.PI),this._setZoom(yt(p,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new E(e[0],e[1],e[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(this._seaLevelZoom??this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,e)*this.tileSize))}zoomFromMercatorZAdjusted(e){let t=0,n=6,s=0,l=1/0;for(;n-t>1e-6&&n>t;){const c=t+.5*(n-t),h=this.tileSize*Math.pow(2,c),p=this.getCameraToCenterDistance(this.projection,c,h),_=this.scaleZoom(p/(Math.max(0,e)*this.tileSize)),y=Math.abs(c-_);y<l&&(l=y,s=c),c<_?t=c:n=c}return s}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(gi("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(e,t){const n=Math.min(e.x,t.x),s=Math.max(e.x,t.x),l=Math.min(e.y,t.y),c=Math.max(e.y,t.y);if(l<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const h=[new Le(n,l),new Le(s,c),new Le(n,c),new Le(s,l)],p=this.renderWorldCopies?-3:0,_=this.renderWorldCopies?4:1;for(const y of h){const v=this.pointRayIntersection(y);if(v.t<0)return!0;const b=this.rayIntersectionCoordinate(v);if(b.x<p||b.y<0||b.x>_||b.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+Ur(this.fovAboveCenter)>88||this.anyCornerOffEdge(new Le(0,0),new Le(this.width,this.height))}zoomDeltaToMovement(e,t){const n=Xi(Li([],this._camera.position,e)),s=this._zoomFromMercatorZ(n)+t;return n-this._mercatorZfromZoom(s)}getCameraPoint(){if(this.projection.name==="globe"){const e=function([t,n,s],l){const c=[t,n,s,1];ar(c,c,l);const h=c[3]=Math.max(c[3],1e-6);return c[0]/=h,c[1]/=h,c[2]/=h,c}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new Le(e[0],e[1])}{const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Le(0,e))}}getCameraToCenterDistance(e,t=this.zoom,n=this.worldSize){const s=Tf(e,t,this.width,this.height,1024),l=e.pixelSpaceConversion(this.center.lat,n,s);let c=.5/Math.tan(.5*this._fov)*this.height*l;return this.isOrthographic&&(c=lt(1,c,Jc(this.pitch>=Yh?1:this.pitch/Yh))),c}getWorldToCameraMatrix(){const e=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&zt(e,e,this.globeMatrix),e}getFrustum(e){return Pl.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,e,this.projection.zAxisUnit==="meters")}}const Kh=(i,e)=>{if(e<=0||i.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const t=i.transform,n=t.pitch,s=t.isLODDisabled(!1)?60:30;if(n<s-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const l=t._farZ-t._nearZ,c=e*t.height*1.3,h=Math.pow(2,.85*Math.max(t._zoom-i.minCutoffZoom,0)),p=1.4*t.cameraToCenterDistance*h,_=ls(s-15,s,n),y=lt(t._farZ+c,p,_),v=Math.min(c,y-t._nearZ);return{shouldRenderCutoff:_>0,uniformValues:{u_cutoff_params:[t._nearZ,t._farZ,(y-t._nearZ)/l,(y-v-t._nearZ)/l]}}},zf=.05;function Km(i,e,t){const n=ls(45,65,t),[s,l]=i.range;let c=1-Math.min(1,Math.exp((e-s)/(l-s)*-6));return c*=c*c,c=Math.min(1,1.00747*c),c*n*i.alpha}function g1(i,e,t,n,s){return Km(i,Xi(hi([],[e,t,n],s.mercatorFogMatrix)),s.pitch)}function _y(i,e,t,n){const s=1<<i.z;e.lat=wr((n/We+i.y)/s),e.lng=qn((t/We+i.x)/s)}const y1=(i,e,t=1)=>({u_matrix:i,u_color:e,u_overlay:0,u_overlay_scale:t}),ja=new Float64Array(16),Bc=new Float64Array(16),x1=new Float64Array(16),gy=new Float64Array(16),yy=new Float64Array(16),Jm=new Float64Array(16),LE=new Float64Array(16),Qm=[0,0,0],zE=new Float32Array(16),e_=[0,0,0],FE=[0,0,0],xy=[];function v1(i,e,t){const n=t.cameraWorldSizeForFog/t.worldSize;return mr(i,t.worldToFogMatrix,[n,n,1]),zt(i,i,e),i}function Ff(i,e,t,n){return Wi(i,e,t),ns(n,OT)||mr(i,i,n),i}function vy(i,e,t,n,s){const l=t.material,c=n.context,{baseColorTexture:h,metallicRoughnessTexture:p}=l.pbrMetallicRoughness,{normalTexture:_,occlusionTexture:y,emissionTexture:v}=l;function b(S,A,C){if(S&&(i.push(A),c.activeTexture.set(c.gl.TEXTURE0+C),S.gfxTexture)){const{minFilter:D,magFilter:F,wrapS:O,wrapT:z}=S.sampler;S.gfxTexture.bindExtraParam(D,F,O,z)}}b(h,"HAS_TEXTURE_u_baseColorTexture",Yn.BaseColor),b(p,"HAS_TEXTURE_u_metallicRoughnessTexture",Yn.MetallicRoughness),b(_,"HAS_TEXTURE_u_normalTexture",Yn.Normal),b(y,"HAS_TEXTURE_u_occlusionTexture",Yn.Occlusion),b(v,"HAS_TEXTURE_u_emissionTexture",Yn.Emission),s&&(s.texture||(s.texture=new Ox(n.context,s.image,[s.image.height,s.image.height,s.image.height],c.gl.RGBA8)),c.activeTexture.set(c.gl.TEXTURE0+Yn.LUT),s.texture&&s.texture.bind(c.gl.LINEAR,c.gl.CLAMP_TO_EDGE),i.push("APPLY_LUT_ON_GPU")),t.texcoordBuffer&&(i.push("HAS_ATTRIBUTE_a_uv_2f"),e.push(t.texcoordBuffer)),t.colorBuffer&&(i.push(t.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),e.push(t.colorBuffer)),t.normalBuffer&&(i.push("HAS_ATTRIBUTE_a_normal_3f"),e.push(t.normalBuffer)),t.pbrBuffer&&(i.push("HAS_ATTRIBUTE_a_pbr"),i.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),e.push(t.pbrBuffer)),l.alphaMode!=="OPAQUE"&&l.alphaMode!=="MASK"||i.push("UNPREMULT_TEXTURE_IN_SHADER"),l.defined||i.push("DIFFUSE_SHADED");const T=n.shadowRenderer;T&&(i.push("RENDER_SHADOWS"),T.useNormalOffset&&i.push("NORMAL_OFFSET"))}function by(i,e,t,n,s,l){const c=i.modelOpacity,h=e.context,p=new mn(e.context.gl.LEQUAL,i.isLightMesh?mn.ReadOnly:mn.ReadWrite,e.depthRangeFor3D),_=e.transform,y=i.mesh,v=y.material,b=v.pbrMetallicRoughness,T=e.style.fog;e.transform.projection.zAxisUnit==="pixels"?ja.set(i.nodeModelMatrix):zt(ja,n.zScaleMatrix,i.nodeModelMatrix),zt(ja,n.negCameraPosMatrix,ja),xn(Bc,ja),Ul(Bc,Bc);const S=t.paint.get("model-color-use-theme").constantOr("default")==="none",A=t.paint.get("model-emissive-strength").constantOr(0),C={defines:[]},D=[],F=e.shadowRenderer;F&&(F.useNormalOffset=!1),vy(C.defines,D,y,e,S?null:t.lut);let O=null;if(T&&(O=v1(x1,i.nodeModelMatrix,e.transform),_.projection.name!=="globe")){const te=y.aabb.min,G=y.aabb.max,[W,K]=T.getOpacityForBounds(O,te[0],te[1],G[0],G[1]);C.overrideFog=W>=zf||K>=zf}const z=Kh(e,t.paint.get("model-cutoff-fade-range"));z.shouldRenderCutoff&&C.defines.push("RENDER_CUTOFF");const N=e.getOrCreateProgram("model",C),j=ly(i.worldViewProjection,ja,Bc,null,e,c,b.baseColorFactor,v.emissiveFactor,b.metallicFactor,b.roughnessFactor,v,A,t,void 0,void 0,i.materialOverride,i.modelColor,1,N.fixedDefines.includes("LIGHTING_3D_MODE"));e.uploadCommonUniforms(h,N,null,O,z,i.lightOverrides),e.renderPass!=="shadow"&&F&&F.setupShadowsFromMatrix(i.nodeModelMatrix,N),N.draw(e,h.gl.TRIANGLES,p,s,l,y.material.doubleSided?_n.disabled:_n.backCCW,j,t.id,y.vertexBuffer,y.indexBuffer,y.segments,t.paint,e.transform.zoom,void 0,D)}function b1(i,e){return i.style._importedAsBasemap?"basemap":e.scope}function wy(i,e,t,n,s,l,c,h,p,_,y){const v=i.transform,b=!!e.isGeometryBloom&&e.isGeometryBloom;if(e.minZoom!==void 0&&i.transform.zoom<e.minZoom||e.maxZoom!==void 0&&i.transform.zoom>e.maxZoom||b&&i.renderPass==="shadow")return;const T=v.projection.name==="globe"?Cm(t,v):[...t];zt(T,T,e.globalMatrix);const S=zt([],n,T);if(e.meshes)for(const A of e.meshes){const C=h.get(A.material.name);if(C&&C.opacity<=0)continue;if(A.material.alphaMode!=="BLEND"){c.push({mesh:A,depth:0,modelIndex:s,worldViewProjection:S,nodeModelMatrix:T,isLightMesh:b,materialOverride:C,modelOpacity:p,modelColor:_,lightOverrides:y,node:e,modelMatrix:t});continue}const D=hi([],A.centroid,S);!v.isOrthographic&&D[2]<=0||l.push({mesh:A,depth:D[2],modelIndex:s,worldViewProjection:S,nodeModelMatrix:T,isLightMesh:b,materialOverride:C,modelOpacity:p,modelColor:_,lightOverrides:y,node:e,modelMatrix:t})}if(e.children)for(const A of e.children)wy(i,A,t,n,s,l,c,h,p,_,y)}function Of(i,e,t,n,s){const l=t.shadowRenderer;if(!l)return;const c=l.getShadowPassDepthMode(),h=s||l.calculateShadowPassMatrixFromMatrix(e),p=o1(h);t.getOrCreateProgram("modelDepth").draw(t,t.context.gl.TRIANGLES,c,bs.disabled,Qi.disabled,_n.disabled,p,n.id,i.vertexBuffer,i.indexBuffer,i.segments,n.paint,t.transform.zoom,void 0,void 0)}function w1(i,e,t,n){const s=function(y,v){if(v.footprintDebugMesh)return v.footprintDebugMesh;if(!v.footprint)return null;const b=y.context,T=v.footprint.vertices,S=v.footprint.indices,A=new fe;A.reserve(T.length);for(const K of T)A.emplaceBack(K.x,K.y);const C=new bt;C.reserve(S.length);for(let K=0;K<S.length;K+=3)C.emplaceBack(S[K],S[K+1],S[K+2]);const D=b.createVertexBuffer(A,rg.members),F=b.createIndexBuffer(C),O=fi.simpleSegment(0,0,T.length,S.length),z=v.id||v.name||"footprint";let N;const j=parseInt(z,10);N=isNaN(j)?function(K){let ee=0;for(let le=0;le<K.length;le++)ee=(ee<<5)-ee+K.charCodeAt(le)|0;return ee}(z):j;const te=ec(N),G=ec(N+1),W=ec(N+2);return v.footprintDebugMesh={vertexBuffer:D,indexBuffer:F,segments:O,color:new Lt(te,G,W,.5)},v.footprintDebugMesh}(i,t);if(!s)return;const l=i.context,c=l.gl,h=i.getOrCreateProgram("debug"),p=s.color,_=mn.disabled;l.activeTexture.set(c.TEXTURE0),i.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),h.draw(i,c.TRIANGLES,_,bs.disabled,Qi.alphaBlended,_n.disabled,y1(n,p.toPremultipliedRenderColor(null)),"$debug",s.vertexBuffer,s.indexBuffer,s.segments)}function OE(i,e,t,n,s,l){for(const c of s){const h={...n};h.part=c;const p={type:"Unknown",id:e,properties:h},_={orientation:i.paint.get("model-rotation").evaluate(p,t)};l.set(c,_)}}function BE(i,e,t,n,s,l){for(const c of s){const h={...n};h.part=c;const p={type:"Unknown",id:e,properties:h},_={color:i.paint.get("model-color").evaluate(p,t),colorMix:i.paint.get("model-color-mix-intensity").evaluate(p,t),opacity:i.paint.get("model-opacity").evaluate(p,t),emissionStrength:i.paint.get("model-emissive-strength").evaluate(p,t)};l.set(c,_)}}function T1(i,e,t,n,s){let l=!1;for(const h of n)h.modelOpacity!==1&&(by(h,i,e,s[h.modelIndex],bs.disabled,Qi.disabled),l=!0);for(const h of n)by(h,i,e,s[h.modelIndex],h.modelOpacity!==1?i.stencilModeFor3D():bs.disabled,i.colorModeForRenderPass());l&&i.resetStencilClippingMasks();const c=Qi.additive;for(const h of t)by(h,i,e,s[h.modelIndex],bs.disabled,h.isLightMesh?c:i.colorModeForRenderPass())}function kE(i,e,t){const n=e.updateZoomBasedPaintProperties(),s=function(l,c,h){let p,_,y,v=l.terrain?l.terrain.exaggeration():0;if(l.terrain&&v>0){const b=l.terrain,T=b.findDEMTileFor(h);T&&T.dem?p=Wh.create(b,h,T):v=0}if(v===0&&(c.terrainElevationMin=0,c.terrainElevationMax=0),v===c.validForExaggeration&&(v===0||p&&p._demTile&&p._demTile.tileID===c.validForDEMTile.id&&p._dem._timestamp===c.validForDEMTile.timestamp))return!1;for(const b in c.instancesPerModel){const T=c.instancesPerModel[b];for(let S=0;S<T.instancedDataArray.length;++S){const A=(p?v*p.getElevationAt(0|T.instancedDataArray.float32[16*S],0|T.instancedDataArray.float32[16*S+1],!0,!0):0)+T.instancesEvaluatedElevation[S];T.instancedDataArray.float32[16*S+6]=A,_=_?Math.min(c.terrainElevationMin,A):A,y=y?Math.max(c.terrainElevationMax,A):A}}return c.terrainElevationMin=_||0,c.terrainElevationMax=y||0,c.validForExaggeration=v,c.validForDEMTile=p&&p._demTile?{id:p._demTile.tileID,timestamp:p._dem._timestamp}:{id:void 0,timestamp:0},!0}(i,e,t);(n||s)&&(e.uploaded=!1,e.upload(i.context))}const Ga={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new zi([0,0,0],[We,We,0])};function NE(i,e){const t=1<<i.canonical.z,n=e.getFreeCameraOptions().position,s=e.elevation,l=i.canonical.x/t,c=(i.canonical.x+1)/t,h=i.canonical.y/t,p=(i.canonical.y+1)/t;let _=e._centerAltitude;if(s){const T=s.getMinMaxForTile(i);T&&T.max>_&&(_=T.max)}const y=yt(n.x,l,c)-n.x,v=yt(n.y,h,p)-n.y,b=o(_,e.center.lat)-n.z;return e._zoomFromMercatorZ(Math.sqrt(y*y+v*v+b*b))}function E1(i,e,t,n,s,l,c){const h=i.context,p=i.renderPass==="shadow",_=i.shadowRenderer,y=p&&_?_.getShadowPassDepthMode():new mn(h.gl.LEQUAL,mn.ReadWrite,i.depthRangeFor3D),v=i.isTileAffectedByFog(l),b=i.transform.projection.name==="globe";if(t.meshes)for(const T of t.meshes){const S=b?[]:["MODEL_POSITION_ON_GPU"],A=[];let C,D,F;const O=!b&&n.instancedDataArray.length>20;O&&S.push("INSTANCED_ARRAYS");const z=Kh(i,e.paint.get("model-cutoff-fade-range"));if(z.shouldRenderCutoff&&S.push("RENDER_CUTOFF"),p&&_)C=i.getOrCreateProgram("modelDepth",{defines:S}),D=o1(c.shadowTileMatrix,c.shadowTileMatrix,t.globalMatrix),F=Qi.disabled;else{vy(S,A,T,i,e.paint.get("model-color-use-theme").constantOr("default")==="none"?null:e.lut),C=i.getOrCreateProgram("model",{defines:S,overrideFog:v});const j=T.material,te=j.pbrMetallicRoughness,G=e.paint.get("model-opacity").constantOr(1),W=e.paint.get("model-emissive-strength").constantOr(0);D=ly(l.expandedProjMatrix,t.globalMatrix,zE,null,i,G,te.baseColorFactor,j.emissiveFactor,te.metallicFactor,te.roughnessFactor,j,W,e,s,void 0,void 0,void 0,1,C.fixedDefines.includes("LIGHTING_3D_MODE")),_&&(c.shadowUniformsInitialized?C.setShadowUniformValues(h,_.getShadowUniformValues()):(_.setupShadows(l.toUnwrapped(),C,"model-tile"),c.shadowUniformsInitialized=!0)),F=z.shouldRenderCutoff||G<1||j.alphaMode!=="OPAQUE"?Qi.alphaBlended:Qi.unblended}i.uploadCommonUniforms(h,C,l.toUnwrapped(),null,z);const N=T.material.doubleSided?_n.disabled:_n.backCCW;if(O)A.push(n.instancedDataBuffer),C.draw(i,h.gl.TRIANGLES,y,bs.disabled,F,N,D,e.id,T.vertexBuffer,T.indexBuffer,T.segments,e.paint,i.transform.zoom,void 0,A,n.instancedDataArray.length);else{const j=p?"u_instance":"u_normal_matrix";for(let te=0;te<n.instancedDataArray.length;++te)D[j]=new Float32Array(n.instancedDataArray.arrayBuffer,64*te,16),C.draw(i,h.gl.TRIANGLES,y,bs.disabled,F,N,D,e.id,T.vertexBuffer,T.indexBuffer,T.segments,e.paint,i.transform.zoom,void 0,A)}}if(t.children)for(const T of t.children)E1(i,e,T,n,s,l,c)}function VE(i,e,t,n,s){const l=i.node;if(l.lodMeshes&&l.lodMeshes.length>0)if(i.targetLod<0)i.targetLod=e>n?1:0;else{const c=s>0?t/1e3/s:1;i.targetLod=yt(e>n?i.targetLod+c:i.targetLod-c,0,1)}else i.targetLod=0}function UE(i,e,t,n){if(!t.modelManager)return!0;const s=t.modelManager;if(!t.shadowRenderer)return!0;const l=t.shadowRenderer,c=e.aabb;let h=!0,p=i.maxHeight;if(p===0){let y=0;for(const v in i.instancesPerModel){const b=s.getModel(v,n);b?y=Math.max(y,Math.max(Math.max(b.aabb.max[0],b.aabb.max[1]),b.aabb.max[2])):h=!1}p=i.maxScale*y*1.41+i.maxVerticalOffset,h&&(i.maxHeight=p)}c.max[2]=p,c.min[2]+=i.terrainElevationMin,c.max[2]+=i.terrainElevationMax,hi(c.min,c.min,e.tileMatrix),hi(c.max,c.max,e.tileMatrix);const _=c.intersects(l.getCurrentCascadeFrustum());return t.currentShadowCascade===0&&(i.isInsideFirstShadowMapFrustum=_===2),_===0}function jE(i,e){const t=i.uniformValues.u_cutoff_params[0],n=i.uniformValues.u_cutoff_params[1],s=i.uniformValues.u_cutoff_params[2],l=i.uniformValues.u_cutoff_params[3];return n===t||l===s?1:yt(((e-t)/(n-t)-s)/(l-s),0,1)}function GE(i,e,t,n){if(e.pitch<20)return 1;const s=e.getWorldToCameraMatrix();zt(s,s,i);const l=Hc(t.min[0],t.min[1],t.min[2],1);let c=ar(to(),l,s),h=c,p=c;l[1]=t.max[1],c=ar(to(),l,s),h=c[1]<h[1]?c:h,p=c[1]>p[1]?c:p,l[0]=t.max[0],c=ar(to(),l,s),h=c[1]<h[1]?c:h,p=c[1]>p[1]?c:p,l[1]=t.min[1],c=ar(to(),l,s),h=c[1]<h[1]?c:h,p=c[1]>p[1]?c:p;const _=yt(n[0],0,1),y=100*e.pixelsPerMeter*yt(n[1],0,1),v=yt(n[2],0,1),b=(A=to(),z=(C=h)[1],N=C[2],j=C[3],A[0]=(O=C[0])+(F=_)*((D=p)[0]-O),A[1]=z+F*(D[1]-z),A[2]=N+F*(D[2]-N),A[3]=j+F*(D[3]-j),A),T=Math.tan(.5*e.fovX),S=-b[2]*T;var A,C,D,F,O,z,N,j;if(y===0)return b[1]<-Math.abs(S)?v:1;const te=yt(lt(1,v,(-Math.abs(S)-b[1])/y),v,1);return lt(1,te,yt((e.pitch-20)/20,0,1))}var Ty=` 8#define EPSILON 0.0000001 9#define PI 3.141592653589793 10#ifdef RENDER_CUTOFF 11float 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);} 12#endif`,S1=` 13#if defined(VIEWPORT_ORIGIN_TOP_LEFT) || defined(FLIP_Y) 14#define FLIP_VIEWPORT_UV_Y(uv) (uv).y=1.0-(uv).y 15#else 16#define FLIP_VIEWPORT_UV_Y(uv) 17#endif 18#ifdef DUAL_SOURCE_BLENDING 19layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1; 20#elif defined(FLOAT_RENDER_TARGET) 21layout(location=0) out highp vec4 glFragColor; 22#else 23layout(location=0) out vec4 glFragColor; 24#endif 25#ifdef USE_MRT1 26layout(location=1) out vec4 out_Target1; 27#endif 28highp float unpack_depth(highp vec4 rgba_depth) 29{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) { 30#ifdef CLIP_ZERO_TO_ONE 31highp float depth=ndc_z; 32#else 33highp float depth=ndc_z*0.5+0.5; 34#endif 35const 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;}const float DITHER_THRESHOLDS[16]=float[16]( 361.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
36/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0 37);int viewport_dither_index(vec2 fragCoordXY) {return (int(fragCoordXY.x) % 4)*4+(int(fragCoordXY.y) % 4);} 38#ifdef DEBUG_WIREFRAME 39#define HANDLE_WIREFRAME_DEBUG \\ 40glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 41gl_FragDepth=gl_FragCoord.z-0.0001; 42#else 43#define HANDLE_WIREFRAME_DEBUG 44#endif 45#ifdef RENDER_CUTOFF 46uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 47#endif 48vec4 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 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}`,I1=` 49#define EXTENT 8192.0 50#define RAD_TO_DEG 180.0/PI 51#define DEG_TO_RAD PI/180.0 52#define GLOBE_RADIUS EXTENT/PI/2.0 53float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 54#ifdef PROJECTION_GLOBE_VIEW 55vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 56#ifndef PROJECTED_POS_ON_VIEWPORT 57float 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; 58#else 59return vec3(0.0); 60#endif 61}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);} 62#endif 63vec2 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( 64unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 65);}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);} 66#ifdef RENDER_CUTOFF 67uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 68#endif 69const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt) 70{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} 71#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer 72#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib 73#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib 74#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib 75#define DECLARE_MATERIAL_TABLE_INFO 76#endif`,A1="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
76void 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;}",C1=` 77#define ELEVATION_SCALE 7.0 78#define ELEVATION_OFFSET 450.0 79#ifdef PROJECTION_GLOBE_VIEW 80uniform 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; 81#endif 82vec3 elevationVector(vec2 pos) { 83#ifdef PROJECTION_GLOBE_VIEW 84vec2 uv=pos/EXTENT;vec3 up=normalize(mix( 85mix(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; 86#else 87return vec3(0,0,1); 88#endif 89} 90#ifdef TERRAIN 91uniform 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);}float currentElevation(vec2 apos) { 92#ifdef TERRAIN_DEM_FLOAT_FORMAT 93vec2 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; 94#else 95float 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); 96#endif 97}float prevElevation(vec2 apos) { 98#ifdef TERRAIN_DEM_FLOAT_FORMAT 99vec2 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; 100#else 101float 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); 102#endif 103}vec4 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);} 104#endif 105float elevation(vec2 apos) { 106#ifdef TERRAIN 107#ifdef ZERO_EXAGGERATION 108return 0.0; 109#endif 110#ifdef TERRAIN_VERTEX_MORPHING 111float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp); 112#else 113return currentElevation(apos); 114#endif 115#else 116return 0.0; 117#endif 118} 119#ifdef DEPTH_OCCLUSION 120uniform 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; 121#ifdef DEPTH_D24 122float 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);} 123#else 124highp float unpack_depth_rgba(vec4 rgba_depth) 125{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;} 126#endif 127bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 128#ifdef CLIP_ZERO_TO_ONE 129coord.z=-1.0+2.0*coord.z; 130#endif 131#ifdef DEPTH_D24 132float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 133#else 134float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 135#endif 136return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
136size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 137#ifdef DEPTH_D24 138highp vec4 depth=vec4( 139texture(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 140);depth=unpack_depth4(depth); 141#else 142highp vec4 depth=vec4( 143unpack_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)) 144); 145#endif 146return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; 147#ifdef CLIP_ZERO_TO_ONE 148coord.z=-1.0+2.0*coord.z; 149#endif 150int 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) { 151#ifdef DEPTH_D24 152highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 153#else 154highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 155#endif 156res+=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; 157#ifdef CLIP_ZERO_TO_ONE 158coord.z=-1.0+2.0*coord.z; 159#endif 160highp 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));} 161#else 162bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 163#endif`,M1=`#ifdef FOG 164uniform 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);} 165#endif`,R1=`#ifdef FOG 166uniform 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;FLIP_VIEWPORT_UV_Y(uv);highp vec3 ray_dir=mix( 167mix(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;}
167vec3 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);} 168#endif`,Ey=` 169#ifdef LIGHTING_3D_MODE 170uniform 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));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);} 171#endif`,P1=`#ifdef RASTER_ARRAY 172uniform 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);}
172vec2 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) 173);}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) 174);}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);} 175#endif`,D1=`#ifdef RENDER_SHADOWS 176uniform 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];} 177#endif`,L1=`#ifdef RENDER_SHADOWS 178precision 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;highp vec2 shadow_map_ndc_to_uv(highp vec2 ndc_xy) { 179#ifdef SHADOW_MAP_FLIP_Y 180return ndc_xy*vec2(0.5,-0.5)+0.5; 181#else 182return ndc_xy*0.5+0.5; 183#endif 184}highp vec3 shadow_map_ndc_to_sample_space(highp vec3 ndc) { 185#ifdef CLIP_ZERO_TO_ONE 186return vec3(shadow_map_ndc_to_uv(ndc.xy),ndc.z); 187#else 188return vec3(shadow_map_ndc_to_uv(ndc.xy),ndc.z*0.5+0.5); 189#endif 190}float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) { 191#ifdef CLIP_ZERO_TO_ONE 192highp vec3 coord=vec3(shadow_map_ndc_to_uv(pos.xy),pos.z-bias); 193#else 194highp vec3 coord=vec3(shadow_map_ndc_to_uv(pos.xy),pos.z*0.5+0.5-bias); 195#endif 196return 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; 197#ifdef SHADOWS_SINGLE_CASCADE 198vec2 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); 199#else 200light_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); 201#endif 202}highp float calculate_shadow_bias(float NDotL) { 203#ifdef NORMAL_OFFSET 204return 0.5*u_shadow_bias.x; 205#else 206return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 207#endif 208}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) 209{highp vec2 biasUV=vec2( 210pos_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=shadow_map_ndc_to_sample_space(light_view_pos0.xyz/light_view_pos0.w);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);} 211#endif`;const z1=/^#include\s+"([^"]+)"\s*\r?\n/gm,F1=/#pragma mapbox: ([\
211w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,HE=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,ZE=new Set(["ifdef","ifndef","elif","if","defined"]),t_=new Set;Jh(Ty,t_),Jh(I1,t_),Jh(S1,t_);const O1={"_prelude_fog.vertex.glsl":M1,"_prelude_terrain.vertex.glsl":C1,"_prelude_shadow.vertex.glsl":D1,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer 212#define MATERIAL_TABLE_DEBUG 0 213uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; 214#if MATERIAL_TABLE_DEBUG 215vec4 colorDebug; 216#endif 217};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);}float 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++) { 218if (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; 219}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 { 220iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; 221#if MATERIAL_TABLE_DEBUG 222const 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; 223#endif 224uint offset=0u; 225#if MATERIAL_TABLE_DEBUG 226bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} 227#endif 228offset++; 229#if MATERIAL_TABLE_DEBUG 230uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} 231#endif 232offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); 233#if MATERIAL_TABLE_DEBUG 234if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} 235#endif 236uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); 237#if MATERIAL_TABLE_DEBUG 238if(keepFinding) 239{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;}}} 240#endif 241offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; 242#if MATERIAL_TABLE_DEBUG 243if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} 244#endif 245info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) 246{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);} 247#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) 248#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) 249#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) 250#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); 251#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; 252#endif`,"_prelude_fog.fragment.glsl":R1,"_prelude_shadow.fragment.glsl":L1,"_prelude_lighting.glsl":Ey,"_prelude_raster_array.glsl":P1,"_prelude_indicator_cutout.fragment.glsl":` 253#ifdef INDICATOR_CUTOUT 254uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 255#endif 256vec4 applyCutout(vec4 color,float height) { 257#ifdef INDICATOR_CUTOUT 258float 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;
258float 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); 259#else 260return color; 261#endif 262}float cutoutGroundRoofOpacity(vec4 groundRoof) { 263#ifdef INDICATOR_CUTOUT 264float 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); 265#else 266return 1.0; 267#endif 268}`,"_prelude_feature_cutout.fragment.glsl":`// feature cutout (gl-native only) 269`,"_prelude_feature_cutout.vertex.glsl":`// feature cutout (gl-native only) 270`},i_={},B1="precision highp float;",k1="precision mediump float;",N1=` 271#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) 272#extension GL_EXT_blend_func_extended : require 273#endif`,V1={preludeTerrain:ci("",C1),preludeFog:ci(R1,M1),preludeShadow:ci(L1,D1),preludeRasterArray:ci(P1,""),preludeLighting:ci(Ey,Ey),preludePrecisionQualifiers:ci(k1,B1),prelude:ci(S1,I1),preludeExtensions:ci(N1,"")},$E=[N1,k1,Ty,V1.prelude.fragmentSource].join(` 274`),qE=[B1,Ty,V1.prelude.vertexSource].join(` 275`);var WE={background:ci(`#include "_prelude_fog.fragment.glsl" 276#include "_prelude_feature_cutout.fragment.glsl" 277uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength; 278#ifdef LIGHTING_3D_MODE 279in vec4 v_color; 280#endif 281void main() {vec4 out_color; 282#ifdef FEATURE_CUTOUT 283vec2 uv=fragcoord_to_viewport_uv(gl_FragCoord.xy,u_inv_viewport_size.xy);float 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); 284#else 285#ifdef LIGHTING_3D_MODE 286out_color=v_color; 287#else 288out_color=u_color; 289#endif 290#ifdef FOG 291out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 292#endif 293#endif 294glFragColor=out_color*u_opacity; 295#ifdef USE_MRT1 296out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 297#endif 298#ifdef OVERDRAW_INSPECTOR 299glFragColor=vec4(1.0); 300#endif 301HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 302#include "_prelude_lighting.glsl" 303in ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength; 304#ifdef LIGHTING_3D_MODE 305uniform mediump vec4 u_color;out vec4 v_color; 306#endif 307void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 308#ifndef FEATURE_CUTOUT 309#ifdef LIGHTING_3D_MODE 310v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 311#endif 312#ifdef FOG 313v_fog_pos=fog_position(vec2(a_pos)); 314#endif 315#endif 316}`),backgroundPattern:ci(`#include "_prelude_fog.fragment.glsl" 317#include "_prelude_lighting.glsl" 318uniform 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); 319#ifdef LIGHTING_3D_MODE 320out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 321#endif 322#ifdef FOG 323out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 324#endif 325glFragColor=out_color*u_opacity; 326#ifdef USE_MRT1 327out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 328#endif 329#ifdef OVERDRAW_INSPECTOR 330glFragColor=vec4(1.0); 331#endif 332HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 333uniform 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); 334#ifdef FOG 335v_fog_pos=fog_position(pos); 336#endif 337}`),circle:ci(`#include "_prelude_fog.fragment.glsl" 338#include "_prelude_lighting.glsl" 339in vec3 v_data;in float v_visibility; 340#pragma mapbox: define highp vec4 color 341#pragma mapbox: define mediump float radius 342#pragma mapbox: define lowp float blur 343#pragma mapbox: define lowp float opacity 344#pragma mapbox: define highp vec4 stroke_color 345#pragma mapbox: define mediump float stroke_width 346#pragma mapbox: define lowp float stroke_opacity 347uniform float u_emissive_strength;void main() { 348#pragma mapbox: initialize highp vec4 color 349#pragma mapbox: initialize mediump float radius 350#pragma mapbox: initialize lowp float blur 351#pragma mapbox: initialize lowp float opacity 352#pragma mapbox: initialize highp vec4 stroke_color 353#pragma mapbox: initialize mediump float stroke_width 354#pragma mapbox: initialize lowp float stroke_opacity 355vec2 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);
355float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 356smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 357smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 358antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 359);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 360#ifdef LIGHTING_3D_MODE 361out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 362#endif 363#ifdef FOG 364out_color=fog_apply_premultiplied(out_color,v_fog_pos); 365#endif 366glFragColor=out_color*(v_visibility*opacity_t); 367#ifdef OVERDRAW_INSPECTOR 368glFragColor=vec4(1.0); 369#endif 370}`,`#include "_prelude_fog.vertex.glsl" 371#include "_prelude_terrain.vertex.glsl" 372#define NUM_VISIBILITY_RINGS 2 373#define INV_SQRT2 0.70710678 374#define ELEVATION_BIAS 0.0001 375#define NUM_SAMPLES_PER_RING 16 376uniform 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; 377#ifdef PROJECTION_GLOBE_VIEW 378in 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; 379#endif 380#ifdef ELEVATED_ROADS 381in float a_circle_z_offset; 382#endif 383out vec3 v_data;out float v_visibility; 384#pragma mapbox: define highp vec4 color 385#pragma mapbox: define mediump float radius 386#pragma mapbox: define lowp float blur 387#pragma mapbox: define lowp float opacity 388#pragma mapbox: define highp vec4 stroke_color 389#pragma mapbox: define mediump float stroke_width 390#pragma mapbox: define lowp float stroke_opacity 391vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_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) { 392#if defined(TERRAIN) 393return elevation(pos)+ELEVATION_BIAS; 394#else 395return 0.0; 396#endif 397}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); 398#ifdef PITCH_WITH_MAP 399#ifdef PROJECTION_GLOBE_VIEW 400return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 401#else 402return u_matrix*( world_center+vec4(sample_offset,0,0) ); 403#endif 404#else 405return projected_center+vec4(sample_offset,0,0); 406#endif 407}float get_sample_step() { 408#ifdef PITCH_WITH_MAP 409return 2.0*PI/float(NUM_SAMPLES_PER_RING); 410#else 411return PI/float(NUM_SAMPLES_PER_RING); 412#endif 413}void main() { 414#pragma mapbox: initialize highp vec4 color 415#pragma mapbox: initialize mediump float radius 416#pragma mapbox: initialize lowp float blur 417#pragma mapbox: initialize lowp float opacity 418#pragma mapbox: initialize highp vec4 stroke_color 419#pragma mapbox: initialize mediump float stroke_width 420#pragma mapbox: initialize lowp float stroke_opacity 421vec2 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; 422#ifdef PROJECTION_GLOBE_VIEW 423surface_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); 424#else
425surface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1); 426#endif 427#ifdef ELEVATED_ROADS 428world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 429#endif 430vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 431#ifdef PITCH_WITH_MAP 432#ifdef SCALE_WITH_MAP 433view_scale=1.0; 434#else 435view_scale=projected_center.w/u_camera_to_center_distance; 436#endif 437#else 438#ifdef SCALE_WITH_MAP 439view_scale=u_camera_to_center_distance; 440#else 441view_scale=projected_center.w; 442#endif 443#endif 444gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 445#ifdef TERRAIN 446float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 447#ifdef PITCH_WITH_MAP 448float 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; 449#else 450occlusion_world_center=world_center;occlusion_projected_center=projected_center; 451#endif 452for(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); 453#else 454visibility=1.0; 455#endif 456#ifdef PROJECTION_GLOBE_VIEW 457visibility=1.0; 458#endif 459v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 460#ifdef FOG 461v_fog_pos=fog_position(world_center.xyz); 462#endif 463}`),clippingMask:ci("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:ci(`#include "_prelude_fog.fragment.glsl" 464uniform highp float u_intensity;in vec2 v_extrude; 465#pragma mapbox: define highp float weight 466#define GAUSS_COEF 0.3989422804014327 467void main() { 468#pragma mapbox: initialize highp float weight 469float 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); 470#ifdef FOG 471if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 472#endif 473#ifdef OVERDRAW_INSPECTOR 474glFragColor=vec4(1.0); 475#endif 476HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 477#include "_prelude_fog.vertex.glsl" 478uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_intensity;in ivec2 a_pos; 479#ifdef PROJECTION_GLOBE_VIEW 480in 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; 481#endif 482out vec2 v_extrude; 483#pragma mapbox: define highp float weight 484#pragma mapbox: define mediump float radius 485const highp float ZERO=1.0/255.0/16.0; 486#define GAUSS_COEF 0.3989422804014327 487void main() { 488#pragma mapbox: initialize highp float weight 489#pragma mapbox: initialize mediump float radius 490vec2 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; 491#ifdef PROJECTION_GLOBE_VIEW 492vec3 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); 493#else 494pos=vec3(tilePos+extrude,elevation(tilePos)); 495#endif 496gl_Position=u_matrix*vec4(pos,1); 497#ifdef FOG 498v_fog_pos=fog_position(pos); 499#endif 500}`),heatmapTexture:ci(`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; 501#ifdef OVERDRAW_INSPECTOR 502glFragColor=vec4(0.0); 503#endif 504HANDLE_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:ci("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" 505in 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; 506#ifdef PROJECTION_GLOBE_VIEW 507uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; 508#endif 509out 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); 510#ifdef PROJECTION_GLOBE_VIEW 511#ifndef PROJECTED_POS_ON_VIEWPORT 512vec3 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); 513#endif 514#endif 515vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 5160.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:ci("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( 517mix(-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( 5180.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:ci("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" 519in ivec2 a_pos; 520#ifdef PROJECTION_GLOBE_VIEW 521in ivec4 a_pos_3; 522#endif 523out 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; 524#ifdef PROJECTION_GLOBE_VIEW
525gl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1); 526#else 527gl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1); 528#endif 529}`),fill:ci(`#include "_prelude_fog.fragment.glsl" 530#include "_prelude_lighting.glsl" 531#include "_prelude_shadow.fragment.glsl" 532#include "_prelude_indicator_cutout.fragment.glsl" 533#include "_prelude_feature_cutout.fragment.glsl" 534#pragma mapbox: define highp vec4 color 535#pragma mapbox: define lowp float opacity 536uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier; 537#ifdef RENDER_SHADOWS 538uniform 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; 539#endif 540#ifdef ELEVATED_ROADS 541in highp float v_road_z_offset; 542#endif 543#ifdef INDICATOR_CUTOUT 544in highp float v_z_offset; 545#endif 546void main() { 547#pragma mapbox: initialize highp vec4 color 548#pragma mapbox: initialize lowp float opacity 549vec2 cutout_factors=vec2(0.0); 550#ifdef FEATURE_CUTOUT 551cutout_factors=get_cutout_factors(gl_FragCoord); 552#endif 553vec4 out_color=color; 554#ifdef LIGHTING_3D_MODE 555out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 556#ifdef RENDER_SHADOWS 557float 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); 558#endif 559#endif 560#ifdef FOG 561out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 562#endif 563out_color*=(opacity*u_opacity_multiplier); 564#ifdef INDICATOR_CUTOUT 565if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 566#endif 567#ifdef FEATURE_CUTOUT 568float z=0.0; 569#ifdef ELEVATED_ROADS 570z=v_road_z_offset; 571#endif 572out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z); 573#endif 574glFragColor=out_color; 575#ifdef USE_MRT1 576out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 577#endif 578#ifdef OVERDRAW_INSPECTOR 579glFragColor=vec4(1.0); 580#endif 581HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 582#include "_prelude_shadow.vertex.glsl" 583in ivec2 a_pos; 584#ifdef ELEVATED_ROADS 585in float a_road_z_offset;out highp float v_road_z_offset; 586#endif 587#ifdef RENDER_SHADOWS 588uniform 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; 589#endif 590#ifdef INDICATOR_CUTOUT 591out highp float v_z_offset; 592#endif 593uniform mat4 u_matrix;uniform lowp float u_opacity_multiplier; 594#pragma mapbox: define highp vec4 color 595#pragma mapbox: define lowp float opacity 596#pragma mapbox: define highp float z_offset 597void main() { 598#pragma mapbox: initialize highp vec4 color 599#pragma mapbox: initialize lowp float opacity 600#pragma mapbox: initialize highp float z_offset 601#ifdef ELEVATED_ROADS 602z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 603#endif 604float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 605#ifdef RENDER_SHADOWS 606vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 607#ifdef NORMAL_OFFSET 608vec3 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(); 609#endif 610v_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; 611#endif 612#ifdef FOG 613v_fog_pos=fog_position(vec2(a_pos)); 614#endif 615#ifdef INDICATOR_CUTOUT 616v_z_offset=z_offset; 617#endif 618}`),fillOutline:ci(`#include "_prelude_fog.fragment.glsl" 619#include "_prelude_lighting.glsl" 620#include "_prelude_shadow.fragment.glsl" 621#include "_prelude_feature_cutout.fragment.glsl" 622in highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier; 623#ifdef ELEVATED_ROADS 624in highp float v_road_z_offset; 625#endif 626#ifdef RENDER_SHADOWS 627uniform 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; 628#endif 629#pragma mapbox: define highp vec4 outline_color 630#pragma mapbox: define lowp float opacity 631void main() { 632#pragma mapbox: initialize highp vec4 outline_color 633#pragma mapbox: initialize lowp float opacity 634float 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); 635#ifdef FEATURE_CUTOUT 636cutout_factors=get_cutout_factors(gl_FragCoord); 637#endif 638#ifdef LIGHTING_3D_MODE 639out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 640#ifdef RENDER_SHADOWS 641float 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); 642#endif 643#endif 644#ifdef FOG 645out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 646#endif 647#ifdef FEATURE_CUTOUT 648float z=0.0; 649#ifdef ELEVATED_ROADS 650z=v_road_z_offset; 651#endif 652out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z); 653#endif 654glFragColor=out_color*(alpha*opacity*u_opacity_multiplier); 655#ifdef USE_MRT1 656out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 657#endif 658#ifdef OVERDRAW_INSPECTOR 659glFragColor=vec4(1.0); 660#endif 661HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 662#include "_prelude_shadow.vertex.glsl" 663in ivec2 a_pos; 664#ifdef ELEVATED_ROADS 665in float a_road_z_offset;out highp float v_road_z_offset; 666#endif 667#ifdef RENDER_SHADOWS 668uniform 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; 669#endif 670uniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;out highp vec2 v_pos; 671#pragma mapbox: define highp vec4 outline_color 672#pragma mapbox: define lowp float opacity 673#pragma mapbox: define highp float z_offset 674void main() { 675#pragma mapbox: initialize highp vec4 outline_color 676#pragma mapbox: initialize lowp float opacity 677#pragma mapbox: initialize highp float z_offset 678#ifdef ELEVATED_ROADS 679z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 680#endif 681float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 682#ifdef FLIP_Y 683v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 684#else 685v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 686#endif 687#ifdef RENDER_SHADOWS 688vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 689#ifdef NORMAL_OFFSET 690vec3 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(); 691#endif 692v_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; 693#endif 694#ifdef FOG 695v_fog_pos=fog_position(vec2(a_pos)); 696#endif 697}`),fillOutlinePattern:ci(`#include "_prelude_fog.fragment.glsl" 698#include "_prelude_lighting.glsl" 699#include "_prelude_shadow.fragment.glsl" 700#include "_prelude_feature_cutout.fragment.glsl" 701uniform vec2 u_texsize;uniform sampler2D u_image; 702#ifdef FILL_PATTERN_TRANSITION 703uniform float u_pattern_transition; 704#endif 705uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier; 706#ifdef APPLY_LUT_ON_GPU 707uniform highp sampler3D u_lutTexture; 708#endif 709#ifdef RENDER_SHADOWS 710uniform 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; 711#endif 712#ifdef ELEVATED_ROADS 713in highp float v_road_z_offset; 714#endif 715in highp vec2 v_pos;in highp vec2 v_pos_world; 716#pragma mapbox: define lowp float opacity 717#pragma mapbox: define lowp uvec4 pattern 718#ifdef FILL_PATTERN_TRANSITION 719#pragma mapbox: define mediump uvec4 pattern_b 720#endif 721void main() { 722#pragma mapbox: initialize lowp float opacity 723#pragma mapbox: initialize mediump uvec4 pattern 724#ifdef FILL_PATTERN_TRANSITION 725#pragma mapbox: initialize mediump uvec4 pattern_b 726#endif 727vec2 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); 728#ifdef APPLY_LUT_ON_GPU 729out_color=applyLUT(u_lutTexture,out_color); 730#endif 731#ifdef FILL_PATTERN_TRANSITION 732vec2 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; 733#endif 734vec2 cutout_factors=vec2(0.0); 735#ifdef FEATURE_CUTOUT 736cutout_factors=get_cutout_factors(gl_FragCoord); 737#endif 738#ifdef LIGHTING_3D_MODE 739out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 740#ifdef RENDER_SHADOWS 741float 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); 742#endif 743#endif 744#ifdef FEATURE_CUTOUT 745float z=0.0; 746#ifdef ELEVATED_ROADS 747z=v_road_z_offset; 748#endif 749out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z); 750#endif 751#ifdef FOG 752out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 753#endif 754glFragColor=out_color*(alpha*opacity*u_opacity_multiplier); 755#ifdef USE_MRT1 756out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 757#endif 758#ifdef OVERDRAW_INSPECTOR 759glFragColor=vec4(1.0); 760#endif 761HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 762#include "_prelude_shadow.vertex.glsl" 763uniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos; 764#ifdef ELEVATED_ROADS 765in float a_road_z_offset;out highp float v_road_z_offset; 766#endif 767#ifdef RENDER_SHADOWS 768uniform 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; 769#endif 770out highp vec2 v_pos;out highp vec2 v_pos_world; 771#pragma mapbox: define lowp float opacity 772#pragma mapbox: define lowp uvec4 pattern 773#ifdef FILL_PATTERN_TRANSITION 774#pragma mapbox: define mediump uvec4 pattern_b 775#endif 776#pragma mapbox: define lowp float pixel_ratio 777#pragma mapbox: define highp float z_offset 778void main() { 779#pragma mapbox: initialize lowp float opacity 780#pragma mapbox: initialize mediump uvec4 pattern 781#ifdef FILL_PATTERN_TRANSITION 782#pragma mapbox: initialize mediump uvec4 pattern_b 783#endif 784#pragma mapbox: initialize lowp float pixel_ratio 785#pragma mapbox: initialize highp float z_offset 786vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw); 787#ifdef ELEVATED_ROADS 788z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 789#endif 790float 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); 791#ifdef FLIP_Y 792v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 793#else 794v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 795#endif 796#ifdef RENDER_SHADOWS 797vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset); 798#ifdef NORMAL_OFFSET 799vec3 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(); 800#endif 801v_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; 802#endif 803#ifdef FOG 804v_fog_pos=fog_position(pos); 805#endif 806}`),fillPattern:ci(`#include "_prelude_fog.fragment.glsl" 807#include "_prelude_lighting.glsl" 808#include "_prelude_shadow.fragment.glsl" 809#include "_prelude_feature_cutout.fragment.glsl" 810uniform vec2 u_texsize;uniform sampler2D u_image; 811#ifdef FILL_PATTERN_TRANSITION 812uniform float u_pattern_transition; 813#endif 814in highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier; 815#ifdef RENDER_SHADOWS 816uniform 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; 817#endif 818#ifdef ELEVATED_ROADS 819in highp float v_road_z_offset; 820#endif 821#ifdef APPLY_LUT_ON_GPU 822uniform highp sampler3D u_lutTexture; 823#endif 824#pragma mapbox: define lowp float opacity 825#pragma mapbox: define lowp uvec4 pattern 826#ifdef FILL_PATTERN_TRANSITION 827#pragma mapbox: define mediump uvec4 pattern_b 828#endif 829void main() { 830#pragma mapbox: initialize lowp float opacity 831#pragma mapbox: initialize mediump uvec4 pattern 832#ifdef FILL_PATTERN_TRANSITION 833#pragma mapbox: initialize mediump uvec4 pattern_b 834#endif 835vec2 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); 836#ifdef APPLY_LUT_ON_GPU 837out_color=applyLUT(u_lutTexture,out_color); 838#endif 839#ifdef FILL_PATTERN_TRANSITION 840vec2 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; 841#endif 842vec2 cutout_factors=vec2(0.0); 843#ifdef FEATURE_CUTOUT 844cutout_factors=get_cutout_factors(gl_FragCoord); 845#endif 846#ifdef LIGHTING_3D_MODE 847out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 848#ifdef RENDER_SHADOWS 849float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y); 850#ifdef ELEVATED_ROADS 851out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 852#else 853out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 854#endif 855#endif 856#endif 857#ifdef FEATURE_CUTOUT 858float z=0.0; 859#ifdef ELEVATED_ROADS 860z=v_road_z_offset; 861#endif 862out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z); 863#endif 864#ifdef FOG 865out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 866#endif 867glFragColor=out_color*(opacity*u_opacity_multiplier); 868#ifdef USE_MRT1 869out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 870#endif 871#ifdef OVERDRAW_INSPECTOR 872glFragColor=vec4(1.0); 873#endif 874HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 875#include "_prelude_shadow.vertex.glsl" 876uniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos; 877#ifdef ELEVATED_ROADS 878in float a_road_z_offset;out highp float v_road_z_offset; 879#endif 880#ifdef RENDER_SHADOWS 881uniform 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; 882#endif 883out highp vec2 v_pos; 884#pragma mapbox: define lowp float opacity 885#pragma mapbox: define lowp uvec4 pattern 886#ifdef FILL_PATTERN_TRANSITION 887#pragma mapbox: define mediump uvec4 pattern_b 888#endif 889#pragma mapbox: define lowp float pixel_ratio 890#pragma mapbox: define highp float z_offset 891void main() { 892#pragma mapbox: initialize lowp float opacity 893#pragma mapbox: initialize mediump uvec4 pattern 894#pragma mapbox: initialize lowp float pixel_ratio 895#pragma mapbox: initialize highp float z_offset 896#ifdef FILL_PATTERN_TRANSITION 897#pragma mapbox: initialize mediump uvec4 pattern_b 898#endif 899vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 900#ifdef ELEVATED_ROADS 901z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 902#endif 903float 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); 904#ifdef RENDER_SHADOWS 905vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset); 906#ifdef NORMAL_OFFSET 907vec3 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(); 908#endif 909v_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; 910#e
910ndif 911#ifdef FOG 912v_fog_pos=fog_position(pos); 913#endif 914}`),lineBlendComposite:ci(`uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos; 915#define ADDITIVE 1 916void main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);} 917#ifdef OVERDRAW_INSPECTOR 918glFragColor=vec4(0.0); 919#endif 920HANDLE_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;}"),lineBlendReduce:ci("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}","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:ci(`#include "_prelude_fog.fragment.glsl" 921#include "_prelude_shadow.fragment.glsl" 922#include "_prelude_lighting.glsl" 923#include "_prelude_indicator_cutout.fragment.glsl" 924#include "_prelude_feature_cutout.fragment.glsl" 925in vec4 v_color;in vec4 v_flat; 926#ifdef RENDER_SHADOWS 927in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 928#endif 929uniform lowp float u_opacity; 930#ifdef RENDER_FRONT_CUTOFF 931in float v_front_cutoff_opacity; 932#endif 933#ifdef INDICATOR_CUTOUT 934#ifdef FEATURE_CUTOUT 935in vec4 v_ground_roof; 936#endif 937#endif 938#ifdef FAUX_AO 939uniform lowp vec2 u_ao;in vec2 v_ao; 940#endif 941#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 942in vec4 v_roof_color; 943#endif 944#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 945in highp vec3 v_normal; 946#endif 947uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 948#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 949in float v_flood_radius;in float v_has_floodlight; 950#endif 951in float v_height; 952#pragma mapbox: define highp float emissive_strength 953void main() { 954#pragma mapbox: initialize highp float emissive_strength 955#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 956vec3 normal=normalize(v_normal); 957#endif 958float z;vec4 color=v_color; 959#ifdef ZERO_ROOF_RADIUS 960z=float(normal.z > 0.00001); 961#ifdef LIGHTING_3D_MODE 962normal=mix(normal,vec3(0.0,0.0,1.0),z); 963#else 964color=mix(v_color,v_roof_color,z); 965#endif 966#endif 967float h=max(0.0,v_height);float ao_shade=1.0; 968#ifdef FAUX_AO 969float 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),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; 970#ifdef ZERO_ROOF_RADIUS 971concave*=(1.0-z); 972#endif 973float 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); 974#ifdef LIGHTING_3D_MODE 975#ifdef FLOOD_LIGHT 976color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 977#else 978color.rgb*=ao_shade; 979#endif 980#else 981color.rgb*=ao_shade; 982#endif 983#endif 984#ifdef LIGHTING_3D_MODE 985float flood_radiance=0.0; 986#ifdef FLOOD_LIGHT 987flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 988#endif 989#ifdef RENDER_SHADOWS 990#ifdef FLOOD_LIGHT 991float 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); 992#else 993float shadowed_lighting_factor; 994#ifdef RENDER_CUTOFF 995shadowed_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;} 996#else 997shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 998#endif 999color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 1000#endif 1001#else 1002color.rgb=apply_lighting(color.rgb,normal); 1003#ifdef FLOOD_LIGHT 1004color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 1005#endif 1006#endif 1007color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 1008#endif 1009#ifdef FOG 1010color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 1011#endif 1012#ifdef INDICATOR_CUTOUT 1013#ifdef FEATURE_CUTOUT 1014{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}} 1015#else 1016color=applyCutout(color,h); 1017#endif 1018#endif 1019#ifdef RENDER_FRONT_CUTOFF 1020if (v_front_cutoff_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}} 1021#endif 1022#ifdef FEATURE_CUTOUT 1023color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x,0.0); 1024#endif 1025glFragColor=color; 1026#ifdef OVERDRAW_INSPECTOR 1027glFragColor=vec4(1.0); 1028#endif 1029HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1030#include "_prelude_terrain.vertex.glsl" 1031#include "_prelude_shadow.vertex.glsl" 1032#include "_prelude_lighting.glsl" 1033#include "_prelude_material_table.vertex.glsl" 1034uniform mat4 u_matrix; 1035#ifndef LIGHTING_3D_MODE 1036uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity; 1037#endif 1038uniform 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; 1039#if defined(HAS_CENTROID) || defined(TERRAIN) 1040in uvec2 a_centroid_pos; 1041#endif 1042#ifdef RENDER_WALL_MODE 1043in ivec4 a_join_normal_inside; 1044#endif 1045#ifdef PROJECTION_GLOBE_VIEW 1046in 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; 1047#endif 1048#ifdef TERRAIN
1049uniform int u_height_type;uniform int u_base_type; 1050#endif 1051uniform highp float u_vertical_scale; 1052#ifdef RENDER_FRONT_CUTOFF 1053uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity; 1054#endif 1055out vec4 v_color;out vec4 v_flat; 1056#ifdef RENDER_SHADOWS 1057uniform 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; 1058#endif 1059#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1060out vec4 v_roof_color; 1061#endif 1062#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1063out highp vec3 v_normal; 1064#endif 1065#ifdef FAUX_AO 1066uniform lowp vec2 u_ao;out vec2 v_ao; 1067#endif 1068#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 1069out float v_flood_radius;out float v_has_floodlight; 1070#endif 1071out float v_height; 1072#ifdef INDICATOR_CUTOUT 1073#ifdef FEATURE_CUTOUT 1074out vec4 v_ground_roof; 1075#endif 1076#endif 1077vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 1078#pragma mapbox: define highp float base 1079#pragma mapbox: define highp float height 1080#pragma mapbox: define highp vec4 color 1081#pragma mapbox: define highp float flood_light_wall_radius 1082#pragma mapbox: define highp float line_width 1083#pragma mapbox: define highp float emissive_strength 1084void main() {DECLARE_MATERIAL_TABLE_INFO 1085#pragma mapbox: initialize highp float base 1086#pragma mapbox: initialize highp float height 1087#pragma mapbox: initialize highp vec4 color 1088#pragma mapbox: initialize highp float flood_light_wall_radius 1089#pragma mapbox: initialize highp float line_width 1090#pragma mapbox: initialize highp float emissive_strength 1091base*=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)); 1092#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1093v_normal=normal; 1094#endif 1095base=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); 1096#if defined(HAS_CENTROID) || defined(TERRAIN) 1097centroid_pos=vec2(a_centroid_pos); 1098#endif 1099float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 1100#ifdef TERRAIN 1101bool 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; 1102#else 1103h=t > 0.0 ? height : base; 1104#endif 1105pos=vec3(pos_nx.xy,h); 1106#ifdef PROJECTION_GLOBE_VIEW 1107float 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); 1108#endif 1109float cutoff=1.0;vec3 scaled_pos=pos; 1110#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) 1111vec2 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);}} 1112#endif 1113#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) 1114vec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0); 1115#endif 1116#ifdef RENDER_CUTOFF 1117#ifdef CLIP_ZERO_TO_ONE
1118cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); 1119#else 1120cutoff=cutoff_opacity(u_cutoff_params,ground.z); 1121#endif 1122if (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); 1123#endif 1124float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 1125#ifdef RENDER_FRONT_CUTOFF 1126v_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);} 1127#endif 1128#ifdef RENDER_WALL_MODE 1129vec3 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; 1130#endif 1131gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 1132#ifdef RENDER_SHADOWS 1133vec3 shd_pos0=pos;vec3 shd_pos1=pos; 1134#ifdef NORMAL_OFFSET 1135vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 1136#endif 1137v_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); 1138#endif 1139float NdotL=0.0;float colorvalue=0.0; 1140#ifndef LIGHTING_3D_MODE 1141colorvalue=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*=( 1142(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1143#endif 1144#ifdef FAUX_AO 1145float 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; 1146#ifdef TERRAIN 1147top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
1147ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1148#endif 1149v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]); 1150#ifdef PROJECTION_GLOBE_VIEW 1151top_height+=u_height_lift; 1152#endif 1153gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1154#endif 1155#ifdef LIGHTING_3D_MODE 1156#ifdef FLOOD_LIGHT 1157float 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; 1158#endif 1159v_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); 1160#else 1161v_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; 1162#endif 1163#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1164float 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; 1165#endif 1166#ifdef FOG 1167v_fog_pos=fog_position(pos); 1168#endif 1169#ifdef INDICATOR_CUTOUT 1170#ifdef FEATURE_CUTOUT 1171vec4 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); 1172#endif 1173#endif 1174}`),fillExtrusionPattern:ci(`#include "_prelude_fog.fragment.glsl" 1175#include "_prelude_lighting.glsl" 1176#include "_prelude_indicator_cutout.fragment.glsl" 1177uniform vec2 u_texsize;uniform sampler2D u_image; 1178#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1179uniform float u_pattern_transition; 1180#endif 1181#ifdef FAUX_AO 1182uniform lowp vec2 u_ao;in vec3 v_ao; 1183#endif 1184#ifdef LIGHTING_3D_MODE 1185in vec3 v_normal; 1186#endif 1187#ifdef APPLY_LUT_ON_GPU 1188uniform highp sampler3D u_lutTexture; 1189#endif 1190in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 1191#pragma mapbox: define highp float base 1192#pragma mapbox: define highp float height 1193#pragma mapbox: define mediump uvec4 pattern 1194#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1195#pragma mapbox: define mediump uvec4 pattern_b 1196#endif 1197#pragma mapbox: define highp float pixel_ratio 1198void main() { 1199#pragma mapbox: initialize highp float base 1200#pragma mapbox: initialize highp float height 1201#pragma mapbox: initialize mediump uvec4 pattern 1202#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1203#pragma mapbox: initialize mediump uvec4 pattern_b 1204#endif 1205#pragma mapbox: initialize highp float pixel_ratio 1206vec2 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); 1207#ifdef APPLY_LUT_ON_GPU 1208out_color=applyLUT(u_lutTexture,out_color); 1209#endif 1210#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1211vec2 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; 1212#endif 1213#ifdef LIGHTING_3D_MODE 1214out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 1215#else 1216out_color=out_color*v_lighting; 1217#endif 1218#ifdef FAUX_AO 1219float 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),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; 1220#endif 1221#ifdef FOG 1222out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1223#endif 1224#ifdef INDICATOR_CUTOUT 1225out_color=applyCutout(out_color,height); 1226#endif 1227glFragColor=out_color; 1228#ifdef OVERDRAW_INSPECTOR 1229glFragColor=vec4(1.0); 1230#endif 1231HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1232#include "_prelude_terrain.vertex.glsl" 1233#include "_prelude_lighting.glsl" 1234#include "_prelude_material_table.vertex.glsl" 1235uniform 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; 1236#ifndef LIGHTING_3D_MODE 1237uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity; 1238#endif 1239in ivec4 a_pos_normal_ed; 1240#if defined(HAS_CENTROID) || defined(TERRAIN) 1241in uvec2 a_centroid_pos; 1242#endif 1243#ifdef RENDER_WALL_MODE 1244in ivec4 a_join_normal_inside; 1245#endif 1246#ifdef PROJECTION_GLOBE_VIEW 1247in 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; 1248#endif 1249#ifdef TERRAIN
1250uniform int u_height_type;uniform int u_base_type; 1251#endif 1252out highp vec2 v_pos;out vec4 v_lighting; 1253#ifdef FAUX_AO 1254uniform lowp vec2 u_ao;out vec3 v_ao; 1255#endif 1256#ifdef LIGHTING_3D_MODE 1257out vec3 v_normal; 1258#endif 1259#pragma mapbox: define highp float base 1260#pragma mapbox: define highp float height 1261#pragma mapbox: define highp vec4 color 1262#pragma mapbox: define mediump uvec4 pattern 1263#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1264#pragma mapbox: define mediump uvec4 pattern_b 1265#endif 1266#pragma mapbox: define highp float pixel_ratio 1267#pragma mapbox: define highp float line_width 1268void main() {DECLARE_MATERIAL_TABLE_INFO 1269#pragma mapbox: initialize highp float base 1270#pragma mapbox: initialize highp float height 1271#pragma mapbox: initialize highp vec4 color 1272#pragma mapbox: initialize mediump uvec4 pattern 1273#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1274#pragma mapbox: initialize mediump uvec4 pattern_b 1275#endif 1276#pragma mapbox: initialize highp float pixel_ratio 1277#pragma mapbox: initialize highp float line_width 1278vec2 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); 1279#if defined(HAS_CENTROID) || defined(TERRAIN) 1280centroid_pos=vec2(a_centroid_pos); 1281#endif 1282float ele=0.0;float h=z;vec3 p;float c_ele; 1283#ifdef TERRAIN 1284bool 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); 1285#else 1286p=vec3(pos_nx.xy,z); 1287#endif 1288#ifdef PROJECTION_GLOBE_VIEW 1289float 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); 1290#endif 1291#ifdef RENDER_WALL_MODE 1292vec3 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; 1293#endif 1294float 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 1295? pos_nx.xy 1296: 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; 1297#ifdef LIGHTING_3D_MODE 1298NdotL=calculate_NdotL(normal); 1299#else 1300NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 1301#endif 1302if (normal.y !=0.0) {float r=0.84; 1303#ifndef LIGHTING_3D_MODE 1304r=mix(0.7,0.98,1.0-u_lightintensity); 1305#endif 1306NdotL*=( 1307(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1308#ifdef FAUX_AO 1309float 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; 1310#ifdef TERRAIN 1311top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
1311ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1312#endif 1313v_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]); 1314#ifdef PROJECTION_GLOBE_VIEW 1315top_height+=u_height_lift; 1316#endif 1317gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1318#endif 1319#ifdef LIGHTING_3D_MODE 1320v_normal=normal; 1321#else 1322v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 1323#endif 1324#ifdef FOG 1325v_fog_pos=fog_position(p); 1326#endif 1327}`),hillshadePrepare:ci(`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( 1328(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 1329)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 1330deriv.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:ci(`#include "_prelude_fog.fragment.glsl" 1331#include "_prelude_lighting.glsl" 1332uniform 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; 1333#ifdef LIGHTING_3D_MODE 1334glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 1335#endif 1336#ifdef FOG 1337glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 1338#endif 1339#ifdef USE_MRT1 1340out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1341#endif 1342#ifdef OVERDRAW_INSPECTOR 1343glFragColor=vec4(1.0); 1344#endif 1345HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1346uniform 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; 1347#ifdef VIEWPORT_ORIGIN_TOP_LEFT 1348v_pos.y=1.0-v_pos.y; 1349#endif 1350#ifdef FOG 1351v_fog_pos=fog_position(vec2(a_pos)); 1352#endif 1353}`),line:ci(`#include "_prelude_fog.fragment.glsl" 1354#include "_prelude_lighting.glsl" 1355#include "_prelude_shadow.fragment.glsl" 1356#include "_prelude_indicator_cutout.fragment.glsl" 1357#include "_prelude_feature_cutout.fragment.glsl" 1358uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in vec2 v_tile_pos; 1359#ifdef ELEVATED_ROADS 1360in highp float v_road_z_offset; 1361#endif 1362#ifdef VARIABLE_LINE_WIDTH 1363in float stub_side; 1364#endif 1365#ifdef RENDER_LINE_DASH 1366uniform sampler2D u_dash_image;uniform highp float u_floor_width_scale;in vec2 v_tex; 1367#endif 1368#ifdef DEBUG_ELEVATION_ID 1369in vec3 v_elevation_id_col; 1370#endif 1371#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1372in highp vec3 v_uv; 1373#endif 1374#ifdef RENDER_LINE_GRADIENT 1375uniform sampler2D u_gradient_image; 1376#endif 1377#ifdef RENDER_LINE_BORDER_GRADIENT 1378uniform sampler2D u_border_gradient_image; 1379#endif 1380#ifdef RENDER_LINE_TRIM_OFFSET 1381uniform 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; 1382#endif 1383#ifdef INDICATOR_CUTOUT 1384in highp float v_z_offset; 1385#endif 1386#ifdef RENDER_SHADOWS 1387uniform bool u_emissive_in_shadows;uniform 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; 1388#endif 1389float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} 1390#pragma mapbox: define highp vec4 color 1391#pragma mapbox: define lowp float floorwidth 1392#pragma mapbox: define mediump uvec4 dash 1393#pragma mapbox: define lowp float blur 1394#pragma mapbox: define lowp float opacity 1395#pragma mapbox: define mediump float side_z_offset 1396#pragma mapbox: define lowp float border_width 1397#pragma mapbox: define lowp vec4 border_color 1398#pragma mapbox: define lowp float emissive_strength
1399float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 1400#pragma mapbox: initialize highp vec4 color 1401#pragma mapbox: initialize lowp float floorwidth 1402#pragma mapbox: initialize mediump uvec4 dash 1403#pragma mapbox: initialize lowp float blur 1404#pragma mapbox: initialize lowp float opacity 1405#pragma mapbox: initialize mediump float side_z_offset 1406#pragma mapbox: initialize lowp float border_width 1407#pragma mapbox: initialize lowp vec4 border_color 1408#pragma mapbox: initialize lowp float emissive_strength 1409float dist=length(v_normal)*v_width2_dilute.x;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0; 1410#ifdef RENDER_LINE_BORDER 1411#ifndef VARIABLE_LINE_WIDTH 1412ANTIALIASING*=8.0; 1413#endif 1414#endif 1415#ifdef VARIABLE_LINE_WIDTH 1416blur=mix(blur,0.0,stub_side); 1417#endif 1418float 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);float pxStep;float delta; 1419#ifdef RENDER_LINE_BORDER 1420#ifndef VARIABLE_LINE_WIDTH 1421pxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0; 1422#endif 1423#endif 1424#ifdef RENDER_LINE_DASH 1425float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=ANTIALIASING/(float(dash.z)+float(dash.w)/65535.0);float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); 1426#endif 1427highp vec4 out_color; 1428#ifdef RENDER_LINE_GRADIENT 1429out_color=texture(u_gradient_image,v_uv.xy); 1430#else 1431out_color=color; 1432#endif 1433float trim_alpha=1.0; 1434#ifdef RENDER_LINE_TRIM_OFFSET 1435highp 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; 1436#ifdef RENDER_LINE_GRADIENT 1437gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress); 1438#endif 1439highp 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;} 1440#endif 1441if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 1442#ifdef RENDER_LINE_BORDER 1443#ifndef VARIABLE_LINE_WIDTH 1444float edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) { 1445#ifdef RENDER_LINE_BORDER_GRADIENT 1446vec4 border_gradient_color=texture(u_border_gradient_image,v_uv.xy);out_color=mix(border_gradient_color*trim_alpha,out_color,alpha2); 1447#else 1448if (border_color.a==0.0) { 1449#ifndef RENDER_LINE_GRADIENT 1450float 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-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);} 1451#else 1452out_color.rgb*=(0.6+0.4*alpha2); 1453#endif 1454} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);} 1455#endif 1456out_color*=v_width2_dilute.w;} 1457#endif 1458#endif 1459vec2 cutout_factors=vec2(0.0); 1460#ifdef FEATURE_CUTOUT 1461cutout_factors=get_cutout_factors(gl_FragCoord); 1462#endif 1463#ifdef LIGHTING_3D_MODE 1464out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1465#ifdef RENDER_SHADOWS 1466float 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; 1467#ifdef ELEVATED_ROADS 1468out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1469#else 1470out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1471#endif 1472#endif 1473#endif 1474#ifdef FOG 1475out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1476#endif 1477out_color*=(alpha*diluted_opacity*u_opacity_multiplier); 1478#ifdef INDICATOR_CUTOUT 1479out_color=applyCutout(out_color,v_z_offset); 1480#endif 1481#ifdef FEATURE_CUTOUT 1482float z=0.0; 1483#ifdef ELEVATED_ROADS 1484z=v_road_z_offset; 1485#endif 1486out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z); 1487#endif 1488#ifdef LINE_BLEND_ADDITIVE 1489{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);} 1490#else 1491#ifdef LINE_BLEND_MULTIPLY 1492glFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0); 1493#else 1494glFragColor=out_color; 1495#endif 1496#endif 1497#ifdef DUAL_SOURCE_BLENDING 1498glFragColorSrc1=vec4(vec3(0.0),emissive_strength); 1499#else 1500#ifdef USE_MRT1 1501out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1502#endif 1503#endif 1504#ifdef OVERDRAW_INSPECTOR 1505glFragColor=vec4(1.0); 1506#endif 1507#ifdef DEBUG_ELEVATION_ID 1508glFragColor=vec4(v_elevation_id_col,1.0); 1509#endif 1510if (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1511#include "_prelude_shadow.vertex.glsl" 1512#include "_prelude_terrain.vertex.glsl" 1513#define EXTRUDE_SCALE 0.015873016 1514in ivec2 a_pos_normal;in uvec4 a_data; 1515#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH) 1516in vec4 a_z_offset_width; 1517#endif 1518#ifdef DEBUG_ELEVATION_ID 1519in vec3 a_elevation_id_col; 1520#endif 1521#ifdef DEBUG_ELEVATION_ID 1522out vec3 v_elevation_id_col; 1523#endif 1524#ifdef ELEVATION_GROUND_SCALE 1525in float a_elevation_ground_scale; 1526#endif 1527#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE) 1528in highp vec3 a_packed; 1529#endif 1530#ifdef RENDER_LINE_DASH 1531in float a_linesofar; 1532#endif 1533uniform 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 float u_z_offset;uniform highp float u_road_view_depth_bias;uniform highp vec4 u_road_clip_to_view; 1534#ifdef RENDER_LINE_CURVE 1535uniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count; 1536#endif 1537#ifdef ELEVATED 1538uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1539#ifdef ELEVATION_REFERENCE_SEA 1540return 0.0; 1541#else 1542return elevation(apos); 1543#endif 1544} 1545#endif 1546out vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out vec2 v_tile_pos; 1547#ifdef ELEVATED_ROADS 1548out highp float v_road_z_offset; 1549#endif 1550#ifdef VARIABLE_LINE_WIDTH 1551out float stub_side; 1552#endif 1553#ifdef RENDER_LINE_DASH 1554uniform highp float u_floor_width_scale;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 1555#endif 1556#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1557out highp vec3 v_uv; 1558#endif 1559#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) 1560uniform float u_image_height; 1561#endif 1562#ifdef INDICATOR_CUTOUT 1563out highp float v_z_offset; 1564#endif 1565#ifdef RENDER_SHADOWS 1566uniform 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; 1567#endif 1568#pragma mapbox: define highp vec4 color 1569#pragma mapbox: define lowp float floorwidth 1570#pragma mapbox: define mediump uvec4 dash 1571#pragma mapbox: define lowp float blur 1572#pragma mapbox: define lowp float opacity 1573#pragma mapbox: define mediump float gapwidth 1574#pragma mapbox: define lowp float offset 1575#pragma mapbox: define mediump float width 1576#pragma mapbox: define mediump float side_z_offset 1577#pragma mapbox: define lowp float border_width 1578#pragma mapbox: define lowp vec4 border_color 1579#pragma mapbox: define lowp float emissive_strength 1580#ifdef RENDER_LINE_CURVE 1581vec3 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
1581=t*t;float t3=t2*t;return 0.5*( 15822.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 1583);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*( 1584(-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 1585);}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;} 1586#endif 1587void main() { 1588#pragma mapbox: initialize highp vec4 color 1589#pragma mapbox: initialize lowp float floorwidth 1590#pragma mapbox: initialize mediump uvec4 dash 1591#pragma mapbox: initialize lowp float blur 1592#pragma mapbox: initialize lowp float opacity 1593#pragma mapbox: initialize mediump float gapwidth 1594#pragma mapbox: initialize lowp float offset 1595#pragma mapbox: initialize mediump float width 1596#pragma mapbox: initialize mediump float side_z_offset 1597#pragma mapbox: initialize lowp float border_width 1598#pragma mapbox: initialize lowp vec4 border_color 1599#pragma mapbox: initialize lowp float emissive_strength 1600#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH 1601emissive_strength=a_z_offset_width.w; 1602#endif 1603float a_z_offset=u_z_offset; 1604#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1605a_z_offset+=a_z_offset_width.x; 1606#endif 1607#ifdef DEBUG_ELEVATION_ID 1608v_elevation_id_col=a_elevation_id_col; 1609#endif 1610highp float line_progress=0.0; 1611#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE) 1612line_progress=a_packed[2]; 1613#endif 1614float ANTIALIASING=1.0/u_device_pixel_ratio/2.0; 1615#ifdef RENDER_LINE_BORDER 1616#ifndef VARIABLE_LINE_WIDTH 1617ANTIALIASING*=8.0; 1618#endif 1619#endif 1620vec2 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; 1621#ifdef RENDER_LINE_CURVE 1622CurveResult 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; 1623#endif 1624gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0; 1625#ifdef VARIABLE_LINE_WIDTH 1626float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=u_width_scale*(left ? left_width : right_width);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*=apply;}offset=border_width > 0.0 ? (left_width+right_width)*u_width_scale : 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;symmetric_outset=zero_right_width ? u_width_scale*left_width : halfwidth;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; 1627#else 1628halfwidth=(u_width_scale*width)/2.0; 1629#endif 1630float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth > 0.0 ? ANTIALIASING : 0.0);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;
1630vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1631#ifdef ELEVATED_ROADS 1632v_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0); 1633#else 1634#ifdef ELEVATED 1635vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset; 1636#ifdef ELEVATION_GROUND_SCALE 1637scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale); 1638#endif 1639#ifdef CROSS_SLOPE_VERTICAL 1640float 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); 1641#else 1642#ifdef CROSS_SLOPE_HORIZONTAL 1643float 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; 1644#else 1645float 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; 1646#endif 1647#endif 1648v_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_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); 1649#else 1650v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0); 1651#endif 1652#endif 1653#ifndef ELEVATED 1654#ifndef VARIABLE_LINE_WIDTH 1655#ifndef RENDER_TO_TEXTURE 1656float 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 (width >=1.0 && 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 if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else 1657{ 1658#ifdef RENDER_LINE_BORDER 1659float 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); 1660#endif 1661}} 1662#endif 1663#endif 1664v_tile_pos=(v_tile_pos+extrude)/EXTENT; 1665#ifdef ELEVATED_ROADS 1666gl_Position=gl_Position+projected_extrude; 1667#ifdef VARIABLE_LINE_WIDTH 1668#ifndef ELEVATED 1669if (u_road_view_depth_bias > 0.0) {highp float z_in=gl_Position.z/gl_Position.w*0.5+0.5;highp float a=u_road_clip_to_view.x;highp float b=u_road_clip_to_view.y;highp float c=u_road_clip_to_view.z;highp float d=u_road_clip_to_view.w;highp float view=(a*z_in+b)/(c*z_in+d);highp float view_new=view+u_road_view_depth_bias;highp float z_new=(view_new*d-b)/(a-view_new*c);z_new=clamp(z_new,0.0,1.0);gl_Position.z=(z_new*2.0-1.0)*gl_Position.w;} 1670#endif 1671#endif 1672#else 1673gl_Position=mix(gl_Position+projected_extrude,AWAY,hidden); 1674#endif 1675#endif 1676#ifdef ELEVATED_ROADS 1677#ifdef RENDER_SHADOWS 1678vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1679#ifdef NORMAL_OFFSET 1680vec3 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(); 1681#endif 1682v_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; 1683#endif 1684#endif 1685#ifndef RENDER_TO_TEXTURE 1686float 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)); 1687#else 1688v_gamma_scale=1.0; 1689#endif 1690#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1691highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1]; 1692#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) 1693highp 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); 1694#else 1695v_uv=vec3(a_uv_x,0.0,line_progress); 1696#endif 1697#endif 1698#ifdef RENDER_LINE_DASH 1699vec4 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); 1700#endif 1701v_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale); 1702#ifdef VARIABLE_LINE_WIDTH 1703v_width2_dilute.x=symmetric_outset; 1704#endif 1705#ifdef FOG 1706v_fog_pos=fog_position(pos); 1707#endif 1708#ifdef INDICATOR_CUTOUT 1709v_z_offset=a_z_offset; 1710#endif 1711}`),linePattern:ci(`#include "_prelude_fog.fragment.glsl" 1712#include "_prelude_lighting.glsl" 1713#include "_prelude_shadow.fragment.glsl" 1714#include "_prelude_indicator_cutout.fragment.glsl" 1715uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
1715uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;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; 1716#ifdef APPLY_LUT_ON_GPU 1717uniform highp sampler3D u_lutTexture; 1718#endif 1719#ifdef LINE_PATTERN_TRANSITION 1720uniform float u_pattern_transition; 1721#endif 1722in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 1723#ifdef RENDER_LINE_TRIM_OFFSET 1724in highp vec3 v_uv; 1725#endif 1726#ifdef ELEVATED_ROADS 1727in highp float v_road_z_offset; 1728#endif 1729#ifdef LINE_JOIN_NONE 1730in vec2 v_pattern_data; 1731#endif 1732#ifdef INDICATOR_CUTOUT 1733in highp float v_z_offset; 1734#endif 1735#ifdef RENDER_SHADOWS 1736uniform 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; 1737#endif 1738#pragma mapbox: define mediump uvec4 pattern 1739#ifdef LINE_PATTERN_TRANSITION 1740#pragma mapbox: define mediump uvec4 pattern_b 1741#endif 1742#pragma mapbox: define mediump float pixel_ratio 1743#pragma mapbox: define mediump float blur 1744#pragma mapbox: define mediump float opacity 1745#pragma mapbox: define lowp float emissive_strength 1746void main() { 1747#pragma mapbox: initialize mediump uvec4 pattern 1748#ifdef LINE_PATTERN_TRANSITION 1749#pragma mapbox: initialize mediump uvec4 pattern_b 1750#endif 1751#pragma mapbox: initialize mediump float pixel_ratio 1752#pragma mapbox: initialize mediump float blur 1753#pragma mapbox: initialize mediump float opacity 1754#pragma mapbox: initialize lowp float emissive_strength 1755vec2 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); 1756#ifdef APPLY_LUT_ON_GPU 1757color=applyLUT(u_lutTexture,color); 1758#endif 1759#ifdef LINE_PATTERN_TRANSITION 1760vec2 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; 1761#endif 1762#ifdef RENDER_LINE_TRIM_OFFSET 1763highp 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);} 1764#endif 1765#ifdef LINE_JOIN_NONE 1766highp 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);} 1767#endif 1768#ifdef LIGHTING_3D_MODE 1769color=apply_lighting_with_emission_ground(color,emissive_strength); 1770#ifdef RENDER_SHADOWS 1771float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1772#ifdef ELEVATED_ROADS 1773color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1774#else 1775color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1776#endif 1777#endif 1778#endif 1779#ifdef FOG 1780color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1781#endif 1782color*=(alpha*opacity*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 1783#ifdef INDICATOR_CUTOUT 1784color=applyCutout(color,v_z_offset); 1785#endif 1786glFragColor=color; 1787#ifdef DUAL_SOURCE_BLENDING 1788glFragColorSrc1=vec4(vec3(0.0),emissive_strength); 1789#else 1790#ifdef USE_MRT1 1791out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1792#endif 1793#endif 1794#ifdef OVERDRAW_INSPECTOR 1795glFragColor=vec4(1.0); 1796#endif 1797HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1798#include "_prelude_shadow.vertex.glsl" 1799#include "_prelude_terrain.vertex.glsl" 1800#define scale 0.015873016 1801in ivec2 a_pos_normal;in uvec4 a_data; 1802#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1803in vec4 a_z_offset_width; 1804#endif 1805#ifdef ELEVATION_GROUND_SCALE 1806in float a_elevation_ground_scale; 1807#endif 1808#ifdef RENDER_LINE_TRIM_OFFSET 1809in highp vec3 a_packed; 1810#endif 1811in highp float a_linesofar; 1812#ifdef LINE_JOIN_NONE 1813in highp vec3 a_pattern_data;out vec2 v_pattern_data; 1814#endif 1815#ifdef INDICATOR_CUTOUT 1816out highp float v_z_offset; 1817#endif 1818uniform 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; 1819#ifdef ELEVATED 1820uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1821#ifdef ELEVATION_REFERENCE_SEA 1822return 0.0; 1823#else 1824return elevation(apos); 1825#endif 1826} 1827#endif 1828out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 1829#ifdef RENDER_LINE_TRIM_OFFSET 1830out highp vec3 v_uv; 1831#endif 1832#ifdef ELEVATED_ROADS 1833out highp float v_road_z_offset; 1834#endif 1835#ifdef RENDER_SHADOWS 1836uniform 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; 1837#endif 1838#pragma mapbox: define mediump float blur 1839#pragma mapbox: define mediump float opacity 1840#pragma mapbox: define mediump float offset 1841#pragma mapbox: define mediump float gapwidth 1842#pragma mapbox: define mediump float width 1843#pragma mapbox: define mediump float floorwidth 1844#pragma mapbox: define mediump uvec4 pattern 1845#ifdef LINE_PATTERN_TRANSITION 1846#pragma mapbox: define mediump uvec4 pattern_b 1847#endif 1848#pragma mapbox: define mediump float pixel_ratio 1849#pragma mapbox: define lowp float emissive_strength 1850void main() { 1851#pragma mapbox: initialize mediump float blur 1852#pragma mapbox: initialize mediump float opacity 1853#pragma mapbox: initialize mediump float offset 1854#pragma mapbox: initialize mediump float gapwidth 1855#pragma mapbox: initialize mediump float width 1856#pragma mapbox: initialize mediump float floorwidth 1857#pragma mapbox: initialize mediump uvec4 pattern 1858#ifdef LINE_PATTERN_TRANSITION 1859#pragma mapbox: initialize mediump uvec4 pattern_b 1860#endif 1861#pragma mapbox: initialize mediump float pixel_ratio 1862#pragma mapbox: initialize lowp float emissive_strength 1863float a_z_offset; 1864#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1865a_z_offset=a_z_offset_width.x; 1866#endif 1867float 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;
1867vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1868#ifdef ELEVATED_ROADS 1869v_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; 1870#else 1871#ifdef ELEVATED 1872vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset; 1873#ifdef ELEVATION_GROUND_SCALE 1874scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale); 1875#endif 1876#ifdef CROSS_SLOPE_VERTICAL 1877float 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); 1878#else 1879#ifdef CROSS_SLOPE_HORIZONTAL 1880float 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; 1881#else 1882float 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; 1883#endif 1884#endif 1885gl_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); 1886#else 1887gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1888#endif 1889#endif 1890#ifdef ELEVATED_ROADS 1891#ifdef RENDER_SHADOWS 1892vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1893#ifdef NORMAL_OFFSET 1894vec3 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(); 1895#endif 1896v_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; 1897#endif 1898#endif 1899#ifndef RENDER_TO_TEXTURE 1900float 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)); 1901#else 1902v_gamma_scale=1.0; 1903#endif 1904#ifdef RENDER_LINE_TRIM_OFFSET 1905highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 1906#endif 1907v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 1908#ifdef LINE_JOIN_NONE 1909v_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); 1910#endif 1911#ifdef FOG 1912v_fog_pos=fog_position(pos); 1913#endif 1914#ifdef INDICATOR_CUTOUT 1915v_z_offset=a_z_offset; 1916#endif 1917}`),raster:ci(`#include "_prelude_fog.fragment.glsl" 1918#include "_prelude_lighting.glsl" 1919#include "_prelude_raster_array.glsl" 1920uniform 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; 1921#ifdef PROJECTION_GLOBE_VIEW 1922in float v_split_fade; 1923#endif 1924uniform 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; 1925#ifndef RASTER_ARRAY 1926uniform highp sampler2D u_image0;uniform sampler2D u_image1; 1927#endif 1928#ifdef RASTER_COLOR 1929uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 1930#endif 1931void main() {vec4 color0,color1,color;vec2 value; 1932#ifdef RASTER_COLOR 1933#ifdef RASTER_ARRAY 1934#ifdef RASTER_ARRAY_LINEAR 1935value=mix( 1936raTexture2D_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 1937); 1938#else 1939value=mix( 1940raTexture2D_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 1941); 1942#endif 1943if (value.y > 0.0) value.x/=value.y; 1944#else 1945color=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); 1946#endif 1947color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 1948#else 1949color0=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); 1950#endif 1951color.a*=u_opacity; 1952#ifdef GLOBE_POLES 1953color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 1954#endif 1955vec3 rgb=color.rgb;rgb=vec3( 1956dot(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); 1957#ifdef LIGHTING_3D_MODE 1958out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 1959#endif 1960#ifdef FOG 1961highp 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)); 1962#endif 1963glFragColor=vec4(out_color*color.a,color.a); 1964#ifdef PROJECTION_GLOBE_VIEW 1965glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 1966#endif 1967#ifdef RENDER_CUTOFF 1968glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 1969#endif 1970#ifdef OVERDRAW_INSPECTOR 1971glFragColor=vec4(1.0); 1972#endif 1973#ifdef USE_MRT1 1974out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1975#endif 1976HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1977#include "_prelude_terrain.vertex.glsl" 1978uniform 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; 1979#ifdef ELEVATED 1980uniform lowp float u_zbias_factor; 1981#endif 1982#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 1983#ifdef GLOBE_POLES 1984in vec3 a_globe_pos;in vec2 a_uv; 1985#else 1986in ivec2 a_pos;in uvec2 a_texture_pos; 1987#endif 1988out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 1989#ifdef PROJECTION_GLOBE_VIEW 1990out float v_split_fade; 1991#endif 1992void main() {vec2 uv; 1993#ifdef GLOBE_POLES 1994vec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation; 1995#ifdef ELEVATION_REFERENCE_GROUND 1996ele+=elevation(uv*EXTENT); 1997#endif 1998globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0); 1999#ifdef FOG 2000v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 2001#endif 2002#else 2003vec4 world_pos; 2004#ifdef PROJECTION_GLOBE_VIEW 2005vec2 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]); 2006float tiles=u_grid_matrix[0][2];
2006if (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; 2007#ifdef ELEVATION_REFERENCE_GROUND 2008ele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z; 2009#endif 2010vec4 merc_world_pos=vec4(0.0); 2011v_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); 2012#ifdef FOG 2013v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2014#endif 2015#else 2016float ele=0.0;vec2 decodedPos=vec2(a_pos); 2017#ifdef ELEVATION_REFERENCE_GROUND 2018vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt; 2019#else 2020uv=vec2(a_texture_pos)/8192.0; 2021#endif 2022world_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0); 2023#ifdef FOG 2024v_fog_pos=fog_position(decodedPos); 2025#endif 2026#endif 2027float w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w; 2028#endif 2029v_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; 2030#ifdef ELEVATED 2031float 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); 2032#endif 2033#ifdef RENDER_CUTOFF 2034v_depth=gl_Position.z; 2035#endif 2036}`),symbol:ci(`#include "_prelude_lighting.glsl" 2037#include "_prelude_shadow.fragment.glsl" 2038#include "_prelude_indicator_cutout.fragment.glsl" 2039#include "_prelude_feature_cutout.fragment.glsl" 2040#define SDF_PX 8.0 2041#define SDF 1.0 2042#define ICON 0.0 2043uniform sampler2D u_texture; 2044#ifdef RENDER_TEXT_AND_SYMBOL 2045uniform sampler2D u_texture_icon; 2046#endif 2047uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_sdf;uniform lowp float u_scale_factor;uniform lowp float u_opacity_multiplier; 2048#ifdef ICON_TRANSITION 2049uniform float u_icon_transition; 2050#endif 2051#ifdef COLOR_ADJUSTMENT 2052uniform mat4 u_color_adj_mat; 2053#endif 2054#ifdef INDICATOR_CUTOUT 2055in highp float v_z_offset; 2056#else 2057#ifdef RENDER_SHADOWS 2058in highp float v_z_offset; 2059#endif 2060#endif 2061in vec2 v_tex_a; 2062#ifdef ICON_TRANSITION 2063in vec2 v_tex_b; 2064#endif 2065in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 2066#ifdef RENDER_TEXT_AND_SYMBOL 2067in float is_sdf;in vec2 v_tex_a_icon; 2068#endif 2069#ifdef RENDER_SHADOWS 2070uniform 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; 2071#endif 2072#ifdef APPLY_LUT_ON_GPU 2073uniform highp sampler3D u_lutTexture; 2074#endif 2075in lowp float v_opacity;in lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur; 2076#ifdef LIGHTING_3D_MODE 2077in lowp float v_emissive_strength; 2078#endif 2079void main() {lowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;if (u_is_sdf) {fill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;}lowp float emissive_strength=0.0; 2080#ifdef LIGHTING_3D_MODE 2081emissive_strength=v_emissive_strength; 2082#endif 2083vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 2084#ifdef RENDER_TEXT_AND_SYMBOL 2085if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity*u_opacity_multiplier;
2085glFragColor=texture(u_texture_icon,tex_icon)*alpha; 2086#ifdef OVERDRAW_INSPECTOR 2087glFragColor=vec4(1.0); 2088#endif 2089return;} 2090#endif 2091vec2 cutout_factors=vec2(0.0); 2092#ifdef FEATURE_CUTOUT 2093cutout_factors=get_cutout_factors(gl_FragCoord); 2094#endif 2095if (u_is_sdf) {float 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;} else { 2096#ifdef ICON_TRANSITION 2097vec4 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); 2098#else 2099out_color=texture(u_texture,v_tex_a); 2100#endif 2101#ifdef APPLY_LUT_ON_GPU 2102out_color=applyLUT(u_lutTexture,out_color); 2103#endif 2104#ifdef COLOR_ADJUSTMENT 2105out_color=u_color_adj_mat*out_color; 2106#endif 2107}out_color*=opacity*fade_opacity*u_opacity_multiplier; 2108#ifdef LIGHTING_3D_MODE 2109out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 2110#ifdef RENDER_SHADOWS 2111float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y); 2112#ifdef TERRAIN 2113out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 2114#else 2115out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 2116#endif 2117#endif 2118#endif 2119#ifdef INDICATOR_CUTOUT 2120out_color=applyCutout(out_color,v_z_offset); 2121#endif 2122#ifdef FEATURE_CUTOUT 2123out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,0.0); 2124#endif 2125glFragColor=out_color; 2126#ifdef OVERDRAW_INSPECTOR 2127glFragColor=vec4(1.0); 2128#endif 2129HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 2130#include "_prelude_shadow.vertex.glsl" 2131#define USING_APPEARANCE 1.0 2132in ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity; 2133#ifdef Z_OFFSET 2134in float a_auto_z_offset; 2135#endif 2136#ifdef PROJECTION_GLOBE_VIEW 2137in ivec4 a_globe_anchor;in vec3 a_globe_normal; 2138#endif 2139#ifdef ICON_TRANSITION 2140in uvec2 a_texb; 2141#endif 2142#ifdef OCCLUSION_QUERIES 2143in float a_occlusion_query_opacity; 2144#endif 2145#ifdef ELEVATED_ROADS 2146in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; 2147#endif 2148#ifdef INDICATOR_CUTOUT 2149out highp float v_z_offset; 2150#else 2151#ifdef RENDER_SHADOWS 2152out highp float v_z_offset; 2153#endif 2154#endif 2155uniform 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; 2156#ifdef RENDER_SHADOWS 2157uniform mat4 u_inv_matrix; 2158#endif 2159uniform 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; 2160#ifdef PROJECTION_GLOBE_VIEW 2161uniform vec3 u_up_vector; 2162#endif 2163#ifdef RENDER_TEXT_AND_SYMBOL 2164uniform vec2 u_texsize_icon; 2165#endif 2166uniform bool u_is_halo; 2167#ifdef PROJECTION_GLOBE_VIEW 2168uniform 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; 2169#endif 2170out vec2 v_tex_a; 2171#ifdef ICON_TRANSITION 2172out vec2 v_tex_b; 2173#endif 2174out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 2175#ifdef RENDER_TEXT_AND_SYMBOL 2176out float is_sdf;out vec2 v_tex_a_icon; 2177#endif 2178#ifdef RENDER_SHADOWS 2179uniform 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; 2180#endif 2181#ifndef MAX_UBO_SIZE_VEC4 2182#define MAX_UBO_SIZE_VEC4 1024u 2183#endif 2184#define SPP_HEADER_SIZE_VEC4 4u 2185struct 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;};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 highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;uniform highp float u_spp_zoom_fraction;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 v_opacity;out lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur; 2186#ifdef LIGHTING_3D_MODE 2187out lowp float v_emissive_strength; 2188#endif 2189float zoomFactor(float zm,float zM) {if (zm==zM) return u_spp_zoom_fraction-zm >=0.0 ? 1.0 : 0.0;return clamp((u_spp_zoom_fraction-zm)/(zM-zm),0.0,1.0);}vec4 readColor(uint base,bool isDataDriven,uint offsetVec4,uint dzr,vec2 headerZoom,vec4 fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;vec2 zr=mix(headerZoom,blockZoom,float(dzr));return unpack_mix_color(value,zoomFactor(zr.x,zr.y));}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x : 2190(index==1u) ? v.y : 2191(index==2u) ? v.z : v.w;}
2191float readScalar(uint base,bool isDataDriven,uint offsetVec4,float fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 slot=u_spp_properties.properties[base+offsetVec4];return unpack_mix_vec2(slot.xy,zoomFactor(slot.z,slot.w));}vec2 readTranslate(uint base,bool isDataDriven,uint offsetVec4,uint dzr) {if (!isDataDriven) return vec2(0.0);vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;float t=zoomFactor(blockZoom.x,blockZoom.y)*float(dzr);return mix(value.xy,value.zw,t);}SymbolPaintProperties readSymbolPaintProperties() {uint dataDrivenMask=u_spp_header.header[0][0];uint dzrMask =u_spp_header.header[0][1];uint blockSizeVec4 =u_spp_header.header[0][2];uint fillColorDzr=dzrMask & 1u;uint haloColorDzr=(dzrMask >> 1u) & 1u;vec2 fillColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].xy);vec2 haloColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].zw);uint featureIndex=uint(a_feature_index);uvec4 indexSlot=u_spp_index.block_indices[featureIndex/4u];uint base=uvec4At(indexSlot,featureIndex % 4u)*blockSizeVec4;SymbolPaintProperties props;props.fill_np_color =readColor(base,(dataDrivenMask & (1u << 0u)) !=0u,u_spp_header.header[0][3],fillColorDzr,fillColorHeaderZoom,u_spp_fill_np_color);props.halo_np_color =readColor(base,(dataDrivenMask & (1u << 1u)) !=0u,u_spp_header.header[1][0],haloColorDzr,haloColorHeaderZoom,u_spp_halo_np_color);props.opacity =readScalar(base,(dataDrivenMask & (1u << 2u)) !=0u,u_spp_header.header[1][1],u_spp_opacity);props.halo_width =readScalar(base,(dataDrivenMask & (1u << 3u)) !=0u,u_spp_header.header[1][2],u_spp_halo_width);props.halo_blur =readScalar(base,(dataDrivenMask & (1u << 4u)) !=0u,u_spp_header.header[1][3],u_spp_halo_blur);props.emissive_strength=readScalar(base,(dataDrivenMask & (1u << 5u)) !=0u,u_spp_header.header[2][0],u_spp_emissive_strength);props.occlusion_opacity=readScalar(base,(dataDrivenMask & (1u << 6u)) !=0u,u_spp_header.header[2][1],u_spp_occlusion_opacity);props.z_offset =readScalar(base,(dataDrivenMask & (1u << 7u)) !=0u,u_spp_header.header[2][2],u_spp_z_offset);uint translateDzr=(dzrMask >> 8u) & 1u;props.translate =readTranslate(base,(dataDrivenMask & (1u << 8u)) !=0u,u_spp_header.header[2][3],translateDzr);return props;}vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;v_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur; 2192#ifdef LIGHTING_3D_MODE 2193v_emissive_strength=paint_properties.emissive_strength; 2194#endif 2195lowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;vec2 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); 2196#ifdef Z_OFFSET 2197e+=a_auto_z_offset; 2198#endif 2199vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 2200#ifdef PROJECTION_GLOBE_VIEW 2201mercator_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; 2202#else 2203world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 2204#endif 2205vec4 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 ? 2206camera_to_anchor_distance/u_camera_to_center_distance : 2207u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 22080.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; 2209#ifdef PROJECTION_GLOBE_VIEW 2210vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);
2210offsetprojected_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; 2211#else 2212offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 2213#endif 2214vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 2215#ifdef PROJECTION_GLOBE_VIEW 2216#ifdef PROJECTED_POS_ON_VIEWPORT 2217projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 2218#else 2219vec3 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); 2220#endif 2221#else 2222projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 2223#endif 2224highp 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); 2225#ifdef TERRAIN 2226#ifdef PITCH_WITH_MAP_TERRAIN 2227vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 2228#endif 2229#endif 2230#ifdef Z_OFFSET 2231z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; 2232#else 2233z+=u_pitch_with_map ? z_offset : 0.0; 2234#endif 2235float 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)); 2236#ifdef DEPTH_OCCLUSION 2237float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 2238#endif 2239#ifdef OCCLUSION_QUERIES 2240float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 2241#endif 2242#ifdef Z_TEST_OCCLUSION 2243out_fade_opacity*=occlusion_opacity; 2244#endif 2245float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; 2246#ifdef PROJECTION_GLOBE_VIEW 2247vec3 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; 2248#else 2249#ifdef ELEVATED_ROADS 2250vec3 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; 2251#else 2252pos=vec3(projected_pos.xy/projected_pos.w+offset,z); 2253#endif 2254#endif 2255gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2( 2256u_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 2257);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}float 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; 2258#ifdef RENDER_TEXT_AND_SYMBOL 2259is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 2260#endif 2261#ifdef ICON_TRANSITION 2262v_tex_b=vec2(a_texb)/u_texsize; 2263#endif 2264#ifdef RENDER_SHADOWS 2265vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; 2266#ifdef NORMAL_OFFSET 2267vec3 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(); 2268#endif 2269v_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; 2270#endif 2271#ifdef INDICATOR_CUTOUT 2272v_z_offset=e; 2273#else 2274#ifdef RENDER_SHADOWS 2275v_z_offset=e; 2276#endif 2277#endif 2278}`),terrainRaster:ci(`#include "_prelude_fog.fragment.glsl" 2279#include "_prelude_shadow.fragment.glsl" 2280#include "_prelude_lighting.glsl" 2281uniform sampler2D u_image0; 2282#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2283uniform sampler2D u_image1;uniform float u_emissive_texture_available; 2284#endif 2285in vec2 v_pos0; 2286#ifdef FOG 2287in float v_fog_opacity; 2288#endif 2289#ifdef RENDER_SHADOWS 2290in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 2291#endif 2292uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 2293#ifdef LIGHTING_3D_MODE 2294const vec3 normal=vec3(0.0,0.0,1.0); 2295#ifdef RENDER_SHADOWS 2296float cutoffOpacity=1.0; 2297#ifdef RENDER_CUTOFF 2298cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 2299#endif 2300#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2301float 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; 2302#else 2303float 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)); 2304#endif 2305#else 2306float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 2307#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2308float 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; 2309#endif 2310#endif 2311#else 2312color=image_color; 2313#endif 2314#ifdef FOG 2315#ifdef ZERO_EXAGGERATION 2316color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2317#else 2318color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 2319#endif 2320#endif 2321glFragColor=color; 2322#ifdef OVERDRAW_INSPECTOR 2323glFragColor=vec4(1.0); 2324#endif 2325HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2326#include "_prelude_terrain.vertex.glsl" 2327uniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0; 2328#ifdef FOG 2329out float v_fog_opacity; 2330#endif 2331#ifdef RENDER_SHADOWS 2332uniform 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; 2333#endif 2334void 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; 2335#ifdef VIEWPORT_ORIGIN_TOP_LEFT 2336v_pos0.y=1.0-v_pos0.y; 2337#endif 2338gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); 2339#ifdef FOG 2340#ifdef ZERO_EXAGGERATION 2341v_fog_pos=fog_position(decodedPos); 2342#else 2343v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 2344#endif 2345#endif 2346#ifdef RENDER_SHADOWS 2347vec3 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.); 2348#endif 2349}`),terrainDepth:ci("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 2350uniform 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:ci(`#include "_prelude_fog.fragment.glsl" 2351in 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( 2352cos_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
2352nd-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; 2353#ifdef FOG 2354sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 2355#endif 2356sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 2357#ifdef OVERDRAW_INSPECTOR 2358glFragColor=vec4(1.0); 2359#endif 2360}`,A1),skyboxGradient:ci(`#include "_prelude_fog.fragment.glsl" 2361in 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)); 2362#ifdef FOG 2363color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 2364#endif 2365color*=u_opacity;glFragColor=color; 2366#ifdef OVERDRAW_INSPECTOR 2367glFragColor=vec4(1.0); 2368#endif 2369}`,A1),skyboxCapture:ci(` 2370in 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; 2371#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 2372#define BETA_M vec3(21e-6,21e-6,21e-6) 2373#define MIE_G 0.76 2374#define DENSITY_HEIGHT_SCALE_R 8000.0 2375#define DENSITY_HEIGHT_SCALE_M 1200.0 2376#define PLANET_RADIUS 6360e3 2377#define ATMOSPHERE_RADIUS 6420e3 2378#define SAMPLE_STEPS 10 2379#define DENSITY_STEPS 4 2380float 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);}
2380float 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))/(e
2380nd-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz; 2381#ifndef VIEWPORT_ORIGIN_TOP_LEFT 2382v_position.y*=-1.0; 2383#endif 2384v_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:ci(`#include "_prelude_fog.fragment.glsl" 2385#include "_prelude_lighting.glsl" 2386uniform sampler2D u_image0; 2387#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2388uniform sampler2D u_image1;uniform float u_emissive_texture_available; 2389#endif 2390uniform float u_far_z_cutoff;in vec2 v_pos0; 2391#ifndef FOG 2392uniform 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; 2393#endif 2394void main() {vec4 color; 2395#ifdef CUSTOM_ANTIALIASING 2396highp vec2 uv=gl_FragCoord.xy/u_viewport;FLIP_VIEWPORT_UV_Y(uv);highp vec3 ray_dir=mix( 2397mix(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); 2398#ifdef LIGHTING_3D_MODE 2399#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2400float 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); 2401#else 2402raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 2403#endif 2404#else 2405color=vec4(raster.rgb*antialias,raster.a*antialias); 2406#endif 2407#else 2408color=texture(u_image0,v_pos0); 2409#ifdef LIGHTING_3D_MODE 2410#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2411float 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; 2412#else 2413color=apply_lighting_ground(color); 2414#endif 2415#endif 2416#endif 2417#ifdef FOG 2418color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2419#endif 2420color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 2421#ifdef OVERDRAW_INSPECTOR 2422glFragColor=vec4(1.0); 2423#endif 2424HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2425#include "_prelude_terrain.vertex.glsl" 2426uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix; 2427#ifndef GLOBE_POLES 2428uniform mat4 u_merc_matrix; 2429#endif 2430uniform float u_zoom_transition;uniform vec2 u_merc_center; 2431#ifndef GLOBE_POLES 2432uniform mat3 u_grid_matrix; 2433#endif 2434uniform float u_skirt_height; 2435#ifdef GLOBE_POLES 2436in vec3 a_globe_pos;in vec2 a_uv; 2437#else 2438in ivec2 a_pos; 2439#endif 2440out vec2 v_pos0;void main() { 2441#ifdef GLOBE_POLES 2442vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 2443#else 2444float 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); 2445#endif 2446v_pos0=uv; 2447#ifdef VIEWPORT_ORIGIN_TOP_LEFT 2448v_pos0.y=1.0-v_pos0.y; 2449#endif 2450vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 2451#ifdef GLOBE_POLES 2452vec3 up_vector=globe_derived_up_vector; 2453#else 2454vec3 up_vector=elevationVector(tile_pos); 2455#endif 2456float height=elevation(tile_pos);globe_pos+=up_vector*height; 2457#ifndef GLOBE_POLES 2458globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 2459#endif 2460#ifdef GLOBE_POLES 2461vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 2462#else 2463vec4 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); 2464#endif 2465gl_Position=u_proj_matrix*interpolated_pos; 2466#ifdef FOG 2467v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2468#endif 2469}`),globeAtmosphere:ci(`#include "_prelude_fog.fragment.glsl" 2470uniform 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; 2471#ifdef PROJECTION_GLOBE_VIEW 2472globe_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) { 2473#ifdef ALPHA_PASS 2474glFragColor=vec4(0,0,0,0);return; 2475#else 2476#ifdef NATIVE 2477glFragColor=vec4(1,1,1,1); 2478#else 2479glFragColor=vec4(0,0,0,1); 2480#endif 2481return; 2482#endif 2483} 2484#endif 2485highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 24860.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 2487#ifdef PROJECTION_GLOBE_VIEW 2488highp 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 ? 2489PI-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); 2490#else 2491horizon_angle=horizon_angle_mercator; 2492#endif 2493horizon_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;
2493vec3 color_stop_2=u_space_color.rgb; 2494#ifdef ALPHA_PASS 2495float 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); 2496#else 2497vec3 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); 2498#endif 2499}`,`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( 2500mix(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( 2501mix(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);}`),stars:ci(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2502{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;}`,` 2503in 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);}`),occlusion:ci("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" 2504in 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; 2505#ifdef TERRAIN 2506float e=elevation(world_pos.xy);world_pos.z+=e; 2507#endif 2508vec4 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 Jh(i,e){const t=i.split(` 2509`);for(let n of t){if(n=n.trimStart(),n[0]!=="#"||!n.includes("if")||n.startsWith("#endif"))continue;const s=n.match(HE);if(s)for(const l of s)ZE.has(l)||e.add(l)}}function U1(i){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(i)}function ci(i,e){const t=new Set,n=[],s=[];i=i.replace(z1,(c,h)=>(s.push(h),"")),e=e.replace(z1,(c,h)=>(n.push(h),""));let l=new Set(t_);Jh(i,l),Jh(e,l);for(const c of[...n,...s])i_[c]||(i_[c]=new Set,Jh(O1[c],i_[c])),l=new Set([...l,...i_[c]]);return{fragmentSource:i=i.replace(F1,(c,h,p,_,y)=>(t.add(y),h==="define"?` 2510#ifndef HAS_UNIFORM_u_${y} 2511${U1(_)?"flat ":""}in ${p} ${_} ${y}; 2512#else 2513uniform ${p} ${_} u_${y}; 2514#endif 2515`:h==="initialize"?` 2516#ifdef HAS_UNIFORM_u_${y} 2517 ${p} ${_} ${y} = u_${y}; 2518#endif 2519`:h==="define-attribute"?` 2520#ifdef HAS_ATTRIBUTE_a_${y} 2521 in ${p} ${_} ${y}; 2522#endif 2523`:h==="initialize-attribute"?"":void 0)),vertexSource:e=e.replace(F1,(c,h,p,_,y)=>{const v=`MATERIAL_ATTRIBUTE_OFFSET_${y}`,b=_==="float"?"vec2":_,T=`GET_ATTRIBUTE_${b}(a_${y}, materialInfo, ${v})`,S=y.includes("color")?"color":b;return h==="define-attribute-vertex-shader-only"?` 2524#ifdef HAS_ATTRIBUTE_a_${y} 2525in ${p} ${_} a_${y}; 2526#endif 2527`:t.has(y)?h==="define"?` 2528#ifndef HAS_UNIFORM_u_${y} 2529uniform lowp float u_${y}_t; 2530 #if !defined(${v}) 2531 in ${p} ${b} a_${y}; 2532 #endif 2533${U1(_)?"flat ":""}out ${p} ${_} ${y}; 2534#else 2535uniform ${p} ${_} u_${y}; 2536#endif 2537`:h==="initialize"?S==="vec4"||S==="uvec4"?` 2538#ifndef HAS_UNIFORM_u_${y} 2539 ${y} = a_${y}; 2540#else 2541 ${p} ${_} ${y} = u_${y}; 2542#endif 2543`:` 2544#if !defined(HAS_UNIFORM_u_${y}) 2545 #ifdef ${v} 2546 ${y} = unpack_mix_${S}(${T}, u_${y}_t); 2547 #else 2548 ${y} = unpack_mix_${S}(a_${y}, u_${y}_t); 2549 #endif 2550#else 2551 ${p} ${_} ${y} = u_${y}; 2552#endif 2553`:h==="define-attribute"?` 2554#ifdef HAS_ATTRIBUTE_a_${y} 2555 in ${p} ${_} a_${y}; 2556 out ${p} ${_} ${y}; 2557#endif 2558`:h==="initialize-attribute"?` 2559#ifdef HAS_ATTRIBUTE_a_${y} 2560 ${y} = a_${y}; 2561#endif 2562`:void 0:h==="define"?` 2563#ifndef HAS_UNIFORM_u_${y} 2564uniform lowp float u_${y}_t; 2565 #if !defined(${v}) 2566 in ${p} ${b} a_${y}; 2567 #endif 2568#else 2569uniform ${p} ${_} u_${y}; 2570#endif 2571`:h==="define-instanced"?S==="mat4"?` 2572#ifdef INSTANCED_ARRAYS 2573in vec4 a_${y}0; 2574in vec4 a_${y}1; 2575in vec4 a_${y}2; 2576in vec4 a_${y}3; 2577#else 2578uniform ${p} ${_} u_${y}; 2579#endif 2580`:` 2581#ifdef INSTANCED_ARRAYS 2582in ${p} ${b} a_${y}; 2583#else 2584uniform ${p} ${_} u_${y}; 2585#endif 2586`:h==="initialize-attribute-custom"?` 2587#ifdef HAS_ATTRIBUTE_a_${y} 2588 ${p} ${_} ${y} = a_${y}; 2589#endif 2590`:S==="vec4"||S==="uvec4"?` 2591#ifndef HAS_UNIFORM_u_${y} 2592 #ifdef ${v} 2593 ${p} ${_} ${y} = ${T}; 2594 #else 2595 ${p} ${_} ${y} = a_${y}; 2596 #endif 2597#else 2598 ${p} ${_} ${y} = u_${y}; 2599#endif 2600`:` 2601#ifndef HAS_UNIFORM_u_${y} 2602 #ifdef ${v} 2603 ${p} ${_} ${y} = unpack_mix_${S}(${T}, u_${y}_t); 2604 #else 2605 ${p} ${_} ${y} = unpack_mix_${S}(a_${y}, u_${y}_t); 2606 #endif 2607#else 2608 ${p} ${_} ${y} = u_${y}; 2609#endif 2610`}),usedDefines:l,vertexIncludes:n,fragmentIncludes:s}}var XE={model:ci(`#include "_prelude_fog.fragment.glsl" 2611#include "_prelude_shadow.fragment.glsl" 2612#include "_prelude_lighting.glsl" 2613#include "_prelude_indicator_cutout.fragment.glsl" 2614#include "_prelude_feature_cutout.fragment.glsl" 2615uniform float u_opacity; 2616#ifdef DITHERED_DISCARD 2617uniform float u_dithered_discard_threshold; 2618#endif 2619#ifndef LIGHTING_3D_MODE 2620uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity; 2621#endif 2622uniform 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; 2623#ifdef RENDER_SHADOWS 2624in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 2625#endif 2626#ifdef OCCLUSION_TEXTURE_TRANSFORM 2627uniform vec4 u_occlusionTextureTransform; 2628#endif 2629#pragma mapbox: define-attribute highp vec3 normal_3f 2630#pragma mapbox: define-attribute highp vec3 color_3f 2631#pragma mapbox: define-attribute highp vec4 color_4f 2632#pragma mapbox: define-attribute highp vec2 uv_2f 2633#pragma mapbox: initialize-attribute highp vec3 normal_3f 2634#pragma mapbox: initialize-attribute highp vec3 color_3f 2635#pragma mapbox: initialize-attribute highp vec4 color_4f 2636#pragma mapbox: initialize-attribute highp vec2 uv_2f 2637#ifdef HAS_ATTRIBUTE_a_pbr 2638in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 2639#endif 2640#ifdef HAS_TEXTURE_u_baseColorTexture 2641uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;
2641uniform float u_alphaCutoff; 2642#endif 2643#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 2644uniform sampler2D u_metallicRoughnessTexture; 2645#endif 2646#ifdef HAS_TEXTURE_u_occlusionTexture 2647uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 2648#endif 2649#ifdef HAS_TEXTURE_u_normalTexture 2650uniform sampler2D u_normalTexture; 2651#endif 2652#ifdef HAS_TEXTURE_u_emissionTexture 2653uniform sampler2D u_emissionTexture; 2654#endif 2655#ifdef APPLY_LUT_ON_GPU 2656uniform highp sampler3D u_lutTexture; 2657#endif 2658#ifdef FEATURE_CUTOUT_VERTEX 2659in highp float v_cutout_factor; 2660#endif 2661#ifdef TERRAIN_FRAGMENT_OCCLUSION 2662in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 2663#ifdef DEPTH_D24 2664highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 2665#else 2666highp float unpack_depth_rgba(highp vec4 rgba_depth) 2667{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;} 2668#endif 2669bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 2670#ifdef FLIP_Y 2671coord.y=1.0-coord.y; 2672#endif 2673#ifdef DEPTH_D24 2674highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 2675#else 2676highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 2677#endif 2678return v_depth > depth+0.0005;} 2679#endif 2680#define saturate(_x) clamp(_x,0.,1.) 2681vec3 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) 2682{ 2683#ifdef LIGHTING_3D_MODE 2684vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 2685#ifdef RENDER_SHADOWS 2686lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2687#else 2688lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 2689#endif 2690return apply_lighting(albedo,transformed_normal,lighting_factor); 2691#else 2692vec3 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)-lightColor),vec3(1.0));return c3; 2693#endif 2694}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 2695#ifdef HAS_ATTRIBUTE_a_color_3f 2696albedo*=vec4(color_3f,1.0); 2697#endif 2698#ifdef HAS_ATTRIBUTE_a_pbr 2699#else 2700#ifdef HAS_ATTRIBUTE_a_color_4f 2701albedo*=color_4f; 2702#endif 2703#endif 2704#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 2705vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 2706#ifdef UNPREMULT_TEXTURE_IN_SHADER 2707texColor=vec4(unpremultiplyColor(texColor),1.0); 2708#endif 2709if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 2710#endif 2711vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 2712#ifdef APPLY_LUT_ON_GPU 2713color=applyLUT(u_lutTexture,color); 2714#endif 2715return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 2716#ifdef HAS_TEXTURE_u_normalTexture 2717highp 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; 2718#ifdef FLIP_Y 2719T=-T;B=-B; 2720#endif 2721highp 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; 2722#else 2723return mat3(1.0); 2724#endif 2725}highp vec3 getNormal(){highp vec3 n; 2726#ifdef HAS_ATTRIBUTE_a_normal_3f 2727n=normalize(normal_3f); 2728#else 2729highp 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)); 2730#ifdef FLIP_Y 2731n=normalize(cross(fdx,fdy)); 2732#else 2733n=normalize(cross(fdx,fdy))*-1.0; 2734#endif 2735#endif 2736#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2737vec3 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); 2738#endif 2739return 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; 2740#ifdef HAS_ATTRIBUTE_a_pbr 2741mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 2742#endif 2743#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2744vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 2745#endif 2746const 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) 2747{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);
2747float 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) 2748{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 2749{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) 2750{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) 2751{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) 2752{ 2753#ifdef LIGHTING_3D_MODE 2754return mat.diffuseColor; 2755#else 2756return mat.diffuseColor/PI; 2757#endif 2758}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 2759{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) 2760{vec3 env_light=vec3(0.65,0.65,0.65); 2761#ifdef LIGHTING_3D_MODE 2762float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 2763#endif 2764vec3 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) 2765{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; 2766#ifdef RENDER_SHADOWS 2767lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2768#else 2769lighting_factor=NdotL; 2770#endif 2771vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2771Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 2772#if !defined(LIGHTING_3D_MODE) 2773const 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); 2774#endif 2775color*=intensityFactor;return color;}void main() { 2776#ifdef TERRAIN_FRAGMENT_OCCLUSION 2777if (isOccluded()) {discard;} 2778#endif 2779vec3 lightDir;vec3 lightColor; 2780#ifdef LIGHTING_3D_MODE 2781lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 2782#else 2783lightDir=u_lightpos;lightColor=u_lightcolor; 2784#endif 2785vec4 finalColor; 2786#ifdef DIFFUSE_SHADED 2787vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 2788#ifdef HAS_TEXTURE_u_occlusionTexture 2789float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 2790#endif 2791finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 2792#else 2793Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 2794#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2795#ifdef OCCLUSION_TEXTURE_TRANSFORM 2796vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 2797#else 2798vec2 uv=uv_2f; 2799#endif 2800ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 2801#endif 2802vec4 emissive=u_emissiveFactor; 2803#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2804emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 2805#endif 2806#ifdef APPLY_LUT_ON_GPU 2807float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 2808#endif 2809color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 2810#ifdef HAS_ATTRIBUTE_a_pbr 2811float 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; 2812#ifdef APPLY_LUT_ON_GPU 2813color_mix=applyLUT(u_lutTexture,color_mix); 2814#endif 2815color=mix(color,color_mix,min(1.0,resEmission)); 2816#ifdef HAS_ATTRIBUTE_a_color_4f 2817float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2817y));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); 2818#endif 2819#endif 2820vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 2821#endif 2822#ifdef DITHERED_DISCARD 2823if (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;}} 2824#endif 2825#ifdef FOG 2826finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 2827#endif 2828#ifdef RENDER_CUTOFF 2829finalColor*=v_cutoff_opacity; 2830#endif 2831#ifdef INDICATOR_CUTOUT 2832finalColor=applyCutout(finalColor,v_position_height.w); 2833#endif 2834#ifdef FEATURE_CUTOUT_VERTEX 2835apply_feature_cutout_dither(gl_FragCoord,v_cutout_factor); 2836#else 2837#ifdef FEATURE_CUTOUT 2838finalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x,0.0); 2839#endif 2840#endif 2841glFragColor=finalColor; 2842#ifdef OVERDRAW_INSPECTOR 2843glFragColor=vec4(1.0); 2844#endif 2845HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2846#include "_prelude_shadow.vertex.glsl" 2847#include "_prelude_feature_cutout.vertex.glsl" 2848in vec3 a_pos_3f; 2849#pragma mapbox: define-attribute highp vec3 normal_3f 2850#pragma mapbox: define-attribute highp vec2 uv_2f 2851#pragma mapbox: define-attribute highp vec3 color_3f 2852#pragma mapbox: define-attribute highp vec4 color_4f 2853#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr 2854#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 2855uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 2856#ifdef INSTANCED_ARRAYS 2857in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2858#else 2859uniform highp mat4 u_normal_matrix; 2860#endif 2861#ifdef RENDER_SHADOWS 2862uniform 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; 2863#endif 2864out vec4 v_position_height;out lowp vec4 v_color_mix; 2865#ifdef TERRAIN_FRAGMENT_OCCLUSION 2866out highp float v_depth; 2867#endif 2868#ifdef FEATURE_CUTOUT_VERTEX 2869out highp float v_cutout_factor; 2870#endif 2871#ifdef HAS_ATTRIBUTE_a_pbr 2872out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 2873#endif 2874vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 2875#pragma mapbox: initialize-attribute highp vec3 normal_3f 2876#pragma mapbox: initialize-attribute highp vec2 uv_2f 2877#pragma mapbox: initialize-attribute highp vec3 color_3f 2878#pragma mapbox: initialize-attribute highp vec4 color_4f 2879#pragma mapbox: initialize-attribute-custom highp uvec4 pbr 2880#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 2881highp mat4 normal_matrix; 2882#ifdef INSTANCED_ARRAYS 2883normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2884#else 2885normal_matrix=u_normal_matrix; 2886#endif 2887#ifdef FEATURE_CUTOUT_VERTEX 2888v_cutout_factor=1.0; 2889#endif 2890vec3 local_pos;mat3 rs; 2891#ifdef MODEL_POSITION_ON_GPU 2892vec3 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; 2893#ifdef FEATURE_CUTOUT_VERTEX 2894highp vec4 ground_pos=vec4(pos_a.xy,0.0,1.0);highp vec4 cutout_clip_pos=mix(u_matrix*ground_pos,AWAY,hidden);highp vec3 cutout_ndc=cutout_clip_pos.xyz/cutout_clip_pos.w;vec2 uv=cutout_ndc.xy*0.5+0.5;highp float fragDepthNDC=cutout_ndc.z*0.5+0.5; 2895#ifdef FLIP_Y 2896fragDepthNDC=cutout_ndc.z; 2897#endif 2898highp float cutoutFactor=get_cutout_factors_vert(uv).x;highp float cutoutDepthNDC=sample_cutout_depth(u_cutout_depth_image,uv);highp float groundThreshold=0.001;
2898highp float groundLimit=clamp((fragDepthNDC+groundThreshold-cutoutDepthNDC)/groundThreshold+0.5,0.0,1.0);v_cutout_factor=mix(1.0-cutoutFactor,1.0,groundLimit); 2899#endif 2900#else 2901local_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); 2902#endif 2903v_position_height.w=a_pos_3f.z; 2904#ifdef HAS_ATTRIBUTE_a_pbr 2905vec4 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; 2906#endif 2907#ifdef FOG 2908v_fog_pos=fog_position(local_pos); 2909#endif 2910#ifdef RENDER_CUTOFF 2911v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2912#endif 2913#ifdef TERRAIN_FRAGMENT_OCCLUSION 2914v_depth=gl_Position.z/gl_Position.w; 2915#ifdef CLIP_ZERO_TO_ONE 2916v_depth=-1.0+2.0*v_depth; 2917#endif 2918#endif 2919#ifdef HAS_ATTRIBUTE_a_normal_3f 2920#ifdef MODEL_POSITION_ON_GPU 2921float 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); 2922#else 2923normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 2924#endif 2925#endif 2926#ifdef HAS_ATTRIBUTE_a_pbr 2927#ifdef HAS_ATTRIBUTE_a_color_4f 2928v_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); 2929#endif 2930#endif 2931#ifdef RENDER_SHADOWS 2932vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 2933#ifdef NORMAL_OFFSET 2934#ifdef HAS_ATTRIBUTE_a_normal_3f 2935#ifdef MODEL_POSITION_ON_GPU 2936vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2937#else 2938vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2939#endif 2940#endif 2941#endif 2942v_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; 2943#endif 2944}`),modelDepth:ci("void main() {}",`in vec3 a_pos_3f;uniform mat4 u_matrix; 2945#ifdef MODEL_POSITION_ON_GPU 2946#ifdef INSTANCED_ARRAYS 2947in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2948#else 2949uniform highp mat4 u_instance; 2950#endif 2951uniform highp mat4 u_node_matrix; 2952#endif 2953void main() { 2954#ifdef MODEL_POSITION_ON_GPU 2955highp mat4 instance; 2956#ifdef INSTANCED_ARRAYS 2957instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2958#else 2959instance=u_instance; 2960#endif 2961vec3 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;
2961rs[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); 2962#else 2963gl_Position=u_matrix*vec4(a_pos_3f,1); 2964#endif 2965}`),fillExtrusionDepth:ci("void main() {}",`#include "_prelude_terrain.vertex.glsl" 2966#include "_prelude_material_table.vertex.glsl" 2967uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 2968#ifdef TERRAIN 2969uniform int u_height_type;uniform int u_base_type; 2970#endif 2971in ivec4 a_pos_normal_ed; 2972#if defined(HAS_CENTROID) || defined(TERRAIN) 2973in uvec2 a_centroid_pos; 2974#endif 2975#ifdef RENDER_WALL_MODE 2976in ivec4 a_join_normal_inside; 2977#endif 2978#pragma mapbox: define highp float base 2979#pragma mapbox: define highp float height 2980#pragma mapbox: define highp float line_width 2981#pragma mapbox: define highp vec4 color 2982void main() {DECLARE_MATERIAL_TABLE_INFO 2983#pragma mapbox: initialize highp float base 2984#pragma mapbox: initialize highp float height 2985#pragma mapbox: initialize highp float line_width 2986#pragma mapbox: initialize highp vec4 color 2987base*=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); 2988#if defined(HAS_CENTROID) || defined(TERRAIN) 2989centroid_pos=vec2(a_centroid_pos); 2990#endif 2991vec3 pos; 2992#ifdef TERRAIN 2993bool 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); 2994#else 2995pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 2996#endif 2997#ifdef RENDER_WALL_MODE 2998vec3 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; 2999#endif 3000float 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);}`),fillExtrusionGroundEffect:ci(`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; 3001#ifdef SDF_SUBPASS 3002in 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);} 3003#ifdef FOG 3004in highp float v_fog; 3005#endif 3006#endif 3007void main() { 3008#ifdef CLEAR_SUBPASS 3009vec4 color=vec4(1.0); 3010#ifdef CLEAR_FROM_TEXTURE 3011color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 3012#endif 3013glFragColor=color; 3014#else 3015#ifdef SDF_SUBPASS 3016highp 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; 3017#ifdef FOG 3018fog=v_fog; 3019#endif 3020#ifdef RENDER_CUTOFF 3021fog*=v_cutoff_opacity; 3022#endif 3023glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 3024#else 3025#ifdef USE_MRT1 3026out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0); 3027#else
3028vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 3029#ifdef OVERDRAW_INSPECTOR 3030color=vec4(1.0); 3031#endif 3032glFragColor=color; 3033#endif 3034#endif 3035HANDLE_WIREFRAME_DEBUG; 3036#endif 3037}`,`#include "_prelude_fog.vertex.glsl" 3038in highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark; 3039#ifdef SDF_SUBPASS 3040out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 3041#ifdef FOG 3042out highp float v_fog; 3043#endif 3044#endif 3045uniform 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; 3046#pragma mapbox: define highp float flood_light_ground_radius 3047const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { 3048#pragma mapbox: initialize highp float flood_light_ground_radius 3049vec4 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; 3050#ifdef SDF_SUBPASS 3051v_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); 3052#ifdef FOG 3053v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 3054#endif 3055#endif 3056float hidden_by_landmark=0.0; 3057#ifdef HAS_CENTROID 3058hidden_by_landmark=float(a_hidden_by_landmark); 3059#endif 3060float 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)); 3061#ifdef RENDER_CUTOFF 3062v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 3063#endif 3064}`),groundShadow:ci(`#include "_prelude_shadow.fragment.glsl" 3065#include "_prelude_indicator_cutout.fragment.glsl" 3066#include "_prelude_feature_cutout.fragment.glsl" 3067precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 3068#ifdef FOG 3069in float v_fog_opacity; 3070#endif 3071void 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); 3072#ifdef RENDER_CUTOFF 3073shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 3074#endif 3075#ifdef FOG 3076shadow=mix(shadow,vec3(1.0),v_fog_opacity); 3077#endif 3078#ifdef INDICATOR_CUTOUT 3079shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 3080#endif 3081#ifdef FEATURE_CUTOUT 3082vec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy; 3083#ifdef FLIP_Y 3084uv.y=1.0-uv.y; 3085#endif 3086highp float cutoutFactor=get_cutout_factors(gl_FragCoord).y;highp float cutoutDepthNDC=sample_cutout_depth_bilinear(u_cutout_depth_image,uv);highp float fragDepthNDC=gl_FragCoord.z/u_feature_cutout_params.w;highp float groundThreshold=-0.001;highp float groundLimit=clamp((fragDepthNDC+groundThreshold-cutoutDepthNDC)/groundThreshold+0.5,0.0,1.0);cutoutFactor=mix(0.0,cutoutFactor,groundLimit);shadow=mix(shadow,vec3(1.0),cutoutFactor); 3087#endif 3088glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 3089uniform 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; 3090#ifdef FOG 3091out float v_fog_opacity; 3092#endif 3093void 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); 3094#ifdef FOG 3095v_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos); 3096#endif 3097}`)};const YE=(i,e)=>({u_matrix:i,u_ground_shadow_factor:e});
vendor: 40,833 bytes, line 3097
3097function j1(i,e,t=0){const n=Math.pow(2,e.tileID.overscaledZ),s=e.tileSize*Math.pow(2,i.transform.tileZoom)/n,l=s*(e.tileID.canonical.x+e.tileID.wrap*n),c=s*e.tileID.canonical.y;return{u_image:0,u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/Rf(e,1,i.transform.tileZoom),u_pixel_coord_upper:[l>>16,c>>16],u_pixel_coord_lower:[65535&l,65535&c],u_pattern_transition:t}}const r_={terrain:0,flat:1},KE=Jn(),G1=[0,0,0],H1=(i,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F=[0,0,1],O=!1)=>{let z=G1,N=0,j=G1;if(!O){const W=e.style.light,K=W.properties.get("position");if(z=[K.x,K.y,K.z],W.properties.get("anchor")==="viewport"){const le=Vl();Eo(le,-e.transform.angle),Io(z,z,le)}const ee=W.properties.get("color").toPremultipliedRenderColor(null);N=W.properties.get("intensity"),j=[ee.r,ee.g,ee.b]}const te=e.transform,G={u_matrix:i,u_lightpos:z,u_lightintensity:N,u_lightcolor:j,u_vertical_gradient:+t,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:KE,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:r_[_],u_base_type:r_[y],u_ao:s,u_edge_radius:l,u_width_scale:c,u_flood_light_color:S,u_vertical_scale:A,u_flood_light_intensity:C,u_ground_shadow_factor:D,u_front_cutoff_params:F};return te.projection.name==="globe"&&(G.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],G.u_zoom_transition=v,G.u_inv_rot_matrix=T,G.u_merc_center=b,G.u_up_dir=te.projection.upVector(new Rc(0,0,0),b[0]*We,b[1]*We),G.u_height_lift=p),G},Z1=new Float32Array(16);function $1(i,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F,O,z){const N=e.context,j=N.gl,te=e.transform,G=e.transform.zoom,W=[],K=i.translate,ee=i.translateAnchor,le=i.edgeRadius,de=Kh(e,i.cutoffFadeRange);y==="clear"?(W.push("CLEAR_SUBPASS"),O&&(W.push("CLEAR_FROM_TEXTURE"),N.activeTexture.set(j.TEXTURE0),O.bind(j.LINEAR,j.CLAMP_TO_EDGE))):y==="sdf"?W.push("SDF_SUBPASS"):y==="emissive"&&(W.push("USE_MRT1"),N.activeTexture.set(j.TEXTURE0),O.bind(j.LINEAR,j.CLAMP_TO_EDGE)),D&&W.push("HAS_CENTROID"),de.shouldRenderCutoff&&W.push("RENDER_CUTOFF");const ve=(xe,we,Fe,se,pe)=>{let ge=W;we.groundRadiusBuffer!=null&&(ge=W.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Se=we.programConfigurations.get(n.id),Me=e.isTileAffectedByFog(xe),Pe=e.getOrCreateProgram("fillExtrusionGroundEffect",{config:Se,defines:ge,overrideFog:Me}),Ie=((Be,Ke,Ne,He,ft,pt,xt,ht,wt,vt)=>({u_matrix:Be,u_opacity:Ke,u_ao_pass:Ne?1:0,u_meter_to_tile:He,u_ao:ft,u_flood_light_intensity:pt,u_flood_light_color:xt,u_attenuation:ht,u_edge_radius:wt,u_fb:0,u_fb_size:vt,u_dynamic_offset:1}))(se,v,_,pe,[b,T*pe],S,A,C,G>=17?0:le*pe,O?O.size[0]:0),Oe=[];D&&Oe.push(we.hiddenByLandmarkVertexBuffer),we.groundRadiusBuffer!=null&&Oe.push(we.groundRadiusBuffer),e.uploadCommonUniforms(N,Pe,xe.toUnwrapped(),null,de),Pe.draw(e,N.gl.TRIANGLES,l,c,h,p,Ie,n.id,we.vertexBuffer,we.indexBuffer,Fe,n.paint,G,Se,Oe)};for(const xe of s){const we=t.getTile(xe),Fe=we.getBucket(n);if(!Fe||Fe.projection.name!==te.projection.name||!Fe.groundEffect||Fe.groundEffect&&!Fe.groundEffect.hasData())continue;const se=Fe.groundEffect,pe=1/Fe.tileToMeter;{const ge=e.translatePosMatrix(xe.projMatrix,we,K,ee),Se=se.getDefaultSegment();ve(xe,se,Se,ge,pe)}if(F)for(let ge=0;ge<4;ge++){const Se=vx[ge](xe),Me=t.getTile(Se);if(!Me)continue;const Pe=Me.getBucket(n);if(!Pe||Pe.projection.name!==te.projection.name||!Pe.groundEffect||Pe.groundEffect&&!Pe.groundEffect.hasData())continue;const Ie=Pe.groundEffect;let Oe,Be;ge===0?(Oe=[-8192,0,0],Be=1):ge===1?(Oe=[We,0,0],Be=0):ge===2?(Oe=[0,-8192,0],Be=3):(Oe=[0,We,0],Be=2);const Ke=Ie.regionSegments[Be];Ke&&(Wi(Z1,xe.projMatrix,Oe),ve(xe,Ie,Ke,e.translatePosMatrix(Z1,we,K,ee),pe))}}}const JE={model:i=>({u_matrix:new Kr(i),u_lighting_matrix:new Kr(i),u_normal_matrix:new Kr(i),u_node_matrix:new Kr(i),u_lightpos:new dr(i),u_lightintensity:new St(i),u_lightcolor:new dr(i),u_camera_pos:new dr(i),u_opacity:new St(i),u_baseColorFactor:new ks(i),u_emissiveFactor:new ks(i),u_metallicFactor:new St(i),u_roughnessFactor:new St(i),u_baseTextureIsAlpha:new hr(i),u_alphaMask:new hr(i),u_alphaCutoff:new St(i),u_baseColorTexture:new hr(i),u_metallicRoughnessTexture:new hr(i),u_normalTexture:new hr(i),u_occlusionTexture:new hr(i),u_emissionTexture:new hr(i),u_lutTexture:new hr(i),u_color_mix:new ks(i),u_aoIntensity:new St(i),u_emissive_strength:new St(i),u_occlusionTextureTransform:new ks(i),u_dithered_discard_threshold:new St(i)}),modelDepth:i=>({u_matrix:new Kr(i),u_instance:new Kr(i),u_node_matrix:new Kr(i)}),groundShadow:i=>({u_matrix:new Kr(i),u_ground_shadow_factor:new dr(i)}),fillExtrusionDepth:i=>({u_matrix:new Kr(i),u_edge_radius:new St(i),u_width_scale:new St(i),u_vertical_scale:new St(i),u_height_type:new hr(i),u_base_type:new hr(i)}),fillExtrusionGroundEffect:i=>({u_matrix:new Kr(i),u_opacity:new St(i),u_ao_pass:new St(i),u_meter_to_tile:new St(i),u_ao:new Mr(i),u_flood_light_intensity:new St(i),u_flood_light_color:new dr(i),u_attenuation:new St(i),u_edge_radius:new St(i),u_fb:new hr(i),u_fb_size:new St(i),u_dynamic_offset:new St(i)})};function q1(i){const e=i.properties.get("direction"),t=nl(e.x,e.y,e.z);t[2]=yt(t[2],0,75);const n=Kc([t[0],t[1],t[2]]);return Tr(n.x,n.y,n.z)}function W1(i,e,t){const n=e.properties.get("color-use-theme")==="none",s=e.properties.get("color"),l=e.properties.get("intensity"),c=e.properties.get("direction"),h=[c.x,c.y,c.z],p=t.properties.get("color-use-theme")==="none",_=t.properties.get("color"),y=t.properties.get("intensity"),v=Math.max(Di([0,0,1],h),0),b=[0,0,0];oi(b,_.toPremultipliedRenderColor(p?null:i.getLut(e.scope)).toArray01Linear().slice(0,3),y);const T=[0,0,0];return oi(T,s.toPremultipliedRenderColor(n?null:i.getLut(t.scope)).toArray01Linear().slice(0,3),v*l),Xu([b[0]>0?b[0]/(b[0]+T[0]):0,b[1]>0?b[1]/(b[1]+T[1]):0,b[2]>0?b[2]/(b[2]+T[2]):0])}const n_=[];function X1(i){return n_[i]=n_[i]||new Float64Array(16)}const o_=[],QE=new Float32Array(16);class eS{constructor(e,t){this.aabb=e,this.lastCascade=t}}class tS{add(e,t){const n=this.receivers[e.key];n!==void 0?(n.aabb.min[0]=Math.min(n.aabb.min[0],t.min[0]),n.aabb.min[1]=Math.min(n.aabb.min[1],t.min[1]),n.aabb.min[2]=Math.min(n.aabb.min[2],t.min[2]),n.aabb.max[0]=Math.max(n.aabb.max[0],t.max[0]),n.aabb.max[1]=Math.max(n.aabb.max[1],t.max[1]),n.aabb.max[2]=Math.max(n.aabb.max[2],t.max[2])):this.receivers[e.key]=new eS(t,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(e,t,n){const s=zi.fromPoints(e.points);let l=0;for(const c in this.receivers){const h=this.receivers[c];if(!h||!s.intersectsAabb(h.aabb))continue;h.aabb.min=s.closestPoint(h.aabb.min),h.aabb.max=s.closestPoint(h.aabb.max);const p=h.aabb.getCorners();for(let _=0;_<n.length;_++){let y=!0;for(const v of p){const b=[v[0]*t,v[1]*t,v[2]];if(hi(b,b,n[_].matrix),b[0]<-1||b[0]>1||b[1]<-1||b[1]>1){y=!1;break}}if(h.lastCascade=_,l=Math.max(l,_),y)break}}return l+1}}function s_(i,e,t){const n=xr([],Li([],t,e),Li([],i,e)),s=Xi(n);return s===0?[0,0,1,0]:(oi(n,n,1/s),[n[0],n[1],n[2],-Di(n,e)])}function iS(i,e,t,n,s,l){const c=i.zoom,h=i.scale,p=i.worldSize,_=1/p,y=i.aspect,v=Math.sqrt(1+y*y)*Math.tan(.5*i.fovX),b=v*v,T=n-t,S=n+t;let A,C;b>T/S?(A=n,C=n*v):(A=.5*S*(1+b),C=.5*Math.sqrt(T*T+2*(n*n+t*t)*b+S*S*b*b));const D=i.projection.pixelsPerMeter(i.center.lat,p),F=[0,0,-A*_];hi(F,F,i._camera.getCameraToWorldMercator());let O=C*_;const z=function(pe){return pe[0]/=h,pe[1]/=h,pe[2]=o(pe[2],i._center.lat),pe},N=i._edgeInsets;if(!(N.left===0&&N.top===0&&N.right===0&&N.bottom===0||N.left===N.right&&N.top===N.bottom)){const pe=i._camera.getWorldToCamera(i.worldSize,i.projection.zAxisUnit==="meters"?D:1),ge=i._camera.getCameraToClipPerspective(i._fov,i.width/i.height,t,n);ge[8]=2*-i.centerOffset.x/i.width,ge[9]=2*i.centerOffset.y/i.height;const Se=new Float64Array(16);Wa(Se,ge,pe);const Me=new Float64Array(16);xn(Me,Se);const Pe=Pl.fromInvProjectionMatrix(Me,p,c,!0);for(const Ie of Pe.points){const Oe=z(Ie);O=Math.max(O,As(eo([],F,Oe)))}}O*=s/(s-1);const j=Math.acos(e[2]),te=Math.atan2(-e[0],-e[1]),G=new Xm;G.position=F,G.setPitchBearing(j,te);const W=G.getWorldToCamera(p,D),K=O*p,ee=Math.min(i._mercatorZfromZoom(17)*p*-2,-2*K),le=G.getCameraToClipOrthographic(-K,K,-K,K,ee,(K+l*D)/e[2]),de=new Float64Array(16);zt(de,le,W);const ve=.5*s,xe=[0,0,0];hi(xe,Tr(Math.floor(1e6*F[0])/1e6*p,Math.floor(1e6*F[1])/1e6*p,0),de),oi(xe,xe,ve);const we=[Math.floor(xe[0]),Math.floor(xe[1]),Math.floor(xe[2])],Fe=[0,0,0];Li(Fe,xe,we),oi(Fe,Fe,-1/ve);const se=new Float64Array(16);return er(se),Wi(se,se,Fe),zt(de,se,de),[de,K]}class kl extends Pn{constructor(e,t,n,s){super(),this.id=e,this.type="model",this.models=[],this._options=t,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}async loadGLTFFromURI(e,t){return Sv((await this.map._requestManager.transformRequest(e,pi.Model,t)).url,t)}async loadModel(e,t,n){try{const s=await this.loadGLTFFromURI(t.uri,n);if(n.aborted)return;const l=this._modelsInfo.get(e);if(!l)return;const c=Hg(s),h=l.modelSpec,p=new Rv(e,h.uri,h.position,h.orientation,c);kl.applyModelSpecification(p,h),p.computeBoundsAndApplyParent(),this.models.push(p),l.model=p}catch(s){if(n.aborted)return;this.fire(new Tn(new Error(`Could not load model ${e} from ${t.uri}`,{cause:s})))}}async load(){this._abortController||(this._abortController=new AbortController);const e=this._abortController.signal,t=[];for(const n in this._options.models){const s=this._options.models[n],l=this._modelsInfo.get(n);if(l&&l.model){l.modelSpec=s;const c=l.model;c.position=s.position!=null?new Wt(s.position[0],s.position[1]):new Wt(0,0),c.orientation=s.orientation??[0,0,0],kl.applyModelSpecification(c,s),c.computeBoundsAndApplyParent(),this.models.push(c)}else l?l.modelSpec=s:(this._modelsInfo.set(n,{modelSpec:s,model:null}),t.push(this.loadModel(n,s,e)))}t.length!==0?(await Promise.allSettled(t),e.aborted||this.fire(new Co("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new Co("data",{dataType:"source",sourceDataType:"metadata"}))}static arrayFromColorSpecification(e){const t=e;if(t===void 0)return;if(Array.isArray(t))return[t[0],t[1],t[2]];const n=Lt.parse(t);return n?[n.r,n.g,n.b]:void 0}static applyModelSpecification(e,t){if(t.nodeOverrides&&kl.convertNodeOverrides(e,t.nodeOverrides),t.materialOverrides&&kl.convertMaterialOverrides(e,t.materialOverrides),t.nodeOverrideNames&&(e.nodeOverrideNames=[...t.nodeOverrideNames]),t.materialOverrideNames&&(e.materialOverrideNames=[...t.materialOverrideNames]),t.featureProperties&&(e.featureProperties=t.featureProperties),t.lightOverrides){const n=t.lightOverrides,s=kl.arrayFromColorSpecification(n["light-ambient-color"]),l=kl.arrayFromColorSpecification(n["light-directional-color"]);e.lightOverrides={ambientIntensity:n["light-ambient-intensity"],ambientColor:s,directionalIntensity:n["light-directional-intensity"],directionalColor:l}}else e.lightOverrides=void 0}static convertNodeOverrides(e,t){if(Array.isArray(t)&&t.every(n=>typeof n=="string")){e.nodeOverrideNames=[];for(const n of t)e.nodeOverrideNames.push(n)}else Object.entries(t).forEach(([n,s])=>{const l={orientation:[0,0,0],minZoom:void 0,maxZoom:void 0};if(Object.hasOwn(s,"orientation")){const c=s.orientation;c&&(l.orientation=c)}Object.hasOwn(s,"minzoom")&&(l.minZoom=s.minzoom),Object.hasOwn(s,"maxzoom")&&(l.maxZoom=s.maxzoom),e.nodeOverrides.set(n,l)})}static convertMaterialOverrides(e,t){if(Array.isArray(t)&&t.every(n=>typeof n=="string")){e.materialOverrideNames=[];for(const n of t)e.materialOverrideNames.push(n)}else Object.entries(t).forEach(([n,s])=>{const l=kl.arrayFromColorSpecification(s["model-color"]),c={color:l!==void 0?new Lt(l[0],l[1],l[2]):new Lt(1,1,1),colorMix:0,emissionStrength:0,opacity:1},h=s["model-color-mix-intensity"];h!==void 0&&(c.colorMix=h);const p=s["model-emissive-strength"];p!==void 0&&(c.emissionStrength=p);const _=s["model-opacity"];_!==void 0&&(c.opacity=_),e.materialOverrides.set(n,c)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(this._modelsInfo.size===0)return!0;for(const e of this._modelsInfo.values())if(e.model==null)return!1;return!0}getModels(){return this.models}loadTile(e,t){}serialize(){return this._options}setProperty(e,t){return!1}reload(){this.cancelModelRequests();const e=Sh(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(e){this.cancelModelRequests()}setModels(e){this.models=[];const t=new Map;for(const n in e){const s=e[n],l=this._modelsInfo.get(n);l&&l.modelSpec.uri===s.uri&&t.set(n,l)}if(this._modelsInfo.size!==t.size){this.cancelModelRequests();for(const[n,s]of t)s.model||t.delete(n)}this._modelsInfo=t,this._options.models=e,this.load()}}function Y1(i,e,t){try{e=function(s){if(!s.variants)return s;if(!Array.isArray(s.variants))throw new Error("variants must be an array");for(const l of s.variants){if(l==null||typeof l!="object"||l.constructor!==Object)throw new Error("variant must be an object");if(!Array.isArray(l.capabilities))throw new Error("capabilities must be an array");if(l.capabilities.length===1&&l.capabilities[0]==="meshopt")return Object.assign(s,l)}return s}(e)}catch(s){return new Error("Failed to process TileJSON variants",{cause:s})}const n=rl({...e,...i},["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);return i.url&&e.tiles&&i.tiles&&(n.tiles=e.tiles),n.tiles=t.canonicalizeTileset(n,i.url),n}function K1(i,e,t,n,s){const l=function(h,p){if(h)return s(h);if(p){i.url&&p.tiles&&i.tiles&&delete i.tiles;const _=Y1(i,p,e);if(_ instanceof Error)return s(_);s(null,_)}},c=function(h,p,_){if(!h)return null;if(!p&&!_)return h;_=_||h.worldview_default;const y=Object.values(h.language||{});if(y.length===0)return null;const v=Object.values(h.worldview||{});if(v.length===0)return null;const b=y.every(S=>S===p),T=v.every(S=>S===_);return b&&T?h:p in(h.language_options||{})||_ in(h.worldview_options||{})?null:h.language_options&&h.worldview_options?h:null}(i.data,t,n);if(c)return Y.frame(()=>l(null,c));if(i.url){const h=new AbortController;return(async()=>{const p=await e.transformRequest(e.normalizeSourceURL(i.url,null,t,n),pi.Source,h.signal),{data:_}=await vr(p,h.signal);l(null,_)})().catch(p=>{h.signal.aborted||l(p)}),{cancel:()=>h.abort()}}return Y.frame(()=>{const{data:h,...p}=i;l(null,p)})}function J1(i,e){const t=Math.pow(2,e.z),n=Math.floor(po(i.getWest())*t),s=Math.floor($n(i.getNorth())*t),l=Math.ceil(po(i.getEast())*t),c=Math.ceil($n(i.getSouth())*t);return e.x>=n&&e.x<l&&e.y>=s&&e.y<c}class a_{constructor(e,t,n){this.bounds=e?a.convert(this.validateBounds(e)):null,this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}addExtraBounds(e){if(e){this.extraBounds||(this.extraBounds=[]);for(const t of e)this.extraBounds.push(a.convert(this.validateBounds(t)))}}contains(e){if(e.z>this.maxzoom||e.z<this.minzoom||this.bounds&&!J1(this.bounds,e))return!1;if(!this.extraBounds)return!0;for(const t of this.extraBounds)if(J1(t,e))return!0;return!1}static fromTileJSON(e){if(!e.bounds&&!e.extra_bounds)return null;const t=new a_(e.bounds,e.minzoom,e.maxzoom);return t.addExtraBounds(e.extra_bounds),t}}const ku={loaded:!0,drawModels:function(i,e,t,n){if(i.renderPass==="opaque")return;const s=t.paint.get("model-opacity").constantOr(1),l=t.paint.get("model-elevation-reference"),c=l==="ground",h=l==="ground";if(s===0)return;const p=t.paint.get("model-cast-shadows");if(i.renderPass==="shadow"&&(!p||i.terrain&&s<.65&&t._transitionablePaint._values["model-opacity"].value.expression instanceof vl))return;const _=i.shadowRenderer,y=t.paint.get("model-receive-shadows");_&&(_.useNormalOffset=!0,y||(_.enabled=!1));const v=()=>{_&&(_.useNormalOffset=!0,y||(_.enabled=!0))},b=e.getSource();if(i.renderPass==="light-beam"&&b.type!=="batched-model")return;if(b.type==="vector"||b.type==="geojson")return function(z,N,j,te,G){const W=z.transform,K=W.projection.name==="globe",ee=W.getFreeCameraOptions().position;if(!z.modelManager)return;const le=z.modelManager;j.modelManager=le;const de=z.shadowRenderer;if(!Object.hasOwn(j._unevaluatedLayout._values,"model-id"))return;const ve=j._unevaluatedLayout._values["model-id"],xe={...j.layout.get("model-id").parameters},we=z.style.order.indexOf(j.fqid),Fe=j.paint.get("model-opacity").constantOr(1);for(const se of te){const pe=N.getTile(se).getBucket(j);if(!pe||pe.projection.name!==W.projection.name)continue;const ge=pe.getModelUris();if(ge&&!pe.modelsRequested&&(le.addModelsFromBucket(ge,G),pe.modelsRequested=!0),K)xe.zoom=se.overscaledZ;else{const Ne=NE(se,W);xe.zoom=Ne}const Se=ve.possiblyEvaluate(xe);if(kE(z,pe,se),Ga.shadowUniformsInitialized=!1,Ga.useSingleShadowCascade=!!de&&de.getMaxCascadeForTile(se.toUnwrapped())===0,z.renderPass==="shadow"&&de){if(z.currentShadowCascade===1&&pe.isInsideFirstShadowMapFrustum)continue;const Ne=W.calculatePosMatrix(se.toUnwrapped(),W.worldSize);if(Ga.tileMatrix.set(Ne),Ga.shadowTileMatrix.set(de.calculateShadowPassMatrixFromMatrix(Ne)),Ga.aabb.min=[0,0,0],Ga.aabb.max[0]=Ga.aabb.max[1]=We,Ga.aabb.max[2]=0,UE(pe,Ga,z,j.scope))continue}const Me=1<<se.canonical.z,Pe=[((ee.x-se.wrap)*Me-se.canonical.x)*We,(ee.y*Me-se.canonical.y)*We,ee.z*Me*We];z.conflationActive&&Object.keys(pe.instancesPerModel).length>0&&z.style.isLayerClipped(j,N.getSource())&&pe.updateReplacement(se,z.replacementSource,we,j.scope)&&(pe.uploaded=!1,pe.upload(z.context));let Ie=0;const Oe=new Array,Be=new Array,Ke=new Array;for(let Ne in pe.instancesPerModel){const He=pe.instancesPerModel[Ne];He.features.length>0&&!K&&(Ne=Se.evaluate(He.features[0].feature,{}));const ft=le.getModel(Ne,G);if(ft||le.hasURLBeenRequested(Ne)||pe.modelUris.includes(Ne)||(pe.modelUris.push(Ne),pe.modelsRequested=!1),ft&&ft.uploaded)if(K){const pt=oi([],[ee.x,ee.y,ee.z],z.transform.worldSize);rs(pt,pt);for(let xt=0;xt<He.instancedDataArray.length;++xt){const ht=[0,0,0],wt=[1,1,1],vt=it(),ri=He.tileCoordinatesForInstance(xt),Gt=He.transformForInstance(xt);jl(wt,Gt),Uu(vt,Gt),Zl(ht,vt);const ei=He.translationForInstance(xt),ui=new Wt(0,0);_y(pe.canonical,ui,ri.x,ri.y);const Pr=Jn();Mm(Pr,ft,z.transform,ui,ht,wt,ei,!0,!1,!1);const Bo=He.colorForInstance(xt),fr=Gs([],pt),Xt=No([],[1,1,1/g(ui.lat,z.transform.zoom)]);Ke.push({zScaleMatrix:Xt,negCameraPosMatrix:fr});for(const ji of ft.nodes)wy(z,ji,Pr,z.transform.expandedFarZProjMatrix,Ie,Oe,Be,ft.materialOverrides,Fe,Bo);++Ie}}else for(const pt of ft.nodes)E1(z,j,pt,He,Pe,se,Ga)}if(K)if(z.renderPass==="shadow"){for(const Ne of Be)Of(Ne.mesh,Ne.nodeModelMatrix,z,j);for(const Ne of Oe)Of(Ne.mesh,Ne.nodeModelMatrix,z,j)}else T1(z,j,Oe,Be,Ke)}}(i,e,t,n,b1(i,t)),void v();if(!b.loaded())return;if(b.type==="batched-model")return function(z,N,j,te){j.resetLayerRenderingStats(z);const G=z.context,W=z.transform,K=z.style.fog,ee=z.shadowRenderer;if(W.projection.name!=="mercator")return void gi(`Drawing 3D landmark models for ${W.projection.name} projection is not yet implemented`);const le=z.transform.getFreeCameraOptions().position,de=oi([],[le.x,le.y,le.z],z.transform.worldSize),ve=Gs([],rs([],de)),xe=g(W.center.lat,W.zoom),we=zt([],ve,No([],[1,1,1/xe])),Fe=j.paint.get("model-opacity").constantOr(1),se=new mn(G.gl.LEQUAL,mn.ReadWrite,z.depthRangeFor3D),pe=new mn(G.gl.LEQUAL,mn.ReadOnly,z.depthRangeFor3D),ge=new zi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Se=z.renderPass==="shadow",Me=z.renderPass==="light-beam",Pe=j.paint.get("model-color-use-theme").constantOr("default")==="none",Ie=Se&&ee?ee.getCurrentCascadeFrustum():W.getFrustum(W.scaleZoom(W.worldSize)),Oe=j.paint.get("model-front-cutoff"),Be=Oe[2]<1,Ke=Kh(z,j.paint.get("model-cutoff-fade-range")),Ne=j.getLayerRenderingStats();(function(He,ft,pt,xt){const ht=He.terrain?He.terrain.exaggeration():0,wt=He.transform.zoom;for(const vt of xt){const ri=ft.getTile(vt).getBucket(pt);ri&&(ri.setFilter(pt.filter),He.conflationActive&&ri.updateReplacement(vt,He.replacementSource),ri.evaluateTransform(He,pt),He.terrain&&ht>0&&ri.elevationUpdate(He.terrain,ht,vt,pt.source),ri.needsReEvaluation(He,wt,pt)&&ri.evaluate(pt))}})(z,N,j,te),function(){const He=new Map;let ft,pt,xt;Be?(ft=te.length-1,pt=-1,xt=-1):(ft=0,pt=te.length,xt=1);const ht=Qt(),wt=new Le(0,0);for(let vt=ft;vt!==pt;vt+=xt){const ri=te[vt],Gt=N.getTile(ri).getBucket(j);if(!Gt||!Gt.uploaded)continue;let ei=!1;ee&&(ei=ee.getMaxCascadeForTile(ri.toUnwrapped())===0);const ui=W.calculatePosMatrix(ri.toUnwrapped(),W.worldSize),Pr=!!(4&Gt.modelTraits);zt(gy,we,ui),zt(yy,W.expandedFarZProjMatrix,ui),xn(Jm,gy),Ul(Jm,Jm);const Bo=!Se&&ee&&ee.enabled?ee.computeCascadeTileMatrices(ui):null;!Se&&Be&&(xn(Bc,ui),hi(ht,de,Bc),wt.x=ht[0],wt.y=ht[1]);const fr=[];Gt.setFilter(j.filter);for(const Xt of Gt.getNodesInfo()){if(Xt.hiddenByReplacement||!Xt.node.meshes)continue;const ji=Xt.node;let yr=0;z.terrain&&ji.elevation&&(yr=ji.elevation*z.terrain.exaggeration());const Dr=()=>{const Gi=Xt.aabb,bo=ge.min,wo=ge.max;return bo[0]=Gi.min[0],bo[1]=Gi.min[1],bo[2]=Gi.min[2]+yr,wo[0]=Gi.max[0],wo[1]=Gi.max[1],wo[2]=Gi.max[2]+yr,hi(bo,bo,ui),hi(wo,wo,ui),ge},It=Dr(),Jr=Xt.evaluatedScale;if(Jr[0]<=1&&Jr[1]<=1&&Jr[2]<=1&&It.intersects(Ie)===0)continue;if(!Se){const Gi=It.min,bo=It.max;e_[0]=.5*(Gi[0]+bo[0]),e_[1]=.5*(Gi[1]+bo[1]),e_[2]=.5*(Gi[2]+bo[2]);const wo=Xa(de,e_)*xe,sn=z._debugParams.lodSwitchDistance,Ha=sn>=0;if(Ha&&sn>=9999)Xt.targetLod=0;else{let es;if(Ha)es=sn;else{const Nn=(bo[2]-Gi[2])*xe*Jr[2],Nl=Math.max(bo[0]-Gi[0],bo[1]-Gi[1])*xe*Math.max(Jr[0],Jr[1]);let ua;ua=Nn>=30?1:Nl>=80?.5:Math.max(Nn,Nl)>=20?.25:0,es=2e3+3e3*ua}VE(Xt,wo,Math.min(z.frameTimeDelta,1e3/30),es,z._debugParams.lodSwitchFadeDuration)}}if(!Se&&Be){const Gi=.16666666666666666;Xt.cameraCollisionOpacity=de[0]>It.min[0]&&de[0]<It.max[0]&&de[1]>It.min[1]&&de[1]<It.max[1]&&de[2]*xe<It.max[2]&&ji.footprint&&mg(wt,ji.footprint)?Math.max(Xt.cameraCollisionOpacity-Gi,0):Math.min(1,Xt.cameraCollisionOpacity+Gi)}const Qr=1/w(ri.canonical),Bn=ji.anchor?ji.anchor[0]:0,kn=ji.anchor?ji.anchor[1]:0,yo=[Bn*(Jr[0]-1)+Xt.evaluatedTranslation[0]*Qr,kn*(Jr[1]-1)+Xt.evaluatedTranslation[1]*Qr,yr+Xt.evaluatedTranslation[2]],xo=Ff(new Float64Array(16),ui,yo,Jr),gn=zt([],xo,ji.globalMatrix),on=zt([],W.expandedFarZProjMatrix,gn),yn=on[2]*Bn+on[6]*kn+on[10]*yr+on[14];ji.hidden=!1;let vo=Fe;Se||(Be&&(vo*=Xt.cameraCollisionOpacity,vo*=GE(xo,W,Xt.aabb,Oe)),vo*=jE(Ke,yn)),vo!==0?fr.push({nodeInfo:Xt,depth:yn,opacity:vo,wvpForNode:on,nodeModelMatrix:gn,tileModelMatrix:xo,tileTranslation:yo}):ji.hidden=!0}Se||fr.sort((Xt,ji)=>!Be||Xt.opacity===1&&ji.opacity===1?Xt.depth<ji.depth?-1:1:Xt.opacity===1?-1:ji.opacity===1?1:Xt.depth>ji.depth?-1:1);for(const Xt of fr){const ji=Xt.nodeInfo,yr=ji.node;let Dr=null;if(z._debugParams.show3DModelFootprints&&yr.footprint){const yn=yr.id||yr.name||"footprint";if(!He.has(yn)){const vo=Ff(new Float64Array(16),yy,Xt.tileTranslation,Xt.nodeInfo.evaluatedScale);He.set(yn,{node:yr,mvp:vo})}}const It=Xt.nodeInfo.evaluatedScale;Ff(ja,gy,Xt.tileTranslation,It),Qm[0]=1/It[0],Qm[1]=-1/It[1],Qm[2]=1/It[2],mr(Bc,Jm,Qm),zt(ja,ja,yr.globalMatrix);const Jr=Pr?0:ji.evaluatedRMEA[0][2],Qr=ji.targetLod,Bn=yr.lodMeshes&&yr.lodMeshes.length>0,kn=Bn&&Qr>0&&Qr<1;if(Se&&Bn&&Math.round(Qr)===1)continue;const yo=!Se&&K?v1(x1,Xt.nodeModelMatrix,z.transform):null,xo=Se&&ee?ee.calculateShadowPassMatrixFromMatrix(Xt.nodeModelMatrix):null,gn=kn?2:1,on=Bn&&Math.round(Qr)===1;for(let yn=0;yn<gn;++yn){const vo=kn?yn===1:on,Gi=vo?yr.lodMeshes:yr.meshes,bo=kn?vo?-Qr:1-Qr:1;for(let wo=0;wo<Gi.length;++wo){const sn=Gi[wo],Ha=!vo&&wo===yr.lightMeshIndex;let es=Xt.wvpForNode;if(Ha){if(!Me&&!z.terrain&&z.shadowRenderer){z.currentLayer<z.firstLightBeamLayer&&(z.firstLightBeamLayer=z.currentLayer);continue}es=Ff(LE,yy,Xt.tileTranslation,Xt.nodeInfo.evaluatedScale)}else if(Me)continue;const Nn={defines:[]},Nl=[],ua=!!sn.normalBuffer;if(!Se&&ee&&(ee.useNormalOffset=ua),vy(Nn.defines,Nl,sn,z,Pe?null:j.lut),Pr||Nn.defines.push("DIFFUSE_SHADED"),ei&&Nn.defines.push("SHADOWS_SINGLE_CASCADE"),Ne&&(Se?Ne.numRenderedVerticesInShadowPass+=sn.vertexArray.length:Ne.numRenderedVerticesInTransparentPass+=sn.vertexArray.length),Se){Of(sn,Xt.nodeModelMatrix,z,j,xo);continue}if(K&&W.projection.name!=="globe"){const an=sn.aabb.min,ts=sn.aabb.max,[Es,Ly]=K.getOpacityForBounds(yo,an[0],an[1],ts[0],ts[1]);Nn.overrideFog=Es>=zf||Ly>=zf}const Rt=sn.material;let Wr;Rt.occlusionTexture&&Rt.occlusionTexture.offsetScale&&(Wr=Rt.occlusionTexture.offsetScale,Nn.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),kn&&Nn.defines.push("DITHERED_DISCARD");const Hi=z.getOrCreateProgram("model",Nn);if(!Se&&ee&&ee.enabled)if(Dr!==ua){for(let an=0;an<Bo.length;an++)Ff(xy[an]=xy[an]||new Float64Array(16),Bo[an],Xt.tileTranslation,Xt.nodeInfo.evaluatedScale);ee.setupShadowsFromCascadeMatrices(xy,Hi,ua),Dr=ua}else Hi.setShadowUniformValues(G,ee.getShadowUniformValues());z.uploadCommonUniforms(G,Hi,null,yo);const pr=Rt.pbrMetallicRoughness;pr.metallicFactor=.9,pr.roughnessFactor=.5;const Ts=ly(es,ja,Bc,yr.globalMatrix,z,Xt.opacity,pr.baseColorFactor,Rt.emissiveFactor,pr.metallicFactor,pr.roughnessFactor,Rt,Jr,j,FE,Wr,void 0,void 0,bo,Hi.fixedDefines.includes("LIGHTING_3D_MODE"));!Ha&&(ji.hasTranslucentParts||Xt.opacity<1)&&Hi.draw(z,G.gl.TRIANGLES,se,bs.disabled,Qi.disabled,_n.backCCW,Ts,j.id,sn.vertexBuffer,sn.indexBuffer,sn.segments,j.paint,z.transform.zoom,void 0,Nl),Hi.draw(z,G.gl.TRIANGLES,Ha?pe:se,bs.disabled,Ha||Xt.opacity<1||ji.hasTranslucentParts?Qi.alphaBlended:Qi.unblended,_n.backCCW,Ts,j.id,sn.vertexBuffer,sn.indexBuffer,sn.segments,j.paint,z.transform.zoom,void 0,Nl)}}}}if(z._debugParams.show3DModelFootprints&&He.size>0){const vt=Array.from(He.keys()).sort();for(const ri of vt){const{node:Gt,mvp:ei}=He.get(ri);w1(z,0,Gt,ei)}}}()}(i,e,t,n),void v();if(b.type!=="model")return;const T=b.getModels(),S=[],A=i.transform.getFreeCameraOptions().position,C=oi([],[A.x,A.y,A.z],i.transform.worldSize);rs(C,C);const D=[],F=[];let O=0;for(const z of T){const N=e.getFeatureState("",z.id),j={type:"Unknown",id:z.id,properties:z.featureProperties},te=t.paint.get("model-rotation").evaluate(j,N),G=t.paint.get("model-scale").evaluate(j,N),W=t.paint.get("model-translation").evaluate(j,N),K=t.paint.get("model-opacity").evaluate(j,N);OE(t,z.id,N,z.featureProperties,z.nodeOverrideNames,z.nodeOverrides),BE(t,z.id,N,z.featureProperties,z.materialOverrideNames,z.materialOverrides),z.nodeOverrides.size>0&&z.computeBoundsAndApplyParent(),z.computeModelMatrix(i,te,G,W,h,c,!1);const ee=Gs([],C),le=No([],[1,1,1/g(z.position.lat,i.transform.zoom)]);S.push({zScaleMatrix:le,negCameraPosMatrix:ee});for(const de of z.nodes)wy(i,de,z.matrix,i.transform.expandedFarZProjMatrix,O,D,F,z.materialOverrides,K,void 0,z.lightOverrides);O++}if(D.sort((z,N)=>N.depth-z.depth),i.renderPass!=="shadow"){if(i._debugParams.show3DModelFootprints){const z=i.transform.projMatrix,N=new Map,j=(G,W)=>{if(G.footprint){const K=G.id||G.name||"footprint";if(!N.has(K)){const ee=zt([],z,W);N.set(K,{node:G,mvp:ee})}}};for(const G of F)j(G.node,G.modelMatrix);for(const G of D)j(G.node,G.modelMatrix);const te=Array.from(N.keys()).sort();for(const G of te){const{node:W,mvp:K}=N.get(G);w1(i,0,W,K)}}T1(i,t,D,F,S),v()}else{for(const z of F)Of(z.mesh,z.nodeModelMatrix,i,t);for(const z of D)Of(z.mesh,z.nodeModelMatrix,i,t);v()}},prepare:function(i,e,t){const n=e.getSource();if(!n.loaded())return;if(n.type==="vector"||n.type==="geojson")return void(t.modelManager&&t.modelManager.upload(t,b1(t,i)));if(n.type==="batched-model"||n.type!=="model")return;const s=n.getModels();for(const l of s)l.upload(t.context)},shaders:XE,programUniforms:JE,ShadowRenderer:class{constructor(i){this.painter=i,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new tS,this._depthMode=new mn(i.context.gl.LEQUAL,mn.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._devtoolsFolder=null,this.useNormalOffset=!1,this._shadowParameters={cascadeCount:2,normalOffset:3,shadowMapResolution:2048}}destroy(){for(const i of this._cascades)i.texture.destroy(),i.framebuffer.destroy();this._cascades=[]}updateShadowParameters(i,e){const t=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!e||!e.properties)return;const n=e.properties.get("shadow-intensity"),s=e.properties.get("shadow-draw-before-layer");if(!e.shadowsEnabled()||n<=0)return;let l=-1,c=0;for(const C of t.style.order){const D=t.style._mergedLayers[C];D.hasShadowPass()&&!D.isHidden(i.zoom)&&(l=c),!s||s!==C&&s!==D.slot||(this._drawShadowAfterLayer=c>0?c-1:0),c+=1}if(this._enabled=l>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=l);const h=t.context,p=this._shadowParameters.shadowMapResolution,_=this._shadowParameters.shadowMapResolution;if(this._cascades.length===0||this._shadowParameters.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let C=0;C<this._shadowParameters.cascadeCount;++C){const D=h.gl,F=h.createFramebuffer(p,_,0,"texture"),O=new lm(h,{width:p,height:_,data:null},D.DEPTH_COMPONENT16);F.depthAttachment.set(O.texture),this._cascades.push({framebuffer:F,texture:O,matrix:[],far:0,boundingSphereRadius:0,frustum:new Pl,scale:0})}}this.shadowDirection=q1(e);let y=0;if(i.elevation){const C=i.elevation,D=[1e4,-1e4];C.visibleDemTiles.filter(F=>F.dem).forEach(F=>{const O=F.dem.tree;D[0]=Math.min(D[0],O.minimums[0]),D[1]=Math.max(D[1],O.maximums[0])}),D[0]!==1e4&&(y=(D[1]-D[0])*C.exaggeration())}const v=1.5*i.cameraToCenterDistance,b=3*v,T=new Float64Array(16);for(let C=0;C<this._cascades.length;++C){const D=this._cascades[C];let F=i.height/50,O=1;this._shadowParameters.cascadeCount===1?O=b:C===0?O=v:(F=v,O=b);const[z,N]=iS(i,this.shadowDirection,F,O,this._shadowParameters.shadowMapResolution,y);D.scale=i.scale,D.matrix=z,D.boundingSphereRadius=N,xn(T,D.matrix),D.frustum=Pl.fromInvProjectionMatrix(T,1,0,!0),D.far=O}const S=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[S].far,this._cascades[S].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadowmap_0=Yn.ShadowMap0,this._uniformValues.u_shadowmap_1=Yn.ShadowMap0+1,this._groundShadowTiles=t.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const A=t.transform.elevation;for(const C of this._groundShadowTiles){let D={min:0,max:0};if(A){const F=A.getMinMaxForTile(C);F&&(D=F)}this.addShadowReceiver(C.toUnwrapped(),D.min,D.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(i){this._enabled=i}drawShadowPass(i,e){if(!this.enabled)return;const t=this.painter,n=t.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(t.transform.getFrustum(0),t.transform.worldSize,this._cascades),n.viewport.set([0,0,this._shadowParameters.shadowMapResolution,this._shadowParameters.shadowMapResolution]);for(let s=0;s<this._numCascadesToRender;++s){t.currentShadowCascade=s,n.bindFramebuffer.set(this._cascades[s].framebuffer.framebuffer),n.clear({color:Lt.white,depth:1});for(const l of i.order){const c=i._mergedLayers[l];if(!c.hasShadowPass()||c.isHidden(t.transform.zoom))continue;const h=i.getLayerSourceCache(c),p=h?e[h.id]:void 0;(c.type==="model"||p&&p.length)&&t.renderLayer(t,h,c,p)}}t.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const i=this.painter,e=i.style,t=i.context,n=t.gl,s=e.directionalLight,l=e.ambientLight;if(!s||!l)return;const c=[],h=Kh(i,i.longestCutoffRange);h.shouldRenderCutoff&&c.push("RENDER_CUTOFF"),c.push("RENDER_SHADOWS"),this.useNormalOffset&&c.push("NORMAL_OFFSET");const p=W1(e,s,l),_=new mn(n.LEQUAL,mn.ReadOnly,i.depthRangeFor3D),y=new bs({func:n.EQUAL,mask:255},0,255,n.KEEP,n.KEEP,n.KEEP);for(const v of this._groundShadowTiles){const b=v.toUnwrapped(),T=i.isTileAffectedByFog(v),S=i.getOrCreateProgram("groundShadow",{defines:c,overrideFog:T});this.setupShadows(b,S),i.uploadCommonUniforms(t,S,b,null,h);const A=YE(i.transform.calculateProjMatrix(b),p);S.draw(i,n.TRIANGLES,_,y,Qi.multiply,_n.disabled,A,"ground_shadow",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments,null,i.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(i){const e=this.painter.transform,t=e.calculatePosMatrix(i,e.worldSize);return zt(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}calculateShadowPassMatrixFromMatrix(i){return zt(QE,this._cascades[this.painter.currentShadowCascade].matrix,i)}setupShadows(i,e,t){if(!this.enabled)return;const n=this.painter.transform,s=this.painter.context,l=s.gl,c=this._uniformValues,h=n.calculatePosMatrix(i,n.worldSize);for(let p=0;p<this._cascades.length;p++){const _=X1(p);zt(_,this._cascades[p].matrix,h),c[p===0?"u_light_matrix_0":"u_light_matrix_1"]=_,s.activeTexture.set(l.TEXTURE0+Yn.ShadowMap0+p),this._cascades[p].texture.bindExtraParam(l.LINEAR,l.LINEAR,l.CLAMP_TO_EDGE,l.CLAMP_TO_EDGE,l.GREATER)}if(this.useNormalOffset=!!t,this.useNormalOffset){const p=w(i.canonical),_=2/n.tileSize*We/this._shadowParameters.shadowMapResolution,y=_*this._cascades[0].boundingSphereRadius,v=_*this._cascades.at(-1).boundingSphereRadius,b=(t==="vector-tile"?1:3)*function(T){const S=yt((T-22)/-22,0,1);return .125*(1-S)+4*S}(n.zoom);c.u_shadow_normal_offset=[p,y*b,v*b],c.u_shadow_bias=[1e-4,.0012,.012]}else c.u_shadow_bias=[36e-5,.0012,.012];e.setShadowUniformValues(s,c)}computeCascadeTileMatrices(i){const e=this._shadowParameters.cascadeCount;for(let t=0;t<e;t++)zt(o_[t]=o_[t]||new Float64Array(16),this._cascades[t].matrix,i);return o_.length=e,o_}setupShadowsFromMatrix(i,e,t=!1){if(!this.enabled)return;const n=this._shadowParameters.cascadeCount;for(let s=0;s<n;s++)zt(X1(s),this._cascades[s].matrix,i);n_.length=n,this.setupShadowsFromCascadeMatrices(n_,e,t)}setupShadowsFromCascadeMatrices(i,e,t=!1){if(!this.enabled)return;const n=this.painter.context,s=n.gl,l=this._uniformValues;for(let c=0;c<this._shadowParameters.cascadeCount;c++)l[c===0?"u_light_matrix_0":"u_light_matrix_1"]=i[c],n.activeTexture.set(s.TEXTURE0+Yn.ShadowMap0+c),this._cascades[c].texture.bindExtraParam(s.LINEAR,s.LINEAR,s.CLAMP_TO_EDGE,s.CLAMP_TO_EDGE,s.GREATER);if(this.useNormalOffset=t,t){const c=this._shadowParameters.normalOffset;l.u_shadow_normal_offset=[1,c,c],l.u_shadow_bias=[6e-5,.0012,.012]}else l.u_shadow_bias=[36e-5,.0012,.012];e.setShadowUniformValues(n,l)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(i,e,t,n){if(n[2]>=0)return{};const s=function(h,p,_){const y=_/(1<<h.canonical.z);return new zi([h.canonical.x*y+h.wrap*_,h.canonical.y*y+h.wrap*_,0],[(h.canonical.x+1)*y+h.wrap*_,(h.canonical.y+1)*y+h.wrap*_,p])}(i,e,t).getCorners(),l=e/-n[2];n[0]<0?(Yi(s[0],s[0],[n[0]*l,0,0]),Yi(s[3],s[3],[n[0]*l,0,0])):n[0]>0&&(Yi(s[1],s[1],[n[0]*l,0,0]),Yi(s[2],s[2],[n[0]*l,0,0])),n[1]<0?(Yi(s[0],s[0],[0,n[1]*l,0]),Yi(s[1],s[1],[0,n[1]*l,0])):n[1]>0&&(Yi(s[2],s[2],[0,n[1]*l,0]),Yi(s[3],s[3],[0,n[1]*l,0]));const c={};return c.vertices=s,c.planes=[s_(s[1],s[0],s[4]),s_(s[2],s[1],s[5]),s_(s[3],s[2],s[6]),s_(s[0],s[3],s[7])],c}addShadowReceiver(i,e,t){this._receivers.add(i,zi.fromTileIdAndHeight(i,e,t))}getMaxCascadeForTile(i){const e=this._receivers.get(i);return e&&e.lastCascade?e.lastCascade:0}},drawGroundEffect:$1,queryModelLayerRendered:function(i,e,t,n){const s=t.getSource();if(!s||s.type!=="model")return{};const l=s,c={};c[i.id]=[];const h=c[i.id];let p=0;for(const _ of l.models){const y=t.getFeatureState(i.sourceLayer,_.id),v={type:"Unknown",id:_.id,properties:_.featureProperties},b=i.paint.get("model-rotation").evaluate(v,y),T=i.paint.get("model-scale").evaluate(v,y),S=i.paint.get("model-translation").evaluate(v,y),A=i.paint.get("model-elevation-reference");let C=[];Mm(C,_,n,_.position,b,T,S,A==="ground",A==="ground",!1),n.projection.name==="globe"&&(C=Cm(C,n));const D=zt([],n.projMatrix,C),F=kg(e.isPointQuery()?e.screenBounds:e.screenGeometry,n,D,_.aabb);if(F!=null){const O=new Bu(void 0,0,0,0,_.id);O.layer=i.layer,O.properties=structuredClone(_.featureProperties),O.properties.layer=i.id,O.properties.uri=_.uri,O.properties.orientation=_.orientation,O.sourceLayer=i.sourceLayer,O.geometry={type:"Point",coordinates:[_.position.lng,_.position.lat]},O.state=y,O.source=i.source,h.push({featureIndex:p,feature:O,intersectionZ:F})}++p}return c},queryModelLayerIntersectsFeature:function(i,e,t,n,s,l){if(!i.modelManager)return!1;const c=i.modelManager,h=e.tile.getBucket(i);if(!(h&&h instanceof oy))return!1;for(const p in h.instancesPerModel){const _=h.instancesPerModel[p],y=t.id!==void 0?t.id:t.properties&&Object.hasOwn(t.properties,"id")?t.properties.id:void 0;if(Object.hasOwn(_.idToFeaturesIndex,y)){const v=_.features[_.idToFeaturesIndex[y]],b=c.getModel(p,l||i.scope);if(!b)return!1;let T=[];const S=new Wt(0,0),A=h.canonical;let C=Number.MAX_VALUE;for(let D=0;D<v.instancedDataCount;++D){const F=16*(v.instancedDataOffset+D),O=_.instancedDataArray.float32,z=[O[F+4],O[F+5],O[F+6]];_y(A,S,Math.floor(O[F]),Math.floor(O[F+1])),Mm(T,b,s,S,v.rotation,v.scale,z,!1,!1,!1),s.projection.name==="globe"&&(T=Cm(T,s));const N=zt([],s.projMatrix,T),j=e.queryGeometry,te=kg(j.isPointQuery()?j.screenBounds:j.screenGeometry,s,N,b.aabb);te!=null&&(C=Math.min(te,C))}return C!==Number.MAX_VALUE&&C}}return!1},loadMatchingModelFeature:function(i,e,t,n){const s=i.getNodesInfo()[e];if(!s||s.hiddenByReplacement||!s.node.meshes)return;let l=Number.MAX_VALUE;const c=s.node,h=t.tile,p=n.calculatePosMatrix(h.tileID.toUnwrapped(),n.worldSize),_=s.evaluatedScale;let y=0;n.elevation&&c.elevation&&(y=c.elevation*n.elevation.exaggeration()),Wi(p,p,[(c.anchor?c.anchor[0]:0)*(_[0]-1),(c.anchor?c.anchor[1]:0)*(_[1]-1),y]),mr(p,p,_);const v=t.queryGeometry,b=v.isPointQuery()?v.screenBounds:v.screenGeometry,T=function(A){const C=zt([],p,A.globalMatrix);zt(C,n.expandedFarZProjMatrix,C);for(let D=0;D<A.meshes.length;++D){const F=A.meshes[D];if(D===A.lightMeshIndex)continue;const O=kg(b,n,C,F.aabb);O!=null&&(l=Math.min(O,l))}if(A.children)for(const D of A.children)T(D)};if(T(c),l===Number.MAX_VALUE)return;const S=new Wt(0,0);return _y(h.tileID.canonical,S,s.node.anchor[0],s.node.anchor[1]),{intersectionZ:l,position:S,feature:s.feature}},ModelSource:kl,Tiled3dModelSource:class extends Pn{constructor(i,e,t,n){super(),this.type="batched-model",this.id=i,this.tileSize=512,this._options=e,this.tiles=this._options.tiles,this.maxzoom=e.maxzoom||19,this.minzoom=e.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=t,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(n)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();const i=Sh(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(i){this._loaded=!1,this.fire(new Co("dataloading",{dataType:"source"}));const e=Array.isArray(this.map._language)?this.map._language.join():this.map._language,t=this.map.getWorldview();this._tileJSONRequest=K1(this._options,this.map._requestManager,e,t,(n,s)=>{this._tileJSONRequest=null,this._loaded=!0,n?(e&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${e}`),t&&t.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${t}`),this.fire(new Tn(n))):s&&(Object.assign(this,s),s.bounds&&(this.tileBounds=new a_(s.bounds,this.minzoom,this.maxzoom)),Rn(s.tiles,this.map._requestManager._customAccessToken),this.fire(new Co("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new Co("data",{dataType:"source",sourceDataType:"content"}))),i&&i(n)})}hasTransition(){return!1}
vendor: 1,082 bytes, line 3097
3097hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loaded(){return this._loaded}async loadTile(i,e){const t=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme)),n=!i.actor||i.state==="expired";if(n)i.actor=this.dispatcher.getActor();else{if(i.state==="loading")return void(i.reloadCallback=e);if(i.buckets){const h=Object.values(i.buckets);for(const p of h)p.dirty=!0;return void(i.state="loaded")}}const s=n?"loadTile":"reloadTile",l=new AbortController;i.request=l;const c=(h,p)=>(delete i.request,i.aborted?e(null):h&&!Zt(h)?e(h):(this.map._refreshExpiredTiles&&p&&i.setExpiryData(jo(p.headers)),i.loadModelData(p,this.map.painter),i.state="loaded",e(null),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null))));try{const h=await this.map._requestManager.transformRequest(t,pi.Tile,l.signal);if(l.signal.aborted)return e(null);const p={request:h,data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
vendor: 25,095 bytes, line 3097
3097ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:i.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:Y.devicePixelRatio,promoteId:this.promoteId};i.request=i.actor.sendCancelable(s,p,{},c)}catch(h){if(l.signal.aborted)return e(null);e(h)}}abortTile(i){i.request&&(i.request.abort(),delete i.request),i.actor&&i.actor.notify("abortTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope})}serialize(){return{...this._options}}},loadModel:async function(i,e,t){const n=await Sv(i),s=new Rv(e,t,void 0,void 0,Hg(n));return s.computeBoundsAndApplyParent(),s}};class Q1{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new mu(We,We,512),this.featureIndexArray=new Jt,this.promoteId=t,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,t,n,s,l,c=0,h=0){const p=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,s,l,c);const _=this.grid;for(let y=0;y<t.length;y++){const v=t[y],b=[1/0,1/0,-1/0,-1/0];for(let T=0;T<v.length;T++){const S=v[T];b[0]=Math.min(b[0],S.x),b[1]=Math.min(b[1],S.y),b[2]=Math.max(b[2],S.x),b[3]=Math.max(b[3],S.y)}h!==0&&(b[0]-=h,b[1]-=h,b[2]+=h,b[3]+=h),b[0]<We&&b[1]<We&&b[2]>=0&&b[3]>=0&&_.insert(p,b[0],b[1],b[2],b[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new G_(new om(this.rawTileData)).layers,this.sourceLayerCoder=new r1(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t){const{tilespaceGeometry:n,transform:s,tileTransform:l,pixelPosMatrix:c,availableImages:h,worldview:p}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const _=t.queryRadius?t.queryRadius:0,y=n.bufferedTilespaceBounds,v=this.grid.queryKeys(y.min.x,y.min.y,y.max.x,y.max.y,(A,C,D,F)=>X_(n.bufferedTilespaceGeometry,A-_,C-_,D+_,F+_));v.sort(rS);let b=null;s.elevation&&v.length>0&&(b=Wh.create(s.elevation,this.tileID));const T={};let S;for(let A=0;A<v.length;A++){const C=v[A];if(C===S)continue;S=C;const D=this.featureIndexArray.get(C);let F=null;this.is3DTile?this.loadMatchingModelFeature(T,D,e,n,s,p):this.loadMatchingFeature(T,D,e,h,p,(O,z,N,j=0)=>(F||(F=q(O,this.tileID.canonical,l)),z.queryIntersectsFeature(n,O,N,F,this.z,s,c,b,j,t.scope)))}return T}loadMatchingFeature(e,t,n,s,l,c){const{featureIndex:h,bucketIndex:p,sourceLayerIndex:_,layoutVertexArrayOffset:y}=t,v=this.bucketLayerIDs[p],b=n.layers,T=Object.keys(b);if(T.length&&!Yc(T,v))return;const S=n.sourceCache,A=this.sourceLayerCoder.decode(_),C=this.vtLayers[A].feature(h),D=this.getId(C,A);for(let F=0;F<v.length;F++){const O=v[F];if(!b[O])continue;const{styleLayer:z,targets:N}=b[O];let j={};D!==void 0&&(j=S.getFeatureState(z.sourceLayer,D));const te=!c||c(C,z,j,y);if(!te)continue;const G=new Bu(C,this.z,this.x,this.y,D);G.tile=this.tileID.canonical,G.state=j;let W=this.serializedLayersCache.get(O);W||(W=z.serialize(),W.id=O,this.serializedLayersCache.set(O,W)),G.source=W.source,G.sourceLayer=W["source-layer"],G.layer={...W},G.layer.paint=eb(W.paint,z.paint,C,j,s),G.layer.layout=eb(W.layout,z.layout,C,j,s);const K=new Oi(this.tileID.overscaledZ,{worldview:l});let ee=!1;for(const le of N){this.updateFeatureProperties(G,le);const{filter:de}=le;if(de){if(C.properties=G.properties,de.needGeometry){const ve=X(C,!0);if(!de.filter(K,ve,this.tileID.canonical))continue}else if(!de.filter(K,C))continue}ee=!0,le.targetId&&this.addFeatureVariant(G,le)}ee&&this.appendToResult(e,O,h,G,te)}}loadMatchingModelFeature(e,t,n,s,l,c){const{featureIndex:h,bucketIndex:p}=t,_=this.bucketLayerIDs[p],y=n.layers,v=Object.keys(y);if(!v.length||Yc(v,_))for(let b=0;b<_.length;b++){const T=_[b],{styleLayer:S,targets:A}=y[T];if(S.type!=="model")continue;const C=s.tile,D=C.getBucket(S);if(!D||!D.isTiled3dModelBucket||!ku.loadMatchingModelFeature)continue;const F=ku.loadMatchingModelFeature(D,h,s,l);if(!F)continue;const{z:O,x:z,y:N}=C.tileID.canonical,{feature:j,intersectionZ:te,position:G}=F;let W={};j.id!==void 0&&(W=n.sourceCache.getFeatureState(S.sourceLayer,j.id));const K=new Bu({},O,z,N,j.id);K.tile=this.tileID.canonical,K.state=W,K.properties=j.properties,K.geometry={type:"Point",coordinates:[G.lng,G.lat]};let ee=this.serializedLayersCache.get(T);ee||(ee=S.serialize(),ee.id=T,this.serializedLayersCache.set(T,ee)),K.source=ee.source,K.sourceLayer=ee["source-layer"],K.layer={...ee};const le=new Oi(this.tileID.overscaledZ,{worldview:c});let de=!1;for(const ve of A){this.updateFeatureProperties(K,ve);const{filter:xe}=ve;if(xe){if(j.properties=K.properties,xe.needGeometry){if(!xe.filter(le,j,this.tileID.canonical))continue}else if(!xe.filter(le,j))continue}de=!0,ve.targetId&&this.addFeatureVariant(K,ve)}de&&this.appendToResult(e,T,h,K,te)}}updateFeatureProperties(e,t,n){if(t.properties){const s={};for(const l in t.properties){const c=t.properties[l].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,n);c!=null&&(s[l]=c)}e.properties=s}}addFeatureVariant(e,t,n){const s={target:t.target,namespace:t.namespace,uniqueFeatureID:t.uniqueFeatureID};t.properties&&(s.properties=e.properties),e.variants=e.variants||{},e.variants[t.targetId]=e.variants[t.targetId]||[],e.variants[t.targetId].push(s)}appendToResult(e,t,n,s,l){let c=e[t];c===void 0&&(c=e[t]=[]),c.push({featureIndex:n,feature:s,intersectionZ:l})}lookupSymbolFeatures(e,t,n,s,l,c){const h={};this.loadVTLayers();for(const p of e)this.loadMatchingFeature(h,{bucketIndex:t,sourceLayerIndex:n,featureIndex:p,layoutVertexArrayOffset:0},s,l,c);return h}loadFeature(e){const{featureIndex:t,sourceLayerIndex:n}=e;this.loadVTLayers();const s=this.sourceLayerCoder.decode(n),l=this.vtFeatures[s];if(l[t])return l[t];const c=this.vtLayers[s].feature(t);return l[t]=c,c}hasLayer(e){for(const t of this.bucketLayerIDs)for(const n of t)if(e===n)return!0;return!1}getId(e,t){let n=e.id;if(this.promoteId){const s=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[t];if(s!=null)if(Array.isArray(s)){if(!this.promoteIdExpression){const l=xl(s);if(l.result!=="success"){const c=l.value.map(h=>`${h.key}: ${h.message}`).join(", ");return void gi(`Failed to create expression for promoteId: ${c}`)}this.promoteIdExpression=l.value}n=this.promoteIdExpression.evaluate({zoom:0},e)}else n=e.properties[s];typeof n=="boolean"&&(n=Number(n))}return n}}function eb(i,e,t,n,s){return ro(i,(l,c)=>{const h=e instanceof Oa?e.get(c):null;return h&&h.evaluate?h.evaluate(t,n,void 0,s):h})}function rS(i,e){return e-i}async function tb(){return Promise.resolve()}tt(Q1,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const nS={circle:class extends zn{constructor(i,e,t,n){super(i,{layout:Yv||(Yv=new qi({"circle-sort-key":new Ze(me.layout_circle["circle-sort-key"]),"circle-elevation-reference":new je(me.layout_circle["circle-elevation-reference"]),visibility:new je(me.layout_circle.visibility)})),paint:Kv||(Kv=new qi({"circle-radius":new Ze(me.paint_circle["circle-radius"]),"circle-color":new Ze(me.paint_circle["circle-color"]),"circle-blur":new Ze(me.paint_circle["circle-blur"]),"circle-opacity":new Ze(me.paint_circle["circle-opacity"]),"circle-translate":new je(me.paint_circle["circle-translate"]),"circle-translate-anchor":new je(me.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new je(me.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new je(me.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ze(me.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ze(me.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ze(me.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new je(me.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n)}createBucket(i){return new Gp(i)}queryRadius(i){const e=i;return qh("circle-radius",this,e)+qh("circle-stroke-width",this,e)+Gm(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,t,n,s,l,c,h){const p=i0(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),l.angle,i.pixelToTileUnitsFactor),_=this.paint.get("circle-radius").evaluate(e,t)+this.paint.get("circle-stroke-width").evaluate(e,t);return n0(i,n,l,c,h,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",p,_)}getProgramIds(){return["circle"]}getDefaultProgramParams(i,e,t){const n=r0(this);return{config:new Au(this,{zoom:e,lut:t}),defines:n,overrideFog:!1}}is3D(i){return!i&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}mayUse(i){return i==="HD"&&Ih(this,"circle-elevation-reference",e=>e==="hd-road-markup")}prepare(){return this.mayUse("HD")?jm():Promise.resolve()}},heatmap:class extends zn{createBucket(i){return new s0(i)}constructor(i,e,t,n){super(i,{layout:a0||(a0=new qi({visibility:new je(me.layout_heatmap.visibility)})),paint:l0||(l0=new qi({"heatmap-radius":new Ze(me.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ze(me.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new je(me.paint_heatmap["heatmap-intensity"]),"heatmap-color":new oa(me.paint_heatmap["heatmap-color"]),"heatmap-opacity":new je(me.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Cf({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 qh("heatmap-radius",this,i)}queryIntersectsFeature(i,e,t,n,s,l,c,h){const p=this.paint.get("heatmap-radius").evaluate(e,t);return n0(i,n,l,c,h,!0,!0,new Le(0,0),p)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(i,e,t){return i==="heatmap"?{config:new Au(this,{zoom:e,lut:t}),overrideFog:!1}:{}}},hillshade:class extends zn{constructor(i,e,t,n){super(i,{layout:c0||(c0=new qi({visibility:new je(me.layout_hillshade.visibility)})),paint:u0||(u0=new qi({"hillshade-illumination-direction":new je(me.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new je(me.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new je(me.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new je(me.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new je(me.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new je(me.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new je(me.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(i,e,t){return{overrideFog:!1}}},fill:class extends zn{constructor(i,e,t,n){super(i,{layout:h0||(h0=new qi({"fill-sort-key":new Ze(me.layout_fill["fill-sort-key"]),visibility:new je(me.layout_fill.visibility),"fill-elevation-reference":new je(me.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Ze(me.layout_fill["fill-construct-bridge-guard-rail"])})),paint:d0||(d0=new qi({"fill-antialias":new je(me.paint_fill["fill-antialias"]),"fill-opacity":new Ze(me.paint_fill["fill-opacity"]),"fill-color":new Ze(me.paint_fill["fill-color"]),"fill-outline-color":new Ze(me.paint_fill["fill-outline-color"]),"fill-translate":new je(me.paint_fill["fill-translate"]),"fill-translate-anchor":new je(me.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ze(me.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new je(me.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new je(me.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Ze(me.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Ze(me.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Ze(me.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n)}getProgramIds(){const i=this.paint.get("fill-pattern"),e=i&&i.constantOr(1),t=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&t.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),t}getDefaultProgramParams(i,e,t){return{config:new Au(this,{zoom:e,lut:t}),overrideFog:!1}}recalculate(i,e){super.recalculate(i,e);const t=this.paint._values["fill-outline-color"];t.value.kind==="constant"&&t.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new j_(i)}queryRadius(){return Gm(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,t,n,s,l){return!i.queryGeometry.isAboveHorizon&&Z_(t0(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),l.angle,i.pixelToTileUnitsFactor),n)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(i){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return i!=null?e&&!i:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}mayUse(i){return i==="HD"&&Ih(this,"fill-elevation-reference",e=>e!=="none")}prepare(){return this.mayUse("HD")?jm():Promise.resolve()}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends zn{constructor(i,e,t,n){super(i,{layout:m0||(m0=new qi({visibility:new je(me["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new je(me["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new je(me["layout_fill-extrusion"]["source-max-zoom"])})),paint:_0||(_0=new qi({"fill-extrusion-opacity":new je(me["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ze(me["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new je(me["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new je(me["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ze(me["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new je(me["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Ze(me["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ze(me["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new je(me["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new je(me["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new je(me["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new je(me["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new je(me["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new je(me["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new je(me["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new je(me["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new je(me["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new je(me["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Ze(me["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Ze(me["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new je(me["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new je(me["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new je(me["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new je(me["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new je(me["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new Ze(me["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Ze(me["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new je(me["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(i){return new Nm(i)}queryRadius(){return Gm(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,e,t,n,s,l,c,h,p){const _=i0(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),l.angle,i.pixelToTileUnitsFactor),y=this.paint.get("fill-extrusion-height").evaluate(e,t),v=this.paint.get("fill-extrusion-base").evaluate(e,t),b=[0,0],T=h&&l.elevation,S=l.elevation?l.elevation.exaggeration():1,A=i.tile.getBucket(this);if(A instanceof Nm){const z=A.centroidData.find(N=>p>=N.vertexArrayOffset&&p<N.vertexArrayOffset+N.vertexCount);if(z&&z.flags&zm)return!1;if(T){const N=A.centroidVertexArray,j=p+1;j<N.length&&(b[0]=N.geta_centroid_pos0(j),b[1]=N.geta_centroid_pos1(j))}}if(b[0]===0&&b[1]===1)return!1;l.projection.name==="globe"&&(n=Wv([n],[new Le(0,0),new Le(We,We)],i.tileID.canonical).map(z=>z.polygon).flat());const C=T?h:null,[D,F]=E0(l,n,v,y,_,c,C,b,S,l.center.lat,i.tileID.canonical),O=i.queryGeometry;return T0(D,F,O.isPointQuery()?O.screenBounds:O.screenGeometry)}},building:class extends zn{constructor(i,e,t,n){super(i,{layout:g0||(g0=new qi({visibility:new je(me.layout_building.visibility),"building-facade":new Ze(me.layout_building["building-facade"]),"building-facade-floors":new Ze(me.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ze(me.layout_building["building-facade-unit-width"]),"building-facade-window":new Ze(me.layout_building["building-facade-window"]),"building-roof-shape":new Ze(me.layout_building["building-roof-shape"]),"building-height":new Ze(me.layout_building["building-height"]),"building-base":new Ze(me.layout_building["building-base"]),"building-flood-light-wall-radius":new Ze(me.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ze(me.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ze(me.layout_building["building-flip-roof-orientation"])})),paint:y0||(y0=new qi({"building-opacity":new je(me.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new je(me.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new je(me.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new je(me.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new je(me.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new je(me.paint_building["building-vertical-scale"]),"building-cast-shadows":new je(me.paint_building["building-cast-shadows"]),"building-color":new Ze(me.paint_building["building-color"]),"building-emissive-strength":new Ze(me.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new je(me.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new je(me.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new je(me.paint_building["building-front-cutoff"]),"building-flood-light-color":new je(me.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new je(me.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new je(me.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(i){return i==="HD"}prepare(){return async function(){return function(){if(!us(self)||vs!=null||Jv!=null)return null;if($h!=null)return $h;const i=fetch(ye());return $h=function(e){let t,n,s,l,c;function h(){t=new Uint8Array(c.buffer),n=new Int16Array(c.buffer),s=new Int32Array(c.buffer),l=new Float32Array(c.buffer)}function p(){throw new Error("Unexpected BuildingGen error.")}const _=()=>{},y={a:{a:p,f:function(v){const b=t.length,T=Math.max(v>>>0,Math.ceil(1.2*b)),S=Math.ceil((T-b)/65536);try{return c.grow(S),h(),!0}catch{return!1}},g:p,b:_,c:_,d:_,e:_}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,y):e.then(v=>v.arrayBuffer()).then(v=>WebAssembly.instantiate(v,y))).then(v=>{const b=v.instance.exports;return(0,b.g)(),c=b.f,h(),new _E({setStyle:b.h,setAOOptions:b.i,setMetricOptions:b.j,setStructuralOptions:b.k,setFacadeOptions:b.l,setFauxFacadeOptions:b.m,setFacadeClassifierOptions:b.n,addFeature:b.o,addFacade:b.p,generateMesh:b.q,getLastError:b.r,getOuterRingLength:b.s,getMeshCount:b.t,getPositionsPtr:b.u,getPositionsLength:b.v,getNormalsPtr:b.w,getNormalsLength:b.x,getAOPtr:b.y,getAOLength:b.z,getUVPtr:b.A,getUVLength:b.B,getFauxFacadePtr:b.C,getFauxFacadeLength:b.D,getIndicesPtr:b.E,getIndicesLength:b.F,getBuildingPart:b.G,getRingCount:b.H,getRingPtr:b.I,getRingLength:b.J,malloc:b.K,free:b.L,heapU8:t,heap16:n,heap32:s,heapF32:l})})}(i).then(e=>{$h=null,vs=e}).catch(e=>{gi("Could not load building-gen"),$h=null,Jv=e}),$h}()}()}createBucket(i){return new Qv(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,e,t,n,s,l,c,h,p,_){let y=this.layout.get("building-height").evaluate(e,t);const v=this.layout.get("building-base").evaluate(e,t),b=i.tile.getBucket(this).getFootprint(e);if(b){if(b.hiddenFlags!==0)return!1;y=b.height}const[T,S]=E0(l,n,v,y,new Le(0,0),c,null,[0,0],1,l.center.lat,i.tileID.canonical),A=i.queryGeometry;return T0(T,S,A.isPointQuery()?A.screenBounds:A.screenGeometry)}},line:class extends zn{constructor(i,e,t,n){const s=R0();super(i,s,e,t,n),s.layout&&(this.layout=new Oa(s.layout)),this.gradientVersion=0,this.borderGradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1,this.lineBlendFbos=null,this.lineBlendDensityReadback=null}_handleSpecialPaintPropertyUpdate(i){if(i==="line-gradient"){const
3097e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof gl,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}else if(i==="line-gradient-use-theme")this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER;else if(i==="line-border-gradient"){const e=this._transitionablePaint._values["line-border-gradient"].value.expression;this.borderStepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof gl,this.borderGradientVersion=(this.borderGradientVersion+1)%Number.MAX_SAFE_INTEGER}else i==="line-border-gradient-use-theme"&&(this.borderGradientVersion=(this.borderGradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}borderGradientExpression(){return this._transitionablePaint._values["line-border-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=(()=>
3097{if(Pf)return Pf;const t=R0();return Pf=new SE(t.paint.properties["line-width"].specification),Pf.useIntegerZoom=!0,Pf})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Q_(i)}getProgramIds(){const i=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return this.paint.get("line-blend-mode")!=="default"&&i.push("lineBlendComposite"),i}getDefaultProgramParams(i,e,t){if(i==="lineBlendComposite")return{};const n=C0(this);return{config:new Au(this,{zoom:e,lut:t}),defines:n,overrideFog:!1}}queryRadius(i){const e=i,t=L0(qh("line-width",this,e),qh("line-gap-width",this,e)),n=qh("line-offset",this,e);return t/2+Math.abs(n)+Gm(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,t,n,s,l){if(i.queryGeometry.isAboveHorizon)return!1;const c=t0(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),l.angle,i.pixelToTileUnitsFactor),h=i.pixelToTileUnitsFactor/2*L0(this.paint.get("line-width").evaluate(e,t),this.paint.get("line-gap-width").evaluate(e,t)),p=this.paint.get("line-offset").evaluate(e,t);return p&&(n=function(_,y){const v=[],b=new Le(0,0);for(let T=0;T<_.length;T++){const S=_[T],A=[];for(let C=0;C<S.length;C++){const D=S[C],F=S[C+1],O=C===0?b:D.sub(S[C-1])._unit()._perp(),z=C===S.length-1?b:F.sub(D)._unit()._perp(),N=O._add(z)._unit();N._mult(1/(N.x*z.x+N.y*z.y)),A.push(N._mult(y)._add(D))}v.push(A)}return v}(n,p*i.pixelToTileUnitsFactor)),function(_,y,v){for(let b=0;b<y.length;b++){const T=y[b];if(_.length>=3){for(let S=0;S<T.length;S++)if(Ac(_,T[S]))return!0}if(Xb(_,T,v))return!0}return!1}(c,n,h)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(i){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}mayUse(i){return i==="HD"&&Ih(this,"line-elevation-reference",e=>e==="hd-road-markup")}prepare(){return this.mayUse("HD")?jm():Promise.resolve()}hasOffscreenPass(){return this.paint.get("line-blend-mode")!=="default"&&this.paint.get("line-opacity").constantOr(1)!==0&&this.paint.get("line-width").constantOr(1)!==0&&this.visibility!=="none"}resize(){this._destroyLineBlendFbo()}onRemove(i){this._destroyLineBlendFbo(i.painter&&i.painter.context&&i.painter.context.gl||void 0)}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(i){this.lineBlendFbos&&(this.lineBlendFbos.destroy(),this.lineBlendFbos=null),i&&this.lineBlendDensityReadback&&this.lineBlendDensityReadback.destroy(i),this.lineBlendDensityReadback=null}},symbol:Hm,background:class extends zn{constructor(i,e,t,n){super(i,{layout:O0||(O0=new qi({visibility:new je(me.layout_background.visibility)})),paint:B0||(B0=new qi({"background-pitch-alignment":new je(me.paint_background["background-pitch-alignment"]),"background-color":new je(me.paint_background["background-color"]),"background-pattern":new je(me.paint_background["background-pattern"]),"background-opacity":new je(me.paint_background["background-opacity"]),"background-emissive-strength":new je(me.paint_background["background-emissive-strength"]),"background-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(i,e,t){return{overrideFog:!1}}is3D(i){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:V0,"raster-particle":W0,sky:class extends zn{constructor(i,e,t,n){super(i,{layout:G0||(G0=new qi({visibility:new je(me.layout_sky.visibility)})),paint:H0||(H0=new qi({"sky-type":new je(me.paint_sky["sky-type"]),"sky-atmosphere-sun":new je(me.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new je(me.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new je(me.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new je(me.paint_sky["sky-gradient-radius"]),"sky-gradient":new oa(me.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new je(me.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new je(me.paint_sky["sky-atmosphere-color"]),"sky-opacity":new je(me.paint_sky["sky-opacity"]),"sky-gradient-use
3097-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,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){i==="sky-gradient"?this._updateColorRamp():i!=="sky-atmosphere-sun"&&i!=="sky-atmosphere-halo-color"&&i!=="sky-atmosphere-color"&&i!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Cf({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")){const e=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(i,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),s=!n,l=i.style.light,c=l.properties.get("position");return s&&l.properties.get("anchor")==="viewport"&&gi("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),s?ny(c.azimuthal,90-c.polar,e):ny(n[0],90-n[1],e)}const t=this.paint.get("sky-gradient-center");return ny(t[0],90-t[1],e)}isSky(){return!0}markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const i=this.paint.get("sky-type");return i==="atmosphere"?["skyboxCapture","skybox"]:i==="gradient"?["skyboxGradient"]:null}},slot:class extends zn{constructor(i,e,t,n){super(i,{paint:Z0||(Z0=new qi({}))},e,null)}},model:class extends zn{constructor(i,e,t,n){super(i,{layout:$0||($0=new qi({visibility:new je(me.layout_model.visibility),"model-id":new Ze(me.layout_model["model-id"]),"model-allow-density-reduction":new je(me.layout_model["model-allow-density-reduction"])})),paint:q0||(q0=new qi({"model-opacity":new Ze(me.paint_model["model-opacity"]),"model-rotation":new Ze(me.paint_model["model-rotation"]),"model-scale":new Ze(me.paint_model["model-scale"]),"model-translation":new Ze(me.paint_model["model-translation"]),"model-color":new Ze(me.paint_model["model-color"]),"model-color-mix-intensity":new Ze(me.paint_model["model-color-mix-intensity"]),"model-type":new je(me.paint_model["model-type"]),"model-cast-shadows":new je(me.paint_model["model-cast-shadows"]),"model-receive-shadows":new je(me.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new je(me.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Ze(me.paint_model["model-emissive-strength"]),"model-roughness":new Ze(me.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Ze(me.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new je(me.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new je(me.paint_model["model-front-cutoff"]),"model-elevation-reference":new je(me.paint_model["model-elevation-reference"]),"model-line-cutout-mode":new je(me.paint_model["model-line-cutout-mode"]),"model-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this.layer=i,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(i){return i==="Standard"}prepare(){return tb()}createBucket(i){return new oy(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 i.isTiled3dModelBucket?8191:0}queryRenderedFeatures(i,e,t){return ku.queryModelLayerRendered?ku.queryModelLayerRendered(this,i,e,t):{}}queryIntersectsFeature(i,e,t,n,s,l,c,h,p,_){return!!ku.queryModelLayerIntersectsFeature&&ku.queryModelLayerIntersectsFeature(this,i,e,t,l,_)}_handleOverridablePaintPropertyUpdate(i,e,t){return!(!this.layout||e.isDataDriven()||t.isDataDriven()||i!=="model-color"&&i!=="model-color-mix-intensity"&&i!=="model-rotation"&&i!=="model-scale"&&i!=="model-translation"&&i!=="model-emissive-strength")}_isPropertyZoomDependent(i){const e=this._transitionablePaint._values[i];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof vl}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends zn{constructor(i,e,t,n){super(i,{layout:f0||(f0=new qi({"clip-layer-types":ne
vendor: 10,185 bytes, line 3097
3097w je(me.layout_clip["clip-layer-types"]),"clip-layer-scope":new je(me.layout_clip["clip-layer-scope"]),visibility:new je(me.layout_clip.visibility)})),paint:p0||(p0=new qi({}))},e,t,n)}recalculate(i,e){super.recalculate(i,e)}createBucket(i){return new b0(i)}is3D(i){return!0}}};class Sy{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}delete(e){this.cache.delete(e)}}tt(Sy,"LRUCache");class oS{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(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&&(this._channel.port1.close(),this._channel.port2.close()),this._callback=()=>{}}}const ib={Other:0,Symbol:1,FillExtrusion:2,HdRoadCoverage:3,HdRoadElevation:4};class sS{constructor(){this.tasks=new Map,cs(["process"],this),this.invoker=new oS(this.process),this.nextId=0}add(e,t){const n=this.nextId++,s=function({type:l,renderSourceType:c,zoom:h}){h=h||0;const p=c===ib.Symbol;return l==="message"?0:l!=="maybePrepare"||p?l!=="parseTile"||p?l==="parseTile"&&p?300-h:l==="maybePrepare"&&p?400-h:500:200-h:100-h}(t);if(s===0){try{e()}finally{}return null}return this.tasks.set(n,{fn:e,metadata:t,priority:s,id:n}),this.invoker.trigger(),{cancel:()=>{this.tasks.delete(n)}}}process(){try{const e=this.pick();if(!e)return;this.tasks.delete(e.id),this.tasks.size>0&&this.invoker.trigger(),e.fn()}finally{}}pick(){let e=null,t=1/0;for(const n of this.tasks.values())n.priority<t&&(t=n.priority,e=n);return e}remove(){this.tasks.clear(),this.invoker.remove()}}const rb={type:"message"},Iy=new Map,nb=new Map;class ob{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,t){const n=this.toIdx(e,t);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,t){return this.leaves[this.toIdx(e,t)]}toIdx(e,t){return t*this.size+e}}function sb(i,e,t,n){let s=0,l=Number.MAX_VALUE;for(let c=0;c<3;c++)if(Math.abs(n[c])<1e-15){if(t[c]<i[c]||t[c]>e[c])return null}else{const h=1/n[c];let p=(i[c]-t[c])*h,_=(e[c]-t[c])*h;if(p>_){const y=p;p=_,_=y}if(p>s&&(s=p),_<l&&(l=_),s>l)return null}return s}function ab(i,e,t,n,s,l,c,h,p,_,y){const v=n-i,b=s-e,T=l-t,S=c-i,A=h-e,C=p-t,D=y[1]*C-y[2]*A,F=y[2]*S-y[0]*C,O=y[0]*A-y[1]*S,z=v*D+b*F+T*O;if(Math.abs(z)<1e-15)return null;const N=1/z,j=_[0]-i,te=_[1]-e,G=_[2]-t,W=(j*D+te*F+G*O)*N;if(W<0||W>1)return null;const K=te*T-G*b,ee=G*v-j*T,le=j*b-te*v,de=(y[0]*K+y[1]*ee+y[2]*le)*N;return de<0||W+de>1?null:(S*K+A*ee+C*le)*N}function lb(i,e,t,n,s,l,c,h,p){const _=1<<t,y=l-n,v=c-s,b=(i+1)/_*y+n,T=(e+0)/_*v+s,S=(e+1)/_*v+s;h[0]=(i+0)/_*y+n,h[1]=T,p[0]=b,p[1]=S}class cb{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const t=function(l){const c=l.dim,h=Math.ceil(Math.log2(c/8)),p=[];let _=Math.ceil(Math.pow(2,h));const y=(C,D,F,O,z)=>{const N=O?1:0,j=(C+1)*F-N,te=D*F,G=(D+1)*F-N;z[0]=C*F,z[1]=te,z[2]=j,z[3]=G};let v=new ob(_);const b=1/_,{floatView:T,stride:S}=l,A=[];for(let C=0;C<_*_;C++){const D=Math.floor(C/_),F=C%_;y(F,D,b,!1,A);const O=kc(A[0],A[1],l),z=kc(A[2],A[1],l),N=kc(A[2],A[3],l),j=kc(A[0],A[3],l),te=Math.min(O,z,N,j),G=Math.max(0,8*F-1),W=Math.min(c-1,8*(F+1)),K=Math.max(0,8*D-1),ee=Math.min(c-1,8*(D+1));let le=-1/0;for(let de=K;de<=ee;de++){const ve=(de+1)*S;for(let xe=G;xe<=W;xe++){const we=T[ve+xe+1];we>le&&(le=we)}}v.minimums.push(te),v.maximums.push(le),v.leaves.push(1)}for(p.push(v),_/=2;_>=1;_/=2){const C=p.at(-1);v=new ob(_);for(let D=0;D<_*_;D++){y(D%_,Math.floor(D/_),2,!0,A);const F=C.getElevation(A[0],A[1]),O=C.getElevation(A[2],A[1]),z=C.getElevation(A[2],A[3]),N=C.getElevation(A[0],A[3]),j=C.isLeaf(A[0],A[1]),te=C.isLeaf(A[2],A[1]),G=C.isLeaf(A[2],A[3]),W=C.isLeaf(A[0],A[3]),K=Math.min(F.min,O.min,z.min,N.min),ee=Math.max(F.max,O.max,z.max,N.max),le=j&&te&&G&&W;v.maximums.push(ee),v.minimums.push(K),v.leaves.push(ee-K<=5&&le?1:0)}p.push(v)}return p}(this.dem),n=t.length-1,s=t[n];this._addNode(s.minimums[0],s.maximums[0],s.leaves[0]),this._construct(t,0,0,n,0)}raycastRoot(e,t,n,s,l,c,h=1){return sb([e,t,-100],[n,s,this.maximums[0]*h],l,c)}raycast(e,t,n,s,l,c,h=1){if(!this.nodeCount)return null;const p=this.raycastRoot(e,t,n,s,l,c,h);if(p==null)return null;const _=[],y=[],v=[],b=[],T=[{idx:0,t:p,nodex:0,nodey:0,depth:0}];for(;T.length>0;){const{idx:S,t:A,nodex:C,nodey:D,depth:F}=T.pop();if(this.leaves[S]){lb(C,D,F,e,t,n,s,v,b);const z=1<<F,N=C/z,j=(C+1)/z,te=D/z,G=(D+1)/z,{dim:W,floatView:K,stride:ee}=this.dem,le=Math.floor(N*W),de=Math.ceil(j*W),ve=Math.floor(te*W),xe=de-le,we=Math.ceil(G*W)-ve;if(xe<=0||we<=0)continue;const Fe=v[0],se=v[1],pe=(b[0]-Fe)/xe,ge=(b[1]-se)/we,Se=Math.max(0,A),Me=l[0]+c[0]*Se,Pe=l[1]+c[1]*Se,Ie=Math.abs(c[0])>1e-10,Oe=Math.abs(c[1])>1e-10,Be=c[0]>=0?1:-1,Ke=c[1]>=0?1:-1;let Ne=Math.max(0,Math.min(xe-1,Math.floor((Me-Fe)/pe))),He=Math.max(0,Math.min(we-1,Math.floor((Pe-se)/ge)));const ft=Ie?Math.abs(pe/c[0]):Number.MAX_VALUE,pt=Oe?Math.abs(ge/c[1]):Number.MAX_VALUE;let xt=Ie?Se+(Fe+(c[0]>=0?Ne+1:Ne)*pe-Me)/c[0]:Number.MAX_VALUE,ht=Oe?Se+(se+(c[1]>=0?He+1:He)*ge-Pe)/c[1]:Number.MAX_VALUE;const wt=(Dr,It)=>K[(It+1)*ee+Dr+1]*h;let vt=wt(le+Ne,ve+He),ri=wt(le+Ne+1,ve+He),Gt=wt(le+Ne,ve+He+1),ei=wt(le+Ne+1,ve+He+1),ui=null;for(let Dr=0;Dr<xe+we;Dr++){const It=Math.min(xt,ht);if(c[2]>=0||l[2]+c[2]*It<=Math.max(vt,ri,Gt,ei)){const Qr=Fe+Ne*pe,Bn=Qr+pe,kn=se+He*ge,yo=kn+ge,xo=ab(Bn,kn,ri,Qr,kn,vt,Qr,yo,Gt,l,c),gn=ab(Qr,yo,Gt,Bn,yo,ei,Bn,kn,ri,l,c);xo!=null&&xo>=0&&(ui===null||xo<ui)&&(ui=xo),gn!=null&&gn>=0&&(ui===null||gn<ui)&&(ui=gn)}const Jr=xt<ht;if(Jr?(Ne+=Be,xt+=ft):(He+=Ke,ht+=pt),Ne<0||Ne>=xe||He<0||He>=we||ui!==null&&It>ui)break;Jr?Be>0?(vt=ri,Gt=ei,ri=wt(le+Ne+1,ve+He),ei=wt(le+Ne+1,ve+He+1)):(ri=vt,ei=Gt,vt=wt(le+Ne,ve+He),Gt=wt(le+Ne,ve+He+1)):Ke>0?(vt=Gt,ri=ei,Gt=wt(le+Ne,ve+He+1),ei=wt(le+Ne+1,ve+He+1)):(Gt=vt,ei=ri,vt=wt(le+Ne,ve+He),ri=wt(le+Ne+1,ve+He))}if(ui!==null)return ui||0;const Pr=cn([],l,c,A),Bo=(Pr[0]-v[0])/(b[0]-v[0]),fr=(Pr[1]-v[1])/(b[1]-v[1]),Xt=kc(N,te,this.dem)*h,ji=kc(j,te,this.dem)*h,yr=kc(j,G,this.dem)*h;if(ub(Xt,ji,kc(N,G,this.dem)*h,yr,Bo,fr)>=Pr[2])return A;continue}let O=0;for(let z=0;z<this._siblingOffset.length;z++){lb((C<<1)+this._siblingOffset[z][0],(D<<1)+this._siblingOffset[z][1],F+1,e,t,n,s,v,b),v[2]=-100,b[2]=this.maximums[this.childOffsets[S]+z]*h;const N=sb(v,b,l,c);if(N!=null){const j=N;_[z]=j;let te=!1;for(let G=0;G<O&&!te;G++)j>=_[y[G]]&&(y.splice(G,0,z),te=!0);te||(y[O]=z),O++}}for(let z=0;z<O;z++){const N=y[z];T.push({idx:this.childOffsets[S]+N,t:_[N],nodex:(C<<1)+this._siblingOffset[N][0],nodey:(D<<1)+this._siblingOffset[N][1],depth:F+1})}}return null}_addNode(e,t,n){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,n,s,l){if(e[s].isLeaf(t,n)===1)return;this.childOffsets[l]||(this.childOffsets[l]=this.nodeCount);const c=s-1,h=e[c];let p=0,_=0;for(let y=0;y<this._siblingOffset.length;y++){const v=2*t+this._siblingOffset[y][0],b=2*n+this._siblingOffset[y][1],T=h.getElevation(v,b),S=h.isLeaf(v,b),A=this._addNode(T.min,T.max,S);S&&(p|=1<<y),_||(_=A)}for(let y=0;y<this._siblingOffset.length;y++)p&1<<y||this._construct(e,2*t+this._siblingOffset[y][0],2*n+this._siblingOffset[y][1],c,_+y)}}function ub(i,e,t,n,s,l){return lt(lt(i,t,l),lt(e,n,l),s)}function kc(i,e,t){const n=t.dim,s=yt(i*n-.5,0,n-1),l=yt(e*n-.5,0,n-1),c=Math.floor(s),h=Math.floor(l),p=Math.min(c+1,n-1),_=Math.min(h+1,n-1);return ub(t.get(c,h),t.get(p,h),t.get(c,_),t.get(p,_),s-c,l-h)}const aS={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function lS(i,e,t){return(256*i*256+256*e+t)/10-1e4}function cS(i,e,t){return 256*i+e+t/256-32768}class l_{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,t,n,s=!1){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return void gi(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const l=this.dim=t.height-2,c=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.floatView=new Float32Array(t.data.buffer),this.borderReady=s,this._modifiedForSources={},!s){for(let p=0;p<l;p++)c[this._idx(-1,p)]=c[this._idx(0,p)],c[this._idx(l,p)]=c[this._idx(l-1,p)],c[this._idx(p,-1)]=c[this._idx(p,0)],c[this._idx(p,l)]=c[this._idx(p,l-1)];c[this._idx(-1,-1)]=c[this._idx(0,0)],c[this._idx(l,-1)]=c[this._idx(l-1,0)],c[this._idx(-1,l)]=c[this._idx(0,l-1)],c[this._idx(l,l)]=c[this._idx(l-1,l-1)]}const h=n==="terrarium"?cS:lS;for(let p=0;p<c.length;++p){const _=4*p;this.floatView[p]=h(this.pixels[_],this.pixels[_+1],this.pixels[_+2])}this._timestamp=Y.now()}_buildQuadTree(){this._tree=new cb(this)}get(e,t,n=!1){n&&(e=yt(e,-1,this.dim),t=yt(t,-1,this.dim));const s=this._idx(e,t);return this.floatView[s]}set(e,t,n){const s=this._idx(e,t),l=this.floatView[s];return this.floatView[s]=n,n-l}static getUnpackVector(e){return aS[e]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const n=[0,0,0,0],s=l_.getUnpackVector(t);let l=Math.floor((e+s[3])/s[2]);return n[2]=l%256,l=Math.floor(l/256),n[1]=l%256,l=Math.floor(l/256),n[0]=l,n}getPixels(){return new Wy({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let s=t*this.dim,l=t*this.dim+this.dim,c=n*this.dim,h=n*this.dim+this.dim;switch(t){case-1:s=l-1;break;case 1:l=s+1}switch(n){case-1:c=h-1;break;case 1:h=c+1}const p=-t*this.dim,_=-n*this.dim;for(let y=c;
vendor: 14,438 bytes, line 3097
3097y<h;y++)for(let v=s;v<l;v++){const b=4*this._idx(v,y),T=4*this._idx(v+p,y+_);this.pixels[b+0]=e.pixels[T+0],this.pixels[b+1]=e.pixels[T+1],this.pixels[b+2]=e.pixels[T+2],this.pixels[b+3]=e.pixels[T+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function uS(i,e){const t={};let n;for(;n=i.nextField(e);)n===1?(t.delta_filter=hS(i,i.readVarint()+i.pos),t.filter="delta_filter"):n===2?(i.readVarint(),t.filter="zigzag_filter"):n===3?(i.readVarint(),t.filter="bitshuffle_filter"):n===4&&(i.readVarint(),t.filter="byteshuffle_filter");return t}function hS(i,e){const t={blockSize:0};let n;for(;n=i.nextField(e);)n===1&&(t.blockSize=i.readVarint());return t}function dS(i,e){const t={};let n;for(;n=i.nextField(e);)n===1?(i.readVarint(),t.codec="gzip_data"):n===2?(i.readVarint(),t.codec="jpeg_image"):n===3?(i.readVarint(),t.codec="webp_image"):n===4&&(i.readVarint(),t.codec="png_image");return t}function fS(i,e){const t={firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]};let n,s=0,l=0;for(;n=i.nextField(e);)n===1?t.firstByte=i.readFixed64():n===2?t.lastByte=i.readFixed64():n===3?t.filters.push(uS(i,i.readVarint()+i.pos)):n===4?t.codec=dS(i,i.readVarint()+i.pos):n===5?l=i.readFloat():n===6?s=i.readFloat():n===7?t.bands.push(i.readString()):n===8?t.offset=i.readDouble():n===9&&(t.scale=i.readDouble());return t.offset===0&&(t.offset=l),t.scale===0&&(t.scale=s),t}function pS(i,e){const t={version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]};let n;for(;n=i.nextField(e);)n===1?t.version=i.readVarint():n===2?t.name=i.readString():n===3?t.units=i.readString():n===4?t.tileSize=i.readVarint():n===5?t.buffer=i.readVarint():n===6?t.pixelFormat=i.readVarint():n===7&&t.dataIndex.push(fS(i,i.readVarint()+i.pos));return t}function mS(i,e,t){let n;for(;n=i.nextField(e);)if(n===1){let s=0;const l=i.readVarint()+i.pos;for(;i.pos<l;)t[s++]=i.readVarint()}return t}function _S(i,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let t=e[3];for(let n=2;n>=1;n--){const s=n===1?1:0,l=n===2?1:0;for(let c=0;c<e[0];c++){const h=e[1]*c;for(let p=s;p<e[1];p++){const _=e[2]*(p+h);for(let y=l;y<e[2];y++){const v=e[3]*(y+_);for(let b=0;b<e[3];b++){const T=v+b;i[T]+=i[T-t]}}}}t*=e[n]}return i}function gS(i){for(let e=0,t=i.length;e<t;e++)i[e]=i[e]>>>1^-(1&i[e]);return i}function yS(i,e){switch(e){case"uint32":return i;case"uint16":for(let t=0;t<i.length;t+=2){const n=i[t],s=i[t+1];i[t]=(240&n)>>4|(61440&n)>>8|(240&s)<<4|61440&s,i[t+1]=15&n|(3840&n)>>4|(15&s)<<8|(3840&s)<<4}return i;case"uint8":for(let t=0;t<i.length;t+=4){const n=i[t],s=i[t+1],l=i[t+2],c=i[t+3];i[t+0]=(192&n)>>6|(192&s)>>4|(192&l)>>2|192&c,i[t+1]=(48&n)>>4|(48&s)>>2|48&l|(48&c)<<2,i[t+2]=(12&n)>>2|12&s|(12&l)<<2|(12&c)<<4,i[t+3]=3&n|(3&s)<<2|(3&l)<<4|(3&c)<<6}return i;default:throw new Error(`Invalid pixel format, "${e}"`)}}tt(l_,"DEMData"),tt(cb,"DemMinMaxQuadTree",{omit:["dem"]});var ws=Uint8Array,Bf=Uint16Array,xS=Int32Array,hb=new ws([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]),db=new ws([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]),vS=new ws([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fb=function(i,e){for(var t=new Bf(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];var s=new xS(t[30]);for(n=1;n<30;++n)for(var l=t[n];l<t[n+1];++l)s[l]=l-t[n]<<5|n;return{b:t,r:s}},pb=fb(hb,2),mb=pb.b,bS=pb.r;mb[28]=258,bS[258]=28;for(var wS=fb(db,0).b,_b=new Bf(32768),Rr=0;Rr<32768;++Rr){var Qh=(43690&Rr)>>1|(21845&Rr)<<1;_b[Rr]=((65280&(Qh=(61680&(Qh=(52428&Qh)>>2|(13107&Qh)<<2))>>4|(3855&Qh)<<4))>>8|(255&Qh)<<8)>>1}var kf=function(i,e,t){for(var n=i.length,s=0,l=new Bf(e);s<n;++s)i[s]&&++l[i[s]-1];var c,h=new Bf(e);for(s=1;s<e;++s)h[s]=h[s-1]+l[s-1]<<1;c=new Bf(1<<e);var p=15-e;for(s=0;s<n;++s)if(i[s])for(var _=s<<4|i[s],y=e-i[s],v=h[i[s]-1]++<<y,b=v|(1<<y)-1;v<=b;++v)c[_b[v]>>p]=_;return c},Nf=new ws(288);for(Rr=0;Rr<144;++Rr)Nf[Rr]=8;for(Rr=144;Rr<256;++Rr)Nf[Rr]=9;for(Rr=256;Rr<280;++Rr)Nf[Rr]=7;for(Rr=280;Rr<288;++Rr)Nf[Rr]=8;var gb=new ws(32);for(Rr=0;Rr<32;++Rr)gb[Rr]=5;var TS=kf(Nf,9),ES=kf(gb,5),Ay=function(i){for(var e=i[0],t=1;t<i.length;++t)i[t]>e&&(e=i[t]);return e},la=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(7&e)&t},Cy=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(7&e)},SS=function(i){return(i+7)/8|0},IS=["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"],ca=function(i,e,t){var n=new Error(e||IS[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,ca),!t)throw n;return n},AS=new ws(0),CS=typeof TextDecoder<"u"&&new TextDecoder;try{CS.decode(AS,{stream:!0})}catch{}const MS={gzip_data:"gzip"};class Ns extends Error{constructor(e){super(e),this.name="MRTError"}}const RS={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},yb={uint32:1,uint16:2,uint8:4},PS={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let My;class c_{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new Ns(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),n=new DataView(e);if(t[0]!==13)throw new Ns("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),n=this.getHeaderLength(e);if(t.length<n)throw new Ns(`Expected header with length >= ${n} but got buffer of length ${t.length}`);const s=function(l){const c={headerLength:0,x:0,y:0,z:0,layers:[]};let h;for(;h=l.nextField(void 0);)h===1?c.headerLength=l.readFixed32():h===2?c.x=l.readVarint():h===3?c.y=l.readVarint():h===4?c.z=l.readVarint():h===5&&c.layers.push(pS(l,l.readVarint()+l.pos));return c}(new My(t.subarray(0,n)));if(!isNaN(this.x)&&(this.x!==s.x||this.y!==s.y||this.z!==s.z))throw new Ns(`Invalid attempt to parse header ${s.z}/${s.x}/${s.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=s.x,this.y=s.y,this.z=s.z;for(const l of s.layers)this.layers[l.name]=new xb(l,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],n=this.getLayer(e.layerName);for(let s of e.blockIndices){const l=n.dataIndex[s],c=l.firstByte-e.firstByte,h=l.lastByte-e.firstByte;if(n._blocksInProgress.has(s))continue;const p={layerName:n.name,firstByte:c,lastByte:h,pixelFormat:n.pixelFormat,blockIndex:s,blockShape:[l.bands.length].concat(n.bandShape),buffer:n.buffer,codec:l.codec.codec,filters:l.filters.map(_=>_.filter)};n._blocksInProgress.add(s),t.push(p)}return new vb(t,()=>{t.forEach(s=>n._blocksInProgress.delete(s.blockIndex))},(s,l)=>{if(t.forEach(c=>n._blocksInProgress.delete(c.blockIndex)),s)throw s;l.forEach(c=>{this.getLayer(c.layerName).processDecodedData(c)})})}}class xb{constructor({version:e,name:t,units:n,tileSize:s,pixelFormat:l,buffer:c,dataIndex:h},p){if(this.version=e,this.version!==1)throw new Ns(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=n,this.tileSize=s,this.buffer=c,this.pixelFormat=RS[l],this.dataIndex=h,this.bandShape=[s+2*c,s+2*c,yb[this.pixelFormat]],this._decodedBlocks=new Sy(p?p.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return yb[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[n,s]of this.dataIndex.entries()){for(const[l,c]of s.bands.entries())if(c===e)return{bandIndex:t+l,blockIndex:n,blockBandIndex:l};t+=s.bands.length}break;case"number":for(const[n,s]of this.dataIndex.entries()){if(e>=t&&e<t+s.bands.length)return{bandIndex:e,blockIndex:n,blockBandIndex:e-t};t+=s.bands.length}break;default:throw new Ns(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let t=1/0,n=-1/0;const s=[],l=new Set;for(const c of e){const{blockIndex:h}=this.getBlockForBand(c);if(h<0)throw new Ns(`Invalid band: ${JSON.stringify(c)}`);const p=this.dataIndex[h];s.includes(h)||s.push(h),l.add(h),t=Math.min(t,p.firstByte),n=Math.max(n,p.lastByte)}if(l.size>this.cacheSize)throw new Ns(`Number of blocks to decode (${l.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:n,blockIndices:s}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:n}=this.getBlockForBand(e);if(t<0)throw new Ns(`Band not found: ${JSON.stringify(e)}`);const s=this._decodedBlocks.get(t.toString());if(!s)throw new Ns(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const l=this.dataIndex[t],c=this.bandShape.reduce((_,y)=>_*y,1),h=n*c,p=s.subarray(h,h+c);return{data:p,bytes:new Uint8Array(p.buffer).subarray(p.byteOffset,p.byteOffset+p.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:l.offset,scale:l.scale}}}c_.setPbf=function(i){My=i};class vb{constructor(e,t,n){this.tasks=e,this._onCancel=t,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}c_.performDecoding=function(i,e){const t=new Uint8Array(i);return Promise.all(e.tasks.map(n=>{const{layerName:s,firstByte:l,lastByte:c,pixelFormat:h,blockShape:p,blockIndex:_,filters:y,codec:v}=n,b=t.subarray(l,c+1),T=new Uint32Array(p[0]*p[1]*p[2]);let S;if(v!=="gzip_data")throw new Ns(`Unhandled codec: ${v}`);return S=function(A,C){if(!globalThis.DecompressionStream&&C==="gzip_data")return Promise.resolve((N=function(G){G[0]==31&&G[1]==139&&G[2]==8||ca(6,"invalid gzip data");var W=G[3],K=10;4&W&&(K+=2+(G[10]|G[11]<<8));for(var ee=(W>>3&1)+(W>>4&1);ee>0;ee-=!G[K++]);return K+(2&W)}(D=A),N+8>D.length&&ca(6,"invalid gzip data"),function(G,W,K,ee){var le=G.length;if(!le||W.f&&!W.l)return K||new ws(0);var de=!K,ve=de||W.i!=2,xe=W.i;de&&(K=new ws(3*le));var we=function(gn){var on=K.length;if(gn>on){var yn=new ws(Math.max(2*on,gn));yn.set(K),K=yn}},Fe=W.f||0,se=W.p||0,pe=W.b||0,ge=W.l,Se=W.d,Me=W.m,Pe=W.n,Ie=8*le;do{if(!ge){Fe=la(G,se,1);var Oe=la(G,se+1,3);if(se+=3,!Oe){var Be=G[(Gt=SS(se)+4)-4]|G[Gt-3]<<8,Ke=Gt+Be;if(Ke>le){xe&&ca(0);break}ve&&we(pe+Be),K.set(G.subarray(Gt,Ke),pe),W.b=pe+=Be,W.p=se=8*Ke,W.f=Fe;continue}if(Oe==1)ge=TS,Se=ES,Me=9,Pe=5;else if(Oe==2){var Ne=la(G,se,31)+257,He=la(G,se+10,15)+4,ft=Ne+la(G,se+5,31)+1;se+=14;for(var pt=new ws(ft),xt=new ws(19),ht=0;ht<He;++ht)xt[vS[ht]]=la(G,se+3*ht,7);se+=3*He;var wt=Ay(xt),vt=(1<<wt)-1,ri=kf(xt,wt);for(ht=0;ht<ft;){var Gt,ei=ri[la(G,se,vt)];if(se+=15&ei,(Gt=ei>>4)<16)pt[ht++]=Gt;else{var ui=0,Pr=0;for(Gt==16?(Pr=3+la(G,se,3),se+=2,ui=pt[ht-1]):Gt==17?(Pr=3+la(G,se,7),se+=3):Gt==18&&(Pr=11+la(G,se,127),se+=7);Pr--;)pt[ht++]=ui}}var Bo=pt.subarray(0,Ne),fr=pt.subarray(Ne);Me=Ay(Bo),Pe=Ay(fr),ge=kf(Bo,Me),Se=kf(fr,Pe)}else ca(1);if(se>Ie){xe&&ca(0);break}}ve&&we(pe+131072);for(var Xt=(1<<Me)-1,ji=(1<<Pe)-1,yr=se;;yr=se){var Dr=(ui=ge[Cy(G,se)&Xt])>>4;if((se+=15&ui)>Ie){xe&&ca(0);break}if(ui||ca(2),Dr<256)K[pe++]=Dr;else{if(Dr==256){yr=se,ge=null;break}var It=Dr-254;Dr>264&&(It=la(G,se,(1<<(Bn=hb[ht=Dr-257]))-1)+mb[ht],se+=Bn);var Jr=Se[Cy(G,se)&ji],Qr=Jr>>4;if(Jr||ca(3),se+=15&Jr,fr=wS[Qr],Qr>3){var Bn=db[Qr];fr+=Cy(G,se)&(1<<Bn)-1,se+=Bn}if(se>Ie){xe&&ca(0);break}ve&&we(pe+131072);var kn=pe+It;if(pe<fr){var yo=0-fr,xo=Math.min(fr,kn);for(yo+pe<0&&ca(3);pe<xo;++pe)K[pe]=ee[yo+pe]}for(;pe<kn;++pe)K[pe]=K[pe-fr]}}W.l=ge,W.p=yr,W.b=pe,W.f=Fe,ge&&(Fe=1,W.m=Me,W.d=Se,W.n=Pe)}while(!Fe);return pe!=K.length&&de?function(gn,on,yn){return(yn==null||yn>gn.length)&&(yn=gn.length),new ws(gn.subarray(0,yn))}(K,0,pe):K.subarray(0,pe)}(D.subarray(N,-8),{i:2},new ws(((O=D)[(z=O.length)-4]|O[z-3]<<8|O[z-2]<<16|O[z-1]<<24)>>>0),F)));var D,F,O,z,N;const j=MS[C];if(!j)throw new Error(`Unhandled codec: ${C}`);const te=new globalThis.DecompressionStream(j);return new Response(new Blob([A]).stream().pipeThrough(te)).arrayBuffer().then(G=>new Uint8Array(G))}(b,v).then(A=>(function(C,D){let F;for(;F=C.nextField();)if(F===2)mS(C,C.readVarint()+C.pos,D);else if(F===3)throw new Error("Not implemented")}(new My(A),T),new PS[h](T.buffer))),S.then(A=>{for(let C=y.length-1;C>=0;C--)switch(y[C]){case"delta_filter":_S(A,p);break;case"zigzag_filter":gS(A);break;case"bitshuffle_filter":yS(A,h);break;default:throw new Ns(`Unhandled filter "${y[C]}"`)}return{layerName:s,blockIndex:_,data:A}}).catch(A=>{throw A})}))},tt(vb,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),tt(c_,"MapboxRasterTile"),tt(xb,"MapboxRasterLayer",{omit:["_blocksInProgress"]});const bb=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Vr=new Uint32Array(96);class Ry{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(t!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=n>>4;if(s!==1)throw new Error(`Got v${s} data when expected v1.`);const l=bb[15&n];if(!l)throw new Error("Unrecognized array type.");const[c]=new Uint16Array(e,2,1),[h]=new Uint32Array(e,4,1);return new Ry(h,c,l,void 0,e)}constructor(e,t=64,n=Float64Array,s=ArrayBuffer,l){if(isNaN(e)||e<0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const c=bb.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,p=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-p%8)%8;if(c<0)throw new Error(`Unexpected typed array class: ${n}.`);if(l)this.data=l,this.ids=new this.IndexArrayType(l,8,e),this.coords=new n(l,8+p+_,2*e),this._pos=2*e,this._finished=!0;else{const y=this.data=new s(8+h+p+_);this.ids=new this.IndexArrayType(y,8,e),this.coords=new n(y,8+p+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(y,0,2).set([219,16+c]),new Uint16Array(y,2,1)[0]=t,new Uint32Array(y,4,1)[0]=e}}
vendor: 9,499 bytes, line 3097
3097add(e,t){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Py(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:c,nodeSize:h}=this;Vr[0]=0,Vr[1]=l.length-1,Vr[2]=0;let p=3;const _=[];for(;p>0;){const y=Vr[--p],v=Vr[--p],b=Vr[--p];if(v-b<=h){for(let C=b;C<=v;C++){const D=c[2*C],F=c[2*C+1];D>=e&&D<=n&&F>=t&&F<=s&&_.push(l[C])}continue}const T=b+v>>1,S=c[2*T],A=c[2*T+1];S>=e&&S<=n&&A>=t&&A<=s&&_.push(l[T]),(y===0?e<=S:t<=A)&&(Vr[p++]=b,Vr[p++]=T-1,Vr[p++]=1-y),(y===0?n>=S:s>=A)&&(Vr[p++]=T+1,Vr[p++]=v,Vr[p++]=1-y)}return _}within(e,t,n){const s=[];return this.withinInto(e,t,n,s),s}withinInto(e,t,n,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:c,nodeSize:h}=this;Vr[0]=0,Vr[1]=l.length-1,Vr[2]=0;let p=3,_=0;const y=n*n;for(;p>0;){const v=Vr[--p],b=Vr[--p],T=Vr[--p];if(b-T<=h){for(let D=T;D<=b;D++)Tb(c[2*D],c[2*D+1],e,t)<=y&&(s[_++]=l[D]);continue}const S=T+b>>1,A=c[2*S],C=c[2*S+1];Tb(A,C,e,t)<=y&&(s[_++]=l[S]),(v===0?e-n<=A:t-n<=C)&&(Vr[p++]=T,Vr[p++]=S-1,Vr[p++]=1-v),(v===0?e+n>=A:t+n>=C)&&(Vr[p++]=S+1,Vr[p++]=b,Vr[p++]=1-v)}return _}}function Py(i,e,t,n,s,l){if(s-n<=t)return;const c=n+s>>1;wb(i,e,c,n,s,l),Py(i,e,t,n,c-1,1-l),Py(i,e,t,c+1,s,1-l)}function wb(i,e,t,n,s,l){for(;s>n;){if(s-n>600){const _=s-n+1,y=t-n+1,v=Math.log(_),b=.5*Math.exp(2*v/3),T=.5*Math.sqrt(v*b*(_-b)/_)*(y-_/2<0?-1:1);wb(i,e,t,Math.max(n,Math.floor(t-y*b/_+T)),Math.min(s,Math.floor(t+(_-y)*b/_+T)),l)}const c=e[2*t+l];let h=n,p=s;for(Vf(i,e,n,t),e[2*s+l]>c&&Vf(i,e,n,s);h<p;){for(Vf(i,e,h,p),h++,p--;e[2*h+l]<c;)h++;for(;e[2*p+l]>c;)p--}e[2*n+l]===c?Vf(i,e,n,p):(p++,Vf(i,e,p,s)),p<=t&&(n=p+1),t<=p&&(s=p-1)}}function Vf(i,e,t,n){Dy(i,t,n),Dy(e,2*t,2*n),Dy(e,2*t+1,2*n+1)}function Dy(i,e,t){const n=i[e];i[e]=i[t],i[t]=n}function Tb(i,e,t,n){const s=i-t,l=e-n;return s*s+l*l}L.$=_n,L.A=Ma,L.B=zs,L.C=Lt,L.D=ml,L.E=Pn,L.F=Sn,L.G=tu,L.H=nc,L.I=Ir,L.J=Eh,L.K=/^(.*)-transition$/,L.L=Sy,L.M=Cd,L.N=Id,L.O=as,L.P=Le,L.Q=Us,L.R=pi,L.S=Ll,L.T=lm,L.U=/^(.*)-use-theme$/,L.V=function(i,e){const t=Ll(e.zoom);if(t===0)return Na(i);const n=Xp(i),s=lg(n),l=po(n.getWest())*e.worldSize,c=po(n.getEast())*e.worldSize,h=$n(n.getNorth())*e.worldSize,p=$n(n.getSouth())*e.worldSize,_=[l,h,0],y=[c,h,0],v=[l,p,0],b=[c,p,0],T=xn([],e.globeMatrix);return hi(_,_,T),hi(y,y,T),hi(v,v,T),hi(b,b,T),s[0]=Dl(s[0],v,t),s[1]=Dl(s[1],b,t),s[2]=Dl(s[2],y,t),s[3]=Dl(s[3],_,t),zi.fromPoints(s)},L.W=cg,L.X=zt,L.Y=Jn,L.Z=mn,L._=bs,L.a=async function(i,e){i.headers||(i.headers={}),i.headers.accept="image/webp,*/*";const t=await function(n){return new Promise((s,l)=>{if(n&&n.aborted)return void l(n.reason);const c=()=>{const _=Ki.shift();_?_():wi--};if(wi<ie.MAX_PARALLEL_IMAGE_REQUESTS)return wi++,void s(c);const h=()=>{n&&n.removeEventListener("abort",p),s(c)},p=()=>{const _=Ki.indexOf(h);_!==-1&&Ki.splice(_,1),l(n.reason)};n&&n.addEventListener("abort",p),Ki.push(h)})}(e);try{const{data:n,headers:s}=await vi(i,e);let l;try{l=await createImageBitmap(new Blob([new Uint8Array(n)],{type:"image/png"}))}catch(c){throw new Error(`Could not load image because of ${c.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`,{cause:c})}return e&&e.throwIfAborted(),{data:l,headers:s}}finally{t()}},L.a$=lr,L.a0=y1,L.a1=Qi,L.a2=We,L.a3=Mr,L.a4=St,L.a5=Kr,L.a6=dr,L.a7=po,L.a8=$n,L.a9=Wa,L.aA=g,L.aB=vx,L.aC=Nm,L.aD=qv,L.aE=Kh,L.aF=W1,L.aG=fn,L.aH=(i,e,t,n,s,l,c,h,p,_,y,v,b,T,S,A,C,D,F=!1)=>{const O=H1(i,e,t,n,s,l,c,h,_,y,v,b,T,S,A,C,1,[0,0,0],[0,0,1],F),z={u_height_factor:-Math.pow(2,h.overscaledZ)/p.tileSize/8};return Object.assign(O,j1(e,p,D),z)},L.aI=H1,L.aJ=Bl,L.aK=450,L.aL=7,L.aM=(i,e,t,n,s,l)=>({u_matrix:i,u_edge_radius:e,u_width_scale:t,u_vertical_scale:n,u_height_type:r_[s],u_base_type:r_[l]}),L.aN=mr,L.aO=xn,L.aP=Ul,L.aQ=$1,L.aR=4,L.aS=2,L.aT=H_,L.aU=Z_,L.aV=cs,L.aW=class{static calculate(i,e,t){const n=new Set,s=new Map,l=new Set,c=new Set;for(const p of Object.values(i))for(const[_,y]of Object.entries(p.floors)){l.add(_),y.isDefault&&c.add(_),y.conflicts&&s.set(_,y.conflicts);const v=_===e,b=y.connections&&e&&y.connections.has(e);(v||b)&&n.add(_)}const h=p=>{const _=s.get(p)||new Set;for(const y of n)if((s.get(y)||new Set).has(p)||_.has(y))return!0;return!1};if(t)for(const p of t)l.has(p)&&(h(p)||n.add(p));for(const p of c)n.has(p)||h(p)||n.add(p);return n}},L.aX=hr,L.aY=ks,L.aZ=class extends Qo{constructor(i){super(i),this.current=new Float32Array(9)}set(i,e,t){if(!this.fetchUniformLocation(i,e))return;const n=this.current;for(let s=0;s<9;s++)if(t[s]!==n[s]){n.set(t),this.gl.uniformMatrix3fv(this.location,!1,n);break}}},L.a_=ue,L.aa=_t,L.ab=pw,L.ac=fi,L.ad=bt,L.ae=_o,L.af=qi,L.ag=je,L.ah=class{constructor(i){this.specification=i}possiblyEvaluate(i,e){return Kc(i.expression.evaluate(e))}interpolate(i,e,t){return{x:lt(i.x,e.x,t),y:lt(i.y,e.y,t),z:lt(i.z,e.z,t),azimuthal:lt(i.azimuthal,e.azimuthal,t),polar:lt(i.polar,e.polar,t)}}},L.ai=Oi,L.aj=vl,L.ak=Oa,L.al=lt,L.am=ls,L.an=65,L.ao=45,L.ap=function(i,e,t){const n=E.fromLngLat(e),s=t.elevation?t.elevation.getAtPointOrZero(n):0;return g1(i,n.x,n.y,s,t)},L.aq=function(i,e,t,n,s,l,c){const h=[[t,n,0],[s,n,0],[s,l,0],[t,l,0]];let p=Number.MAX_VALUE,_=-Number.MAX_VALUE;for(const y of h){const v=Xi(hi([],y,e));p=Math.min(p,v),_=Math.max(_,v)}return[Km(i,p,c.pitch),Km(i,_,c.pitch)]},L.ar=En,L.as=g1,L.at=zf,L.au=Bt,L.av=function(){return Wu++},L.aw=class{constructor(i,e,t){this.target=i,this.parent=e,this.mapId=t,this.pendingResponses=new Map,cs(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new sS}send(i,e,t){const{signal:n,targetMapId:s,metadata:l}=t||{},c=Math.round(1e18*Math.random()).toString(36).substring(0,10),h=new Set;return n&&n.aborted?Promise.reject(n.reason):(this.target.postMessage({id:c,type:i,targetMapId:s,sourceMapId:this.mapId,data:Wn(e,h)},[...h]),new Promise((p,_)=>{const y={resolve:p,reject:_,metadata:l||rb};if(n){const v=()=>{this.pendingResponses.delete(c),_(n.reason)};n.addEventListener("abort",v,{once:!0}),y.detach=()=>n.removeEventListener("abort",v)}this.pendingResponses.set(c,y)}))}notify(i,e,t){const{targetMapId:n}=t||{},s=new Set;this.target.postMessage({type:i,targetMapId:n,sourceMapId:this.mapId,data:Wn(e,s)},[...s])}sendCancelable(i,e,t,n){const s=new AbortController;return this.send(i,e,{...t,signal:s.signal}).then(l=>n(null,l)).catch(l=>{l.name!=="AbortError"&&n(l)}),s}getWorkerSourceActor(i){return{scheduler:this.scheduler,send:(e,t,n)=>this.send(e,t,{...n,targetMapId:i}),notify:(e,t)=>{this.notify(e,t,{targetMapId:i})},sendCancelable:(e,t,n,s)=>this.sendCancelable(e,t,{...n,targetMapId:i},s)}}receive(i){const e=i.data;if(!e)return;const t=e.id;if(!e.targetMapId||this.mapId===e.targetMapId)if(us(self)){const n=this.pendingResponses.get(t);this.scheduler.add(()=>{this.processTask(t,e)},n&&n.metadata||rb)}else this.processTask(t,e)}async processTask(i,e){if(e.type==="<response>"){const s=this.pendingResponses.get(i);if(this.pendingResponses.delete(i),s){s.detach&&s.detach();try{e.error?s.reject(qo(e.error)):s.resolve(qo(e.data))}catch(l){s.reject(l)}}return}const t=new Set,n=qo(e.data);try{let s;if(this.parent[e.type])s=await this.parent[e.type](e.sourceMapId,n);else{if(!this.parent.getWorkerSource)throw new Error(`Could not find function ${e.type}`);{const l=e.type.split("."),{source:c,scope:h}=n;s=await this.parent.getWorkerSource(e.sourceMapId,{type:l[0],source:c,scope:h})[l[1]](n)}}if(!i)return;this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:null,data:Wn(s,t)},[...t])}catch(s){this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:Wn(s),data:null},[])}}remove(){for(const i of this.pendingResponses.values())i.detach&&i.detach(),i.reject(new DOMException("Actor removed","AbortError"));this.pendingResponses.clear(),this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},L.ax=class{constructor(i){this.specification=i}possiblyEvaluate(i,e){return function([t,n]){const s=Kc([1,t,n]);return{x:s.x,y:s.y,z:s.z}}(i.expression.evaluate(e))}interpolate(i,e,t){return{x:lt(i.x,e.x,t),y:lt(i.y,e.y,t),z:lt(i.z,e.z,t)}}},L.ay=ku,L.az=Pl,L.b=An,L.b$=function(i,{x:e,y:t},n=0){return new Le(((e-n)*i.scale-i.x)*We,(t*i.scale-i.y)*We)},L.b0=yt,L.b1=6,L.b2=Xp,L.b3=function(i){const e=80.051129;i=yt(i,-80.051129,e)/e*90;const t=Math.pow(Math.abs(Math.sin(Bt(i))),3);return Math.round(t*(Qd.length-1))},L.b4=Jp,L.b5=Na,L.b6=function(i){const e=i.pixelsPerMeter,t=e/o(1,i.center.lat),n=er(new Float64Array(16));return Wi(n,n,[i.point.x,i.point.y,0]),mr(n,n,[t,t,e]),Float32Array.from(n)},L.b7=function(i,e,t,n){const s=e.getNorth(),l=e.getSouth(),c=e.getWest(),h=e.getEast(),p=1<<i.z,_=h-c,y=s-l,v=_/Xo,b=-y/Qd[t],T=[0,v,0,b,0,0,s,c,0];if(i.z>0){const S=180/n;si(T,T,[S/_+1,0,0,0,S/y+1,0,-.5*S/v,.5*S/b,1])}return T[2]=p,T[5]=i.x,T[8]=i.y,T},L.b8=ec,L.b9=256,L.bA=j_,L.bB=q,L.bC=fe,L.bD=Mi,L.bE=rg,L.bF=vc,L.bG=af,L.bH=hi,L.bI=Dl,L.bJ=be,L.bK=Tw,L.bL=No,L.bM=Wi,L.bN=function(){Fa.isLoading()||Fa.isLoaded()||Hd()!=="deferred"||Ep()},L.bO=Zt,L.bP=qr,L.bQ=function(i,e){const t=[];for(const n in i)n in e||t.push(n);return t}
vendor: 10,172 bytes, line 3097
3097,L.bR=ib,L.bS=E,L.bT=Cs,L.bU="hd_road_coverage",L.bV=function(i){const e=i.indexOf(bu);return e>=0?i.slice(0,e):i},L.bW=Mp,L.bX=Rc,L.bY=Qp,L.bZ=function(i,e,t=0,n=!0){const s=new Le(t,t),l=i.sub(s),c=e.add(s),h=[l,new Le(c.x,l.y),c,new Le(l.x,c.y)];return n&&h.push(l.clone()),h},L.b_=function(i,e){const t=[];for(let n=0;n<i.length;n++){const s=vn(n-1,-1,i.length-1),l=vn(n+1,-1,i.length-1),c=i[n],h=i[l],p=i[s].sub(c).unit(),_=h.sub(c).unit(),y=_.angleWithSep(p.x,p.y),v=p.add(_).unit().mult(-1*e/Math.sin(y/2));t.push(c.add(v))}return t},L.ba=O1,L.bb=ci,L.bc=Ui,L.bd=Cn,L.be=Xs,L.bf=Ao,L.bg=qa,L.bh=Tr,L.bi=fc,L.bj=Il,L.bk=Ji,L.bl=Ei,L.bm=u,L.bn=Yh,L.bo=Jc,L.bp=dg,L.bq=qn,L.br=wr,L.bs=Re,L.bt=li,L.bu=pm,L.bv=yu,L.bw=X,L.bx=Bu,L.by=Gn,L.bz=Q_,L.c=xl,L.c$=_1,L.c0=X_,L.c1=function(i,e,t=0){return Tr(((e.x-t)*i.scale-i.x)*We,(e.y*i.scale-i.y)*We,u(e.z,e.y))},L.c2=Li,L.c3=ti,L.c4=qp,L.c5=Rf,L.c6=function(i){let e=1/0,t=1/0,n=-1/0,s=-1/0;for(const l of i)e=Math.min(e,l.x),t=Math.min(t,l.y),n=Math.max(n,l.x),s=Math.max(s,l.y);return{min:new Le(e,t),max:new Le(n,s)}},L.c7=ar,L.c8=Fn,L.c9=Ac,L.cA=c_,L.cB=om,L.cC=vi,L.cD=["type","source","source-layer","minzoom","maxzoom","filter","layout"],L.cE=function(i,e,t,n,s,l,c){const h=py(i,e,t,n,s,l,c);return l.name==="globe"&&t||(h[2]=h[6]=h[10]=h[14]=0),h},L.cF=function(i,e,t,n,s,l,c){if(t){if(l.name==="globe"){const h=py(i,e,t,n,s,l,c);return xn(h,h),zt(h,i,h),h}{const h=Us(i),[p,_,y,v]=c,[b,T,S,A,C,D,F,O]=h;return h[0]=p*b+_*C,h[1]=p*T+_*D,h[2]=p*S+_*F,h[3]=p*A+_*O,h[4]=y*b+v*C,h[5]=y*T+v*D,h[6]=y*S+v*F,h[7]=y*A+v*O,n||js(h,h,-s.angle),h}}return s.glCoordMatrix},L.cG=Mu,L.cH=Ix,L.cI=Dm,L.cJ=Rx,L.cK=mg,L.cL=Rl,L.cM=ix,L.cN=function(i,[e,t]){let n=0,s=0;if(t===vw){e<0&&(e=0);const l=e/bw;switch(i){case"top-right":case"top-left":s=l-7;break;case"bottom-right":case"bottom-left":s=7-l;break;case"bottom":s=7-e;break;case"top":s=e-7}switch(i){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),t=Math.abs(t),i){case"top-right":case"top-left":case"top":s=t-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-t}switch(i){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,s]},L.cO=function(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"},L.cP=mu,L.cQ=Ks,L.cR=Ka,L.cS=os,L.cT=ss,L.cU=vn,L.cV=Hc,L.cW=class{isDataAvailableAtPoint(i){const e=this._source();if(this.isUsingMockSource()||!e||i.y<0||i.y>1)return!1;const t=e.getSource().maxzoom,n=1<<t,s=Math.floor(i.x),l=Math.floor((i.x-s)*n),c=Math.floor(i.y*n),h=this.findDEMTileFor(new qr(t,s,t,l,c));return!(!h||!h.dem)}getAtPointOrZero(i,e=0){return this.getAtPoint(i,e)||0}getAtPoint(i,e,t=!0){if(this.isUsingMockSource())return null;e??(e=null);const n=this._source();if(!n||i.y<0||i.y>1)return e;const s=n.getSource().maxzoom,l=1<<s,c=Math.floor(i.x),h=i.x-c,p=new qr(s,c,s,Math.floor(h*l),Math.floor(i.y*l)),_=this.findDEMTileFor(p);if(!_||!_.dem)return e;const y=_.dem,v=1<<_.tileID.canonical.z,b=(h*v-_.tileID.canonical.x)*y.dim,T=(i.y*v-_.tileID.canonical.y)*y.dim,S=Math.floor(b),A=Math.floor(T);return(t?this.exaggeration():1)*lt(lt(y.get(S,A),y.get(S,A+1),T-A),lt(y.get(S+1,A),y.get(S+1,A+1),T-A),b-S)}static getAtTileOffset(i,e,t,n){const s=1<<i.canonical.z;return n?n.pointElevation(e):t?t.getAtPointOrZero(new E(i.wrap+(i.canonical.x+e.x/We)/s,(i.canonical.y+e.y/We)/s)):0}static getAtTileOffsetFunc(i,e,t,n){return(s,l,c)=>{const h=this.getAtTileOffset(i,s,l,c),p=n.upVector(i.canonical,s.x,s.y);return oi(p,p,h*n.upVectorScale(i.canonical,e,t).metersToTile),p}}getForTilePoints(i,e,t,n){if(this.isUsingMockSource())return!1;const s=Wh.create(this,i,n);return!!s&&(e.forEach(l=>{l[2]=this.exaggeration()*s.getElevationAt(l[0],l[1],t,!0)}),!0)}getMinMaxForTile(i){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(i);if(!e||!e.dem)return null;const t=e.dem.tree,n=e.tileID,s=1<<i.canonical.z-n.canonical.z;let l=i.canonical.x/s-n.canonical.x,c=i.canonical.y/s-n.canonical.y,h=0;for(let p=0;p<i.canonical.z-n.canonical.z&&!t.leaves[h];p++){l*=2,c*=2;const _=2*Math.floor(c)+Math.floor(l);h=t.childOffsets[h]+_,l%=1,c%=1}return{min:this.exaggeration()*t.minimums[h],max:this.exaggeration()*t.maximums[h]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(i,e,t){throw new Error("Pure virtual method called.")}pointCoordinate(i){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(i){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const i=this.visibleDemTiles;if(i.length===0)return null;let e=!1,t=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const s of i){const l=this.getMinMaxForTile(s.tileID);l&&(t=Math.min(t,l.min),n=Math.max(n,l.max),e=!0)}return e?{min:t,max:n}:null}},L.cX=Oc,L.cY=u1,L.cZ=K_,L.c_=function(i,e,t,n,s,l){const c=[e,t,n];return hi(c,c,l.calculateFogTileMatrix(s)),Km(i,Xi(c),l.pitch)},L.ca=P,L.cb=rl,L.cc=class{constructor(i){this.entries={},this.scheduler=i}request(i,e,t,n){const s=this.entries[i]=this.entries[i]||{callbacks:[]};if(s.result){const[l,c]=s.result;return this.scheduler?this.scheduler.add(()=>{n(l,c)},e):n(l,c),()=>{}}return s.callbacks.push(n),s.cancel||(s.cancel=t((l,c)=>{s.result=[l,c];for(const h of s.callbacks)this.scheduler?this.scheduler.add(()=>{h(l,c)},e):h(l,c);setTimeout(()=>delete this.entries[i],3e3)})),()=>{s.result||(s.callbacks=s.callbacks.filter(l=>l!==n),s.callbacks.length||(s.cancel(),delete this.entries[i]))}}},L.cd=function(i){if("provider"in i&&!i.provider)return null;let e=i.provider;if(!e&&"url"in i&&i.url&&(e=function(s){try{const l=new URL(s).pathname.split("/").pop()||"",c=l.lastIndexOf(".");return c>=0?l.slice(c+1):""}catch{return""}}(i.url)),!e)return null;const t=ie.TILE_PROVIDER_URLS[e];if(!t)return null;let n;try{n=new URL(t,ie.API_URL).href}catch{return new Error(`TileProvider "${e}" has an invalid URL: "${t}"`)}return{name:e,url:n}},L.ce=K1,L.cf=a_,L.cg=jt,L.ch=function(i,e,t){const 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},s=>{const l=new AbortController;return vi(i.request,l.signal).then(({data:c,headers:h})=>{s(null,{rawData:c,vectorTile:t?void 0:new G_(new om(c)),headers:h})}).catch(c=>{l.signal.aborted||(Zt(c)?s(null,null):s(c))}),()=>{l.abort(),s(null,null)}},e)},L.ci=jo,L.cj=function(i){At++,At>ut&&(i.getActor().notify("enforceCacheSizeLimit",Ue),At=0)},L.ck=Rn,L.cl=async function(i,e,t){const n=i.url&&!i.tiles?await e.transformRequest(i.url,pi.Source,t):void 0;return{request:n,options:n?{...i,url:n.url}:i}},L.cm=function(i,e,t){return e?Y1(i,e,t):i.tiles&&i.tiles.length>0?{tiles:i.tiles}:new Error('TileJSON is missing required "tiles" property')},L.cn=async function(i,e){const t=nb.get(i);if(t)return t;const n=Iy.get(i);if(n!==void 0)return n;const s=self.__mapboxImport(e).catch(l=>{throw new Error(`TileProvider "${i}" failed to load: ${l instanceof Error?l.message:String(l)}`)}).then(l=>{const c=l.default;if(typeof c!="function")throw new Error(`TileProvider "${i}" module must default-export a class`);if(typeof c.prototype.loadTile!="function")throw new Error(`TileProvider "${i}" class must have a loadTile method`);return nb.set(i,c),c}).finally(()=>{Iy.delete(i)});return Iy.set(i,s),s},L.co=class{constructor(i,e){this.context=i,this.texture=e}bind(i,e){const{context:t}=this,{gl:n}=t;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),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}},L.cp=f,L.cq=function(i,e,t,n){for(;e<t;){const s=e+t>>1;i[s]<=n?e=s+1:t=s}return e},L.cr=function(i,e,t,n){for(;e<t;){const s=e+t>>1;i[s]<n?e=s+1:t=s}return e},L.cs=Xo,L.ct=Io,L.cu=function(i,e){var t=e[0],n=e[1],s=e[2],l=e[3],c=e[4],h=e[5],p=e[6],_=e[7],y=e[8];return i[0]=c*y-h*_,i[1]=s*_-n*y,i[2]=n*h-s*c,i[3]=h*p-l*y,i[4]=t*y-s*p,i[5]=s*l-t*h,i[6]=l*_-c*p,i[7]=n*p-t*_,i[8]=t*c-n*l,i},L.cv=si,L.cw=async function(i){const e=document.createElement("video");e.muted=!0;for(const t of i){const n=document.createElement("source");_r(t)||(e.crossOrigin="Anonymous"),n.src=t,e.appendChild(n)}return await new Promise((t,n)=>{e.onloadstart=()=>t(),e.onerror=()=>n(new Error(`Could not load video: ${i.join(", ")}`))}),e},L.cx=V0,L.cy=W0,L.cz=Wt,L.d=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.currentFrameAtlases=new Set,this.finalizationRegistry=new FinalizationRegistry(e=>{this.cache.delete(e),this.clearExpiredTextures()})}beginFrame(){this.currentFrameAtlases.clear()}calculateTextureMemory(i){return i.image?Math.ceil(i.image.width*i.image.height*4*(i.patternPositions.size>0?1.33:1)):0}evictTexture(i){const e=this.textures.get(i);if(e){const t=this.calculateTextureMemory(i);e.destroy(),this.textures.delete(i),this.textureAccessTimes.delete(i),this.textureMemoryUsed-=t,i.uploaded=!1}}evictTexturesIfNeeded(i){for(;this.textureMemoryUsed+i>this.maxTextureMemory&&this.textures.size>0;){let e=null,t=1/0;for(const[n]of this.textures.entries()){if(this.currentFrameAtlases.has(n))continue;const s=this.textureAccessTimes.get(n)||0;s<t&&(t=s,e=n)}if(!e)break;this.evictTexture(e)}}findCachedAtlas(i){const e=this.cache.get(i.hash);if(e){const t=e.deref();if(t&&t.contentDescriptor&&this.isMipmapCompatible(i,t.contentDescriptor))return t}for(const[,t]of this.cache.entries()){const n=t.deref();
vendor: 4,080 bytes, line 3097
3097if(n&&n.contentDescriptor){const s=i.subsetOf(n.contentDescriptor),l=this.isMipmapCompatible(i,n.contentDescriptor);if(s&&l)return n}}}getTextureForAtlas(i,e,t){this.textureAccessTimes.set(i,performance.now()),this.currentFrameAtlases.add(i);let n=this.textures.get(i);if(n)return n;if(i.image){const s=this.calculateTextureMemory(i);return this.evictTexturesIfNeeded(s),n=new lm(e,i.image,t,{useMipmap:!!i.patternPositions.size}),this.textures.set(i,n),this.textureMemoryUsed+=s,n}return null}clearExpiredTextures(){for(const[i]of this.textures.entries())if(!this.isAtlasCached(i)){const e=this.textures.get(i);if(e){const t=this.calculateTextureMemory(i);e.destroy(),this.textureMemoryUsed-=t}this.textures.delete(i),this.textureAccessTimes.delete(i)}}isAtlasCached(i){if(!i.contentDescriptor)return!1;const e=this.cache.get(i.contentDescriptor.hash);return!!e&&e.deref()===i}getOrCache(i){if(!("image"in i)){const s=this.cache.get(i.sourceAtlasHash);if(s){const l=s.deref();if(l)return l}return gi("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!i.contentDescriptor)return i;const e=i.contentDescriptor,t=e.hash,n=this.cache.get(t);if(n){const s=n.deref();if(s&&s.contentDescriptor&&this.isMipmapCompatible(e,s.contentDescriptor))return s}return this.cache.set(t,new WeakRef(i)),this.finalizationRegistry.register(i,t,i),i}isMipmapCompatible(i,e){return!i.requiresMipMaps||e.requiresMipMaps}destroyTextures(){for(const i of this.textures.values())i&&i.destroy();this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}clear(){for(const i of this.textures.values())i&&i.destroy();this.cache.clear(),this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}},L.d$=function(i,e,t,n,s,l,c,h,p,_,y=1){const v=t.transform,b=n?i.textSizeData:i.iconSizeData,T=Mu(b,t.transform.zoom,y),S=v.projection.name==="globe",A=(()=>{if(!S)return null;const G=Ll(v.zoom);return G===0?null:{t:G,invMatrix:v.projection.createInversionMatrix(v,_.canonical),mercCenter:[po(v.center.lng),$n(v.center.lat)]}})(),C=[256/t.width*2+1,256/t.height*2+1],D=n?i.text.dynamicLayoutVertexArray:i.icon.dynamicLayoutVertexArray;D.clear();let F=null;S&&(F=n?i.text.globeExtVertexArray:i.icon.globeExtVertexArray);const O=i.lineVertexArray,z=n?i.text.placedSymbolArray:i.icon.placedSymbolArray,N=t.transform.width/t.transform.height;let j,te=!1;for(let G=0;G<z.length;G++){const W=z.get(G),{numGlyphs:K,writingMode:ee}=W;if(ee!==Rl.vertical||te||j===Rl.horizontal||(te=!0),j=ee,(W.hidden||ee===Rl.vertical)&&!te){Lf(K,D);continue}te=!1;const le=new Le(W.tileAnchorX,W.tileAnchorY),de=i.elevationType==="road",ve=!!v.elevation||de;let{x:xe,y:we,z:Fe}=v.projection.projectTilePoint(le.x,le.y,_.canonical);if(A){const[ft,pt,xt]=f1(le,_.canonical,A);xe+=(ft-xe)*A.t,we+=(pt-we)*A.t,Fe+=(xt-Fe)*A.t}let se=null;if(ve){se=de&&i.hdExt?i.hdExt.makeRoadSymbolElevationParams(i,n?i.text:i.icon,G,_,p,v.elevation,v.projection,v.center.lat,v.worldSize):{getElevation:p,elevation:v.elevation,elevationFeature:null};const[ft,pt,xt]=se.getElevation(le,v.elevation,se.elevationFeature);xe+=ft,we+=pt,Fe+=xt}const pe=[xe,we,Fe,1];if(ar(pe,pe,e),!DE(pe,C)){Lf(K,D);continue}const ge=pe[3],Se=c1(t.transform.getCameraToCenterDistance(v.projection),ge),Me=Zp(b,T,W),Pe=c?Me/Se:Me*Se,Ie=Oc(xe,we,Fe,s);if(Ie[3]<=0){Lf(K,D);continue}let Oe={};const Be=Bt(i.layers[0].layout.get("text-max-angle")),Ke=Math.cos(Be),Ne=c?null:se,He=d1(W,Pe,!1,h,e,s,l,i.glyphOffsetArray,O,D,F,Ie,le,Oe,N,Ne,v.projection,_,c,Ke,A);te=He.useVertical,Ne&&He.needsFlipping&&(Oe={}),(He.notEnoughRoom||te||He.needsFlipping&&d1(W,Pe,!0,h,e,s,l,i.glyphOffsetArray,O,D,F,Ie,le,Oe,N,Ne,v.projection,_,c,Ke,A).notEnoughRoom)&&Lf(K,D)}n?(i.text.dynamicLayoutVertexBuffer.updateData(D),F&&i.text.globeExtVertexBuffer&&i.text.globeExtVertexBuffer.updateData(F)):(i.icon.dynamicLayoutVertexBuffer.updateData(D),F&&i.icon.globeExtVertexBuffer&&i.icon.globeExtVertexBuffer.updateData(F))},L.d0=er,L.d1=Bh,L.d2=.9,L.d3=to,L.d4=Zp,L.d5=Ry,L.d6=function(i){return i({pluginStatus:Ln,pluginURL:za}
vendor: 1,473 bytes, line 3097
3097),Gd.on("pluginStateChange",i),i},L.d7=Mt,L.d8=cm,L.d9=wg,L.dA=function(i,e){return[Math.pow(i[0],2.2)*e,Math.pow(i[1],2.2)*e,Math.pow(i[2],2.2)*e]},L.dB=oi,L.dC=Yi,L.dD=Xu,L.dE=Di,L.dF=$E,L.dG=qE,L.dH=i=>({u_cutoff_params:new ks(i)}),L.dI=i=>({u_light_matrix_0:new Kr(i),u_light_matrix_1:new Kr(i),u_fade_range:new Mr(i),u_shadow_normal_offset:new dr(i),u_shadow_intensity:new St(i),u_shadow_texel_size:new St(i),u_shadow_map_resolution:new St(i),u_shadow_direction:new dr(i),u_shadow_bias:new dr(i),u_shadowmap_0:new hr(i),u_shadowmap_1:new hr(i)}),L.dJ=j1,L.dK=mx,L.dL=ry,L.dM=Yu,L.dN=Ql,L.dO=function(i,e){const t=[0,0,0];return hi(t,t,Jp(Na(e.canonical))),hi(t,t,i),t},L.dP=Yn,L.dQ=function(i,e,t,n,s,l){const{width:c,height:h}=n.imageManager.getPixelSize(e),p=Math.pow(2,l.tileID.overscaledZ),_=l.tileSize*Math.pow(2,n.transform.tileZoom)/p,y=_*(l.tileID.canonical.x+l.tileID.wrap*p),v=_*l.tileID.canonical.y;return{u_image:0,u_pattern_tl:t.tl,u_pattern_br:t.br,u_texsize:[c,h],u_pattern_size:t.displaySize,u_pattern_units_to_pixels:s?[n.transform.width,-1*n.transform.height]:[1/Rf(l,1,n.transform.tileZoom),1/Rf(l,1,n.transform.tileZoom)],u_pixel_coord_upper:[y>>16,v>>16],u_pixel_coord_lower:[65535&y,65535&v]}},L.dR=i=>({u_matrix:new Kr(i),u_texsize:new Mr(i),u_pixels_to_tile_units:new N_(i),u_device_pixel_ratio:new St(i),u_width_scale:new St(i),u_floor_width_scale:new St(i),u_image:new hr(i),u_units_to_pixels:new Mr(i),u_tile_units_to_pixels:new St(i),u_alph
3097a_discard_threshold:new St(i),u_trim_offset:new Mr(i),u_trim_fade_range:new Mr(i),u_trim_gradient_mix_range:new Mr(i),u_trim_color:new ks(i),u_zbias_factor:new St(i),u_tile_to_meter:new St(i),u_ground_shadow_factor:new dr(i),u_pattern_transition:new St(i),u_opacity_multiplier:new St(i)}),L.dS=i=>({u_matrix:new Kr(i),u_pixels_to_tile_units:new N_(i),u_device_pixel_ratio:new St(i),u_width_scale:new St(i),u_floor_width_scale:new St(i),u_units_to_pixels:new Mr(i),u_dash_image:new hr(i),u_gradient_image:new hr(i),u_border_gradient_image:new hr(i),u_image_height:new St(i),u_texsize:new Mr(i),u_tile_units_to_pixels:new St(i),u_alpha_discard_threshold:new St(i),u_trim_offset:new Mr(i),u_trim_fade_range:new Mr(i),u_trim_gradient_mix_range:new Mr(i),u_trim_color:new ks(i),u_zbias_factor:new St(i),u_road_view_depth_bias:new St(i),u_road_clip_to_view:new ks(i),u_tile_to_meter:new St(i),u_ground_shadow_factor:new dr(i),u_opacity_multiplier:new St(i)}),L.dT=i=>({u_color:new tf(i),u_matrix:new Kr(i),u_overlay:new hr(i),u_overlay_scale:new St(i)}),L.dU=i=>({u_camera_to_center_distance:new St(i),u_extrude_scale:new N_(i),u_device_pixel_ratio:new St(i),u_matrix:new Kr(i),u_inv_rot_matrix:new Kr(i),u_merc_center:new Mr(i),u_tile_id:new dr(i),u_zoom_transition:new St(i),u_up_dir:new dr(i),u_emissive_strength:new St(i)}),L.dV=i=>({u_matrix:new Kr(i),u_lightpos:new dr(i),u_lightintensity:new St(i),u_lightcolor:new dr(i),u_vertical_gradient:new St(i),u_height_factor:new St(i),u_edge_radius:new St(i),u_width_scale:new St(i),u_ao:new Mr(i),u_height_type:new hr(i),u_base_type:new hr(i),u_tile_id:new dr(i),u_zoom_transition:new St(i),u_inv_rot_matrix:new Kr(i),u_merc_center:new Mr(i),u_up_dir:new dr(i),u_height_lift:new St(i),u_image:new hr(i),u_texsize:new Mr(i),u_pixel_coord_upper:new Mr(i),u_pixel_coord_lower:new Mr(i),u_tile_units_to_pixels:new St(i),u_opacity:new St(i),u_pattern_transition:new St(i)}),L.dW=i=>({u_matrix:new Kr(i),u_lightpos:new dr(i),u_lightintensity:new St(i),u_lightcolor:new dr(i),u_vertical_gradient:new St(i),u_opacity:new St(i),u_edge_radius:new St(i),u_width_scale:new St(i),u_ao:new Mr(i),u_height_type:new hr(i),u_base_type:new hr(i),u_tile_id:new dr(i),u_zoom_transition:new St(i),u_inv_rot_matrix:new Kr(i),u_merc_center:new Mr(i),u_up_dir:new dr(i),u_height_lift:new St(i),u_flood_light_color:new dr(i),u_vertical_scale:new St(i),u_flood_light_intensity:new St(i),u_ground_shadow_factor:new dr(i),u_front_cutoff_params:new dr(i)}),L.dX=py,L.dY=Lf,L.dZ=c1,L.d_=Pu,L.da=jd,L.db=ze,L.dc=sl,L.dd=jn,L.de=nl,L.df=function(i){return i.includes(bu)},L.dg=function(i){const e=i.lastIndexOf(bu);return e>=0?i.slice(e+1):""},L.dh=function(i){const e=[],t=i.id;return t===void 0&&e.push({message:`layers.${t}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${t}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${t}: property "renderingMode" must be either "2d" or "3d"`}),e},L.di=function(i,e,t,n){return i.type==="custom"?new AE(i,e):new nS[i.type](i,e,t,n)},L.dj=Xc,L.dk=class extends Bu{constructor(i,e){super(i._vectorTileFeature,i._z,i._x,i._y,i.id),i.state&&(this.state={...i.state}),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.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(){const i=super.toJSON();return i.target=this.target,i.namespace=this.namespace,i}},L.dl=Gd,L.dm=q1,L.dn=function(){return{API_URL:ie.API_URL,DRACO_URL:ie.DRACO_URL,MESHOPT_URL:ie.MESHOPT_URL,MESHOPT_SIMD_URL:ie.MESHOPT_SIMD_URL,BUILDING_GEN_URL:ie.BUILDING_GEN_URL}},L.dp=tf,L.dq=ju,L.dr=ga,L.ds=function(i,e,t){const n=Ll(t.zoom),s=i.style.map._antialias,l=i.terrain&&i.terrain.exaggeration()>0;return n===0&&!s&&!l},L.dt=function(i,e,t){const n=er(new Float64Array(16)),s=(e/(1<<i)-.5)*Math.PI*2;return So(n,t.globeMatrix,s),Float32Array.from(n)},L.du=Wy,L.dv=o,L.dw=Wp,L.dx=Vo,L.dy=eo,L.dz=cn,L.e=Y,L.e$=bn,L.e0=Ox,L.e1=r
vendor: 6,808 bytes, line 3097
30970,L.e2=(i,e,t,n,s,l)=>{const c=i.transform,h=c.projection.name==="globe";let p;if(l.paint.get("circle-pitch-alignment")==="map")if(h){const y=mx(c.zoom,e.canonical)*c._pixelsPerMercatorPixel;p=Float32Array.from([y,0,0,y])}else p=c.calculatePixelsToTileUnitsMatrix(t);else p=new Float32Array([c.pixelsToGLUnits[0],0,0,c.pixelsToGLUnits[1]]);const _={u_camera_to_center_distance:i.transform.getCameraToCenterDistance(c.projection),u_matrix:i.translatePosMatrix(e.projMatrix,t,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Y.devicePixelRatio,u_extrude_scale:p,u_inv_rot_matrix:bE,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:l.paint.get("circle-emissive-strength")};if(h){_.u_inv_rot_matrix=n,_.u_merc_center=s,_.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],_.u_zoom_transition=Ll(c.zoom);const y=s[0]*We,v=s[1]*We;_.u_up_dir=c.projection.upVector(new Rc(0,0,0),y,v)}return _},L.e3=C0,L.e4=(i,e,t,n,s,l,c,h,p,_)=>{const y=i.transform,v=y.pitch<15?lt(.07,.7,yt((14-y.zoom)/5,0,1)):.07,b=t.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:A0(i,e,t,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:y.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:s,u_width_scale:l,u_floor_width_scale:c,u_image:0,u_tile_units_to_pixels:I0(e,y),u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:h,u_trim_fade_range:t.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:t.paint.get("line-trim-color").toPremultipliedRenderColor(b?null:t.lut).toArray01(),u_zbias_factor:v,u_tile_to_meter:w(e.tileID.canonical,0),u_ground_shadow_factor:p,u_pattern_transition:_,u_opacity_multiplier:1}},L.e5=(i,e,t,n,s,l,c,h,p,_)=>{const y=i.transform,v=y.calculatePixelsToTileUnitsMatrix(e),b=t.paint.get("line-trim-color-use-theme").constantOr("default")==="none",T=y.pitch<15?lt(.07,.7,yt((14-y.zoom)/5,0,1)):.07;return{u_matrix:A0(i,e,t,n),u_pixels_to_tile_units:v,u_device_pixel_ratio:l,u_width_scale:c,u_floor_width_scale:h,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_border_gradient_image:2,u_image_height:s,u_texsize:M0(t)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:I0(e,i.transform),u_alpha_discard_threshold:0,u_trim_offset:p,u_trim_fade_range:t.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:t.paint.get("line-trim-color").toPremultipliedRenderColor(b?null:t.lut).toArray01(),u_zbias_factor:T,u_road_view_depth_bias:0,u_road_clip_to_view:[0,0,0,0],u_tile_to_meter:w(e.tileID.canonical,0),u_ground_shadow_factor:_,u_opacity_multiplier:1}},L.e6=Yl,L.e7=Cf,L.e8=5,L.e9=IE,L.eA=Gu,L.eB=a,L.eC=Sl,L.eD=xr,L.eE=zi,L.eF=is,L.eG=Ni,L.eH=function([i,e,t]){const n=Math.hypot(i,e,t),s=Math.atan2(i,t),l=.5*Math.PI-Math.acos(-e/n);return new Wt(Ur(s),Ur(l))},L.eI=Xa,L.eJ=Hl,L.eK=Bg,L.eL=ie,L.eM=tr,L.eN=Ii,L.eO=my,L.eP=class{constructor(i,e,t){this._transformRequestFn=i,this._customAccessToken=e,this._silenceAuthErrors=!!t,this._createSkuToken()}_createSkuToken(){const i=function(){let e="";for(let t=0;t<10;t++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Fi,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}async transformRequest(i,e,t){if(!this._transformRequestFn)return{url:i};const n=t?{signal:t}:{};return await this._transformRequestFn(i,e,n)||{url:i}}normalizeStyleURL(i,e){if(!jt(i))return i;const t=Vt(i);return t.params.push(`sdk=js-${To}`),t.path=`/styles/v1${t.path}`,this._makeAPIURL(t,this._customAccessToken||e)}normalizeGlyphsURL(i,e){if(!jt(i))return i;const t=Vt(i);return t.path=`/fonts/v1${t.path}`,this._makeAPIURL(t,this._customAccessToken||e)}normalizeModelURL(i,e){if(!jt(i))return i;const t=Vt(i);return t.path=`/models/v1${t.path}`,this._makeAPIURL(t,this._customAccessToken||e)}normalizeSourceURL(i,e,t,n){if(!jt(i))return i;const s=Vt(i);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),t&&s.params.push(`language=${t}`),n&&s.params.push(`worldview=${n}`),this._makeAPIURL(s,this._customAccessToken||e)}normalizeIconsetURL(i,e){const t=Vt(i);return jt(i)?(t.path=`/styles/v1${t.path}/iconset.pbf`,this._makeAPIURL(t,this._customAccessToken||e)):Zi(t)}normalizeSpriteURL(i,e,t,n){const s=Vt(i);return jt(i)?(s.path=`/styles/v1${s.path}/sprite${e}${t}`,this._makeAPIURL(s,this._customAccessToken||n)):(s.path+=`${e}${t}`,Zi(s))}normalizeTileURL(i,e,t){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!jt(i))return i;const n=Vt(i);n.path=n.path.replace(Gr,(e||t&&n.authority!=="raster"&&t===512?"@2x":"")+".webp"),n.authority==="raster"?n.path=`/${ie.RASTER_URL_PREFIX}${n.path}`:n.authority==="rasterarrays"?n.path=`/${ie.RASTERARRAYS_URL_PREFIX}${n.path}`:n.authority==="3dtiles"?n.path=`/${ie.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(gr,"/"),n.path=`/${ie.TILE_URL_VERSION}${n.path}`);const s=this._customAccessToken||function(l){for(const c of l){const h=c.match(yi);if(h)return h[1]}return null}(n.params)||ie.ACCESS_TOKEN;return ie.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,s)}canonicalizeTileURL(i,e){const t=Vt(i);if(!Ai.test(t.path)||!oo.test(t.path))return i;let n="mapbox://";t.path.startsWith("/raster/v1/")?n+=`raster/${t.path.replace(`/${ie.RASTER_URL_PREFIX}/`,"")}`:t.path.startsWith("/rasterarrays/v1/")?n+=`rasterarrays/${t.path.replace(`/${ie.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${t.path.replace(`/${ie.TILE_URL_VERSION}/`,"")}`;let s=t.params;return e&&(s=s.filter(l=>!l.match(yi))),s.length&&(n+=`?${s.join("&")}`),n}canonicalizeTileset(i,e){const t=!!e&&jt(e),n=[];for(const s of i.tiles||[])Nt(s)?n.push(this.canonicalizeTileURL(s,t)):n.push(s);return n}_makeAPIURL(i,e){const t="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=Vt(ie.API_URL);if(i.protocol=n.protocol,i.authority=n.authority,i.protocol==="http"){const s=i.params.indexOf("secure");s>=0&&i.params.splice(s,1)}if(n.path!=="/"&&(i.path=`${n.path}${i.path}`),!ie.REQUIRE_ACCESS_TOKEN)return Zi(i);if(e=e||ie.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${t}`);if(e[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${t}`)}return i.params=i.params.filter(s=>!s.includes("access_token")),i.params.push(`access_token=${e||""}`),Zi(i)}},L.eQ=Mn,L.eR=function(i,e){e?hn.add(i):hn.delete(i)}
vendor: 7,551 bytes, line 3097
3097,L.eS=Sr,L.eT=Ms,L.eU=Yr,L.eV=rn,L.eW=lo,L.eX=Hn,L.eY=wn,L.eZ=function(i){hn.delete(i)},L.e_=co,L.ea=$e,L.eb=function(i,e){var t=Math.sin(e),n=Math.cos(e);return i[0]=n,i[1]=0,i[2]=-t,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=t,i[9]=0,i[10]=n,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},L.ec=function(i,e){var t=Math.sin(e),n=Math.cos(e);return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=n,i[6]=t,i[7]=0,i[8]=0,i[9]=-t,i[10]=n,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},L.ed=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[4],i[4]=e[5],i[5]=e[6],i[6]=e[8],i[7]=e[9],i[8]=e[10],i},L.ee=Vl,L.ef=Ot,L.eg=1,L.eh=Xh,L.ei=0,L.ej=Tt,L.ek=function(i,e,t,n,s){return yt((i-e)/(t-e)*(s-n)+n,n,s)},L.el=Xi,L.em=fa,L.en=function(i,e){var t=e[0],n=e[1],s=e[2],l=e[3],c=e[4],h=e[5],p=e[6],_=e[7],y=e[8],v=y*c-h*_,b=-y*l+h*p,T=_*l-c*p,S=t*v+n*b+s*T;return S?(i[0]=v*(S=1/S),i[1]=(-y*n+s*_)*S,i[2]=(h*n-s*c)*S,i[3]=b*S,i[4]=(y*t-s*p)*S,i[5]=(-h*t+s*l)*S,i[6]=T*S,i[7]=(-_*t+n*p)*S,i[8]=(c*t-n*l)*S,i):null},L.eo=dt,L.ep=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Le(1/0,1/0),max:new Le(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(i,e=!1){const t=Cx(new Le(0,0),new Le(We,We),i),n=[];if(e&&!fg(t,this._globalClipBounds))return n;for(const s of this._activeRegions){if(s.hiddenByOverlap||!fg(t,s))continue;const l=Nw(s.min,s.max,i);n.push({min:l.min,max:l.max,sourceId:this._sourceIds[s.priority],footprint:s.footprint,footprintTileId:s.tileId,order:s.order,clipMask:s.clipMask,clipScope:s.clipScope})}return n}setSources(i){this._setSources(i.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const n of e.cache.getVisibleCoordinates()){const s=e.cache.getTile(n).buckets[e.layer];s&&s.updateFootprints(n.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(i){const e=i.getFootprints();if(e.length===0)return;const t=i.getOrder(),n=i.getClipMask(),s=i.getClipScope();for(const l of e){if(!l.footprint)continue;const c=Cx(l.footprint.min,l.footprint.max,l.id);this._activeRegions.push({min:c.min,max:c.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:l.id,footprint:l.footprint,order:t,clipMask:n,clipScope:s})}this._sourceIds.push(i.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,t)=>e.priority-t.priority||rm(e.min,t.min)||rm(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(n,s){const l=(c,h)=>c+h;return n.length-s.length||n.reduce(l,"").localeCompare(s.reduce(l,""))}(e.clipScope,t.clipScope));let i=this._activeRegions.length!==this._prevRegions.length;if(!i){let e=0;for(;!i&&e!==this._activeRegions.length;){const t=this._activeRegions[e],n=this._prevRegions[e];i=t.priority!==n.priority||!Ax(t,n)||t.order!==n.order||t.clipMask!==n.clipMask||!as(t.clipScope,n.clipScope),this._activeRegions[e].hiddenByOverlap=n.hiddenByOverlap,++e}}if(i){++this._updateTime;for(const t of this._activeRegions)t.order!==df&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,t.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,t.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,t.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,t.max.y));const e=t=>{const n=this._activeRegions;if(t>=n.length)return t;const s=n[t].priority;for(;t<n.length&&n[t].priority===s;)++t;return t};if(this._sourceIds.length>1){let t=0,n=e(t);for(;t!==n;){let s=t;const l=t;for(;s!==n;){const c=this._activeRegions[s];c.hiddenByOverlap=!1;for(let h=0;h<l;h++){const p=this._activeRegions[h];if(!p.hiddenByOverlap&&c.order===df&&fg(c,p)&&(c.hiddenByOverlap=Mx(c.footprint,c.tileId,p.footprint,p.tileId),c.hiddenByOverlap))break}++s}t=n,n=e(t)}}}}_setSources(i){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=i.length-1;e>=0;e--)this._addSource(i[e]);this._computeReplacement()}},L.eq=df,L.er=class{constructor(i){this._createGrid(i),this._createPoles(i)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const i of this._poleSegments)i.destroy();for(const i of this._gridSegments)i.withSkirts.destroy(),i.withoutSkirts.destroy()}_fillGridMeshWithLods(i,e){const t=new fe,n=new bt,s=[],l=i+1+2,c=e[0]+1,h=e[0]+1+(1+e.length),p=(_,y,v)=>{let b=_===l-1?_-2:_===0?_:_-1;return b+=v?24575:0,[b,y]};for(let _=0;_<l;++_)t.emplaceBack(...p(_,0,!0));for(let _=0;_<c;++_)for(let y=0;y<l;++y)t.emplaceBack(...p(y,_,(y===0||y===l-1)&&!0));for(let _=0;_<e.length;++_){const y=e[_];for(let v=0;v<l;++v)t.emplaceBack(...p(v,y,!0))}for(let _=0;_<e.length;++_){const y=n.length,v=e[_]+1+2,b=new bt;for(let A=0;A<v-1;A++){const C=A===v-2,D=C?l*(h-e.length+_-A):l;for(let F=0;F<l-1;F++){const O=A*l+F;A===0||C||F===0||F===l-2?(b.emplaceBack(O+1,O,O+D),b.emplaceBack(O+D,O+D+1,O+1)):(n.emplaceBack(O+1,O,O+D),n.emplaceBack(O+D,O+D+1,O+1))}}const T=fi.simpleSegment(0,y,t.length,n.length-y);for(let A=0;A<b.uint16.length;A+=3)n.emplaceBack(b.uint16[A],b.uint16[A+1],b.uint16[A+2]);const S=fi.simpleSegment(0,y,t.length,n.length-y);s.push({withoutSkirts:T,withSkirts:S})}return{vertices:t,indices:n,segments:s}}_createGrid(i){const e=this._fillGridMeshWithLods(Xo,Qd);this._gridSegments=e.segments,this._gridBuffer=i.createVertexBuffer(e.vertices,rg.members),this._gridIndexBuffer=i.createIndexBuffer(e.indices,!0)}_createPoles(i){const e=new bt;for(let c=0;c<=Xo;c++)e.emplaceBack(0,c+1,c+2);this._poleIndexBuffer=i.createIndexBuffer(e,!0);const t=new Ot,n=new Ot,s=new Ot,l=new Ot;this._poleSegments=[];for(let c=0,h=0;c<6;c++){const p=360/(1<<c);t.emplaceBack(0,-Fn,0,.5,0),n.emplaceBack(0,-Fn,0,.5,1),s.emplaceBack(0,-Fn,0,.5,.5),l.emplaceBack(0,-Fn,0,.5,.5);for(let _=0;_<=Xo;_++){let y=_/Xo,v=0;const b=lt(0,p,y),[T,S,A]=Tc(Cw,Mw,b,Fn);t.emplaceBack(T,S,A,y,v),n.emplaceBack(T,S,A,y,1-v);const C=Bt(b);y=.5+.5*Math.sin(C),v=.5+.5*Math.cos(C),s.emplaceBack(T,S,A,y,v),l.emplaceBack(T,S,A,y,1-v)}this._poleSegments.push(fi.simpleSegment(h,0,66,64)),h+=66}this._poleNorthVertexBuffer=i.createVertexBuffer(t,$p,!1),this._poleSouthVertexBuffer=i.createVertexBuffer(n,$p,!1),this._texturedPoleNorthVertexBuffer=i.createVertexBuffer(s,$p,!1),this._texturedPoleSouthVertexBuffer=i.createVertexBuffer(l,$p,!1)}getGridBuffers(i,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[i].withSkirts:this._gridSegments[i].withoutSkirts]}getPoleBuffers(i,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[i]]}},L.es=function(i){return hn.has(i)},L.et=WE,L.eu=kw,L.ev=$c,L.ew=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},L.ex=id,L.ey=x,L.ez=function(i,e,t){return i[0]=e[0]/t[0],i[1]=e[1]/t[1],i[2]=e[2]/t[2],i},L.f=Tn,L.f$=Gx,L.f0=function(i,e){Ue=i,ut=e},L.f1=To,L.f2=hg,L.f3=Ur,L.f4=gx,L.f5=function(i){const e=[0,0,0],t=er(new Float64Array(16));return zt(t,i.pixelMatrix,i.globeMatrix),hi(e,e,t),new Le(e[0],e[1])},L.f6=function(i){ao=i},L.f7=Ht,L.f8=l1,L.f9=function(i,e){if(!i||!e)throw new Error("TileProvider name and URL are required");ie.TILE_PROVIDER_URLS[i]=Y.resolveURL(e)},L.fA=function(i){let e=0;
3097if(new Uint32Array(i,0,1)[0]!==vv){const t=new Uint32Array(i,0,7),[,,n,s,l,c]=t;e=t.byteLength+s+l+c+l,(n!==i.byteLength||e>=i.byteLength)&&gi("Invalid b3dm header information.")}return Ev(i,e)},L.fB=function(i,e){const t=i.json.extensionsUsed&&i.json.extensionsUsed.includes("mbx_bvh"),n=Hg(i);for(const s of n){if(!t)for(const l of s.meshes)GT(l);s.lights&&(s.lightMeshIndex=s.meshes.length,s.meshes.push(HT(s.lights,e)))}return n},L.fC=w,L.fD=e1,L.fE=tt,L.fF=function(i,e){let t="";for(let n=0;n<i.length;n++){const s=i.charCodeAt(n+1)||null,l=i.charCodeAt(n-1)||null;t+=!e&&(s&&wp(s)&&!sf[i[n+1]]||l&&wp(l)&&!sf[i[n-1]])||!sf[i[n]]?i[n]:sf[i[n]]}return t},L.fG=Fa,L.fH=function(i){return!(i<11904||!(Ld(i)||xh(i)||La(i)||xp(i)||Od(i)||_h(i)||zd(i)||yh(i)||_u(i)||Bd(i)||vh(i)||Vd(i)||mc(i)||Dd(i)||gh(i)||Fd(i)||wl(i)||kd(i)||gp(i)||_p(i)))},L.fI=Ud,L.fJ=function(i){return pp(i)||mp(i)||mh(i)||Os(i)||Nd(i)},L.fK=function(i){return i===12307||i===12312||i===12313||i===12316||i===12448||i===12540||i>=8592&&i<=8595||i===8208||i===8229||i===8741||i>=9472&&i<=9547||i===65294||i===65309||i===65374||i===65507},L.fL=3,L.fM=iu,L.fN=Vy,L.fO=Ml,L.fP=function(i){for(const e of i)if(!P_(e.charCodeAt(0)))return!1;return!0},L.fQ=bp,L.fR=ig,L.fS=rx,L.fT=lx,L.fU=nx,L.fV=Bx,L.fW=1,L.fX=ox,L.fY=sx,L.fZ=Si,L.f_=kh,L.fa=function(i){typeof i!="string"||i.length>64||!so.test(i)?gi(`Invalid SDK info "${i}"; expected a "Name/version" string. Ignoring.`):Br=i},L.fb=Hd,L.fc=function(i,e,t=!1){if(Ln===mo.deferred||Ln===mo.loading||Ln===mo.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");za=Y.resolveURL(i),Ln=mo.deferred,wh=e,gc(),t||Ep()},L.fd=function(i){ie.BUILDING_GEN_URL=Y.resolveURL(i)},L.fe=ye,L.ff=function(i){const e=Y.resolveURL(i);ie.MESHOPT_URL=e,ie.MESHOPT_SIMD_URL=e},L.fg=ce,L.fh=function(i){ie.DRACO_URL=Y.resolveURL(i)},L.fi=re,L.fj=function(i){const e=gt();if(!e)return;const t=e.delete(ke);i&&t.then(()=>i()).catch(i)},L.fk=function(i){ie.MAX_PARALLEL_IMAGE_REQUESTS=i},L.fl=function(i){ie.API_URL=i},L.fm=function(i){ie.ACCESS_TOKEN=i},L.fn="hd_road_elevation",L.fo=class{static parseFrom(i,e){const t=Fl.parse(i);if(!t)return[];let{vertices:n,features:s}=t;const l=1/w(e);s.sort((_,y)=>_.id-y.id),n.sort((_,y)=>_.id-y.id||_.idx-y.idx),n=n.filter((_,y,v)=>y===v.findIndex(b=>b.id===_.id&&b.idx===_.idx));const c=new Array;let h=0;const p=n.length;for(const _ of s){if(_.constantHeight){c.push(new Ol(_.id,_.bounds,_.constantHeight));continue}for(;h!==p&&n[h].id<_.id;)h++;if(h===p||n[h].id!==_.id)continue;const y=new Array,v=new Array,b=h;for(;h!==p&&n[h].id===_.id;){const T=n[h];if(y.push({position:T.position,height:T.height,extent:T.extent,index:T.idx}),h!==b&&n[h-1].idx===T.idx-1){const S=h-b;v.push({a:S-1,b:S})}h++}c.push(new Ol(_.id,_.bounds,void 0,y,v,l))}return c}},L.fp=zl,L.fq=e0,L.fr=vm,L.fs=Un,L.ft=oh,L.fu=function(i,e){const t=i.layers[0].layout.get("fill-elevation-reference"),n=t==="hd-road-base"||t==="hd-road-markup"?t:null,s=!!e&&e.length>0&&zg(e,i.layers[0].source,i.sourceLayerName);(n||s)&&(i.hdExt=new cv(i,n,s))},L.fv=function(i,e){const t=i.layers[0].layout.get("line-elevation-reference")==="hd-road-markup",n=!!e&&e.length>0&&zg(e,i.layers[0].source,i.sourceLayerName);(t||n)&&(i.hdExt=new uv(t,n))},L.fw=Gp,L.fx=function(i){const e=i.layers[0];e.type==="circle"&&e.layout.get("circle-elevation-reference")==="hd-road-markup"&&(i.hdExt=new hv)},L.fy=function(i){i.layers[0].layout.get("symbol-elevation-reference")==="hd-road-markup"&&(i.hdExt=new dv)},L.fz=Q1,L.g=vr,L.g0=cx,L.g1=function(i,e){const t=i.stretchY||[[0,i.paddedRect.h-2]];return i.stretchX||i.stretchY?Zx(i.stretchX||[[0,i.paddedRect.w-2]])*Zx(t):1},L.g2=$x,L.g3=Cc,L.g4=2,L.g5=r1,L.g6=Xy,L.g7=zg,L.g8=function(i,e){const t=vm(i);return t!==null&&!!(e&1<<t)},L.g9=ro,L.ga=vg,L.gb=gg,L.gc=kx,L.gd=Nx,L.ge=G_,L.gf=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log2(i)))},L.gg=l_,L.gh=Ic,L.gi=class{constructor(i=new Uint8Array(16)){this.buf=ArrayBuffer.isView(i)?i:new Uint8Array(i),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(i,e){this.writeVarint(i<<3|e)}realloc(i){let e=this.length||16;for(;e<this.pos+i;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}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}
vendor: 4,826 bytes, line 3097
3097writeFixed64(i){this.realloc(8),this.dataView.setInt32(this.pos,-1&i,!0),this.dataView.setInt32(this.pos+4,Math.floor(i*Px),!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(i*Px),!0),this.pos+=8}writeVarint(i){if((i=+i||0)>=0&&i<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=i);i>268435455||i<0?function(e,t){let n,s;if(e>=0?(n=e%4294967296|0,s=e/4294967296|0):(n=~(-e%4294967296),s=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,s=s+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(l,c,h){h.buf[h.pos++]=127&l|128,l>>>=7,h.buf[h.pos++]=127&l|128,l>>>=7,h.buf[h.pos++]=127&l|128,l>>>=7,h.buf[h.pos++]=127&l|128,h.buf[h.pos]=127&(l>>>=7)}(n,0,t),function(l,c){const h=(7&l)<<4;c.buf[c.pos++]|=h|((l>>>=3)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l)))))}(s,t)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),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++;const e=this.pos;this.pos=function(n,s,l){for(let c,h,p=0;p<s.length;p++){if(c=s.charCodeAt(p),c>55295&&c<57344){if(!h){c>56319||p+1===s.length?(n[l++]=239,n[l++]=191,n[l++]=189):h=c;continue}if(c<56320){n[l++]=239,n[l++]=191,n[l++]=189,h=c;continue}c=h-55296<<10|c-56320|65536,h=null}else h&&(n[l++]=239,n[l++]=191,n[l++]=189,h=null);c<128?n[l++]=c:(c<2048?n[l++]=c>>6|192:(c<65536?n[l++]=c>>12|224:(n[l++]=c>>18|240,n[l++]=c>>12&63|128),n[l++]=c>>6&63|128),n[l++]=63&c|128)}return l}(this.buf,i,this.pos);const t=this.pos-e;t>=128&&Lx(e,t,this),this.pos=e-1,this.writeVarint(t),this.pos+=t}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){const e=i.length;this.writeVarint(e),this.realloc(e),this.buf.set(i,this.pos),this.pos+=e}writeRawMessage(i,e){this.pos++;const t=this.pos;i(e,this);const n=this.pos-t;n>=128&&Lx(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeMessage(i,e,t){this.writeTag(i,2),this.writeRawMessage(e,t)}writePackedVarint(i,e){e.length&&this.writeMessage(i,Vw,e)}writePackedSVarint(i,e){e.length&&this.writeMessage(i,Uw,e)}writePackedBoolean(i,e){e.length&&this.writeMessage(i,Hw,e)}writePackedFloat(i,e){e.length&&this.writeMessage(i,jw,e)}writePackedDouble(i,e){e.length&&this.writeMessage(i,Gw,e)}writePackedFixed32(i,e){e.length&&this.writeMessage(i,Zw,e)}writePackedSFixed32(i,e){e.length&&this.writeMessage(i,$w,e)}writePackedFixed64(i,e){e.length&&this.writeMessage(i,qw,e)}writePackedSFixed64(i,e){e.length&&this.writeMessage(i,Ww,e)}writeBytesField(i,e){this.writeTag(i,2),this.writeBytes(e)}writeFixed32Field(i,e){this.writeTag(i,5),this.writeFixed32(e)}writeSFixed32Field(i,e){this.writeTag(i,5),this.writeSFixed32(e)}writeFixed64Field(i,e){this.writeTag(i,1),this.writeFixed64(e)}writeSFixed64Field(i,e){this.writeTag(i,1),this.writeSFixed64(e)}writeVarintField(i,e){this.writeTag(i,0),this.writeVarint(e)}writeSVarintField(i,e){this.writeTag(i,0),this.writeSVarint(e)}writeStringField(i,e){this.writeTag(i,2),this.writeString(e)}writeFloatField(i,e){this.writeTag(i,5),this.writeFloat(e)}writeDoubleField(i,e){this.writeTag(i,1),this.writeDouble(e)}writeBooleanField(i,e){this.writeVarintField(i,+e)}},L.gj=us,L.gk=im,L.gl=mo,L.gm=tb,L.gn=function(i){at(),Je!=null&&Je.then(e=>{e.keys().then(t=>{for(let n=0;n<t.length-i;n++)e.delete(t[n]).catch(s=>gi(s.message))}).catch(t=>gi(t.message))}).catch(e=>gi(e.message))},L.h=Co,L.i=ho,L.j=2,L.k=ff,L.l=Sa,L.m=Sh,L.n=cl,L.o=J,L.p=zx,L.q=Ia,L.r=Ad,L.s=me,L.t=du,L.u=Ip,L.v=cp,L.w=gi,L.x=fh,L.y=Th,L.z=Pd}),Nc(["require","./shared"],function(d,L){function To(H){const M=H?H.url.toString():void 0;return M?performance.getEntriesByName(M):[]}function Kn(H,M){if(Object.hasOwn(H.layers,L.fn))return L.fo.parseFrom(H.layers[L.fn],M)}function Lr({buckets:H,data:M,sourceLayerCoder:k,canonical:$,options:J}){if(!J.elevationFeatures||J.elevationFeatures.length===0)return;const Y=[];for(const ie of Object.values(H))if(ie instanceof L.bA&&ie.hdExt){const re=ie.hdExt.getUnevaluatedPortalGraph();re&&Y.push(re)}const Q=L.fp.evaluate(Y);for(const ie of Object.values(H))if(ie instanceof L.bA&&ie.hdExt){const re=M.layers[k.decode(ie.sourceLayerIndex)];ie.hdExt.setEvaluatedPortalGraph(Q,re,$,J.availableImages,J.brightness,ie.w
3097orldview)}}function Vc(H){const M=[];for(let k=0;k<H.length;k++){const $=H.feature(k),J=$.properties.frc_mask;if(J==null)continue;const Y=Number(J);if(!Y)continue;const Q=$.loadGeometry();if(Q.length>0){let re=!1;for(const ce of Q[0])if(ce.x<0||ce.x>L.a2||ce.y<0||ce.y>L.a2){re=!0;break}if(re)continue}const ie=Q.length===1&&Q[0].length===5&&Q[0].some(re=>re.x<=0&&re.y<=0)&&Q[0].some(re=>re.x>=L.a2&&re.y<=0)&&Q[0].some(re=>re.x>=L.a2&&re.y>=L.a2)&&Q[0].some(re=>re.x<=0&&re.y>=L.a2);M.push(new L.fq(Y,ie?[]:Q))}return M}function Vl(H,M,k,$,J){const Y=L.fr(M);if(Y===null)return!1;let Q=k.x,ie=k.y;const re=J??$.z;if($.z!==re){const ce=1<<$.z-re,ye=L.a2/ce;Q=$.x%ce*ye+k.x/ce,ie=$.y%ce*ye+k.y/ce}for(const ce of H){if(!(ce.hasGeometry()&&ce.frcMask&1<<Y))continue;const ye=ce.rings.map(Te=>Te.map(ze=>[ze.x,ze.y]));if(L.fs([Q,ie],ye))return!0}return!1}function si(H,M,k,$){const J=M.indoorState.activeFloorsVisible;if(!M.sourceLayers)return J?M.indoorState.activeFloors:void 0;const Y=function(re,ce){if(!re)return L.w("No source layers defined in indoor specification"),ce;if(re.size===0)return ce;const ye=re.difference(ce);for(const Te of ye)L.w(`Missing source layer required in indoor specification: ${Te}`);return ce.intersection(ce)}(M.sourceLayers,new Set(Object.keys(H.layers))),Q=M.indoorState,ie=function(re,ce,ye,Te,ze){const ke={};for(const Ue of ce){const ut=re.layers[Ue];if(ut)for(let nt=0;nt<ut.length;nt++){const Je=ut.feature(nt);if(Ul(Je)){const{id:gt,center:at}=Us(Je);Eo(ke,gt,at);continue}if(xn(Je)){const gt=Uc(Je,ze);Jn(ke,gt.buildings,gt.id,gt)}}else L.w(`indoor source layer not found: ${Ue}`)}return{buildings:ke,activeFloors:L.aW.calculate(ke,Te,ye)}}(H,Y,Q.activeFloors,Q.selectedFloorId,$);return k.notify("setIndoorData",ie),J?ie.activeFloors:void 0}function Eo(H,M,k){H[M]?k&&(H[M].center=k):H[M]={floorIds:new Set,center:k||[0,0],floors:{}}}function Jn(H,M,k,$){for(const J of M)Eo(H,J),H[J].floors[k]=$,H[J].floorIds.add(k)}function Us(H){return{id:H.properties.id.toString(),center:[H.properties.center_lon||0,H.properties.center_lat||0]}}function Uc(H,M){const k=H.properties.id.toString(),$=!!H.properties.is_default&&H.properties.is_default,J=H.properties.connected_floor_ids?new Set(H.properties.connected_floor_ids.toString().split(";")):new Set,Y=H.properties.conflicted_floor_ids?new Set(H.properties.conflicted_floor_ids.toString().split(";")):new Set,Q=H.properties.structure_ids?new Set(H.properties.structure_ids.toString().split(";")):new Set,ie=H.properties.name.toString(),re=H.properties.z_index,ce=function(ye,Te){const ze=ye.loadGeometry();if(!ze||ze.length===0)return;const ke=ze.map(Ue=>Ue.map(ut=>L.ft(ut,Te,ye.extent)));return ke.length===0?void 0:{type:"Polygon",coordinates:[ke[0]]}}(H,M);return{id:k,isDefault:$,connections:J,conflicts:Y,buildings:Q,name:ie,zIndex:re,geometry:ce}}function er(H,M){return M.every(k=>H.properties&&H.properties[k]!=null)}function Ul(H){return er(H,["type","id","name"])&&H.properties.type==="structure"}function xn(H){return er(H,["type","id","name","z_index"])&&H.properties.type==="floor"}function zt(H,M){H instanceof L.bA?L.fu(H,M):H instanceof L.bz?L.fv(H,M):H instanceof L.fw?L.fx(H):H instanceof L.bu&&L.fy(H)}function Wi(H){for(const M in H){const k=H[M];if(k instanceof L.bz&&k.hdExt&&k.hdExt.hasDeferredElevationFeatures||k instanceof L.bu&&k.hdExt&&k.hdExt.hasDeferredElevationFeatures)return!0}return!1}class mr{constructor(M,k,$){this.tileID=new L.bP(M.tileID.overscaledZ,M.tileID.wrap,M.tileID.canonical.z,M.tileID.canonical.x,M.tileID.canonical.y),this.tileZoom=M.tileZoom,this.uid=M.uid,this.zoom=M.zoom,this.canonical=M.tileID.canonical,this.pixelRatio=M.pixelRatio,this.tileSize=M.tileSize,this.source=M.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=M.projection,this.brightness=k,this.worldview=$}async parse(M,k,$){this.status="parsing";const J=new L.bP($.tileID.overscaledZ,$.tileID.wrap,$.tileID.canonical.z,$.tileID.canonical.x,$.tileID.canonical.y),Y=[],Q=k.familiesBySource[$.source],ie=new L.fz(J,$.promoteId);ie.bucketLayerIDs=[],ie.is3DTile=!0;const re=await L.fA(M),ce=re.json.extensionsUsed&&re.json.extensionsUsed.includes("MAPBOX_mesh_features")||re.json.asset.extras&&re.json.asset.extras.MAPBOX_mesh_features,ye=re.json.extensionsUsed&&re.json.extensionsUsed.includes("EXT_meshopt_compression"),Te=new L.ai(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const ze in Q)for(const ke of Q[ze]){const Ue=ke[0];ie.bucketLayerIDs.push(ke.map(Je=>L.m(Je.id,Je.scope))),Ue.recalculate(Te,[]);const ut=L.fB(re,1/L.fC($.tileID.canonical)),nt=new L.fD(ke,ut,J,ce,ye,this.brightness,ie,this.worldview);ce||(nt.needsUpload=!0),Y.push(nt),nt.evaluate(Ue)}return this.status="done",{buckets:Y,featureIndex:ie,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null}}}class Is{constructor({actor:M,layerIndex:k,availableImages:$,availableModels:J,brightness:Y,worldview:Q}){this.actor=M,this.layerIndex=k,this.availableImages=$,this.availableModels=J,this.brightness=Y,this.loading={},this.loaded={},this.worldview=Q}async loadTile(M){const k=M.uid,$=new AbortController,J=this.loading[k]=new mr(M,this.brightness,this.worldview);J.abort=()=>$.abort();const Y=(ie,re)=>{const ce=J.reloadCallback;ce&&(delete J.reloadCallback,ce(ie,re))};let Q;try{Q=(await L.cC(M.request,$.signal)).data}catch(ie){if(delete this.loading[k],J.status="done",this.loaded[k]=J,$.signal.aborted)return null;throw ie}if(delete this.loading[k],!Q||Q.byteLength===0)return J.status="done",this.loaded[k]=J,null;try{const ie=await J.parse(Q,this.layerIndex,M);return this.loaded[k]=J,Y(null,ie),ie}catch(ie){throw this.loaded[k]=J,Y(ie),ie}}async reloadTile(M){const k=this.loaded&&this.loaded[M.uid];if(k)return k.projection=M.projection,k.brightness=M.brightness,k.status==="parsing"&&await new Promise(($,J)=>{k.reloadCallback=Y=>{Y?J(Y):$()}}),this.loadTile(M)}abortTile(M){const k=M.uid,$=this.loading[k];$&&($.abort&&$.abort(),delete this.loading[k])}removeTile(M){const k=this.loaded,$=M.uid;k&&k[$]&&delete k[$]}}function So(H){if(typeof H=="number"||typeof H=="boolean"||typeof H=="string"||H==null)return JSON.stringify(H);if(Array.isArray(H)){let k="[";for(const $ of H)k+=`${So($)},`;return`${k}]`}let M="{";for(const k of Object.keys(H).sort())M+=`${k}:${So(H[k])},`;return`${M}}`}function js(H){let M="";for(const k of L.cD)M+=`/${So(H[k])}`;return M}function Gs(H,M){return function k($){return typeof $=="string"&&$===M||(Array.isArray($)?$.some(k):!(!$||typeof $!="object")&&Object.values($).some(k))}(H)}class No{constructor(M){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),M&&this.replace(M)}replace(M,k){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(M,[],k)}update(M,k,$){this._options=$;for(const Y of M)this._layerConfigs[Y.id]=Y,(this._layers[Y.id]=L.di(Y,this.scope,null,this._options)).compileFilter($),this.keyCache[Y.id]&&delete this.keyCache[Y.id];
vendor: 6,791 bytes, line 3097
3097for(const Y of k)delete this.keyCache[Y],delete this._layerConfigs[Y],delete this._layers[Y];this.familiesBySource=Object.create(null);const J=function(Y,Q){const ie=Object.create(null);for(let ce=0;ce<Y.length;ce++){const ye=Y[ce];let Te=Q&&Q[ye.id];Te||(ye.type==="symbol"?Te=ye.id:(Te=js(ye),ye.type==="line"&&ye.paint&&(Gs(ye.paint["line-width"],"line-progress")&&(Te+=`/${So(ye.paint["line-width"])}`),Gs(ye.paint["line-emissive-strength"],"line-progress")&&(Te+=`/${So(ye.paint["line-emissive-strength"])}`)))),Q&&(Q[ye.id]=Te);let ze=ie[Te];ze||(ze=ie[Te]=[]),ze.push(ye)}const re=[];for(const ce in ie)re.push(ie[ce]);return re}(Object.values(this._layerConfigs),this.keyCache);for(const Y of J){const Q=Y.map(ze=>this._layers[ze.id]),ie=Q[0];if(ie.visibility==="none")continue;const re=ie.source||"";let ce=this.familiesBySource[re];ce||(ce=this.familiesBySource[re]=Object.create(null));const ye=ie.sourceLayer||"_geojsonTileLayer";let Te=ce[ye];Te||(Te=ce[ye]=[]),Te.push(Q)}}}class Qn extends L.P{constructor(M,k,$,J,Y){super(M,k),this.angle=J,this.z=$,Y!==void 0&&(this.segment=Y)}clone(){return new Qn(this.x,this.y,this.z,this.angle,this.segment)}}function jl(H,M,k,$,J){if(M.segment===void 0)return!0;let Y=M,Q=M.segment+1,ie=0;for(;ie>-k/2;){if(Q--,Q<0)return!1;ie-=H[Q].dist(Y),Y=H[Q]}ie+=H[Q].dist(H[Q+1]),Q++;const re=[];let ce=0;for(;ie<k/2;){const ye=H[Q],Te=H[Q+1];if(!Te)return!1;let ze=H[Q-1].angleTo(ye)-ye.angleTo(Te);for(ze=Math.abs((ze+3*Math.PI)%(2*Math.PI)-Math.PI),re.push({distance:ie,angleDelta:ze}),ce+=ze;ie-re[0].distance>$;)ce-=re.shift().angleDelta;if(ce>J)return!1;Q++,ie+=ye.dist(Te)}return!0}function Uu(H){let M=0;for(let k=0;k<H.length-1;k++)M+=H[k].dist(H[k+1]);return M}function qa(H,M,k){return H?.6*M*k:0}function Gl(H,M){return Math.max(H?H.right-H.left:0,M?M.right-M.left:0)}function ju(H,M,k,$,J,Y){const Q=qa(k,J,Y),ie=Gl(k,$)*Y;let re=0;const ce=Uu(H)/2;for(let ye=0;ye<H.length-1;ye++){const Te=H[ye],ze=H[ye+1],ke=Te.dist(ze);if(re+ke>ce){const Ue=(ce-re)/ke,ut=L.al(Te.x,ze.x,Ue),nt=L.al(Te.y,ze.y,Ue),Je=new Qn(ut,nt,0,ze.angleTo(Te),ye);return!Q||jl(H,Je,ie,Q,M)?Je:void 0}re+=ke}}function Wa(H,M,k,$,J,Y,Q,ie,re){const ce=qa($,Y,Q),ye=Gl($,J),Te=ye*Q,ze=H[0].x===0||H[0].x===re||H[0].y===0||H[0].y===re;return M-Te<M/4&&(M=Te+M/4),Qt(H,ze?M/2*ie%M:(ye/2+2*Y)*Q*ie%M,M,ce,k,Te,ze,!1,re)}function Qt(H,M,k,$,J,Y,Q,ie,re){const ce=Y/2,ye=Uu(H);let Te=0,ze=M-k,ke=[];for(let Ue=0;Ue<H.length-1;Ue++){const ut=H[Ue],nt=H[Ue+1],Je=ut.dist(nt),gt=nt.angleTo(ut);for(;ze+k<Te+Je;){ze+=k;const at=(ze-Te)/Je,At=L.al(ut.x,nt.x,at),Nt=L.al(ut.y,nt.y,at);if(At>=0&&At<re&&Nt>=0&&Nt<re&&ze-ce>=0&&ze+ce<=ye){const jt=new Qn(At,Nt,0,gt,Ue);$&&!jl(H,jt,Y,$,J)||ke.push(jt)}}Te+=Je}return ie||ke.length||Q||(ke=Qt(H,Te/2,k,$,J,Y,Q,!0,re)),ke}L.fE(Qn,"Anchor");class Hs{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(M,k){const $=new Hs;return $.scale=M||1,$.fontStack=k,$}static forImage(M){const k=new Hs;return k.image=M,k}}class Xi{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(M,k,$,J=1){const Y=new Xi;for(let Q=0;Q<M.sections.length;Q++){const ie=M.sections[Q];ie.image?Y.addImageSection(ie,$,J):Y.addTextSection(ie,k)}return Y}length(){return this.text.length}getSection(M){return this.sections[this.sectionIndex[M]]}getSections(){return this.sections}getSectionIndex(M){return this.sectionIndex[M]}getCodePoint(M){return this.text.codePointAt(M)}verticalizePunctuation(M){this.text=L.fF(this.text,M)}trim(){let M=0;for(let $=0;$<this.text.length&&Ni[this.text.charCodeAt($)];$++)M++;let k=this.text.length;for(let $=this.text.length-1;$>=0&&$>=M&&Ni[this.text.charCodeAt($)];$--)k--;this.text=this.text.substring(M,k),this.sectionIndex=this.sectionIndex.slice(M,k)}substring(M,k){const $=new Xi;return $.text=this.text.substring(M,k),$.sectionIndex=this.sectionIndex.slice(M,k),$.sections=this.sections,$}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((M,k)=>Math.max(M,this.sections[k].scale),0)}addTextSection(M,k){this.text+=M.text,this.sections.push(Hs.forText(M.scale,M.fontStack||k));const $=this.sections.length-1;for(let J=0;J<M.text.length;++J)this.sectionIndex.push($)}addImageSection(M,k,$=1){const J=M.image?M.image.getPrimary():null;if(!J)return void L.w("Can't add FormattedSection with an empty image.");J.scaleSelf(k*$);const Y=this.getNextImageSectionCharCode();Y?(this.text+=String.fromCodePoint(Y),this.sections.push(Hs.forImage(J)),this.sectionIndex.push(this.sections.length-1)):L.w("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Tr(H,M,k,$,J,Y,Q,ie,re,ce,ye,Te,ze,ke,Ue,ut=1,nt=1){const Je=Xi.fromFeature(H,J,ut,nt);Te===L.cL.vertical&&Je.verticalizePunctuation(ze);let gt=[];const at=function(Ct,xi,pi,kt,Zt,Mt,$t){if(!Ct)return[];const mi=[],Ft=function(vi,_r,Ki,wi,Fi,Ii,tr){let jr=0;for(let Gr=0;Gr<vi.length();Gr++){const gr=vi.getSection(Gr);jr+=eo(vi.getCodePoint(Gr),gr,wi,Fi,_r,Ii,tr)}return jr/Math.max(1,Math.ceil(jr/Ki))}(Ct,xi,pi,kt,Zt,Mt,$t),di=Ct.text.includes("â");let vr=0;for(let vi=0;vi<Ct.length();vi++){const _r=Ct.getSection(vi),Ki=Ct.getCodePoint(vi);if(Ni[Ki]||(vr+=eo(Ki,_r,kt,Zt,xi,Mt,$t)),vi<Ct.length()-1){const wi=L.fH(Ki);(Yi[Ki]||wi||_r.image)&&mi.push($s(vi+1,vr,Ft,mi,Zs(Ki,Ct.getCodePoint(vi+1),wi&&di),!1))}}return oi($s(Ct.length(),vr,Ft,mi,0,!0))}(Je,ce,Y,M,$,ke,nt),{processBidirectionalText:At,processStyledBidirectionalText:Nt}=L.fG;if(At&&Je.sections.length===1){const Ct=At(Je.toString(),at);for(const xi of Ct){const pi=new Xi;pi.text=xi,pi.sections=Je.sections;for(let kt=0;kt<xi.length;kt++)pi.sectionIndex.push(0);gt.push(pi)}}else if(Nt){const Ct=Nt(Je.text,Je.sectionIndex,at);for(const xi of Ct){const pi=new Xi;pi.text=xi[0],pi.sectionIndex=xi[1],pi.sections=Je.sections,gt.push(pi)}}else gt=function(Ct,xi){const pi=[],kt=Ct.text;let Zt=0;for(const Mt of xi)pi.push(Ct.substring(Zt,Mt)),Zt=Mt;return Zt<kt.length&&pi.push(Ct.substring(Zt,kt.length)),pi}(Je,at);const jt=[],Ht={positionedLines:jt,text:Je.toString(),top:ye[1],bottom:ye[1],left:ye[0],right:ye[0],writingMode:Te,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(Ct,xi,pi,kt,Zt,Mt,$t,mi,Ft,di,vr,vi,_r){let Ki=0,wi=0,Fi=0;const Ii=mi==="right"?1:mi==="left"?0:.5;let tr=!1;for(const Ai of Zt){const yi=Ai.getSections();for(const Yr of yi){if(Yr.image)continue;const Er=xi[Yr.fontStack];if(Er&&(tr=Er.ascender!==void 0&&Er.descender!==void 0,!tr))break}if(!tr)break}let jr=0;for(const Ai of Zt){Ai.trim();const yi=Ai.getMaxScale(),Yr=(yi-1)*L.d1,Er={positionedGlyphs:[],lineOffset:0};Ct.positionedLines[jr]=Er;
3097const Vt=Er.positionedGlyphs;let Zi=0;if(!Ai.length()){wi+=Mt,++jr;continue}let Or=0,Mn=0;for(let Br=0;Br<Ai.length();Br++){const so=Ai.getSection(Br),ao=Ai.getSectionIndex(Br),Ci=Ai.getCodePoint(Br);let or=so.scale,kr=null,Rn=null,bn=null,rn=L.d1,Hr=0,lo=Ft;lo===L.cL.vertical&&L.fK(Ci)&&(lo=L.cL.horizontal);const Go=!(lo===L.cL.horizontal||!vr&&!L.fI(Ci)||vr&&(Ni[Ci]||L.fJ(Ci)));if(so.image){const Hn=kt.get(so.image.toString());if(!Hn)continue;bn=so.image,Ct.iconsInText=!0,Rn=Hn.paddedRect;const ir=Hn.displaySize,wn=ir[0]*_r,Bi=ir[1]*_r;or=or*L.d1/vi,kr={width:wn,height:Bi,left:0,top:-L.fL,advance:Go?Bi:wn,localGlyph:!1},Hr=tr?-kr.height*or:yi*L.d1-17-Bi*or,rn=kr.advance;const Sr=(Go?wn:Bi)*or-L.d1*yi;Sr>0&&Sr>Zi&&(Zi=Sr)}else{const Hn=pi[so.fontStack];if(!Hn)continue;Hn[Ci]&&(Rn=Hn[Ci]);const ir=xi[so.fontStack];if(!ir)continue;const wn=ir.glyphs[Ci];if(!wn)continue;if(kr=wn.metrics,rn=Ci!==8203?L.d1:0,tr){const Bi=ir.ascender!==void 0?Math.abs(ir.ascender):0,Sr=ir.descender!==void 0?Math.abs(ir.descender):0,co=(Bi+Sr)*or;Or<co&&(Or=co,Mn=(Bi-Sr)/2*or),Hr=-Bi*or}else Hr=(yi-or)*L.d1-17}Vt.push({glyph:Ci,image:bn,x:Ki,y:wi+Hr,vertical:Go,scale:or,localGlyph:kr.localGlyph,fontStack:so.fontStack,sectionIndex:ao,metrics:kr,rect:Rn}),Go?(Ct.verticalizable=!0,Ki+=rn*or+di):Ki+=kr.advance*or+di}Vt.length!==0&&(Fi=Math.max(Ki-di,Fi),tr?cn(Vt,Ii,Zi,Mn,Mt*yi/2):cn(Vt,Ii,Zi,0,Mt/2)),Ki=0;const tn=Mt*yi+Zi;Er.lineOffset=Math.max(Zi,Yr),wi+=tn,++jr}const Gr=wi,{horizontalAlign:gr,verticalAlign:oo}=L.cM($t);(function(Ai,yi,Yr,Er,Vt,Zi){const Or=(yi-Yr)*Vt,Mn=-Zi*Er;for(const tn of Ai)for(const Br of tn.positionedGlyphs)Br.x+=Or,Br.y+=Mn})(Ct.positionedLines,Ii,gr,oo,Fi,Gr),Ct.top+=-oo*Gr,Ct.bottom=Ct.top+Gr,Ct.left+=-gr*Fi,Ct.right=Ct.left+Fi,Ct.hasBaseline=tr}(Ht,M,k,$,gt,Q,ie,re,Te,ce,ze,Ue,nt),!function(Ct){for(const xi of Ct)if(xi.positionedGlyphs.length!==0)return!1;return!0}(jt))return Ht}const Ni={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Yi={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 eo(H,M,k,$,J,Y,Q){if(M.image){const ie=$.get(M.image.toString());return ie?ie.displaySize[0]*Q*M.scale*L.d1/Y+J:0}{const ie=k[M.fontStack],re=ie&&ie.glyphs[H];return re?re.metrics.advance*M.scale+J:0}}function jc(H,M,k,$){const J=Math.pow(H-M,2);return $?H<M?J/2:2*J:J+Math.abs(k)*k}function Zs(H,M,k){let $=0;return H===10&&($-=1e4),k&&($+=150),H!==40&&H!==65288||($+=50),M!==41&&M!==6
vendor: 4,745 bytes, line 3097
30975289||($+=50),$}function $s(H,M,k,$,J,Y){let Q=null,ie=jc(M,k,J,Y);for(const re of $){const ce=jc(M-re.x,k,J,Y)+re.badness;ce<=ie&&(Q=re,ie=ce)}return{index:H,x:M,priorBreak:Q,badness:ie}}function oi(H){return H?oi(H.priorBreak).concat(H.index):[]}function cn(H,M,k,$,J){if(!(M||k||$||J))return;const Y=H.length-1,Q=H[Y],ie=(Q.x+Q.metrics.advance*Q.scale)*M;for(let re=0;re<=Y;re++)H[re].x-=ie,H[re].y+=k+$+J}function Xa(H,M=1,k=!1){let $=1/0,J=1/0,Y=-1/0,Q=-1/0;const ie=H[0];for(let ke=0;ke<ie.length;ke++){const Ue=ie[ke];(!ke||Ue.x<$)&&($=Ue.x),(!ke||Ue.y<J)&&(J=Ue.y),(!ke||Ue.x>Y)&&(Y=Ue.x),(!ke||Ue.y>Q)&&(Q=Ue.y)}const re=Math.min(Y-$,Q-J);let ce=re/2;const ye=new L.fM([],qs);if(re===0)return new L.P($,J);for(let ke=$;ke<Y;ke+=re)for(let Ue=J;Ue<Q;Ue+=re)ye.push(new is(ke+ce,Ue+ce,ce,H));let Te=function(ke){let Ue=0,ut=0,nt=0;const Je=ke[0];for(let gt=0,at=Je.length,At=at-1;gt<at;At=gt++){const Nt=Je[gt],jt=Je[At],Ht=Nt.x*jt.y-jt.x*Nt.y;ut+=(Nt.x+jt.x)*Ht,nt+=(Nt.y+jt.y)*Ht,Ue+=3*Ht}return new is(ut/Ue,nt/Ue,0,ke)}(H),ze=ye.length;for(;ye.length;){const ke=ye.pop();(ke.d>Te.d||!Te.d)&&(Te=ke,k&&console.log("found best %d after %d probes",Math.round(1e4*ke.d)/1e4,ze)),ke.max-Te.d<=M||(ce=ke.h/2,ye.push(new is(ke.p.x-ce,ke.p.y-ce,ce,H)),ye.push(new is(ke.p.x+ce,ke.p.y-ce,ce,H)),ye.push(new is(ke.p.x-ce,ke.p.y+ce,ce,H)),ye.push(new is(ke.p.x+ce,ke.p.y+ce,ce,H)),ze+=4)}return k&&(console.log(`num probes: ${ze}`),console.log(`best distance: ${Te.d}`)),Te.p}function qs(H,M){return M.max-H.max}class is{constructor(M,k,$,J){this.p=new L.P(M,k),this.h=$,this.d=function(Y,Q){let ie=!1,re=1/0;for(let ce=0;ce<Q.length;ce++){const ye=Q[ce];for(let Te=0,ze=ye.length,ke=ze-1;Te<ze;ke=Te++){const Ue=ye[Te],ut=ye[ke];Ue.y>Y.y!=ut.y>Y.y&&Y.x<(ut.x-Ue.x)*(Y.y-Ue.y)/(ut.y-Ue.y)+Ue.x&&(ie=!ie),re=Math.min(re,L.fN(Y,Ue,ut))}}return(ie?1:-1)*Math.sqrt(re)}(this.p,J),this.max=this.d+this.h*Math.SQRT2}}const rs=Object.keys;function ti(H){return H.imagePrimary!==void 0&&H.top!==void 0&&H.bottom!==void 0&&H.left!==void 0&&H.right!==void 0}function Di(H){return!H.imagePrimary.stretchX}function xr(H){return!H.imagePrimary.stretchY}function Ws(H){return{width:H.right-H.left,height:H.bottom-H.top}}const hi=Number.POSITIVE_INFINITY;function Io(H,M,k,$,J,Y){const Q=ti(H)&&H.collisionPadding?H.collisionPadding:[0,0,0,0],ie={top:H.top-Q[1],bottom:H.bottom+Q[3],left:H.left-Q[0],right:H.right+Q[2],scaled:!1};return $!==void 0&&function(re,ce){re.top*=ce,re.bottom*=ce,re.left*=ce,re.right*=ce,re.scaled=!0}(ie,$),Y&&(ie.left+=Y[0],ie.right+=Y[0],ie.top+=Y[1],ie.bottom+=Y[1]),k&&function(re,ce,ye){if(!ce)return;const Te=L.au(ce),ze=new L.P(ye?ye[0]:0,ye?ye[1]:0),ke=new L.P(re.left,re.top),Ue=new L.P(re.right,re.top),ut=new L.P(re.left,re.bottom),nt=new L.P(re.right,re.bottom);ke._rotateAround(Te,ze),Ue._rotateAround(Te,ze),ut._rotateAround(Te,ze),nt._rotateAround(Te,ze),re.left=Math.min(ke.x,Ue.x,ut.x,nt.x),re.right=Math.max(ke.x,Ue.x,ut.x,nt.x),re.top=Math.min(ke.y,Ue.y,ut.y,nt.y),re.bottom=Math.max(ke.y,Ue.y,ut.y,nt.y)}(ie,k,J),M?{top:Math.min(M.top,ie.top),bottom:Math.max(M.bottom,ie.bottom),left:Math.min(M.left,ie.left),right:Math.max(M.right,ie.right),scaled:M.scaled||ie.scaled}:ie}function da(H,M,k,$,J,Y,Q,ie=1,re,ce,ye,Te,ze,ke,Ue,ut,nt){H.createArrays(),H.tilePixelRatio=L.a2/(512*H.overscaling),H.compareText={},H.iconsNeedLinear=!1;const Je=H.layers[0].layout,gt=H.layers[0]._unevaluatedLayout._values,at={};at.scaleFactor=ie,at.textSizeScaleRange=Je.get("text-size-scale-range"),at.iconSizeScaleRange=Je.get("icon-size-scale-range");const[At,Nt]=at.textSizeScaleRange,[jt,Ht]=at.iconSizeScaleRange;at.textScaleFactor=L.b0(at.scaleFactor,At,Nt),at.iconScaleFactor=L.b0(at.scaleFactor,jt,Ht);const Ct=gt["text-size"],xi=gt["icon-size"];if(H.textSizeData.kind==="composite"){const{minZoom:Ft,maxZoom:di}=H.textSizeData;at.compositeTextSizes=[Ct.possiblyEvaluate(new L.ai(Ft,{worldview:ye}),Y),Ct.possiblyEvaluate(new L.ai(di,{worldview:ye}),Y)]}if(H.iconSizeData.kind==="composite"){const{minZoom:Ft,maxZoom:di}=H.iconSizeData;at.compositeIconSizes=[xi.possiblyEvaluate(new L.ai(Ft,{worldview:ye}),Y,Te),xi.possiblyEvaluate(new L.ai(di,{worldview:ye}),Y,Te)]}at.layoutTextSize=Ct.possiblyEvaluate(new L.ai(Q+1,{worldview:ye}),Y),at.layoutIconSize=xi.possiblyEvaluate(new L.ai(Q+1,{worldview:ye}),Y,Te),at.textMaxSize=Ct.possiblyEvaluate(new L.ai(18,{worldview:ye}),Y);const pi=Je.get("symbol-placement"),kt=Je.get("text-rotation-alignment")==="map"&&pi!=="point",Zt=Je.get("text-size");let Mt=!1;const $t=[],mi=ze!=null&&ze!==0;for(const Ft of H.features){if(mi&&Ft.properties&&ut&&ut(Ft.properties,ze))continue;let di=65535;if(H.hdExt&&Ft.properties&&Object.hasOwn(Ft.properties,L.fO)){const Ci=+Ft.properties[L.fO];
3097if(!Number.isNaN(Ci)){const or=H.hdExt.resolveRoadElevation(Ft,Ci);if(or==="defer")continue;di=or}}const vr=Je.get("text-font").evaluate(Ft,{},Y).join(","),vi=Zt.evaluate(Ft,{},Y)*at.textScaleFactor,_r=at.layoutTextSize.evaluate(Ft,{},Y)*at.textScaleFactor,Ki=at.layoutIconSize.evaluate(Ft,{},Y,Te)*at.iconScaleFactor,wi={horizontal:{},vertical:void 0},Fi=Ft.text;let Ii,tr=[0,0];if(Fi){const Ci=Fi.toString(),or=Je.get("text-letter-spacing").evaluate(Ft,{},Y)*L.d1,kr=Je.get("text-line-height").evaluate(Ft,{},Y)*L.d1,Rn=L.fP(Ci)?or:0,bn=Je.get("text-anchor").evaluate(Ft,{},Y),rn=Je.get("text-variable-anchor");if(!rn){const ir=Je.get("text-radial-offset").evaluate(Ft,{},Y);if(ir)tr=L.cN(bn,[ir*L.d1,hi]);else{const wn=Je.get("text-offset").evaluate(Ft,{},Y);tr=[wn[0]*L.d1,wn[1]*L.d1]}}let Hr=kt?"center":Je.get("text-justify").evaluate(Ft,{},Y);const lo=pi==="point",Go=lo?Je.get("text-max-width").evaluate(Ft,{},Y)*L.d1:1/0,Hn=ir=>{H.allowVerticalPlacement&&L.fQ(Ci)&&(wi.vertical=Tr(Fi,M,k,J,vr,Go,kr,bn,ir,Rn,tr,L.cL.vertical,!0,_r,vi,re,at.textScaleFactor))};if(!kt&&rn){const ir=Hr==="auto"?rn.map(Bi=>L.cO(Bi)):[Hr];let wn=!1;for(let Bi=0;Bi<ir.length;Bi++){const Sr=ir[Bi];if(!wi.horizontal[Sr])if(wn)wi.horizontal[Sr]=wi.horizontal[0];else{const co=Tr(Fi,M,k,J,vr,Go,kr,"center",Sr,Rn,tr,L.cL.horizontal,!1,_r,vi,re,at.textScaleFactor);co&&(wi.horizontal[Sr]=co,wn=co.positionedLines.length===1)}}Hn("left")}else{if(Hr==="auto"&&(Hr=L.cO(bn)),lo||Je.get("text-writing-mode").includes("horizontal")||!L.fQ(Ci)){const ir=Tr(Fi,M,k,J,vr,Go,kr,bn,Hr,Rn,tr,L.cL.horizontal,!1,_r,vi,re,at.textScaleFactor);ir&&(wi.horizontal[Hr]=ir)}Hn(lo?"left":Hr)}}let jr,Gr,gr,oo,Ai,yi,Yr=!1;const Er=Je.get("icon-text-fit").evaluate(Ft,{},Y);if(Ft.icon&&Ft.icon.hasPrimary()){const Ci=L.fR(Ft.icon,H.iconSizeData,gt["icon-size"],Y,H.zoom,Ft,re,at.iconScaleFactor,ye,Te);jr=Ci.iconPrimary,gr=Ci.iconSecondary;const or=jr.toString();if(Gr=$.get(or),Gr&&(Ai=Je.get("icon-offset").evaluate(Ft,{},Y),yi=Je.get("icon-anchor").evaluate(Ft,{},Y),Ii=L.fS(J.get(or),gr?J.get(gr.toString()):void 0,Ai,yi),Yr=Gr.sdf,H.sdfIcons===void 0?H.sdfIcons=Gr.sdf:H.sdfIcons!==Gr.sdf&&L.w("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Gr.pixelRatio!==H.pixelRatio||Je.get("icon-rotate").constantOr(1)!==0)&&(H.iconsNeedLinear=!0)),gr){const kr=gr.toString();oo=$.get(kr)}}Mt=Mt||!(!Ft.icon||!Ft.icon.hasSecondary());const Vt=Xs(wi.horizontal)||wi.vertical;H.iconsInText||(H.iconsInText=!!Vt&&Vt.iconsInText);const Zi=L.fT(_r,at.textScaleFactor),{defaultShapedIcon:Or,verticallyShapedIcon:Mn}=it(H,Ii,Je,Ft,Y,wi,Zi,Ai,Er);Er!=="none"&&Ii&&(Di(Ii)||xr(Ii))&&(As(Gr,jr,Ii,Or,Er,ce,$,J),As(oo,gr,Ii,Or,Er,ce,$,J),Mn&&(As(Gr,jr,Ii,Mn,Er,ce,$,J),As(oo,gr,Ii,Mn,Er,ce,$,J))),Ii=Or;const{iconBBox:tn,iconVerticalBBox:Br,textBBox:so,textVerticalBBox:ao}=Gc(H,Ii,Mn,Je,Ft,Y,Ki,Ai,at,J,yi,wi,_r,tr,Te);$t.push({feature:Ft,shapedTextOrientations:wi,shapedText:Vt,shapedIcon:Ii,iconPrimary:jr,iconSecondary:gr,iconOffset:Ai,iconAnchor:yi,verticallyShapedIcon:Mn,layoutTextSize:_r,layoutIconSize:Ki,textOffset:tr,isSDFIcon:Yr,iconTextFit:Er,iconCollisionBounds:tn,iconVerticalCollisionBounds:Br,textCollisionBounds:so,textVerticalCollisionBounds:ao,elevationFeatureIndex:di})}return H.hdExt&&H.hdExt.clearWorkerState(),{featureData:$t,sizes:at,hasAnySecondaryIcon:Mt,textAlongLine:kt,symbolPlacement:pi,coverageFrcMask:ze,coveragePolygons:ke,coverageTileZoom:Ue,isFeatureCoveredByFrcMask:ut,symbolAnchorInFrcCoverage:nt}}function Gc(H,M,k,$,J,Y,Q,ie,re,ce,ye,Te,ze,ke,Ue){const ut=H.layers[0],nt=ut.appearances;if(nt.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const Je={iconBBox:null,iconVerticalBBox:null},gt={textBBox:null,textVerticalBBox:null},{baseIconRotate:at,baseTextRotate:At,iconScaleFactor:Nt}=function(Ht,Ct,xi){const pi=Ht.get("icon-rotate").evaluate(Ct,{},xi),kt=Ht.get("text-rotate").evaluate(Ct,{},xi),[Zt,Mt]=Ht.get("icon-size-scale-range");return{baseIconRotate:pi,baseTextRotate:kt,iconScaleFactor:L.b0(1,Zt,Mt)}}($,J,Y);M&&(Je.iconBBox=Io(M,Je.iconBBox,at),k)&&(Je.iconVerticalBBox=Io(k,Je.iconVerticalBBox,at+90)
3097);const jt=Xs(Te.horizontal);jt&&(gt.textBBox=Io(jt,gt.textBBox,At,1,ke)),Te.vertical&&(gt.textVerticalBBox=Io(Te.vertical,gt.textVerticalBBox,At+90,1,ke));for(const Ht of nt)Ht.hasIconLayoutProperties()&&ns(Je,H,ut,Ht,J,Y,ie,at,Q,re,M,ce,Nt,ye,Ue),Ht.hasTextLayoutProperties()&&Gu(gt,ut,Ht,J,Y,ke,At,ze,jt,Te.vertical);return{iconBBox:Je.iconBBox,iconVerticalBBox:Je.iconVerticalBBox,textBBox:gt.textBBox,textVerticalBBox:gt.textVerticalBBox}}function ns(H,M,k,$,J,Y,Q,ie,re,ce,ye,Te,ze,ke,Ue){const{appearanceIconOffset:ut,appearanceIconRotate:nt,appearanceIconSize:Je}=L.fX($,k,J,Y,Q,ie,re,ce.iconScaleFactor);let gt=null,at=null,At=null;$.hasLayoutProperty("icon-image")?At=Li(M,k,$,J,Y,Te,ze,Ue):ye&&(At=ye.imagePrimary),At&&(gt=L.fS(At,null,ut,ke),M.allowVerticalPlacement&&(at=gt));const Nt=re>0?Je/re:1;gt&&(H.iconBBox=Io(gt,H.iconBBox,nt,Nt!==1?Nt:void 0)),at&&(H.iconVerticalBBox=Io(at,H.iconVerticalBBox,nt+90,Nt!==1?Nt:void 0))}function Li(H,M,k,$,J,Y,Q,ie){let re=null;const ce=M.getAppearanceValueAndResolveTokens(k,"icon-image",$,J,ie);if(ce){const ye=H.getResolvedImageFromTokens(ce),Te=k.hasLayoutProperty("icon-size")?k.getUnevaluatedLayoutProperty("icon-size"):M._unevaluatedLayout._values["icon-size"],ze=L.f_(H.zoom,Te,H.worldview,ie),ke=L.fR(ye,ze,Te,J,H.zoom,$,H.pixelRatio,Q,H.worldview,ie);re=Y.get(ke.iconPrimary.toString())}return re}function Gu(H,M,k,$,J,Y,Q,ie,re,ce){const{appearanceTextOffset:ye,appearanceTextRotate:Te,appearanceTextSize:ze}=L.fY(k,M,$,J,Y,Q,ie),ke=ze/ie,Ue=[(ye[0]-Y[0])*ke,(ye[1]-Y[1])*ke],ut=Ue[0]!==0||Ue[1]!==0;re&&(H.textBBox=Io(re,H.textBBox,Te,ke,ye,ut?Ue:void 0)),ce&&(H.textVerticalBBox=Io(ce,H.textVerticalBBox,Te+90,ke,ye,ut?Ue:void 0))}function As(H,M,k,$,J,Y,Q,ie){if(!H||!H.usvg)return;const re=Ws(k),ce=Ws($),ye=J!=="both"&&J!=="width"||!Di(k)?1:ce.width/re.width,Te=J!=="both"&&J!=="height"||!xr(k)?1:ce.height/re.height;M.scaleSelf(ye,Te);const ze=M.toString();Y.set(ze,M),Q.set(ze,H);const{imagePosition:ke}=L.fV(ze,H,L.fW);ie.set(ze,ke)}function to(H,M,k){if(!M)return;const $=k.get(H.toString()),J=k.get(M.toString());$&&J&&($.paddedRect.w===J.paddedRect.w&&$.paddedRect.h===J.paddedRect.h||L.w(`Mismatch in icon variant sizes: ${H.toString()} and ${M.toString()}`),$.usvg!==J.usvg&&L.w(`Mismatch in icon variant image types: ${H.id} and ${M.id}`))}function Hc(H,M,k,$,J,Y,Q,ie,re,ce){H.iconAtlasPositions=ce.iconPositions;const{featureData:ye,sizes:Te,textAlongLine:ze,symbolPlacement:ke,coveragePolygons:Ue,coverageTileZoom:ut,symbolAnchorInFrcCoverage:nt}=M,Je=M.hasAnySecondaryIcon||H.hasAnySecondaryIcon;for(const gt of ye){const{shapedIcon:at,verticallyShapedIcon:At,feature:Nt,shapedTextOrientations:jt,shapedText:Ht,layoutTextSize:Ct,textOffset:xi,isSDFIcon:pi,iconPrimary:kt,iconSecondary:Zt,iconTextFit:Mt,iconOffset:$t,iconCollisionBounds:mi,iconVerticalCollisionBounds:Ft,textCollisionBounds:di,elevationFeatureIndex:vr}=gt;Vo(at,ce.iconPositions,kt,Zt),Vo(At,ce.iconPositions,kt,Zt),Hl(jt,ce.iconPositions),to(kt,Zt,ce.iconPositions),(Ht||at)&&Cn(H,Nt,jt,at,At,re,Te,Ct,0,xi,pi,$,J,Q,ie,Je,Mt,$t,ze,ke,mi,Ft,di,0,0,Ue,ut,nt,vr)}k&&H.generateCollisionDebugBuffers(Y,H.collisionBoxArray,Te.textScaleFactor),H.text.uboBinder&&H.text.uboBinder.finalize(),H.icon.uboBinder&&H.icon.uboBinder.finalize()}function Vo(H,M,k,$){if(!H)return;const J=M.get(k.toString());if(J&&(H.imagePrimary=J),$){const Y=M.get($.toString());H.imageSecondary=Y}}function Hl(H,M){for(const k in H.horizontal)ar(H.horizontal[k],M);ar(H.vertical,M)}function ar(H,M){if(H){for(const k of H.positionedLines)for(const $ of k.positionedGlyphs)if($.image!==null){const J=$.image.toString();$.rect=M.get(J).paddedRect}}}function it(H,M,k,$,J,Y,Q,ie,re){const ce=Xs(Y.horizontal)||Y.vertical,ye=k.get("icon-text-fit-padding").evaluate($,{},J);let Te,ze=M;return M&&re!=="none"&&(H.allowVerticalPlacement&&Y.vertical&&(Te=L.fU(M,Y.vertical,re,ye,ie,Q)),ce&&(ze=L.fU(M,ce,re,ye,ie,Q))),{defaultShapedIcon:ze,verticallyShapedIcon:Te}}function Cn(H,M,k,$,J,Y,Q,ie,re,ce,ye,Te,ze,ke,Ue,ut,nt,Je,gt,at,At,Nt,jt,Ht,Ct,xi,pi,kt,Zt=65535){let Mt=Q.textMaxSize.evaluate(M,{},ze);Mt===void 0?Mt=ie*Q.textScaleFactor:Mt*=Q.textScaleFactor;const $t=H.layers[0].layout,mi=L.d1,Ft=L.fT(ie,Q.textScaleFactor),di=Xs(k.horizontal)||k.vertical,vr=H.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),vi=H.getAppearanceFeatureData(M.index);(nt!=="none"||vr)&&vi&&(vi.textShaping=di,vi.iconTextFitPadding=$t.get("icon-text-fit-padding").evaluate(M,{},ze),vi.fontScale=Ft,vi.textScaleFactor=Q.textScaleFactor);const _r=ke.name==="globe",Ki=H.tilePixelRatio*Mt/mi,wi=(gr=H.overscaling,H.zoom>18&&gr>2&&(gr>>=1),Math.max(L.a2/(512*gr),1)*$t.get("symbol-spacing")),Fi=$t.get("text-padding")*H.tilePixelRatio,Ii=$t.get("icon-padding")*H.tilePixelRatio,tr=L.au($t.get("text-max-angle")),jr=$t.get("icon-rotation-alignment")==="map"&&at!=="point",Gr=wi/2;var gr;H.hasAnyIconTextFit===!1&&nt!=="none"&&(H.hasAnyIconTextFit=!0);const oo=(Ai,yi,Yr)=>{if(yi.x<0||yi.x>=L.a2||yi.y<0||yi.y>=L.a2||xi&&xi.length>0&&M.properties&&kt&&kt(xi,M.properties,yi,ze,pi))return;let Er=null;if(_r){const{x:Vt,y:Zi,z:Or}=ke.projectTilePoint(yi.x,yi.y,Yr);
vendor: 5,164 bytes, line 3097
3097Er={anchor:new Qn(Vt,Zi,Or,0,void 0),up:ke.upVector(Yr,yi.x,yi.y)}}(function(Vt,Zi,Or,Mn,tn,Br,so,ao,Ci,or,kr,Rn,bn,rn,Hr,lo,Go,Hn,ir,wn,Bi,Sr,co,Ms,hn,sl,Co,Tn,Mo,Ho,Pn,Ir){const Zo=Vt.addToLineVertexArray(Zi,Mn);let hs,Rs,lt,ta,Lt,Ps,Ju,Qu=0,En=0,xa=0,dn=0,al=-1,va=-1;const st={};let ii=L.dc("");const qt=Or?Or.anchor:Zi,nn=Tn!=="none";let Ro=0,Yt=0;if(Ci._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Vi=Ci.layout.get("text-offset").evaluate(Bi,{},hn);Ro=Vi[0]*L.d1,Yt=Vi[1]*L.d1}else Ro=Ci.layout.get("text-radial-offset").evaluate(Bi,{},hn)*L.d1,Yt=hi;if(Vt.allowVerticalPlacement&&tn.vertical){const Vi=tn.vertical;if(Hr)Ps=Ao(Vi),ao&&(Ju=Ao(ao));else{const ki=Ci.layout.get("text-rotate").evaluate(Bi,{},hn)+90;lt=fa(or,qt,Zi,kr,Rn,bn,Vi,rn,ki,lo,Ir),ao&&(ta=fa(or,qt,Zi,kr,Rn,bn,ao,Hn,ki,null,Pn))}}if(Br){const Vi=Ci.layout.get("icon-rotate").evaluate(Bi,{},hn),ki=L.f$(Br,Vi,co,nn,Sr.iconScaleFactor),Po=ao?L.f$(ao,Vi,co,nn,Sr.iconScaleFactor):void 0;Rs=fa(or,qt,Zi,kr,Rn,bn,Br,Hn,Vi,null,Ho);const Dn=function(Ar,ho,fn,eu,Ta,Nr,Do,fs,br){const rc=Ar.layers[0],Et=rc.appearances;let Zn=ho.length;if(fn&&(Zn=Math.max(Zn,fn.length)),Et.length===0)return Zn;const[Ea,cl]=eu.get("icon-size-scale-range"),Sa=L.b0(1,Ea,cl);for(const nc of Et)if(nc.hasLayoutProperty("icon-image")){const Ia=Li(Ar,rc,nc,Ta,Nr,Do,Sa,br);Ia&&(Zn=Math.max(Zn,L.g1(Ia)))}return Zn}(Vt,ki,Po,Ci.layout,Bi,hn,Vt.iconAtlasPositions,0,Ms);Qu=4*Dn;const tc=Ci.layout.get("icon-size").evaluate(Bi,{},hn,Ms),ll=Sr.compositeIconSizes?Sr.compositeIconSizes[0].evaluate(Bi,{},hn,Ms):0,ic=Sr.compositeIconSizes?Sr.compositeIconSizes[1].evaluate(Bi,{},hn,Ms):0,wa=L.g0(Vt.layerIds[0],Vt.iconSizeData,tc,Br.imagePrimary.usvg?1:Sr.iconScaleFactor,ll,ic);Vt.addSymbols(Vt.icon,ki,wa,wn,ir,Bi,void 0,Or,Zi,Zo.lineStartIndex,Zo.lineLength,-1,Ms,hn,sl,Co,Vt.symbolInstances.length,Dn),al=Vt.icon.placedSymbolArray.length-1,Po&&(En=4*Dn,Vt.addSymbols(Vt.icon,Po,wa,wn,ir,Bi,L.cL.vertical,Or,Zi,Zo.lineStartIndex,Zo.lineLength,-1,Ms,hn,sl,Co,Vt.symbolInstances.length,Dn),va=Vt.icon.placedSymbolArray.length-1)}for(const Vi in tn.horizontal){const ki=Vi,Po=tn.horizontal[ki];hs||(ii=L.dc(Po.text),Hr?Lt=Ao(Po):hs=fa(or,qt,Zi,kr,Rn,bn,Po,rn,Ci.layout.get("text-rotate").evaluate(Bi,{},hn),lo,Ir));const Dn=Po.positionedLines.length===1;if(xa+=Zl(Vt,Or,Zi,Po,so,Ci,Hr,Bi,lo,Zo,tn.vertical?L.cL.horizontal:L.cL.horizontalOnly,Dn?rs(tn.horizontal):[ki],st,al,Sr,Ms,hn,Vt.symbolInstances.length,sl),Dn)break}tn.vertical&&(dn+=Zl(Vt,Or,Zi,tn.vertical,so,Ci,Hr,Bi,lo,Zo,L.cL.vertical,["vertical"],st,va,Sr,Ms,hn,Vt.symbolInstances.length,sl));let uo=-1;const ds=(Vi,ki)=>Vi?Math.max(Vi,ki):ki;uo=ds(Lt,uo),uo=ds(Ps,uo),uo=ds(Ju,uo);const ba=uo>-1?1:0;Vt.glyphOffsetArray.length>=65535&&L.w("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Bi.sortKey!==void 0&&Vt.addToSortKeyRanges(Vt.symbolInstances.length,Bi.sortKey),Vt.symbolInstances.emplaceBack(Zi.x,Zi.y,qt.x,qt.y,qt.z,st.right>=0?st.right:-1,st.center>=0?st.center:-1,st.left>=0?st.left:-1,st.vertical>=0?st.vertical:-1,al,va,ii,hs!==void 0?hs:Vt.collisionBoxArray.length,hs!==void 0?hs+1:Vt.collisionBoxArray.length,lt!==void 0?lt:Vt.collisionBoxArray.length,lt!==void 0?lt+1:Vt.collisionBoxArray.length,Rs!==void 0?Rs:Vt.collisionBoxArray.length,Rs!==void 0?Rs+1:Vt.collisionBoxArray.length,ta||Vt.collisionBoxArray.length,ta?ta+1:Vt.collisionBoxArray.length,kr,xa,dn,Qu,En,ba,0,Ro,Yt,uo,0,nn?1:0,Mo)})(H,yi,Er,Ai,k,$,Y,J,H.layers[0],H.collisionBoxArray,M.index,M.sourceLayerIndex,H.index,Fi,gt,ce,0,Ii,jr,Je,M,Q,ye,Te,ze,Ue,ut,nt,Zt,At,Nt,jt)};if(at==="line")for(const Ai of L.cZ(M.geometry,0,0,L.a2,L.a2)){const yi=Wa(Ai,wi,tr,k.vertical||di,$,mi,Ki,H.overscaling,L.a2);for(const Yr of yi)di&&io(H,di.text,Gr,Yr)||oo(Ai,Yr,ze)}else if(at==="line-center"){for(const Ai of M.geometry)if(Ai.length>1){const yi=ju(Ai,tr,k.vertical||di,$,mi,Ki);yi&&oo(Ai,yi,ze)}}else if(M.type==="Polygon")for(const Ai of L.fZ(M.geometry,0)){const yi=Xa(Ai,16);oo(Ai[0],new Qn(yi.x,yi.y,0,0,void 0),ze)}else if(M.type==="LineString")for(const Ai of M.geometry)oo(Ai,new Qn(Ai[0].x,Ai[0].y,0,0,void 0),ze);else if(M.type==="Point")for(const Ai of M.geometry)for(const yi of Ai)oo([yi],new Qn(yi.x,yi.y,0,0,void 0),ze)}function Zl(H,M,k,$,J,Y,Q,ie,re,ce,ye,Te,ze,ke,Ue,ut,nt,Je,gt){const at=L.g2(k,$,re,Y,Q,ie,J,H.allowVerticalPlacement,void 0,Ue.textScaleFactor),At=Y.layout.get("text-size").evaluate(ie,{},nt),Nt=Ue.compositeTextSizes?Ue.compositeTextSizes[0].evaluate(ie,{},nt):0,jt=Ue.compositeTextSizes?Ue.compositeTextSizes[1].evaluate(ie,{},nt):0,Ht=L.g0(H.layerIds[0],H.textSizeData,At,Ue.textScaleFactor,Nt,jt);H.addSymbols(H.text,at,Ht,re,Q,ie,ye,M,k,ce.lineStartIndex,ce.lineLength,ke,ut,nt,gt,!1,Je,at.length);for(const Ct of Te)ze[Ct]=H.text.placedSymbolArray.length-1;return 4*at.length}function Xs(H){for(const M in H)return H[M];return null}function fa(H,M,k,$,J,Y,Q,ie,re,ce,ye){let Te,ze,ke,Ue;if(Te=ye?ye.top:Q.top,ze=ye?ye.bottom:Q.bottom,ke=ye?ye.left:Q.left,Ue=ye?ye.right:Q.right,ti(Q)&&Q.collisionPadding){const ut=Q.collisionPadding;ke-=ut[0],Te-=ut[1],Ue+=ut[2],ze+=ut[3]}
3097if(re){const ut=new L.P(ke,Te),nt=new L.P(Ue,Te),Je=new L.P(ke,ze),gt=new L.P(Ue,ze),at=L.au(re);let At=new L.P(0,0);ce&&(At=new L.P(ce[0],ce[1])),ut._rotateAround(at,At),nt._rotateAround(at,At),Je._rotateAround(at,At),gt._rotateAround(at,At),ke=Math.min(ut.x,nt.x,Je.x,gt.x),Ue=Math.max(ut.x,nt.x,Je.x,gt.x),Te=Math.min(ut.y,nt.y,Je.y,gt.y),ze=Math.max(ut.y,nt.y,Je.y,gt.y)}return H.emplaceBack(M.x,M.y,M.z,k.x,k.y,ke,Te,Ue,ze,ie,$,J,Y),H.length-1}function Ao(H){ti(H)&&H.collisionPadding&&(H.top-=H.collisionPadding[1],H.bottom+=H.collisionPadding[3]);const M=H.bottom-H.top;return M>0?Math.max(10,M):null}function io(H,M,k,$){const J=H.compareText;if(M in J){const Y=J[M];for(let Q=Y.length-1;Q>=0;Q--)if($.dist(Y[Q])<k)return!0}else J[M]=[];return J[M].push($),!1}const Zc=1*L.g4;class pa{constructor(M){const k={},$=[];for(const ie in M){const re=M[ie],ce=k[ie]={};for(const ye in re.glyphs){const Te=re.glyphs[+ye];if(!Te||Te.bitmap.width===0||Te.bitmap.height===0)continue;const ze=Te.metrics.localGlyph?Zc:1,ke={x:0,y:0,w:Te.bitmap.width+2*ze,h:Te.bitmap.height+2*ze};$.push(ke),ce[ye]=ke}}const{w:J,h:Y}=L.p($),Q=new L.g3({width:J||1,height:Y||1});for(const ie in M){const re=M[ie];for(const ce in re.glyphs){const ye=re.glyphs[+ce];if(!ye||ye.bitmap.width===0||ye.bitmap.height===0)continue;const Te=k[ie][ce],ze=ye.metrics.localGlyph?Zc:1;L.g3.copy(ye.bitmap,Q,{x:0,y:0},{x:Te.x+ze,y:Te.y+ze},ye.bitmap)}}this.image=Q,this.positions=k}}function Ya(H){for(const M of H)if(M.hdExt!=null||M.requiresHDRuntime)return!0;return!1}function Ys(H){for(const M of H)if(M.requiresStandardRuntime)return!0;return!1}function Xr(H,M,k){const $=H!=null&&!!L.g7&&L.g7(H.sourceLayers,M,k);return{applies:$,frcMask:$&&H?H.frcMask:null,polygons:$&&H?H.polygons:null,tileZoom:$&&H?H.tileZoom:null}}L.fE(pa,"GlyphAtlas");class Ks{constructor(M){this.tileID=new L.bP(M.tileID.overscaledZ,M.tileID.wrap,M.tileID.canonical.z,M.tileID.canonical.x,M.tileID.canonical.y),this.tileZoom=M.tileZoom,this.uid=M.uid,this.zoom=M.zoom,this.lut=M.lut,this.canonical=M.tileID.canonical,this.pixelRatio=M.pixelRatio,this.tileSize=M.tileSize,this.source=M.source,this.scope=M.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=M.showCollisionBoxes,this.showElevationIdDebug=M.showElevationIdDebug,this.collectResourceTiming=!!M.request&&M.request.collectResourceTiming,this.promoteId=M.promoteId,this.renderSourceType=M.renderSourceType,this.frcCoverage=M.frcCoverage||null,this.elevation=M.elevation||null,this.crossSourceElevationEnabled=!!M.crossSourceElevationEnabled,this.terrainEnabled=!!M.terrainEnabled,this.deferRoadStructure=!1,this.tileTransform=L.bp(M.tileID.canonical,M.projection),this.projection=M.projection,this.worldview=M.worldview,this.localizableLayerIds=M.localizableLayerIds,this.brightness=M.brightness,this.extraShadowCaster=!!M.extraShadowCaster,this.tessellationStep=M.tessellationStep,this.scaleFactor=M.scaleFactor,this.worldview=M.worldview,this.indoor=M.indoor}isLayerActiveForTile(M){return!(this.renderSourceType===L.bR.Symbol&&M.type!=="symbol"||this.renderSourceType===L.bR.FillExtrusion&&M.type!=="fill-extrusion"||this.renderSourceType===L.bR.Other&&(M.type==="symbol"||M.type==="fill-extrusion")||this.renderSourceType===L.bR.HdRoadElevation||M.minzoom&&this.zoom<Math.floor(M.minzoom)||M.maxzoom&&this.zoom>=M.maxzoom||M.visibility==="none")}parse(M,k,$,J,Y,Q){this._parseAfterHD(M,k,$,J,Y,Q)}_parseAfterHD(M,k,$,J,Y,Q){let ie;if(this.status="parsing",this.data=M,this.renderSourceType===L.bR.HdRoadCoverage){const nt=M.layers[L.bU];ie=nt&&Vc?Vc(nt):[]}this.collisionBoxArray=new L.bt;const re=new L.g5(Object.keys(M.layers).sort()),ce=new L.fz(this.tileID,this.promoteId);ce.bucketLayerIDs=[];const ye={},Te=new L.g6(256,256),ze={featureIndex:ce,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Te,availableImages:$,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,elevationParams:this.elevation,crossSourceElevationEnabled:this.crossSourceElevationEnabled,terrainEnabled:this.terrainEnabled,activeFloors:void 0};this.indoor&&si&&(ze.activeFloors=si(M,this.indoor,Y,this.canonical));const ke=[],Ue=k.familiesBySource[this.source];if(this.renderSourceType===L.bR.HdRoadElevation){const nt=Kn&&Kn(M,this.canonical)||[],Je=new pa({});return this.status="done",void Q(null,{buckets:[],containsHdExt:!1,containsStandardExt:!1,featureIndex:ce,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Je.image,lineAtlas:Te,imageAtlas:null,brightness:this.brightness,parsedElevationFeatures:nt})}if(this.deferRoadStructure=!1,this.renderSourceType!==L.bR.HdRoadCoverage&&this.frcCoverage!=null&&!this.frcCoverage.resolved&&this.frcCoverage.frcMask===null){for(const nt in Ue)if(L.g7&&L.g7(this.frcCoverage.sourceLayers,this.source,nt)){this.deferRoadStructure=!0;break}}for(const nt in Ue){const Je=M.layers[nt];
3097if(!Je)continue;let gt=!1,at=!1,At=!1,Nt=!1;for(const kt of Ue[nt])kt[0].type==="symbol"?gt=!0:kt[0].type==="fill-extrusion"?at=!0:At=!0,kt[0].is3D()&&kt[0].type!=="model"&&(Nt=!0);if(this.extraShadowCaster&&!Nt||this.renderSourceType===L.bR.Symbol&&!gt||this.renderSourceType===L.bR.FillExtrusion&&!at||(this.renderSourceType===L.bR.Other||this.renderSourceType===L.bR.HdRoadCoverage)&&!At)continue;const jt=this.frcCoverage!=null&&!!L.g7&&L.g7(this.frcCoverage.sourceLayers,this.source,nt);if(this.deferRoadStructure&&jt)continue;Je.version===1&&L.w(`Vector tile source "${this.source}" layer "${nt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ht=re.encode(nt),Ct=[],xi=this.localizableLayerIds&&this.localizableLayerIds.has(nt);let pi=!1;for(let kt=0,Zt=0;kt<Je.length;kt++){const Mt=Je.feature(kt),$t=ce.getId(Mt,nt),mi=Mt.properties?Mt.properties.worldview:null;if(xi&&this.worldview&&typeof mi=="string")if(mi==="all")Mt.properties.$localized=!0;else{if(!mi.split(",").includes(this.worldview))continue;Mt.properties.$localized=!0,Mt.properties.worldview=this.worldview}!pi&&Mt.properties&&Object.hasOwn(Mt.properties,L.fO)&&(pi=!0),jt&&this.frcCoverage&&this.frcCoverage.frcMask&&Mt.properties&&L.g8&&L.g8(Mt.properties,this.frcCoverage.frcMask)||(Ct.push({feature:Mt,id:$t,index:Zt,sourceLayerIndex:Ht}),Zt++)}pi&&!ze.elevationFeatures&&Kn&&(ze.elevationFeatures=Kn(M,this.canonical));for(const kt of Ue[nt]){const Zt=kt[0];if(this.extraShadowCaster&&(!Zt.is3D()||Zt.type==="model")||this.renderSourceType===L.bR.Symbol&&Zt.type!=="symbol"||this.renderSourceType===L.bR.FillExtrusion&&Zt.type!=="fill-extrusion"||!(this.renderSourceType!==L.bR.Other&&this.renderSourceType!==L.bR.HdRoadCoverage||Zt.type!=="symbol"&&Zt.type!=="fill-extrusion")||!this.isLayerActiveForTile(Zt))continue;const Mt=ce.bucketLayerIDs.length;ce.bucketLayerIDs.push(kt.map(mi=>L.m(mi.id,mi.scope)));const $t=()=>{$l(kt,this.zoom,ze.brightness,$,this.worldview,ze.activeFloors);const mi=ye[Zt.id]=Zt.createBucket({index:Mt,layers:kt,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ht,sourceLayerName:nt,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:J,worldview:this.worldview,localizable:xi,availableImages:$,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords});zt&&zt(mi,this.frcCoverage?this.frcCoverage.sourceLayers:null),mi.populate(Ct,ze,this.tileID.canonical,this.tileTransform)};Zt.mayUse("HD")||Zt.mayUse("Standard")?ke.push(Zt.prepare().then(()=>$t())):$t()}}const ut=()=>{Te.trim();const nt=!(!ze.elevationFeatures||!ze.elevationFeatures.some(kt=>kt.heightRange.min<0));let Je,gt,at,At,Nt,jt,Ht;const Ct={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},xi=()=>{if(Je)return this.status="done",Q(Je);if(this.extraShadowCaster){this.status="done";const kt=Object.values(ye).filter(Mt=>!Mt.isEmpty()),Zt=ze.elevationFeatures;Q(null,{buckets:kt,containsHdExt:Ya(kt),containsStandardExt:Ys(kt),featureIndex:ce,collisionBoxArray:null,hasTunnelGeometry:nt,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ze.brightness,hasDeferredElevationFeatures:!!Wi&&Wi(ye),parsedElevationFeatures:Zt,glyphMap:null,iconMap:null,glyphPositions:null})}else if(gt&&at&&At&&Ht){const Zt=new pa(gt),Mt=new Map;for(const[mi,Ft]of at.entries()){const{imagePosition:di}=L.fV(mi,Ft,L.fW);Mt.set(mi,di)}const $t={};for(const mi in ye){const Ft=ye[mi];if(Ft instanceof L.bu){$l(Ft.layers,this.zoom,ze.brightness,$,this.worldview,ze.activeFloors);const di=Xr(this.frcCoverage,this.source,Ft.layers[0].sourceLayer);$t[mi]=da(Ft,gt,Zt.positions,at,Mt,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Nt,this.worldview,$,di.frcMask,di.polygons,di.tileZoom,L.g8||null,Vl||null)}}Nt.size||jt.size?this.rasterizeTask=Y.sendCancelable("rasterizeImages",{scope:this.scope,iconTasks:Nt,patternTasks:jt},{},(mi,Ft)=>{if(!mi)for(const[di,vr]of Ft.entries())at.has(di)&&at.set(di,Object.assign(at.get(di),{data:vr})),At.has(di)&&At.set(di,Object.assign(At.get(di),{data:vr}));pi($t,Zt,void 0,Ht)}):pi($t,Zt,void 0,Ht)}},pi=(kt,Zt,Mt,$t)=>{const mi=at.size>0||At.size>0,Ft=Object.keys(kt).length>0,di=ze.elevationFeatures;if(!mi&&!Ft){this.status="done";const vi=Object.values(ye).filter(_r=>!_r.isEmpty());return void Q(null,{buckets:vi,containsHdExt:Ya(vi),containsStandardExt:Ys(vi),featureIndex:ce,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:nt,glyphAtlasImage:Zt.image,lineAtlas:Te,imageAtlas:null,brightness:ze.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:ie,hasDeferredElevationFeatures:!!Wi&&Wi(ye),parsedElevationFeatures:di})}const vr=(vi,_r)=>{for(const wi in ye){const Fi=ye[wi];if(wi in kt)Hc(Fi,kt[wi],this.showCollisionBoxes,$,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,at,_r);else if(Fi.hasPattern&&(Fi instanceof L.bz||Fi instanceof L.bA||Fi instanceof L.aC)){$l(Fi.layers,this.zoom,ze.brightness,$,this.worldview,ze.activeFloors);const Ii=Object.fromEntries(_r.patternPositions);Fi.addFeatures(ze,this.tileID.canonical,Ii,$,this.tileTransform,this.brightness)}}this.status="done";const Ki=Object.values(ye).filter(wi=>!wi.isEmpty());Q(null,{buckets:Ki,containsHdExt:Ya(Ki),containsStandardExt:Ys(Ki),featureIndex:ce,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:nt,glyphAtlasImage:Zt.image,lineAtlas:Te,imageAtlas:vi,brightness:ze.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:ie,hasDeferredElevationFeatures:!!Wi&&Wi(ye),parsedElevationFeatures:di})};if(mi){const vi=new Map,_r=L.ga(at,vi),Ki=L.ga(At,vi),wi=new L.gb(_r,Ki,$t,this.lut,this.scope,vi);Y.send("checkAtlasCache",{descriptor:wi,scope:this.scope}).then(Fi=>{let Ii,tr;if(Fi)Ii=new L.gc(Fi.sourceHash),tr=Fi;else{const jr=new L.gd(at,At,this.lut,$t,this.scope);Ii=jr,tr=jr}vr(Ii,tr)}).catch(Fi=>{Fi.name!=="AbortError"&&L.w(`[Worker] Error checking atlas cache: ${Fi.message}`);const Ii=new L.gd(at,At,this.lut,$t,this.scope);
vendor: 6,525 bytes, line 3097
3097vr(Ii,Ii)})}else vr(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){const kt=L.g9(ze.glyphDependencies,$t=>Object.keys($t).map(Number));Object.keys(kt).length?Y.send("getGlyphs",{uid:this.uid,stacks:kt},{metadata:Ct}).then($t=>{Je||(gt=$t,xi())}).catch($t=>{Je||(Je=$t,xi())}):gt={},Ht=new Map;const Zt=Array.from(ze.iconDependencies.keys()).map($t=>L.I.parse($t)),Mt=Array.from(ze.patternDependencies.keys()).map($t=>L.I.parse($t));Zt.length||Mt.length?Y.send("getImages",{icons:Zt,patterns:Mt,source:this.source,scope:this.scope,tileID:this.tileID},{metadata:Ct}).then($t=>{if(!Je){at=new Map,At=new Map,Nt=this.updateImageMapAndGetImageTaskQueue(at,$t.images,ze.iconDependencies),jt=this.updateImageMapAndGetImageTaskQueue(At,$t.images,ze.patternDependencies);for(const[mi,Ft]of $t.versions.entries())Ht.set(mi,Ft);xi()}}).catch($t=>{Je||(Je=$t,xi())}):(at=new Map,At=new Map,Nt=new Map,jt=new Map)}Lr&&Lr({buckets:ye,data:M,sourceLayerCoder:re,canonical:this.tileID.canonical,options:ze}),xi()};ke.length>0?Promise.allSettled(ke).then(ut).catch(Q):ut()}updateParameters(M){this.scaleFactor=M.scaleFactor,this.showCollisionBoxes=M.showCollisionBoxes,this.showElevationIdDebug=M.showElevationIdDebug,this.projection=M.projection,this.brightness=M.brightness,this.tileTransform=L.bp(M.tileID.canonical,M.projection),this.extraShadowCaster=M.extraShadowCaster,this.lut=M.lut,this.worldview=M.worldview,this.indoor=M.indoor,this.frcCoverage=M.frcCoverage||null,this.elevation=M.elevation||null,this.terrainEnabled=!!M.terrainEnabled}updateImageMapAndGetImageTaskQueue(M,k,$){const J=new Map;for(const Y of k.keys()){const Q=$.get(Y)||[];for(const ie of Q){const re=ie.toString(),ce=k.get(ie.id.toString());ce.usvg?J.has(re)||(J.set(re,ie),M.set(re,{...ce})):M.set(re,ce)}}return J}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.abort()}}function $l(H,M,k,$,J,Y){const Q=new L.ai(M,{brightness:k,worldview:J,activeFloors:Y});for(const ie of H)ie.recalculate(Q,$)}class os extends L.E{constructor({actor:M,layerIndex:k,availableImages:$,availableModels:J,isSpriteLoaded:Y,tileProvider:Q,brightness:ie,maxUniformBufferBindings:re,maxUniformBlockSizeDwords:ce}){super(),this.actor=M,this.layerIndex=k,this.availableImages=$,this.availableModels=J,this.loadVectorData=L.ch,this.tileProvider=Q,this.loading={},this.loaded={},this.deduped=new L.cc(M.scheduler),this.isSpriteLoaded=Y,this.scheduler=M.scheduler,this.brightness=ie,this.maxUniformBufferBindings=re,this.maxUniformBlockSizeDwords=ce}loadTileData(M,k){if(!this.tileProvider)return this.loadVectorData(M,k);const $=new AbortController;return this.loadTileWithProvider(this.tileProvider,M,$,k),()=>$.abort()}async loadTileWithProvider(M,k,$,J){const{z:Y,x:Q,y:ie}=k.tileID.canonical;try{const re=await M.loadTile({z:Y,x:Q,y:ie},{request:k.request,signal:$.signal});if($.signal.aborted)return;if(re==null){const ye=new Error("Tile not found");return ye.status=404,J(ye)}if(re.data==null)return J(null,null);if(re.data instanceof ImageBitmap)return J(new Error("Vector tiles require ArrayBuffer data"));const ce=new Headers;re.expires&&ce.set("expires",re.expires),re.cacheControl&&ce.set("cache-control",re.cacheControl),J(null,{rawData:re.data,headers:ce})}catch(re){if($.signal.aborted)return;J(re instanceof Error?re:new Error(String(re)))}}_fetchTileData(M,k){return new Promise(($,J)=>{M.abort=this.loadTileData(k,(Y,Q)=>{Y?J(Y):$(Q)})})}async _parse(M,k){const $=!this.isSpriteLoaded;return $&&await this.once("isSpriteLoaded"),new Promise((J,Y)=>{const Q=()=>M.parse(M.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(ie,re)=>{ie?Y(ie):J(re)});$&&this.scheduler?this.scheduler.add(Q,{type:"parseTile",renderSourceType:k.renderSourceType,zoom:k.tileZoom}):Q()})}async loadTile(M){const k=M.uid,$=M&&M.request,J=$&&$.collectResourceTiming,Y=this.loading[k]=new Ks(M);Y.maxUniformBufferBindings=this.maxUniformBufferBindings,Y.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords;const Q=(Ue,ut)=>{const nt=Y.reloadCallback;nt&&(delete Y.reloadCallback,Ue||!ut?nt(Ue,null):Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,nt))};let ie,re;try{ie=await this._fetchTileData(Y,M)}catch(Ue){re=Ue}const ce=!this.loading[k];if(delete this.loading[k],Y.cancelRasterize(),re||ce||!ie){if(Y.status="done",ce||(this.loaded[k]=Y),re)throw re;return null}const ye=ie.rawData;let Te;Y.vectorTile=ie.vectorTile||new L.ge(new L.cB(ye)),this.loaded=this.loaded||{},this.loaded[k]=Y;try{Te=await this._parse(Y,M)}catch(Ue){throw Q(Ue),Ue}if(!Te)return Q(null,null),null;const ze={};if(J){const Ue=To($);Ue.length>0&&(ze.resourceTiming=JSON.parse(JSON.stringify(Ue)))}const ke={rawTileData:ye.slice(0),headers:ie.headers,...Te,...ze};return Q(null,Te),ke}async reloadTile(M){const k=this.loaded,$=M.uid;if(k&&k[$])return new Promise((J,Y)=>{const Q=k[$];Q.updateParameters(M);const ie=(re,ce)=>{const ye=Q.reloadCallback;ye&&(delete Q.reloadCallback,Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ye)),re?Y(re):J(ce)};Q.status==="parsing"?Q.reloadCallback=ie:Q.status==="done"?Q.vectorTile?Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ie):ie():J(void 0)})}abortTile(M){const k=M.uid,$=this.loading[k];$&&($.abort&&$.abort(),delete this.loading[k])}removeTile(M){const k=this.loaded,$=M.uid;k&&k[$]&&delete k[$]}}class Js{constructor(M){this.tileProvider=M.tileProvider,this.loading={}}async loadTile(M){const k=M.uid,$=new AbortController;if(this.loading[k]={cancel:()=>$.abort()},this.tileProvider)return this.loadTileWithProvider(this.tileProvider,k,M,$);try{const{data:J,headers:Y}=await L.cC(M.request,$.signal);if(!J)return null;const Q=await this.decodeTile(k,J,M.encoding);return Q.headers=Y,Q}catch(J){if($.signal.aborted)return null;throw J}finally{delete this.loading[k]}}async decodeTile(M,k,$){const J=k instanceof ImageBitmap?k:await createImageBitmap(new Blob([new Uint8Array(k)],{type:"image/png"})),Y=1-(J.width-L.gf(J.width))/2,Q=Y<1,ie=this.getImageData(J,Y);return J.close(),{dem:new L.gg(M,ie,$,Q),borderReady:Q}}async loadTileWithProvider(M,k,$,J){const{z:Y,x:Q,y:ie}=$.tileID.canonical;try{const re=await M.loadTile({z:Y,x:Q,y:ie},{request:$.request,signal:J.signal});if(J.signal.aborted)return null;if(re==null){const Te=new Error("Tile not found");throw Te.status=404,Te}if(re.data==null)return null;const ce=await this.decodeTile(k,re.data,$.encoding);
3097if(J.signal.aborted)return null;const ye=new Headers;return re.expires&&ye.set("expires",re.expires),re.cacheControl&&ye.set("cache-control",re.cacheControl),ce.headers=ye,ce}catch(re){if(J.signal.aborted)return null;throw re}finally{delete this.loading[k]}}async reloadTile(M){}abortTile(M){const k=M.uid,$=this.loading[k];$&&($.cancel(),delete this.loading[k])}removeTile(M){}getImageData(M,k){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(M.width,M.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=M.width,this.offscreenCanvas.height=M.height,this.offscreenCanvasContext.drawImage(M,0,0,M.width,M.height);const $=this.offscreenCanvasContext.getImageData(-k,-k,M.width+2*k,M.height+2*k);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),$}}const Ka=L.gh.prototype.toGeoJSON;class ql{constructor(M){this._feature=M,this.extent=L.a2,this.type=M.type,this.properties=M.tags,"id"in M&&!isNaN(M.id)&&(this.id=parseInt(M.id,10))}loadGeometry(){if(this._feature.type===1){const M=[];for(const k of this._feature.geometry)M.push([new L.P(k[0],k[1])]);return M}{const M=[];for(const k of this._feature.geometry){const $=[];for(const J of k)$.push(new L.P(J[0],J[1]));M.push($)}return M}}toGeoJSON(M,k,$){return Ka.call(this,M,k,$)}}class ma{constructor(M,k){this.name=M,this.extent=L.a2,this.length=k.length,this._jsonFeatures=k}feature(M){return new ql(this._jsonFeatures[M])}}class Ja{constructor(M){this.layers={},this.extent=L.a2;for(const k of Object.keys(M))this.layers[k]=new ma(k,M[k])}}const ss=64/4096;class $c{constructor(){this.features=new Map}clear(){this.features.clear()}load(M=[],k){for(const $ of M){const J=$.id;if(J==null)continue;let Y=this.features.get(J);Y&&this.updateCache(Y,k),$.geometry?(Y=as($),this.updateCache(Y,k),this.features.set(J,Y)):this.features.delete(J),this.updateCache(Y,k)}}updateCache(M,k){for(const{canonical:$,uid:J}of Object.values(k)){const{z:Y,x:Q,y:ie}=$;Le(M,Math.pow(2,Y),Q,ie)&&delete k[J]}}getTile(M,k,$){const J=Math.pow(2,M),Y=[];for(const Q of this.features.values())Le(Q,J,k,$)&&Y.push(Hu(Q,J,k,$));return{features:Y}}getFeatures(){return[...this.features.values()]}}function Le({minX:H,minY:M,maxX:k,maxY:$},J,Y,Q){return H<(Y+1+ss)/J&&M<(Q+1+ss)/J&&k>(Y-ss)/J&&$>(Q-ss)/J}function as(H){const{id:M,geometry:k,properties:$}=H;if(!k)return;if(k.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:J,coordinates:Y}=k,Q={id:M,type:1,geometry:[],tags:$,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},ie=Q.geometry;if(J==="Point")Qa(Y,ie,Q);else if(J==="MultiPoint")for(const re of Y)Qa(re,ie,Q);else if(J==="LineString")Q.type=2,Qs(Y,ie,Q);else if(J==="MultiLineString")Q.type=2,Wl(Y,ie,Q);else if(J==="Polygon")Q.type=3,Wl(Y,ie,Q,!0);else{if(J!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");Q.type=3;for(const re of Y)Wl(re,ie,Q,!0)}return Q}function Qa([H,M],k,$){const J=L.a7(H);let Y=L.a8(M);Y=Y<0?0:Y>1?1:Y,k.push(J,Y),$.minX=Math.min($.minX,J),$.minY=Math.min($.minY,Y),$.maxX=Math.max($.maxX,J),$.maxY=Math.max($.maxY,Y)}function Qs(H,M,k,$=!1,J=!1){const Y=[];for(const Q of H)Qa(Q,Y,k);M.push(Y),$&&function(Q,ie){let re=0;for(let ce=0,ye=Q.length,Te=ye-2;ce<ye;Te=ce,ce+=2)re+=(Q[ce]-Q[Te])*(Q[ce+1]+Q[Te+1]);if(re>0===ie)for(let ce=0,ye=Q.length;ce<ye/2;ce+=2){const Te=Q[ce],ze=Q[ce+1];Q[ce]=Q[ye-2-ce],Q[ce+1]=Q[ye-1-ce],Q[ye-2-ce]=Te,Q[ye-1-ce]=ze}}(Y,J)}function Wl(H,M,k,$=!1){for(let J=0;J<H.length;J++)Qs(H[J],M,k,$,J===0)}function Hu(H,M,k,$){const{id:J,type:Y,geometry:Q,tags:ie}=H,re=[];if(Y===1)(function(ce,ye,Te,ze,ke){for(let Ue=0;Ue<ce.length;Ue+=2){const ut=Math.round(L.a2*(ce[Ue+0]*ye-Te)),nt=Math.round(L.a2*(ce[Ue+1]*ye-ze));ke.push([ut,nt])}})(Q,M,k,$,re);else if(Y===2)for(const ce of Q)Zu(ce,M,k,$,re);else if(Y===3)for(const ce of Q)Si(ce,M,k,$,re);return{id:J,type:Y,geometry:re,tags:ie}}function Zu(H,M,k,$,J){const Q=L.a2+128;let ie;for(let re=0;re<H.length-2;re+=2){let ce=Math.round(L.a2*(H[re+0]*M-k)),ye=Math.round(L.a2*(H[re+1]*M-$)),Te=Math.round(L.a2*(H[re+2]*M-k)),ze=Math.round(L.a2*(H[re+3]*M-$));const ke=Te-ce,Ue=ze-ye;ce<-128&&Te<-128||(ce<-128?(ye+=Math.round(Ue*((-128-ce)/ke)),ce=-128):Te<-128&&(ze=ye+Math.round(Ue*((-128-ce)/ke)),Te=-128),ye<-128&&ze<-128||(ye<-128?(ce+=Math.round(ke*((-128-ye)/Ue)),ye=-128):ze<-128&&(Te=ce+Math.round(ke*((-128-ye)/Ue)),ze=-128),ce>=Q&&Te>=Q||(ce>=Q?(ye+=Math.round(Ue*((Q-ce)/ke)),ce=Q):Te>=Q&&(ze=ye+Math.round(Ue*((Q-ce)/ke)),Te=Q),ye>=Q&&ze>=Q||(ye>=Q?(ce+=Math.round(ke*((Q-ye)/Ue)),ye=Q):ze>=Q&&(Te=ce+Math.round(ke*((Q-ye)/Ue)),ze=Q),ie&&ce===ie.at(-1)[0]&&ye===ie.at(-1)[1]||(ie=[[ce,ye]],J.push(ie)),ie.push([Te,ze])))))}}function Si(H,M,k,$,J){const Y=(k-ss)/M,Q=($-ss)/M,ie=(k+1+ss)/M,re=($+1+ss)/M;function ce(ze,ke){let Ue=0;return ze<Y?Ue|=1:ze>ie&&(Ue|=2),ke<Q?Ue|=4:ke>re&&(Ue|=8),Ue}let ye=[];for(let ze=1;ze<=8;ze*=2){let ke=H[H.length-2],Ue=H.at(-1),ut=!(ce(ke,Ue)&ze);for(let nt=0;nt<H.length;nt+=2){const Je=H[nt],gt=H[nt+1],at=!(ce(Je,gt)&ze);at!==ut&&(8&ze?ye.push(ke+(Je-ke)*(re-Ue)/(gt-Ue),re):4&ze?ye.push(ke+(Je-ke)*(Q-Ue)/(gt-Ue),Q):2&ze?ye.push(ie,Ue+(gt-Ue)*(ie-ke)/(Je-ke)):1&ze&&ye.push(Y,Ue+(gt-Ue)*(Y-ke)/(Je-ke))),at&&ye.push(Je,gt),ke=Je,Ue=gt,ut=at}if(!(H=ye).length||ze===8)break;ye=[]}const Te=[];for(let ze=0;ze<ye.length;ze+=2)Te.push([Math.round(L.a2*(ye[ze]*M-k)),Math.round(L.a2*(ye[ze+1]*M-$))]);Te.length&&J.push(Te)}function zr({name:H,features:M},k){k.writeStringField(1,H),k.writeVarintField(5,L.a2);const $=new Map,J=new Map,Y={keys:$,values:J,feature:null};for(const Q of M)Y.feature=Q,k.writeMessage(2,el,Y);for(const Q of $.keys())k.writeStringField(3,Q);for(const Q of J.keys())k.writeMessage(4,ea,Q)}function el(H,M){const k=H.feature;k.id!==void 0&&Number.isSafeInteger(+k.id)&&M.writeVarintField(1,+k.id),k.tags&&M.writeMessage(2,$u,H),M.writeVarintField(3,k.type),M.writeMessage(4,qc,k)}function $u({keys:H,values:M,feature:k},$){for(const J of Object.keys(k.tags)){let Y=k.tags[J];if(Y===null)continue;let Q=H.get(J);Q===void 0&&(Q=H.size,H.set(J,Q)),$.writeVarint(Q);const ie=typeof Y;ie!=="string"&&ie!=="boolean"&&ie!=="number"&&(Y=JSON.stringify(Y));let re=M.get(Y);re===void 0&&(re=M.size,M.set(Y,re)),$.writeVarint(re)}}function un(H,M){return(M<<3)+(7&H)}function Un(H){return H<<1^H>>31}function qc(H,M){const{geometry:k,type:$}=H;let J=0,Y=0;
3097if($===1){M.writeVarint(un(1,k.length));for(const Q of k){const ie=Q[0]-J,re=Q[1]-Y;M.writeVarint(Un(ie)),M.writeVarint(Un(re)),J+=ie,Y+=re}}else for(const Q of k){if(Q.length===0)continue;M.writeVarint(un(1,1));const ie=Q.length-($===3?1:0);for(let re=0;re<ie;re++){re===1&&M.writeVarint(un(2,ie-1));const ce=Q[re][0]-J,ye=Q[re][1]-Y;M.writeVarint(Un(ce)),M.writeVarint(Un(ye)),J+=ce,Y+=ye}$===3&&M.writeVarint(un(7,1))}}function ea(H,M){const k=typeof H;k==="string"?M.writeStringField(1,H):k==="boolean"?M.writeBooleanField(7,H):k==="number"&&(H%1!=0?M.writeDoubleField(3,H):H<0?M.writeSVarintField(6,H):M.writeVarintField(5,H))}const tl={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:H=>H},Wc=Math.fround||(_a=new Float32Array(1),H=>(_a[0]=+H,_a[0]));var _a;class qu{constructor(M){this.options=Object.assign(Object.create(tl),M),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(M){const{log:k,minZoom:$,maxZoom:J}=this.options;k&&console.time("total time");const Y=`prepare ${M.length} points`;k&&console.time(Y),this.points=M;const Q=[];for(let re=0;re<M.length;re++){const ce=M[re];
vendor: 4,261 bytes, line 3097
3097if(!ce.geometry)continue;const[ye,Te]=ce.geometry.coordinates,ze=Wc(il(ye)),ke=Wc(ga(Te));Q.push(ze,ke,1/0,re,-1,1),this.options.reduce&&Q.push(0)}let ie=this.trees[J+1]=this._createTree(Q);k&&console.timeEnd(Y);for(let re=J;re>=$;re--){const ce=+Date.now();ie=this.trees[re]=this._createTree(this._cluster(ie,re)),k&&console.log("z%d: %d clusters in %dms",re,ie.numItems,+Date.now()-ce)}return k&&console.timeEnd("total time"),this}getClusters(M,k){let $=((M[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,M[1]));let Y=M[2]===180?180:((M[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,M[3]));if(M[2]-M[0]>=360)$=-180,Y=180;else if($>Y){const Te=this.getClusters([$,J,180,Q],k),ze=this.getClusters([-180,J,Y,Q],k);return Te.concat(ze)}const ie=this.trees[this._limitZoom(k)],re=ie.range(il($),ga(Q),il(Y),ga(J)),ce=ie.data,ye=[];for(const Te of re){const ze=this.stride*Te;ye.push(ce[ze+5]>1?Bt(ce,ze,this.clusterProps):this.points[ce[ze+3]])}return ye}getChildren(M){const k=this._getOriginId(M),$=this._getOriginZoom(M),J="No cluster with the specified id.",Y=this.trees[$];if(!Y)throw new Error(J);const Q=Y.data;if(k*this.stride>=Q.length)throw new Error(J);const ie=this.options.radius/(this.options.extent*Math.pow(2,$-1)),re=Y.within(Q[k*this.stride],Q[k*this.stride+1],ie),ce=[];for(const ye of re){const Te=ye*this.stride;Q[Te+4]===M&&ce.push(Q[Te+5]>1?Bt(Q,Te,this.clusterProps):this.points[Q[Te+3]])}if(ce.length===0)throw new Error(J);return ce}getLeaves(M,k,$){const J=[];return this._appendLeaves(J,M,k=k||10,$=$||0,0),J}getTile(M,k,$){const J=this.trees[this._limitZoom(M)],Y=Math.pow(2,M),{extent:Q,radius:ie}=this.options,re=ie/Q,ce=($-re)/Y,ye=($+1+re)/Y,Te={features:[]};return this._addTileFeatures(J.range((k-re)/Y,ce,(k+1+re)/Y,ye),J.data,k,$,Y,Te),k===0&&this._addTileFeatures(J.range(1-re/Y,ce,1,ye),J.data,Y,$,Y,Te),k===Y-1&&this._addTileFeatures(J.range(0,ce,re/Y,ye),J.data,-1,$,Y,Te),Te.features.length?Te:null}getClusterExpansionZoom(M){let k=this._getOriginZoom(M)-1;for(;k<=this.options.maxZoom;){const $=this.getChildren(M);if(k++,$.length!==1)break;M=$[0].properties.cluster_id}return k}_appendLeaves(M,k,$,J,Y){const Q=this.getChildren(k);for(const ie of Q){const re=ie.properties;if(re&&re.cluster?Y+re.point_count<=J?Y+=re.point_count:Y=this._appendLeaves(M,re.cluster_id,$,J,Y):Y<J?Y++:M.push(ie),M.length===$)break}return Y}_createTree(M){const k=new L.d5(M.length/this.stride|0,this.options.nodeSize,Float32Array);for(let $=0;$<M.length;$+=this.stride)k.add(M[$],M[$+1]);return k.finish(),k.data=M,k}_addTileFeatures(M,k,$,J,Y,Q){for(const ie of M){const re=ie*this.stride,ce=k[re+5]>1;let ye,Te,ze;if(ce)ye=Ur(k,re,this.clusterProps),Te=k[re],ze=k[re+1];else{const ut=this.points[k[re+3]];ye=ut.properties;const[nt,Je]=ut.geometry.coordinates;Te=il(nt),ze=ga(Je)}const ke={type:1,geometry:[[Math.round(this.options.extent*(Te*Y-$)),Math.round(this.options.extent*(ze*Y-J))]],tags:ye};let Ue;Ue=ce||this.options.generateId?k[re+3]:this.points[k[re+3]].id,Ue!==void 0&&(ke.id=Ue),Q.features.push(ke)}}_limitZoom(M){return Math.max(this.options.minZoom,Math.min(Math.floor(+M),this.options.maxZoom+1))}_cluster(M,k){const{radius:$,extent:J,reduce:Y,minPoints:Q}=this.options,ie=$/(J*Math.pow(2,k)),re=M.data,ce=[],ye=this.stride;for(let Te=0;Te<re.length;Te+=ye){if(re[Te+2]<=k)continue;re[Te+2]=k;const ze=re[Te],ke=re[Te+1],Ue=M.within(re[Te],re[Te+1],ie),ut=re[Te+5];let nt=ut;for(const Je of Ue){const gt=Je*ye;re[gt+2]>k&&(nt+=re[gt+5])}if(nt>ut&&nt>=Q){let Je,gt=ze*ut,at=ke*ut,At=-1;const Nt=(Te/ye<<5)+(k+1)+this.points.length;for(const jt of Ue){const Ht=jt*ye;if(re[Ht+2]<=k)continue;re[Ht+2]=k;const Ct=re[Ht+5];gt+=re[Ht]*Ct,at+=re[Ht+1]*Ct,re[Ht+4]=Nt,Y&&(Je||(Je=this._map(re,Te,!0),At=this.clusterProps.length,this.clusterProps.push(Je)),Y(Je,this._map(re,Ht)))}re[Te+4]=Nt,ce.push(gt/nt,at/nt,1/0,Nt,-1,nt),Y&&ce.push(At)}else{for(let Je=0;Je<ye;Je++)ce.push(re[Te+Je]);if(nt>1)for(const Je of Ue){const gt=Je*ye;if(!(re[gt+2]<=k)){re[gt+2]=k;for(let at=0;at<ye;at++)ce.push(re[gt+at])}}}}return ce}_getOriginId(M){return M-this.points.length>>5}_getOriginZoom(M){return(M-this.points.length)%32}_map(M,k,$){if(M[k+5]>1){const Q=this.clusterProps[M[k+6]];return $?Object.assign({},Q):Q}
3097const J=this.points[M[k+3]].properties,Y=this.options.map(J);return $&&Y===J?Object.assign({},Y):Y}}function Bt(H,M,k){return{type:"Feature",id:H[M+3],properties:Ur(H,M,k),geometry:{type:"Point",coordinates:[($=H[M],360*($-.5)),id(H[M+1])]}};var $}function Ur(H,M,k){const $=H[M+5],J=$>=1e4?`${Math.round($/1e3)}k`:$>=1e3?Math.round($/100)/10+"k":$,Y=H[M+6],Q=Y===-1?{}:Object.assign({},k[Y]);return Object.assign(Q,{cluster:!0,cluster_id:H[M+3],point_count:$,point_count_abbreviated:J})}function il(H){return H/360+.5}function ga(H){const M=Math.sin(H*Math.PI/180),k=.5-.25*Math.log((1+M)/(1-M))/Math.PI;return k<0?0:k>1?1:k}function id(H){const M=(180-360*H)*Math.PI/180;return 360*Math.atan(Math.exp(M))/Math.PI-90}function yt(H,M,k,$){let J=$;const Y=M+(k-M>>1);let Q,ie=k-M;const re=H[M],ce=H[M+1],ye=H[k],Te=H[k+1];for(let ze=M+3;ze<k;ze+=3){const ke=ls(H[ze],H[ze+1],re,ce,ye,Te);if(ke>J)Q=ze,J=ke;else if(ke===J){const Ue=Math.abs(ze-Y);Ue<ie&&(Q=ze,ie=Ue)}}J>$&&(Q-M>3&&yt(H,M,Q,$),H[Q+2]=J,k-Q>3&&yt(H,Q,k,$))}function ls(H,M,k,$,J,Y){let Q=J-k,ie=Y-$;if(Q!==0||ie!==0){const re=((H-k)*Q+(M-$)*ie)/(Q*Q+ie*ie);re>1?(k=J,$=Y):re>0&&(k+=Q*re,$+=ie*re)}return Q=H-k,ie=M-$,Q*Q+ie*ie}function vn(H,M,k,$){const J={id:H??null,type:M,geometry:k,tags:$,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(M==="Point"||M==="MultiPoint"||M==="LineString")Cs(J,k);else if(M==="Polygon")Cs(J,k[0]);else if(M==="MultiLineString")for(const Y of k)Cs(J,Y);else if(M==="MultiPolygon")for(const Y of k)Cs(J,Y[0]);return J}function Cs(H,M){for(let k=0;k<M.length;k+=3)H.minX=Math.min(H.minX,M[k]),H.minY=Math.min(H.minY,M[k+1]),H.maxX=Math.max(H.maxX,M[k]),H.maxY=Math.max(H.maxY,M[k+1])}function rl(H,M,k,$){if(!M.geometry)return;const J=M.geometry.coordinates;if(J&&J.length===0)return;const Y=M.geometry.type,Q=Math.pow(k.tolerance/((1<<k.maxZoom)*k.extent),2);let ie=[],re=M.id;if(k.promoteId?re=M.properties[k.promoteId]:k.generateId&&(re=$||0),Y==="Point")Wu(J,ie);else if(Y==="MultiPoint")for(const ce of J)Wu(ce,ie);else if(Y==="LineString")Xl(J,ie,Q,!1);else if(Y==="MultiLineString"){if(k.lineMetrics){for(const ce of J)ie=[],Xl(ce,ie,Q,!1),H.push(vn(re,"LineString",ie,M.properties));return}Yl(J,ie,Q,!1)}else if(Y==="Polygon")Yl(J,ie,Q,!0);else{if(Y!=="MultiPolygon"){if(Y==="GeometryCollection"){for(const ce of M.geometry.geometries)rl(H,{id:re,geometry:ce,properties:M.properties},k,$);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ce of J){const ye=[];Yl(ce,ye,Q,!0),ie.push(ye)}}H.push(vn(re,Y,ie,M.properties))}function Wu(H,M){M.push(Kl(H[0]),cs(H[1]),0)}function Xl(H,M,k,$){let J,Y,Q=0;for(let re=0;re<H.length;re++){const ce=Kl(H[re][0]),ye=cs(H[re][1]);M.push(ce,ye,0),re>0&&(Q+=$?(J*ye-ce*Y)/2:Math.sqrt(Math.pow(ce-J,2)+Math.pow(ye-Y,2))),J=ce,Y=ye}const ie=M.length-3;M[2]=1,yt(M,0,ie,k),M[ie+2]=1,M.size=Math.abs(Q),M.start=0,M.end=M.size}function Yl(H,M,k,$){for(let J=0;J<H.length;J++){const Y=[];Xl(H[J],Y,k,$),M.push(Y)}}function Kl(H){return H/360+.5}function cs(H){const M=Math.sin(H*Math.PI/180),k=.5-.25*Math.log((1+M)/(1-M))/Math.PI;return k<0?0:k>1?1:k}function ro(H,M,k,$,J,Y,Q,ie){if($/=M,Y>=(k/=M)&&Q<$)return H;if(Q<k||Y>=$)return null;const re=[];for(const ce of H){const ye=ce.geometry;let Te=ce.type;const ze=J===0?ce.minX:ce.minY,ke=J===0?ce.maxX:ce.maxY;if(ze>=k&&ke<$){re.push(ce);continue}if(ke<k||ze>=$)continue;let Ue=[];if(Te==="Point"||Te==="MultiPoint")Xc(ye,Ue,k,$,J);else if(Te==="LineString")jn(ye,Ue,k,$,J,!1,ie.lineMetrics);else if(Te==="MultiLineString")Jl(ye,Ue,k,$,J,!1);else if(Te==="Polygon")Jl(ye,Ue,k,$,J,!0);else if(Te==="MultiPolygon")for(const ut of ye){const nt=[];Jl(ut,nt,k,$,J,!0),nt.length&&Ue.push(nt)}if(Ue.length){if(ie.lineMetrics&&Te==="LineString"){for(const ut of Ue)re.push(vn(ce.id,Te,ut,ce.tags));continue}Te!=="LineString"&&Te!=="MultiLineString"||(Ue.length===1?(Te="LineString",Ue=Ue[0]):Te="MultiLineString"),Te!=="Point"&&Te!=="MultiPoint"||(Te=Ue.length===3?"Point":"MultiPoint"),re.push(vn(ce.id,Te,Ue,ce.tags))}}return re.length?re:null}function Xc(H,M,k,$,J){for(let Y=0;Y<H.length;Y+=3){const Q=H[Y+J];Q>=k&&Q<=$&&gi(M,H[Y],H[Y+1],H[Y+2])}}function jn(H,M,k,$,J,Y,Q){let ie=Yc(H);const re=J===0?Uo:Kc;let ce,ye,Te=H.start;for(let nt=0;nt<H.length-3;nt+=3){const Je=H[nt],gt=H[nt+1],at=H[nt+2],At=H[nt+3],Nt=H[nt+4],jt=J===0?Je:gt,Ht=J===0?At:Nt;let Ct=!1;Q&&(ce=Math.sqrt(Math.pow(Je-At,2)+Math.pow(gt-Nt,2))),jt<k?Ht>=k&&(ye=re(ie,Je,gt,At,Nt,k),Q&&(ie.start=Te+ce*ye)):jt>$?Ht<=$&&(ye=re(ie,Je,gt,At,Nt,$),Q&&(ie.start=Te+ce*ye)):gi(ie,Je,gt,at),Ht<k&&jt>=k&&(ye=re(ie,Je,gt,At,Nt,k),Ct=!0),Ht>$&&jt<=$&&(ye=re(ie,Je,gt,At,Nt,$),Ct=!0),!Y&&Ct&&(Q&&(ie.end=Te+ce*ye),M.push(ie),ie=Yc(H)),Q&&(Te+=ce)}let ze=H.length-3;const ke=H[ze],Ue=H[ze+1],ut=J===0?ke:Ue;ut>=k&&ut<=$&&gi(ie,ke,Ue,H[ze+2]),ze=ie.length-3,Y&&ze>=3&&(ie[ze]!==ie[0]||ie[ze+1]!==ie[1])&&gi(ie,ie[0],ie[1],ie[2]),ie.length&&M.push(ie)}function Yc(H){const M=[];return M.size=H.size,M.start=H.start,M.end=H.end,M}function Jl(H,M,k,$,J,Y){for(const Q of H)jn(Q,M,k,$,J,Y,!1)}function gi(H,M,k,$){H.push(M,k,$)}function Uo(H,M,k,$,J,Y){const Q=(Y-M)/($-M);return gi(H,Y,k+(J-k)*Q,1),Q}function Kc(H,M,k,$,J,Y){const Q=(Y-k)/(J-k);return gi(H,M+($-M)*Q,Y,1),Q}function nl(H,M){const k=[];for(let $=0;$<H.length;$++){const J=H[$],Y=J.type;let Q;if(Y==="Point"||Y==="MultiPoint"||Y==="LineString")Q=us(J.geometry,M);else if(Y==="MultiLineString"||Y==="Polygon"){Q=[];for(const ie of J.geometry)Q.push(us(ie,M))}else if(Y==="MultiPolygon"){Q=[];for(const ie of J.geometry){const re=[];for(const ce of ie)re.push(us(ce,M));Q.push(re)}}k.push(vn(J.id,Y,Q,J.tags))}return k}function us(H,M){const k=[];k.size=H.size,H.start!==void 0&&(k.start=H.start,k.end=H.end);for(let $=0;$<H.length;$+=3)k.push(H[$]+M,H[$+1],H[$+2]);return k}function Gn(H,M){if(H.transformed)return H;const k=1<<H.z,$=H.x,J=H.y;for(const Y of H.features){const Q=Y.geometry,ie=Y.type;if(Y.geometry=[],ie===1)for(let re=0;re<Q.length;re+=2)Y.geometry.push(jo(Q[re],Q[re+1],M,k,$,J));else for(let re=0;re<Q.length;re++){const ce=[];for(let ye=0;ye<Q[re].length;ye+=2)ce.push(jo(Q[re][ye],Q[re][ye+1],M,k,$,J));Y.geometry.push(ce)}}return H.transformed=!0,H}function jo(H,M,k,$,J,Y){return[Math.round(k*(H*$-J)),Math.round(k*(M*$-Y))]}function ya(H,M,k,$,J){const Y=M===J.maxZoom?0:J.tolerance/((1<<M)*J.extent),Q={features:[],numPoints:0,numSimplified:0,numFeatures:H.length,source:null,x:k,y:$,z:M,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ie of H)Fr(Q,ie,Y,J);return Q}function Fr(H,M,k,$){const J=M.geometry,Y=M.type,Q=[];if(H.minX=Math.min(H.minX,M.minX),H.minY=Math.min(H.minY,M.minY),H.maxX=Math.max(H.maxX,M.maxX),H.maxY=Math.max(H.maxY,M.maxY),Y==="Point"||Y==="MultiPoint")for(let ie=0;ie<J.length;ie+=3)Q.push(J[ie],J[ie+1]),H.numPoints++,H.numSimplified++;else if(Y==="LineString")no(Q,J,H,k,!1,!1);else if(Y==="MultiLineString"||Y==="Polygon")for(let ie=0;ie<J.length;ie++)no(Q,J[ie],H,k,Y==="Polygon",ie===0);else if(Y==="MultiPolygon")for(let ie=0;ie<J.length;ie++){const re=J[ie];for(let ce=0;ce<re.length;ce++)no(Q,re[ce],H,k,!0,ce===0)}if(Q.length){let ie=M.tags||null;if(Y==="LineString"&&$.lineMetrics){ie={};for(const ce in M.tags)ie[ce]=M.tags[ce];ie.mapbox_clip_start=J.start/J.size,ie.mapbox_clip_end=J.end/J.size}const re={geometry:Q,type:Y==="Polygon"||Y==="MultiPolygon"?3:Y==="LineString"||Y==="MultiLineString"?2:1,tags:ie};M.id!==null&&(re.id=M.id),H.features.push(re)}}function no(H,M,k,$,J,Y){const Q=$*$;if($>0&&M.size<(J?Q:$))return void(k.numPoints+=M.length/3);const ie=[];for(let re=0;re<M.length;re+=3)($===0||M[re+2]>
3097Q)&&(k.numSimplified++,ie.push(M[re],M[re+1])),k.numPoints++;J&&function(re,ce){let ye=0;for(let Te=0,ze=re.length,ke=ze-2;Te<ze;ke=Te,Te+=2)ye+=(re[Te]-re[ke])*(re[Te+1]+re[ke+1]);if(ye>0===ce)for(let Te=0,ze=re.length;Te<ze/2;Te+=2){const ke=re[Te],Ue=re[Te+1];re[Te]=re[ze-2-Te],re[Te+1]=re[ze-1-Te],re[ze-2-Te]=ke,re[ze-1-Te]=Ue}}(ie,Y),H.push(ie)}const Xu={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Yu{constructor(M,k){const $=(k=this.options=function(Y,Q){for(const ie in Q)Y[ie]=Q[ie];return Y}(Object.create(Xu),k)).debug;if($&&console.time("preprocess data"),k.maxZoom<0||k.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(k.promoteId&&k.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(Y,Q){const ie=[];if(Y.type==="FeatureCollection")for(let re=0;re<Y.features.length;re++)rl(ie,Y.features[re],Q,re);else rl(ie,Y.type==="Feature"?Y:{geometry:Y},Q);return ie}(M,k);this.tiles={},this.tileCoords=[],$&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",k.indexMaxZoom,k.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(Y,Q){const ie=Q.buffer/Q.extent;let re=Y;const ce=ro(Y,1,-1-ie,ie,0,-1,2,Q),ye=ro(Y,1,1-ie,2+ie,0,-1,2,Q);return(ce||ye)&&(re=ro(Y,1,-ie,1+ie,0,-1,2,Q)||[],ce&&(re=nl(ce,1).concat(re)),ye&&(re=re.concat(nl(ye,-1)))),re}(J,k),J.length&&this.splitTile(J,0,0,0),$&&(J.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(M,k,$,J,Y,Q,ie){const re=[M,k,$,J],ce=this.options,ye=ce.debug;for(;re.length;){J=re.pop(),$=re.pop(),k=re.pop(),M=re.pop();const Te=1<<k,ze=Ql(k,$,J);let ke=this.tiles[ze];if(!ke&&(ye>1&&console.time("creation"),ke=this.tiles[ze]=ya(M,k,$,J,ce),this.tileCoords.push({z:k,x:$,y:J}),ye)){ye>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",k,$,J,ke.numFeatures,ke.numPoints,ke.numSimplified),console.timeEnd("creation"));const Ct=`z${k}`;this.stats[Ct]=(this.stats[Ct]||0)+1,this.total++}if(ke.source=M,Y==null){if(k===ce.indexMaxZoom||ke.numPoints<=ce.indexMaxPoints)continue}else{if(k===ce.maxZoom||k===Y)continue;if(Y!=null){const Ct=Y-k;if($!==Q>>Ct||J!==ie>>Ct)continue}}if(ke.source=null,M.length===0)continue;ye>1&&console.time("clipping");const Ue=.5*ce.buffer/ce.extent,ut=.5-Ue,nt=.5+Ue,Je=1+Ue;let gt=null,at=null,At=null,Nt=null;const jt=ro(M,Te,$-Ue,$+nt,0,ke.minX,ke.maxX,ce),Ht=ro(M,Te,$+ut,$+Je,0,ke.minX,ke.maxX,ce);jt&&(gt=ro(jt,Te,J-Ue,J+nt,1,ke.minY,ke.maxY,ce),at=ro(jt,Te,J+ut,J+Je,1,ke.minY,ke.maxY,ce)),Ht&&(At=ro(Ht,Te,J-Ue,J+nt,1,ke.minY,ke.maxY,ce),Nt=ro(Ht,Te,J+ut,J+Je,1,ke.minY,ke.maxY,ce)),ye>1&&console.timeEnd("clipping"),re.push(gt||[],k+1,2*$,2*J),re.push(at||[],k+1,2*$,2*J+1),re.push(At||[],k+1,2*$+1,2*J),re.push(Nt||[],k+1,2*$+1,2*J+1)}}getTile(M,k,$){M=+M,k=+k,$=+$;const J=this.options,{extent:Y,debug:Q}=J;if(M<0||M>24)return null;const ie=1<<M,re=Ql(M,k=k+ie&ie-1,$);if(this.tiles[re])return Gn(this.tiles[re],Y);Q>1&&console.log("drilling down to z%d-%d-%d",M,k,$);let ce,ye=M,Te=k,ze=$;for(;!ce&&ye>0;)ye--,Te>>=1,ze>>=1,ce=this.tiles[Ql(ye,Te,ze)];return ce&&ce.source?(Q>1&&(console.log("found parent tile z%d-%d-%d",ye,Te,ze),console.time("drilling down")),this.splitTile(ce.source,ye,Te,ze,M,k,$),Q>1&&console.timeEnd("drilling down"),this.tiles[re]?Gn(this.tiles[re],Y):null):null}}function Ql(H,M,k){return 32*((1<<H)*k+M)+H}function Ku(H,M){const k=H.tileID.canonical;if(!this._geoJSONIndex)return void M(null,null);const $=this._geoJSONIndex.getTile(k.z,k.x,k.y);if(!$)return void M(null,null);const J=ce=>ce.tags&&"3d_elevation_id"in ce.tags&&"source"in ce.tags&&ce.tags.source==="elevation",Y=$.features.filter(ce=>J(ce));let Q={_geojsonTileLayer:$.features};Y.length>0&&(Q={_geojsonTileLayer:$.features.filter(ce=>!J(ce)),hd_road_elevation:Y});const ie=new Ja(Q),re=function(ce){const ye=new L.gi;for(const Te of Object.keys(ce))ye.writeMessage(3,zr,{name:Te,features:ce[Te]});return ye.finish()}(Q).buffer;M(null,{vectorTile:ie,rawData:re,headers:new Headers})}class Jc extends os{constructor(M){super(M),this.loadVectorData=Ku,this._dynamicIndex=new $c}async loadData(M){const k=M&&M.request,$=k&&k.collectResourceTiming;this._geoJSONIndex=null;let J=await new Promise((Q,ie)=>{this.loadGeoJSON(M,(re,ce)=>{re?ie(re):Q(ce)})});if(!J)return{};if(typeof J!="object")throw new Error(`Input data given to '${M.source}' is not a valid GeoJSON object.`);if(M.filter){const Q=L.c(M.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(ie=>`${ie.key}: ${ie.message}`).join(", "));J.features=J.features.filter(ie=>Q.value.evaluate({zoom:0},ie))}M.dynamic?(J.type==="Feature"&&(J={type:"FeatureCollection",features:[J]}),M.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(J.features,this.loaded),M.cluster&&(J.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=M.cluster?new qu(function({superclusterOptions:Q,clusterProperties:ie}){if(!ie||!Q)return Q;const re={},ce={},ye={accumulated:null,zoom:0},Te={properties:null},ze=Object.keys(ie);for(const ke of ze){const[Ue,ut]=ie[ke],nt=L.c(ut),Je=L.c(typeof Ue=="string"?[Ue,["accumulated"],["get",ke]]:Ue);re[ke]=nt.value,ce[ke]=Je.value}return Q.map=ke=>{Te.properties=ke;const Ue={};for(const ut of ze)Ue[ut]=re[ut].evaluate(ye,Te);return Ue},Q.reduce=(ke,Ue)=>{Te.properties=Ue;for(const ut of ze)ye.accumulated=ke[ut],ke[ut]=ce[ut].evaluate(ye,Te)},Q}(M)).load(J.features):M.dynamic?this._dynamicIndex:function(Q,ie){return new Yu(Q,ie)}(J,M.geojsonVtOptions);const Y={};if($){const Q=To(k);Q&&(Y.resourceTiming={},Y.resourceTiming[M.source]=JSON.parse(JSON.stringify(Q)))}return Y}async reloadTile(M){const k=this.loaded;return k&&k[M.uid]?M.partial?void 0:super.reloadTile(M):this.loadTile(M)}loadGeoJSON(M,k){if(M.request)L.g(M.request).then(({data:$})=>k(null,$)).catch($=>k($));else{if(typeof M.data!="string")return k(new Error(`Input data given to '${M.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return k(null,JSON.parse(M.data))}catch{return k(new Error(`Input data given to '${M.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(M){return this._geoJSONIndex.getClusterExpansionZoom(M.clusterId)}getClusterChildren(M){return this._geoJSONIndex.getChildren(M.clusterId)}getClusterLeaves(M){return this._geoJSONIndex.getLeaves(M.clusterId,M.limit,M.offset)}}L.cA.setPbf(L.cB);class ec{constructor(M){this._mrt=new L.cA(M.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=M.uid,this.tileID=M.tileID,this.source=M.source}async parse(M){const k=this._mrt;this.status="parsing",this._entireBuffer=M,k.parseHeader(M),this._isHeaderLoaded=!0;const $=[];for(const J in k.layers){const Y=k.getLayer(J),Q=Y.getDataRange(Y.getBandList()),ie=k.createDecodingTask(Q),re=M.slice(Q.firstByte,Q.lastByte+1);$.push(L.cA.performDecoding(re,ie).then(ce=>ie.complete(null,ce)).catch(ce=>ie.complete(ce,null)))}return await Promise.allSettled($),k}}class Qc{constructor({actor:M}){this.actor=M,this.loading={},this.loaded={}}async loadTile(M){const k=M.uid,$=new AbortController,J=this.loading[k]=new ec(M);J.abort=()=>$.abort();try{const{data:Y,headers:Q}=await L.cC(M.request,$.signal);return Y?(this.loaded[k]=J,{mrt:await J.parse(Y),headers:Q}):(J.status="done",this.loaded[k]=J,null)}catch(Y){if($.signal.aborted)return null;throw J.status="done",this.loaded[k]=J,Y}finally{delete this.loading[k]}}async reloadTile(M){}abortTile(M){const k=M.uid,$=this.loading[k];$&&($.abort&&$.abort(),delete this.loading[k])}removeTile(M){const k=M.uid;this.loaded[k]&&delete this.loaded[k]}async decodeRasterArray(M){return L.cA.performDecoding(M.buffer,M.task)}}class ol{constructor(M){this.self=M,this.actor=new L.aw(M,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=L.gk({name:"mercator"}),this.workerSourceTypes={vector:os,geojson:Jc,"raster-dem":Js},this.workerSources={},this.self.registerRTLTextPlugin=k=>{if(L.fG.isParsed())throw new Error("RTL text plugin already registered.");L.fG.setState({pluginStatus:L.gl.parsed,pluginURL:L.fG.getPluginURL()}),L.fG.applyArabicShaping=k.applyArabicShaping,L.fG.processBidirectionalText=k.processBidirectionalText,L.fG.processStyledBidirectionalText=k.processStyledBidirectionalText;
vendor: 9,137 bytes, line 3097
3097for(const{resolve:$}of this.rtlPluginParsingListeners)$(!0);this.rtlPluginParsingListeners=[]}}clearCaches(M,k){delete this.layerIndexes[M],delete this.availableImages[M],delete this.availableModels[M],delete this.workerSources[M],delete this.isSpriteLoaded[M]}checkIfReady(M,k){}spriteLoaded(M,k){const{scope:$}=k;if(this.isSpriteLoaded[M]||(this.isSpriteLoaded[M]={}),this.isSpriteLoaded[M][$]=!0,this.workerSources[M]&&this.workerSources[M][$])for(const J in this.workerSources[M][$]){const Y=this.workerSources[M][$][J];for(const Q in Y){const ie=Y[Q];ie instanceof os&&(ie.isSpriteLoaded=!0,ie.fire(new L.h("isSpriteLoaded")))}}}setImages(M,k){this.availableImages[M]||(this.availableImages[M]={});const{scope:$,images:J}=k;if(this.availableImages[M][$]=J,k.isSpriteLoaded&&this.spriteLoaded(M,{scope:$}),this.workerSources[M]&&this.workerSources[M][$])for(const Y in this.workerSources[M][$]){const Q=this.workerSources[M][$][Y];for(const ie in Q)Q[ie].availableImages=J}}setModels(M,{scope:k,models:$}){if(this.availableModels[M]||(this.availableModels[M]={}),this.availableModels[M][k]=$,this.workerSources[M]&&this.workerSources[M][k])for(const J in this.workerSources[M][k]){const Y=this.workerSources[M][k][J];for(const Q in Y)Y[Q].availableModels=$}}setProjection(M,k){this.projections[M]=L.gk(k)}setGlobalParams(M,k){if(this.referrer=k.referrer,Object.assign(L.eL,k.config),k.contextOptions){const{maxBindingPoints:$,maxUniformBlockSizeDwords:J}=k.contextOptions;this.maxUniformBufferBindings=$,this.maxUniformBlockSizeDwords=J}}upsertRenderParams(M,k){k.brightness!==void 0&&(this.brightness=k.brightness),k.worldview!==void 0&&(this.worldview=k.worldview)}setLayers(M,k){this.getLayerIndex(M,k.scope).replace(k.layers,k.options)}updateLayers(M,k){this.getLayerIndex(M,k.scope).update(k.layers,k.removedIds,k.options)}async loadTile(M,k){if(k.projection=this.projections[M]||this.defaultProjection,k.type==="batched-model"&&!this.workerSourceTypes["batched-model"]){if(await L.gm(),!Is)throw new Error('Could not load Standard module for "batched-model" source.');this.workerSourceTypes["batched-model"]=Is}return k.type==="raster-array"&&await this.ensureRasterArrayWorkerSource(),this.getWorkerSource(M,k).loadTile(k)}async ensureRasterArraySource(M,k){await this.ensureRasterArrayWorkerSource()}async ensureRasterArrayWorkerSource(){if(!this.workerSourceTypes["raster-array"]){if(await async function(){return Promise.resolve()}(),!Qc)throw new Error('Could not load raster-array module for "raster-array" source.');this.workerSourceTypes["raster-array"]=Qc}}async decodeRasterArray(M,k){return await this.ensureRasterArrayWorkerSource(),this.getWorkerSource(M,k).decodeRasterArray(k)}reloadTile(M,k){return k.projection=this.projections[M]||this.defaultProjection,this.getWorkerSource(M,k).reloadTile(k)}abortTile(M,k){const $=this.getExistingWorkerSource(M,k);return $?$.abortTile(k):void 0}removeTile(M,k){const $=this.getExistingWorkerSource(M,k);return $?$.removeTile(k):void 0}getExistingWorkerSource(M,k){const{type:$,source:J,scope:Y}=k,Q=this.workerSources[M];if(Q&&Q[Y]&&Q[Y][$])return Q[Y][$][J]}async removeSource(M,k){const{type:$,source:J,scope:Y}=k,Q=this.workerSources[M]&&this.workerSources[M][Y]&&this.workerSources[M][Y][$],ie=Q&&Q[J];ie&&(delete Q[J],ie.removeSource&&await ie.removeSource({source:J}))}async loadTileProvider(M,k){const $=new(await L.cn(k.name,k.url))(k.options);return this.getWorkerSource(M,{type:k.type,source:k.source,scope:k.scope},$),$.load&&k.request?$.load({request:k.request}):null}async syncRTLPluginState(M,k){if(L.fG.isParsed())return!0;if(L.fG.isParsing())return new Promise((J,Y)=>{this.rtlPluginParsingListeners.push({resolve:J,reject:Y})});L.fG.setState(k);const $=L.fG.getPluginURL();if(!L.fG.isLoaded()||L.fG.isParsed()||L.fG.isParsing())return!1;L.fG.setState({pluginStatus:L.gl.parsing,pluginURL:$});try{return await self.__mapboxImport($),!!L.fG.isParsed()||new Promise((J,Y)=>{this.rtlPluginParsingListeners.push({resolve:J,reject:Y})})}catch(J){L.fG.setState({pluginStatus:L.gl.error,pluginURL:$});for(const{reject:Y}of this.rtlPluginParsingListeners)Y(J);throw this.rtlPluginParsingListeners=[],J}}getAvailableImages(M,k){this.availableImages[M]||(this.availableImages[M]={});let $=this.availableImages[M][k];return $||($=[]),$}getAvailableModels(M,k){this.availableModels[M]||(this.availableModels[M]={});let $=this.availableModels[M][k];return $||($={}),$}getLayerIndex(M,k){this.layerIndexes[M]||(this.layerIndexes[M]={});let $=this.layerIndexes[M][k];return $||($=this.layerIndexes[M][k]=new No,$.scope=k),$}getWorkerSource(M,k,$){const{type:J,source:Y,scope:Q}=k,ie=this.workerSources;if(ie[M]||(ie[M]={}),ie[M][Q]||(ie[M][Q]={}),ie[M][Q][J]||(ie[M][Q][J]={}),this.isSpriteLoaded[M]||(this.isSpriteLoaded[M]={}),this.getExistingWorkerSource(M,k))$&&(ie[M][Q][J][Y].tileProvider=$);else{const re=this.actor.getWorkerSourceActor(M),ce=this.workerSourceTypes[J];if(!ce)throw new Error(`Unknown worker source type "${J}".`);ie[M][Q][J][Y]=new ce({actor:re,layerIndex:this.getLayerIndex(M,Q),availableImages:this.getAvailableImages(M,Q),availableModels:this.getAvailableModels(M,Q),isSpriteLoaded:this.isSpriteLoaded[M][Q],tileProvider:$,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords})}return ie[M][Q][J][Y]}enforceCacheSizeLimit(M,k){L.gn(k)}}return L.gj(self)&&(self.worker=new ol(self)),ol}),Nc(["./shared"],function(d){const L={antialias:!1,alpha:!0,stencil:!0,depth:!0};let To,Kn;function Lr(a){const r=document.createElement("canvas"),o=Object.create(L);o.failIfMajorPerformanceCaveat=a;const u=r.getContext("webgl2",o);if(!u)return!1;let f;try{f=u.createShader(u.VERTEX_SHADER)}catch{return!1}return!(!f||u.isContextLost())&&(u.shaderSource(f,"void main() {}"),u.compileShader(f),u.getShaderParameter(f,u.COMPILE_STATUS)===!0)}const Vc=/firefox/i,Vl=/macintosh/i;function si(a,r,o){const u=document.createElement(a);return r!=null&&(u.className=r),o&&o.appendChild(u),u}function Eo(a,r,o){const u=document.createElementNS("http://www.w3.org/2000/svg",a);for(const f of Object.keys(r))u.setAttributeNS(null,f,String(r[f]));return o&&o.appendChild(u),u}const Jn=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Us=Jn&&Jn.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Uc;function er(){Jn&&Us&&(Uc=Jn[Us],Jn[Us]="none")}function Ul(){Jn&&Us&&(Jn[Us]=Uc)}function xn(a){a.preventDefault(),a.stopPropagation(),window.removeEventListener("click",xn,!0)}function zt(){window.addEventListener("click",xn,!0),window.setTimeout(()=>{window.removeEventListener("click",xn,!0)},0)}function Wi(a,r){const o=a.getBoundingClientRect();return So(a,o,r)}function mr(a,r){const o=a.getBoundingClientRect(),u=[];for(let f=0;f<r.length;f++)u.push(So(a,o,r[f]));return u}function Is(a){return Vc.test(navigator.userAgent)&&Vl.test(navigator.userAgent)&&a.button===2&&a.ctrlKey?0:a.button}function So(a,r,o){const u=a.offsetWidth===r.width?1:a.offsetWidth/r.width;return new d.P((o.clientX-r.left)*u,(o.clientY-r.top)*u)}class js{constructor(){this._changed=!1,this._updatedLayers=Object.create(null),this._removedLayers=Object.create(null),this._updatedSourceCaches=Object.create(null),this._updatedPaintProps=new Set,this._updatedImages=Object.create(null)}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(r,o){this._updatedSourceCaches[r]=o,this.setDirty()}discardSourceCacheUpdate(r){delete this._updatedSourceCaches[r]}updateLayer(r){const o=r.scope;this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._updatedLayers[o].add(r.id),this.setDirty()}removeLayer(r){const o=r.scope;this._removedLayers[o]=this._removedLayers[o]||{},this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._removedLayers[o][r.id]=r,this._updatedLayers[o].delete(r.id),this._updatedPaintProps.delete(r.fqid),this.setDirty()}getRemovedLayer(r){return this._removedLayers[r.scope]?this._removedLayers[r.scope][r.id]:null}discardLayerRemoval(r){this._removedLayers[r.scope]&&delete this._removedLayers[r.scope][r.id]}getLayerUpdatesByScope(){const r={};for(const o in this._updatedLayers)r[o]=r[o]||{},r[o].updatedIds=Array.from(this._updatedLayers[o].values());for(const o in this._removedLayers)r[o]=r[o]||{},r[o].removedIds=Object.keys(this._removedLayers[o]);return r}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(r){this._updatedPaintProps.add(r.fqid),this.setDirty()}getUpdatedImages(r){return this._updatedImages[r]?Array.from(this._updatedImages[r].values()):[]}updateImage(r,o){this._updatedImages[o]=this._updatedImages[o]||new Set,this._updatedImages[o].add(d.I.toString(r)),this.setDirty()}resetUpdatedImages(r){this._updatedImages[r]&&this._updatedImages[r].clear()}reset(){this._changed=!1,this._updatedLayers=Object.create(null),this._removedLayers=Object.create(null),this._updatedSourceCaches=Object.create(null),this._updatedPaintProps.clear(),this._updatedImages=Object.create(null)}}
3097class Gs{constructor(r){this._layer=r,this._filterDependencies=void 0}invalidateFilter(){this._filterDependencies=void 0}get _filterDeps(){return this._filterDependencies===void 0&&(this._filterDependencies=this._computeFilterDependencies()),this._filterDependencies}_computeFilterDependencies(){const r=this._layer;if(!r.type||r.type==="custom"||r.type==="background"||r.type==="sky"||r.type==="slot")return null;const o=d.c(r.filter,d.s[`filter_${r.type}`]);return o.result==="error"?null:{configDependencies:o.value.configDependencies,isIndoorDependent:o.value.isIndoorDependent}}hasConfigDependency(r){const{_unevaluatedLayout:o,_transitionablePaint:u}=this._layer;if(o&&o.configDependencies.has(r)||u&&u.configDependencies.has(r))return!0;const f=this._filterDeps;return!!f&&f.configDependencies.has(r)}get isConfigDependent(){const{_unevaluatedLayout:r,_transitionablePaint:o}=this._layer;if(r&&r.configDependencies.size!==0||o&&o.configDependencies.size!==0)return!0;const u=this._filterDeps;return!!u&&u.configDependencies.size!==0}get isIndoorDependent(){const{_unevaluatedLayout:r,_transitionablePaint:o}=this._layer;if(r&&r.isIndoorDependent()||o&&o.isIndoorDependent())return!0;const u=this._filterDeps;return!!u&&u.isIndoorDependent}}function No(a){const{userImage:r}=a;return!!(r&&r.render&&r.render())&&(a.data.replace(new Uint8Array(r.data.buffer)),!0)}const Qn=new d.C(0,0,0);function jl(a,r){const o=[],u=a[`stretch_${r}`];let f=null;for(let m=0;m<u.length;m++)f===null?f=o.length===0?u[0]:o.at(-1)[1]+u[m]:(o.push([f,f+u[m]]),f=null);a[`stretch_${r}_areas`]=o}function Uu(a,r){const o={name:void 0};let u;for(;u=a.nextField(r);)u===1?o.name=a.readString():u===2?o.metadata=qa(a,a.readVarint()+a.pos):u===3&&(o.usvg_tree=Wa(a,a.readVarint()+a.pos),o.data="usvg_tree");return function(f){if(f.usvg_tree.height||(f.usvg_tree.height=f.usvg_tree.width),!f.metadata)return f;const{metadata:m}=f;if(m.content_area){const{content_area:g}=m;g.left??(g.left=0),g.top??(g.top=g.left),g.width??(g.width=f.usvg_tree.width),g.height??(g.height=g.width)}if(m.text_placeholder){const{text_placeholder:g}=m;g.top??(g.top=g.left),g.height??(g.height=g.width)}return m.stretch_x&&m.stretch_x.length&&jl(m,"x"),m.stretch_y&&m.stretch_y.length&&jl(m,"y"),f}(o)}function qa(a,r){const o={stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]};let u;for(;u=a.nextField(r);)u===1?o.stretch_x=a.readPackedVarint():u===2?o.stretch_y=a.readPackedVarint():u===3?o.content_area=Gl(a,a.readVarint()+a.pos):u===4?o.variables.push(ju(a,a.readVarint()+a.pos)):u===5&&(o.text_placeholder=Gl(a,a.readVarint()+a.pos));return o}function Gl(a,r){const o={};let u;for(;u=a.nextField(r);)u===1?o.left=a.readVarint():u===2?o.width=a.readVarint():u===3?o.top=a.readVarint():u===4&&(o.height=a.readVarint());return o}function ju(a,r){const o={name:void 0};let u;for(;u=a.nextField(r);)u===1?o.name=a.readString():u===2&&(o.rgb_color=eo(a.readVarint()),o.value="rgb_color");return o}function Wa(a,r){const o={width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[],height:20};let u;for(;u=a.nextField(r);)u===1?o.width=o.height=a.readVarint():u===2?o.height=a.readVarint():u===3?o.children.push(Qt(a,a.readVarint()+a.pos)):u===4?o.linear_gradients.push(jc(a,a.readVarint()+a.pos)):u===5?o.radial_gradients.push($s(a,a.readVarint()+a.pos)):u===7?o.clip_paths.push(oi(a,a.readVarint()+a.pos)):u===8&&o.masks.push(cn(a,a.readVarint()+a.pos));return o}function Qt(a,r){const o={};let u;for(;u=a.nextField(r);)u===1?(o.group=Hs(a,a.readVarint()+a.pos),o.node="group"):u===2&&(o.path=Tr(a,a.readVarint()+a.pos),o.node="path");return o}function Hs(a,r){const o={opacity:255,children:[]};let u;for(;u=a.nextField(r);)u===1?o.transform=Xi(a,a.readVarint()+a.pos):u===2?o.opacity=a.readVarint():u===5?o.clip_path_idx=a.readVarint():u===6?o.mask_idx=a.readVarint():u===7&&o.children.push(Qt(a,a.readVarint()+a.pos));return o}function Xi(a,r){const o={sx:1,ky:0,kx:0,sy:1,tx:0,ty:0};let u;for(;u=a.nextField(r);)u===1?o.sx=a.readFloat():u===2?o.ky=a.readFloat():u===3?o.kx=a.readFloat():u===4?o.sy=a.readFloat():u===5?o.tx=a.readFloat():u===6&&(o.ty=a.readFloat());return o}function Tr(a,r){const o={paint_order:1,commands:[],step:1,diffs:[],rule:1};let u;for(;u=a.nextField(r);)u===1?o.fill=Ni(a,a.readVarint()+a.pos):u===2?o.stroke=Yi(a,a.readVarint()+a.pos):u===3?o.paint_order=a.readVarint():u===5?a.readPackedVarint(o.commands):u===6?o.step=a.readFloat():u===7?a.readPackedSVarint(o.diffs):u===8&&(o.rule=a.readVarint());return o}function Ni(a,r){const o={rgb_color:Qn,paint:"rgb_color",opacity:255};let u;for(;u=a.nextField(r);)u===1?(o.rgb_color=eo(a.readVarint()),o.paint="rgb_color"):u===2?(o.linear_gradient_idx=a.readVarint(),o.paint="linear_gradient_idx"):u===3?(o.radial_gradient_idx=a.readVarint(),o.paint="radial_gradient_idx"):u===5&&(o.opacity=a.readVarint());return o}function Yi(a,r){const o={rgb_color:Qn,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1};let u;for(;u=a.nextField(r);)u===1?(o.rgb_color=eo(a.readVarint()),o.paint="rgb_color"):u===2?(o.linear_gradient_idx=a.readVarint(),o.paint="linear_gradient_idx"):u===3?(o.radial_gradient_idx=a.readVarint(),o.paint="radial_gradient_idx"):u===5?a.readPackedFloat(o.dasharray):u===6?o.dashoffset=a.readFloat():u===7?o.miterlimit=a.readFloat():u===8?o.opacity=a.readVarint():u===9?o.width=a.readFloat():u===10?o.linecap=a.readVarint():u===11&&(o.linejoin=a.readVarint());return o}function eo(a){return new d.C((a>>16&255)/255,(a>>8&255)/255,(255&a)/255,1)}function jc(a,r){const o={spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0};let u;for(;u=a.nextField(r);)u===1?o.transform=Xi(a,a.readVarint()+a.pos):u===2?o.spread_method=a.readVarint():u===3?o.stops.push(Zs(a,a.readVarint()+a.pos)):u===4?o.x1=a.readFloat():u===5?o.y1=a.readFloat():u===6?o.x2=a.readFloat():u===7&&(o.y2=a.readFloat());return o}function Zs(a,r){const o={offset:0,opacity:255,rgb_color:Qn};let u;for(;u=a.nextField(r);)u===1?o.offset=a.readFloat():u===2?o.opacity=a.readVarint():u===3&&(o.rgb_color=eo(a.readVarint()));return o}function $s(a,r){const o={spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0};let u;for(;u=a.nextField(r);)u===1?o.transform=Xi(a,a.readVarint()+a.pos):u===2?o.spread_method=a.readVarint():u===3?o.stops.push(Zs(a,a.readVarint()+a.pos)):u===4?o.cx=a.readFloat():u===5?o.cy=a.readFloat():u===6?o.r=a.readFloat():u===7?o.fx=a.readFloat():u===8?o.fy=a.readFloat():u===9&&(o.fr=a.readFloat());return o}function oi(a,r){const o={children:[]};let u;for(;u=a.nextField(r);)u===1?o.transform=Xi(a,a.readVarint()+a.pos):u===2?o.clip_path_idx=a.readVarint():u===3&&o.children.push(Qt(a,a.readVarint()+a.pos));return o}function cn(a,r){const o={left:0,width:20,mask_type:1,children:[]};let u;for(;u=a.nextField(r);)u===1?o.left=o.top=a.readFloat():u===2?o.width=o.height=a.readFloat():u===3?o.top=a.readFloat():u===4?o.height=a.readFloat():u===5?o.mask_type=a.readVarint():u===6?o.mask_idx=a.readVarint():u===7&&o.children.push(Qt(a,a.readVarint()+a.pos));return o.height??(o.height=o.width),o.top??(o.top=o.left),o}class Xa{static calculate(r={},o=[]){const u=new Map,f=new Map;if(Object.keys(r).length===0)return u;o.forEach(m=>{f.set(m.name,m.rgb_color||new d.C(0,0,0))});for(const[m,g]of Object.entries(r))f.has(m)?u.set(f.get(m).toString(),g):console.warn(`Ignoring unknown image variable "${m}"`);return u}}function qs(a,r=255,o){const u=o.get(a.toString())||a;return r===255?u.toString():new d.C(u.r,u.g,u.b,u.a*r/255).toString()}const is=[];let rs=0;function ti(a,r){if(rs>=is.length){const u=d.o()?new OffscreenCanvas(a,r).getContext("2d",{willReadFrequently:!0}):document.createElement("canvas").getContext("2d",{willReadFrequently:!0});is.push(u)}const o=is[rs++];return o.canvas.width=a,o.canvas.height=r,o}function Di(){rs--}function xr(a,r,o,u,f){for(const m of u.children)Ws(a,r,o,m,f)}function Ws(a,r,o,u,f){u.group?(a.save(),function(m,g,x,w,E){const I=w.mask_idx!=null?x.masks[w.mask_idx]:null,P=w.clip_path_idx!=null?x.clip_paths[w.clip_path_idx]:null;if(w.transform&&(g=to(w.transform).preMultiplySelf(g)),!function(B,V,U){return B.opacity!==255||V||U}(w,P!=null,I!=null))return void xr(m,g,x,w,E);const R=ti(m.canvas.width,m.canvas.height);xr(R,g,x,w,E),P&&Gu(R,g,x,P),I&&As(R,g,x,I,E),m.globalAlpha=w.opacity/255,m.drawImage(R.canvas,0,0),Di()}
vendor: 7,397 bytes, line 3097
3097(a,r,o,u.group,f),a.restore()):u.path&&(a.save(),function(m,g,x,w,E){m.setTransform(g),w.paint_order===1?(hi(m,x,w,E),da(m,x,w,E)):(da(m,x,w,E),hi(m,x,w,E))}(a,r,o,u.path,f),a.restore())}function hi(a,r,o,u){const f=o.fill;if(!f)return;const m=f.opacity/255;switch(a.save(),a.beginPath(),Hc(o,a),f.paint){case"rgb_color":a.fillStyle=qs(f.rgb_color,f.opacity,u);break;case"linear_gradient_idx":{const g=r.linear_gradients[f.linear_gradient_idx];g.transform&&a.setTransform(to(g.transform).preMultiplySelf(a.getTransform())),a.fillStyle=Gc(a,g,m,u);break}case"radial_gradient_idx":{const g=r.radial_gradients[f.radial_gradient_idx];g.transform&&a.setTransform(to(g.transform).preMultiplySelf(a.getTransform())),a.fillStyle=ns(a,g,m,u)}}a.fill(Io(o)),a.restore()}function Io(a){return a.rule===1?"nonzero":a.rule===2?"evenodd":void 0}function da(a,r,o,u){const f=o.stroke;if(!f)return;const m=Vo(o);a.lineWidth=f.width,a.miterLimit=f.miterlimit,a.setLineDash(f.dasharray),a.lineDashOffset=f.dashoffset;const g=f.opacity/255;switch(f.paint){case"rgb_color":a.strokeStyle=qs(f.rgb_color,f.opacity,u);break;case"linear_gradient_idx":a.strokeStyle=Gc(a,r.linear_gradients[f.linear_gradient_idx],g,u,!0);break;case"radial_gradient_idx":a.strokeStyle=ns(a,r.radial_gradients[f.radial_gradient_idx],g,u,!0)}switch(f.linejoin){case 2:case 1:a.lineJoin="miter";break;case 3:a.lineJoin="round";break;case 4:a.lineJoin="bevel"}switch(f.linecap){case 1:a.lineCap="butt";break;case 2:a.lineCap="round";break;case 3:a.lineCap="square"}a.stroke(m)}function Gc(a,r,o,u,f=!1){if(r.stops.length===1){const R=r.stops[0];return qs(R.rgb_color,R.opacity*o,u)}const{x1:m,y1:g,x2:x,y2:w}=r;let E=new DOMPoint(m,g),I=new DOMPoint(x,w);if(f){const R=to(r.transform);E=R.transformPoint(E),I=R.transformPoint(I)}const P=a.createLinearGradient(E.x,E.y,I.x,I.y);for(const R of r.stops)P.addColorStop(R.offset,qs(R.rgb_color,R.opacity*o,u));return P}function ns(a,r,o,u,f=!1){if(r.stops.length===1){const q=r.stops[0];return qs(q.rgb_color,q.opacity*o,u)}const m=to(r.transform),{fx:g,fy:x,fr:w,cx:E,cy:I,r:P}=r;let R=new DOMPoint(g,x),B=new DOMPoint(E,I),V=w,U=P;if(f){R=m.transformPoint(R),B=m.transformPoint(B);const q=(m.a+m.d)/2;V=w*q,U=r.r*q}const Z=a.createRadialGradient(R.x,R.y,V,B.x,B.y,U);for(const q of r.stops)Z.addColorStop(q.offset,qs(q.rgb_color,q.opacity*o,u));return Z}function Li(a,r,o,u){const f=u.transform?to(u.transform).preMultiplySelf(r):r,m=ti(a.canvas.width,a.canvas.height);for(const x of u.children)if(x.group)Li(m,f,o,x.group);else if(x.path){const w=x.path,E=new Path2D;E.addPath(Vo(w),f),m.fill(E,Io(w))}const g=u.clip_path_idx!=null?o.clip_paths[u.clip_path_idx]:null;g&&Gu(m,f,o,g),a.globalCompositeOperation="source-over",a.drawImage(m.canvas,0,0),Di()}function Gu(a,r,o,u){const f=ti(a.canvas.width,a.canvas.height);Li(f,r,o,u),a.globalCompositeOperation="destination-in",a.drawImage(f.canvas,0,0),Di()}function As(a,r,o,u,f){if(u.children.length===0)return;const m=u.mask_idx!=null?o.masks[u.mask_idx]:null;m&&As(a,r,o,m,f);const g=a.canvas.width,x=a.canvas.height,w=ti(g,x),E=u.width,I=u.height,P=u.left,R=u.top,B=new Path2D,V=new Path2D;V.rect(P,R,E,I),B.addPath(V,r),w.clip(B);for(const q of u.children)Ws(w,r,o,q,f);const U=w.getImageData(0,0,g,x),Z=U.data;if(u.mask_type===1)for(let q=0;q<Z.length;q+=4)Z[q+3]=Z[q+3]/255*(.2126*Z[q]+.7152*Z[q+1]+.0722*Z[q+2]);w.putImageData(U,0,0),a.globalCompositeOperation="destination-in",a.drawImage(w.canvas,0,0),Di()}function to(a){return a?new DOMMatrix([a.sx,a.ky,a.kx,a.sy,a.tx,a.ty]):new DOMMatrix}function Hc(a,r){const o=a.step;let u=a.diffs[0]*o,f=a.diffs[1]*o;r.moveTo(u,f);for(let m=0,g=2;m<a.commands.length;m++)switch(a.commands[m]){case 1:u+=a.diffs[g++]*o,f+=a.diffs[g++]*o,r.moveTo(u,f);break;case 2:u+=a.diffs[g++]*o,f+=a.diffs[g++]*o,r.lineTo(u,f);break;case 3:{const x=u+a.diffs[g++]*o,w=f+a.diffs[g++]*o;u=x+a.diffs[g++]*o,f=w+a.diffs[g++]*o,r.quadraticCurveTo(x,w,u,f);break}case 4:{const x=u+a.diffs[g++]*o,w=f+a.diffs[g++]*o,E=x+a.diffs[g++]*o,I=w+a.diffs[g++]*o;u=E+a.diffs[g++]*o,f=I+a.diffs[g++]*o,r.bezierCurveTo(x,w,E,I,u,f);break}case 5:r.closePath()}return r}function Vo(a){return Hc(a,new Path2D)}class Hl{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(r){return new d.b(r,r.data)}getFromCache(r,o,u){return this.cacheMap.has(u)||this.cacheMap.set(u,new d.L(150)),this.cacheMap.get(u).get(d.m(r.toString(),o))}setInCache(r,o,u,f){this.cacheDependenciesMap.has(f)||this.cacheDependenciesMap.set(f,new Map),this.cacheMap.has(f)||this.cacheMap.set(f,new d.L(150));const m=this.cacheDependenciesMap.get(f),g=d.m(r.id.toString(),u);m.get(g)||m.set(g,new Set);const x=this.cacheMap.get(f),w=r.toString();m.get(g).add(w),x.put(d.m(r.toString(),u),o)}removeImagesFromCacheByIds(r,o,u=0){if(!this.cacheMap.has(u)||!this.cacheDependenciesMap.has(u))return;const f=this.cacheMap.get(u),m=this.cacheDependenciesMap.get(u);for(const g of r){const x=d.m(g.toString(),o);if(m.has(x)){for(const w of m.get(x))f.delete(w);m.delete(x)}}}rasterize(r,o,u,f){const m=this.getFromCache(r,u,f);if(m)return m.clone();const g=function(w,E){const I=Xa.calculate(E.params,w.metadata?w.metadata.variables:[]),P=w.usvg_tree,R=P.width,B=P.height,V=Math.max(1,Math.round(R*E.sx)),U=Math.max(1,Math.round(B*E.sy)),Z=new DOMMatrix([V/R,0,0,U/B,0,0]),q=ti(V,U);xr(q,Z,P,P,I);const X=q.getImageData(0,0,V,U);return Di(),X}(o.icon,r),x=Hl._getImage(g);return this.setInCache(r,x,u,f),x.clone()}}class ar extends d.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 d.d,this.dirty=!0,this.spriteFormat=r,this.imageRasterizer=new Hl}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 d.b({width:1,height:1}))}removeScope(r){this.loaded.delete(r),this.imageProviders.delete(r),this.images.delete(r),this.updatedImages.delete(r),this.callbackDispatchedThisFrame.delete(r),this.imageVersions.delete(r),this.patterns.delete(r),this.atlasImage.delete(r);const o=this.atlasTexture.get(r);o&&(o.destroy(),this.atlasTexture.delete(r))}addImageProvider(r,o){this.imageProviders.has(o)||this.imageProviders.set(o,new Map),this.imageProviders.get(o).set(r.id,r)}removeImageProvider(r,o){this.imageProviders.has(o)&&this.imageProviders.get(o).delete(r)}getPendingImageProviders(){const r=[];for(const o of this.imageProviders.values())for(const u of o.values())u.hasPendingRequests()&&r.push(u);return r}isLoaded(){for(const r of this.loaded.keys())if(!this.loaded.get(r))return!1;return!0}setLoaded(r,o){if(this.loaded.get(o)!==r&&(this.loaded.set(o,r),r)){for(const{ids:u,callback:f}of this.requestors)this._notify(u,o,f);this.requestors=[]}}hasImage(r,o){return!!this.getImage(r,o)}getImage(r,o){return this.images.get(o).get(r.toString())}addImage(r,o,u){if(this._validate(r,u)){this.images.get(o).set(r.toString(),u);const f=this.imageVersions.get(o),m=f.get(r.toString())||0;f.set(r.toString(),m+1)}}_validate(r,o){let u=!0;
vendor: 4,306 bytes, line 3097
3097return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new d.f(new Error(`Image "${r.name}" has invalid "stretchX" value`))),u=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new d.f(new Error(`Image "${r.name}" has invalid "stretchY" value`))),u=!1),this._validateContent(o.content,o)||(this.fire(new d.f(new Error(`Image "${r.name}" has invalid "content" value`))),u=!1),u}_validateStretch(r,o){if(!r)return!0;let u=0;for(const f of r){if(f[0]<u||f[1]<f[0]||o<f[1])return!1;u=f[1]}return!0}_validateContent(r,o){return r?r.length!==4||!o.usvg&&(r[0]<0||o.data.width<r[0]||r[1]<0||o.data.height<r[1]||r[2]<0||o.data.width<r[2]||r[3]<0||o.data.height<r[3])?!1:!(r[2]<r[0]||r[3]<r[1]):!0}updateImage(r,o,u){const f=this.images.get(o).get(r.toString());u.version=f.version+1,this.images.get(o).set(r.toString(),u),this.updatedImages.get(o).add(r);const m=this.imageVersions.get(o),g=m.get(r.toString())||0;m.set(r.toString(),g+1),this.removeFromImageRasterizerCache(r,o)}clearUpdatedImages(r){this.updatedImages.get(r).clear()}removeFromImageRasterizerCache(r,o){this.spriteFormat!=="raster"&&this.imageRasterizer.removeImagesFromCacheByIds([r],o)}removeImage(r,o){const u=this.images.get(o),f=u.get(r.toString());u.delete(r.toString());const m=this.imageVersions.get(o),g=m.get(r.toString())||0;m.set(r.toString(),g+1),this.patterns.get(o).delete(r.toString()),this.removeFromImageRasterizerCache(r,o),f.userImage&&f.userImage.onRemove&&f.userImage.onRemove()}listImages(r){return Array.from(this.images.get(r).keys()).map(o=>d.I.from(o))}getImageVersions(r){return this.imageVersions.get(r)||new Map}getImages(r,o,u){const f=[],m=[],g=this.imageProviders.get(o);for(const I of r){if(!I.iconsetId){f.push(I);continue}const P=g.get(I.iconsetId);P&&(this.getImage(I,o)?m.push(I):P.addPendingRequest(I))}if(f.length===0)return void this._notify(m,o,u);let x=!0;const w=!!this.loaded.get(o),E=this.images.get(o);if(!w)for(const I of f)E.has(I.toString())||(x=!1);w||x?this._notify(f,o,u):this.requestors.push({ids:f,scope:o,callback:u})}rasterizeImages(r,o){const u=new Map,{iconTasks:f,patternTasks:m,scope:g}=r;for(const x of[f,m])for(const[w,E]of x.entries()){const I=this.getImage(E.id,g);I&&u.set(w,{image:I,imageVariant:E})}o(null,this._rasterizeImages(g,u))}_rasterizeImages(r,o){const u=new Map;for(const[f,{image:m,imageVariant:g}]of o.entries())u.set(f,this.imageRasterizer.rasterize(g,m,r,0));return u}getUpdatedImages(r){return this.updatedImages.get(r)||new Set}_notify(r,o,u){const f=this.images.get(o),m=new Map;for(const g of r){if(!f.get(g.toString())){if(g.iconsetId)continue;this.fire(new d.h("styleimagemissing",{id:g.name}))}const x=f.get(g.toString());if(!x){d.w(`Image "${g.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}const w={data:x.usvg?null:x.data.clone(),pixelRatio:x.pixelRatio,sdf:x.sdf,usvg:x.usvg,stretchX:x.stretchX,stretchY:x.stretchY,content:x.content,hasRenderCallback:!!(x.userImage&&x.userImage.render)};x.usvg&&Object.assign(w,{width:x.icon.usvg_tree.width,height:x.icon.usvg_tree.height}),m.set(d.I.toString(g),w)}u(null,{images:m,versions:this.getImageVersions(o)})}getPixelSize(r){const{width:o,height:u}=this.atlasImage.get(r);return{width:o,height:u}}getPattern(r,o,u){const f=r.toString(),m=this.patterns.get(o),g=m.get(f),x=this.getImage(r,o);if(!x)return null;if(g){if(g.position.version===x.version)return g.position;g.position.version=x.version}else{if(x.usvg&&!x.data){const w=this.getPatternInFlightId(f,o);if(this.patternsInFlight.has(w))return null;this.patternsInFlight.add(w);const E=new d.i(r).scaleSelf(d.e.devicePixelRatio),I=new Map([[E.toString(),{image:x,imageVariant:E}]]),P=this._rasterizeImages(o,I);return this.storePatternImage(E,o,x,u,P),null}this.storePattern(r,o,x)}return this._updatePatternAtlas(o,u),m.get(f).position}getPatternInFlightId(r,o){return d.m(r,o)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(r,o,u,f,m){const g=r.toString(),x=m?m.get(g):void 0;x&&(u.data=x,this.storePattern(r.id,o,u),this._updatePatternAtlas(o,f),this.patternsInFlight.delete(this.getPatternInFlightId(r.i
3097d.toString(),o)))}storePattern(r,o,u){const f={w:u.data.width+2*d.j,h:u.data.height+2*d.j,x:0,y:0},m=new d.k(f,u,d.j);this.patterns.get(o).set(r.toString(),{bin:f,position:m})}destroyAtlasTextures(){for(const r of this.atlasTexture.values())r&&r.destroy();this.atlasTexture.clear()}bind(r,o){const u=r.gl;let f=this.atlasTexture.get(o);f?this.dirty&&(f.update(this.atlasImage.get(o)),this.dirty=!1):(f=new d.T(r,this.atlasImage.get(o),u.RGBA8),this.atlasTexture.set(o,f)),f.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(r,o){const u=this.patterns.get(r),f=Array.from(u.values()).map(({bin:E})=>E),{w:m,h:g}=d.p(f),x=this.atlasImage.get(r);x.resize({width:m||1,height:g||1});const w=this.images.get(r);for(const[E,{bin:I,position:P}]of u.entries()){let R=P.padding;const B=I.x+R,V=I.y+R,U=w.get(E).data,Z=U.width,q=U.height;R=R>1?R-1:R,d.b.copy(U,x,{x:0,y:0},{x:B,y:V},{width:Z,height:q},o),d.b.copy(U,x,{x:0,y:q-R},{x:B,y:V-R},{width:Z,height:R},o),d.b.copy(U,x,{x:0,y:0},{x:B,y:V+q},{width:Z,height:R},o),d.b.copy(U,x,{x:Z-R,y:0},{x:B-R,y:V},{width:R,height:q},o),d.b.copy(U,x,{x:0,y:0},{x:B+Z,y:V},{width:R,height:q},o),d.b.copy(U,x,{x:Z-R,y:q-R},{x:B-R,y:V-R},{width:R,height:R},o),d.b.copy(U,x,{x:0,y:q-R},{x:B+Z,y:V-R},{width:R,height:R},o),d.b.copy(U,x,{x:0,y:0},{x:B+Z,y:V+q},{width:R,height:R},o),d.b.copy(U,x,{x:Z-R,y:0},{x:B-R,y:V+q},{width:R,height:R},o)}this.dirty=!0}beginFrame(){for(const r of this.images.keys())this.callbackDispatchedThisFrame.set(r,new Set);this.imageAtlasCache.beginFrame()}dispatchRenderCallbacks(r,o){const u=this.images.get(o);for(const f of r){if(this.callbackDispatchedThisFrame.get(o).has(f.toString()))continue;this.callbackDispatchedThisFrame.get(o).add(f.toString());const m=u.get(f.toString());No(m)&&this.updateImage(f,o,m)}}}class it{constructor(r,o,u,f){this.message=(r?`${r}: `:"")+u,f&&(this.identifier=f),o!=null&&o.__line__&&(this.line=o.__line__)}}class Cn extends it{}function Zl(a){const r=a.value,o=a.valueSpec,u=a.style,f=a.styleSpec,m=a.key,g=a.arrayElementValidator||Si;if(!Array.isArray(r))return[new it(m,r,`array expected, ${d.n(r)} found`)];if(o.length&&r.length!==o.length)return[new it(m,r,`array length ${o.length} expected, length ${r.length} found`)];if(o["min-length"]&&r.length<o["min-length"])return[new it(m,r,`array length at least ${o["min-length"]} expected, length ${r.length} found`)];let x={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};f.$version<7&&(x.function=o.function),d.l(o.value)&&(x=o.value);let w=[];for(let E=0;E<r.length;E++)w=w.concat(g({array:r,arrayIndex:E,value:r[E],valueSpec:x,style:u,styleSpec:f,key:`${m}[${E}]`},!0));return w}function Xs(a){const r=a.key,o=a.value,u=a.valueSpec;if(!d.q(o))return[new it(r,o,`number expected, ${d.n(o)} found`)];if(o!=o)return[new it(r,o,"number expected, NaN found")];if("minimum"in u){let f=u.minimum;if(Array.isArray(u.minimum)&&(f=u.minimum[a.arrayIndex]),o<f)return[new it(r,o,`${o} is less than the minimum value ${f}`)]}if("maximum"in u){let f=u.maximum;if(Array.isArray(u.maximum)&&(f=u.maximum[a.arrayIndex]),o>f)return[new it(r,o,`${o} is greater than the maximum value ${f}`)]}return[]}function fa(a){const r=a.key,o=a.value;if(!d.l(o))return[new it(r,o,`object expected, ${d.n(o)} found`)];const u=a.valueSpec,f=d.u(o.type);let m,g,x,w={};const E=f!=="categorical"&&o.property===void 0,I=!E,P=function(U){const Z=U.stops;return Array.isArray(Z)&&Array.isArray(Z[0])&&d.l(Z[0][0])}(o),R=zr({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(U){if(f==="identity")return[new it(U.key,U.value,'identity function may not have a "stops" property')];let Z=[];const q=U.value;return Z=Z.concat(Zl({key:U.key,value:q,valueSpec:U.valueSpec,style:U.style,styleSpec:U.styleSpec,arrayElementValidator:B})),Array.isArray(q)&&q.length===0&&Z.push(new it(U.key,q,"array must have at least one stop")),Z},default:function(U){return Si({key:U.key,value:U.value,valueSpec:u,style:U.style,styleSpec:U.styleSpec})}}});return f==="identity"&&E&&R.push(new it(a.key,a.value,'missing required property "property"')),f==="identity"||o.stops||R.push(new it(a.key,a.value,'missing required property "stops"')),f==="exponential"&&u.expression&&!d.r(u)&&R.push(new it(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(I&&!d.t(u)?R.push(new it(a.key,a.value,"property functions not supported")):E&&!d.v(u)&&R.push(new it(a.key,a.value,"zoom functions not supported"))),f!=="categorical"&&!P||o.property!==void 0||R.push(new it(a.key,a.value,'"property" property is required')),R;function B(U){let Z=[];const q=U.value,X=U.key;if(!Array.isArray(q))return[new it(X,q,`array expected, ${d.n(q)} found`)];if(q.length!==2)return[new it(X,q,`array length 2 expected, length ${q.length} found`)];if(P){if(!d.l(q[0]))return[new it(X,q,`object expected, ${d.n(q[0])} found`)];const ne=q[0];if(ne.zoom===void 0)return[new it(X,q,"object stop key must have zoom")];if(ne.value===void 0)return[new it(X,q,"object stop key must have value")];const oe=d.u(ne.zoom);if(typeof oe!="number")return[new it(X,ne.zoom,"stop zoom values must be numbers")];if(x&&x>oe)return[new it(X,ne.zoom,"stop zoom values must appear in ascending order")];oe!==x&&(x=oe,g=void 0,w={}),Z=Z.concat(zr({key:`${X}[0]`,value:q[0],valueSpec:{zoom:{}},style:U.style,styleSpec:U.styleSpec,objectElementValidators:{zoom:Xs,value:V}}))}else Z=Z.concat(V({key:`${X}[0]`,value:q[0],style:U.style,styleSpec:U.styleSpec},q));return d.x(d.y(q[1]))?Z.concat([new it(`${X}[1]`,q[1],"expressions are not allowed in function stops.")]):Z.concat(Si({key:`${X}[1]`,value:q[1],valueSpec:u,style:U.style,styleSpec:U.styleSpec}))}function V(U,Z){const q=d.n(U.value),X=d.u(U.value),ne=U.value!==null?U.value:Z;if(m){if(q!==m)return[new it(U.key,ne,`${q} stop domain type must match previous stop domain type ${m}`)]}else m=q;if(q!=="number"&&q!=="string"&&q!=="boolean"&&typeof X!="number"&&typeof X!="string"&&typeof X!="boolean")return[new it(U.key,ne,"stop domain value must be a number, string, or boolean")];if(q!=="number"&&f!=="categorical"){let oe=`number expected, ${q} found`;return d.t(u)&&f===void 0&&(oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new it(U.key,ne,oe)]}return f!=="categorical"||q!=="number"||typeof X=="number"&&isFinite(X)&&Math.floor(X)===X?f!=="categorical"&&q==="number"&&typeof X=="number"&&typeof g=="number"&&g!==void 0&&X<g?[new it(U.key,ne,"stop domain values must appear in ascending order")]:(g=X,f==="categorical"&&X in w?[new it(U.key,ne,"stop domain values must be unique")]:(w[X]=!0,[])):[new it(U.key,ne,`integer expected, found ${String(X)}`)]}}function Ao(a){const r=(a.expressionContext==="property"?d.z:d.c)(d.y(a.value),a.valueSpec);if(r.result==="error")return r.value.map(u=>
3097new it(`${a.key}${u.key}`,a.value,u.message));const o=r.value.expression||r.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!o.outputDefined())return[new it(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`)];if(a.expressionContext==="property"&&a.propertyType==="layout"&&!d.A(o))return[new it(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter")return io(o,a);if(a.expressionContext==="appearance")return Ya(o,a);if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!d.B(o,["zoom","feature-state"]))return[new it(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!d.D(o))return[new it(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function io(a,r){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const f of r.valueSpec.expression.parameters)o.delete(f);if(o.size===0)return[];const u=[];return a instanceof d.F&&o.has(a.name)?[new it(r.key,r.value,`["${a.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(a.eachChild(f=>{u.push(...io(f,r))}),u)}const Zc=new Set(["get","has","properties","geometry-type","id"]),pa=new Set(["zoom","pitch","distance-from-center","feature","feature-state","measure-light","heatmap-density","line-progress","raster-value","raster-particle-speed","sky-radial-progress"]);function Ya(a,r){if(r.valueSpec&&r.valueSpec.expression)for(const u of r.valueSpec.expression.parameters)pa.delete(u);if(pa.size===0)return[];const o=[];if(a instanceof d.F){const u=Zc.has(a.name)?"feature":a.name;if(pa.has(u))return[new it(r.key,r.value,`["${a.name}"] is not an allowed parameter`)]}return a.eachChild(u=>{o.push(...Ya(u,r))}),o}function Ys(a){const r=a.key,o=a.value,u=a.valueSpec,f=[];return Array.isArray(u.values)?u.values.includes(d.u(o))||f.push(new it(r,o,`expected one of [${u.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(u.values).includes(d.u(o))||f.push(new it(r,o,`expected one of [${Object.keys(u.values).join(", ")}], ${JSON.stringify(o)} found`)),f}function Xr(a){if(d.J(d.y(a.value))){const r=a.layerType||"fill";return Ao({...a,expressionContext:"filter",valueSpec:a.styleSpec[`filter_${r}`]})}return Ks(a)}function Ks(a){const r=a.value,o=a.key;if(!Array.isArray(r))return[new it(o,r,`array expected, ${d.n(r)} found`)];if(r.length<1)return[new it(o,r,"filter array must have at least 1 element")];const u=a.styleSpec;let f=Ys({key:`${o}[0]`,value:r[0],valueSpec:u.filter_operator});const m=()=>{r.length>=2&&(d.H(r[1])||f.push(new it(`${o}[1]`,r[1],`string expected, ${d.n(r[1])} found`)));for(let g=2;g<r.length;g++)d.u(r[1])==="$type"?f=f.concat(Ys({key:`${o}[${g}]`,value:r[g],valueSpec:u.geometry_type})):d.H(r[g])||d.q(r[g])||d.G(r[g])||f.push(new it(`${o}[${g}]`,r[g],`string, number, or boolean expected, ${d.n(r[g])} found.`))};switch(d.u(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&d.u(r[1])==="$type"&&f.push(new it(o,r,`"$type" cannot be use with operator "${r[0]}"`)),r.length!==3&&f.push(new it(o,r,`filter array for operator "${r[0]}" must have 3 elements`)),m();break;case"==":case"!=":r.length!==3&&f.push(new it(o,r,`filter array for operator "${r[0]}" must have 3 elements`)),m();break;case"in":case"!in":m();break;case"any":case"all":case"none":for(let g=1;g<r.length;g++)f=f.concat(Ks({key:`${o}[${g}]`,value:r[g],style:a.style,styleSpec:a.styleSpec}));break;case"has":case"!has":r.length!==2?f.push(new it(o,r,`filter array for "${r[0]}" operator must have 2 elements`)):d.H(r[1])||f.push(new it(`${o}[1]`,r[1],`string expected, ${d.n(r[1])} found`))}return f}const $l=/^{([^}]+)}$/;function os(a,r){const o=a.key,u=a.style,f=a.layer,m=a.styleSpec,g=a.value,x=a.objectKey,w=m[`${r}_${a.layerType}`];if(!w)return[];const E=x.match(d.U);if(E&&w[E[1]])return d.x(d.y(g))?[].concat(Si({key:o,value:g,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:u,styleSpec:m,expressionContext:"property",propertyType:r,propertyKey:x})):Si({key:o,value:g,valueSpec:{type:"string"},style:u,styleSpec:m});const I=x.match(d.K);if(r==="paint"&&I&&w[I[1]]&&w[I[1]].transition)return Si({key:o,value:g,valueSpec:m.transition,style:u,styleSpec:m});const P=a.valueSpec||w[x];if(!P)return[new Cn(o,g,`unknown property "${x}"`)];let R;if(d.H(g)&&d.t(P)&&!P.tokens&&(R=$l.exec(g))){const V=`\`{ "type": "identity", "property": ${R?JSON.stringify(R[1]):'"_"'} }\``;return[new it(o,g,`"${x}" does not support interpolation syntax 3098Use an identity property function instead: ${V}.`)]}const B=[];if(a.layerType==="symbol")x!=="text-field"||!u||u.glyphs||u.imports||B.push(new it(o,g,'use of "text-field" requires a style "glyphs" property')),x==="text-font"&&d.M(d.y(g))&&d.u(g.type)==="identity"&&B.push(new it(o,g,'"text-font" does not support identity functions'));else if(a.layerType==="model"&&r==="paint"&&f&&f.layout&&Object.hasOwn(f.layout,"model-id")&&d.t(P)&&(d.N(P)||d.v(P))){const V=d.z(d.y(g),P).value,U="expression"in V&&V.expression||"_styleExpression"in V&&V._styleExpression&&V._styleExpression.expression;U&&!d.B(U,["measure-light"])&&(x==="model-emissive-strength"&&d.D(U)&&d.A(U)||B.push(new it(o,g,`${x} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return B.concat(Si({key:a.key,value:g,valueSpec:P,style:u,styleSpec:m,expressionContext:"property",propertyType:r,propertyKey:x}))}function Js(a){return os(a,"paint")}function Ka(a){return os(a,"layout")}function ql(a){let r=[];const o=a.value,u=a.key,f=a.style,m=a.styleSpec;if(!d.l(o))return[new it(u,o,"object expected")];o.type||o.ref||r.push(new it(u,o,'either "type" or "ref" is required'));let g=d.u(o.type);const x=d.u(o.ref);
3098if(o.id){const w=d.u(o.id);for(let E=0;E<a.arrayIndex;E++){const I=f.layers[E];d.u(I.id)===w&&r.push(new it(u,o.id,`duplicate layer id "${w}", previously used at line ${I.id.__line__}`))}}if("ref"in o){let w;["type","source","source-layer","filter","layout"].forEach(E=>{E in o&&r.push(new it(u,o[E],`"${E}" is prohibited for ref layers`))}),f.layers.forEach(E=>{d.u(E.id)===x&&(w=E)}),w?w.ref?r.push(new it(u,o.ref,"ref cannot reference another ref layer")):g=d.u(w.type):typeof x=="string"&&r.push(new it(u,o.ref,`ref layer "${x}" not found`))}else if(g!=="background"&&g!=="sky"&&g!=="slot")if(o.source)if(d.H(o.source)){const w=f.sources&&Object.hasOwn(f.sources,o.source)?f.sources[o.source]:void 0,E=w&&d.u(w.type);w?E==="vector"&&g==="raster"?r.push(new it(u,o.source,`layer "${o.id}" requires a raster source`)):E==="raster"&&g!=="raster"?r.push(new it(u,o.source,`layer "${o.id}" requires a vector source`)):E!=="vector"||o["source-layer"]?E==="raster-dem"&&g!=="hillshade"?r.push(new it(u,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):E!=="raster-array"||["raster","raster-particle"].includes(g)?g==="line"&&o.paint&&o.paint["line-gradient"]&&E==="geojson"&&!w.lineMetrics?r.push(new it(u,o,`layer "${o.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):g==="line"&&o.paint&&o.paint["line-trim-offset"]&&E==="geojson"&&!w.lineMetrics?r.push(new it(u,o,`layer "${o.id}" specifies a line-trim-offset, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):g==="raster-particle"&&E!=="raster-array"&&r.push(new it(u,o.source,`layer "${o.id}" requires a 'raster-array' source.`)):r.push(new it(u,o.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new it(u,o,`layer "${o.id}" must specify a "source-layer"`)):r.push(new it(u,o.source,`source "${o.source}" not found`))}else r.push(new it(`${u}.source`,o.source,'"source" must be a string'));else r.push(new it(u,o,'missing required property "source"'));return r=r.concat(zr({key:u,value:o,valueSpec:m.layer,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Si({key:`${u}.type`,value:o.type,valueSpec:m.layer.type,style:a.style,styleSpec:a.styleSpec,object:o,objectKey:"type"}),filter:w=>Xr({layerType:g,...w}),layout:w=>zr({layer:o,key:w.key,value:w.value,valueSpec:{},style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":E=>Ka({layerType:g,...E})}}),paint:w=>zr({layer:o,key:w.key,value:w.value,valueSpec:{},style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":E=>Js({layerType:g,layer:o,...E})}}),appearances(w){const E=Zl({key:w.key,value:w.value,valueSpec:w.valueSpec,style:w.style,styleSpec:w.styleSpec,arrayElementValidator:R=>function(B){const{key:V,layer:U,layerType:Z}=B,q=d.u(B.value),X=d.u(q.name),ne=d.u(q.condition),oe=zr({key:V,value:q,valueSpec:B.styleSpec.appearance,style:B.style,styleSpec:B.styleSpec,objectElementValidators:{condition:_e=>function(ae){const ue=[];return ue.push(...Ao({key:ae.key,value:ae.object.condition,valueSpec:d.s.appearance.condition,expressionContext:"appearance"})),ue}({..._e}),properties:_e=>function(ae){const ue=[],{styleSpec:he,layer:fe,layerType:be}=ae,Re=he[`paint_${be}`],Ae=he[`layout_${be}`],Ce=ae.object[ae.objectKey];for(const Ee in Ce){const Ye=Ee in Re?"paint":Ee in Ae?"layout":void 0;if(!Ye){ue.push(new it(ae.key,Ee,`unknown property "${Ee}" for layer type "${be}"`));continue}const De={...ae,key:`${ae.key}.${Ee}`,objectKey:Ee,layer:fe,layerType:be,value:Ce[Ee],valueSpec:Ye==="paint"?Re[
vendor: 5,645 bytes, line 3098
3098Ee]:Ae[Ee]};ue.push(...os(De,Ye))}return ue}({layer:U,layerType:Z,..._e})}});return X!=="hidden"&&ne===void 0&&oe.push(new it(B.key,"name",'Appearance with name different than "hidden" must have a condition')),oe}({layerType:g,layer:o,...R})}),I=Array.isArray(w.value)?w.value:[],P=new Set;return I.forEach((R,B)=>{const V=d.u(R.name);if(V)if(P.has(V)){const U=d.u(o.id);E.push(new it(w.key,V,`Duplicated appearance name "${V}" for layer "${U}"`))}else P.add(V)}),E}}})),r}function ma({key:a,value:r}){return d.H(r)?[]:[new it(a,r,`string expected, ${d.n(r)} found`)]}const Ja={promoteId:function a({key:r,value:o}){if(d.H(o))return ma({key:r,value:o});if(Array.isArray(o)){const f=[],m=d.y(o),g=d.c(m);return g.result==="error"?(g.value.forEach(x=>{f.push(new it(`${r}${x.key}`,null,`${x.message}`))}),f):(d.B(g.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"])||f.push(new it(`${r}`,null,"promoteId expression should be only feature dependent")),f)}if(!d.l(o))return[new it(r,o,`string, expression or object expected, "${d.n(o)}" found`)];const u=[];for(const f in o)u.push(...a({key:`${r}.${f}`,value:o[f]}));return u}};function ss(a){const r=a.value,o=a.key,u=a.styleSpec,f=a.style;if(!d.l(r))return[new it(o,r,`object expected, ${d.n(r)} found`)];if(!("type"in r))return[new it(o,r,'"type" is required')];const m=d.u(r.type);let g=[];switch(["vector","raster","raster-dem","raster-array"].includes(m)&&("url"in r||"tiles"in r||g.push(new Cn(o,r,'Either "url" or "tiles" is required.'))),m){case"vector":case"raster":case"raster-dem":case"raster-array":return g=g.concat(zr({key:o,value:r,valueSpec:u[`source_${m.replace("-","_")}`],style:a.style,styleSpec:u,objectElementValidators:Ja})),g;case"geojson":if(g=zr({key:o,value:r,valueSpec:u.source_geojson,style:f,styleSpec:u,objectElementValidators:Ja}),"cluster"in r&&"clusterProperties"in r){if(!d.l(r.clusterProperties))return[new it(`${o}.clusterProperties`,r,`object expected, ${d.n(r)} found`)];for(const x in r.clusterProperties){const w=r.clusterProperties[x];if(!Array.isArray(w))return[new it(`${o}.clusterProperties.${x}`,w,"array expected")];const[E,I]=w,P=typeof E=="string"?[E,["accumulated"],["get",x]]:E;g.push(...Ao({key:`${o}.${x}.map`,value:I,expressionContext:"cluster-map"})),g.push(...Ao({key:`${o}.${x}.reduce`,value:P,expressionContext:"cluster-reduce"}))}}return g;case"video":return zr({key:o,value:r,valueSpec:u.source_video,style:f,styleSpec:u});case"image":return zr({key:o,value:r,valueSpec:u.source_image,style:f,styleSpec:u});case"canvas":return[new it(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ys({key:`${o}.type`,value:r.type,valueSpec:{values:$c(u)}})}}function $c(a){return a.source.reduce((r,o)=>{const u=a[o];return u.type.type==="enum"&&(r=r.concat(Object.keys(u.type.values||{}))),r},[])}function Le(a,r){const o=!a.includes("://");try{return new URL(a,o&&r?"http://example.com":void 0),!0}catch{return!1}}function as(a){const r=a.value;return r?d.H(r)?Le(r,!0)?[]:[new it(a.key,r,`invalid url "${r}"`)]:[new it(a.key,r,`string expected, "${d.n(r)}" found`)]:[]}function Qa(a){const r=a.value,o=a.styleSpec,u=o.light,f=a.style;if(r===void 0)return[];if(!d.l(r))return[new it("light",r,`object expected, ${d.n(r)} found`)];let m=[];for(const g in r){const x=g.match(d.K),w=g.match(d.U);m=m.concat(w&&u[w[1]]?Si({key:g,value:r[g],valueSpec:{type:"string"},style:f,styleSpec:o}):x&&u[x[1]]&&u[x[1]].transition?Si({key:g,value:r[g],valueSpec:o.transition,style:f,styleSpec:o}):u[g]?Si({key:g,value:r[g],valueSpec:u[g],style:f,styleSpec:o}):[new it(g,r[g],`unknown property "${g}"`)])}return m}function Qs(a){const r=a.value;if(!r)return[];const o=a.key;if(!d.l(r))return[new it(o,r,`object expected, ${d.n(r)} found`)];let u=[];const f=a.styleSpec,m=f["light-3d"],g=a.style,x=a.style.lights;for(const I of["type","id"])if(!(I in r))return u=u.concat([new it(o,r,`missing property "${I}"`)]),u;if(!d.H(r.type))return u=u.concat([new it(`${o}.type`,r.type,"string expected")]),u;if(x)for(let I=0;I<a.arrayIndex;I++){const P=d.u(r.type),R=x[I];d.u(R.type)===P&&u.push(new it(o,r.id,`duplicate light type "${r.type}", previously defined at line ${R.id.__line__}`))}const w=`properties_light_${r.type}`;if(!(w in f))return u=u.concat([new it(`${o}.type`,r,`Invalid light type ${r.type}`)]),u;const E=f[w];for(const I in r)if(I==="properties"){const P=r[I];if(!d.l(P))return u=u.concat([new it("properties",P,`object expected, ${d.n(P)} found`)]),u;for(const R in P){const B=R.match(d.K),V=R.match(d.U);u=u.concat(V&&E[V[1]]?Si({key:I,value:P[R],valueSpec:{type:"string"},style:g,styleSpec:f}):B&&E[B[1]]&&E[B[1]].transition?Si({key:I,value:r[I],valueSpec:f.transition,style:g,styleSpec:f}):E[R]?Si({key:R,value:P[R],valueSpec:E[R],style:g,styleSpec:f}):[new Cn(a.key,P[R],`unknown property "${R}"`)])}}else u=u.concat(m[I]?Si({key:I,value:r[I],valueSpec:m[I],style:g,styleSpec:f}):[new Cn(I,r[I],`unknown property "${I}"`)]);return u}function Wl(a){const r=a.value,o=a.key,u=a.style,f=a.styleSpec,m=f.terrain;if(r==null)return[];if(!d.l(r))return[new it("terrain",r,`object expected, ${d.n(r)} found`)];let g=[];for(const x in r){const w=x.match(d.K),E=x.match(d.U);g=g.concat(E&&m[E[1]]?Si({key:x,value:r[x],valueSpec:{type:"string"},style:u,styleSpec:f}):w&&m[w[1]]&&m[w[1]].transition?Si({key:x,value:r[x],valueSpec:f.transition,style:u,styleSpec:f}):m[x]?Si({key:x,value:r[x],valueSpec:m[x],style:u,styleSpec:f}
vendor: 13,413 bytes, line 3098
3098):[new Cn(x,r[x],`unknown property "${x}"`)])}if(r.source)if(d.H(r.source)){const x=u.sources&&Object.hasOwn(u.sources,r.source)?u.sources[r.source]:void 0,w=x&&d.u(x.type);x?w!=="raster-dem"&&g.push(new it(`${o}.source`,r.source,`terrain cannot be used with a source of type ${w}, it only be used with a "raster-dem" source type`)):g.push(new it(`${o}.source`,r.source,`source "${r.source}" not found`))}else g.push(new it(`${o}.source`,r.source,"source must be a string"));else g.push(new it(o,r,'terrain is missing required property "source"'));return g}function Hu(a){const r=a.value,o=a.style,u=a.styleSpec,f=u.fog;if(r===void 0)return[];if(!d.l(r))return[new it("fog",r,`object expected, ${d.n(r)} found`)];let m=[];for(const g in r){const x=g.match(d.K),w=g.match(d.U);m=m.concat(w&&f[w[1]]?Si({key:g,value:r[g],valueSpec:{type:"string"},style:o,styleSpec:u}):x&&f[x[1]]&&f[x[1]].transition?Si({key:g,value:r[g],valueSpec:u.transition,style:o,styleSpec:u}):f[g]?Si({key:g,value:r[g],valueSpec:f[g],style:o,styleSpec:u}):[new Cn(g,r[g],`unknown property "${g}"`)])}return m}const Zu={"*":()=>[],array:Zl,boolean:function(a){const r=a.value,o=a.key;return d.G(r)?[]:[new it(o,r,`boolean expected, ${d.n(r)} found`)]},number:Xs,color:function({key:a,value:r}){return d.H(r)?d.C.parse(d.u(r))===void 0?[new it(a,r,`color expected, "${r}" found`)]:[]:[new it(a,r,`color expected, ${d.n(r)} found`)]},enum:Ys,filter:Xr,function:fa,layer:ql,object:zr,source:ss,model:as,light:Qa,"light-3d":Qs,terrain:Wl,fog:Hu,string:ma,formatted:function(a){return ma(a).length===0?[]:Ao(a)},resolvedImage:function(a){return ma(a).length===0?[]:Ao(a)},projection:function(a){const r=a.value,o=a.styleSpec,u=o.projection,f=a.style;if(d.l(r)){let m=[];for(const g in r)m=m.concat(Si({key:g,value:r[g],valueSpec:u[g],style:f,styleSpec:o}));return m}return d.H(r)?[]:[new it("projection",r,`object or string expected, ${d.n(r)} found`)]},import:function(a){const r=a.key,{value:o,styleSpec:u}=a;if(!d.l(o))return[new it(r,o,"import must be an object")];const{data:f,...m}=o;Object.defineProperty(m,"__line__",{value:o.__line__,enumerable:!1});let g=zr({...a,value:m,valueSpec:u.import});d.u(m.id)===""&&g.push(new it(`${a.key}.id`,m,"import id can't be an empty string"));const x=d.u(m.id);return x!=="__proto__"&&x!=="constructor"&&x!=="prototype"||g.push(new it(`${a.key}.id`,m,`import id can't be "${String(x)}"`)),f&&(g=g.concat($u(f,u,{key:`${a.key}.data`}))),g},iconset:function(a){const r=a.value,o=a.key,u=a.styleSpec,f=a.style;if(!d.l(r))return[new it(o,r,"object expected")];if(!r.type)return[new it(o,r,'"type" is required')];const m=d.u(r.type);let g=[];if(g=g.concat(zr({key:o,value:r,valueSpec:u[`iconset_${m}`],style:f,styleSpec:u})),function(x,w){return!(x!=="source"||!w.source)}(m,r)){const x=f.sources&&Object.hasOwn(f.sources,r.source)?f.sources[r.source]:void 0,w=x&&d.u(x.type);x?w!=="raster-array"&&g.push(new it(o,r.source,`iconset cannot be used with a source of type ${String(w)}, it only be used with a "raster-array" source type`)):g.push(new it(o,r.source,`source "${r.source}" not found`))}return g},option:function(a){const r=a.styleSpec,o=a.value,u=d.l(o)&&d.u(o.array)===!0||!d.l(o)?void 0:d.u(o.type);return zr({...a,valueSpec:r.option,objectElementValidators:u?{default:f=>Array.isArray(f.value)?Si({...f,valueSpec:{...f.valueSpec,type:u}}):Si(f)}:void 0})}};function Si(a,r=!1){const o=a.value,u=a.valueSpec,f=a.styleSpec;if(u.expression){if(d.M(d.u(o)))return fa(a);if(d.x(d.y(o)))return Ao(a)}if(u.type&&Zu[u.type]){const m=Zu[u.type](a);return r===!0&&m.length>0&&Array.isArray(a.value)?Ao(a):m}return zr({...a,valueSpec:u.type?f[u.type]:u})}function zr(a){const r=a.key,o=a.value,u=a.valueSpec||{},f=a.objectElementValidators||{},m=a.style,g=a.styleSpec;if(!d.l(o))return[new it(r,o,`object expected, ${d.n(o)} found`)];let x=[];for(const w in o){if(!Object.hasOwn(o,w))continue;const E=w.split(".")[0],I=Object.hasOwn(u,E),P=Object.hasOwn(u,"*"),R=I?u[E]:P?u["*"]:void 0;let B;Object.hasOwn(f,E)?B=f[E]:I?B=Si:Object.hasOwn(f,"*")?B=f["*"]:P&&(B=Si),B?x=x.concat(B({key:(r&&`${r}.`)+w,value:o[w],valueSpec:R,style:m,styleSpec:g,object:o,objectKey:w},o)):x.push(new Cn(r,o[w],`unknown property "${w}"`))}for(const w in u){if(!Object.hasOwn(u,w)||Object.hasOwn(f,w))continue;const E=u[w];!E.required||E.default!==void 0||Object.hasOwn(o,w)&&o[w]!==void 0||x.push(new it(r,o,`missing required property "${w}"`))}return x}function el({key:a,value:r}){const o=ma({key:a,value:r});if(o.length)return o;const u=r;return u.includes("{fontstack}")||o.push(new it(a,r,'"glyphs" url must include a "{fontstack}" token')),u.includes("{range}")||o.push(new it(a,r,'"glyphs" url must include a "{range}" token')),o}function $u(a,r=d.s,o={}){return zr({key:o.key||"",value:a,valueSpec:{...r.$root,"*":{type:"*"}},styleSpec:r,style:a,objectElementValidators:{glyphs:el}})}function un(a){return a.slice().sort((r,o)=>r.line&&o.line?r.line-o.line:0)}const Un="setStyle",qc="addLayer",ea="removeLayer",tl="setPaintProperty",Wc="setLayerProperty",_a="setTerrain",qu="removeImport",Bt="addIconset",Ur="removeIconset";function il(a,r,o){o.push({command:"addSource",args:[a,r[a]]})}function ga(a,r,o){r.push({command:"removeSource",args:[a]}),o[a]=!0}function id(a,r,o,u){ga(a,o,u),il(a,r,o)}function yt(a,r,o){let u;for(u in a[o])if(Object.hasOwn(a[o],u)&&u!=="data"&&!d.O(a[o][u],r[o][u]))return!1;for(u in r[o])if(Object.hasOwn(r[o],u)&&u!=="data"&&!d.O(a[o][u],r[o][u]))return!1;return!0}function ls(a,r,o,u,f,m){let g;for(g in r=r||{},a=a||{})Object.hasOwn(a,g)&&(d.O(a[g],r[g])||o.push({command:m,args:[u,g,r[g],f]}));for(g in r)Object.hasOwn(r,g)&&!Object.hasOwn(a,g)&&(d.O(a[g],r[g])||o.push({command:m,args:[u,g,r[g],f]}))}function vn(a){return a.id}function Cs(a,r){return a[r.id]=r,a}const rl=new d.C(1,0,0,1),Wu=new d.C(0,1,0,1),Xl=new d.C(0,0,1,1),Yl=new d.C(1,0,1,1),Kl=new d.C(0,1,1,1);function cs(a,r,o,u,f,m,g){const x=a.context,w=a.transform,E=x.gl,I=w.projection.name==="globe",P=I?["PROJECTION_GLOBE_VIEW"]:[];let R=d.Q(o.projMatrix);if(I&&d.S(w.zoom)>0){const Ae=d.V(o.canonical,w),Ce=d.W(Ae);R=d.X(new Float32Array(16),w.globeMatrix,Ce),d.X(R,w.projMatrix,R)}const B=d.Y();B[12]+=2*f/(d.e.devicePixelRatio*w.width),B[13]+=2*m/(d.e.devicePixelRatio*w.height),d.X(R,B,R);const V=a.getOrCreateProgram("debug",{defines:P}),U=r.getTileByID(o.key);a.terrain&&a.terrain.setupElevationDraw(U,V);const Z=d.Z.disabled,q=d._.disabled,X=a.colorModeForRenderPass(),ne="$debug";x.activeTexture.set(E.TEXTURE0),a.emptyTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),I?U._makeGlobeTileDebugBuffers(a.context,w):U._makeDebugTileBoundsBuffers(a.context,w.projection);const oe=U._tileDebugBuffer||a.debugBuffer,_e=U._tileDebugIndexBuffer||a.debugIndexBuffer,ae=U._tileDebugSegments||a.debugSegments;if(V.draw(a,E.LINE_STRIP,Z,q,X,d.$.disabled,d.a0(R,u.toPremultipliedRenderColor(null)),ne,oe,_e,ae,null,null,null,[U._globeTileDebugBorderBuffer]),g){const Ae=U.latestRawTileData,Ce=Math.floor((Ae&&Ae.byteLength||0)/1024);let Ee=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(Ee+=` => ${o.overscaledZ}`),Ee+=` ${U.state}`,Ee+=` ${Ce}kb`,function(Ye,De){Ye.initDebugOverlayCanvas();const Ve=Ye.debugOverlayCanvas,$e=Ye.context.gl,ot=Ye.debugOverlayCanvas.getContext("2d");ot.clearRect(0,0,Ve.width,Ve.height),ot.shadowColor="white",ot.shadowBlur=2,ot.lineWidth=1.5,ot.strokeStyle="white",ot.textBaseline="top",ot.font="bold 36px Open Sans, sans-serif",ot.fillText(De,5,5),ot.strokeText(De,5,5),Ye.debugOverlayTexture.update(Ve),Ye.debugOverlayTexture.bind($e.LINEAR,$e.CLAMP_TO_EDGE)}(a,Ee)}const ue=r.getTile(o).tileSize,he=512/Math.min(ue,512)*(o.overscaledZ/w.zoom)*.5,fe=U._tileDebugTextBuffer||a.debugBuffer,be=U._tileDebugTextIndexBuffer||a.quadTriangleIndexBuffer,Re=U._tileDebugTextSegments||a.debugSegments;V.draw(a,E.TRIANGLES,Z,q,d.a1.alphaBlended,d.$.disabled,d.a0(R,d.C.transparent.toPremultipliedRenderColor(null),he),ne,fe,be,Re,null,null,null,[U._globeTileDebugTextBuffer])}function ro(a,r,o,u){jn(a,0,r+o/2,a.transform.width,o,u)}function Xc(a,r,o,u){jn(a,r-o/2,0,o,a.transform.height,u)}function jn(a,r,o,u,f,m){const g=a.context,x=g.gl;x.enable(x.SCISSOR_TEST),x.scissor(r*d.e.devicePixelRatio,o*d.e.devicePixelRatio,u*d.e.devicePixelRatio,f*d.e.devicePixelRatio),g.clear({color:m}),x.disable(x.SCISSOR_TEST)}function Yc(a,r,o){const u=a.context,f=u.gl,m=o.projMatrix,g=a.getOrCreateProgram("debug"),x=r.getTileByID(o.key);a.terrain&&a.terrain.setupElevationDraw(x,g);const w=d.Z.disabled,E=d._.disabled,I=a.colorModeForRenderPass(),P="$debug";u.activeTexture.set(f.TEXTURE0),a.emptyTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const R=x.queryGeometryDebugViz,B=x.queryBoundsDebugViz;if(R&&R.vertices.length>0){R.lazyUpload(u);const V=R.vertexBuffer,U=R.indexBuffer,Z=R.segments;V!=null&&U!=null&&Z!=null&&g.draw(a,f.LINE_STRIP,w,E,I,d.$.disabled,d.a0(m,R.color.toPremultipliedRenderColor(null)),P,V,U,Z)}if(B&&B.vertices.length>0){B.lazyUpload(u);const V=B.vertexBuffer,U=B.indexBuffer,Z=B.segments;V!=null&&U!=null&&Z!=null&&g.draw(a,f.LINE_STRIP,w,E,I,d.$.disabled,d.a0(m,B.color.toPremultipliedRenderColor(null)),P,V,U,Z)}}const Jl=(a,r,o,u,f,m,g,x)=>{const w=d.a2/m.tileSize;return{u_matrix:a,u_inv_rot_matrix:r,u_camera_to_center_distance:o.getCameraToCenterDistance(x),u_extrude_scale:[o.pixelsToGLUnits[0]/w,o.pixelsToGLUnits[1]/w],u_zoom_transition:u,u_tile_id:g,u_merc_center:f}},gi=(a,r,o,u)=>({u_matrix:a,u_inv_matrix:r,u_camera_to_center_distance:o.getCameraToCenterDistance(u),u_viewport_size:[o.width,o.height]});function Uo(a,r,o){const u=r.createTileMatrix(a,a.worldSize,o.toUnwrapped());return d.X(new Float32Array(16),a.projMatrix,u)}function Kc(a,r,o){if(r.projection.name===o.projection.name)return a.projMatrix;const u=o.clone();return u.setProjection(r.projection),Uo(u,r.getProjection(),a)}function nl(a,r,o){return r.name===o.projection.name?a.projMatrix:Uo(o,r,a)}let us;const Gn={loaded:!0,validateStyle:function(a,r=d.s){return un($u(a,r))},validateSource:a=>un(ss(a)),validateLight:a=>un(Qa(a)),validateLights:a=>un(Qs(a)),validateTerrain:a=>un(Wl(a)),validateFog:a=>un(Hu(a)),validateSnow:a=>un(function(r){const o=r.value,u=r.style,f=r.styleSpec,m=f.snow;if(o===void 0)return[];if(!d.l(o))return[new it("snow",o,`object expected, ${d.n(o)} found`)];let g=[];for(const x in o){const w=x.match(d.K);g=g.concat(w&&m[w[1]]&&m[w[1]].transition?Si({key:x,value:o[x],valueSpec:f.transition,style:u,styleSpec:f}):m[x]?Si({key:x,value:o[x],valueSpec:m[x],style:u,styleSpec:f}):[new Cn(x,o[x],`unknown property "${x}"`)])}return g}(a)),validateRain:a=>un(function(r){const o=r.value,u=r.style,f=r.styleSpec,m=f.rain;if(o===void 0)return[];if(!d.l(o))return[new it("rain",o,`object expected, ${d.n(o)} found`)];let g=[];for(const x in o){const w=x.match(d.K);g=g.concat(w&&m[w[1]]&&m[w[1]].transition?Si({key:x,value:o[x],valueSpec:f.transition,style:u,styleSpec:f}):m[x]?Si({key:x,value:o[x],valueSpec:m[x],style:u,styleSpec:f}):[new Cn(x,o[x],`unknown property "${x}"`)])}return g}(a)),validateLayer:a=>un(ql(a)),validateFilter:a=>un(Xr(a)),validatePaintProperty:a=>un(Js(a)),validateLayoutProperty:a=>un(Ka(a)),validateModel:a=>un(as(a)),diffStyles:function(a,r){if(!a)return[{command:Un,args:[r]}];let o=[];try{if(!d.O(a.version,r.version))return[{command:Un,args:[r]}];if(d.O(a.center,r.center)||o.push({command:"setCenter",args:[r.center]}),d.O(a.zoom,r.zoom)||o.push({command:"setZoom",args:[r.zoom]}),d.O(a.bearing,r.bearing)||o.push({command:"setBearing",args:[r.bearing]}),d.O(a.pitch,r.pitch)||o.push({command:"setPitch",args:[r.pitch]}),d.O(a.sprite,r.sprite)||o.push({command:"setSprite",args:[r.sprite]}),d.O(a.glyphs,r.glyphs)||o.push({command:"setGlyphs",args:[r.glyphs]}),d.O(a.imports,r.imports)||function(x=[],w=[],E){w=w||[];const I=(x=x||[]).map(vn),P=w.map(vn),R=x.reduce(Cs,{}),B=w.reduce(Cs,{}),V=I.slice();let U,Z,q,X;for(U=0,Z=0;U<I.length;U++)q=I[U],Object.hasOwn(B,q)?Z++:(E.push({command:qu,args:[q]}),V.splice(V.indexOf(q,Z),1));for(U=0,Z=0;U<P.length;U++)q=P[P.length-1-U],V[V.length-1-U]!==q&&(Object.hasOwn(R,q)?(E.push({command:qu,args:[q]}),V.splice(V.lastIndexOf(q,V.length-Z),1)):Z++,X=V[V.length-U],E.push({command:"addImport",args:[B[q],X]}),V.splice(V.length-U,0,q));for(const ne of w){const oe=R[ne.id];oe&&(delete oe.data,d.O(oe,ne)||E.push({command:"updateImport",args:[ne.id,ne]}))}}(a.imports,r.imports,o),d.O(a.transition,r.transition)||o.push({command:"setTransition",args:[r.transition]}),d.O(a.light,r.light)||o.push({command:"setLight",args:[r.light]}),d.O(a.fog,r.fog)||o.push({command:"setFog",args:[r.fog]}),d.O(a.snow,r.snow)||o.push({command:"setSnow",args:[r.snow]}),d.O(a.rain,r.rain)||o.push({command:"setRain",args:[r.rain]}),d.O(a.projection,r.projection)||o.push({command:"setProjection",args:[r.projection]}),d.O(a.lights,r.lights)||o.push({command:"setLights",args:[r.lights]}),d.O(a.camera,r.camera)||o.push({command:"setCamera",args:[r.camera]}),d.O(a.iconsets,r.iconsets)||function(x,w,E){let I;for(I in w=w||{},x=x||{})Object.hasOwn(x,I)&&(Object.hasOwn(w,I)||E.push({command:Ur,args:[I]}));for(I in w){if(!Object.hasOwn(w,I))continue;const P=w[I];Object.hasOwn(x,I)?d.O(x[I],P)||(E.push({command:Ur,args:[I]}),E.push({command:Bt,args:[I,P]})):E.push({command:Bt,args:[I,P]})}}(a.iconsets,r.iconsets,o),!d.O(a["color-theme"],r["color-theme"]))return[{command:Un,args:[r]}];const u={},f=[];(function(x,w,E,I){let P;
3098for(P in w=w||{},x=x||{})Object.hasOwn(x,P)&&(Object.hasOwn(w,P)||ga(P,E,I));for(P in w){if(!Object.hasOwn(w,P))continue;const R=w[P];Object.hasOwn(x,P)?d.O(x[P],R)||(x[P].type==="geojson"&&R.type==="geojson"&&yt(x,w,P)?E.push({command:"setGeoJSONSourceData",args:[P,R.data]}):id(P,w,E,I)):il(P,w,E)}})(a.sources,r.sources,f,u);const m=[];a.layers&&a.layers.forEach(x=>{x.source&&u[x.source]?o.push({command:ea,args:[x.id]}):m.push(x)});let g=a.terrain;g&&u[g.source]&&(o.push({command:_a,args:[void 0]}),g=void 0),o=o.concat(f),d.O(g,r.terrain)||o.push({command:_a,args:[r.terrain]}),function(x,w,E){w=w||[];const I=(x=x||[]).map(vn),P=w.map(vn),R=x.reduce(Cs,{}),B=w.reduce(Cs,{}),V=I.slice(),U=Object.create(null);let Z,q,X,ne,oe,_e,ae;for(Z=0,q=0;Z<I.length;Z++)X=I[Z],Object.hasOwn(B,X)?q++:(E.push({command:ea,args:[X]}),V.splice(V.indexOf(X,q),1));for(Z=0,q=0;Z<P.length;Z++)X=P[P.length-1-Z],V[V.length-1-Z]!==X&&(Object.hasOwn(R,X)?(E.push({command:ea,args:[X]}),V.splice(V.lastIndexOf(X,V.length-q),1)):q++,_e=V[V.length-Z],E.push({command:qc,args:[B[X],_e]}),V.splice(V.length-Z,0,X),U[X]=!0);for(Z=0;Z<P.length;Z++)if(X=P[Z],ne=R[X],oe=B[X],!U[X]&&!d.O(ne,oe))if(d.O(ne.source,oe.source)&&d.O(ne["source-layer"],oe["source-layer"])&&d.O(ne.type,oe.type)){for(ae in ls(ne.layout,oe.layout,E,X,null,"setLayoutProperty"),ls(ne.paint,oe.paint,E,X,null,tl),d.O(ne.slot,oe.slot)||E.push({command:"setSlot",args:[X,oe.slot]}),d.O(ne.filter,oe.filter)||E.push({command:"setFilter",args:[X,oe.filter]}),d.O(ne.minzoom,oe.minzoom)&&d.O(ne.maxzoom,oe.maxzoom)||E.push({command:"setLayerZoomRange",args:[X,oe.minzoom,oe.maxzoom]}),ne)Object.hasOwn(ne,ae)&&ae!=="layout"&&ae!=="paint"&&ae!=="filter"&&ae!=="metadata"&&ae!=="minzoom"&&ae!=="maxzoom"&&ae!=="slot"&&(ae.indexOf("paint.")===0?ls(ne[ae],oe[ae],E,X,ae.slice(6),tl):d.O(ne[ae],oe[ae])||E.push({command:Wc,args:[X,ae,oe[ae]]}));for(ae in oe)Object.hasOwn(oe,ae)&&!Object.hasOwn(ne,ae)&&ae!=="layout"&&ae!=="paint"&&ae!=="filter"&&ae!=="metadata"&&ae!=="minzoom"&&ae!=="maxzoom"&&ae!=="slot"&&(ae.indexOf("paint.")===0?ls(ne[ae],oe[ae],E,X,ae.slice(6),tl):d.O(ne[ae],oe[ae])||E.push({command:Wc,args:[X,ae,oe[ae]]}))}else E.push({command:ea,args:[X]}),_e=V[V.lastIndexOf(X)+1],E.push({command:qc,args:[oe,_e]})}(m,r.layers,o)}catch(u){console.warn("Unable to compute style diff:",u),o=[{command:Un,args:[r]}]}return o},drawDebug:function(a,r,o,u,f,m){for(let g=0;g<o.length;g++)if(f){const E=new d.C(u.r*.8,u.g*.8,u.b*.8,1);cs(a,r,o[g],u,-1,-1,m),cs(a,r,o[g],u,-1,1,m),cs(a,r,o[g],u,1,1,m),cs(a,r,o[g],u,1,-1,m),cs(a,r,o[g],E,0,0,m)}else cs(a,r,o[g],u,0,0,m)},drawDebugPadding:function(a){const r=a.transform.padding;ro(a,a.transform.height-(r.top||0),3,rl),ro(a,r.bottom||0,3,Wu),Xc(a,r.left||0,3,Xl),Xc(a,a.transform.width-(r.right||0),3,Yl);const o=a.transform.centerPoint;(function(u,f,m,g){jn(u,f-1,m-10,2,20,g),jn(u,f-10,m-1,20,2,g)})(a,o.x,a.transform.height-o.y,Kl)},drawDebugQueryGeometry:function(a,r,o){for(let u=0;u<o.length;u++)Yc(a,r,o[u])},drawCollisionDebug:function(a,r,o,u,f,m,g){const x=a.context,w=x.gl,E=a.transform,I=[d.a7(E.center.lng),d.a8(E.center.lat)],P=o.layout.get("symbol-placement"),R=o.layout.get("text-variable-anchor"),B=o.layout.get("icon-rotation-alignment")==="map",V=o.layout.get("text-rotation-alignment")==="map",U=P!=="point",Z=[];let q=0,X=0;for(let he=0;he<u.length;he++){const fe=u[he],be=r.getTile(fe),Re=be.getBucket(o);if(!Re)continue;const Ae=Re.getProjection().createInversionMatrix(E,fe.canonical),Ce=[],Ee=Kc(fe,Re,E),Ye=!g&&B&&U,De=g&&V&&U,Ve=R&&Re.hasTextData(),$e=Re.hasIconTextFit()&&Ve&&Re.hasIconData(),ot=Ye||De||g&&Ve||$e,et=Re.projection.name==="globe",Xe=et?d.S(E.zoom):0;et&&(Ce.push("PROJECTION_GLOBE_VIEW"),ot&&Ce.push("PROJECTED_POS_ON_VIEWPORT"));const mt=a.getOrCreateProgram("collisionBox",{defines:Ce});let qe=Ee;f[0]===0&&f[1]===0||(qe=a.translatePosMatrix(Ee,be,f,m));const Ge=g?Re.textCollisionBox:Re.iconCollisionBox,Qe=Re.collisionCircleArray;if(Qe.length>0){const rt=d.Y(),ct=qe;d.a9(rt,Re.placementInvProjMatrix,E.glCoordMatrix),d.a9(rt,rt,Re.placementViewportMatrix),Z.push({circleArray:Qe,circleOffset:X,transform:ct,invTransform:rt,projection:Re.getProjection()}),q+=Qe.length/4,X=q}if(!Ge)continue;a.terrain&&a.terrain.setupElevationDraw(be,mt);const dt=et?[fe.canonical.x,fe.canonical.y,1<<fe.canonical.z]:[0,0,0];mt.draw(a,w.LINES,d.Z.disabled,d._.disabled,a.colorModeForRenderPass(),d.$.disabled,Jl(qe,Ae,E,Xe,I,be,dt,Re.getProjection()),o.id,Ge.layoutVertexBuffer,Ge.indexBuffer,Ge.segments,null,E.zoom,null,[Ge.collisionVertexBuffer,Ge.collisionVertexBufferExt])}if(!g||!Z.length)return;const ne=a.getOrCreateProgram("collisionCircle"),oe=new d.aa;oe.resize(4*q),oe._trim();let _e=0;for(const he of Z)for(let fe=0;fe<he.circleArray.length/4;fe++){const be=4*fe,Re=he.circleArray[be+0],Ae=he.circleArray[be+1],Ce=he.circleArray[be+2],Ee=he.circleArray[be+3];oe.emplace(_e++,Re,Ae,Ce,Ee,0),oe.emplace(_e++,Re,Ae,Ce,Ee,1),oe.emplace(_e++,Re,Ae,Ce,Ee,2),oe.emplace(_e++,Re,Ae,Ce,Ee,3)}
vendor: 9,307 bytes, line 3098
3098(!us||us.length<2*q)&&(us=function(he){const fe=2*he,be=new d.ad;be.resize(fe),be._trim();for(let Re=0;Re<fe;Re++){const Ae=6*Re;be.uint16[Ae+0]=4*Re+0,be.uint16[Ae+1]=4*Re+1,be.uint16[Ae+2]=4*Re+2,be.uint16[Ae+3]=4*Re+2,be.uint16[Ae+4]=4*Re+3,be.uint16[Ae+5]=4*Re+0}return be}(q));const ae=x.createIndexBuffer(us,!0),ue=x.createVertexBuffer(oe,d.ab.members,!0);for(const he of Z){const fe=gi(he.transform,he.invTransform,E,he.projection);ne.draw(a,w.TRIANGLES,d.Z.disabled,d._.disabled,a.colorModeForRenderPass(),d.$.disabled,fe,o.id,ue,ae,d.ac.simpleSegment(0,2*he.circleOffset,he.circleArray.length,he.circleArray.length/2),null,E.zoom)}ue.destroy(),ae.destroy()}};async function jo(){return Promise.resolve()}function ya(a,r){let o=!1;if(r&&r.length)for(const u of r)u instanceof Cn?d.w(u.message):(a.fire(new d.f(new Error(u.message))),o=!0);return o}function Fr(a){return(...r)=>{const o=Gn[a];return o?o(...r):[]}}const no=Fr("validateStyle"),Xu=Fr("validateSource"),Yu=Fr("validateLight"),Ql=Fr("validateLights"),Ku=Fr("validateTerrain"),Jc=Fr("validateFog"),ec=Fr("validateSnow"),Qc=Fr("validateRain"),ol=Fr("validateLayer"),H=Fr("validateFilter"),M=Fr("validatePaintProperty"),k=Fr("validateLayoutProperty"),$=Fr("validateModel"),J=d.s.light;let Y;class Q extends d.E{constructor(r,o="flat"){super(),this._transitionable=new d.ae(Y||(Y=new d.af({anchor:new d.ag(J.anchor),position:new d.ah(J.position),color:new d.ag(J.color),intensity:new d.ag(J.intensity)}))),this.setLight(r,o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,o,u={}){this._validate(Yu,r,u)||(this._transitionable.setTransitionOrValue(r),this.id=o)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,o,u){return(!u||u.validate!==!1)&&ya(this,r.call(no,{value:o,style:{glyphs:!0,sprite:!0},styleSpec:d.s}))}}const ie=d.s.terrain;let re=class extends d.E{constructor(a,r,o,u,f){super(),this.scope=o,this._transitionable=new d.ae(new d.af({source:new d.ag(ie.source),exaggeration:new d.ag(ie.exaggeration)}),o,u),this._transitionable.setTransitionOrValue(a,u),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r,this.worldview=f}get(){return this._transitionable.serialize()}set(a,r){this._transitionable.setTransitionOrValue(a,r)}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}getExaggeration(a){return this._transitioning.possiblyEvaluate(new d.ai(a,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const a=this._transitionable._values.exaggeration;if(!a)return null;const r=a.value.expression;if(!r)return null;let o=-1,u=-1,f=1;for(const m of r.zoomStops)f=r.evaluate(new d.ai(m,{worldview:this.worldview})),f>.01?(o=m,u=-1):u=m;return f<.01&&o>0&&u>o?[o,u]:null}isZoomDependent(){const a=this._transitionable._values.exaggeration;return a!=null&&a.value!=null&&a.value.expression!=null&&a.value.expression instanceof d.aj}};function ce(a,r){const o=a?a.terrain:null;return!!o&&(!r||!!r.projection.requiresDraping||!o.isZoomDependent()||o.getExaggeration(r.zoom)>0)}const ye=d.s.fog;class Te extends d.E{constructor(r,o,u,f){super();const m=new d.af({range:new d.ag(ye.range),color:new d.ag(ye.color),"color-use-theme":new d.ag({type:"string","property-type":"data-constant",default:"default"}),"high-color":new d.ag(ye["high-color"]),"high-color-use-theme":new d.ag({type:"string","property-type":"data-constant",default:"default"}),"space-color":new d.ag(ye["space-color"]),"space-color-use-theme":new d.ag({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new d.ag(ye["horizon-blend"]),"star-intensity":new d.ag(ye["star-intensity"]),"vertical-range":new d.ag(ye["vertical-range"])});this._transitionable=new d.ae(m,u,f),this.set(r,f),this._transitioning=this._transitionable.untransitioned(),this._transform=o,this.properties=new d.ak(m),this.scope=u}get state(){const r=this._transform,o=r.projection.name==="globe",u=d.S(r.zoom),f=this.properties.get("range"),m=[2,4.5],g=.5/Math.tan(.5*r._fov),x=[f[0]+g,f[1]+g];return{range:o?[d.al(m[0],x[0],u),d.al(m[1],x[1],u)]:x,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,o,u={}){if(this._validate(Jc,r,u))return;const f={...r};for(const m of Object.keys(ye))f[m]===void 0&&(f[m]=ye[m].default);this._options=f,this._transitionable.setTransitionOrValue(this._options,o)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;const o=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:d.am(d.ao,d.an,r))*o.a}getOpacityAtLatLng(r,o){return this._transform.projection.supportsFog?d.ap(this.state,r,o):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];const o=this._transform.calculateFogTileMatrix(r.toUnwrapped());return d.aq(this.state,o,0,0,d.a2,d.a2,this._transform)}getOpacityForBounds(r,o,u,f,m){return this._transform.projection.supportsFog?d.aq(this.state,r,o,u,f,m,this._transform):[1,1]}getRangeForProjection(){return this._transform.projection.supportsFog?this.state.range:[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;const o=[4,5,6,7];for(const u of o){const f=r.points[u];let m;if(f[2]>=0)m=f;else{const g=r.points[u-4];m=d.ar(g,f,g[2]/(g[2]-f[2]))}if(d.as(this.state,m[0],m[1],0,this._transform)>=d.at)return!0}return!1}updateConfig(r){this._transitionable.setTransitionOrValue(this._options,r)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,o,u){return(!u||u.validate!==!1)&&ya(this,r.call(no,{value:o,style:{glyphs:!0,sprite:!0},styleSpec:d.s}))}}let ze,ke,Ue=class extends d.E{constructor(a,r,o,u){super();const f=ze||(ze=new d.af({density:new d.ag(d.s.snow.density),intensity:new d.ag(d.s.snow.intensity),color:new d.ag(d.s.snow.color),opacity:new d.ag(d.s.snow.opacity),vignette:new d.ag(d.s.snow.vignette),"vignette-color":new d.ag(d.s.snow["vignette-color"]),"center-thinning":new d.ag(d.s.snow["center-thinning"]),direction:new d.ag(d.s.snow.direction),"flake-size":new d.ag(d.s.snow["flake-size"])}));this._transitionable=new d.ae(f,o,u),this.set(a,u),this._transitioning=this._transitionable.untransitioned(),this.properties=new d.ak(f),this.scope=o}get state(){const a=this.properties.get("opacity"),r=this.properties.get("color"),o=this.properties.get("direction"),u=d.au(o[0]),f=-Math.max(d.au(o[1]),.01),m=[Math.cos(u)*Math.cos(f),Math.sin(u)*Math.cos(f),Math.sin(f)],g=this.properties.get("vignette"),x=this.properties.get("vignette-color"),w=new d.C(x.r,x.g,x.b,g);return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new d.C(r.r,r.g,r.b,r.a*a),direction:m,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:w}}get(){return this._transitionable.serialize()}set(a,r,o={}){if(this._validate(ec,a,o))return;const u={...a},f=d.s.snow;for(const m of Object.keys(f))u[m]===void 0&&(u[m]=f[m].default);this._options=u,this._transitionable.setTransitionOrValue(this._options,r)}updateConfig(a){this._transitionable.setTransitionOrValue(this._options,a)}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,r,o){return(!o||o.validate!==!1)&&ya(this,a.call(no,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:d.s}))}},ut=class extends d.E{constructor(a,r,o,u){super();const f=ke||(ke=new d.af({density:new d.ag(d.s.rain.density),intensity:new d.ag(d.s.rain.intensity),color:new d.ag(d.s.rain.color),opacity:new d.ag(d.s.rain.opacity),vignette:new d.ag(d.s.rain.vignette),"vignette-color":new d.ag(d.s.rain["vignette-color"]),"center-thinning":new d.ag(d.s.rain["center-thinning"]),direction:new d.ag(d.s.rain.direction),"droplet-size":new d.ag(d.s.rain["droplet-size"]),"distortion-strength":new d.ag(d.s.rain["distortion-strength"])}));this._transitionable=new d.ae(f,o,u),this.set(a,u),this._transitioning=this._transitionable.untransitioned(),this.properties=new d.ak(f),this.scope=o}get state(){const a=this.properties.get("opacity"),r=this.properties.get("color"),o=this.properties.get("direction"),u=d.au(o[0]),f=-Math.max(d.au(o[1]),.01),m=[Math.cos(u)*Math.cos(f),Math.sin(u)*Math.cos(f),Math.sin(f)],g=this.properties.get("vignette-color"),x=new d.C(g.r,g.g,g.b,this.properties.get("vignette"));return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new d.C(r.r,r.g,r.b,r.a*a),direction:m,centerThinning:this.properties.get("center-thinning"),droplet
3098Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:x}}get(){return this._transitionable.serialize()}set(a,r,o={}){if(this._validate(Qc,a,o))return;const u={...a},f=d.s.rain;for(const m of Object.keys(f))u[m]===void 0&&(u[m]=f[m].default);this._options=u,this._transitionable.setTransitionOrValue(this._options,r)}updateConfig(a){this._transitionable.setTransitionOrValue(this._options,a)}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,r,o){return(!o||o.validate!==!1)&&ya(this,a.call(no,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:d.s}))}};const nt={workerUrl:"",workerClass:null,workerParams:void 0};function Je(a){return nt.workerClass!=null?new nt.workerClass:new self.Worker(nt.workerUrl,{name:a,type:"module",...nt.workerParams})}const gt="mapboxgl_preloaded_worker_pool";class at{constructor(r){this.active={},this.name=r}acquire(r,o=at.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<o;){const u=Je(`${this.name||""}WorkerPool: ${r}-${this.workers.length}`);this.workers.push(u)}return this.active[r]=!0,this.workers.slice()}release(r){delete this.active[r],this.workers&&this.numActive()===0&&(this.workers.forEach(o=>{o.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[gt]}numActive(){return Object.keys(this.active).length}}at.workerCount=2;class At{constructor(r,o,u="Worker",f=at.workerCount){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=d.av();const m=this.workerPool.acquire(this.id,f);for(let g=0;g<m.length;g++){const x=new At.Actor(m[g],o,this.id);x.name=`${u} ${g}`,this.actors.push(x)}this.ready=!1,this.send("checkIfReady",null).then(()=>{this.ready=!0}).catch(()=>{})}send(r,o,u){return Promise.all(this.actors.map(f=>f.send(r,o,u)))}broadcast(r,o){for(const u of this.actors)u.notify(r,o)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(r=>{r.remove()}),this.actors=[],this.workerPool.release(this.id)}}At.Actor=d.aw;class Nt extends d.E{constructor(r,o,u,f){super(),this.scope=u,this._options=r,this.properties=new d.ak(o),this._transitionable=new d.ae(o,u,f),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(r){this._transitionable.setTransitionOrValue(this._options.properties,r)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(r,o){this._options=r,this._transitionable.setTransitionOrValue(r.properties,o)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}let jt;const Ht=()=>jt||(jt=new d.af({color:new d.ag(d.s.properties_light_ambient.color),"color-use-theme":new d.ag({type:"string",default:"default","property-type":"data-constant"}),intensity:new d.ag(d.s.properties_light_ambient.intensity)}));let Ct;const xi=()=>Ct||(Ct=new d.af({direction:new d.ax(d.s.properties_light_directional.direction),color:new d.ag(d.s.properties_light_directional.color),"color-use-theme":new d.ag({type:"string",default:"default","property-type":"data-constant"}),intensity:new d.ag(d.s.properties_light_directional.intensity),"cast-shadows":new d.ag(d.s.properties_light_directional["cast-shadows"]),"shadow-quality":new d.ag(d.s.properties_light_directional["shadow-quality"]),"shadow-intensity":new d.ag(d.s.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new d.ag(d.s.properties_light_directional["shadow-draw-before-layer"])})),pi=(a,r,o,u,f,m,g,x,w,E=[0,0,1])=>({u_matrix:a,u_normal_matrix:r,u_opacity:o,u_faux_facade_ao_intensity:u,u_camera_pos:f,u_tile_to_meter:m,u_facade_emissive_chance:g,u_flood_light_color:x,u_flood_light_intensity:w,u_front_cutoff_params:E}),kt=a=>({u_matrix:a}),Zt=a=>({u_matrix:a}),Mt=d.ay;async function $t(){return Promise.resolve()}function mi(a,r,o,u,f,m,g,x){o.resetLayerRenderingStats(a);const w=a.context,E=w.gl,I=a.transform,P=o.paint.get("fill-extrusion-pattern"),R=o.paint.get("fill-extrusion-pattern-cross-fade"),B=P.constantOr(null),V=P.constantOr(1),U=o.paint.get("fill-extrusion-opacity"),Z=a.style.enable3dLights(),q=o.paint.get(Z&&!V?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),X=[o.paint.get("fill-extrusion-ambient-occlusion-intensity"),q],ne=o.layout.get("fill-extrusion-edge-radius"),oe=ne>0&&!o.paint.get("fill-extrusion-rounded-roof"),_e=oe?0:ne,ae=I.projection.name==="globe"?d.aD():0,ue=I.projection.name==="globe",he=ue?d.S(I.zoom):0,fe=[d.a7(I.center.lng),d.a8(I.center.lat)],be=o.paint.get("fill-extrusion-flood-light-color-use-theme").
vendor: 6,197 bytes, line 3098
3098constantOr("default")==="none",Re=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(be?null:o.lut).toArray01().slice(0,3),Ae=o.paint.get("fill-extrusion-flood-light-intensity"),Ce=o.paint.get("fill-extrusion-vertical-scale"),Ee=o.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Ye=o.paint.get("fill-extrusion-height-alignment"),De=o.paint.get("fill-extrusion-base-alignment"),Ve=d.aE(a,o.paint.get("fill-extrusion-cutoff-fade-range")),$e=o.paint.get("fill-extrusion-front-cutoff"),ot=di(I.pitch,$e,!!a.terrain),et=ot[2]<1;et&&(a.maxFrontCutoffRawStart=Math.max(a.maxFrontCutoffRawStart,$e[0]));const Xe=[];let mt;ue&&Xe.push("PROJECTION_GLOBE_VIEW"),X[0]>0&&Xe.push("FAUX_AO"),oe&&Xe.push("ZERO_ROOF_RADIUS"),x&&Xe.push("HAS_CENTROID"),Ae>0&&Xe.push("FLOOD_LIGHT"),Ve.shouldRenderCutoff&&Xe.push("RENDER_CUTOFF"),et&&Xe.push("RENDER_FRONT_CUTOFF"),Ee&&Xe.push("RENDER_WALL_MODE");const qe=a.renderPass==="shadow",Ge=a.shadowRenderer,Qe=qe&&!!Ge,dt=qe?d.$.disabled:d.$.backCCW;a.shadowRenderer&&(a.shadowRenderer.useNormalOffset=!0);let rt=[0,0,0];if(Ge){const Dt=a.style.directionalLight,bt=a.style.ambientLight;Dt&&bt&&(rt=d.aF(a.style,Dt,bt)),qe||(Xe.push("RENDER_SHADOWS"),Ge.useNormalOffset&&Xe.push("NORMAL_OFFSET")),mt=Xe.concat(["SHADOWS_SINGLE_CASCADE"])}const ct=Qe?"fillExtrusionDepth":V?"fillExtrusionPattern":"fillExtrusion",_t=o.getLayerRenderingStats();for(const Dt of u){const bt=r.getTile(Dt),Kt=bt.getBucket(o);if(!Kt||Kt.projection.name!==I.projection.name)continue;let Ti=!1;Ge&&(Ti=Ge.getMaxCascadeForTile(Dt.toUnwrapped())===0);const ai=a.isTileAffectedByFog(Dt),Ot=Kt.programConfigurations.get(o.id);let Tt=!1;if(B&&bt.imageAtlas){const ni=bt.imageAtlas,lr=d.aG.from(B),cr=lr.getPrimary().scaleSelf(d.e.devicePixelRatio).toString(),Ri=lr.getSecondary(),li=ni.patternPositions.get(cr),rr=Ri?ni.patternPositions.get(Ri.scaleSelf(d.e.devicePixelRatio).toString()):null;Tt=!!li&&!!rr,li&&Ot.setConstantPatternPositions(li,rr)}R>0&&(Tt||Ot.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Xe.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Ei=a.getOrCreateProgram(ct,{config:Ot,defines:Ti?mt:Xe,overrideFog:ai});if(a.terrain&&a.terrain.setupElevationDraw(bt,Ei,{useMeterToDem:!0}),!Kt.centroidVertexBuffer){const ni=Ei.getAttributeLocation(E,"a_centroid_pos");ni!==-1&&E.vertexAttribI4ui(ni,0,0,0,0)}!qe&&Ge&&Ge.setupShadows(bt.tileID.toUnwrapped(),Ei,"vector-tile"),V&&(a.context.activeTexture.set(E.TEXTURE0),bt.imageAtlasTexture&&bt.imageAtlasTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),Ot.updatePaintBuffers());const Ji=o.paint.get("fill-extrusion-vertical-gradient"),Ui=1/Kt.tileToMeter;let Ut;if(qe&&Ge){if(wi(bt.tileID,Kt.maxHeight,a))continue;const ni=Ge.calculateShadowPassMatrixFromTile(bt.tileID.toUnwrapped());Ut=d.aM(ni,_e,Ui,Ce,Ye,De)}else{const ni=a.translatePosMatrix(Dt.expandedProjMatrix,bt,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),lr=I.projection.createInversionMatrix(I,Dt.canonical),cr=Ei.fixedDefines.includes("LIGHTING_3D_MODE");Ut=V?d.aH(ni,a,Ji,U,X,_e,Ui,Dt,bt,ae,Ye,De,he,fe,lr,Re,Ce,R,cr):d.aI(ni,a,Ji,U,X,_e,Ui,Dt,ae,Ye,De,he,fe,lr,Re,Ce,Ae,rt,ot,cr)}a.uploadCommonUniforms(w,Ei,Dt.toUnwrapped(),null,Ve);let Mi=Kt.segments;if(I.projection.name==="mercator"&&!qe&&(Mi=Kt.getVisibleSegments(bt.tileID,a.terrain,a.transform.getFrustum(0)),!Mi.get().length))continue;if(_t)if(qe)for(const ni of Mi.get())_t.numRenderedVerticesInShadowPass+=ni.primitiveLength;else for(const ni of Mi.get())_t.numRenderedVerticesInTransparentPass+=ni.primitiveLength;const _i=[];(a.terrain||x)&&_i.push(Kt.centroidVertexBuffer),ue&&_i.push(Kt.layoutVertexExtBuffer),Ee&&_i.push(Kt.wallVertexBuffer),Ei.draw(a,w.gl.TRIANGLES,f,m,g,dt,Ut,o.id,Kt.layoutVertexBuffer,Kt.indexBuffer,Mi,o.paint,a.transform.zoom,Ot,_i)}a.shadowRenderer&&(a.shadowRenderer.useNormalOffset=!1)}class Ft{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function di(a,r,o){if(!(r[2]<1)||o)return[0,0,1];const u=180*a/Math.PI;if(u<15)return[-.5,r[1],r[2]];const f=Math.min(1,Math.max(0,(u-15)/5)),m=f*f*(3-2*f);return[-.5*(1-m)+r[0]*m,r[1],r[2]]}function vr(a,r,o,u,f,m,g){u.centroidVertexArray.length===0&&u.createCentroidsBuffer();const x=m?m.findDEMTileFor(o):null;if(!(x&&x.dem||g))return;m&&x&&x.dem&&u.selfDEMTileTimestamp!==x.dem._timestamp&&(u.borderDoneWithNeighborZ=[-1,-1,-1,-1],u.selfDEMTileTimestamp=x.dem._timestamp);const w=(q,X)=>{(q.flags|X.flags)&d.aJ?(q.flags|=d.aJ,X.flags|=d.aJ):(q.flags&=~d.aJ,X.flags&=~d.aJ)},E=q=>new d.P(Math.ceil((q+d.aK)*d.aL),0),I=(q,X,ne)=>{const oe=Math.ceil((q+d.aK)*d.aL),_e=Math.floor(Math.max(0,Math.min(d.a2-1,ne))/4);return new d.P(oe,_e<<5|(3&X)<<3|7)},P=q=>{const X=r.getSource().minzoom,ne=_e=>{const ae=r.getTileByID(_e);if(ae&&ae.hasData())return ae.getBucket(f)},oe=[0,-1,1];for(const _e of oe){if(q.overscaledZ+_e<X)continue;const ae=ne(q.calculateScaledKey(q.overscaledZ+_e));if(ae)return ae}},R=[0,0,0],B=(q,X)=>(R[0]=Math.min(q.min.y,X.min.y),R[1]=Math.max(q.max.y,X.max.y),R[2]=d.a2-X.min.x>q.max.x?X.min.x-d.a2:q.max.x,R),V=(q,X)=>(R[0]=Math.min(q.min.x,X.min.x),R[1]=Math.max(q.max.x,X.max.x),R[2]=d.a2-X.min.y>q.max.y?X.min.y-d.a2:q.max.y,R),U=[(q,X)=>B(q,X),(q,X)=>B(X,q),(q,X)=>V(q,X),(q,X)=>V(X,q)],Z=(q,X,ne,oe,_e,ae,ue)=>{if(!m)return 0;const he=[[ae?ne:q,ae?q:ne,0],[ae?ne:X,ae?X:ne,0]],fe=ue<0?d.a2+ue:ue,be=[ae?fe:(q+X)/2,ae?(q+X)/2:fe,0];return ne===0&&ue<0||ne!==0&&ue>0?m.getForTilePoints(_e,[be],!0,oe):he.push(be),m.getForTilePoints(o,he,!0,x),Math.max(he[0][2],he[1][2],be[2])/m.exaggeration()};for(let q=0;q<4;q++){const X=u.borderFeatureIndices[q];if(X.length===0)continue;const ne=d.aB[q](o),oe=P(ne);if(!(oe&&oe instanceof d.aC))continue;const _e=m?m.findDEMTileFor(ne):null;if(!(_e&&_e.dem||g)||(m&&_e&&_e.dem&&u.borderDEMTileTimestamp[q]!==_e.dem._timestamp&&(u.borderDoneWithNeighborZ[q]=-1,u.borderDEMTileTimestamp[q]=_e.dem._timestamp),u.borderDoneWithNeighborZ[q]===oe.canonical.z))continue;oe.centroidVertexArray.length===0&&oe.createCentroidsBuffer();const ae=(q<2?1:5)-q,ue=oe.borderDoneWithNeighborZ[ae]!==u.canonical.z,he=oe.borderFeatureIndices[ae];let fe=0;
3098if(u.canonical.z!==oe.canonical.z){for(const Ce of X)u.showCentroid(u.featuresOnBorder[Ce]);if(ue)for(const Ce of he)oe.showCentroid(oe.featuresOnBorder[Ce]);u.borderDoneWithNeighborZ[q]=oe.canonical.z,oe.borderDoneWithNeighborZ[ae]=u.canonical.z;continue}const be=new Map,Re=new Set,Ae=new Set;for(let Ce=0;Ce<he.length;Ce++){const Ee=oe.featuresOnBorder[he[Ce]];Ee.buildingId!==void 0&&be.set(Ee.buildingId,Ce)}for(const Ce of X){const Ee=u.featuresOnBorder[Ce],Ye=u.centroidData.get(Ee.centroidDataIndex);if(Ee.buildingId===void 0)continue;const De=be.get(Ee.buildingId);if(De===void 0)continue;const Ve=oe.featuresOnBorder[he[De]],$e=oe.centroidData.get(Ve.centroidDataIndex);Re.add(Ce),Ae.add(De),g&&w(Ye,$e);const ot=Ye.groupCentroidPos.x!==0||Ye.groupCentroidPos.y!==0?Ye.groupCentroidPos:Ee.centroid(),et=$e.groupCentroidPos.x!==0||$e.groupCentroidPos.y!==0?$e.groupCentroidPos:Ve.centroid(),Xe=q<2?Math.round((ot.y+et.y)/2):Math.round((ot.x+et.x)/2),mt=Ee.intersectsCount()>1||Ve.intersectsCount()>1;{let qe=0;if(_e&&_e.dem&&!mt){const Ge=U[q](Ye,$e),Qe=q%2?d.a2-1:0;qe=Z(Ge[0],Math.min(d.a2-1,Ge[1]),Qe,_e,ne,q<2,Ge[2])}Ye.centroidXY=I(qe,q,Xe),$e.centroidXY=I(qe,ae,Xe)}if(u.writeCentroidToBuffer(Ye),oe.writeCentroidToBuffer($e),Ee.buildingId!==void 0){for(const qe of u.centroidData)qe.buildingId===Ee.buildingId&&qe!==Ye&&(qe.centroidXY=Ye.centroidXY,u.writeCentroidToBuffer(qe));for(const qe of oe.centroidData)qe.buildingId===Ee.buildingId&&qe!==$e&&(qe.centroidXY=$e.centroidXY,oe.writeCentroidToBuffer(qe))}}for(const Ce of X){if(Re.has(Ce))continue;const Ee=u.featuresOnBorder[Ce],Ye=u.centroidData.get(Ee.centroidDataIndex),De=Ee.borders[q];let Ve;for(;fe<he.length;){if(Ae.has(fe)){fe++;continue}Ve=oe.featuresOnBorder[he[fe]];const $e=Ve.borders[ae];if($e[1]>De[0]+3||$e[0]>De[0]-3)break;oe.showCentroid(Ve),fe++}if(Ve&&fe<he.length){let $e=fe,ot=0;for(;;)if(Ae.has(fe)){if(++fe===he.length)break;Ve=oe.featuresOnBorder[he[fe]]}else{if(Ve.borders[ae][0]>De[1]-3||(ot++,++fe===he.length))break;Ve=oe.featuresOnBorder[he[fe]]}for(;$e<he.length&&Ae.has($e);)$e++;if($e>
3098=he.length){u.showCentroid(Ee);continue}Ve=oe.featuresOnBorder[he[$e]];let et=!1;if(ot>=1){const qe=Ve.borders[ae];Math.abs(De[0]-qe[0])<3&&Math.abs(De[1]-qe[1])<3&&(ot=1,et=!0,fe=$e+1)}else if(ot===0){u.showCentroid(Ee);continue}const Xe=oe.centroidData.get(Ve.centroidDataIndex);g&&et&&w(Ye,Xe);const mt=Ee.intersectsCount()>1||Ve.intersectsCount()>1;if(ot>1)fe=$e,Ye.centroidXY=Xe.centroidXY=new d.P(0,0);else if(_e&&_e.dem&&!mt){const qe=U[q](Ye,Xe),Ge=q%2?d.a2-1:0,Qe=Z(qe[0],Math.min(d.a2-1,qe[1]),Ge,_e,ne,q<2,qe[2]);Ye.centroidXY=Xe.centroidXY=E(Qe)}else mt?Ye.centroidXY=Xe.centroidXY=new d.P(0,0):(Ye.centroidXY=u.encodeBorderCentroid(Ee),Xe.centroidXY=oe.encodeBorderCentroid(Ve));u.writeCentroidToBuffer(Ye),oe.writeCentroidToBuffer(Xe)}else u.showCentroid(Ee)}u.borderDoneWithNeighborZ[q]=oe.canonical.z,oe.borderDoneWithNeighborZ[ae]=u.canonical.z}(u.needsCentroidUpdate||!u.centroidVertexBuffer&&u.centroidVertexArray.length!==0)&&u.uploadCentroid(a)}const vi=[1,0,0],_r=[0,1,0],Ki=[0,0,1];function wi(a,r,o){const u=o.transform,f=o.shadowRenderer;if(!f)return!0;const m=o.frameCounter,g=o.currentShadowCascade;let x=o._shadowCullCache;if(!x||x.frame!==m||x.cascade!==g){const q=u.tileSize*f._cascades[g].scale,X=u.scaleZoom(q),ne=f.shadowDirection,oe=[ne[0],ne[1],-ne[2]],_e=[vi,_r,Ki,oe,[oe[0],0,oe[2]],[0,oe[1],oe[2]]];x={frame:m,cascade:g,cameraFrustum:d.az.fromInvProjectionMatrix(u.invProjMatrix,u.worldSize,X,u.projection.name!=="globe"),edges:_e,shadowDir:oe,ws:q,zoom:X},o._shadowCullCache=x}const{cameraFrustum:w,edges:E,shadowDir:I,ws:P,zoom:R}=x;let B=r;if(u.elevation){const q=u.elevation.getMinMaxForTile(a);q&&(B+=q.max)}B/=d.aA(u.center.lat,R);const V=f.computeSimplifiedTileShadowVolume(a.toUnwrapped(),B,P,I);if(!V)return!1;const{vertices:U,planes:Z}=V;return w.intersectsPrecise(U,Z,E)===0||f.getCurrentCascadeFrustum().intersectsPrecise(U,Z,E)===0}const Fi=new Float32Array(16),Ii=new Float32Array(16);function tr(a){const{painter:r,source:o,layer:u,coords:f}=a;let m=a.defines;const g=r.context,x=r.renderPass==="shadow",w=r.renderPass==="light-beam",E=r.shadowRenderer,I=d.aA(r.transform.center.lat,r.transform.zoom),P=d.aE(r,u.paint.get("building-cutoff-fade-range"));P.shouldRenderCutoff&&(m=m.concat("RENDER_CUTOFF"));const R=u.paint.get("building-front-cutoff"),B=R[2]<1&&!r.terrain,V=di(r.transform.pitch,R,!!r.terrain);B&&(m=m.concat("RENDER_FRONT_CUTOFF"),r.maxFrontCutoffRawStart=Math.max(r.maxFrontCutoffRawStart,R[0])),a.floodLightIntensity>0&&(m=m.concat("FLOOD_LIGHT"));for(const U of f){const Z=o.getTile(U),q=Z.getBucket(u);if(!q)continue;E&&E.getMaxCascadeForTile(U.toUnwrapped())===0&&(m=m.concat("SHADOWS_SINGLE_CASCADE"));const X=q.programConfigurations.get(u.id);let ne,oe;const _e=r.translatePosMatrix(U.expandedProjMatrix,Z,[0,0],"map");d.aN(Fi,_e,[1,1,a.verticalScale]);const ae=Fi;let ue;if(x&&E){if(wi(Z.tileID,q.maxHeight*I,r))continue;const fe=E.calculateShadowPassMatrixFromTile(Z.tileID.toUnwrapped());d.aN(fe,fe,[1,1,a.verticalScale]),ue=Zt(fe),ne=oe=r.getOrCreateProgram("buildingDepth",{config:X,defines:m,overrideFog:!1})}else if(w)ne=oe=r.getOrCreateProgram("buildingBloom",{config:X,defines:m,overrideFog:!1}),ue=kt(ae);else{const fe=r.transform.calculatePosMatrix(U.toUnwrapped(),r.transform.worldSize);d.aN(fe,fe,[1,1,a.verticalScale]),d.aN(Ii,fe,[1,-1,1/I]),d.aO(Ii,Ii),d.aP(Ii,Ii);const be=Ii,Re=r.transform.getFreeCameraOptions().position,Ae=1<<U.canonical.z;if(ue=pi(ae,be,a.opacity,a.facadeAOIntensity,[((Re.x-U.wrap)*Ae-U.canonical.x)*d.a2,(Re.y*Ae-U.canonical.y)*d.a2,Re.z*Ae*d.a2],q.tileToMeter,a.facadeEmissiveChance,a.floodLightColor,a.floodLightIntensity,V),oe=r.getOrCreateProgram("building",{config:X,defines:m,overrideFog:!1}),a.depthOnly===!0)ne=oe;else{const Ce=m.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);ne=r.getOrCreateProgram("building",{config:X,defines:Ce,overrideFog:!1})}E&&(E.setupShadowsFromMatrix(fe,oe,!0),ne!==oe&&ne.setShadowUniformValues(g,E.getShadowUniformValues()))}const he=(fe,be)=>{if(w){const Re=fe.entranceBloom;be.draw(r,g.gl.TRIANGLES,a.depthMode,d._.disabled,a.blendMode,d.$.disabled,ue,u.id,Re.layoutVertexBuffer,Re.indexBuffer,Re.segmentsBucket,u.paint,r.transform.zoom,X,[Re.layoutAttenuationBuffer,Re.layoutColorBuffer])}else{const Re=fe.segmentsBucket;let Ae=[fe.layoutNormalBuffer,fe.layoutCentroidBuffer,fe.layoutColorBuffer,fe.layoutFloodLightDataBuffer];fe.layoutFacadePaintBuffer&&(Ae=Ae.concat([fe.layoutFacadeDataBuffer,fe.layoutFacadeVerticalRangeBuffer,fe.layoutFacadePaintBuffer])),be.draw(r,g.gl.TRIANGLES,a.depthMode,d._.disabled,a.blendMode,x?d.$.disabled:d.$.backCW,ue,u.id,fe.layoutVertexBuffer,fe.indexBuffer,Re,u.paint,r.transform.zoom,X,Ae)}};r.uploadCommonUniforms(g,oe,U.toUnwrapped(),null,P),q.buildingWithoutFacade&&he(q.buildingWithoutFacade,oe),q.buildingWithFacade&&(ne!==oe&&r.uploadCommonUniforms(g,ne,U.toUnwrapped(),null,P),he(q.buildingWithFacade,ne))}}
vendor: 9,678 bytes, lines 3098-3126
3098function jr(a,r,o,u,f,m,g,x,w,E,I,P,R,B){const V=a.context.gl,U=a.depthModeForSublayer(1,d.Z.ReadOnly,V.LEQUAL,!0),Z=d.al(.1,3,I),q=a._showOverdrawInspector,X=P,ne=new Ft;if(!q){const oe=new d._({func:V.ALWAYS,mask:255},255,255,V.KEEP,V.KEEP,V.REPLACE),_e=new d.a1([V.ONE,V.ONE,V.ONE,V.ONE],d.C.transparent,[!1,!1,!1,!0],V.MIN);d.aQ(ne,a,r,o,u,U,oe,_e,d.$.disabled,f,"sdf",m,g,x,w,E,Z,X,!1,void 0)}{const oe=q?d._.disabled:new d._({func:V.EQUAL,mask:255},255,255,V.KEEP,V.DECR,V.DECR),_e=q?a.colorModeForRenderPass():new d.a1([V.ONE_MINUS_DST_ALPHA,V.DST_ALPHA,V.ONE,V.ONE],d.C.transparent,[!0,!0,!0,!0]);d.aQ(ne,a,r,o,u,U,oe,_e,d.$.disabled,f,"color",m,g,x,w,E,Z,X,!1,void 0)}}class Gr{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indoorMinimumZoom=16}findClosestBuilding(r,o,u,f,m){if(u<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let g=null,x=Number.MAX_VALUE,w=Number.MAX_VALUE,E=!1;const I=this._previousClosestBuildingId?r[this._previousClosestBuildingId]:null;this._previousClosestBuildingId&&I&&this._isBuildingVisible(I,f,m)&&(E=!0,w=this._calculateDistance(o,I));for(const[P,R]of Object.entries(r)){if(!this._isBuildingVisible(R,f,m))continue;const B=this._calculateDistance(o,R);B<x&&(x=B,g=P)}return E&&g&&this._previousClosestBuildingId&&g!==this._previousClosestBuildingId?x>w*this._hysteresisRatio&&(g=this._previousClosestBuildingId):E&&!g&&(g=this._previousClosestBuildingId),this._previousClosestBuildingId=g,g}_calculateDistance(r,o){if(!o.center)return Number.MAX_VALUE;const u=r.lat-o.center[1],f=r.lng-o.center[0];return u*u+f*f}_isBuildingVisible(r,o,u){if(!u)return!1;for(const f of r.floorIds){const m=r.floors[f];if(!m.geometry)continue;const g=m.geometry;if(g.type==="Polygon"){const x=this._convertRingToPoints(g.coordinates[0]);if(d.aT(x,u))return!0}else if(g.type==="MultiPolygon"){const x=this._convertMultiPolygonToPoints(g.coordinates);if(d.aU(u,x))return!0}}return!1}_convertRingToPoints(r){return r.map(o=>new d.P(o[0],o[1]))}_convertMultiPolygonToPoints(r){return r.map(o=>o.length===0?[]:o[0].map(u=>new d.P(u[0],u[1])))}}const gr=.05,oo=(a,r,o,u,f,m,g,x,w,E,I,P)=>({u_matrix:a,u_normalize_matrix:r,u_globe_matrix:o,u_merc_matrix:u,u_grid_matrix:f,u_tl_parent:m,u_scale_parent:E,u_fade_t:I.mix,u_opacity:I.opacity,u_image0:0,u_image1:1,u_raster_elevation:P,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:w}),Ai=(a,r,o,u,f,m,g,x,w,E)=>({u_particle_texture:a,u_particle_texture_side_len:r,u_tile_offset:o,u_velocity:u,u_color_ramp:m,u_velocity_res:f,u_max_speed:g,u_uv_offset:x,u_data_scale:[255*w[0],255*w[1]],u_data_offset:E,u_particle_pos_scale:1.1,u_particle_pos_offset:[gr,gr]}),yi=(a,r,o,u,f,m,g,x,w,E)=>({u_particle_texture:a,u_particle_texture_side_len:r,u_velocity:o,u_velocity_res:u,u_max_speed:f,u_speed_factor:m,u_reset_rate:g,u_rand_seed:Math.random(),u_uv_offset:x,u_data_scale:[255*w[0],255*w[1]],u_data_offset:E,u_particle_pos_scale:1.1,u_particle_pos_offset:[gr,gr]});function Yr(a,[r,o,u,f],[m,g]){if(m===g)return[0,0,0,0];const x=255*(a-1)/(a*(g-m));return[r*x,o*x,u*x,f*x]}function Er(a,r,[o,u]){return o===u?0:.5/a+(r-o)*(a-1)/(a*(u-o))}var Vt=d.a_([{name:"a_index",type:"Int16",components:1}]);class Zi{constructor(r,o,u,f){const m={width:u[0],height:u[1],data:null},g=r.gl;this.targetColorTexture=new d.T(r,m,g.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new d.T(r,m,g.RGBA8,{useMipmap:!1}),this.context=r,this.updateParticleTexture(o,f),this.lastInvalidatedAt=0}updateParticleTexture(r,o){if(this.particleTextureDimension===o.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const u=this.context.gl,f=o.width*o.height;this.particleTexture0=new d.T(this.context,o,u.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new d.T(this.context,o,u.RGBA8,{premultiply:!1,useMipmap:!1});const m=new d.a$;m.reserve(f);for(let g=0;g<f;g++)m.emplaceBack(g);this.particleIndexBuffer=this.context.createVertexBuffer(m,Vt.members,!0),this.particleSegment=d.ac.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=o.width}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=d.e.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Or(a,r,o,u,f){if(f>0){const m=d.e.now(),g=(m-a.timeAdded)/f,x=r?(m-r.timeAdded)/f:-1,w=o.getSource(),E=u.coveringZoomLevel({tileSize:w.tileSize,roundZoom:w.roundZoom}),I=!r||Math.abs(r.tileID.overscaledZ-E)>Math.abs(a.tileID.overscaledZ-E),P=I&&a.refreshedUponExpiration?1:d.b0(I?g:1-x,0,1);return r?{opacity:1,mix:1-P,isFading:g<1}:{opacity:P,mix:0,isFading:g<1}}return{opacity:1,mix:0,isFading:!1}}function Mn(a,r,o){if(!a)return null;const u=r.getTextureDescriptor(a,o,!0);if(!u)return null;let{texture:f,mix:m,offset:g,tileSize:x,buffer:w,format:E}=u;if(!f||!E)return null;let I=!1;return E==="uint32"&&(I=!0,m[3]=0,m=Yr(d.b9,m,[0,o.paint.get("raster-particle-max-speed")]),g=Er(d.b9,g,[0,o.paint.get("raster-particle-max-speed")])),{texture:f,textureOffset:[w/(x+2*w),x/(x+2*w)],tileSize:x,scalarData:I,scale:m,offset:g,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[E]]}}function tn(a){const r=a._nearZ,o=a.projection.farthestPixelDistance(a),u=o-r,f=.2*a.height,m=r+f;return[r,o,(m-f-r)/u,(m-r)/u]}var Br=`#ifdef RASTER_ARRAY 3099uniform 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;} 3100#endif 3101uniform 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;}`;d.ba["_prelude_raster_particle.glsl"]||(d.ba["_prelude_raster_particle.glsl"]=Br);var so={building:d.bb(`#include "_prelude_fog.fragment.glsl" 3102#include "_prelude_shadow.fragment.glsl" 3103#include "_prelude_lighting.glsl" 3104#include "_prelude_indicator_cutout.fragment.glsl" 3105#include "_prelude_feature_cutout.fragment.glsl" 3106const 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; 3107#ifdef RENDER_FRONT_CUTOFF 3108in float v_front_cutoff_opacity; 3109#endif 3110#ifdef INDICATOR_CUTOUT 3111#ifdef FEATURE_CUTOUT 3112in vec4 v_ground_roof; 3113#endif 3114#endif 3115#ifdef BUILDING_FAUX_FACADE 3116in 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; 3117#endif 3118#ifdef RENDER_SHADOWS 3119in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 3120#endif 3121#ifdef FLOOD_LIGHT 3122in highp float v_flood_radius;in float v_has_flood_light; 3123#endif 3124uniform 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));} 3125#ifdef BUILDING_FAUX_FACADE 3126highp 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);}
3126float 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; 3127#if 0 3128if (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; 3129#else 3130if (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.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao; 3131#endif 3132return out_color;} 3133#endif 3134vec3 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; 3135#ifdef BUILDING_FAUX_FACADE 3136if (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);} 3137#endif 3138vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; 3139#ifdef RENDER_SHADOWS 3140#ifdef RENDER_CUTOFF 3141shadowed_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;} 3142#else 3143shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 3144#endif 3145#else 3146shadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir)); 3147#endif 3148color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); 3149#ifdef FLOOD_LIGHT 3150float 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); 3151#endif 3152color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); 3153#ifdef FOG 3154color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); 3155#endif 3156color*=u_opacity; 3157#ifdef INDICATOR_CUTOUT 3158#ifdef FEATURE_CUTOUT 3159{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}} 3160#else 3161color=applyCutout(color,v_pos.z); 3162#endif 3163#endif 3164#ifdef RENDER_FRONT_CUTOFF 3165if (v_front_cutoff_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}} 3166#endif 3167#ifdef FEATURE_CUTOUT 3168color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x,0.0); 3169#endif 3170glFragColor=color; 3171#ifdef DEBUG_SHOW_NORMALS 3172color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; 3173#endif 3174#ifdef OVERDRAW_INSPECTOR 3175glFragColor=vec4(1.0); 3176#endif 3177HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 3178#include "_prelude_shadow.vertex.glsl" 3179in vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3; 3180#ifdef FLOOD_LIGHT 3181in int a_flood_light_wall_radius_1i16; 3182#endif 3183#ifdef BUILDING_FAUX_FACADE 3184in uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range; 3185#endif 3186uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter; 3187#ifdef RENDER_FRONT_CUTOFF 3188uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity; 3189#endif 3190#ifdef INDICATOR_CUTOUT 3191#ifdef FEATURE_CUTOUT 3192out vec4 v_ground_roof; 3193#endif 3194#endif 3195out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos; 3196#ifdef BUILDING_FAUX_FACADE 3197out 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; 3198#endif 3199#ifdef RENDER_SHADOWS 3200uniform 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; 3201#endif 3202#ifdef FLOOD_LIGHT
3203out highp float v_flood_radius;out float v_has_flood_light; 3204#endif 3205const 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));} 3206#ifdef BUILDING_FAUX_FACADE 3207mat3 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);} 3208#endif 3209#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive 3210#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive 3211void main() { 3212#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive 3213#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive 3214#ifdef FLOOD_LIGHT 3215v_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); 3216#endif 3217vec4 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); 3218#ifdef BUILDING_FAUX_FACADE 3219vec4 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;} 3220#endif 3221v_pos=a_pos_3f; 3222#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) 3223float 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; 3224#endif 3225#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) 3226vec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0); 3227#endif 3228#ifdef RENDER_CUTOFF 3229v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity; 3230#endif 3231#ifdef RENDER_SHADOWS 3232vec3 shadow_pos=v_pos; 3233#ifdef NORMAL_OFFSET 3234vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); 3235#endif 3236v_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); 3237#endif 3238#ifdef FOG 3239v_fog_pos=fog_position(v_pos); 3240#endif 3241#ifdef RENDER_FRONT_CUTOFF 3242v_front_cutoff_opacity=1.0;{hidden=max(hidden,float(ground.w <=0.0));
3242float 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);} 3243#endif 3244gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w; 3245#ifdef INDICATOR_CUTOUT 3246#ifdef FEATURE_CUTOUT 3247vec4 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); 3248#endif 3249#endif 3250}`),buildingBloom:d.bb(`in vec4 v_color_emissive; 3251#pragma mapbox: define-attribute highp vec4 bloom_attenuation 3252float saturate(float val) {return clamp(val,0.0,1.0);}void main() { 3253#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 3254float emission=v_color_emissive.a;float opacity=1.0; 3255#ifdef HAS_ATTRIBUTE_a_bloom_attenuation 3256float 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); 3257#endif 3258#ifdef RENDER_CUTOFF 3259opacity*=v_cutoff_opacity; 3260#endif 3261glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; 3262#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive 3263#pragma mapbox: define-attribute highp vec4 bloom_attenuation 3264out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 3265#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive 3266#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 3267#ifdef HAS_ATTRIBUTE_a_part_color_emissive 3268vec4 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); 3269#else 3270v_color_emissive=vec4(1.0); 3271#endif 3272gl_Position=u_matrix*vec4(a_pos_3f,1.0); 3273#ifdef RENDER_CUTOFF 3274v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 3275#endif 3276}`),buildingDepth:d.bb("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:d.bb(`#include "_prelude_fog.fragment.glsl" 3277#include "_prelude_lighting.glsl" 3278uniform 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; 3279#ifdef LIGHTING_3D_MODE 3280out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; 3281#endif 3282#ifdef FOG 3283highp 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)); 3284#endif 3285glFragColor=vec4(out_color*color.a,color.a); 3286#ifdef OVERDRAW_INSPECTOR 3287glFragColor=vec4(1.0); 3288#endif 3289HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 3290uniform 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; 3291#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 3292in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 3293#ifdef PROJECTION_GLOBE_VIEW 3294vec3 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; 3295#ifdef FOG 3296v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 3297#endif 3298#else 3299uv=vec2(a_texture_pos)/8192.0;
3299gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w); 3300#ifdef FOG 3301v_fog_pos=fog_position(vec2(a_pos)); 3302#endif 3303#endif 3304v_pos0=uv; 3305#ifdef VIEWPORT_ORIGIN_TOP_LEFT 3306v_pos0.y=1.0-v_pos0.y; 3307#endif 3308v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:d.bb("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" 3309in 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( 3310mod(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:d.bb("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; 3311#ifdef VIEWPORT_ORIGIN_TOP_LEFT 3312v_tex_pos.y=1.0-v_tex_pos.y; 3313#endif 3314gl_Position=vec4(a_pos,0.0,1.0);}`),rasterParticleUpdate:d.bb(`#include "_prelude_raster_particle.glsl" 3315uniform 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;vec2 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( 3316linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 3317);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);}"),snowParticle:d.bb("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;}",` 3318in 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; 3319uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 3320uniform float u_horizontalOscillationRate; 3321uniform 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);
3321simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ 3322localY*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:d.bb("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;}",` 3323in 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; 3324uniform float u_velocity; 3325uniform 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;pos*=halfBoxSize; 3326pos+=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+ 3327localY*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:d.bb("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);}"),elevatedStructuresDepth:d.bb("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;}"),elevatedStructures:d.bb(`#include "_prelude_fog.fragment.glsl" 3328#include "_prelude_lighting.glsl" 3329#include "_prelude_shadow.fragment.glsl" 3330#include "_prelude_indicator_cutout.fragment.glsl" 3331#include "_prelude_feature_cutout.fragment.glsl" 3332in vec3 v_normal;in float v_height; 3333#ifdef RENDER_SHADOWS 3334in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 3335#endif 3336vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
3336vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) 3337{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;uniform float u_opacity_multiplier; 3338#pragma mapbox: define highp vec4 structure_color 3339void main() { 3340#pragma mapbox: initialize highp vec4 structure_color 3341vec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0); 3342#ifdef FEATURE_CUTOUT 3343cutout_factors=get_cutout_factors(gl_FragCoord); 3344#endif 3345#ifdef LIGHTING_3D_MODE 3346vec3 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); 3347#ifdef RENDER_SHADOWS 3348float 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); 3349#else 3350color=apply_lighting(color,transformed_normal); 3351#endif 3352color=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);} 3353#endif 3354#ifdef FOG 3355color=fog_apply(color,v_fog_pos); 3356#endif 3357vec4 out_color=vec4(color,1.0); 3358#ifdef INDICATOR_CUTOUT 3359out_color=applyCutout(out_color,v_height); 3360#endif 3361#ifdef FEATURE_CUTOUT 3362out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,v_height); 3363#endif 3364out_color*=u_opacity_multiplier;glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 3365#include "_prelude_shadow.vertex.glsl" 3366in 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; 3367#ifdef RENDER_SHADOWS 3368uniform 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; 3369#endif 3370#pragma mapbox: define highp vec4 structure_color 3371void main() { 3372#pragma mapbox: initialize highp vec4 structure_color 3373v_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); 3374#ifdef RENDER_SHADOWS 3375vec3 shd_pos0=pos;vec3 shd_pos1=pos; 3376#ifdef NORMAL_OFFSET 3377vec3 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(); 3378#endif 3379v_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; 3380#endif 3381#ifdef FOG 3382v_fog_pos=fog_position(vec2(a_pos)); 3383#endif 3384}`),elevatedStructuresDepthReconstruct:d.bb(`#include "_prelude_feature_cutout.fragment.glsl" 3385#ifdef DEPTH_RECONSTRUCTION 3386in float v_height; 3387#endif 3388void main() { 3389#ifdef DEPTH_RECONSTRUCTION 3390if (v_height >=0.0) 3391discard; 3392#else 3393#ifdef FEATURE_CUTOUT 3394apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x,0.0); 3395#endif 3396#endif 3397glFragColor=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; 3398#ifdef DEPTH_RECONSTRUCTION 3399out float v_height; 3400#endif 3401void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 3402#ifdef DEPTH_RECONSTRUCTION 3403if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 3404#endif 3405gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`)};d.bb(Br,"");const ao=d.a_([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),Ci=d.a_([{type:"Float32",name:"a_pos_2f",components:2}]);class or{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(r,o){const u=r.getOrCreateProgram("vignette");
vendor: 7,483 bytes, line 3405
3405if(!this.vignetteVx||!this.vignetteIdx){const g=new d.bc,x=new d.ad;g.emplaceBack(-1,-1),g.emplaceBack(1,-1),g.emplaceBack(1,1),g.emplaceBack(-1,1),x.emplaceBack(0,1,2),x.emplaceBack(0,2,3),this.vignetteVx=r.context.createVertexBuffer(g,Ci.members),this.vignetteIdx=r.context.createIndexBuffer(x)}const f=d.ac.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){r.uploadCommonUniforms(r.context,u);const g={u_vignetteShape:(m={vignetteShape:[o.start,o.range,Math.pow(10,o.fadePower)],vignetteColor:[o.color.r,o.color.g,o.color.b,o.color.a*o.strength]}).vignetteShape,u_vignetteColor:m.vignetteColor};u.draw(r,r.context.gl.TRIANGLES,d.Z.disabled,d._.disabled,d.a1.alphaBlended,d.$.disabled,g,"vignette",this.vignetteVx,this.vignetteIdx,f)}var m}}class kr{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(r,o){const u=r.getFreeCameraOptions().position,f=u.toAltitude(),m=u.toLngLat(),g=d.au(m.lng),x=d.au(m.lat),w=r.pixelsPerMeter/o,E=g*d.bj,I=d.bj*Math.log(Math.tan(Math.PI/4+x/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const P=-this._offsetYPrev+I,R=-this._elevationPrev+f;this._accumulatedOffsetX+=(-this._offsetXPrev+E)*w,this._accumulatedOffsetY+=P*w,this._accumulatedElevation+=R*w,this._offsetXPrev=E,this._offsetYPrev=I,this._elevationPrev=f}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Rn(a,r){return[-(a[0]-Math.floor(a[0]/r)*r),-(a[1]-Math.floor(a[1]/r)*r),-(a[2]-Math.floor(a[2]/r)*r)]}function bn(a){const r=d.bi(1323123451230),o=[];for(let u=0;u<a;++u){const f=2*r()-1,m=2*r()-1,g=2*r()-1;o.push(d.bh(f,m,g))}return o}function rn(a,r,o,u,f){const m=d.b0((f-o)/(u-o),0,1);return d.al(a,r,m)}class Hr{constructor(r){this._movement=new kr,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new or,this._ppmScaleFactor=r}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(r,o){const u=r.transform;this._movement.update(u,this._ppmScaleFactor);const f=u.starsProjMatrix,m=d.bd([]);d.be(m,m,d.au(90)-u._pitch),d.bf(m,m,-u.angle);const g=d.bg(new Float32Array(16),m),x=new Float32Array([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),w=d.aP([],x),E=d.X([],w,g),I=Date.now()/1e3;return this._accumulatedTimeFromStart+=(I-this._prevTime)*o,this._prevTime=I,{projectionMatrix:f,modelviewMatrix:E}}}const lo=d.a_([{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}]),Go=(a,r)=>({u_matrix:a,u_depth_bias:r}),Hn=(a,r)=>({u_matrix:a,u_ground_shadow_factor:r,u_opacity_multiplier:1}),ir=(a,r,o,u,f)=>({u_matrix:a,u_camera_pos:[r[0],r[1],r[2]],u_depth_bias:o,u_height_scale:u,u_reset_depth:f}),wn={building:a=>({u_matrix:new d.a5(a),u_normal_matrix:new d.a5(a),u_opacity:new d.a4(a),u_faux_facade_ao_intensity:new d.a4(a),u_camera_pos:new d.a6(a),u_tile_to_meter:new d.a4(a),u_facade_emissive_chance:new d.a4(a),u_flood_light_color:new d.a6(a),u_flood_light_intensity:new d.a4(a),u_front_cutoff_params:new d.a6(a)}),buildingBloom:a=>({u_matrix:new d.a5(a)}),buildingDepth:a=>({u_matrix:new d.a5(a)}),elevatedStructuresDepth:a=>({u_matrix:new d.a5(a),u_depth_bias:new d.a4(a)}),elevatedStructures:a=>({u_matrix:new d.a5(a),u_ground_shadow_factor:new d.a6(a),u_opacity_multiplier:new d.a4(a)}),elevatedStructuresDepthReconstruct:a=>({u_matrix:new d.a5(a),u_camera_pos:new d.a6(a),u_depth_bias:new d.a4(a),u_height_scale:new d.a4(a),u_reset_depth:new d.a4(a)}),rasterParticle:a=>({u_matrix:new d.a5(a),u_normalize_matrix:new d.a5(a),u_globe_matrix:new d.a5(a),u_merc_matrix:new d.a5(a),u_grid_matrix:new d.aZ(a),u_tl_parent:new d.a3(a),u_scale_parent:new d.a4(a),u_fade_t:new d.a4(a),u_opacity:new d.a4(a),u_image0:new d.aX(a),u_image1:new d.aX(a),u_raster_elevation:new d.a4(a),u_zoom_transition:new d.a4(a),u_merc_center:new d.a3(a),u_cutoff_params:new d.aY(a)}),rasterParticleTexture:a=>({u_texture:new d.aX(a),u_opacity:new d.a4(a)}),rasterParticleDraw:a=>({u_particle_texture:new d.aX(a),u_particle_texture_side_len:new d.a4(a),u_tile_offset:new d.a3(a),u_velocity:new d.aX(a),u_color_ramp:new d.aX(a),u_velocity_res:new d.a3(a),u_max_speed:new d.a4(a),u_uv_offset:new d.a3(a),u_data_scale:new d.a3(a),u_data_offset:new d.a4(a),u_particle_pos_scale:new d.a4(a),u_particle_pos_offset:new d.a3(a)}),rasterParticleUpdate:a=>({u_particle_texture:new d.aX(a),u_particle_texture_side_len:new d.a4(a),u_velocity:new d.aX(a),u_velocity_res:new d.a3(a),u_max_speed:new d.a4(a),u_speed_factor:new d.a4(a),u_reset_rate:new d.a4(a),u_rand_seed:new d.a4(a),u_uv_offset:new d.a3(a),u_data_scale:new d.a3(a),u_data_offset:new d.a4(a),u_particle_pos_scale:new d.a4(a),u_particle_pos_offset:new d.a3(a)}),snowParticle:a=>({u_modelview:new d.a5(a),u_projection:new d.a5(a),u_time:new d.a4(a),u_cam_pos:new d.a6(a),u_velocityConeAperture:new d.a4(a),u_velocity:new d.a4(a),u_horizontalOscillationRadius:new d.a4(a),u_horizontalOscillationRate:new d.a4(a),u_boxSize:new d.a4(a),u_billboardSize:new d.a4(a),u_simpleShapeParameters:new d.a3(a),u_screenSize:new d.a3(a),u_thinningCenterPos:new d.a3(a),u_thinningShape:new d.a6(a),u_thinningAffectedRatio:new d.a4(a),u_thinningParticleOffset:new d.a4(a),u_particleColor:new d.aY(a),u_direction:new d.a6(a)}),rainParticle:a=>({u_modelview:new d.a5(a),u_projection:new d.a5(a),u_time:new d.a4(a),u_cam_pos:new d.a6(a),u_texScreen:new d.aX(a),u_velocityConeAperture:new d.a4(a),u_velocity:new d.a4(a),u_boxSize:new d.a4(a),u_rainDropletSize:new d.a3(a),u_distortionStrength:new d.a4(a),u_rainDirection:new d.a6(a),u_color:new d.aY(a),u_screenSize:new d.a3(a),u_thinningCenterPos:new d.a3(a),u_thinningShape:new d.a6(a),u_thinningAffectedRatio:new d.a4(a),u_thinningParticleOffset:new d.a4(a),u_shapeDirectionalPower:new d.a4(a),u_shapeNormalPower:new d.a4(a),u_mode:new d.a4(a)}),vignette:a=>({u_vignetteShape:new d.a6(a),u_vignetteColor:new d.aY(a)})};function Bi(a,r){const o=1<<a.canonical.z,u=(r.x*o-a.canonical.x-a.wrap*o)*d.a2,f=(r.y*o-a.canonical.y)*d.a2,m=d.bm(r.z,r.y);return d.bh(u,f,m)}function Sr(a){let r=0;for(const o of a)r|=o.frcMask;return r}class co{constructor(r=[]){this.tiles=r}getTile(r){for(const o of this.tiles)if(o.tileId.z===r.z&&o.tileId.x===r.x&&o.tileId.y===r.y)return o;return null}getTileOrParent(r){for(let o=r.z;o>0;--o){const u=Math.floor(r.x/(1<<r.z-o)),f=Math.floor(r.y/(1<<r.z-o));for(const m of this.tiles)if(m.tileId.z===o&&m.tileId.x===u&&m.tileId.y===f&&m.frcMask!==0)return m}return null}getFullCoverageMask(r){let o=null,u=0;for(let P=r.z;P>0;--P){const R=Math.floor(r.x/(1<<r.z-P)),B=Math.floor(r.y/(1<<r.z-P));for(const V of this.tiles)if(V.tileId.z===P&&V.tileId.x===R&&V.tileId.y===B){o=V,u=P;break}if(o)break}if(!o||o.frcMask===0)return null;const f=1<<r.z-u,m=d.a2/f,g=r.x%f*m,x=r.y%f*m,w=g+m,E=x+m;let I=0;for(const P of o.polygons)P.frcMask!==0&&(P.hasGeometry()?P.rings.length===0||r.z<=u||Ms(P.rings,g,x,w,E)&&(I|=P.frcMask):I|=P.frcMask);return I!==0?I:null}equals(r){if(this.tiles.length!==r.length)return!1;for(let o=0;o<this.tiles.length;++o){const u=this.tiles[o],f=r[o];if(u.tileId.z!==f.tileId.z||u.tileId.x!==f.tileId.x||u.tileId.y!==f.t
vendor: 7,456 bytes, line 3405
3405ileId.y||u.frcMask!==f.frcMask||u.polygons.length!==f.polygons.length)return!1}return!0}empty(){return this.tiles.length===0}}function Ms(a,r,o,u,f){const m=[0,0,0,0],g=[r,u,u,r],x=[o,o,f,f];for(const w of a){const E=w.length;if(!(E<2))for(let I=0,P=E-1;I<E;P=I++){const R=w[P].x,B=w[P].y,V=w[I].x,U=w[I].y;for(let X=0;X<4;++X)B>x[X]!=U>x[X]&&g[X]<R+(V-R)*(x[X]-B)/(U-B)&&m[X]++;let Z=0,q=0;if(R<r?Z|=1:R>u&&(Z|=2),B<o?Z|=4:B>f&&(Z|=8),V<r?q|=1:V>u&&(q|=2),U<o?q|=4:U>f&&(q|=8),!(Z&q)&&(Z===0||q===0||hn(R,B,V,U,r,o,u,f)))return!1}}for(let w=0;w<4;++w)if(!(1&m[w]))return!1;return!0}function hn(a,r,o,u,f,m,g,x){const w=(E,I,P,R,B,V,U,Z)=>{const q=(P-E)*(V-I)-(R-I)*(B-E),X=(P-E)*(Z-I)-(R-I)*(U-E);if(q>0&&X>0||q<0&&X<0)return!1;const ne=(U-B)*(I-V)-(Z-V)*(E-B),oe=(U-B)*(R-V)-(Z-V)*(P-B);return!(ne>0&&oe>0||ne<0&&oe<0)};return!!(w(a,r,o,u,f,m,g,m)||w(a,r,o,u,g,m,g,x)||w(a,r,o,u,f,x,g,x)||w(a,r,o,u,f,m,f,x))}class sl{constructor(){this._tileCoverages=[],this._snapshot=new co}clear(){this._tileCoverages=[]}addTileCoverage(r,o){this._tileCoverages.push({tileId:r,polygons:o,frcMask:Sr(o)})}empty(){return this._tileCoverages.length===0}updateSnapshotIfNeeded(){if(this._snapshot.equals(this._tileCoverages))return this._snapshot;const r=this._tileCoverages.map(o=>({tileId:o.tileId,polygons:o.polygons,frcMask:o.frcMask}));return this._snapshot=new co(r),this._snapshot}}function Co(a,r){const o={};if(!r)return o;for(const u of a){const f=u.layerIds.map(m=>r.getLayer(m)).filter(Boolean);if(f.length!==0){u.layers=f,u.stateDependentLayerIds&&(u.stateDependentLayers=u.stateDependentLayerIds.map(m=>f.filter(g=>g.id===m)[0])),u.updateExpressions&&u.updateExpressions(f);for(const m of f)o[m.fqid]=u}}return o}const Tn=32,Mo=33,Ho=new Uint16Array(8184);for(let a=0;a<2046;a++){let r=a+2,o=0,u=0,f=0,m=0,g=0,x=0;for(1&r?f=m=g=Tn:o=u=x=Tn;(r>>=1)>1;){const E=o+f>>1,I=u+m>>1;1&r?(f=o,m=u,o=g,u=x):(o=f,u=m,f=g,m=x),g=E,x=I}const w=4*a;Ho[w+0]=o,Ho[w+1]=u,Ho[w+2]=f,Ho[w+3]=m}const Pn=new Uint16Array(2178),Ir=new Uint8Array(1089),Zo=new Uint16Array(1089);function hs(a){return a===0?-.03125:a===32?.03125:0}var Rs=d.a_([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);const lt={type:2,extent:d.a2,loadGeometry:()=>[[new d.P(0,0),new d.P(d.a2+1,0),new d.P(d.a2+1,d.a2+1),new d.P(0,d.a2+1),new d.P(0,0)]]};let ta,Lt=0;class Ps{constructor(r,o,u,f,m,g){this.tileID=r,this.uid=d.av(),this.uses=0,this.tileSize=o,this.tileZoom=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=m,f&&f.style&&(this._lastUpdatedBrightness=f.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",f&&f.transform&&(this.projection=f.transform.projection),this.worldview=g,this._hasAppearances=null}registerFadeDuration(r){const o=r+this.timeAdded;o<d.e.now()||this.fadeEndTime!==void 0&&o<this.fadeEndTime||(this.fadeEndTime=o)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=d.bp(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(r,o,u){if(this.unloadVectorData(),this.state="loaded",r){r.featureIndex&&(this.latestFeatureIndex=r.featureIndex,r.rawTileData?(this.latestRawTileData=r.rawTileData,this.latestFeatureIndex.rawTileData=r.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=r.collisionBoxArray,this.buckets=Co(r.buckets,o.style),r.frcCoveragePolygons&&r.frcCoveragePolygons.length>0&&(this.frcCoveragePolygons=r.frcCoveragePolygons),this.hasDeferredRoadStructure=!!r.hasDeferredRoadStructure,r.parsedElevationFeatures!==void 0&&(this.parsedElevationFeatures=r.parsedElevationFeatures,this.parsedElevationGeneration=++Lt),this.hasDeferredElevationFeatures=!!r.hasDeferredElevationFeatures,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!!r.hasTunnelGeometry;for(const f in this.buckets){const m=this.buckets[f];if(m instanceof d.bu){if(this.hasSymbolBuckets=!0,!u)break;m.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const f in this.buckets){const m=this.buckets[f];if(m instanceof d.bu&&m.hasRTLText){this.hasRTLText=!0,d.bN();break}}this.queryPadding=0;for(const f in this.buckets){const m=this.buckets[f],g=o.style.getOwnLayer(f);if(!g)continue;const x=g.queryRadius(m)||0;this.queryPadding=Math.max(this.queryPadding,x)}r.imageAtlas&&(this.imageAtlas=o.style.imageManager.imageAtlasCache.getOrCache(r.imageAtlas)),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage),r.lineAtlas&&(this.lineAtlas=r.lineAtlas),this._lastUpdatedBrightness=r.brightness}else this.collisionBoxArray=new d.bt}unloadVectorData(){if(this.hasData()){for(const r in this.buckets)this.buckets[r].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(r,o,u){r&&(r.resourceTiming&&(this.resourceTiming=r.resourceTiming),this.buckets={...this.buckets,...Co(r.buckets,o.style)},r.featureIndex&&(this.latestFeatureIndex=r.featureIndex))}getBucket(r){return this.buckets[r.fqid]}upload(r,o){for(const m in this.buckets){const g=this.buckets[m];if(g.uploadPending()){let x={},w=[],E={zoom:0,pitch:0,brightness:0,worldview:""};if(o){if(o.style){w=o.style.listImages();const I=g.layers[0],P=I.sourceLayer||"_geojsonTileLayer",R=o.style.getLayerSourceCache(I);R&&(x=R._state.getState(P,void 0))}E={zoom:o.transform.zoom||0,pitch:o.transform.pitch||0,brightness:o.style.getBrightness()||0,worldview:o.worldview||""}}g.upload(r,this.tileID.canonical,x,w,E)}}const u=r.gl,f=this.imageAtlas;f&&o&&(this.imageAtlasTexture=o.style.imageManager.imageAtlasCache.getTextureForAtlas(f,r,u.RGBA8),f.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new d.T(r,this.glyphAtlasImage,u.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new d.T(r,this.lineAtlas.image,u.R8),this.lineAtlas.uploaded=!0)}prepare(r,o,u){if(this.imageAtlas&&this.imageAtlasTexture&&o){const R=o.style.getLut(u);this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture,u,R)}if(!o||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const f=o.style.getBrightness(),m=o.style.listImages(),g=m.length,x=o.style._changes.getUpd
vendor: 15,483 bytes, line 3405
3405atedPaintProperties(),w=Object.keys(this.buckets).some(R=>this.buckets[R].layers.some(B=>x.has(B.fqid))),E=Object.keys(this.buckets).some(R=>this.buckets[R].layers.some(B=>B.hasTransition&&B.hasTransition())),I=this._firstPrepareComplete&&g!==this._lastAvailableImagesCount;this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(o));const P=this._lastUpdatedBrightness!==f;this._lastAvailableImagesCount=g,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||f||this._hasAppearances||w||E||I)&&(!(this._hasAppearances||w||E||I)&&this._lastUpdatedBrightness&&f&&Math.abs(this._lastUpdatedBrightness-f)<.001||(this.updateBuckets(o,P,void 0,I||w||E,x,m),this._lastUpdatedBrightness=f))}evaluateQueryRenderedFeaturePadding(){let r=0;for(const o in this.buckets){const u=this.buckets[o];u.evaluateQueryRenderedFeaturePadding&&(r=Math.max(r,u.evaluateQueryRenderedFeaturePadding()))}return r}queryRenderedFeatures(r,o,u,f,m,g,x){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const w=this.evaluateQueryRenderedFeaturePadding(),E=function(I,P){const R=d.bL([],[.5*I.width,.5*-I.height,1]);return d.bM(R,R,[1,-1,0]),d.X(R,R,I.calculateProjMatrix(P.toUnwrapped())),Float32Array.from(R)}(m,this.tileID);return this.latestFeatureIndex.query(r,{tilespaceGeometry:o,pixelPosMatrix:E,transform:f,availableImages:u,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:w,scope:x})}querySourceFeatures(r,o){const u=this.latestFeatureIndex;if(!u||!u.rawTileData)return;const f=u.loadVTLayers(),m=o?o.sourceLayer:"",g=f._geojsonTileLayer||f[m];if(!g)return;const x=d.bv(o&&o.filter),{z:w,x:E,y:I}=this.tileID.canonical,P={z:w,x:E,y:I};for(let R=0;R<g.length;R++){const B=g.feature(R);if(x.needGeometry){const Z=d.bw(B,!0);if(!x.filter(new d.ai(this.tileID.overscaledZ,{worldview:this.worldview}),Z,this.tileID.canonical))continue}else if(!x.filter(new d.ai(this.tileID.overscaledZ,{worldview:this.worldview}),B))continue;const V=u.getId(B,m),U=new d.bx(B,w,E,I,V);U.tile=P,r.push(U)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(r){const o=this.expirationTime;if(r.cacheControl){const u=d.by(r.cacheControl);u["max-age"]&&(this.expirationTime=Date.now()+1e3*u["max-age"])}else r.expires&&(this.expirationTime=new Date(r.expires).getTime());if(this.expirationTime){const u=Date.now();let f=!1;if(this.expirationTime>u)f=!1;else if(o)if(this.expirationTime<o)f=!0;else{const m=this.expirationTime-o;m?this.expirationTime=u+Math.max(m,3e4):f=!0}else f=!0;f?(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-Date.now(),Math.pow(2,31)-1)}refreshFeatureState(r,o){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!r)return;const u=r.style.listImages();this.updateBuckets(r,!1,o,void 0,void 0,u)}hasAppearances(r){for(const o in this.buckets)if(r.style.hasLayer(o)&&this.buckets[o].layers.some(u=>u.appearances&&u.appearances.length>0))return!0;return!1}updateBuckets(r,o,u,f,m,g){if(!this.latestFeatureIndex||!r.style)return;const x=g||r.style.listImages(),w=r.style.getBrightness(),E=m||new Set;for(const I in this.buckets){if(!r.style.hasLayer(I))continue;const P=this.buckets[I],R=P.layers[0],B=R.sourceLayer||"_geojsonTileLayer",V=r.style.getLayerSourceCache(R),U=P.layers.some(ae=>E.has(ae.fqid)),Z=(f||U)&&P instanceof d.bu?r.style.getOwnLayer(I):void 0;let q=u&&u[B]||{};V&&!u&&(q=V._state.getState(B,void 0));const X=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},ne=Object.keys(q).length>0&&!o;P.hasAppearances=P.layers.some(ae=>ae.appearances&&ae.appearances.length>0);const oe=ne?P.stateDependentLayers:P.layers;if(ne&&P.stateDependentLayers.length!==0||o||U||f){const ae=this.latestFeatureIndex.loadVTLayers()[B];if(P.update(q,ae,x,X,oe,o,w,this.tileID.canonical),(f||U)&&(!o||o&&P instanceof d.bu&&(!P.text.uboBinder||P.text.uboBinder.isLightConstant||!P.icon.uboBinder||P.icon.uboBinder.isLightConstant))&&P instanceof d.bu&&Z&&Z.type==="symbol"){const ue=P;ue.text&&ue.text.uboBinder&&ue.text.uboBinder.updateDynamicExpressions(Z,ae,this.tileID.canonical,x,q,w),ue.icon&&ue.icon.uboBinder&&ue.icon.uboBinder.updateDynamicExpressions(Z,ae,this.tileID.canonical,x,q,w)}if(P instanceof d.bu){const ue=P,he=r.context;ue.text&&ue.text.uboBinder&&ue.text.uboBinder.upload(he),ue.icon&&ue.icon.uboBinder&&ue.icon.uboBinder.upload(he)}}if(ne&&P.stateDependentLayers.length!==0||o||P.hasAppearances){const ae={zoom:r.transform.zoom,pitch:r.transform.pitch,brightness:r.style.getBrightness()||0,worldview:r.worldview},ue=P.updateAppearances(this.tileID.canonical,q,x,ae,r.imageManager,ne&&P.stateDependentLayers.length!==0);if(ue&&ue.hasUboChanges){const he=r.context;P instanceof d.bu&&P.text&&P.text.uboBinder&&P.text.uboBinder.upload(he),P instanceof d.bu&&P.icon&&P.icon.uboBinder&&P.icon.uboBinder.upload(he)}}(P instanceof d.bz||P instanceof d.bA)&&r._terrain&&r._terrain.enabled&&V&&P.uploadPending()&&r._terrain._clearRenderCacheForTile(V.id,this.tileID);const _e=r&&r.style&&r.style.getOwnLayer(I);_e&&(this.queryPadding=Math.max(this.queryPadding,_e.queryRadius(P)||0))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<d.e.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(r){this.symbolFadeHoldUntil=d.e.now()+r}setTexture(r,o){const u=o.context,f=u.gl;this.texture=this.texture||o.getTileTexture(r.width),this.texture&&this.texture instanceof d.T?this.texture.update(r):(this.texture=new d.T(u,r,f.RGBA8,{useMipmap:!0}),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE))}setDependencies(r,o){const u={};for(const f of o)u[f]=!0;this.dependencies[r]=u}hasDependency(r,o){for(const u of r){const f=this.dependencies[u];if(f){for(const m of o)if(f[m])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(r,o){if(!o||o.name==="mercator"||this._tileDebugBuffer)return;const u=d.bB(lt,this.tileID.canonical,this.tileTransform)[0],f=new d.bC,m=new d.bD;for(let g=0;g<u.length;g++){const{x,y:w}=u[g];f.emplaceBack(x,w),m.emplaceBack(g)}m.emplaceBack(0),this._tileDebugIndexBuffer=r.createIndexBuffer(m),this._tileDebugBuffer=r.createVertexBuffer(f,d.bE.members),this._tileDebugSegments=d.ac.simpleSegment(0,0,f.length,m.length)}_makeTileBoundsBuffers(r,o){if(this._tileBoundsBuffer||!o||o.name==="mercator")return;const u=d.bB(lt,this.tileID.canonical,this.tileTransform)[0];let f,m;if(this.isRaster){const g=function(x,w){const E=d.bp(x,w),I=Math.pow(2,x.z);for(let Z=0;Z<Mo;Z++)for(let q=0;q<Mo;q++){const X=d.bq((x.x+(q+hs(q))/Tn)/I),ne=d.br((x.y+(Z+hs(Z))/Tn)/I),oe=w.project(X,ne),_e=Z*Mo+q;Pn[2*_e+0]=Math.round((oe.x*E.scale-E.x)*d.a2),Pn[2*_e+1]=Math.round((oe.y*E.scale-E.y)*d.a2)}Ir.fill(0),Zo.fill(0);for(let Z=2045;Z>=0;Z--){const q=4*Z,X=Ho[q+0],ne=Ho[q+1],oe=Ho[q+2],_e=Ho[q+3],ae=X+oe>>1,ue=ne+_e>>1,he=ae+ue-ne,fe=ue+X-ae,be=ne*Mo+X,Re=_e*Mo+oe,Ae=ue*Mo+ae,Ce=Math.hypot((Pn[2*be+0]+Pn[2*Re+0])/2-Pn[2*Ae+0],(Pn[2*be+1]+Pn[2*Re+1])/2-Pn[2*Ae+1])>=16;Ir[Ae]=Ir[Ae]||(Ce?1:0),Z<1022&&(Ir[Ae]=Ir[Ae]||Ir[(ne+fe>>1)*Mo+(X+he>>1)]||Ir[(_e+fe>>1)*Mo+(oe+he>>1)])}const P=new d.bs,R=new d.ad;let B=0;function V(Z,q){const X=q*Mo+Z;return Zo[X]===0&&(P.emplaceBack(Pn[2*X+0],Pn[2*X+1],Z*d.a2/Tn,q*d.a2/Tn),Zo[X]=++B),Zo[X]-1}function U(Z,q,X,ne,oe,_e){const ae=Z+X>>1,ue=q+ne>>1;if(Math.abs(Z-oe)+Math.abs(q-_e)>1&&Ir[ue*Mo+ae])U(oe,_e,Z,q,ae,ue),U(X,ne,oe,_e,ae,ue);else{const he=V(Z,q),fe=V(X,ne),be=V(oe,_e);R.emplaceBack(he,fe,be)}}return U(0,0,Tn,Tn,Tn,0),U(Tn,Tn,0,0,0,Tn),{vertices:P,indices:R}}(this.tileID.canonical,o);f=g.vertices,m=g.indices}else{f=new d.bs,m=new d.ad;for(const{x,y:w}of u)f.emplaceBack(x,w,0,0);const g=d.bF(f.int16.subarray(0,4*f.length),void 0,4);for(let x=0;x<g.length;x+=3)m.emplaceBack(g[x],g[x+1],g[x+2])}this._tileBoundsBuffer=r.createVertexBuffer(f,Rs.members),this._tileBoundsIndexBuffer=r.createIndexBuffer(m),this._tileBoundsSegments=d.ac.simpleSegment(0,0,f.length,m.length)}_makeGlobeTileDebugBuffers(r,o){const u=o.projection;if(!u||u.name!=="globe"||o.freezeTileCoverage)return;const f=this.tileID.canonical,m=d.V(f,o),g=d.b4(m),x=d.S(o.zoom);let w;x>0&&(w=d.aO(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(r,f,o,g,w,x),this._makeGlobeTileDebugTextBuffer(r,f,o,g,w,x)}_globePoint(r,o,u,f,m,g,x){let w=d.bG(r,o,u);if(g){const E=1<<u.z,I=d.a7(f.center.lng),P=d.a8(f.center.lat),R=(u.x+.5)/E-I;let B=0;R>.5?B=-1:R<-.5&&(B=1);let V=(r/d.a2+u.x)/E+B,U=(o/d.a2+u.y)/E;V=(V-I)*f._pixelsPerMercatorPixel+I,U=(U-P)*f._pixelsPerMercatorPixel+P;const Z=[V*f.worldSize,U*f.worldSize,0];d.bH(Z,Z,g),w=d.bI(w,Z,x)}return d.bH(w,w,m)}_makeGlobeTileDebugBorderBuffer(r,o,u,f,m,g){const x=new d.bC,w=new d.bD,E=new d.bJ,I=(R,B,V,U,Z)=>{const q=(V-R)/(Z-1),X=(U-B)/(Z-1),ne=x.length;for(let oe=0;oe<Z;oe++){const _e=R+oe*q,ae=B+oe*X;x.emplaceBack(_e,ae);const ue=this._globePoint(_e,ae,o,u,f,m,g);E.emplaceBack(ue[0],ue[1],ue[2]),w.emplaceBack(ne+oe)}},P=d.a2;I(0,0,P,0,16),I(P,0,P,P,16),I(P,P,0,P,16),I(0,P,0,0,16),this._tileDebugIndexBuffer=r.createIndexBuffer(w),this._tileDebugBuffer=r.createVertexBuffer(x,d.bE.members),this._globeTileDebugBorderBuffer=r.createVertexBuffer(E,d.bK.members),this._tileDebugSegments=d.ac.simpleSegment(0,0,x.length,w.length)}_makeGlobeTileDebugTextBuffer(r,o,u,f,m,g){const x=d.a2/4,w=new d.bC,E=new d.ad,I=new d.bJ,P=25;E.reserve(32),w.reserve(P),I.reserve(P);const R=(B,V)=>P*B+V;for(let B=0;B<P;B++){const V=B*x;for(let U=0;U<P;U++){const Z=U*x;w.emplaceBack(Z,V);const q=this._globePoint(Z,V,o,u,f,m,g);I.emplaceBack(q[0],q[1],q[2])}}for(let B=0;B<4;B++)for(let V=0;V<4;V++){const U=R(B,V),Z=R(B,V+1),q=R(B+1,V),X=R(B+1,V+1);E.emplaceBack(U,Z,q),E.emplaceBack(q,Z,X)}this._tileDebugTextIndexBuffer=r.createIndexBuffer(E),this._tileDebugTextBuffer=r.createVertexBuffer(w,d.bE.members),this._globeTileDebugTextBuffer=r.createVertexBuffer(I,d.bK.members),this._tileDebugTextSegments=d.ac.simpleSegment(0,0,P,32)}destroy(r=!0){for(const o in this.buckets)this.buckets[o].destroy(r);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),r&&this.texture&&this.texture instanceof d.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof d.T&&(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"}}class Ju{constructor(r,o){this.max=r,this.onRemove=o,this.reset()}reset(){for(const r in this.data)for(const o of this.data[r])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(r,o,u){const f=r.wrapped().key;this.data[f]===void 0&&(this.data[f]=[]);const m={value:o,timeout:void 0};if(u!==void 0&&(m.timeout=setTimeout(()=>{this.remove(r,m)},u)),this.data[f].push(m),this.order.push(f),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const o=this.data[r].shift();return o.timeout&&clearTimeout(o.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),o.value}getByKey(r){const o=this.data[r];return o?o[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,o){if(!this.has(r))return this;const u=r.wrapped().key,f=o===void 0?0:this.data[u].indexOf(o),m=this.data[u][f];return this.data[u].splice(f,1),m.timeout&&clearTimeout(m.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(m.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(r){const o=[];for(const u in this.data)for(const f of this.data[u])r(f.value)||o.push(f);for(const u of o)this.remove(u.value.tileID,u)}}class Qu{constructor(){this.state=Object.create(null),this.stateChanges=Object.create(null),this.deletedStates=Object.create(null)}updateState(r,o,u){const f=String(o);if(this.stateChanges[r]=this.stateChanges[r]||Object.create(null),this.stateChanges[r][f]=this.stateChanges[r][f]||Object.create(null),Object.assign(this.stateChanges[r][f],u),this.deletedStates[r]===null){this.deletedStates[r]=Object.create(null);for(const m in this.state[r])m!==f&&(this.deletedStates[r][m]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][f]===null){this.deletedStates[r][f]=Object.create(null);for(const m in this.state[r][f])u[m]||(this.deletedStates[r][f][m]=null)}else for(const m in u)this.deletedStates[r]&&this.deletedStates[r][f]&&this.deletedStates[r][f][m]===null&&delete this.deletedStates[r][f][m]}removeFeatureState(r,o,u){if(this.deletedStates[r]===null)return;const f=String(o);if(this.deletedStates[r]=this.deletedStates[r]||Object.create(null),u&&o!==void 0)this.deletedStates[r][f]!==null&&(this.deletedStates[r][f]=this.deletedStates[r][f]||Object.create(null),this.deletedStates[r][f][u]=null);else if(o!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][f])for(u in this.deletedStates[r][f]=Object.create(null),this.stateChanges[r][f])this.deletedStates[r][f][u]=null;else this.deletedStates[r][f]=null;else this.deletedStates[r]=null}getState(r,o){const u=this.state[r]||Object.create(null),f=this.stateChanges[r]||Object.create(null),m=this.deletedStates[r];if(m===null)return Object.create(null);if(o!==void 0){const x=String(o),w=Object.assign(Object.create(null),u[x],f[x]);if(m){const E=m[o];if(E===null)return Object.create(null);for(const I in E)delete w[I]}return w}const g=Object.assign(Object.create(null),u,f);if(m)for(const x in m)delete g[x];return g}
3405initializeTileState(r,o){r.refreshFeatureState(o)}coalesceChanges(r,o){const u=Object.create(null);for(const f in this.stateChanges){this.state[f]=this.state[f]||Object.create(null);const m=Object.create(null);for(const g in this.stateChanges[f])this.state[f][g]||(this.state[f][g]=Object.create(null)),Object.assign(this.state[f][g],this.stateChanges[f][g]),m[g]=this.state[f][g];u[f]=m}for(const f in this.deletedStates){this.state[f]=this.state[f]||Object.create(null);const m=Object.create(null);if(this.deletedStates[f]===null)for(const g in this.state[f])m[g]=Object.create(null),this.state[f][g]=Object.create(null);else for(const g in this.deletedStates[f]){if(this.deletedStates[f][g]===null)this.state[f][g]=Object.create(null);else if(this.state[f][g])for(const x of Object.keys(this.deletedStates[f][g]))delete this.state[f][g][x];m[g]=this.state[f][g]}u[f]=u[f]||Object.create(null),Object.assign(u[f],m)}if(this.stateChanges=Object.create(null),this.deletedStates=Object.create(null),Object.keys(u).length!==0)for(const f in r)r[f].refreshFeatureState(o,u)}}class En extends d.E{constructor(r,o,u){super(),this.id=r,this._renderSourceType=u,this._maxzoomOverride=null,this.setSource(o),this._tiles={},this._cache=new Ju(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Qu,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&"_dataType"in this._source&&this._source._dataType==="raster",this._supportsFading=this._source.type==="raster"||this._source.type==="raster-array"||this._source.type==="image"||this._source.type==="video"||this._source.type==="custom",this._isRasterElevatedOverTerrain=!1}onAdd(r){this.map=r,this._minTileCacheSize=this._minTileCacheSize===void 0&&r?r._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&r?r._maxTileCacheSize:this._maxTileCacheSize}setSource(r){r.on("data",o=>{o.dataType==="source"&&o.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&o.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const r in this._tiles)if(!this._tiles[r].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform)}setMaxzoomOverride(r){this._maxzoomOverride=r}_loadTile(r,o){return r.renderSourceType=this._renderSourceType,r.isExtraShadowCaster=this._shadowCasterTiles[r.tileID.key],this._source.loadTile(r,o)}_unloadTile(r){if(this._source.unloadTile)return this._source.unloadTile(r)}_abortTile(r){if(this._source.abortTile)return this._source.abortTile(r)}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const u=this._tiles[o];u.upload(r,this.map?this.map.painter:void 0),u.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(r=>r.tileID).sort(xa).map(r=>r.key)}getRenderableIds(r,o){const u=[];for(const f in this._tiles)this._isIdRenderable(+f,r,o)&&u.push(this._tiles[f]);return r?u.sort((f,m)=>{const g=f.tileID,x=m.tileID,w=new d.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle),E=new d.P(x.canonical.x,x.canonical.y)._rotate(this.transform.angle);return g.overscaledZ-x.overscaledZ||E.y-w.y||E.x-w.x}).map(f=>f.tileID.key):u.map(f=>f.tileID).sort(xa).map(f=>f.key)}hasRenderableParent(r){const o=this.findLoadedParent(r,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(r,o,u){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(o||!this._tiles[r].holdingForFade())&&(u||!this._shadowCasterTiles[r])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(+r,"reloading")}}_reloadTile(r,o){const u=this._tiles[r];u&&(u.state!=="loading"&&(u.state=o),this._loadTile(u,this._tileLoaded.bind(this,u,r,o)))}_tileLoaded(r,o,u,f,m){if(f){if(r.state="errored",d.bO(f)){if(this._source.fire(new d.h("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:r})),!(r.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const x=this.map.painter.terrain;this.update(this.transform,x.getScaledDemTileSize(),!0),x.resetTileLookupCache(this.id
3405)}else this.update(this.transform)}else this._source.fire(new d.f(f,{tile:r}));return}r.timeAdded=d.e.now(),u==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(o,r),this._source.type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null);let g=new Headers;m&&m.headers&&(g=m.headers),this._source.fire(new d.h("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id,responseHeaders:g}))}_hasTunnelGeometry(){for(const r in this._tiles){const o=this._tiles[r];if(o&&o.hasTunnelGeometry)return!0}return!1}_backfillDEM(r){const o=this.getRenderableIds();for(let f=0;f<o.length;f++){const m=o[f];if(r.neighboringTiles&&r.neighboringTiles[m]){const g=this.getTileByID(m);u(r,g),u(g,r)}}function u(f,m){if(!f.dem||f.dem.borderReady)return;f.needsHillshadePrepare=!0,f.needsDEMTextureUpload=!0;let g=m.tileID.canonical.x-f.tileID.canonical.x;const x=m.tileID.canonical.y-f.tileID.canonical.y,w=Math.pow(2,f.tileID.canonical.z),E=m.tileID.key;g===0&&x===0||Math.abs(x)>1||(Math.abs(g)>1&&(Math.abs(g+w)===1?g+=w:Math.abs(g-w)===1&&(g-=w)),m.dem&&f.dem&&(f.dem.backfillBorder(m.dem,g,x),f.neighboringTiles&&f.neighboringTiles[E]&&(f.neighboringTiles[E].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,o,u,f){for(const m in this._tiles){let g=this._tiles[m];if(f[m]||!g.hasData()||g.tileID.overscaledZ<=o||g.tileID.overscaledZ>u)continue;let x=g.tileID;for(;g&&g.tileID.overscaledZ>o+1;){const E=g.tileID.scaledTo(g.tileID.overscaledZ-1);g=this._tiles[E.key],g&&g.hasData()&&(x=E)}let w=x;for(;w.overscaledZ>o;)if(w=w.scaledTo(w.overscaledZ-1),r[w.key]){f[x.key]=x;break}}}findLoadedParent(r,o){if(r.key in this._loadedParentTiles){const u=this._loadedParentTiles[r.key];return u&&u.tileID.overscaledZ>=o?u:null}for(let u=r.overscaledZ-1;u>=o;u--){const f=r.scaledTo(u),m=this._getLoadedTile(f);if(m)return m}}_getLoadedTile(r){const o=this._tiles[r.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?r.wrapped().key:r.canonical.key)}updateCacheSize(r,o){o=o||this._source.tileSize;const u=Math.ceil(r.width/o)+1,f=Math.ceil(r.height/o)+1,m=Math.floor(u*f*5),g=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,m):m,x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(x)}handleWrapJump(r){const o=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,o){const u={};for(const f in this._tiles){const m=this._tiles[f];m.tileID=m.tileID.unwrapTo(m.tileID.wrap+o),u[m.tileID.key]=m}this._tiles=u;for(const f in this._timers)clearTimeout(this._timers[f]),delete this._timers[f];for(const f in this._tiles)this._setTileReloadTimer(+f,this._tiles[f])}}update(r,o,u,f,m){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!u)return;this.updateCacheSize(r,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const g=this._source.type==="batched-model";let x,w=this._source.maxzoom;this._maxzoomOverride!==null&&(w=Math.min(w,this._maxzoomOverride));const E=this.map&&this.map.painter?this.map.painter._terrain:null;if(E&&E.sourceCache===this&&E.attenuationRange()){const B=E.attenuationRange()[0],V=Math.floor(B)-Math.log2(E.getDemUpscale());w>V&&(w=V)}const I=this._maxzoomOverride===null&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)x=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(B=>new d.bP(B.canonical.z,B.wrap,B.canonical.z,B.canonical.x,B.canonical.y));else if(this.tileCoverLift!==0){const B=r.clone();B.tileCoverLift=this.tileCoverLift,x=B.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:w,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:I,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:g}),this._source.minzoom<=1&&r.projection.name==="globe"&&(x.push(new d.bP(1,0,1,0,0)),x.push(new d.bP(1,0,1,1,0)),x.push(new d.bP(1,0,1,0,1)),x.push(new d.bP(1,0,1,1,1)))}else if(x=r.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:w,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:I,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:g}),this._source.hasTile){const B=this._source.hasTile.bind(this._source);x=x.filter(V=>B(V))}}else x=[];if(x.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!this._supportsFading){const B=r.coveringZoomLevel({tileSize:o||this._source.tileSize,roundZoom:this._source.roundZoom&&!u}),V=Math.min(B,w);if(g){const U=r.extendTileCover(x,V);for(const Z of U)x.push(Z)}else if(m){const U=this.transform.getFrustum(V),Z=r.extendTileCoverToNearPlane(x,U,V);for(const q of Z)x.push(q);if(V>=18&&this._hasTunnelGeometry()){const q=r.extendTileCoverForTunnels(x,U,V,20);for(const X of q)x.push(X)}}else if(this.castsShadows&&f){const U=r.extendTileCover(x,V,f,16);for(const Z of U)this._shadowCasterTiles[Z.key]=!0,x.push(Z)}}const P=this._updateRetainedTiles(x);if(this._supportsFading&&x.length!==0){const B={},V={},U=d.e.now(),Z=Object.keys(P);for(const X of Z){const ne=P[X],oe=this._tiles[X];if(!oe||oe.fadeEndTime!==void 0&&oe.fadeEndTime<=U)continue;const _e=this.findLoadedParent(ne,Math.max(ne.overscaledZ-En.maxOverzooming,this._source.minzoom));_e&&(this._addTile(_e.tileID),B[_e.tileID.key]=_e.tileID),V[X]=ne}const q=x.at(-1).overscaledZ;for(const X in this._tiles){const ne=this._tiles[X];
vendor: 8,793 bytes, line 3405
3405if(P[X]||!ne.hasData())continue;let oe=ne.tileID;for(;oe.overscaledZ>q;){oe=oe.scaledTo(oe.overscaledZ-1);const _e=this._tiles[oe.key];if(_e&&_e.hasData()&&V[oe.key]){P[X]=ne.tileID;break}}}for(const X in B)P[X]||(this._coveredTiles[X]=!0,P[X]=B[X])}for(const B in P)this._tiles[B].clearFadeHold();const R=d.bQ(this._tiles,P);for(const B of R){const V=this._tiles[B];V.hasSymbolBuckets&&!V.holdingForFade()?V.setHoldDuration(this.map._fadeDuration):V.hasSymbolBuckets&&!V.symbolFadeFinished()||this._removeTile(+B)}this._updateLoadedParentTileCache(),this._renderSourceType===d.bR.Symbol&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(+r)}_updateRetainedTiles(r){const o={};if(r.length===0)return o;const u={},f=r.reduce((E,I)=>Math.min(E,I.overscaledZ),1/0),m=r[0].overscaledZ,g=Math.max(m-En.maxOverzooming,this._source.minzoom),x=Math.max(m+En.maxUnderzooming,this._source.minzoom),w={};for(const E of r){const I=this._addTile(E);o[E.key]=E,I.hasData()||f<this._source.maxzoom&&(w[E.key]=E)}this._retainLoadedChildren(w,f,x,o);for(const E of r){let I=this._tiles[E.key];if(I.hasData())continue;if(E.canonical.z>=this._source.maxzoom){const R=E.children(this._source.maxzoom)[0],B=this.getTile(R);if(B&&B.hasData()){o[R.key]=R;continue}}else{const R=E.children(this._source.maxzoom);if(o[R[0].key]&&o[R[1].key]&&o[R[2].key]&&o[R[3].key])continue}let P=I.wasRequested();for(let R=E.overscaledZ-1;R>=g;--R){const B=E.scaledTo(R);if(u[B.key]||(u[B.key]=!0,I=this.getTile(B),!I&&P&&(I=this._addTile(B)),I&&(o[B.key]=B,P=I.wasRequested(),I.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const o=[];let u,f=this._tiles[r].tileID;for(;f.overscaledZ>0;){if(f.key in this._loadedParentTiles){u=this._loadedParentTiles[f.key];break}o.push(f.key);const m=f.scaledTo(f.overscaledZ-1);if(u=this._getLoadedTile(m),u)break;f=m}for(const m of o)this._loadedParentTiles[m]=u}}_addTile(r){let o=this._tiles[r.key];if(o)return o.isExtraShadowCaster!==!0||this._shadowCasterTiles[r.key]||this._reloadTile(r.key,"reloading"),o;o=this._cache.getAndRemove(r),o&&(this._setTileReloadTimer(r.key,o),o.tileID=r,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,o)));const u=!!o;if(!u){const f=this.map?this.map.painter:null,m=this._source.tileSize*r.overscaleFactor();o=this._source.type==="raster-array"?function(g,x,w,E,I){if(!ta)throw new Error("Raster-array module is not loaded.");return ta(g,x,w,E,I)}(r,m,this.transform.tileZoom,f,this._isRaster):new Ps(r,m,this.transform.tileZoom,f,this._isRaster,this._source.worldview),this._loadTile(o,this._tileLoaded.bind(this,o,r.key,o.state))}return o.uses++,this._tiles[r.key]=o,u||this._source.fire(new d.h("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(r,o){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const u=o.getExpiryTimeout();u&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},u))}_removeTile(r){const o=this._tiles[r];o&&(o.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),o.uses>0||(o.hasData()&&o.state!=="reloading"||o.state==="empty"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(+r);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,o,u){const f=[],m=this.transform;if(!m)return f;const g=m.projection.name==="globe",x=d.a7(m.center.lng),w=m.getFreeCameraOptions().position||new d.bS(0,0,0);for(const E in this._tiles){const I=this._tiles[E];if(u&&I.clearQueryDebugViz(),I.holdingForFade())continue;let P;if(g){const R=I.tileID.canonical;if(R.z===0){const B=[Math.abs(d.b0(x,...dn(R,-1))-x),Math.abs(d.b0(x,...dn(R,1))-x)];P=[0,2*B.indexOf(Math.min(...B))-1]}else{const B=[Math.abs(d.b0(x,...dn(R,-1))-x),Math.abs(d.b0(x,...dn(R,0))-x),Math.abs(d.b0(x,...dn(R,1))-x)];P=[B.indexOf(Math.min(...B))-1]}}else P=[0];for(const R of P){const B=r.containsTile(I,m,o,R,w);B&&f.push(B)}}return f}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(r){return this._getRenderableCoordinates(r)}_getRenderableCoordinates(r,o){if(!this.transform)return[];const u=this.getRenderableIds(r,o).map(m=>this._tiles[m].tileID),f=this.transform.projection.name==="globe";for(const m of u)m.projMatrix=this.transform.calculateProjMatrix(m.toUnwrapped()),m.expandedProjMatrix=f?this.transform.calculateProjMatrix(m.toUnwrapped(),!1,!0):m.projMatrix;return u}sortCoordinatesByDistance(r){if(!this.transform)return r.slice();const o=r.slice(),u=this.transform._camera.position,f=this.transform._camera.forward(),m={};for(const g of o){const x=1/(1<<g.canonical.z);m[g.key]=((g.canonical.x+.5)*x+g.wrap-u[0])*f[0]+((g.canonical.y+.5)*x-u[1])*f[1]-u[2]*f[2]}return o.sort((g,x)=>m[g.key]-m[x.key]),o}hasTransition(){if(this._source.hasTransition())return!0;if(this._supportsFading){const r=d.e.now();for(const o in this._tiles){const u=this._tiles[o];if(u.fadeEndTime!==void 0&&u.fadeEndTime>=r)return!0}}return!1}setFeatureState(r,o,u){this._state.updateState(r=r||"_geojsonTileLayer",o,u)}removeFeatureState(r,o,u){this._state.removeFeatureState(r=r||"_geojsonTileLayer",o,u)}getFeatureState(r,o){return this._state.getState(r=r||"_geojsonTileLayer",o)}setDependencies(r,o,u){const f=this._tiles[r];f&&f.setDependencies(o,u)}reloadTilesForDependencies(r,o){for(const u in this._tiles)this._tiles[u].hasDependency(r,o)&&this._reloadTile(+u,"reloading");this._cache.filter(u=>!u.hasDependency(r,o))}_preloadTiles(r,o){if(!this._sourceLoaded){const w=()=>{this._sourceLoaded&&(this._source.off("data",w),this._preloadTiles(r,o))};return void this._source.on("data",w)}const u=new Map,f=Array.isArray(r)?r:[r],m=this.map.painter.terrain,g=this.usedForTerrain&&m?m.getScaledDemTileSize():this._source.tileSize;for(const w of f){const E=w.coveringTiles({tileSize:g,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const I of E)u.set(I.key,I);this.usedForTerrain&&w.updateElevation(!1)}const x=Array.from(u.values());d.bT(x,(w,E)=>{const I=new Ps(w,this._source.tileSize*w.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(I,P=>{this._source.type==="raster-dem"&&I.dem&&this._backfillDEM(I),E(P,I)})},o)}}function xa(a,r){const o=Math.abs(2*a.wrap)-+(a.wrap<0),u=Math.abs(2*r.wrap)-+(r.wrap<0);return a.overscaledZ-r.overscaledZ||u-o||r.canonical.y-a.canonical.y||r.canonical.x-a.canonical.x}function dn(a,r){const o=1<<a.z;return[a.x/o+r,(a.x+1)/o+r]}function al(a,r){if(a.z<=r.z){const u=r.z-a.z;return r.x>>u===a.x&&r.y>>u===a.y}const o=a.z-r.z;return a.x>>o===r.x&&a.y>>o===r.y}function va(a,r){return a.sourceFQID!==r.sourceFQID?a.sourceFQID<r.sourceFQID?-1:1:a.tileId.z!==r.tileId.z?a.tileId.z-r.tileId.z:a.tileId.x!==r.tileId.x?a.tileId.x-r.tileId.x:a.tileId.y-r.tileId.y}En.maxOverzooming=10,En.maxUnderzooming=3;class st{constructor(r=[]){this.tiles=r}getTilesIntersecting(r){const o=[];for(const u of this.tiles)al(u.tileId,r)&&o.push(u);return o}equals(r){if(this.tiles.length!==r.length)return!1;for(let o=0;o<this.tiles.length;++o){const u=this.tiles[o],f=r[o];if(u.sourceFQID!==f.sourceFQID||u.tileId.z!==f.tileId.z||u.tileId.x!==f.tileId.x||u.tileId.y!==f.tileId.y||u.generation!==f.generation)return!1}return!0}empty(){return this.tiles.length===0}}class ii{constructor(){this._tiles=[],this._snapshot=new st,this._snapshotChanged=!1}clear(){this._tiles.length=0}consumeSnapshotChanged(){const r=this._snapshotChanged;return this._snapshotChanged=!1,r}addTileElevation(r,o,u,f){this._tiles.push({sourceFQID:r,tileId:o,features:u,generation:f})}updateSnapshotIfNeeded(){return this._tiles.sort(va),this._snapshot.equals(this._tiles)||(this._snapshot=new st(this._tiles.slice()),this._snapshotChanged=!0),this._snapshot}}function qt(a,r){const o=[];for(const u of a.getTilesIntersecting(r))o.push(`${u.tileId.z}/${u.tileId.x}/${u.tileId.y}:${u.generation}`);return o.sort(),o.join("|")}function nn(a,r){const o=d.bW(a);return o===r||!o&&!r}function Ro(a,r){return a._mergedOtherSourceCaches[r]||a._mergedSymbolSourceCaches[r]||a._mergedHdRoa
3405dElevationSourceCaches[r]}function Yt(a){const r=a.sourceLayer;return!!r&&r.startsWith("hd_road_")}function uo(a){return!!a.layout&&(a.type==="line"&&a.layout.get("line-elevation-reference")==="hd-road-markup"||a.type==="circle"&&a.layout.get("circle-elevation-reference")==="hd-road-markup"||a.type==="symbol"&&a.layout.get("symbol-elevation-reference")==="hd-road-markup"||a.type==="fill"&&a.layout.get("fill-elevation-reference")==="hd-road-markup")}function ds(a){const r=new Set;for(const o in a._mergedLayers){const u=a._mergedLayers[o];uo(u)&&r.add(d.m(u.source,u.scope))}return r}function ba(a){const r=ds(a),o=new Set;for(const u in a._mergedLayers){const f=a._mergedLayers[u];if(!f.source||!Yt(f))continue;const m=d.m(f.source,f.scope);r.has(m)||o.add(m)}return o}function Vi(a){const r=ds(a);if(r.size===0)return!1;const o=ki(a);for(const u of r)for(const f of o)if(u!==f)return!0;return!1}function ki(a){const r=new Set;for(const o in a._mergedLayers){const u=a._mergedLayers[o];u.source&&Yt(u)&&r.add(d.m(u.source,u.scope))}return r}function Po(a,r,o){const u=ds(a);if(u.size===0)return;if(!o){const m=ki(a);for(const g of m)u.delete(g)}if(u.size===0)return;const f=[a._mergedOtherSourceCaches,a._mergedSymbolSourceCaches];for(const m of f)for(const g in m){if(!u.has(g))continue;const x=m[g];for(const w in x._tiles){const E=x._tiles[w];E&&(r&&!r(E)||(E.hasDeferredElevationFeatures=!1,x._reloadTile(+w,"reloading")))}}}class Dn{constructor(){this.elevationSourceCaches={},this.manager=new ii,this._needsCrossSourceElevation=!1,this._ingestFQIDs=new Set,this._terrainActiveLast=void 0}}function tc(a){a.map&&a.map.painter&&(a.map.painter.elevationCoverageSnapshot=null,a.map.painter.elevationProvidersReady=void 0)}function ll(a){a._crossSourceElevationActive=!1,function(r){const o=r._hdElevation,u=!!(r.map&&r.map.painter&&r.map.painter.elevationCoverageSnapshot);return o?!o._needsCrossSourceElevation&&o._ingestFQIDs.size===0&&o.manager._tiles.length===0&&!u:!u}(a)||(tc(a),a._hdElevation&&(a._hdElevation._needsCrossSourceElevation=!1,a._hdElevation._ingestFQIDs.clear(),a._hdElevation.manager.clear(),a._hdElevation._terrainActiveLast=void 0))}function ic(a,r,o){const u=d.m(o.id,a.scope);if(r.elevationSourceCaches[u])return;const f=`hd-road-elevation:${o.id}`,m=d.m(f,a.scope),g=a._sourceCaches[f]=new En(m,o,d.bR.HdRoadElevation);r.elevationSourceCaches[u]=g,g.onAdd(a.map);const x=a._otherSourceCaches[o.id];x&&x._sourceLoaded&&(g._sourceLoaded=!0)}function wa(a,r){if(ce(a,a.map&&a.map.transform))return r.manager.clear(),void(a.map.painter&&(a.map.painter.elevationCoverageSnapshot=null));if(!r._needsCrossSourceElevation)return void tc(a);for(const x of r._ingestFQIDs){const w=Ro(a,x);w&&(w.used=!0)}r.manager.clear();let o=!0;for(const x of r._ingestFQIDs){const w=Ro(a,x);if(!w)continue;const E=w._tiles;for(const I in E){const P=E[I];if(!P||!P.loaded())continue;const R=P.parsedElevationFeatures;R!==void 0?r.manager.addTileElevation(x,P.tileID.canonical,R,P.parsedElevationGeneration):o=!1}}const u=r.manager._snapshot,f=r.manager.updateSnapshotIfNeeded();a.map.painter&&(a.map.painter.elevationCoverageSnapshot=f.empty()?null:f);const m=o&&function(x,w){for(const E of w){const I=Ro(x,E);if(!I||!I._sourceLoaded)return!1;for(const P in I._tiles){const R=I._tiles[P];if(R&&(R.state==="loading"||R.state==="reloading"))return!1}}return!0}(a,ba(a));a.map.painter&&(a.map.painter.elevationProvidersReady=m);const g=r.manager.consumeSnapshotChanged();(g||m)&&Po(a,x=>{return!!x.hasDeferredElevationFeatures||g&&(w=f,qt(u,E=x.tileID.canonical)!==qt(w,E));var w,E})}const Ar=a=>({u_matrix:a});function ho(a,r){const o=a.context.gl;return new d._({func:o.EQUAL,mask:255},a._tileClippingMaskIDs[r.key]||0,0,o.KEEP,o.KEEP,o.KEEP)}function fn(a,r){const o=a.context.gl;return new d._({func:o.EQUAL,mask:255},255&~(a._tileClippingMaskIDs[r.key]||0),0,o.KEEP,o.KEEP,o.KEEP)}function eu(a,r){if(!a.frcCoverageSnapshot||!a.frcCoverageRenderer)return null;const o=a.frcCoverageSnapshot.getTileOrParent(r.canonical);if(!o||o.frcMask===0)return null;const u=a.frcCoverageRenderer.getBuffers(o.tileId);if(!u)return null;const f=new d.bX(o.tileId.z,o.tileId.x,o.tileId.y),m=new d.bY(r.wrap,f);return{buffers:u,projMatrix:a.transform.calculateProjMatrix(m),coverageTile:o}}function Ta(a,r,o){if(!a.frcCoverageSnapshot)return;
vendor: 10,387 bytes, line 3405
3405const u=a.context,f=u.gl,m=a.getOrCreateProgram("clippingMask");u.setColorMode(d.a1.disabled),u.setDepthMode(d.Z.disabled);for(const g of r){const x=eu(a,g);if(!x)continue;const w=x.buffers.frcLevelSegments[o];w&&m.draw(a,f.TRIANGLES,d.Z.disabled,new d._({func:f.EQUAL,mask:255},a._tileClippingMaskIDs[g.key]||0,255,f.KEEP,f.KEEP,f.INVERT),d.a1.disabled,d.$.disabled,Ar(x.projMatrix),`$frc_coverage_${o}`,x.buffers.vertexBuffer,x.buffers.indexBuffer,w)}}function Nr(a,r,o){if(!a.frcCoverageSnapshot)return;const u=a.context,f=u.gl,m=a.getOrCreateProgram("clippingMask");u.setColorMode(d.a1.disabled),u.setDepthMode(d.Z.disabled);for(const g of r){const x=eu(a,g);if(!x)continue;const w=x.buffers.frcLevelSegments[o];w&&m.draw(a,f.TRIANGLES,d.Z.disabled,new d._({func:f.EQUAL,mask:255},255&~(a._tileClippingMaskIDs[g.key]||0),255,f.KEEP,f.KEEP,f.INVERT),d.a1.disabled,d.$.disabled,Ar(x.projMatrix),`$frc_coverage_restore_${o}`,x.buffers.vertexBuffer,x.buffers.indexBuffer,w)}}function Do(a,r,o,u,f){if(r.length===0)return;let m=0;for(const x of r)m|=x.frcMask;const g=r.map(x=>x.coord);for(let x=0;x<9;++x)if(m&1<<x){if(Ta(a,g,x),u)for(const w of r)w.frcMask&1<<x&&u(w,x,ho(a,w.coord));if(o>0&&f)for(const w of r)w.frcMask&1<<x&&f(w,x,fn(a,w.coord));Nr(a,g,x)}}function fs(a){for(const r of a)if(r.rings.length>0&&r.rings[0].length>0)return!0;return!1}function br(a){const r=a.frcCoverageFadeRange;return!r||r[1]<=r[0]?0:1-Math.max(0,Math.min(1,(a.transform.zoom-r[0])/(r[1]-r[0])))}const rc={loaded:!0,drawBuilding:function(a,r,o,u){a.currentLayer<a.firstLightBeamLayer&&(a.firstLightBeamLayer=a.currentLayer);const f=o.paint.get("building-ambient-occlusion-ground-intensity"),m=o.paint.get("building-ambient-occlusion-ground-radius"),g=o.paint.get("building-ambient-occlusion-ground-attenuation"),x=o.paint.get("building-opacity");if(x<=0)return;let w=f>0&&m>0,E=!0;const I=o.paint.get("building-vertical-scale");if(I<=0)return;a.shadowRenderer||(E=!1);const P=a.conflationActive&&a.style.isLayerClipped(o,r.getSource()),R=a.style.order.indexOf(o.fqid);if(function(B,V,U,Z,q,X){for(const ne of X){const oe=V.getTile(ne).getBucket(U);oe&&(q&&oe.updateReplacement(ne,B.replacementSource,Z),oe.uploadUpdatedIndexBuffer(B.context))}}(a,r,o,R,P,u),function(B,V,U,Z){for(const q of Z){const X=V.getTile(q).getBucket(U);X&&X.needsEvaluation()&&X.uploadUpdatedColorBuffer(B.context)}}(a,r,o,u),o.resetLayerRenderingStats(a),a.shadowRenderer&&(a.shadowRenderer.useNormalOffset=!0),a.renderPass==="shadow"&&a.shadowRenderer){const B=[],V=a.shadowRenderer.getShadowPassDepthMode();tr({painter:a,source:r,layer:o,coords:u,defines:B,blendMode:d.a1.disabled,depthMode:V,opacity:x,verticalScale:I,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(a.renderPass==="translucent"){let B=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];E&&(B=B.concat("RENDER_SHADOWS")),a.shadowRenderer&&a.shadowRenderer.useNormalOffset&&(B=B.concat("NORMAL_OFFSET"));const V=o.paint.get("building-facade-emissive-chance"),U=o.paint.get("building-ambient-occlusion-intensity"),Z=o.paint.get("building-flood-light-intensity"),q=o.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",X=o.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(q?null:o.lut).toArray01().slice(0,3),ne=o.paint.get("building-flood-light-ground-attenuation"),oe=Z>0,_e=new d.Z(a.context.gl.LEQUAL,d.Z.ReadWrite,a.depthRangeFor3D);x<1&&tr({painter:a,source:r,layer:o,coords:u,defines:B,blendMode:d.a1.disabled,depthMode:_e,opacity:x,verticalScale:I,facadeEmissiveChance:V,facadeAOIntensity:U,floodLightIntensity:Z,floodLightColor:X,depthOnly:!0});const ae=a.colorModeForRenderPass();tr({painter:a,source:r,layer:o,coords:u,defines:B,blendMode:ae,depthMode:_e,opacity:x,verticalScale:I,facadeEmissiveChance:V,facadeAOIntensity:U,floodLightIntensity:Z,floodLightColor:X});const ue=o.paint.get("building-front-cutoff");di(a.transform.pitch,ue,!!a.terrain),w&&jr(a,r,o,u,!0,x,f,m,Z,X,g,P),oe&&jr(a,r,o,u,!1,x,f,m,Z,X,ne,P)}else if(a.renderPass==="light-beam"){const B=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],V=new d.Z(a.context.gl.LEQUAL,d.Z.ReadOnly,a.depthRangeFor3D);tr({painter:a,source:r,layer:o,coords:u,defines:B,blendMode:d.a1.alphaBlended,depthMode:V,opacity:x,verticalScale:I,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}a.shadowRenderer&&(a.shadowRenderer.useNormalOffset=!1),a.resetStencilClippingMasks()},BuildingTileBorderManager:class{constructor(){this.visibleTiles=[]}updateBorders(a,r){const o=[],u=[],f=a._getRenderableCoordinates(!1,!0);for(const x of f){const w=a.getTile(x);if(!w.hasData())continue;const E=w.getBucket(r);E&&(E.isEmpty()||(o.push(x.key),u.push({bucket:E,tileID:x.canonical})))}let m=o.length!==this.visibleTiles.length;if(!m){o.sort();for(let x=0;x<o.length;x++)if(o[x]!==this.visibleTiles[x]){m=!0;break}}if(!m)return;const g=new Set;this.visibleTiles=o,u.sort((x,w)=>x.tileID.z-w.tileID.z||x.tileID.x-w.tileID.x||x.tileID.y-w.tileID.y);for(const x of u){const w=new Array,E=new Array,I=x.bucket;for(const P of I.featuresOnBorder)I.footprints[P.footprintIndex].hiddenFlags&d.aR||(g.has(P.featureId)?E.push(P.footprintIndex):(g.add(P.featureId),w.push(P.footprintIndex)));I.updateFootprintHiddenFlags(w,d.aS,!1),I.updateFootprintHiddenFlags(E,d.aS,!0)}}},drawRasterParticle:function(a,r,o,u,f,m){a.renderPass==="offscreen"&&function(g,x,w,E){if(!E.length)return;const I=g.context,P=I.gl,R=x.getSource();if(R.type!=="raster-array")return;const B=Math.ceil(Math.sqrt(w.paint.get("raster-particle-count")));let V=w.particlePositionRGBAImage;if(!V||V.width!==B){const ne=function(oe){const _e=oe*oe,ae=new Uint8Array(4*_e),ue=.9090909090909091;for(let he=0;he<_e;he++){const fe=ue*(d.b8(2*he+0)+gr),be=ue*(d.b8(2*he+1)+gr),Re=255*fe%1,Ae=255*be%1,Ce=Re,Ee=be-Ae/255,Ye=Ae;ae[4*he+0]=255*(fe-Re/255),ae[4*he+1]=255*Ce,ae[4*he+2]=255*Ee,ae[4*he+3]=255*Ye}return ae}(B);V=w.particlePositionRGBAImage=new d.b({width:B,height:B},ne)}let U=w.particleFramebuffer;U?U.width!==B&&(U.destroy(),U=w.particleFramebuffer=I.createFramebuffer(B,B,1,null)):U=w.particleFramebuffer=I.createFramebuffer(B,B,1,null);const Z=[];for(const ne of E){const oe=x.getTile(ne);if(!oe)continue;const _e=Mn(oe,R,w);if(!_e)continue;const ae=[oe.tileSize,oe.tileSize];let ue=w.tileFramebuffer;ue||(ue=w.tileFramebuffer=I.createFramebuffer(ae[0],ae[1],1,null));let he=oe.rasterParticleState;he||(he=oe.rasterParticleState=new Zi(I,ne,ae,V));const fe=he.update(w.lastInvalidatedAt);he.particleTextureDimension!==B&&he.updateParticleTexture(ne,V);const be=he.targetColorTexture;he.targetColorTexture=he.backgroundColorTexture,he.backgroundColorTexture=be;const Re=he.particleTexture0;he.particleTexture0=he.particleTexture1,he.particleTexture1=Re,Z.push([ne,_e,he,fe])}if(Z.length===0)return;const q=d.e.now(),X=w.previousDrawTimestamp?.001*(q-w.previousDrawTimestamp):.0167;if(w.previousDrawTimestamp=q,w.hasColorMap()){I.activeTexture.set(P.TEXTURE0+2);let ne=w.colorRampTexture;ne||(ne=w.colorRampTexture=new d.T(I,w.colorRamp,P.RGBA8)),ne.bind(P.LINEAR,P.CLAMP_TO_EDGE)}I.bindFramebuffer.set(w.tileFramebuffer.framebuffer),function(ne,oe,_e){const ae=ne.context,ue=ae.gl,he=oe.tileFramebuffer;ae.activeTexture.set(ue.TEXTURE0);const fe={u_texture:0,u_opacity:1.05*(Re=oe.paint.get("raster-particle-fade-opacity-factor"))/(Re+.05)},be=ne.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var Re;for(const Ae of _e){const[,,Ce,Ee]=Ae;he.colorAttachment0.set(Ce.targetColorTexture.texture),ae.viewport.set([0,0,he.width,he.height]),ae.clear({color:d.C.transparent}),Ee&&(Ce.backgroundColorTexture.bind(ue.NEAREST,ue.CLAMP_TO_EDGE),be.draw(ne,ue.TRIANGLES,d.Z.disabled,d._.disabled,d.a1.alphaBlended,d.$.disabled,fe,oe.id,ne.viewportBuffer,ne.quadTriangleIndexBuffer,ne.viewportSegments))}}(g,w,Z),function(ne,oe,_e,ae){const ue=ne.context,he=ue.gl,fe=_e.tileFramebuffer,be=ne.transform.projection.name==="globe",Re=_e.paint.get("raster-particle-max-speed");for(const Ae of ae){const[Ce,Ee,Ye]=Ae;ue.activeTexture.set(he.TEXTURE0+0),Ee.texture.bind(he.LINEAR,he.CLAMP_TO_EDGE),fe.colorAttachment0.set(Ye.targetColorTexture.texture);const De=ne.getOrCreateProgram("rasterParticleDraw",{defines:Ee.defines,overrideFog:!1});ue.activeTexture.set(he.TEXTURE0+1);const Ve=Ee.scalarData?[]:[0,1,2,3].map(et=>d.aB[et](Ce));Ve.push(Ce);const $e=Ce.canonical.x,ot=Ce.canonical.y;for(const et of Ve){const Xe=oe.getTile(be?et.wrapped():et);if(!Xe)continue;const mt=Xe.rasterParticleState;if(!mt)continue;const qe=et.canonical.x+(1<<et.canonical.z)*(et.wrap-Ce.wrap),Ge=et.canonical.y;mt.particleTexture0.bind(he.NEAREST,he.CLAMP_TO_EDGE);const Qe=Ai(1,mt.particleTexture0.size[0],[qe-$e,Ge-ot],0,Ee.texture.size,2,Re,Ee.textureOffset,Ee.scale,Ee.offset);De.draw(ne,he.POINTS,d.Z.disabled,d._.disabled,d.a1.alphaBlended,d.$.disabled,Qe,_e.id,mt.particleIndexBuffer,void 0,mt.particleSegment)}}}(g,x,w,Z),I.bindFramebuffer.set(w.particleFramebuffer.framebuffer),function(ne,oe,_e,ae){const ue=ne.context,he=ue.gl,fe=oe.paint.get("raster-particle-max-speed"),be=ae*oe.paint.get("raster-particle-speed-factor")*.15,Re=function(Ce){return Math.pow(Ce,6)}(.01+1*oe.paint.get("raster-particle-reset-rate-factor")),Ae=oe.particleFramebuffer;ue.viewport.set([0,0,Ae.width,Ae.height]);for(const Ce of _e){const[,Ee,Ye]=Ce;ue.activeTexture.set(he.TEXTURE0+0),Ee.texture.bind(he.LINEAR,he.CLAMP_TO_EDGE),ue.activeTexture.set(he.TEXTURE0+1);const De=Ye.particleTexture0;De.bind(he.NEAREST,he.CLAMP_TO_EDGE);const Ve=yi(1,De.size[0],0,Ee.texture.size,fe,be,Re,Ee.textureOffset,Ee.scale,Ee.offset);Ae.colorAttachment0.set(Ye.particleTexture1.texture),ue.clear({color:d.C.transparent}),ne.getOrCreateProgram("rasterParticleUpdate",{defines:Ee.defines}).draw(ne,he.TRIANGLES,d.Z.disabled,d._.disabled,d.a1.unblended,d.$.disabled,Ve,oe.id,ne.viewportBuffer,ne.quadTriangleIndexBuffer,ne.viewportSegments)}}(g,w,Z,X)}(a,r,o,u),a.renderPass==="translucent"&&(function(g,x,w,E){const I=g.context,P=I.gl,R=x.getSource().tileSize,B=5*(1-d.am(d.b1,d.b1+1,g.transform.zoom))*R+w.paint.get("raster-particle-elevation"),V=!g.options.moving,U=g.transform.projection.name==="globe";if(!E.length)return;const[Z,q]=g.stencilConfigForOverlap(E),X=[];U&&X.push("PROJECTION_GLOBE_VIEW");
vendor: 3,771 bytes, line 3405
3405const ne=g.stencilModeFor3D();for(const oe of q){const _e=oe.toUnwrapped(),ae=x.getTile(oe);if(!ae.rasterParticleState)continue;const ue=ae.rasterParticleState,he=100;ae.registerFadeDuration(he);const fe=x.findLoadedParent(oe,0),be=Or(ae,fe,x,g.transform,he);let Re,Ae;g.terrain&&g.terrain.prepareDrawTile(),I.activeTexture.set(P.TEXTURE0),ue.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),I.activeTexture.set(P.TEXTURE1),fe&&fe.rasterParticleState?(fe.rasterParticleState.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),Re=Math.pow(2,fe.tileID.overscaledZ-ae.tileID.overscaledZ),Ae=[ae.tileID.canonical.x*Re%1,ae.tileID.canonical.y*Re%1]):ue.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE);const Ce=U?g.transform.expandedFarZProjMatrix:g.transform.calculateProjMatrix(_e,V),Ee=g.transform,Ye=tn(Ee),De=d.b2(oe.canonical),Ve=d.b3(De.getCenter().lat);let $e,ot,et,Xe,mt;U?($e=Float32Array.from(d.b4(d.b5(oe.canonical))),ot=Float32Array.from(Ee.globeMatrix),et=Float32Array.from(d.b6(Ee)),Xe=[d.a7(Ee.center.lng),d.a8(Ee.center.lat)],mt=Float32Array.from(d.b7(oe.canonical,De,Ve,Ee.worldSize/Ee._pixelsPerMercatorPixel))):($e=new Float32Array(16),ot=new Float32Array(9),et=new Float32Array(16),Xe=[0,0],mt=new Float32Array(9));const qe=oo(Ce,$e,ot,et,mt,Ae||[0,0],d.S(g.transform.zoom),Xe,Ye,Re||1,be,B),Ge=g.isTileAffectedByFog(oe),Qe=g.getOrCreateProgram("rasterParticle",{defines:X,overrideFog:Ge});if(g.uploadCommonUniforms(I,Qe,_e),U){const dt=new d.Z(P.LEQUAL,d.Z.ReadOnly,g.depthRangeFor3D),rt=0,ct=g.globeSharedBuffers;if(ct){const[_t,Dt,bt]=ct.getGridBuffers(Ve,rt!==0);Qe.draw(g,P.TRIANGLES,dt,ne,d.a1.alphaBlended,g.renderElevatedRasterBackface?d.$.frontCCW:d.$.backCCW,qe,w.id,_t,Dt,bt)}}else{const dt=g.depthModeForSublayer(0,d.Z.ReadOnly),rt=Z[oe.overscaledZ],{tileBoundsBuffer:ct,tileBoundsIndexBuffer:_t,tileBoundsSegments:Dt}=g.getTileBoundsBuffers(ae);Qe.draw(g,P.TRIANGLES,dt,rt,d.a1.alphaBlended,d.$.disabled,qe,w.id,ct,_t,Dt)}}g.resetStencilClippingMasks()}(a,r,o,u),a.style.map.triggerRepaint())},prepareRasterParticle:function(a,r,o){const u=r.getSource();if(u.type!=="raster-array"||!u.loaded())return;const f=a.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!f)return;const m=a.paint.get("raster-particle-array-band")||u.getInitialBand(f);if(m==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(a.id,m)&&u.prepareTile(x,f,a.id,m)},Rain:class extends Hr{constructor(){super(4.25),this._params={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._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(a){const r=a.context;if(!this.particlesVx){const o=bn(this.particlesCount),u=new d.bk,f=new d.ad;let m=0;const g=d.bi(1323123451230);for(let x=0;x<o.length;++x){const w=o[x],E=[2*g()-1,g(),g(),g()];u.emplaceBack(w[0],w[1],w[2],-1,-1,...E),u.emplaceBack(w[0],w[1],w[2],1,-1,...E),u.emplaceBack(w[0],w[1],w[2],1,1,...E),u.emplaceBack(w[0],w[1],w[2],-1,1,...E),f.emplaceBack(m+0,m+1,m+2),f.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=r.createVertexBuffer(u,ao.members),this.particlesIdx=r.createIndexBuffer(f)}}getDrawParams(a){if(!a.style.rain)return null;const r=a.style.rain.state,o=structuredClone(this._params);o.intensity=r.density,o.timeFactor=r.intensity,o.color=structuredClone(r.color),o.screenThinning.intensity=r.centerThinning,o.dropletSizeX=r.dropletSize[0],o.droplet
vendor: 4,152 bytes, line 3405
3405SizeYScale=r.dropletSize[1]/r.dropletSize[0],o.distortionStrength=100*r.distortionStrength;const u=structuredClone(this._vignetteParams);return u.strength=1,u.color=structuredClone(r.vignetteColor),{params:o,vignetteParams:u,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(r.direction)}}draw(a){const r=this.getDrawParams(a);if(!r)return;const{params:o,revealParams:u,direction:f,vignetteParams:m}=r,g=a.transform.zoom;if(u.revealStart>g)return;const x=rn(0,1,u.revealStart,u.revealStart+u.revealRange,g);if(!this.particlesVx||!this.particlesIdx)return;m.strength*=x;const w=this.updateOnRender(a,o.timeFactor),E=a.context,I=E.gl,P=a.transform;this.screenTexture&&this.screenTexture.size[0]===a.width&&this.screenTexture.size[1]===a.height||(this.screenTexture=new d.T(E,{width:a.width,height:a.height,data:null},I.RGBA8)),o.distortionStrength>0&&(E.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.copyTexSubImage2D(I.TEXTURE_2D,0,0,0,0,0,a.width,a.height));const R=a.getOrCreateProgram("rainParticle");a.uploadCommonUniforms(E,R),E.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const B=[o.color.r,o.color.g,o.color.b,o.color.a],V=(U,Z)=>{const q=Rn(this._movement.getPosition(),U),X=o.dropletSizeX,ne=o.dropletSizeX*o.dropletSizeYScale,oe=a.width/2,_e=a.height/2,ae=rn(0,o.screenThinning.start,0,1,o.screenThinning.intensity),ue=rn(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),he=rn(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),fe=(be={modelview:w.modelviewMatrix,projection:w.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:q,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,boxSize:U,rainDropletSize:[X,ne],distortionStrength:o.distortionStrength,rainDirection:f,color:B,screenSize:[P.width,P.height],thinningCenterPos:[oe,_e],thinningShape:[ae,ue,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:he,shapeDirectionalPower:o.shapeDirPower,shapeNormalPower:o.shapeNormalPower,mode:Z?0:1},{u_modelview:Float32Array.from(be.modelview),u_projection:Float32Array.from(be.projection),u_time:be.time,u_cam_pos:be.camPos,u_texScreen:0,u_velocityConeAperture:be.velocityConeAperture,u_velocity:be.velocity,u_boxSize:be.boxSize,u_rainDropletSize:be.rainDropletSize,u_distortionStrength:be.distortionStrength,u_rainDirection:be.rainDirection,u_color:be.color,u_screenSize:be.screenSize,u_thinningCenterPos:be.thinningCenterPos,u_thinningShape:be.thinningShape,u_thinningAffectedRatio:be.thinningAffectedRatio,u_thinningParticleOffset:be.thinningParticleOffset,u_shapeDirectionalPower:be.shapeDirectionalPower,u_shapeNormalPower:be.shapeNormalPower,u_mode:be.mode});var be;const Re=Math.round(o.intensity*this.particlesCount),Ae=d.ac.simpleSegment(0,0,4*Re,2*Re);R.draw(a,I.TRIANGLES,d.Z.disabled,d._.disabled,d.a1.alphaBlended,d.$.disabled,fe,"rain_particles",this.particlesVx,this.particlesIdx,Ae)};o.distortionStrength>0&&V(o.boxSize,!0),V(o.boxSize,!1),this._vignette.draw(a,m)}},Snow:class extends Hr{constructor(){super(2.25),this._params={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._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(a){const r=a.context;if(!this.particlesVx){const o=bn(this.particlesCount),u=new d.bl,f=new d.ad;let m=0;const g=d.bi(1323123451230);for(let x=0;x<o.length;++x){const w=o[x],E=g(),I=g(),P=g(),R=[x/o.length,E,I,P],B=[g(),g()];u.emplaceBack(w[0],w[1],w[2],-1,-1,...R,...B),u.emplaceBack(w[0],w[1],w[2],1,-1,...R,...B),u.emplaceBack(w[0],w[1],w[2],1,1,...R,...B),u.emplaceBack(w[0],w[1],w[2],-1,1,...R,...B),f.emplaceBack(m+0,m+1,m+2),f.emplaceBack(m+0,m+2,m+3),m
vendor: 4,417 bytes, line 3405
3405+=4}this.particlesVx=r.createVertexBuffer(u,lo.members),this.particlesIdx=r.createIndexBuffer(f)}}getDrawParams(a){if(!a.style.snow)return null;const r=a.style.snow.state,o=structuredClone(this._params);o.intensity=r.density,o.timeFactor=r.intensity,o.color=structuredClone(r.color),o.screenThinning.intensity=r.centerThinning,o.billboardSize=2.79*r.flakeSize;const u=structuredClone(this._vignetteParams);return u.strength=1,u.color=structuredClone(r.vignetteColor),{params:o,vignetteParams:u,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(r.direction)}}draw(a){const r=this.getDrawParams(a);if(!r)return;const{params:o,revealParams:u,direction:f,vignetteParams:m}=r,g=a.transform.zoom;if(u.revealStart>g)return;const x=rn(0,1,u.revealStart,u.revealStart+u.revealRange,g);m.strength*=x;const w=this.updateOnRender(a,o.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const E=a.context,I=E.gl,P=a.transform,R=a.getOrCreateProgram("snowParticle");a.uploadCommonUniforms(E,R),((B,V,U)=>{const Z=Rn(this._movement.getPosition(),B),q=P.width/2,X=P.height/2,ne=rn(0,U.screenThinning.start,0,1,U.screenThinning.intensity),oe=rn(.001,U.screenThinning.range,0,1,U.screenThinning.intensity),_e=rn(0,U.screenThinning.particleOffset,0,1,U.screenThinning.intensity),ae=(ue={modelview:w.modelviewMatrix,projection:w.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Z,velocityConeAperture:U.velocityConeAperture,velocity:U.velocity,horizontalOscillationRadius:U.horizontalOscillationRadius,horizontalOscillationRate:U.horizontalOscillationRate,boxSize:B,billboardSize:1*U.billboardSize,simpleShapeParameters:[U.shapeFadeStart,U.shapeFadePower],screenSize:[P.width,P.height],thinningCenterPos:[q,X],thinningShape:[ne,oe,Math.pow(10,U.screenThinning.fadePower)],thinningAffectedRatio:U.screenThinning.affectedRatio,thinningParticleOffset:_e,color:[U.color.r,U.color.g,U.color.b,U.color.a],direction:f},{u_modelview:Float32Array.from(ue.modelview),u_projection:Float32Array.from(ue.projection),u_time:ue.time,u_cam_pos:ue.camPos,u_velocityConeAperture:ue.velocityConeAperture,u_velocity:ue.velocity,u_horizontalOscillationRadius:ue.horizontalOscillationRadius,u_horizontalOscillationRate:ue.horizontalOscillationRate,u_boxSize:ue.boxSize,u_billboardSize:ue.billboardSize,u_simpleShapeParameters:ue.simpleShapeParameters,u_screenSize:ue.screenSize,u_thinningCenterPos:ue.thinningCenterPos,u_thinningShape:ue.thinningShape,u_thinningAffectedRatio:ue.thinningAffectedRatio,u_thinningParticleOffset:ue.thinningParticleOffset,u_particleColor:ue.color,u_direction:ue.direction});var ue;const he=Math.round(U.intensity*this.particlesCount),fe=d.ac.simpleSegment(0,0,4*he,2*he);this.particlesVx&&this.particlesIdx&&R.draw(a,I.TRIANGLES,d.Z.disabled,d._.disabled,d.a1.alphaBlended,d.$.disabled,ae,"snow_particles",this.particlesVx,this.particlesIdx,fe)})(o.boxSize,0,o),this._vignette.draw(a,m)}},shaders:so,programUniforms:wn,drawElevatedStructures:function(a){const{painter:r,sourceCache:o,layer:u,coords:f,colorMode:m}=a,g=r.context.gl,x=a.painter.shadowRenderer,w=!!x&&x.enabled,E=new d.Z(r.context.gl.LEQUAL,d.Z.ReadOnly,r.depthRangeFor3D);let I=[0,0,0];if(w){const R=r.style.directionalLight,B=r.style.ambientLight;R&&B&&(I=d.aF(r.style,R,B))}const P=R=>{for(const B of f){const V=o.getTile(B),U=V.getBucket(u);if(!U)continue;const Z=U.hdExt?U.hdExt.elevatedStructures:void 0;if(!Z)continue;let q,X;if(R?(q=Z.renderableBridgeSegments,X=Z.bridgeProgramConfigurations.get(u.id)):(q=Z.renderableTunnelSegments,X=Z.tunnelProgramConfigurations.get(u.id)),!q||q.segments[0].primitiveLength===0)continue;X.updatePaintBuffers(),r.prepareDrawTile();const ne=r.isTileAffectedByFog(B),oe=[];w&&oe.push("RENDER_SHADOWS","NORMAL_OFFSET");const _e=r.getOrCreateProgram("elevatedStructures",{config:X,overrideFog:ne,defines:oe}),ae=r.translatePosMatrix(B.projMatrix,V,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));w&&x.setupShadows(V.tileID.toUnwrapped(),_e,"vector-tile");const ue=Hn(ae,I);r.uploadCommonUniforms(r.context,_e,B.toUnwrapped()),_e.draw(r,g.TRIANGLES,E,d._.disabled,m,d.$.backCCW,ue,u.id,Z.vertexBuffer,Z.indexBuffer,q,u.paint,r.transform.zoom,X,[Z.vertexBufferNormal])}};P(!0),P(!1)},drawElevatedFillShadows:function(a){const{painter:r,sourceCache:o,layer:u,coords:f}=a,m=r.context.gl,g=a.painter.shadowRenderer;for(const x of f){const w=o.getTile(x),E=w.getBucket(u);
3405if(!E)continue;const I=E.hdExt?E.hdExt.elevatedStructures:void 0;if(!I||!I.shadowCasterSegments||I.shadowCasterSegments.segments[0].primitiveLength===0)continue;r.prepareDrawTile();const P=E.bufferData.programConfigurations.get(u.id),R=r.isTileAffectedByFog(x),B=r.getOrCreateProgram("elevatedStructuresDepth",{config:P,overrideFog:R}),V=g.calculateShadowPassMatrixFromTile(w.tileID.toUnwrapped());r.uploadCommonUniforms(r.context,B,x.toUnwrapped());const U=Go(V,0);B.draw(r,m.TRIANGLES,g.getShadowPassDepthMode(),d._.disabled,d.a1.disabled,d.$.disabled,U,u.id,I.vertexBuffer,I.indexBuffer,I.shadowCasterSegments,u.paint,r.transform.zoom,P)}},drawDepthPrepass:function(a,r,o,u,f){if(!r||!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const m=a.context.gl,g=new d.Z(a.context.gl.LEQUAL,d.Z.ReadWrite,a.depthRangeFor3D),x=new d.Z(a.context.gl.GREATER,d.Z.ReadWrite,a.depthRangeFor3D),w=function(B){let V=.01;return B.isOrthographic&&(V=d.al(1e-4,V,d.bo(B.pitch>=d.bn?1:B.pitch/d.bn))),2*V}(a.transform),E=a.transform.getFreeCameraOptions().position,I="elevatedStructuresDepthReconstruct",P=a.getOrCreateProgram(I,{defines:["DEPTH_RECONSTRUCTION"]}),R=a.getOrCreateProgram(I);for(const B of u){const V=r.getTile(B),U=V.getBucket(o);if(!U||!U.hdExt)continue;const Z=U.hdExt.elevatedStructures,q=U.hdExt.elevationBufferData;if(!Z||!Z.depthSegments||!q)continue;const X=q.heightRange,ne=Bi(B.toUnwrapped(),E),oe=a.translatePosMatrix(B.projMatrix,V,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));let _e,ae,ue,he;if(f==="initialize"){if(!X||X.min>=1||Z.depthSegments.segments[0].primitiveLength===0)continue;_e=ir(oe,ne,w,1,0),ae=g,ue=Z.depthSegments,he=P}else if(f==="reset"){if(!X||X.min>=0||Z.maskSegments.segments[0].primitiveLength===0)continue;_e=ir(oe,ne,0,0,1),ae=x,ue=Z.maskSegments,he=P}else if(f==="geometry"){if(Z.depthSegments.segments[0].primitiveLength===0)continue;_e=ir(oe,ne,w,1,0),ae=g,ue=Z.depthSegments,he=R}he.draw(a,m.TRIANGLES,ae,d._.disabled,d.a1.disabled,d.$.disabled,_e,o.id,Z.vertexBuffer,Z.indexBuffer,ue,o.paint,a.transform.zoom)}},drawGroundShadowMask:function(a,r,o,u){if(!r||!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const f=a.context.gl,m=new d.Z(f.LEQUAL,d.Z.ReadOnly,a.depthRangeFor3D),g=new d._({func:f.ALWAYS,mask:255},255,255,f.KEEP,f.KEEP,f.REPLACE),x=a.transform.getFreeCameraOptions().position,w=a.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const E of u){const I=r.getTile(E),P=I.getBucket(o);if(!P)continue;const R=P.hdExt?P.hdExt.elevatedStructures:void 0;if(!R||!R.depthSegments||R.depthSegments.segments[0].primitiveLength===0)continue;const B=Bi(E.toUnwrapped(),x),V=a.translatePosMatrix(E.projMatrix,I,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor")),U=ir(V,B,0,1,0);w.draw(a,f.TRIANGLES,m,g,d.a1.disabled,d.$.disabled,U,o.id,R.vertexBuffer,R.indexBuffer,R.depthSegments,o.paint,a.transform.zoom)}},IndoorManager:class extends d.E{constructor(a,r=!1){super(),this._style=a,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indoorState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new Gr,this._initialLoadDone=!1,d.aV(["_updateUI"],this);const o=()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>{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))};r?(this._initialLoadDone=!0,o()):this._style.on("style.load",o)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(a){a===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=a,this._recalculateActiveFloors())}setActiveFloorsVisibility(a){this._updateActiveFloors(a),this._updateIndoorSelector()}setIndoorData(a){let r=!1;for(const[o,u]of Object.entries(a.buildings))if(this._buildings[o])for(const f of u.floorIds)this._buildings[o].floorIds.add(f),this._buildings[o].floors[f]?this._mergeFloors(this._buildings[o].floors[f],u.floors[f]):(this._buildings[o].floors[f]=u.floors[f],r=!0);else this._buildings[o]=u,r=!0;r&&this._recalculateActiveFloors()}
3405getIndoorTileOptions(a,r){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(a,r),indoorState:this._indoorState}:null}getControlState(){const a=this._buildings,r=this._closestBuildingId,o=r&&a?a[r]:void 0;if(!o)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let u=null;for(const m of o.floorIds)if(this._activeFloors&&this._activeFloors.has(m)){u=m;break}const f=Array.from(o.floorIds).map(m=>({id:m,name:o.floors[m].name,zIndex:o.floors[m].zIndex})).sort((m,g)=>g.zIndex-m.zIndex).filter((m,g,x)=>g===0||m.zIndex!==x[g-1].zIndex);return{selectedFloorId:u,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:f}}_updateUI(){this._initialLoadDone=!0;const a=this._style.map.transform,r=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,a.center,a.zoom,a.getBounds(),this._makeViewportPolygon());if(r!==this._closestBuildingId){const o=this._closestBuildingId;this._closestBuildingId=r,this._onBuildingTransition(o,r),this._updateIndoorSelector()}}_onBuildingTransition(a,r){if(!this._indoorState)return;!r&&a?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):!!r&&!a&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0))}_updateIndoorSelector(){this.fire(new d.h("selector-update",this.getControlState()))}_updateActiveFloors(a){this._indoorState={selectedFloorId:this._selectedFloorId,activeFloorsVisible:a,activeFloors:this._activeFloors},this._initialLoadDone?this._style.updateIndoorDependentLayers():this._indoorState.needsUpdate=!0}_recalculateActiveFloors(){if(!this._buildings)return;const a=d.aW.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(r,o){if(r===o)return!0;if(!r||!o||r.size!==o.size)return!1;for(const u of r)if(!o.has(u))return!1;return!0})(a,this._activeFloors)||(this._activeFloors=a,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(a,r){r.geometry&&(a.geometry?(a.geometry.type==="Polygon"&&(a.geometry={type:"MultiPolygon",coordinates:[a.geometry.coordinates]}),r.geometry.type==="Polygon"?a.geometry.coordinates.push(r.geometry.coordinates):r.geometry.type==="MultiPolygon"&&a.geometry.coordinates.push(...r.geometry.coordinates)):a.geometry=r.geometry)}_makeViewportPolygon(){const a=this._style.map.transform,r=a.width,o=a.height;return[a.pointLocation(new d.P(0,0)),a.pointLocation(new d.P(r,0)),a.pointLocation(new d.P(r,o)),a.pointLocation(new d.P(0,o))].map(u=>new d.P(u.lng,u.lat))}},HdCoverageState:class{constructor(){this.coverageSourceCaches={},this.manager=new sl}},updateFrcCoverage:function(a,r){r.manager.clear();for(const u in a._mergedHdRoadCoverageSourceCaches){const f=a._mergedHdRoadCoverageSourceCaches[u]._tiles;for(const m in f){const g=f[m];if(!g||!g.loaded())continue;const x=g.frcCoveragePolygons;r.manager.addTileCoverage(g.tileID.canonical,x&&x.length>0?x:[])}}const o=r.manager.updateSnapshotIfNeeded();if(a.map.painter&&(a.map.painter.frcCoverageSnapshot=o.empty()?null:o),!o.empty()){const u=[a._mergedOtherSourceCaches,a._mergedSymbolSourceCaches];for(const f of u)for(const m in f){const g=f[m];for(const x in g._tiles){const w=g._tiles[x];w&&w.hasDeferredRoadStructure&&(w.hasDeferredRoadStructure=!1,g._reloadTile(+x,"reloading"))}}}},updateHdCoverageSourceCache:function(a,r,o){if(o.type!=="fill"||o.sourceLayer!==d.bU||r.coverageSourceCaches[o.source])return;const u=a.getOwnSource(o.source);if(!u||u.type!=="vector")return;const f=`hd-road-coverage:${o.source}`,m=d.m(f,a.scope),g=a._sourceCaches[f]=new En(m,u,d.bR.HdRoadCoverage);r.coverageSourceCaches[o.source]=g,g.setMaxzoomOverride(14),g.onAdd(a.map);const x=a._otherSourceCaches[o.source];x&&x._sourceLoaded&&(g._sourceLoaded=!0)},updateFrcCoverageFadeRange:function(a,r){let o=null,u=null;const f={globals:{zoom:0}};a.forEachFragmentStyle(m=>{if(o)return;const g=m.stylesheet?m.stylesheet.schema:null;if(!g||!g.sdCoverageFadeRange)return;const x=d.m("sdCoverageFadeRange",m.scope),w=m.options?m.options.get(x):void 0,E=w?w.value||w.default:null;if(E){const B=E.evaluate(f);Array.isArray(B)&&B.length===2&&(B[0]>0||B[1]>0)&&(o=[B[0],B[1]])}const I=d.m("sdCoverageSourceLayers",m.scope),P=m.options?m.options.get(I):void 0,R=P?P.value||P.default:null;if(R){const B=R.evaluate(f);Array.isArray(B)&&B.length>0&&(u=B)}else{const B=a.stylesheet&&a.stylesheet.imports||[];for(const V of B)if(V.id===m.scope){const U=V.config?V.config.sdCoverageSourceLayers:void 0;Array.isArray(U)&&U.length>0&&(u=U);break}}}),r.frcCoverageFadeRange=o,r.frcCoverageSourceLayers=o!=null?u||["road","structure"]:[]},HdElevationState:Dn,setupAndUpdateElevationCoverage:function(a){if
3405(!function(m){for(const g in m._mergedLayers)if(uo(m._mergedLayers[g]))return!0;return!1}(a))return void ll(a);const r=ce(a,a.map&&a.map.transform);a._hdElevation||(a._hdElevation=new Dn);const o=a._hdElevation._terrainActiveLast;if(a._hdElevation._terrainActiveLast=r,o!==void 0&&o!==r&&Po(a,void 0,!0),r)return void(a.map.painter&&(a.map.painter.elevationCoverageSnapshot=null));if(!Vi(a))return void ll(a);o===void 0&&Po(a,void 0,!0);const u=a._hdElevation;u._needsCrossSourceElevation=!0,a._crossSourceElevationActive=!0,u._ingestFQIDs=ki(a);const f=ba(a);a.forEachFragmentStyle(m=>{for(const g of f){if(!nn(g,m.scope))continue;const x=d.bV(g);if(m._otherSourceCaches[x]||m._symbolSourceCaches[x])continue;const w=m.getOwnSource(x);w&&w.type==="vector"&&(m._hdElevation||(m._hdElevation=new Dn),ic(m,m._hdElevation,w))}}),a.mergeSources(),wa(a,u)},updateElevationCoverage:wa,updateHdElevationSourceCache:ic,markElevationIngestSourceCachesUsed:function(a){if(!a._hdElevation||!a._hdElevation._needsCrossSourceElevation)return;const r=a._hdElevation._ingestFQIDs;if(r)for(const o of r){const u=Ro(a,o);u&&(u.used=!0)}},updateCrossSourceElevationGate:function(a){a._crossSourceElevationActive=Vi(a);const r=a._mergedHdRoadElevationSourceCaches;r&&Object.keys(r).length!==0&&(a._hdElevation||(a._hdElevation=new Dn),a._hdElevation._needsCrossSourceElevation=a._crossSourceElevationActive)},buildElevationRequestParams:function(a,r,o){if(r.renderSourceType===d.bR.HdRoadElevation||ce(a.style,a.transform)||!o)return null;const u=a.painter?a.painter.elevationCoverageSnapshot:null,f=!(!a.painter||!a.painter.elevationProvidersReady);return u?function(m,g,x){const w=m.getTilesIntersecting(g);if(w.length===0)return{registry:[],hasCoveringTile:!1,allProvidersReady:x};const E=[];for(const I of w)for(const P of I.features)E.push({tileId:I.tileId,feature:P});return E.sort((I,P)=>I.feature.id-P.feature.id),{registry:E,hasCoveringTile:!0,allProvidersReady:x}}(u,r.tileID.canonical,f):{registry:[],hasCoveringTile:!1,allProvidersReady:f}},FrcCoverageRenderer:class{constructor(){this.tileBuffers=new Map,this._context=null}update(a,r){this._context=a;const o=new Set;for(const u of r){if(u.frcMask===0)continue;let f=!1;for(const g of u.polygons)if(g.hasGeometry()){f=!0;break}if(!f)continue;const m=`${u.tileId.z}/${u.tileId.x}/${u.tileId.y}`;if(o.add(m),!this.tileBuffers.has(m)){const g=this._createBuffers(a,u);g&&this.tileBuffers.set(m,g)}}for(const u of this.tileBuffers.keys())if(!o.has(u)){const f=this.tileBuffers.get(u);f.vertexBuffer.destroy(),f.indexBuffer.destroy();for(const m of f.frcLevelSegments)m&&m.destroy();this.tileBuffers.delete(u)}}getBuffers(a){return this.tileBuffers.get(`${a.z}/${a.x}/${a.y}`)||null}destroy(){for(const a of this.tileBuffers.values()){a.vertexBuffer.destroy(),a.indexBuffer.destroy();for(const r of a.frcLevelSegments)r&&r.destroy()}this.tileBuffers.clear()}_createBuffers(a,r){const o=new d.bC,u=new d.ad,f=[];for(const g of r.polygons){if(!g.hasGeometry()||g.rings.length===0)continue;const x=o.length,w=u.length,E=o.length,I=[],P=[];let R=0;for(let V=0;V<g.rings.length;V++){const U=g.rings[V];if(!(U.length<3)){V>0&&P.push(R);for(const Z of U)o.emplaceBack(Z.x,Z.y),I.push(Z.x,Z.y),R++}}const B=d.bF(I,P.length>0?P:void 0);for(let V=0;V<B.length;V+=3)u.emplaceBack(E+B[V],E+B[V+1],E+B[V+2]);f.push({vertexOffset:x,indexOffset:w,vertexCount:o.length-x,indexCount:u.length-w,frcMask:g.frcMask})}if(o.length===0)return null;const m=new Array(9).fill(null);for(let g=0;g<9;++g){const x=1<<g;if(!(r.frcMask&x))continue;let w=1/0,E=0,I=0,P=!1;for(const R of f)R.frcMask&x&&(w=Math.min(w,R.indexOffset),E=Math.max(E,R.indexOffset+R.indexCount),I=Math.max(I,R.vertexOffset+R.vertexCount),P=!0);P&&(m[g]=d.ac.simpleSegment(0,w,I,E-w))}return{vertexBuffer:a.createVertexBuffer(o,d.bE.members),indexBuffer:a.createIndexBuffer(u),frcLevelSegments:m}}},drawFillFrcCoverageFirstPass:function(a){const{painter:r,bucket:o,coord:u,elevatedGeometry:f}=a,m=o.sourceLayerName==="road",g=o.sourceLayerName==="structure";if(!m&&!g||!r.frcCoverageSnapshot||f)return"fallthrough";const x=r.frcCoverageSnapshot.getTileOrParent(u.canonical);if(!x||x.frcMask===0)return"fallthrough";const w=o.hdExt&&o.hdExt.frcData,E=!!w&&!w.empty(),I=fs(x.polygons);if(g&&!I)return"skip";if(g&&I)return a.polygonCoverageTiles.push({coord:a.coord,bufferData:a.bufferData,program:a.program,programConfiguration:a.programConfiguration,uniformValues:a.uniformValues,depthMode:a.depthMode,dynamicBuffers:a.dynamicBuffers,indexBuffer:a.indexBuffer,segments:a.segments,frcMask:x.frcMask}),"deferred";if(m&&E&&w){const P=x.frcMask,R=r.transform.zoom;for(const[B,V]of w.frcPerLevel)P&1<<B||V.segments.length!==0&&a.program.draw(r,a.drawMode,a.depthMode,a.stencilMode,a.colorMode,d.$.disabled,a.uniformValues,a.layer.id,a.bufferData.layoutVertexBuffer,a.indexBuffer,V,a.layer.paint,R,a.programConfiguration,a.dynamicBuffers);return w.frcNonRoadSegments.segments.length>0&&a.program.draw(r,a.drawMode,a.depthMode,a.stencilMode,a.colorMode,d.$.disabled,a.uniformValues,a.layer.id,a.bufferData.layoutVertexBuffer,a.indexBuffer,w.frcNonRoadSegments,a.layer.paint,R,a.programConfiguration,a.dynamicBuffers),"drawn"}return"fallthrough"},drawFillFrcCoverageSecondPass:function(a,r,o,u,f){if(o.length===0)return;const m=br(a),g=a.transform.zoom,x=(w,E,I)=>{I!==1&&(w.uniformValues.u_opacity_multiplier=I),w.program.draw(a,u,w.depthMode,E,f,d.$.disabled,w.uniformValues,r.id,w.bufferData.layoutVertexBuffer,w.indexBuffer,w.segments,r.paint,g,w.programConfiguration,w.dynamicBuffers),I!==1&&(w.uniformValues.u_opacity_multiplier=1)};Do(a,o,m,(w,E,I)=>x(w,I,1),(w,E,I)=>x(w,I,m))},drawLineFrcCoverageDetect:function(a,r,o,u,f,m,g,x,w,E){const I=r.hdExt&&r.hdExt.frcData;if(!I||I.frcPerLevel.size===0||!a.frcCoverageSnapshot||u)return null;
3405const P=a.frcCoverageSnapshot.getTileOrParent(o.canonical);if(!P||P.frcMask===0)return null;const R=fs(P.polygons),B=a.frcCoverageFadeRange,V=B!=null&&a.transform.zoom>=B[0];if(R&&V){let U=!1;for(const Z of I.frcPerLevel.keys())if(P.frcMask&1<<Z){U=!0;break}U&&E.push({coord:o,bucket:r,uniformValues:f,programConfiguration:m,program:g,depthMode:x,colorMode:w,frcMask:P.frcMask})}return{coverageTile:P,frcMask:P.frcMask,active:V,hasPolygonGeometry:R}},drawLineFrcRenderLine:function(a,r,o,u){const f=a.hdExt&&a.hdExt.frcData;if(!f)return;const m=r.frcMask;for(const[x,w]of f.frcPerLevel)m&1<<x||u(o,w);const g=f.frcNonRoadSegments;g.segments.length>0&&u(o,g)},drawLineFrcFadePass:function(a,r,o,u,f,m,g){if(u.hasPolygonGeometry)return;const x=r.hdExt&&r.hdExt.frcData;if(!x||!a.frcCoverageFadeRange)return;const[w,E]=a.frcCoverageFadeRange;if(w>=E)return;const I=1-Math.max(0,Math.min(1,(a.transform.zoom-w)/(E-w)));if(I<=0)return;const P=f?m:a.stencilModeForClipping(o),R=u.frcMask;for(const[B,V]of x.frcPerLevel)R&1<<B&&g(P,V,I)},drawLineFrcCoverageSecondPass:function(a,r,o){if(o.length===0)return;const u=a.context.gl,f=br(a),m=a.transform.zoom,g=(x,w,E,I)=>{const P=x.bucket.hdExt&&x.bucket.hdExt.frcData,R=P&&P.frcPerLevel.get(w);R&&R.segments.length!==0&&(I!==1&&(x.uniformValues.u_opacity_multiplier=I),x.program.draw(a,u.TRIANGLES,x.depthMode,E,x.colorMode,d.$.disabled,x.uniformValues,r.id,x.bucket.layoutVertexBuffer,x.bucket.indexBuffer,R,r.paint,m,x.programConfiguration,[x.bucket.layoutVertexBuffer2,x.bucket.patternVertexBuffer,x.bucket.zOffsetVertexBuffer,x.bucket.elevationIdColVertexBuffer,x.bucket.elevationGroundScaleVertexBuffer]),I!==1&&(x.uniformValues.u_opacity_multiplier=1))};Do(a,o,f,(x,w,E)=>g(x,w,E,1),(x,w,E)=>g(x,w,E,f))}},Et=rc;async function Zn(){return Promise.resolve()}class Ea{constructor(r,o,u){this.screenBounds=r,this.cameraPoint=u.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=o,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,u)}static createFromScreenPoints(r,o){let u,f;if(r instanceof d.P||typeof r[0]=="number"){const m=d.P.convert(r);u=[m],f=o.isPointAboveHorizon(m)}else{const m=d.P.convert(r[0]),g=d.P.convert(r[1]),x=m.add(g)._div(2);u=[m,g],f=d.bZ(m,g).every(w=>o.isPointAboveHorizon(w))&&o.isPointAboveHorizon(x)}return new Ea(u,f,o)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(r){return d.bZ(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new d.P(1,1)):this.screenBounds[1],f=d.bZ(o,u,0,!1);return this.cameraPoint.y>u.y&&(this.cameraPoint.x>o.x&&this.cameraPoint.x<u.x?f.splice(3,0,this.cameraPoint):this.cameraPoint.x>=u.x?f[2]=this.cameraPoint:this.cameraPoint.x<=o.x&&(f[3]=this.cameraPoint)),d.b_(f,r)}bufferedCameraGeometryGlobe(r){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new d.P(1,1)):this.screenBounds[1],f=d.bZ(o,u,r),m=this.cameraPoint.clone(),g=+(m.x>o.x)+ +(m.x>u.x);switch(3*(+(m.y>o.y)+ +(m.y>u.y))+g){case 0:f[0]=m,f[4]=m.clone();break;case 1:f.splice(1,0,m);break;case 2:f[1]=m;break;case 3:f.splice(4,0,m);break;case 5:f.splice(2,0,m);break;case 6:f[3]=m;break;case 7:f.splice(3,0,m);break;case 8:f[2]=m}return f}containsTile(r,o,u,f=0,m){const g=Math.max(r.queryPadding,r.evaluateQueryRenderedFeaturePadding())/o._pixelsPerMercatorPixel+1,x=u?this._bufferedCameraMercator(g,o):this._bufferedScreenMercator(g,o);let w=r.tileID.wrap+(x.unwrapped?f:0);const E=x.polygon.map(Z=>d.b$(r.tileTransform,Z,w));if(!d.c0(E,0,0,d.a2,d.a2))return;w=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?f:0);const I=this.screenGeometryMercator.polygon.map(Z=>d.c1(r.tileTransform,Z,w)),P=I.map(Z=>new d.P(Z[0],Z[1])),R=d.c1(r.tileTransform,m,w),B=I.map(Z=>{const q=d.c2(Z,Z,R);return d.c3(q,q),new d.c4(R,q)}),V=d.c5(r,1,o.zoom)*o._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:P,tilespaceRays:B,bufferedTilespaceGeometry:E,bufferedTilespaceBounds:(U=d.c6(E),U.min.x=d.b0(U.min.x,0,d.a2),U.min.y=d.b0(U.min.y,0,d.a2),U.max.x=d.b0(U.max.x,
vendor: 4,121 bytes, line 3405
34050,d.a2),U.max.y=d.b0(U.max.y,0,d.a2),U),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:V};var U}_bufferedScreenMercator(r,o){const u=nc(r);if(this._screenRaycastCache[u])return this._screenRaycastCache[u];{let f;return f=o.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(r),o):{polygon:this.bufferedScreenGeometry(r).map(m=>o.pointCoordinate3D(m)),unwrapped:!0},this._screenRaycastCache[u]=f,f}}_bufferedCameraMercator(r,o){const u=nc(r);if(this._cameraRaycastCache[u])return this._cameraRaycastCache[u];{let f;return f=o.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(r),o):{polygon:this.bufferedCameraGeometry(r).map(m=>o.pointCoordinate3D(m)),unwrapped:!0},this._cameraRaycastCache[u]=f,f}}_projectAndResample(r,o){const u=function(m,g){const x=d.X([],g.pixelMatrix,g.globeMatrix),w=[0,-d.c8,0,1],E=[0,d.c8,0,1],I=[0,0,0,1];d.c7(w,w,x),d.c7(E,E,x),d.c7(I,I,x);const P=new d.P(w[0]/w[3],w[1]/w[3]),R=new d.P(E[0]/E[3],E[1]/E[3]),B=d.c9(m,P)&&w[3]<I[3],V=d.c9(m,R)&&E[3]<I[3];if(!B&&!V)return null;const U=function(he,fe,be){for(let Re=1;Re<he.length;Re++){const Ae=Sa(fe.pointCoordinate3D(he[Re-1]).x),Ce=Sa(fe.pointCoordinate3D(he[Re]).x);if(be<0){if(Ae<Ce)return{idx:Re,t:-Ae/(Ce-1-Ae)}}else if(Ce<Ae)return{idx:Re,t:(1-Ae)/(Ce+1-Ae)}}return null}(m,g,B?-1:1);if(!U)return null;const{idx:Z,t:q}=U;let X=Z>1?cl(m.slice(0,Z),g):[],ne=Z<m.length?cl(m.slice(Z),g):[];X=X.map(he=>new d.P(Sa(he.x),he.y)),ne=ne.map(he=>new d.P(Sa(he.x),he.y));const oe=[...X];oe.length===0&&oe.push(ne.at(-1));const _e=oe.at(-1),ae=d.al(_e.y,(ne.length===0?X[0]:ne[0]).y,q);let ue;return ue=B?[new d.P(0,ae),new d.P(0,0),new d.P(1,0),new d.P(1,ae)]:[new d.P(1,ae),new d.P(1,1),new d.P(0,1),new d.P(0,ae)],oe.push(...ue),ne.length===0?oe.push(X[0]):oe.push(...ne),{polygon:oe.map(he=>new d.bS(he.x,he.y)),unwrapped:!1}}(r,o);if(u)return u;const f=function(m,g){let x=!1,w=-1/0,E=0;for(let P=0;P<m.length-1;P++)m[P].x>w&&(w=m[P].x,E=P);for(let P=0;P<m.length-1;P++){const R=(E+P)%(m.length-1),B=m[R],V=m[R+1];Math.abs(B.x-V.x)>.5&&(B.x<V.x?(B.x+=1,R===0&&(m.at(-1).x+=1)):(V.x+=1,R+1===m.length-1&&(m[0].x+=1)),x=!0)}const I=d.a7(g.center.lng);return x&&I<Math.abs(I-1)&&m.forEach(P=>{P.x-=1}),{polygon:m,unwrapped:x}}(cl(r,o).map(m=>new d.P(Sa(m.x),m.y)),o);return{polygon:f.polygon.map(m=>new d.bS(m.x,m.y)),unwrapped:f.unwrapped}}}function cl(a,r){return d.ca(a,o=>{const u=r.pointCoordinate3D(o);o.x=u.x,o.y=u.y},1/256)}function Sa(a){return a<0?1+a%1:a%1}function nc(a){return 100*a|0}class Ia extends d.E{constructor(r,o,u,f){if(super(),this.id=r,this.dispatcher=u,this.type="vector",this.provider=o.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,d.cb(o,["url","scheme","tileSize","promoteId"])),this._options={type:"vector",...o},this._collectResourceTiming=!!o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(f),this._tileWorkers={},this._deduped=new d.cc}load(r){this._loaded=!1,this.fire(new d.h("dataloading",{dataType:"source"}));const o=Array.isArray(this.map._language)?this.map._language.join():this.map._language,u=this.map.getWorldview(),f=(g,x)=>{this._tileJSONRequest=null,this._loaded=!0,g?(o&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${o}`),u&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${u}`),this.fire(new d.f(g))):x&&(this._setTileJSON(x),Et.updateCrossSourceElevationGate&&this.map.style&&Et.updateCrossSourceElevationGate(this.map.style),d.ck(x.tiles,this.map._requestManager._customAccessToken),this.fire(new d.h("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new d.h("data",{dataType:"source",sourceDataType:"content"}))),r&&r(g)};this.provider=this._options.provider;const m=d.cd(this._options);return m instanceof Error?(this._loaded=!0,this.fire(new d.f(m)),void(r&&r())):this.provider&&!m?(this._loaded=!0,this.fire(new d.f(ne
vendor: 2,585 bytes, line 3405
3405w Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=m?this.loadTileJSONWithProvider(m,f):d.ce(this._options,this.map._requestManager,o,u,f))}loadTileJSONWithProvider(r,o){this.provider=r.name;const u=new AbortController;return(async()=>{const{request:f,options:m}=await d.cl(this._options,this.map._requestManager,u.signal);if(u.signal.aborted)return;const g=await this.dispatcher.send("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.type,options:m,request:f},{signal:u.signal});if(u.signal.aborted)return;const x=g?g.find(E=>E!=null):null,w=d.cm(this._options,x,this.map._requestManager);w instanceof Error?o(w):o(null,w)})().catch(f=>{u.signal.aborted||o(f)}),{cancel:()=>u.abort()}}_setTileJSON(r){if(Object.assign(this,r),this.hasWorldviews=!!r.worldview_options,r.worldview_default&&(this.worldviewDefault=r.worldview_default),r.vector_layers){this.vectorLayers=r.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const o of r.vector_layers)this.vectorLayerIds.push(o.id),r.worldview&&r.worldview[o.source]&&this.localizableLayerIds.add(o.id)}this.tileBounds=d.cf.fromTileJSON(r)}loaded(){return this._loaded}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=d.m(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return{...this._options}}async loadTile(r,o){const u=r.tileID.canonical.url(this.tiles,this.scheme),f=this.map._requestManager.normalizeTileURL(u),m=!r.actor||r.state==="expired";if(!m&&r.state==="loading")return void(r.reloadCallback=o);m&&(r.actor=this._tileWorkers[f]=this._tileWorkers[f]||this.dispatcher.getActor());const g=new AbortController;r.request=g;try{const x=await this.map._requestManager.transformRequest(f,d.R.Tile,g.signal);if(g.signal.aborted)return o(null);this.dispatchTile(r,f,u,x,g,m,o)}catch(x){if(g.signal.aborted)return o(null);o(x)}}dispatchTile(r,o,u,f,m,g,x){const w=this.map.style?this.map.style.getLut(this.scope):null,E=w?{image:w.image.clone()}:null,I=!(!this.map.style||!this.map.style._crossSourceElevationActive),P=!(!this.map.style||!I),R={request:f,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,lut:E,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
vendor: 16,376 bytes, line 3405
3405ype,source:this.id,scope:this.scope,pixelRatio:d.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,renderSourceType:r.renderSourceType,frcCoverage:(()=>{const V=this.map.painter,U=V?V.frcCoverageFadeRange:null;if(U==null)return null;const Z=V?V.frcCoverageSnapshot:null,q=this.map.transform.zoom<U[0],X=Z?Z.getTileOrParent(r.tileID.canonical):null,ne=r.tileID.overscaledZ>=Math.ceil(U[1]),oe=Z&&ne?Z.getFullCoverageMask(r.tileID.canonical):null;return{frcMask:ne?oe??null:null,resolved:q||Z!=null,polygons:X&&X.frcMask!==0?X.polygons:null,tileZoom:X&&X.frcMask!==0?X.tileId.z:null,sourceLayers:V?V.frcCoverageSourceLayers:["road","structure"]}})(),terrainEnabled:ce(this.map.style,this.map.transform),crossSourceElevationEnabled:P,elevation:Et.buildElevationRequestParams?Et.buildElevationRequestParams(this.map,r,I):null,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&&d.cg(u)&&(R.localizableLayerIds=this.localizableLayerIds),R.request.collectResourceTiming=this._collectResourceTiming,g)if(this.dispatcher.ready||this.provider)r.request=r.actor.sendCancelable("loadTile",R,{},B.bind(this));else{const V=d.ch.call({deduped:this._deduped},R,(U,Z)=>{r.aborted||(U||!Z?B.call(this,U):(R.data={rawData:Z.rawData.slice(0),headers:Z.headers},r.actor&&(r.request=r.actor.sendCancelable("loadTile",R,{},B.bind(this)))))},!0);m.signal.addEventListener("abort",V,{once:!0})}else r.request=r.actor.sendCancelable("reloadTile",R,{},B.bind(this));function B(V,U){return delete r.request,r.aborted?x(null):V?x(V):(U&&U.resourceTiming&&(r.resourceTiming=U.resourceTiming),this.map._refreshExpiredTiles&&U&&r.setExpiryData(d.ci(U.headers)),void(function(){if(r.aborted)return x(null);r.loadVectorData(U,this.map.painter),d.cj(this.dispatcher),x(null,U),r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)}).call(this))}}abortTile(r){r.request&&(r.request.abort(),delete r.request),r.actor&&r.actor.notify("abortTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(r,o){r.actor&&r.actor.notify("removeTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope}),r.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class tu extends d.E{constructor(r,o,u,f){super(),this.id=r,this.dispatcher=u,this.setEventedParent(f),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options={type:"raster",...o},Object.assign(this,d.cb(o,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new d.h("dataloading",{dataType:"source"}));const o=this.map.getWorldview(),u=(m,g)=>{this._tileJSONRequest=null,this._loaded=!0,m?this.fire(new d.f(m)):g&&(Object.assign(this,g),g.raster_layers&&(this.rasterLayers=g.raster_layers,this.rasterLayerIds=this.rasterLayers.map(x=>x.id)),this.tileBounds=d.cf.fromTileJSON(g),d.ck(g.tiles),this.fire(new d.h("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new d.h("data",{dataType:"source",sourceDataType:"content"}))),r&&r(m)};this.provider=typeof this._options.provider=="string"?this._options.provider:void 0,this._tileProvider=void 0;const f=d.cd(this._options);return f instanceof Error?(this._loaded=!0,this.fire(new d.f(f)),void(r&&r())):this.provider&&!f?(this._loaded=!0,this.fire(new d.f(new Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=f?this.loadTileJSONWithProvider(f,u):d.ce(this._options,this.map._requestManager,null,o,u))}loadTileJSONWithProvider(r,o){this.provider=r.name;const u=new AbortController;return(async()=>{const{request:f,options:m}=await d.cl(this._options,this.map._requestManager,u.signal);if(u.signal.aborted)return;const g=await d.cn(r.name,r.url);if(u.signal.aborted)return;const x=new g(m);let w=null;if(x.load&&f&&(w=await x.load({request:f}),u.signal.aborted))return;this._tileProvider=x;const E=d.cm(this._options,w,this.map._requestManager);E instanceof Error?o(E):o(null,E)})().catch(f=>{u.signal.aborted||o(new Error(`Could not load tile provider ${r.name}`,{cause:f}))}),{cancel:()=>u.abort()}}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=d.m(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return{...this._options}}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}async loadTile(r,o){const u=d.e.devicePixelRatio>=2,f=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),u,this.tileSize),m=new AbortController;if(r.request=m,this._tileProvider)this.loadTileWithProvider(r,this._tileProvider,f,m,o);else try{const g=await this.map._requestManager.transformRequest(f,d.R.Tile,m.signal);if(m.signal.aborted)return delete r.request,o(null);const{data:x,headers:w}=await d.a(g,m.signal);if(delete r.request,r.aborted)return o(null);const E=d.ci(w);this.map._refreshExpiredTiles&&r.setExpiryData(E),r.setTexture(x,this.map.painter),r.state="loaded",d.cj(this.dispatcher),o(null)}catch(g){if(delete r.request,m.signal.aborted)return o(null);r.state="errored",o(g)}}async loadTileWithProvider(r,o,u,f,m){const{z:g,x,y:w}=r.tileID.canonical;try{const E=await this.map._requestManager.transformRequest(u,d.R.Tile,f.signal);if(f.signal.aborted)return m(null);const I=await o.loadTile({z:g,x,y:w},{request:E,signal:f.signal});if(f.signal.aborted)return m(null);if(I==null){const R=new Error("Tile not found");return R.status=404,r.state="errored",m(R)}if(I.data==null)return r.state="loaded",m(null);const P=I.data instanceof ImageBitmap?I.data:await createImageBitmap(new Blob([I.data]));if(f.signal.aborted)return m(null);r.setTexture(P,this.map.painter),r.state="loaded",this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:I.cacheControl,expires:I.expires}),m(null)}catch(E){if(f.signal.aborted)return m(null);r.state="errored",m(new Error(`Could not load tile from ${u}`,{cause:E}))}finally{delete r.request}}abortTile(r,o){r.request&&(r.request.abort(),delete r.request),o&&o()}unloadTile(r,o){r.texture&&r.texture instanceof d.T?(r.destroy(!1),r.texture&&r.texture instanceof d.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),o&&o()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function eh(a,r,o,u,f,m,g,x){const w=[a,r,1,o,u,1,f,m,1],E=[g,x,1],I=d.cu([],w),[P,R,B]=d.ct(E,E,I);return d.cv(w,w,[P,0,0,0,R,0,0,0,B])}function Ds(a,r,o,u,f,m,g,x){const w=function(E,I,P,R,B,V,U,Z){const q=eh(0,0,1,0,1,1,0,1),X=eh(E,I,P,R,B,V,U,Z),ne=d.cu([],q);return d.cv(X,X,ne)}(a,r,o,u,f,m,g,x);return[w[2]/w[8]/d.a2,w[5]/w[8]/d.a2]}function th(a){return[a[0],Math.min(Math.max(a[1],-d.cp),d.cp)]}class fo extends d.E{constructor(r,o,u,f){super(),this.id=r,this.dispatcher=u,this.coordinates=o.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(f),this.options=o,this._dirty=!1}async load(r,o){if(this._loaded=o||!1,this.fire(new d.h("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return r&&(this.coordinates=r),this._loaded=!0,void this._finishLoading();const u=new AbortController;this._imageRequest=u;try{const f=await this.map._requestManager.transformRequest(this.url,d.R.Image,u.signal),{data:m}=await d.a(f,u.signal);this._imageRequest=null,this._loaded=!0,this.image=m,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),this._finishLoading()}catch(f){if(u.signal.aborted)return;this._imageRequest=null,this._loaded=!0,this.fire(new d.f(f))}}loaded(){return this._loaded}updateImage(r){return r.url?(this._imageRequest&&r.url!==this.options.url&&(this._imageRequest.abort(),this._imageRequest=null),this.options.url=r.url,this.load(r.coordinates,this._loaded),this):this}setTexture(r){if(!(r.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new d.co(this.map.painter.context,r.handle),this.width=r.dimensions[0],this.height=r.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new d.h("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(r){this._imageRequest&&(this._imageRequest.abort(),this._imageRequest=null),!this.texture||this.texture instanceof d.co||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(r){if(this.coordinates=r,this._boundsArray=void 0,this._unsupportedCoords=!1,!r.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let o=r[0][1],u=r[0][1];for(const m of r)m[1]>u&&(u=m[1]),m[1]<o&&(o=m[1]);const f=(u+o)/2;if(f>d.cp?this.onNorthPole=!0:f<-d.cp&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const m=r.map(d.bS.fromLngLat);this.tileID=function(g){let x=1/0,w=1/0,E=-1/0,I=-1/0;for(const U of g)x=Math.min(x,U.x),w=Math.min(w,U.y),E=Math.max(E,U.x),I=Math.max(I,U.y);const P=Math.max(E-x,I-w),R=Math.max(0,Math.floor(-Math.log2(P))),B=Math.pow(2,R);let V=Math.floor((x+E)/2*B);return V>1&&(V-=1),new d.bX(R,V,Math.floor((w+I)/2*B))}(m),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new d.h("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof d.co||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(r){for(const _e in this.tiles){const ae=this.tiles[_e];ae.state!=="loaded"&&(ae.state="loaded",ae.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const o=d.bp(new d.bX(0,0,0),this.map.transform.projection),u=[o.projection.project(this.coordinates[0][0],this.coordinates[0][1]),o.projection.project(this.coordinates[1][0],this.coordinates[1][1]),o.projection.project(this.coordinates[2][0],this.coordinates[2][1]),o.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(_e){const ae=_e[1].x-_e[0].x,ue=_e[1].y-_e[0].y,he=_e[2].x-_e[1].x,fe=_e[2].y-_e[1].y,be=_e[3].x-_e[2].x,Re=_e[3].y-_e[2].y,Ae=_e[0].x-_e[3].x,Ce=_e[0].y-_e[3].y,Ee=ae*fe-he*ue,Ye=he*Re-be*fe,De=be*Ce-Ae*Re,Ve=Ae*ue-ae*Ce;return Ee>0&&Ye>0&&De>0&&Ve>0||Ee<0&&Ye<0&&De<0&&Ve<0}(u))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const f=d.bp(this.tileID,this.map.transform.projection),[m,g,x,w]=this.coordinates.map(_e=>{const ae=f.projection.project(_e[0],_e[1]);return d.b$(f,ae)._round()});this.perspectiveTransform=Ds(m.x,m.y,g.x,g.y,x.x,x.y,w.x,w.y);const E=this._boundsArray=new d.bs;E.emplaceBack(m.x,m.y,0,0),E.emplaceBack(g.x,g.y,d.a2,0),E.emplaceBack(w.x,w.y,0,d.a2),E.emplaceBack(x.x,x.y,d.a2,d.a2),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=r.createVertexBuffer(E,Rs.members),this.boundsSegments=d.ac.simpleSegment(0,0,4,2);const I=d.cs,P=I+1,R=I+1,B=P*R,V=I*I*2,U=[],Z=function(_e){return[th(_e[0]),th(_e[1]),th(_e[2]),th(_e[3])]}(this.coordinates),[q,X,ne,oe]=function(_e){let ae=_e[0][0],ue=ae,he=_e[0][1],fe=he;for(let be=1;be<_e.length;be++)_e[be][0]<ae?ae=_e[be][0]:_e[be][0]>ue&&(ue=_e[be][0]),_e[be][1]<he?he=_e[be][1]:_e[be][1]>fe&&(fe=_e[be][1]);return[ae,he,ue-ae,fe-he]}(Z);{const _e=new d.bs,[ae,ue,he,fe]=function(Xe){let mt=Xe[0].x,qe=mt,Ge=Xe[0].y,Qe=Ge;for(let dt=1;dt<Xe.length;dt++)Xe[dt].x<mt?mt=Xe[dt].x:Xe[dt].x>qe&&(qe=Xe[dt].x),Xe[dt].y<Ge?Ge=Xe[dt].y:Xe[dt].y>Qe&&(Qe=Xe[dt].y);return[mt,Ge,qe-mt,Qe-Ge]}(u),be=Xe=>[(Xe.x-ae)/he,(Xe.y-ue)/fe],[Re,Ae,Ce,Ee]=u.map(be),Ye=function(Xe,mt,qe,Ge,Qe,dt,rt,ct){const _t=eh(0,0,1,0,1,1,0,1),Dt=eh(Xe,mt,qe,Ge,Qe,dt,rt,ct),bt=d.cu([],Dt);return d.cv(_t,_t,bt)}(Re[0],Re[1],Ae[0],Ae[1],Ce[0],Ce[1],Ee[0],Ee[1]);this.elevatedGlobePerspectiveTransform=Ds(Re[0],Re[1],Ae[0],Ae[1],Ce[0],Ce[1],Ee[0],Ee[1]);const De=(Xe,mt)=>{U.push(Xe.lng);const qe=Math.round((Xe.lng-q)/ne*d.a2),Ge=Math.round((Xe.lat-X)/oe*d.a2),Qe=be(mt),dt=d.ct([],[Qe[0],Qe[1],1],Ye),rt=Math.round(dt[0]/dt[2]*d.a2),ct=Math.round(dt[1]/dt[2]*d.a2);_e.emplaceBack(qe,Ge,rt,ct)},Ve=u[3].x-u[0].x,$e=u[3].y-u[0].y,ot=u[2].x-u[1].x,et=u[2].y-u[1].y;for(let Xe=0;Xe<R;Xe++){const mt=Xe/I,qe=[u[0].x+mt*Ve,u[0].y+mt*$e],Ge=[u[1].x+mt*ot,u[1].y+mt*et],Qe=Ge[0]-qe[0],dt=Ge[1]-qe[1];for(let rt=0;rt<P;rt++){const ct=rt/I,_t={x:qe[0]+Qe*ct,y:qe[1]+dt*ct};De(o.projection.unproject(_t.x,_t.y),_t)}}this.elevatedGlobeVertexBuffer=r.createVertexBuffer(_e,Rs.members)}{this.maxLongitudeTriangleSize=0;let _e=[],ae=new d.ad;const ue=(he,fe,be)=>{ae.emplaceBack(he,fe,be);const Re=U[he],Ae=U[fe],Ce=U[be],Ee=Math.min(Math.min(Re,Ae),Ce),Ye=Math.max(Math.max(Re,Ae),Ce)-Ee;Ye>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Ye),_e.push(Ee+Ye/2)};for(let he=0;he<I;he++)for(let fe=0;fe<I;fe++){const be=he*P+fe,Re=be+1,Ae=be+P,Ce=Ae+1;ue(be,Ae,Re),ue(Re,Ae,Ce)}[_e,ae]=function(he,fe){const be=Array.from({length:he.length},(Ce,Ee)=>Ee);be.sort((Ce,Ee)=>he[Ce]-he[Ee]);const Re=[],Ae=new d.ad;for(let Ce=0;Ce<be.length;Ce++){const Ee=be[Ce];Re.push(he[Ee]);const Ye=3*Ee,De=Ye+1;Ae.emplaceBack(fe.uint16[Ye],fe.uint16[De],fe.uint16[De+1])}return[Re,Ae]}(_e,ae),this.elevatedGlobeTrianglesCenterLongitudes=_e,this.elevatedGlobeIndexBuffer=r.createIndexBuffer(ae)}this.elevatedGlobeSegments=d.ac.simpleSegment(0,0,B,V),this.elevatedGlobeGridMatrix=new Float32Array([0,ne/d.a2,0,oe/d.a2,0,0,X,q,0])}prepare(){const r=Object.keys(this.tiles).length!==0;if(this.tileID&&!r)return;const o=this.map.painter.context,u=o.gl;!this._dirty||this.texture instanceof d.co||(this.texture?this.texture.update(this.image):(this.texture=new d.T(o,this.image,u.RGBA8),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE)),this._dirty=!1),r&&this._prepareData(o)}loadTile(r,o){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={},o(null)):(r.state="errored",o(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(r){const o=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!o)return null;const u=this.elevatedGlobeTrianglesCenterLongitudes;let f=(m=r+180)+360*Math.round((u[0]-m)/360);var m;const g=new d.ac,x=(P,R)=>{g.segments.push({vertexOffset:0,primitiveOffset:P,vertexLength:o.segments[0].vertexLength,primitiveLength:R,sortKey:void 0,vaos:{}})},w=.51*this.maxLongitudeTriangleSize;if(Math.abs(u[0]-f)<=w){const P=d.cq(u,0,u.length,f+w);return P===u.length||x(P,d.cr(u,P+1,u.length,f+360-w)-P),g}f<u[0]&&(f+=360);const E=d.cr(u,0,u.length,f-w);if(E===u.length)return x(0,u.length),g;x(0,E-0);const I=d.cq(u,E+1,u.length,f+w);return I!==u.length&&x(I,u.length-I),g}}const Sn={vector:Ia,raster:tu,"raster-dem":class extends tu{constructor(a,r,o,u){super(a,r,o,u),this.type="raster-dem",this.maxzoom=22,this._options={type:"raster-dem",...r},this.encoding=r.encoding||"mapbox"}loadTileJSONWithProvider(a,r){this.provider=a.name;const o=new AbortController;return(async()=>{const{request:u,options:f}=await d.cl(this._options,this.map._requestManager,o.signal);if(o.signal.aborted)return;const m=await this.dispatcher.send("loadTileProvider",{name:a.name,url:a.url,source:this.id,scope:this.scope,type:this.t
3405ype,options:f,request:u},{signal:o.signal});if(o.signal.aborted)return;const g=m?m.find(w=>w!=null):null,x=d.cm(this._options,g,this.map._requestManager);x instanceof Error?r(x):r(null,x)})().catch(u=>{o.signal.aborted||r(u)}),{cancel:()=>o.abort()}}async loadTile(a,r){if(a.actor&&a.state!=="expired")return;const o=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);a.actor=this.dispatcher.getActor();const u=new AbortController;a.request=u;try{const f=await this.map._requestManager.transformRequest(o,d.R.Tile,u.signal);if(u.signal.aborted)return r(null);a.request=a.actor.sendCancelable("loadTile",{uid:a.uid,tileID:a.tileID,source:this.id,type:this.type,scope:this.scope,request:f,encoding:this.encoding},{},(function(m,g){return delete a.request,a.aborted?r(null):m?(a.state="errored",r(m)):(g&&(this.map._refreshExpiredTiles&&a.setExpiryData(d.ci(g.headers)),g.borderReady||a.neighboringTiles||(a.neighboringTiles=this._getNeighboringTiles(a.tileID)),a.dem=g.dem,a.dem.onDeserialize(),a.needsHillshadePrepare=!0,a.needsDEMTextureUpload=!0),a.state="loaded",void r(null))}).bind(this))}catch(f){if(u.signal.aborted)return r(null);a.state="errored",r(f)}}abortTile(a,r){a.request&&(a.request.abort(),delete a.request),a.actor&&a.actor.notify("abortTile",{uid:a.uid,type:this.t
3405ype,source:this.id,scope:this.scope}),r&&r()}_getNeighboringTiles(a){const r=a.canonical,o=Math.pow(2,r.z),u=(r.x-1+o)%o,f=r.x===0?a.wrap-1:a.wrap,m=(r.x+1+o)%o,g=r.x+1===o?a.wrap+1:a.wrap,x={};return x[new d.bP(a.overscaledZ,f,r.z,u,r.y).key]={backfilled:!1},x[new d.bP(a.overscaledZ,g,r.z,m,r.y).key]={backfilled:!1},r.y>0&&(x[new d.bP(a.overscaledZ,f,r.z,u,r.y-1).key]={backfilled:!1},x[new d.bP(a.overscaledZ,a.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},x[new d.bP(a.overscaledZ,g,r.z,m,r.y-1).key]={backfilled:!1}),r.y+1<o&&(x[new d.bP(a.overscaledZ,f,r.z,u,r.y+1).key]={backfilled:!1},x[new d.bP(a.overscaledZ,a.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},x[new d.bP(a.overscaledZ,g,r.z,m,r.y+1).key]={backfilled:!1}),x}},geojson:class extends d.E{constructor(a,r,o,u){super(),this.id=a,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(u),this._data=r.data,this._options={...r},this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.minzoom!==void 0&&(this.minzoom=r.minzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;const f=d.a2/this.tileSize;this.workerOptions={source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(r.buffer!==void 0?r.buffer:128)*f,tolerance:(r.tolerance!==void 0?r.tolerance:.375)*f,extent:d.a2,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:r.clusterMaxZoom!==void 0?r.clusterMa
3405xZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:d.a2,radius:(r.clusterRadius!==void 0?r.clusterRadius:50)*f,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter,dynamic:r.dynamic,...r.workerOptions}}onAdd(a){this.map=a,this.setData(this._data)}setData(a){return this._data=a,this._updateWorkerData(),this}updateData(a){if(!this._options.dynamic)return this.fire(new d.f(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof a!="string"&&(a.type==="Feature"&&(a={type:"FeatureCollection",features:[a]}),a.type!=="FeatureCollection"))return this.fire(new d.f(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof a!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const r=new Map;for(const o of this._data.features)r.set(o.id,o);for(const o of a.features)r.set(o.id,o);this._data.features=[...r.values()]}else this._data=a;return this._updateWorkerData(!0),this}getClusterExpansionZoom(a,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:a,source:this.id,scope:this.scope}).then(o=>r(null,o)).catch(o=>r(o)),this}getClusterChildren(a,r){return this.actor.send("geojson.getClusterChildren",{clusterId:a,source:this.id,scope:this.scope}).then(o=>r(null,o)).catch(o=>r(o)),this}getClusterLeaves(a,r,o,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:a,limit:r,offset:o}).then(f=>u(null,f)).catch(f=>u(f)),this}async _updateWorkerData(a=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new d.h("dataloading",{dataType:"source"})),this._loaded=!1;const r={append:a,...this.workerOptions};r.scope=this.scope;const o=this._data,u=new AbortController;this._pendingLoad=u;try{if(typeof o=="string"){if(r.request=await this.map._requestManager.transformRequest(d.e.resolveURL(o),d.R.Source,u.signal),u.signal.aborted)return this._pendingLoad=null,void(this._coalesce=!1);r.request.collectResourceTiming=this._collectResourceTiming}else r.data=JSON.stringify(o);const f=await this.actor.send(`${this.type}.loadData`,r,{signal:u.signal});this._loaded=!0,this._pendingLoad=null;const m={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&f&&f.resourceTiming&&f.resourceTiming[this.id]&&(m.resourceTiming=f.resourceTiming[this.id]),a&&(this._partialReload=!0),this.fire(new d.h("data",m)),this._partialReload=!1,this._metadataFired=!0}catch(f){if(u.signal.aborted)return this._pendingLoad=null,void(this._coalesce=!1);this._loaded=!0,this._pendingLoad=null,this.fire(new d.f(f))}this._coalesce&&(this._updateWorkerData(a),this._coalesce=!1)}loaded(){return this._loaded}reload(){const a=d.m(this.id,this.scope);this.map.style.clearSource(a),this._updateWorkerData()}loadTile(a,r){const o=a.actor?"reloadTile":"loadTile";a.actor=this.actor;const u=this.map.style?this.map.style.getLut(this.scope):null,f=u?{image:u.image.clone()}:null,m=this._partialReload,g={type:this.type,uid:a.uid,tileID:a.tileID,tileZoom:a.tileZoom,zoom:a.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:f,scope:this.scope,pixelRatio:d.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:a.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:m,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};a.request=this.actor.sendCancelable(o,g,{},(x,w)=>m&&!w?(a.state="loaded",r(null)):(delete a.request,a.destroy(!1),a.aborted?r(null):x?r(x):(a.loadVectorData(w,this.map.painter,o==="reloadTile"),void r(null))))}abortTile(a){a.request&&(a.request.abort(),delete a.request),a.aborted=!0}unloadTile(a,r){this.actor.notify("removeTile",{uid:a.uid,type:this.t
3405ype,source:this.id,scope:this.scope}),a.destroy()}onRemove(a){this._pendingLoad&&this._pendingLoad.abort()}serialize(){return{...this._options,type:this.type,data:this._data}}hasTransition(){return!1}},video:class extends fo{constructor(a,r,o,u){super(a,r,o,u),this.roundZoom=!0,this.type="video",this.options=r}async load(){this._loaded=!1;const a=this.options,r=new AbortController;this._imageRequest=r;try{const o=await Promise.all(a.urls.map(async f=>(await this.map._requestManager.transformRequest(f,d.R.Source,r.signal)).url));if(r.signal.aborted)return;this.urls=o;const u=await d.cw(o);if(r.signal.aborted)return;this._imageRequest=null,this.video=u,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(o){if(r.signal.aborted)return;this.fire(new d.f(o))}finally{this._loaded=!0}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(a){if(this.video){const r=this.video.seekable;a<r.start(0)||a>r.end(0)?this.fire(new d.f(new it(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=a}}getVideo(){return this.video}
3405onAdd(a){this.map||(this.map=a,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const a=this.map.painter.context,r=a.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new d.T(a,this.video,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(a)}serialize(){return{type:"video",urls:this.options.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:fo,canvas:class extends fo{constructor(a,r,o,u){super(a,r,o,u),r.coordinates?Array.isArray(r.coordinates)&&r.coordinates.length===4&&!r.coordinates.some(f=>!Array.isArray(f)||f.length!==2||f.some(m=>typeof m!="number"))||this.fire(new d.f(new it(`sources.${a}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new d.f(new it(`sources.${a}`,null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new d.f(new it(`sources.${a}`,null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas=="string"||r.canvas instanceof HTMLCanvasElement||this.fire(new d.f(new it(`sources.${a}`,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 d.f(new it(`sources.${a}`,null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate===void 0||r.animate}async 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 d.f(new 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(a){this.map=a,this.load(),this.canvas&&this.animate&&this.play()}onRemove(a){this.pause()}prepare(){let a=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,a=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,a=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const r=this.map.painter.context;this.texture?!a&&!this._playing||this.texture instanceof d.co||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new d.T(r,this.canvas,r.gl.RGBA8,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const a of[this.canvas.width,this.canvas.height])if(isNaN(a)||a<=0)return!0;return!1}},custom:class extends d.E{constructor(a,r,o,u){super(),this.id=a,this.type="custom",this._dataType="raster",this._dispatcher=o,this._implementation=r,this.setEventedParent(u),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new d.f(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new d.f(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new d.cf(this._implementation.bounds,this.minzoom,this.maxzoom));const f=r;f.update=this._update.bind(this),f.clearTiles=this._clearTiles.bind(this),f.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,d.cb(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return d.cb(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new d.h("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new d.h("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(a){this.map=a,this._loaded=!1,this.fire(new d.h("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(a),this.load()}onRemove(a){this._implementation.onRemove&&this._implementation.onRemove(a)}hasTile(a){if(this._implementation.hasTile){const{x:r,y:o,z:u}=a.canonical;return this._implementation.hasTile({x:r,y:o,z:u})}return!this.tileBounds||this.tileBounds.contains(a.canonical)}async loadTile(a,r){const{x:o,y:u,z:f}
vendor: 4,067 bytes, line 3405
3405=a.tileID.canonical,m=new AbortController;a.request=m;try{const g=await this._implementation.loadTile({x:o,y:u,z:f},{signal:m.signal});if(delete a.request,a.aborted)return a.state="unloaded",r(null);if(g===void 0)return a.state="errored",r(null);if(g===null)return this.loadTileData(a,{width:this.tileSize,height:this.tileSize,data:null}),a.state="loaded",r(null);if(!function(x){return x instanceof ImageData||x instanceof HTMLCanvasElement||x instanceof ImageBitmap||x instanceof HTMLImageElement}(g))return a.state="errored",r(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`));this.loadTileData(a,g),a.state="loaded",r(null)}catch(g){if(m.signal.aborted)return;a.state="errored",r(g)}}loadTileData(a,r){a.setTexture(r,this.map.painter)}unloadTile(a,r){if(a.texture&&a.texture instanceof d.T?(a.destroy(!1),a.texture&&a.texture instanceof d.T&&this.map.painter.saveTileTexture(a.texture)):a.destroy(),this._implementation.unloadTile){const{x:o,y:u,z:f}=a.tileID.canonical;this._implementation.unloadTile({x:o,y:u,z:f})}r&&r()}abortTile(a,r){a.request&&(a.request.abort(),delete a.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(a=>({x:a.canonical.x,y:a.canonical.y,z:a.canonical.z}))}_clearTiles(){const a=d.m(this.id,this.scope);this.map.style.clearSource(a)}_update(){this.fire(new d.h("data",{dataType:"source",sourceDataType:"content"}))}}},ih=function(a,r,o,u){const f=Aa(r.type);if(!f)throw new Error(`Unknown source type "${r.type}"`);const m=new f(a,r,o,u);if(m.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${m.id}`);return d.aV(["load","abort","unload","serialize","prepare"],m),m},Aa=function(a){return Object.hasOwn(Sn,a)?Sn[a]:void 0};function po([a,r],o,u,{scaled:f=!0}={}){const{tileSize:m,buffer:g}=u,{x,y:w,z:E}=o;if(!isFinite(x)||!isFinite(w)||!isFinite(E))throw new Error("Invalid MRT header");const I=2**E,P=I*d.a7(a),R=I*d.a8(r);return function([B,V],U,{scaled:Z=!0}={}){if(!U)throw new Error("bandView is undefined");const{data:q,tileSize:X,buffer:ne,offset:oe,scale:_e,dimension:ae}=U;if(B<-ne||B>X+ne||V<-ne||V>X+ne)throw new Error(`Point (${B}, ${V}) out of bounds for tileSize=${X}, buffer=${ne}`);const ue=(V+ne)*(X+2*ne)+(B+ne);if(new Uint32Array(q.buffer)[ue]===4294967295)return null;let he=[];he=Z?[]:new U.data.constructor(ae);for(let fe=0;fe<ae;fe++)he[fe]=Math.round(1e12*(q[ae*ue+fe]*_e+oe))/1e12;return he}([Math.min(Math.max(-g,Math.floor((P-x)*m)),m-1+g),Math.min(Math.max(-g,Math.floor((R-w)*m)),m-1+g)],u,{scaled:f})}d.cA.setPbf(d.cB);class $n extends Ps{constructor(r,o,u,f,m){super(r,o,u,f,m),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(r){return this._mrt&&this._mrt.getLayer(r)}setTexturePerLayer(r,o,u){const f=u.context,m=f.gl;let g=this.texturePerLayer.get(r)||u.getTileTexture(o.width);g&&g instanceof d.T?g.update(o,{premultiply:!1}):g=new d.T(f,o,m.RGBA8,{premultiply:!1}),this.texturePerLayer.has(r)||this.texturePerLayer.set(r,g)}flushQueues(r){const o=this._workQueuePerLayer.get(r)||[],u=this._fetchQueuePerLayer.get(r)||[];for(;o.length;)o.pop()();for(;u.length;)u.pop()()}flushAllQueues(){for(const r of this._workQueuePerLayer.keys()){const o=this._workQueuePerLayer.get(r)||[];for(;o.length;)o.pop()()}for(const r of this._fetchQueuePerLayer.keys()){const o=this._fetchQueuePerLayer.get(r)||[];for(;o.length;)o.pop()()}}fetchHeader(r=16384,o){const u=this._mrt=new d.cA(30),f={...this.requestParams,headers:{Range:"bytes=0-"+(r-1)}};this.entireBuffer=null;const m=new AbortController;return this.request=m,d.cC(f,m.signal).then(({data:g,headers:x})=>{try{const w=u.getHeaderLength(g);if(w>r)return void(this.request=this.fetchHeader(w,o));u.parseHeader(g),this._isHeaderLoaded=!0;let E=0;
vendor: 4,307 bytes, line 3405
3405for(const I of Object.values(u.layers))E=Math.max(E,I.dataIndex.at(-1).lastByte);g.byteLength>=E&&(this.entireBuffer=g),o(null,this.entireBuffer||g,x)}catch(w){o(w)}}).catch(g=>{m.signal.aborted||o(g)}),this.request}fetchBandForRender(r,o,u,f){this.fetchBand(r,o,u,m=>{if(m)return void f(m);this.updateTextureDescriptor(r,o,u);const g=this.textureDescriptorPerLayer.get(o);f(null,g?g.img:null)})}fetchBand(r,o,u,f){const m=this._mrt;if(!this._isHeaderLoaded||!m)return void f(new Error("Tile header is not ready"));const g=this.actor;if(!g)return void f(new Error("Can't fetch tile band without an actor"));let x;const w=d.m(String(u),d.m(this.tileID.key,r));let E=this._taskQueue.get(w);E?E.add(f):(E=new Set,E.add(f),this._taskQueue.set(w,E));const I=(V,U)=>{x.complete(V,U),V?f(V):(E.forEach(Z=>Z(null,U)),this._taskQueue.delete(w))},P=(V,U)=>{if(V)return f(V);let Z,q=!1;if(o!==null){const ne=this._workQueuePerLayer.get(o)||[];ne.push(()=>{q=!0,Z&&Z.abort(),x.cancel()}),this._workQueuePerLayer.has(o)||this._workQueuePerLayer.set(o,ne)}const X=()=>{q||(Z=g.sendCancelable("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:U,task:x},{},I))};this.workerReady!==void 0?this.workerReady.then(X).catch(ne=>f(ne)):X()};let R;try{R=m.getLayer(r)}catch(V){if(this.state==="reloading")return;throw V}if(!R)return void f(new Error(`Unknown sourceLayer "${r}"`));if(R.hasDataForBand(u))return E.forEach(V=>V(null,null)),void this._taskQueue.delete(w);const B=R.getDataRange([u]);if(x=m.createDecodingTask(B),!x||x.tasks.length)if(o!==null&&this.flushQueues(o),this.entireBuffer)P(null,this.entireBuffer.slice(B.firstByte,B.lastByte+1));else{const V={...this.requestParams,headers:{Range:`bytes=${B.firstByte}-${B.lastByte}`}},U=new AbortController;if(d.cC(V,U.signal).then(({data:Z})=>P(null,Z)).catch(Z=>{U.signal.aborted||P(Z)}),o!==null){const Z=this._fetchQueuePerLayer.get(o)||[];Z.push(()=>{U.abort(),x.cancel()}),this._fetchQueuePerLayer.has(o)||this._fetchQueuePerLayer.set(o,Z)}}}updateNeeded(r,o){return(!this.textureDescriptorPerLayer.get(r)||this.textureDescriptorPerLayer.get(r).band!==o||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(r,o,u){if(!this._mrt)return;const f=this._mrt.getLayer(r);if(!f||!f.hasBand(u)||!f.hasDataForBand(u))return;const{bytes:m,tileSize:g,buffer:x,offset:w,scale:E}=f.getBandView(u),I=g+2*x,P=new d.b({width:I,height:I},m),R=this.texturePerLayer.get(o);R&&R instanceof d.T&&R.update(P,{premultiply:!1}),this.textureDescriptorPerLayer.set(o,{layer:r,band:u,img:P,buffer:x,offset:w,tileSize:g,format:f.pixelFormat,mix:[E,256*E,65536*E,16777216*E]})}destroy(r=!1){if(super.destroy(r),delete this._mrt,!r)for(const o of this.texturePerLayer.values())o&&o instanceof d.T&&o.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}ta=(a,r,o,u,f)=>new $n(a,r,o,u,f);const qn={RasterArrayTileSource:class extends tu{constructor(a,r,o,u){super(a,r,o,u),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options={type:"raster-array",...r}}triggerRepaint(a){const r=this.map.painter._terrain,o=this.map.style.getSourceCache(this.id);r&&r.enabled&&o&&r._clearRenderCacheForTile(o.id,a.tileID),this.map.triggerRepaint()}async loadTile(a,r){const o=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);a.source=this.id,a.scope=this.scope,this._workerReady===void 0&&(this._workerReady=this.dispatcher.send("ensureRasterArraySource",void 0).then(()=>{}),this._workerReady.catch(()=>{})),a.workerReady=this._workerReady,a.actor||(a.actor=this.dispatcher.getActor());const u=new AbortController;a.request=u;const f=(m,g,x)=>{if(delete a.request,a.aborted)return r(null);if(m)return a.state="errored",r(m);if(this.map._refreshExpiredTiles&&g&&a.setExpiryData(d.ci(x)),this.partial&&a.state!=="expired")a.state="empty";else if(!this.partial){if(!g)return r(null);a.state="loaded",a._isHeaderLoaded=!0,a._mrt=g}r(null)};try{const m=await this.map._requestManager.transformRequest(o,d.R.Tile,u.signal);if(u.signal.aborted)return r(null);
3405a.requestParams=m;const g={request:m,uid:a.uid,tileID:a.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};a.request=this.partial?a.fetchHeader(void 0,(x,w,E)=>{f(x,w,E)}):a.actor.sendCancelable("loadTile",g,{},(x,w)=>x?f(x):w?void f(null,w.mrt,w.headers):f(null,null))}catch(m){if(u.signal.aborted)return r(null);a.state="errored",r(m)}}abortTile(a){a.request&&(a.request.abort(),delete a.request),a.actor&&a.actor.notify("abortTile",{uid:a.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(a,r){const o=a.texturePerLayer;if(a.flushAllQueues(),o.size){a.destroy(!1);for(const u of o.values())this.map.painter.saveTileTexture(u)}else a.destroy()}prepareTile(a,r,o,u){a._isHeaderLoaded&&(a.state!=="empty"&&(a.state="reloading"),a.fetchBandForRender(r,o,u,(f,m)=>{f?(a.state="errored",this.fire(new d.f(f))):m&&(a._isHeaderLoaded=!0,a.setTexturePerLayer(o,m,this.map.painter),a.state="loaded"),this.triggerRepaint(a)}))}getInitialBand(a){if(!this.rasterLayers)return 0;const r=this.rasterLayers.find(({id:f})=>f===a),o=r&&r.fields,u=o&&o.bands&&o.bands;return u?u[0]:0}getTextureDescriptor(a,r,o){if(!a)return;const u=r.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!u)return;let f=null;r instanceof d.cx?f=r.paint.get("raster-array-band"):r instanceof d.cy&&(f=r.paint.get("raster-particle-array-band"));const m=f||this.getInitialBand(u);if(m!=null)if(a.textureDescriptorPerLayer.get(r.id)){if(!a.updateNeeded(r.id,m)||o)return{...a.textureDescriptorPerLayer.get(r.id),texture:a.texturePerLayer.get(r.id)}}else this.prepareTile(a,u,r.id,m)}getImages(a,r){const o=new Map;for(const u of a)for(const f of r){const[m,g]=f.split("/"),x=u.getLayer(m);if(!x||!x.hasBand(g)||!x.hasDataForBand(g))continue;const{bytes:w,tileSize:E,buffer:I}=x.getBandView(g),P=E+2*I,R={data:new d.b({width:P,height:P},w),pixelRatio:2,sdf:!1,usvg:!1,version:0};o.set(f,R)}return o}queryRasterArrayValueByBandId(a,r,o){const u=r._mrt;return new Promise(f=>{const m={},g=new Set;for(const[x,w]of Object.entries(u.layers)){if(o.layerName&&x!==o.layerName)continue;const E={};m[x]=E;for(const{bands:I}of w.dataIndex)for(const P of I)o.bands&&!o.bands.includes(P)||(g.add(d.m(x,P)),r.fetchBand(x,null,P,R=>{d.e.frame(()=>{E[P]=R?null:po([a.lng,a.lat],u,w.getBandView(P)),g.delete(d.m(x,P)),g.size===0&&f(m)})}))}g.size===0&&f(m)})}_loadTileForQuery(a){if(this._loadTileLoaded[a.uid])return Promise.resolve(a._mrt);if(a.uid in this._loadTilePending)return this._loadTilePending[a.uid];const r=this._fetchTileForQuery(a);return this._loadTilePending[a.uid]=r,r}async _fetchTileForQuery(a){const r=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);try{const o={request:await this.map._requestManager.transformRequest(r,d.R.Tile),uid:a.uid,tileID:a.tileID,type:this.t
vendor: 6,567 bytes, line 3405
3405ype,source:this.id,scope:this.scope,partial:!1},u=await a.actor.send("loadTile",o);if(!u)return null;const f=u.mrt;return this.map._refreshExpiredTiles&&a.setExpiryData(d.ci(u.headers)),a._mrt=f,a._isHeaderLoaded=!0,a.state="loaded",this._loadTileLoaded[a.uid]=!0,f}finally{delete this._loadTilePending[a.uid]}}async queryRasterArrayValueByAllBands(a,r,o){return await this._loadTileForQuery(r)?this.queryRasterArrayValueByBandId(a,r,o):null}queryRasterArrayValue(a,r){const o=d.cz.convert(a),u=this.findLoadedParent(o);return u&&u._mrt?r.bands||!this.partial?this.queryRasterArrayValueByBandId(o,u,r):this.queryRasterArrayValueByAllBands(o,u,r):Promise.resolve(null)}findLoadedParent(a){const r=d.bS.fromLngLat(a,this.map.transform.tileSize),o=this.maxzoom+1,u=1<<o,f=Math.floor(r.x),m=Math.floor((r.x-f)*u),g=Math.floor(r.y*u);if(m<0||m>=u||g<0||g>=u)return null;const x=this.map.style.getSourceCache(this.id),w=new d.bP(o,f,o,m,g);return x.findLoadedParent(w,this.minzoom)}}},wr=qn,ia={model:()=>$t().then(()=>Mt.ModelSource),"batched-model":()=>$t().then(()=>Mt.Tiled3dModelSource),"raster-array":()=>async function(){return Promise.resolve()}().then(()=>wr.RasterArrayTileSource)};class h_ extends d.E{constructor(r,o,u,f){super(),this.id=r,this.type=o.type,this._options=o,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.setEventedParent(f)}hasTransition(){return!1}loaded(){return!1}onAdd(r){}onRemove(r){}loadTile(r,o){}serialize(){return this._options}}function Uf(a,r,o=""){return`${o}:${r.id||""}:${r.layer.id}:${function(u){if("layerId"in u)return`layer:${u.layerId}`;{const{featuresetId:f,importId:m}=u;return`featureset:${f}${m?`:import:${m}`:""}`}}(a.target)}`}function jf(a,r,o,u=""){if(a.uniqueFeatureID){const f=Uf(a,r,u);if(o.has(f))return!0;o.add(f)}return!1}function Gf(a,r,o,u,f=!1,m=void 0){const g=r.sourceCache.transform,x=r.sourceCache.tilesIn(a,r.has3DLayers,f);x.sort(nd);const w=[];for(const E of x){const I=E.tile.queryRenderedFeatures(r,E,o,u,g,f,m);Object.keys(I).length&&w.push({wrappedTileID:E.tile.tileID.wrapped().key,queryResults:I})}for(const E in r.layers){const I=r.layers[E];if(I.styleLayer){const P=I.styleLayer.queryRenderedFeatures(a,r.sourceCache,u);Object.keys(P).length&&w.push({wrappedTileID:0,queryResults:P})}}return w.length===0?{}:function(E){const I={},P={};for(const R of E){const B=R.queryResults,V=R.wrappedTileID,U=P[V]=P[V]||{};for(const Z in B){const q=B[Z],X=U[Z]=U[Z]||{},ne=I[Z]=I[Z]||[];for(const oe of q)X[oe.featureIndex]||(X[oe.featureIndex]=!0,ne.push(oe))}}return I}(w)}function d_(a,r,o,u,f,m){const g={},x=u.queryRenderedSymbols(a),w=[];for(const E of Object.keys(x).map(Number))w.push(f[E]);w.sort(nd);for(const E of w){const I=E.featureIndex.lookupSymbolFeatures(x[E.bucketInstanceId],E.bucketIndex,E.sourceLayerIndex,r,o,m);for(const P in I){const R=g[P]=g[P]||[],B=I[P];B.sort((V,U)=>{const Z=E.featureSortOrder;if(Z){const q=Z.indexOf(V.featureIndex);return Z.indexOf(U.featureIndex)-q}return U.featureIndex-V.featureIndex});for(const V of B)R.push(V)}}return g}function rd(a,r){const o=a.getRenderableIds().map(m=>a.getTileByID(m)),u=[],f={};for(let m=0;m<o.length;m++){const g=o[m],x=g.tileID.canonical.key;f[x]||(f[x]=!0,g.querySourceFeatures(u,r))}return u}function nd(a,r){const o=a.tileID,u=r.tileID;return o.overscaledZ-u.overscaledZ||o.canonical.y-u.canonical.y||o.wrap-u.wrap||o.canonical.x-u.canonical.x}class Hf{constructor(r){this.style=r,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const r=!1,o=!1;for(const u in this.style._mergedLayers){const f=this.style._mergedLayers[u];if(f.type==="fill-extrusion"||f.type==="building")this.layers.push({layer:f,visible:r,visibilityChanged:o});else if(f.type==="model"){const m=this.style.getLayerSource(f);m&&m.type==="batched-model"&&this.layers.push({layer:f,visible:r,visibilityChanged:o})}}}onNewFrame(r){this.layersGotHidden=!1;for(const o of this.layers){const u=o.layer;let f=!1;u.type==="fill-extrusion"?f=!u.isHidden(r)&&u.paint.get("fill-extrusion-opacity")>0:u.type==="building"?f=!u.isHidden(r)&&u.paint.get("building-opacity")>0:u.type==="model"&&(f=!u.isHidden(r)&&u.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!f&&o.visible,o.visible=f}}updateZOffset(r,o){this.currentBuildingBuckets=[];for(const f of this.layers){const m=f.layer,g=this.style.getLayerSourceCache(m);let x=1;m.type==="fill-extrusion"?x=f.visible?m.paint.get("fill-extrusion-vertical-scale"):0:m.type==="building"&&(x=f.visible?m.paint.get("building-vertical-scale"):0);let w=g?g.getTile(o):null;if(!w&&g)for(const E in g._tiles){const I=g._tiles[E];if(o.canonical.isChildOf(I.tileID.canonical)){w=I;break}}this.currentBuildingBuckets.push({bucket:w?w.getBucket(m):null,tileID:w?w.tileID:o,verticalScale:x})}r.hasAnyZOffset=!1;let u=!1;for(let f=0;f<r.symbolInstances.length;f++){const m=r.symbolInstances.get(f),g=m.zOffset,x=this._getHeightAtTileOffset(o,m.tileAnchorX,m.tileAnchorY);m.zOffset=x!==Number.NEGATIVE_INFINITY?x:g,u||g===m.zOffset||(u=!0),r.hasAnyZOffset||m.zOffset===0||(r.hasAnyZOffset=!0)}u&&(r.zOffsetBuffersNeedUpload=!0,r.zOffsetSortDirty=!0)}hasLayerForSourceCache(r){for(const{layer:o}of this.layers){const u=this.style.getLayerSourceCache(o);if(u&&u.id===r)return!0}return!1}_mapCoordToOverlappingTile(r,o,u,f){let m=o,g=u;if(r.canonical.z!==f.canonical.z){const x=f.canonical,w=1/(1<<r.canonical.z-x.z);m=(o+r.canonical.x*d.a2)*w-x.x*d.a2|0,g=(u+r.canonical.y*d.a2)*w-x.y*d.a2|0}return{tileX:m,tileY:g}}_getHeightAtTileOffset(r,o,u){let f,m;for(let g=0;g<this.layers.length;++g){const x=this.layers[g].layer;if(x.type!=="fill-extrusion"&&x.type!=="building")continue;const{bucket:w,tileID:E,verticalScale:I}=this.currentBuildingBuckets[g];if(!w)continue;const{tileX:P,tileY:R}=this._mapCoordToOverlappingTile(r,o,u,E),B=w.getHeightAtTileCoord(P,R);B&&B.height!==void 0&&(B.hidden?f=B.height:m=Math.max(B.height*I,m||0))}if(m!==void 0)return m;for(let g=0;g<this.layers.length;++g){const x=this.layers[g];if(x.layer.type!=="model"||!x.visible)continue;const{bucket:w,tileID:E}=this.currentBuildingBuckets[g];if(!w)continue;const{tileX:I,tileY:P}=this._mapCoordToOverlappingTile(r,o,u,E),R=w.getHeightAtTileCoord(I,P);if(R&&!R.hidden)return R.height===void 0&&f!==void 0?Math.min(R.maxHeight,f)*R.verticalScale:R.height?R.height*R.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}let oc;function od(){return oc||(oc=new at),oc}function ul(a,r){const o={},u=a,f=r,m=o;for(const g in u)g!=="ref"&&(m[g]=u[g]);
3405return d.cD.forEach(g=>{g in f&&(m[g]=f[g])}),o}function iu(a){a=a.slice();const r=Object.create(null);for(const o of a)r[o.id]=o;for(let o=0;o<a.length;o++){const u=a[o];if(u&&"ref"in u){const f=r[u.ref];f&&(a[o]=ul(u,f))}}return a}class We{constructor(r,o,u,f){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?o:-o))):f&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class sc{constructor(r,o,u,f,m,g=!1){this.text=new We(r?r.text:null,o,u,m),this.icon=new We(r?r.icon:null,o,f,m),this.clipped=g}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ru{constructor(r,o,u,f=!1){this.text=r,this.icon=o,this.skipFade=u,this.clipped=f}}class Zf{constructor(){this.invProjMatrix=d.Y(),this.viewportMatrix=d.Y(),this.circles=[]}}class sd{constructor(r,o,u,f,m){this.bucketInstanceId=r,this.featureIndex=o,this.sourceLayerIndex=u,this.bucketIndex=f,this.tileID=m}}class hl{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const o=++this.maxGroupID;this.collisionGroups[r]={ID:o,predicate:u=>u.collisionGroupID===o}}return this.collisionGroups[r]}}function ac(a,r,o,u,f){const{horizontalAlign:m,verticalAlign:g}=d.cM(a),x=-(m-.5)*r,w=-(g-.5)*o,E=d.cN(a,u);return new d.P(x+E[0]*f,w+E[1]*f)}function dl(a,r,o,u,f){const m=new d.P(a,r);return o&&m._rotate(u?f:-f),m}function nu(a,r,o,u){const{leftJustifiedTextSymbolIndex:f,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:g,verticalPlacedTextSymbolIndex:x,crossTileID:w}=o,E=d.cO(r),I=u===d.cL.vertical?x:E==="left"?f:E==="center"?m:E==="right"?g:-1;f>=0&&(a.text.placedSymbolArray.get(f).crossTileID=I>=0&&f!==I?0:w),m>=0&&(a.text.placedSymbolArray.get(m).crossTileID=I>=0&&m!==I?0:w),g>=0&&(a.text.placedSymbolArray.get(g).crossTileID=I>=0&&g!==I?0:w),x>=0&&(a.text.placedSymbolArray.get(x).crossTileID=I>=0&&x!==I?0:w)}function ou(a,r,o){const u=r===d.cL.horizontal||r===d.cL.horizontalOnly?r:0,f=r===d.cL.vertical?r:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:g,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:w}=o,E=a.text.placedSymbolArray;m>=0&&(E.get(m).placedOrientation=u),g>=0&&(E.get(g).placedOrientation=u),x>=0&&(E.get(x).placedOrientation=u),w>=0&&(E.get(w).placedOrientation=f)}class rh{constructor(r,o,u,f,m,g,x,w){this.transform=r.clone(),this.projection=r.projection.name,this.algorithm=f,this.collisionIndex=this.algorithm.createCollisionDetector(this.transform,g,w),this.buildingIndex=x,this.frontCutoffStart=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new hl(u),this.collisionCircleArrays={},this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(r,o,u,f,m=1){const g=u.getBucket(o),x=u.latestFeatureIndex;if(!g||!x||o.fqid!==g.layerIds[0])return;const w=g.layers[0].layout,E=g.layers[0].paint,I=u.collisionBoxArray,P=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),R=u.tileSize/d.a2,B=u.tileID.toUnwrapped();this.transform.setProjection(g.projection);const V=(U=u.tileID,Z=g.getProjection(),q=this.transform,Z.name===this.projection?q.calculateProjMatrix(U.toUnwrapped()):Uo(q,Z,U));var U,Z,q;const X=w.get("text-pitch-alignment")==="map",ne=w.get("text-rotation-alignment")==="map";o.compileFilter(o.options);const oe=o.dynamicFilter(),_e=o.dynamicFilterNeedsFeature(),ae=o.dynamicFilterNeedsGeometry(),ue=this.transform.calculatePixelsToTileUnitsMatrix(u),he=d.cE(V,u.tileID.canonical,X,ne,this.transform,g.getProjection(),ue);let fe=null;const be=g.getProjection().createInversionMatrix(this.transform,u.tileID.canonical);if(X){const ot=d.cF(V,u.tileID.canonical,X,ne,this.transform,g.getProjection(),ue);fe=d.X([],this.transform.labelPlaneMatrix,ot)}let Re=null;oe&&u.latestFeatureIndex&&(Re={unwrappedTileID:B,dynamicFilter:oe,dynamicFilterNeedsFeature:_e,needGeometry:ae}),this.retainedQueryData[g.bucketInstanceId]=new sd(g.bucketInstanceId,x,g.sourceLayerIndex,g.index,u.tileID);const[Ae,Ce]=g.layers[0].layout.get("text-size-scale-range"),Ee=d.b0(m,Ae,Ce),[Ye,De]=w.get("icon-size-scale-range"),Ve=d.b0(m,Ye,De),$e={bucket:g,layout:w,paint:E,posMatrix:V,invMatrix:be,mercatorCenter:[d.a7(this.transform.center.lng),d.a8(this.transform.center.lat)],textLabelPlaneMatr
vendor: 5,313 bytes, line 3405
3405ix:he,labelToScreenMatrix:fe,clippingData:Re,scale:P,textPixelRatio:R,holdingForFade:u.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:d.cG(g.textSizeData,this.transform.zoom,Ee),partiallyEvaluatedIconSize:d.cG(g.iconSizeData,this.transform.zoom,Ve),collisionGroup:this.collisionGroups.get(g.sourceID),latestFeatureIndex:u.latestFeatureIndex};if(f)for(const ot of g.sortKeyRanges){const{sortKey:et,symbolInstanceStart:Xe,symbolInstanceEnd:mt}=ot;r.push({sortKey:et,symbolInstanceStart:Xe,symbolInstanceEnd:mt,parameters:$e})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:g.symbolInstances.length,parameters:$e})}placeLayerBucketPart(r,o,u,f=1){this.algorithm.placeLayerBucketPart(this,r,o,u,f)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let u=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const f=o?o.symbolFadeChange(r):1,m=o?o.opacities:{},g=o?o.variableOffsets:{},x=o?o.placedOrientations:{};for(const w in this.placements){const E=this.placements[w],I=m[w];I?(this.opacities[w]=new sc(I,f,E.text,E.icon,null,E.clipped),u=u||E.text!==I.text.placed||E.icon!==I.icon.placed):(this.opacities[w]=new sc(null,f,E.text,E.icon,E.skipFade,E.clipped),u=u||E.text||E.icon)}for(const w in m){const E=m[w];if(!this.opacities[w]){const I=new sc(E,f,!1,!1);I.isHidden()||(this.opacities[w]=I,u=u||E.text.placed||E.icon.placed)}}for(const w in g)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=g[w]);for(const w in x)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=x[w]);u?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:r)}updateLayerOpacities(r,o,u,f,m=!1,g=1){f&&(this.lastReplacementSourceUpdateTime=f.updateTime);const x=new Set;for(const w of o){const E=w.getBucket(r);if(E&&w.latestFeatureIndex&&r.fqid===E.layerIds[0]&&(this.updateBucketOpacities(E,x,w,w.collisionBoxArray,u,f,w.tileID,r.scope),E.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(E,w.tileID),E.elevationType==="road"&&E.hdExt&&E.hdExt.updateRoadElevation(E,w.tileID.canonical),E.updateZOffset(),m&&w.collisionBoxArray)){const I=E.layers[0].layout,[P,R]=I.get("text-size-scale-range"),[B,V]=I.get("icon-size-scale-range"),U=d.b0(g,P,R),Z=d.b0(g,B,V);E.updateCollisionDebugBuffers(this.transform.zoom,w.collisionBoxArray,U,Z)}}}updateBucketOpacities(r,o,u,f,m,g,x,w){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const E=r.layers[0].layout,I=r.layers[0].paint,P=!!r.layers[0].dynamicFilter(),R=new sc(null,0,!1,!1,!0),B=E.get("text-allow-overlap"),V=E.get("icon-allow-overlap"),U=E.get("text-variable-anchor"),Z=E.get("text-rotation-alignment")==="map",q=E.get("text-pitch-alignment")==="map",X=I.get("symbol-z-offset"),ne=E.get("symbol-elevation-reference")==="sea",oe=!X.isConstant(),_e=new sc(null,0,B&&(V||!r.hasIconData()||E.get("icon-optional")),V&&(B||!r.hasTextData()||E.get("text-optional")),!0);!r.collisionArrays&&f&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(f);const ae=(he,fe,be)=>{for(let Re=0;Re<fe/4;Re++)he.opacityVertexArray.emplaceBack(be)};let ue=0;g&&r.updateReplacement(x,g),this.collisionIndex.clearClippedSymbolsForBucket(r.bucketInstanceId);for(let he=0;he<r.symbolInstances.length;he++){const fe=r.symbolInstances.get(he),{numHorizontalGlyphVertices:be,numVerticalGlyphVertices:Re,crossTileID:Ae,numIconVertices:Ce,tileAnchorX:Ee,tileAnchorY:Ye}=fe;let De=null;const Ve=this.retainedQueryData[r.bucketInstanceId];oe&&fe&&Ve&&(De=u.latestFeatureIndex.loadFeature({featureIndex:fe.featureIndex,bucketIndex:Ve.bucketIndex,sourceLayerIndex:Ve.sourceLayerIndex,layoutVertexArrayOffset:0}));const $e=X.evaluate(De,{}),ot=o.has(Ae);let et=this.opacities[Ae];ot?et=R:et||(et=_e,this.opacities[Ae]=et),o.add(Ae);const Xe=be>0||Re>0,mt=Ce>0,qe=this.placedOrientations[Ae],Ge=qe===d.cL.vertical,Qe=qe===d.cL.horizontal||qe===d.cL.horizontalOnly;!Xe&&!mt||et.isHidden()||ue++;let dt=!1;if((Xe||mt)&&g)for(const rt of r.activeReplacements){if(d.cH(rt,m,d.cI.Symbol,w)||rt.min.x>Ee||Ee>rt.max.x||rt.min.y>Ye||Ye>rt.max.y)continue;const ct=d.cJ(Ee,Ye,x.canonical,rt.footprintTileId.canonical);if(dt=d.cK(ct,rt.footprint),dt)break}if(dt&&this.collisionIndex.markSymbolAsClipped(r.bucketInstanceId,fe.featureIndex),Xe){const rt=dt?Ca:ld(et.text);ae(r.text,be,Ge?Ca:rt),ae(r.text,Re,Qe?Ca:rt);const ct=et.text.isHidden(),{leftJustifiedTextSymbolIndex:_t,centerJustifiedTextSymbolIndex:Dt,rightJustifiedTextSymbolIndex:bt,verticalPlacedTextSymbolIndex:Kt}=fe,Ti=r.text.placedSymbolArray,ai=ct||Ge?1:0;_t>=0&&(Ti.get(_t).hidden=ai),Dt>=0&&(Ti.get(Dt).hidden=ai),bt>=0&&(Ti.get(bt).hidden=ai),Kt>=0&&(Ti.get(Kt).hidden=ct||Qe?1:0);const Ot=this.variableOffsets[Ae];Ot&&nu(r,Ot.anchor,fe,qe);const Tt=this.placedOrientations[Ae];Tt&&(nu(r,"left",fe,Tt),ou(r,Tt,fe))}if(mt){const rt=dt?Ca:ld(et.icon),{placedIconSymbolIndex:ct,verticalPlacedIconSymbolIndex:_t}
vendor: 4,295 bytes, line 3405
3405=fe,Dt=r.icon.placedSymbolArray,bt=et.icon.isHidden()?1:0;ct>=0&&(ae(r.icon,Ce,Ge?Ca:rt),Dt.get(ct).hidden=bt),_t>=0&&(ae(r.icon,fe.numVerticalIconVertices,Qe?Ca:rt),Dt.get(_t).hidden=bt)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const rt=r.collisionArrays[he];if(rt){let ct=new d.P(0,0),_t=!0;if(rt.textBox||rt.verticalTextBox){if(U){const bt=this.variableOffsets[Ae];bt?(ct=ac(bt.anchor,bt.width,bt.height,bt.textOffset,bt.textScale),Z&&ct._rotate(q?this.transform.angle:-this.transform.angle)):_t=!1}P&&(_t=!et.clipped),rt.textBox&&$o(r.textCollisionBox.collisionVertexArray,et.text.placed,!_t||Ge,$e,ne,ct.x,ct.y),rt.verticalTextBox&&$o(r.textCollisionBox.collisionVertexArray,et.text.placed,!_t||Qe,$e,ne,ct.x,ct.y)}const Dt=_t&&!!(!Qe&&rt.verticalIconBox);rt.iconBox&&$o(r.iconCollisionBox.collisionVertexArray,et.icon.placed,Dt,$e,ne,fe.hasIconTextFit?ct.x:0,fe.hasIconTextFit?ct.y:0),rt.verticalIconBox&&$o(r.iconCollisionBox.collisionVertexArray,et.icon.placed,!Dt,$e,ne,fe.hasIconTextFit?ct.x:0,fe.hasIconTextFit?ct.y:0)}}}if(r.fullyClipped=ue===0,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){const he=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=he.invProjMatrix,r.placementViewportMatrix=he.viewportMatrix,r.collisionCircleArray=he.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return r-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(r,o){const u=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*u>r}isStale(){return this.stale}setStale(){this.stale=!0}}function $o(a,r,o,u,f,m,g){a.emplaceBack(r?1:0,o?1:0,m||0,g||0,u,f?1:0),a.emplaceBack(r?1:0,o?1:0,m||0,g||0,u,f?1:0),a.emplaceBack(r?1:0,o?1:0,m||0,g||0,u,f?1:0),a.emplaceBack(r?1:0,o?1:0,m||0,g||0,u,f?1:0)}const ad=Math.pow(2,25),fl=Math.pow(2,24),nh=Math.pow(2,17),lc=Math.pow(2,16),oh=Math.pow(2,9),f_=Math.pow(2,8),$f=Math.pow(2,1);function ld(a){if(a.opacity===0&&!a.placed)return 0;if(a.opacity===1&&a.placed)return 4294967295;const r=a.placed?1:0,o=Math.floor(127*a.opacity);return o*ad+r*fl+o*nh+r*lc+o*oh+r*f_+o*$f+r}const Ca=0;class p_{constructor(r,o){this.reset(r,o)}reset(r,o){this.points=r||[],this._distances=[0];for(let u=1;u<this.points.length;u++)this._distances[u]=this._distances[u-1]+this.points[u].dist(this.points[u-1]);this.length=this._distances.at(-1),this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(this.points.length===1)return this.points[0];r=d.b0(r,0,1);let o=1,u=this._distances[o];const f=r*this.paddedLength+this.padding;for(;u<f&&o<this._distances.length;)u=this._distances[++o];const m=o-1,g=this._distances[m],x=u-g,w=x>0?(f-g)/x:0;return this.points[m].mult(1-w).add(this.points[o].mult(w))}}const Ls=100;class qf{constructor(r,o){this.gridRightBoundary=0,this.gridBottomBoundary=0,this.clippedSymbols=new Map,this.reset(r,o)}reset(r,o){const u=r.width+200,f=r.height+200;u!==this.gridRightBoundary||f!==this.gridBottomBoundary?(this.grid=new d.cP(u,f,25),this.ignoredGrid=new d.cP(u,f,25)):(this.grid.clear(),this.ignoredGrid.clear()),this.transform=r,this.fogState=o,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+Ls,this.screenBottomBoundary=r.height+Ls,this.gridRightBoundary=u,this.gridBottomBoundary=f,this.clippedSymbol
vendor: 12,701 bytes, line 3405
3405s.clear()}clearClippedSymbolsForBucket(r){this.clippedSymbols.delete(r)}markSymbolAsClipped(r,o){let u=this.clippedSymbols.get(r);u||(u=new Set,this.clippedSymbols.set(r,u)),u.add(o)}placeCollisionBox(r,o,u,f,m,g,x,w,E,I,P){let R=u.projectedAnchorX,B=u.projectedAnchorY,V=u.projectedAnchorZ;const U=u.tileAnchorX,Z=u.tileAnchorY,q=u.elevation,X=u.tileID,ne=r.getProjection();if(q&&X){const[Ce,Ee,Ye]=ne.upVector(X.canonical,u.tileAnchorX,u.tileAnchorY),De=ne.upVectorScale(X.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;R+=Ce*q*De,B+=Ee*q*De,V+=Ye*q*De}const oe=r.projection.name==="globe",_e=r.projection.name==="globe"?d.S(this.transform.zoom):0;if(X&&oe&&_e<1&&!g){const Ce=1<<X.canonical.z,Ee=d.cQ(U,Z);d.cR(Ee,Ee,1/d.a2),d.cS(Ee,Ee,d.cQ(X.canonical.x,X.canonical.y)),d.cR(Ee,Ee,1/Ce),d.cT(Ee,Ee,d.cQ(f[0],f[1])),Ee[0]=d.cU(Ee[0],-.5,.5),d.cR(Ee,Ee,d.a2);const Ye=d.cV(Ee[0],Ee[1],d.a2/(2*Math.PI),1);d.c7(Ye,Ye,m),R=d.al(R,Ye[0],_e),B=d.al(B,Ye[1],_e),V=d.al(V,Ye[2],_e)}const ae=this.projectAndGetPerspectiveRatio(I,R,B,V,u.tileID,ne.name==="globe"||!!q||this.transform.pitch>0,ne),ue=E*ae.perspectiveRatio,he=(u.x1*o+x.x-u.padding)*ue+ae.point.x,fe=(u.y1*o+x.y-u.padding)*ue+ae.point.y,be=(u.x2*o+x.x+u.padding)*ue+ae.point.x,Re=(u.y2*o+x.y+u.padding)*ue+ae.point.y,Ae=ae.perspectiveRatio<=.55||ae.occluded;return!this.isInsideGrid(he,fe,be,Re)||!w&&this.grid.hitTest(he,fe,be,Re,P)||Ae?{box:[],offscreen:!1,occluded:ae.occluded}:{box:[he,fe,be,Re],offscreen:this.isOffscreen(he,fe,be,Re),occluded:!1}}placeCollisionCircles(r,o,u,f,m,g,x,w,E,I,P,R,B,V,U,Z){const q=[],X=this.transform.elevation,ne=r.getProjection(),oe=r.elevationType==="road",_e=!!X||oe,ae=d.cW.getAtTileOffsetFunc(Z,this.transform.center.lat,this.transform.worldSize,ne),ue=new d.P(u.tileAnchorX,u.tileAnchorY),he=new d.P(u.tileAnchorX,u.tileAnchorY);let{x:fe,y:be,z:Re}=ne.projectTilePoint(he.x,he.y,Z.canonical),Ae=null;if(_e){Ae=oe&&r.hdExt?r.hdExt.makeRoadSymbolElevationParams(r,r.text,f,Z,ae,X,ne,this.transform.center.lat,this.transform.worldSize):{getElevation:ae,elevation:X,elevationFeature:null};const[dt,rt,ct]=Ae.getElevation(ue,X,Ae.elevationFeature);fe+=dt,be+=rt,Re+=ct}const Ce=ne.name==="globe",Ee=this.projectAndGetPerspectiveRatio(w,fe,be,Re,Z,Ce||!!X||this.transform.pitch>0,ne),{perspectiveRatio:Ye}=Ee,De=(R?x/Ye:x*Ye)/d.d1,Ve=d.cX(fe,be,Re,E),$e=u.lineOffsetX*De,ot=u.lineOffsetY*De,et=d.au(r.layers[0].layout.get("text-max-angle")),Xe=Math.cos(et),mt=Ee.signedDistanceFromCamera>0?d.cY(De,g,$e,ot,oe&&u.flipState===1,Ve,he,u,m,E,{},_e&&!R?Ae:null,R&&_e,ne,Z,R,Xe):null;let qe=!1,Ge=!1,Qe=!0;if(mt&&!Ee.occluded){const dt=.5*V*Ye+U,rt=new d.P(-100,-100),ct=new d.P(this.screenRightBoundary,this.screenBottomBoundary),_t=new p_,{first:Dt,last:bt}=mt,Kt=Dt.path.length;let Ti=[];for(let Tt=Kt-1;Tt>=1;Tt--)Ti.push(Dt.path[Tt]);for(let Tt=1;Tt<bt.path.length;Tt++)Ti.push(bt.path[Tt]);const ai=2.5*dt;I&&(Ti=Ti.map(([Tt,Ei,Ji],Ui)=>(_e&&!Ce&&(Ji=Ae.getElevation(Ui<Kt-1?Dt.tilePath[Kt-1-Ui]:bt.tilePath[Ui-Kt+2],X,Ae.elevationFeature)[2]),d.cX(Tt,Ei,Ji,I))),Ti.some(Tt=>Tt[3]<=0)&&(Ti=[]));let Ot=[];if(Ti.length>0){let Tt=1/0,Ei=-1/0,Ji=1/0,Ui=-1/0;for(const Ut of Ti)Tt=Math.min(Tt,Ut[0]),Ji=Math.min(Ji,Ut[1]),Ei=Math.max(Ei,Ut[0]),Ui=Math.max(Ui,Ut[1]);Ei>=rt.x&&Tt<=ct.x&&Ui>=rt.y&&Ji<=ct.y&&(Ot=[Ti.map(Ut=>new d.P(Ut[0],Ut[1]))],(Tt<rt.x||Ei>ct.x||Ji<rt.y||Ui>ct.y)&&(Ot=d.cZ(Ot,rt.x,rt.y,ct.x,ct.y)))}for(const Tt of Ot){_t.reset(Tt,.25*dt);let Ei=0;Ei=_t.length<=.5*dt?1:Math.ceil(_t.paddedLength/ai)+1;for(let Ji=0;Ji<Ei;Ji++){const Ui=Ji/Math.max(Ei-1,1),Ut=_t.lerp(Ui),Mi=Ut.x+Ls,_i=Ut.y+Ls;q.push(Mi,_i,dt,0);const ni=Mi-dt,lr=_i-dt,cr=Mi+dt,Ri=_i+dt;if(Qe=Qe&&this.isOffscreen(ni,lr,cr,Ri),Ge=Ge||this.isInsideGrid(ni,lr,cr,Ri),!o&&this.grid.hitTestCircle(Mi,_i,dt,B)&&(qe=!0,!P))return{circles:[],offscreen:!1,collisionDetected:qe,occluded:!1}}}}return{circles:!P&&qe||!Ge?[]:q,offscreen:Qe,collisionDetected:qe,occluded:Ee.occluded}}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let u=1/0,f=1/0,m=-1/0,g=-1/0;for(const I of r){const P=new d.P(I.x+Ls,I.y+Ls);u=Math.min(u,P.x),f=Math.min(f,P.y),m=Math.max(m,P.x),g=Math.max(g,P.y),o.push(P)}const x=this.grid.query(u,f,m,g).concat(this.ignoredGrid.query(u,f,m,g)),w={},E={};for(const I of x){const P=I.key;if(w[P.bucketInstanceId]===void 0&&(w[P.bucketInstanceId]={}),w[P.bucketInstanceId][P.featureIndex])continue;const R=this.clippedSymbols.get(P.bucketInstanceId);if(R&&R.has(P.featureIndex))continue;const B=[new d.P(I.x1,I.y1),new d.P(I.x2,I.y1),new d.P(I.x2,I.y2),new d.P(I.x1,I.y2)];d.aT(o,B)&&(w[P.bucketInstanceId][P.featureIndex]=!0,E[P.bucketInstanceId]===void 0&&(E[P.bucketInstanceId]=[]),E[P.bucketInstanceId].push(P.featureIndex))}return E}insertCollisionBox(r,o,u,f,m){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:f,collisionGroupID:m},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,o,u,f,m){const g=o?this.ignoredGrid:this.grid,x={bucketInstanceId:u,featureIndex:f,collisionGroupID:m};for(let w=0;w<r.length;w+=4)g.insertCircle(x,r[w],r[w+1],r[w+2])}projectAndGetPerspectiveRatio(r,o,u,f,m,g,x){const w=[o,u,f,1];let E=!1;f||this.transform.pitch>0?(d.c7(w,w,r),this.fogState&&m&&x.name!=="globe"&&(E=d.c_(this.fogState,o,u,f,m.toUnwrapped(),this.transform)>d.d2)):d.c$(w,w,r);const I=w[3];return{point:new d.P((w[0]/I+1)/2*this.transform.width+Ls,(-w[1]/I+1)/2*this.transform.height+Ls),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(x)/I*.5,1.5),signedDistanceFromCamera:I,occluded:g&&w[2]>I||E}}isOffscreen(r,o,u,f){return u<Ls||r>=this.screenRightBoundary||f<Ls||o>this.screenBottomBoundary}isInsideGrid(r,o,u,f){return u>=0&&r<this.gridRightBoundary&&f>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const r=d.d0([]);return d.bM(r,r,[-100,-100,0]),r}}const m_={default:new class{createCollisionDetector(a,r,o){return o instanceof qf?(o.reset(a,r),o):new qf(a,r)}shouldPause(a){return a>2}placeLayerBucketPart(a,r,o,u,f=1){const{bucket:m,layout:g,paint:x,posMatrix:w,textLabelPlaneMatrix:E,labelToScreenMatrix:I,clippingData:P,textPixelRatio:R,mercatorCenter:B,invMatrix:V,holdingForFade:U,collisionBoxArray:Z,partiallyEvaluatedTextSize:q,partiallyEvaluatedIconSize:X,collisionGroup:ne,latestFeatureIndex:oe}=r.parameters,_e=g.get("text-optional"),ae=g.get("icon-optional"),ue=g.get("text-allow-overlap"),he=g.get("icon-allow-overlap"),fe=g.get("text-rotation-alignment")==="map",be=g.get("icon-rotation-alignment")==="map",Re=g.get("text-pitch-alignment")==="map",Ae=x.get("symbol-z-offset"),Ce=g.get("symbol-elevation-reference")==="sea",Ee=g.get("symbol-placement"),Ye=g.get("text-variable-anchor"),De=fe&&Ee!=="point",Ve=be&&Ee!=="point",$e=Ye&&m.hasTextData(),ot=m.hasIconTextFit()&&$e&&m.hasIconData();a.transform.setProjection(m.projection);const et=$e||De,Xe=Ve||ot;let mt=ue&&(he||!m.hasIconData()||ae),qe=he&&(ue||!m.hasTextData()||_e);const Ge=!Ae.isConstant();!m.collisionArrays&&Z&&m.deserializeCollisionBoxes(Z);const Qe=(rt,ct,_t)=>{const{crossTileID:Dt,numVerticalGlyphVertices:bt}=rt;let Kt=null;if(P&&P.dynamicFilterNeedsFeature||Ge){const bi=a.retainedQueryData[m.bucketInstanceId],Pi=oe.loadFeature({featureIndex:rt.featureIndex,bucketIndex:bi.bucketIndex,sourceLayerIndex:bi.sourceLayerIndex,layoutVertexArrayOffset:0}),Jt=Pi.properties?Pi.properties.worldview:null;if(m.localizable&&m.worldview&&typeof Jt=="string")if(Jt==="all")Pi.properties.$localized=!0;else{if(!Jt.split(",").includes(m.worldview))return;Pi.properties.$localized=!0,Pi.properties.worldview=m.worldview}Kt=P&&P.needGeometry?d.bw(Pi,!0):Pi}if(P&&!(0,P.dynamicFilter)({zoom:a.transform.zoom,pitch:a.transform.pitch,worldview:m.worldview},Kt,a.retainedQueryData[m.bucketInstanceId].tileID.canonical,new d.P(rt.tileAnchorX,rt.tileAnchorY),a.transform.calculateDistanceTileData(P.unwrappedTileID)))return a.placements[Dt]=new ru(!1,!1,!1,!0),void o.add(Dt);const Ti=Ae.evaluate(Kt,{});if((rt.zOffset||0)+(Ti||0)>0&&a.frontCutoffStart>0){const bi=2*a.frontCutoffStart-1,Pi=[rt.tileAnchorX,rt.tileAnchorY,0,1],Jt=d.c7(d.d3(),Pi,w);if(Jt[1]/Jt[3]<bi)return a.placements[Dt]=new ru(!1,!1,!1,!0),void o.add(Dt)}if(o.has(Dt))return;if(U)return void(a.placements[Dt]=new ru(!1,!1,!1));let ai=!1,Ot=!1,Tt=!0,Ei=!1,Ji=!1,Ui=null,Ut={box:null,offscreen:null,occluded:null},Mi={box:null},_i=null,ni=null,lr=null,cr=0,Ri=0,li=0;_t.textFeatureIndex?cr=_t.textFeatureIndex:rt.useRuntimeCollisionCircles&&(cr=rt.featureIndex),_t.verticalTextFeatureIndex&&(Ri=_t.verticalTextFeatureIndex);const rr=bi=>{bi.tileID=a.retainedQueryData[m.bucketInstanceId].tileID;const Pi=a.transform.elevation;if(m.elevationType==="road")bi.elevation=Ce?Ti:Ti+d.cW.getAtTileOffset(bi.tileID,new d.P(bi.tileAnchorX,bi.tileAnchorY),Pi,null);else{const Jt=m.hdExt?m.hdExt.elevationFeatures[rt.elevationFeatureIndex]:void 0;bi.elevation=Ce?Ti:Ti+d.cW.getAtTileOffset(bi.tileID,new d.P(bi.tileAnchorX,bi.tileAnchorY),Pi,Jt)}bi.elevation+=rt.zOffset},Zr=_t.textBox;if(Zr){rr(Zr);const bi=Jt=>{let sr=d.cL.horizontal;if(m.allowVerticalPlacement&&!Jt&&a.prevPlacement){const $r=a.prevPlacement.placedOrientations[Dt];$r&&(a.placedOrientations[Dt]=$r,sr=$r,ou(m,sr,rt))}return sr},Pi=(Jt,sr)=>{if(m.allowVerticalPlacement&&bt>0&&_t.verticalTextBox){for(const $r of m.writingModes)if($r===d.cL.vertical?(Ut=sr(),Mi=Ut):Ut=Jt(),Ut&&Ut.box&&Ut.box.length)break}else Ut=Jt()};if(Ye){let Jt=Ye;if(a.prevPlacement&&a.prevPlacement.variableOffsets[Dt]){const Pt=a.prevPlacement.variableOffsets[Dt];Jt.indexOf(Pt.anchor)>0&&(Jt=Jt.filter(nr=>nr!==Pt.anchor),Jt.unshift(Pt.anchor))}const sr=(Pt,nr,pn)=>{const Xn=m.getSymbolInstanceTextSize(q,rt,a.transform.zoom,ct),_s=(Pt.x2-Pt.x1)*Xn+2*Pt.padding,fi=(Pt.y2-Pt.y1)*Xn+2*Pt.padding,On=rt.hasIconTextFit&&!he?nr:null;On&&rr(On);let zo={box:[],offscreen:!1,occluded:!1};const Al=ue?2*Jt.length:Jt.length;for(let gs=0;gs<Al;++gs){const ys=this.attemptAnchorPlacement(a,Jt[gs%Jt.length],Pt,B,V,et,_s,fi,Xn,fe,Re,R,w,ne,gs>=Jt.length,rt,ct,m,pn,On,q,X);if(ys&&(zo=ys.placedGlyphBoxes,zo&&zo.box&&zo.box.length)){ai=!0,Ui=ys.shift;break}}return zo};Pi(()=>sr(Zr,_t.iconBox,d.cL.horizontal),()=>{const Pt=_t.verticalTextBox;return Pt&&rr(Pt),m.allowVerticalPlacement&&!(Ut&&Ut.box&&Ut.box.length)&&bt>0&&Pt?sr(Pt,_t.verticalIconBox,d.cL.vertical):{box:null,offscreen:null,occluded:null}}),Ut&&(ai=Ut.box,Tt=Ut.offscreen,Ei=Ut.occluded);const $r=bi(!(!Ut||!Ut.box));if(!ai&&a.prevPlacement){const Pt=a.prevPlacement.variableOffsets[Dt];Pt&&(a.variableOffsets[Dt]=Pt,nu(m,Pt.anchor,rt,$r))}}else{const Jt=(sr,$r)=>{const Pt=m.getSymbolInstanceTextSize(q,rt,a.transform.zoom,ct),nr=a.collisionIndex.placeCollisionBox(m,Pt,sr,B,V,et,new d.P(0,0),ue,R,w,ne.predicate);return nr&&nr.box&&nr.box.length&&(ou(m,$r,rt),a.placedOrientations[Dt]=$r),nr};Pi(()=>Jt(Zr,d.cL.horizontal),()=>{const sr=_t.verticalTextBox;return m.allowVerticalPlacement&&bt>0&&sr?(rr(sr),Jt(sr,d.cL.vertical)):{box:null,offscreen:null,occluded:null}}),bi(!!(Ut&&Ut.box&&Ut.box.length))}}if(_i=Ut,ai=_i&&_i.box&&_i.box.length>0,Tt=_i&&_i.offscreen,Ei=_i&&_i.occluded,rt.useRuntimeCollisionCircles){const bi=rt.centerJustifiedTextSymbolIndex>=0?rt.centerJustifiedTextSymbolIndex:rt.verticalPlacedTextSymbolIndex,Pi=m.text.placedSymbolArray.get(bi),Jt=d.d4(m.textSizeData,q,Pi),sr=g.get("text-padding");ni=a.collisionIndex.placeCollisionCircles(m,ue,Pi,bi,m.lineVertexArray,m.glyphOffsetArray,Jt,w,E,I,u,Re,ne.predicate,rt.collisionCircleDiameter*Jt/d.d1,sr,a.retainedQueryData[m.bucketInstanceId].tileID),ai=ue||ni.circles.length>0&&!ni.collisionDetected,Tt=Tt&&ni.offscreen,Ei=ni.occluded}if(_t.iconFeatureIndex&&(li=_t.iconFeatureIndex),_t.iconBox){const bi=Pi=>{rr(Pi);const Jt=rt.hasIconTextFit&&Ui?dl(Ui.x,Ui.y,fe,Re,a.transform.angle):new d.P(0,0),sr=m.getSymbolInstanceIconSize(X,a.transform.zoom,rt.placedIconSymbolIndex);return a.collisionIndex.placeCollisionBox(m,sr,Pi,B,V,Xe,Jt,he,R,w,ne.predicate)};Mi&&Mi.box&&Mi.box.length&&_t.verticalIconBox?(lr=bi(_t.verticalIconBox),Ot=lr.box.length>0):(lr=bi(_t.iconBox),Ot=lr.box.length>0),Tt=Tt&&lr.offscreen,Ji=lr.occluded}const Jo=_e||rt.numHorizontalGlyphVertices===0&&bt===0,In=ae||rt.numIconVertices===0;if(Jo||In?In?Jo||(Ot=Ot&&ai):ai=Ot&&ai:Ot=ai=Ot&&ai,ai&&_i&&_i.box&&a.collisionIndex.insertCollisionBox(_i.box,g.get("text-ignore-placement"),m.bucketInstanceId,Mi&&Mi.box&&Ri?Ri:cr,ne.ID),Ot&&lr&&a.collisionIndex.insertCollisionBox(lr.box,g.get("icon-ignore-placement"),m.bucketInstanceId,li,ne.ID),ni&&(ai&&a.collisionIndex.insertCollisionCircles(ni.circles,g.get("text-ignore-placement"),m.bucketInstanceId,cr,ne.ID),u)){const bi=m.bucketInstanceId;
3405let Pi=a.collisionCircleArrays[bi];Pi===void 0&&(Pi=a.collisionCircleArrays[bi]=new Zf);for(let Jt=0;Jt<ni.circles.length;Jt+=4)Pi.circles.push(ni.circles[Jt+0]),Pi.circles.push(ni.circles[Jt+1]),Pi.circles.push(ni.circles[Jt+2]),Pi.circles.push(ni.collisionDetected?1:0)}const ms=m.projection.name!=="globe";mt=mt&&(ms||!Ei),qe=qe&&(ms||!Ji),a.placements[Dt]=new ru(ai||mt,Ot||qe,Tt||m.justReloaded),o.add(Dt)},dt=a.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&a.buildingIndex&&a.buildingIndex.updateZOffset(m,dt),m.elevationType==="road"&&m.hdExt&&m.hdExt.updateRoadElevation(m,dt.canonical),m.updateZOffset(),m.sortFeaturesByY){const rt=m.getSortedSymbolIndexes(a.transform.angle);for(let ct=rt.length-1;ct>=0;--ct){const _t=rt[ct];Qe(m.symbolInstances.get(_t),_t,m.collisionArrays[_t])}m.hasAnyZOffset&&d.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const rt=m.getSortedIndexesByZOffset();for(let ct=0;ct<rt.length;++ct){const _t=rt[ct];Qe(m.symbolInstances.get(_t),_t,m.collisionArrays[_t])}}else for(let rt=r.symbolInstanceStart;rt<r.symbolInstanceEnd;rt++)Qe(m.symbolInstances.get(rt),rt,m.collisionArrays[rt]);if(u&&m.bucketInstanceId in a.collisionCircleArrays){const rt=a.collisionCircleArrays[m.bucketInstanceId];d.aO(rt.invProjMatrix,w),rt.viewportMatrix=a.collisionIndex.getViewportMatrix()}m.justReloaded=!1}attemptAnchorPlacement(a,r,o,u,f,m,g,x,w,E,I,P,R,B,V,U,Z,q,X,ne,oe,_e){const{textOffset0:ae,textOffset1:ue,crossTileID:he}=U,fe=[ae,ue],be=ac(r,g,x,fe,w),Re=a.collisionIndex.placeCollisionBox(q,w,o,u,f,m,dl(be.x,be.y,E,I,a.transform.angle),V,P,R,B.predicate);if(ne){const Ae=q.getSymbolInstanceIconSize(_e,a.transform.zoom,U.placedIconSymbolIndex);if(a.collisionIndex.placeCollisionBox(q,Ae,ne,u,f,m,dl(be.x,be.y,E,I,a.transform.angle),V,P,R,B.predicate).box.length===0)return}if(Re.box.length>0){let Ae;return a.prevPlacement&&a.prevPlacement.variableOffsets[he]&&a.prevPlacement.placements[he]&&a.prevPlacement.placements[he].text&&(Ae=a.prevPlacement.variableOffsets[he].anchor),a.variableOffsets[he]={textOffset:fe,width:g,height:x,anchor:r,textScale:w,prevAnchor:Ae},nu(q,r,U,X),q.allowVerticalPlacement&&(ou(q,X,U),a.placedOrientations[he]=X),{shift:be,placedGlyphBoxes:Re}}}}};class Wf{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&r.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(r,o,u,f,m,g){const x=this._bucketParts;for(;this._currentTileIndex<r.length;)if(o.getBucketParts(x,f,r[this._currentTileIndex],this._sortAcrossTiles,g),this._currentTileIndex++,m())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,x.sort((w,E)=>w.sortKey-E.sortKey));this._currentPartIndex<x.length;)if(o.placeLayerBucketPart(x[this._currentPartIndex],this._seenCrossTileIDs,u,g),this._currentPartIndex++,m())return!0;return!1}}class Xf{constructor(){this._retiredCI=null}startNewPlacement(r,o,u,f,m,g,x,w,E){return this.placement=new rh(r,f,m,m_[E||"default"],g,x,w,this._retiredCI),this._retiredCI=null,this._currentPlacementIndex=o.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=u,this._fadeDuration=f,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,o,u,f,m){const g=d.e.now(),x=()=>!this.isFullPlacementRequested()&&this._fadeDuration!==0&&this.placement.algorithm.shouldPause(d.e.now()-g);for(;this._currentPlacementIndex>=0;){const w=o[r[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(w.type==="symbol"&&w.visibility!=="none"&&(!w.minzoom||w.minzoom<=E)&&(!w.maxzoom||w.maxzoom>E)){const I=w,P=I.layout.get("symbol-z-elevate"),R=I.layout.get("symbol-sort-key").constantOr(1)!==void 0,B=I.layout.get("symbol-z-order"),V=B==="viewport-y"||B==="auto"&&!(B!=="viewport-y"&&R),U=I.layout.get("text-allow-overlap")||I.layout.get("icon-allow-overlap")||I.layout.get("text-ignore-placement")||I.layout.get("icon-ignore-placement"),Z=V&&U,q=this._inProgressLayer=this._inProgressLayer||new Wf(I),X=d.m(w.source,w.scope);if(q.continuePlacement(P||Z?f[X]:u[X],this.placement,this._showCollisionBoxes,w,x,m))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(r){return this._retiredCI=this.placement.prevPlacement?this.placement.prevPlacement.collisionIndex:null,this.placement.commit(r),this.placement}}const cc=512/d.a2/2;class __{constructor(r,o,u){this.tileID=r,this.bucketInstanceId=u,this.index=new d.d5(o.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const f=r.canonical.x*d.a2,m=r.canonical.y*d.a2;
vendor: 8,419 bytes, line 3405
3405for(let g=0;g<o.length;g++){const{key:x,crossTileID:w,tileAnchorX:E,tileAnchorY:I}=o.get(g),P=Math.floor((f+E)*cc),R=Math.floor((m+I)*cc);this.index.add(P,R),this.keys.push(x),this.crossTileIDs.push(w)}this.index.finish()}findMatches(r,o,u){const f=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z),m=cc/Math.pow(2,o.canonical.z-this.tileID.canonical.z),g=o.canonical.x*d.a2,x=o.canonical.y*d.a2;for(let w=0;w<r.length;w++){const E=r.get(w);if(E.crossTileID)continue;const{key:I,tileAnchorX:P,tileAnchorY:R}=E,B=Math.floor((g+P)*m),V=Math.floor((x+R)*m),U=this.index.range(B-f,V-f,B+f,V+f).sort((Z,q)=>Z-q);for(const Z of U){const q=this.crossTileIDs[Z];if(this.keys[Z]===I&&!u.has(q)){u.add(q),E.crossTileID=q;break}}}}}class Yf{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class cd{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const o=Math.round((r-this.lng)/360);if(o!==0)for(const u in this.indexes){const f=this.indexes[u],m={};for(const g in f){const x=f[g];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+o),m[x.tileID.key]=x}this.indexes[u]=m}this.lng=r}addBucket(r,o,u){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let m=0;m<o.symbolInstances.length;m++)o.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[r.overscaledZ]||(this.usedCrossTileIDs[r.overscaledZ]=new Set);const f=this.usedCrossTileIDs[r.overscaledZ];for(const m in this.indexes){const g=this.indexes[m];if(Number(m)>r.overscaledZ)for(const x in g){const w=g[x];w.tileID.isChildOf(r)&&w.findMatches(o.symbolInstances,r,f)}else{const x=g[r.scaledTo(Number(m)).key];x&&x.findMatches(o.symbolInstances,r,f)}}for(let m=0;m<o.symbolInstances.length;m++){const g=o.symbolInstances.get(m);g.crossTileID||(g.crossTileID=u.generate(),f.add(g.crossTileID))}return this.indexes[r.overscaledZ]===void 0&&(this.indexes[r.overscaledZ]={}),this.indexes[r.overscaledZ][r.key]=new __(r,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(r,o){for(const u of o.crossTileIDs)this.usedCrossTileIDs[r].delete(u)}removeStaleBuckets(r){let o=!1;for(const u in this.indexes){const f=this.indexes[u];for(const m in f)r[f[m].bucketInstanceId]||(this.removeBucketCrossTileIDs(u,f[m]),delete f[m],o=!0)}return o}}class sh{constructor(){this.layerIndexes={},this.crossTileIDs=new Yf,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(r,o,u,f){let m=this.layerIndexes[r.fqid];m===void 0&&(m=this.layerIndexes[r.fqid]=new cd);let g=!1;const x={};f.name!=="globe"&&m.handleWrapJump(u);for(const w of o){const E=w.getBucket(r);E&&r.fqid===E.layerIds[0]&&(E.bucketInstanceId||(E.bucketInstanceId=++this.maxBucketInstanceId),m.addBucket(w.tileID,E,this.crossTileIDs)&&(g=!0),x[E.bucketInstanceId]=!0)}return m.removeStaleBuckets(x)&&(g=!0),g}pruneUnusedLayers(r){const o={};r.forEach(u=>{o[u]=!0});for(const u in this.layerIndexes)o[u]||delete this.layerIndexes[u]}}class ud extends d.E{constructor(r){super(),this.requestManager=r,this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}async loadModel(r,o){try{const u=await this.requestManager.transformRequest(o,d.R.Model);return this.modelByURL[o]?(await $t(),Mt.loadModel?await Mt.loadModel(u.url,r,o):null):null}catch(u){if(u.status===404)return null;this.fire(new d.f(new Error(`Could not load model ${r} from ${o}`,{cause:u})))}}load(r,o,u={forceReload:!1}){this.models[o]||(this.models[o]=Object.create(null));const f=Object.keys(r),m=[],g=[];for(const x of f){const w=r[x];this.hasURLBeenRequested(w)&&!u.forceReload||(this.modelByURL[w]={modelId:x,scope:o},m.push(this.loadModel(x,w)),g.push(x)),this.models[o][x]||(this.models[o][x]={model:null,numReferences:1})}this.numModelsLoading[o]=(this.numModelsLoading[o]||0)+g.length,Promise.allSettled(m).then(x=>{for(let w=0;w<x.length;w++){const{status:E}=x[w];if(E==="rejected")continue;const{value:I}=x[w];this.models[o][g[w]]||(this.models[o][g[w]]={model:null,numReferences:1}),this.models[o][g[w]].model=I}this.numModelsLoading[o]-=g.length,this.fire(new d.h("data",{dataType:"style"}))}).catch(x=>{this.fire(new d.f(new Error(`Could not load models: ${x.message}`)))})}isLoaded(){for(const r in this.numModelsLoading)if(this.numModelsLoading[r]>0)return!1;return!0}hasModel(r,o,u={exactIdMatch:!1}){return!!(u.exactIdMatch?this.getModel(r,o):this.getModelByURL(this.modelUris[o][r]))}getModel(r,o){return this.models[o]||(this.models[o]=Object.create(null)),this.models[o][r]?this.models[o][r].model:void 0}getModelByURL(r){if(!r)return null;const o=this.modelByURL[r];return o?this.models[o.scope][o.modelId].model:null}hasModelBeenAdded(r,o){return this.models[o]&&this.models[o][r]!==void 0}getModelURIs(r){return this.modelUris[r]||Object.create(null)}addModel(r,o,u){this.models[u]||(this.models[u]=Object.create(null)),this.modelUris[u]||(this.modelUris[u]=Object.create(null));const f=this.requestManager.normalizeModelURL(o);if((this.hasModel(r,u,{exactIdMatch:!0})||this.hasModelBeenAdded(r,u))&&this.modelUris[u][r]===f)this.models[u][r].numReferences++;else if(this.hasURLBeenRequested(f)){const{scope:m,modelId:g}=this.modelByURL[f];this.models[m][g].numReferences++}else this.modelUris[u][r]=f,this.load({[r]:this.modelUris[u][r]},u)}addModelURLs(r,o){this.models[o]||(this.models[o]=Object.create(null)),this.modelUris[o]||(this.modelUris[o]=Object.create(null));const u=this.modelUris[o];for(const f of Object.keys(r))u[f]=this.requestManager.normalizeModelURL(r[f])}reloadModels(r){this.load(this.modelUris[r],r,{forceReload:!0})}addModelsFromBucket(r,o){this.models[o]||(this.models[o]=Object.create(null)),this.modelUris[o]||(this.modelUris[o]=Object.create(null));const u=Object.create(null);for(const f of r)this.hasModel(f,o,{exactIdMatch:!0})||this.hasURLBeenRequested(f)?this.models[o][f].numReferences++:this.modelUris[o][f]&&!this.hasURLBeenRequested(f)?u[f]=this.modelUris[o][f]:!this.hasURLBeenRequested(f)&&Le(f,!1)&&(this.modelUris[o][f]=this.requestManager.normalizeModelURL(f),u[f]=this.modelUris[o][f]);this.load(u,o)}hasURLBeenRequested(r){return this.modelByURL[r]!==void 0}removeModel(r,o,u=!1,f=!1){if(this.models[o]&&this.models[o][r]&&(this.models[o][r].numReferences--,this.models[o][r].numReferences===0||f)){const m=this.modelUris[o][r];u||delete this.modelUris[o][r],delete this.modelByURL[m];const g=this.models[o][r].model;if(!g)return;delete this.models[o][r],g.destroy()}}destroy(){for(const r of Object.keys(this.models))for(const o of Object.keys(this.models[r])){const u=this.models[r][o].model;delete this.models[r][o],u&&u.destroy()}this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}listModels(r){return this.models[r]||(this.models[r]=Object.create(null)),Object.keys(this.models[r])}upload(r,o){this.models[o]||(this.models[o]=Object.create(null));for(const u in this.models[o])this.models[o][u].model&&this.models[o][u].model.upload(r.context)}}const pl=["RENDER_SHADOWS","NORMAL_OFFSET"],ml=new Set(["symbol","circle"]),Ma=class ky{constructor(){this._queue=[],this._needsBuild=!0,this._idleHandle=null}needsBuild(){return this._needsBuild}buildQueue(r,o,u){this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._idleHandle=null,this._queue=[],this._needsBuild=!1;const f=!!u.fog,m=u.hasTerrain(),g=!(!u.projection||u.projection.name!=="globe"),x=m||g,w=!(!u.directionalLight||!u.directionalLight.shadowsEnabled()),E=u.map&&u.map.painter,I=!E||!E.context.extParallelShaderCompile,P=!!E&&E.emissiveMode==="mrt-fallback",R=(B,V=[],U={})=>{this._queue.push({programId:B,params:{...U.params,defines:V,overrideFog:!!U.fog,overrideTerrain:!!U.terrain,overrideGlobe:!!U.globe,overrideRtt:!!U.rtt,precompiled:!0}})};for(const B of r){if(B.visibility==="none")continue;const V=B.getProgramIds();if(V)for(const U of V){if(ml.has(U))continue;const Z=B.getDefaultProgramParams(U,o.zoom,u._styleColorTheme.lut);
3405if(!Z)continue;const q=E?E.getShaderSource(U):null,X=x&&(!q||q.usedDefines.has("RENDER_TO_TEXTURE")),ne=P&&X?(Z.defines||[]).concat("USE_MRT1"):Z.defines;if(I){R(U,Z.defines,{params:Z}),X&&R(U,ne,{params:Z,rtt:!0});continue}const oe=f&&(!q||q.usedDefines.has("FOG")),_e=m&&!B.isDraped()&&(!q||q.usedDefines.has("TERRAIN")),ae=g&&(!q||q.usedDefines.has("GLOBE")),ue=w&&B.hasElevation()&&(!q||q.usedDefines.has("RENDER_SHADOWS"));for(const he of ue?[!1,!0]:[!1]){const fe=he?(Z.defines||[]).concat(pl):Z.defines||[];for(const be of _e?[!1,!0]:[!1])for(const Re of ae?[!1,!0]:[!1])for(const Ae of oe?[!1,!0]:[!1])R(U,fe,{params:Z,fog:Ae,terrain:be,globe:Re})}X&&R(U,ne,{params:Z,rtt:!0})}}if(R("clippingMask"),m)for(const B of[!1,!0])R("terrainRaster",B?["TERRAIN_VERTEX_MORPHING"]:[],{terrain:!0,fog:f});if(!I){if(r.some(B=>B.type==="hillshade")&&R("hillshadePrepare"),w)for(const B of[!1,!0])for(const V of[!1,!0]){const U=[];B&&U.push("RENDER_CUTOFF"),U.push("RENDER_SHADOWS"),V&&U.push("NORMAL_OFFSET"),R("groundShadow",U),f&&R("groundShadow",U,{fog:!0})}if(g){for(const B of[[],["TERRAIN_VERTEX_MORPHING"],["GLOBE_POLES"]])for(const V of[!1,!0]){const U=[...B,"PROJECTION_GLOBE_VIEW"];V&&U.push("CUSTOM_ANTIALIASING"),R("globeRaster",U,{terrain:m,globe:!0,fog:f})}for(const B of[!1,!0]){const V=B?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];R("globeAtmosphere",V,{fog:!0,terrain:m,globe:B}),R("globeAtmosphere",[...V,"ALPHA_PASS"],{fog:!0,terrain:m,globe:B})}R("stars",[],{fog:f,terrain:m,globe:!0})}}}_executeBatch(r,o,u){if(u.map&&u.map.isMoving())return void(this._idleHandle=d.e.requestIdleCallback(x=>this._executeBatch(x,o,u)));o.context.sweepPendingPrograms();const f=o.context.extParallelShaderCompile?ky.DEADLINE_MARGIN_KHR_MS:ky.DEADLINE_MARGIN_SYNC_MS;let m=0;for(;this._queue.length>0;){const x=this._queue.shift();if(!x||(o.style=u,o._fogVisible=!!x.params.overrideFog,o.getOrCreateProgram(x.programId,x.params),m++,r.timeRemaining()<=f))break}const g=this._queue.length===0||r.timeRemaining()>f;m>0&&g&&o.context.gl.flush(),this._idleHandle=this._queue.length>0||o.context._pendingPrograms.size>0?d.e.requestIdleCallback(x=>this._executeBatch(x,o,u)):null}processQueue(r,o){this._queue.length!==0&&(this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._idleHandle=d.e.requestIdleCallback(u=>this._executeBatch(u,r,o)))}reset(){this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._queue=[],this._idleHandle=null,this._needsBuild=!0}};Ma.DEADLINE_MARGIN_KHR_MS=5,Ma.DEADLINE_MARGIN_SYNC_MS=25;let hd=Ma;const zs=d.s.colorTheme,Kf=new d.af({data:new d.ag(zs.data)});function dd(a){if(!a.metadata||!a.metadata.content_area)return;const r=d.e.devicePixelRatio,{left:o,top:u,width:f,height:m}=a.metadata.content_area,g=o*r,x=u*r;return[g,x,g+f*r,x+m*r]}function fd(a){if(a)return a.map(([r,o])=>[r*d.e.devicePixelRatio,o*d.e.devicePixelRatio])}class uc{constructor(r,o,u){this.id=r,this.scope=o,this.sourceCache=u,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(r){this.missingRequests.has(r.name)||this.pendingRequests.has(r.name)||this.pendingRequests.add(r.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const r=new Map;if(!this.sourceCache.loaded())return r;const o=this.sourceCache.getVisibleCoordinates();if(o.length===0)return r;const u=this.sourceCache.getSource();if(u.type!=="raster-array")return r;const f=o.map(g=>this.sourceCache.getTile(g)),m=u.getImages(f,Array.from(this.pendingRequests));for(const[g,x]of m)r.set(d.I.from({name:g,iconsetId:this.id}),x),this.pendingRequests.delete(g);for(const g of this.pendingRequests)this.missingRequests.add(g);return this.pendingRequests.clear(),r}}const Fs=(a,r)=>ya(a,r&&r.filter(o=>o.identifier!=="source.canvas")),_l=(a,r)=>{const o=a.type&&!a.array&&Array.isArray(r)?{type:a.type,"property-type":"data-constant"}:void 0;return d.c(r,o)},g_=new Set(["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"]),Jf=new Set(["setCenter","setZoom","setBearing","setP
3405itch"]),su=new Set(["background","sky","slot","custom"]),au={version:8,layers:[],sources:{}},gl={duration:300,delay:0};class Ra extends d.E{constructor(r,o={}){super(),this.map=r,this.scope=o.scope||"",this.globalId=null,this.fragments=[],this.importDepth=o.importDepth||0,this.importsCache=o.importsCache||new Map,this.resolvedImports=o.resolvedImports||new Set,this.transition={...gl},this._buildingIndex=new Hf(this),this.crossTileSymbolIndex=new sh,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers=Object.create(null),this._mergedIndoor={},this._indoorEnabled=!1,this._mergedSourceCaches={},this._mergedOtherSourceCaches=Object.create(null),this._mergedSymbolSourceCaches=Object.create(null),this._mergedFillExtrusionSourceCaches=Object.create(null),this._mergedHdRoadCoverageSourceCaches=Object.create(null),this._mergedHdRoadElevationSourceCaches=Object.create(null),this._hdCoverage=null,this._hdElevation=null,this._crossSourceElevationActive=!1,this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=o.styleChanges||new js,this._hasDataDrivenEmissive=!1,this.indoorManager=null,this.dispatcher=o.dispatcher?o.dispatcher:new At(od(),this);const u={referrer:d.d7(),config:d.dn()};if(this.map.painter&&this.map.painter.context){const m=this.map.painter.context.maxUniformBufferBindings,g=Math.floor(this.map.painter.context.maxUniformBlockSize/4);u.contextOptions={maxBindingPoints:m,maxUniformBlockSizeDwords:g}}this.isRootStyle()&&this.dispatcher.broadcast("setGlobalParams",u),o.imageManager?this.imageManager=o.imageManager:(this.imageManager=new ar(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=o.glyphManager?o.glyphManager:new d.d8(r._requestManager,o.localFontFamily?d.d9.all:o.localIdeographFontFamily?d.d9.ideographs:d.d9.none,o.localFontFamily||o.localIdeographFontFamily,o.fontstackCompositing),o.modelManager?this.modelManager=o.modelManager:(this.modelManager=new ud(r._requestManager),this.modelManager.setEventedParent(this)),this._layers=Object.create(null),this._sourceCaches={},this._otherSourceCaches=Object.create(null),this._symbolSourceCaches=Object.create(null),this._fillExtrusionSourceCaches=Object.create(null),this._hdCoverage=null,this._hdElevation=null,this._crossSourceElevationActive=!1,this._loaded=!1,this._initialBroadcastDone=!1,this._programPrecompiler=this.map._precompilePrograms&&this.isRootStyle()?new hd:null,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=o.configOptions?o.configOptions:new Map,this._layerExpressionDependencies=o.layerExpressionDependencies?o.layerExpressionDependencies:new Map,this._config=o.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:o.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=o.initialConfig;const f=this;this._rtlTextPluginCallback=Ra.registerForPluginStateChange(m=>{f.dispatcher.send("syncRTLPluginState",{pluginStatus:m.pluginStatus,pluginURL:m.pluginURL}).then(g=>{if(d.da(null),g.every(x=>x))for(const x in f._sourceCaches){const w=f._sourceCaches[x],E=w.getSource().type;E!=="vector"&&E!=="geojson"||w.reload()}}).catch(g=>{d.da(g)})}),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const g=this.getOwnSource(m.sourceId);if(g&&g.vectorLayerIds)for(const x in this._layers){const w=this._layers[x];w.source===g.id&&this._validateLayer(w)}})}load(r){return r?(typeof r=="string"?this.loadURL(r):this.loadJSON(r),this):this}_getGlobalId(r){if(!r)return null;if(typeof r=="string"){if(d.cg(r))return r;const o=d.db(r);if(!o.startsWith("http"))try{return new URL(o,location.href).toString()}catch{return o}return o}return`json://${d.dc(JSON.stringify(r))}`}_diffStyle(r,o,u){this.globalId=this._getGlobalId(r),jo();const f=(m,g)=>{try{g(null,this.setState(m,u))}catch(x){g(x,!1)}};if(typeof r=="string"){const m=this.map._requestManager.normalizeStyleURL(r),g=new AbortController;this._request={cancel:()=>g.abort()},(async()=>{const x=await this.map._requestManager.transformRequest(m,d.R.Style,g.signal),{data:w}=await d.g(x,g.signal);this._request=null,f(w,o)})().catch(x=>{this._request=null,g.signal.aborted||this.fire(new d.f(x))})}else typeof r=="object"&&f(r,o)}loadURL(r,o={}){this.fire(new d.h("dataloading",{dataType:"style"}));const u=typeof o.validate=="boolean"?o.validate:!d.cg(r);u&&jo(),this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,o.accessToken),this.resolvedImports.add(r);const f=this.importsCache.get(r);if(f)return void this._load(f,u);const m=new AbortController;this._request={cancel:()=>m.abort()},(async()=>{const g=await this.map._requestManager.transformRequest(r,d.R.Style,m.signal),{data:x}=await d.g(g,m.signal);this._request=null,this.importsCache.set(r,x),this._load(x,u)})().catch(g=>{this._request=null,m.signal.aborted||this.fire(new d.f(g))})}loadJSON(r,o={}){this.fire(new d.h("dataloading",{dataType:"style"}));const u=o.validate!==!1;u&&jo(),this.globalId=this._getGlobalId(r),this._request=d.e.frame(()=>{this._request=null,this._load(r,u)})}loadEmpty(){this.fire(new d.h("dataloading",{dataType:"style"})),this._load(au,!1)}_loadImports(r,o,u){if(this.importDepth>=4)return d.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const f=[];for(const m of r){const g=this._createFragmentStyle(m),x=new Promise(I=>{g.once("style.import.load",I),g.once("error",I)}).then(()=>{this.mergeAll(),this.fire(new d.h("data",{dataType:"style"}))});if(f.push(x),this.resolvedImports.has(m.url)){g.loadEmpty();continue}const w=m.data||this.importsCache.get(m.url);w?(m.data?(g.fire(new d.h("dataloading",{dataType:"style"})),g.globalId=g._getGlobalId(w),o&&jo(),queueMicrotask(()=>{g._load(w,o)})):g.loadJSON(w,{validate:o}),this._isInternalStyle(w)&&(g.globalId=null)):m.url?g.loadURL(m.url,{validate:o}):g.loadEmpty();const E={style:g,id:m.id,config:m.config};if(u){const I=this.fragments.findIndex(({id:P})=>P===u);this.fragments=this.fragments.slice(0,I).concat(E).concat(this.fragments.slice(I))}else this.fragments.push(E)}return Promise.allSettled(f)}getImportGlobalIds(r=this,o=new Set){for(const u of r.fragments)u.style.globalId&&o.add(u.style.globalId),this.getImportGlobalIds(u.style,o);return[...o.values()]}_createFragmentStyle(r){const o=this.scope?d.m(r.id,this.scope):r.id;let u;const f=this._initialConfig&&this._initialConfig[o];(r.config||f)&&(u={...r.config,...f});const m=new Ra(this.map,{scope:o,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:u,configOptions:this.options,colorThemeOverride:r["color-theme"],layerExpressionDependencies:this._layerExpressionDependencies});return m.setEventedParent(this.map,{style:m}),m}_reloadImports(r=!1){this.mergeAll(),this._updateMapProjection(),r||this.updateConfigDependencies(),this._updateLayers(this._dependentLayerIds(o=>o.isIndoorDependent)),this.map._triggerCameraUpdate(this.camera),(!r||this.isRootStyle()||this.map.style._initialBroadcastDone)&&(r&&this.isRootStyle()?(this.forEachFragmentStyle(o=>{this.dispatcher.broadcast("setLayers",{layers:o._serializeLayers(o._order),scope:o.scope,options:o.options})}),this._initialBroadcastDone=!0):this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}))}_isInternalStyle(r){return this.isRootStyle()&&(r.fragment||!!r.schema&&r.fragment!==!1)}async _load(r,o){if(this._isInternalStyle(r)){const m={id:"basemap",data:r,url:""},g={...au,imports:[m],...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(g,o)}if(this.updateConfig(this._config,r.schema),o&&(await jo(),!this.dispatcher.actors.length||Fs(this,no(r))))return;this._loaded=!0;for(const m in r.sources)this.addSource(m,r.sources[m],{validate:!1,isInitialLoad:!0});this.stylesheet=d.dd(r);const u=()=>{if(r.iconsets)for(const E in r.iconsets)this.addIconset(E,r.iconsets[E]);r.sprite?this._loadIconset(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope})),!this.glyphManager.url&&r.glyphs&&this.glyphManager.setURL(r.glyphs);
3405const m=iu(this.stylesheet.layers);if(this._order=m.map(E=>E.id),this.stylesheet.light&&d.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const E=this.stylesheet.lights[0];this.light=new Q(E.properties,E.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Q(this.stylesheet.light)),this._layers=Object.create(null);let g=!1;for(const E of m){const I=d.di(E,this.scope,this._styleColorTheme.lut,this.options);this._layerExpressionDependencies.set(I.fqid,new Gs(I)),this._hasAppearances=this._hasAppearances||I.getAppearances().length!==0,I.setEventedParent(this,{layer:{id:I.id}}),this._layers[I.id]=I,this._updateHdCoverageSourceCache(I)&&(g=!0);const P=this.getOwnLayerSourceCache(I),R=!!this.directionalLight&&this.directionalLight.shadowsEnabled();P&&I.canCastShadows()&&R&&(P.castsShadows=!0)}if(g&&Zn().then(()=>{if(!this.map)return;for(const I in this._layers)this._updateHdCoverageSourceCache(this._layers[I]);this.map.style.mergeAll();const E=this.map.transform;for(const I in this.map.style._mergedHdRoadCoverageSourceCaches){const P=this.map.style._mergedHdRoadCoverageSourceCaches[I];P.used=!0,E&&P.update(E)}this.map._update()}),this.glyphManager.url){const E=new Set;for(const I in this._layers){const P=this._layers[I];if(P.type==="symbol"&&P.layout){const R=P.layout.get("text-font");R&&R.value&&R.value.kind==="constant"&&E.add(R.value.value.join(","))}}for(const I of E)this.glyphManager.prefetchRange(I,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const x=this.stylesheet.terrain;x&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(x,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 d.h("data",{dataType:"style"}));const w=this.isRootStyle();r.imports?this._loadImports(r.imports,o).then(()=>{this._reloadImports(!0),this.fire(new d.h(w?"style.load":"style.import.load"))}).catch(E=>{this.fire(new d.f(new Error("Failed to load imports",E))),this.fire(new d.h(w?"style.load":"style.import.load"))}):(this._reloadImports(!0),this.fire(new d.h(w?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const f=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(f){const m=this._evaluateColorThemeData(f);this._loadColorTheme(m).then(()=>{u()}).catch(g=>{d.w(`Couldn't load color theme from the stylesheet: ${g}`),u()})}else this._styleColorTheme.lut=null,u()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(r=>r.style.hasAppearances())}mergeAll(){let r,o,u,f,m,g,x,w,E,I;const P={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(R=>{if(R.stylesheet){if(R.disableElevatedTerrain&&(this.disableElevatedTerrain=!0),R.light!=null&&(r=R.light),R.stylesheet.lights)for(const B of R.stylesheet.lights)B.type==="ambient"&&R.ambientLight!=null&&(o=R.ambientLight),B.type==="directional"&&R.directionalLight!=null&&(u=R.directionalLight);f=this._prioritizeTerrain(f,R.terrain,R.stylesheet.terrain),R.stylesheet.fog&&R.fog!=null&&(m=R.fog),R.stylesheet.snow&&R.snow!=null&&(g=R.snow),R.stylesheet.rain&&R.rain!=null&&(x=R.rain),R.stylesheet.camera!=null&&(I=R.stylesheet.camera),R.stylesheet.projection!=null&&(w=R.stylesheet.projection),R.stylesheet.transition!=null&&(E=R.stylesheet.transition),P[R.scope]=R._styleColorTheme}}),this.light=r,this.ambientLight=o,this.directionalLight=u,this.fog=m,this.snow=g,this.rain=x,this._styleColorThemeForScope=P,f===null?delete this.terrain:this.terrain=f,this.camera=I||{"camera-projection":"perspective"},this.projection=w||{name:"mercator"},this.transition={...gl,...E},this.mergeSources(),this.mergeLayers(),this.mergeIndoor(),this._programPrecompiler&&this._programPrecompiler.reset()}forEachFragmentStyle(r){const o=u=>
3405{for(const f of u.fragments)o(f.style);r(u)};o(this)}_prioritizeTerrain(r,o,u){const f=r&&r.drapeRenderMode===0;return u===null?o&&o.drapeRenderMode===0?o:f?r:null:o!=null&&(!r||f||o&&o.drapeRenderMode===1)?o:r}mergeTerrain(){let r;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(o=>{r=this._prioritizeTerrain(r,o.terrain,o.stylesheet.terrain)}),r===null?delete this.terrain:this.terrain=r,this._programPrecompiler&&this._programPrecompiler.reset()}mergeProjection(){let r;this.forEachFragmentStyle(o=>{o.stylesheet.projection!=null&&(r=o.stylesheet.projection)}),this.projection=r||{name:"mercator"},this._programPrecompiler&&this._programPrecompiler.reset()}mergeSources(){const r={},o=Object.create(null),u=Object.create(null),f=Object.create(null),m=Object.create(null),g=Object.create(null);this.forEachFragmentStyle(x=>{for(const w in x._sourceCaches){const E=d.m(w,x.scope);r[E]=x._sourceCaches[w]}for(const w in x._otherSourceCaches){const E=d.m(w,x.scope);o[E]=x._otherSourceCaches[w]}for(const w in x._symbolSourceCaches){const E=d.m(w,x.scope);u[E]=x._symbolSourceCaches[w]}for(const w in x._fillExtrusionSourceCaches){const E=d.m(w,x.scope);f[E]=x._fillExtrusionSourceCaches[w]}if(x._hdCoverage){const w=x._hdCoverage.coverageSourceCaches;for(const E in w)m[d.m(E,x.scope)]=w[E]}if(x._hdElevation){const w=x._hdElevation.elevationSourceCaches;for(const E in w)g[E]=w[E]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=o,this._mergedSymbolSourceCaches=u,this._mergedFillExtrusionSourceCaches=f,this._mergedHdRoadCoverageSourceCaches=m,this._mergedHdRoadElevationSourceCaches=g,Object.keys(m).length>0&&!this._hdCoverage&&Et.HdCoverageState&&(this._hdCoverage=new Et.HdCoverageState),Et.updateCrossSourceElevationGate&&Et.updateCrossSourceElevationGate(this)}mergeIndoor(){this._mergedIndoor={},this.forEachFragmentStyle(r=>{if(r.stylesheet&&r.stylesheet.indoor)for(const o of Object.values(r.stylesheet.indoor)){const u=o,f=d.m(u.sourceId,r.scope);this._mergedIndoor[f]=new Set(u.sourceLayers||[])}}),this._updateIndoorEnabled()}_updateIndoorEnabled(){const r=this._indoorEnabled;if(this._indoorEnabled=!1,Object.keys(this._mergedIndoor).length>0)for(const o of this._mergedOrder){const u=this._mergedLayers[o];if(u.visibility!=="none"&&this._mergedIndoor[d.m(u.source,u.scope)]){this._indoorEnabled=!0;break}}!this._indoorEnabled||r||this.indoorManager||Zn().then(()=>{this._initIndoorManager()})}_initIndoorManager(){if(!this.indoorManager&&Et.IndoorManager&&this.isRootStyle()&&Object.keys(this._mergedIndoor).length!==0&&(this.indoorManager=new Et.IndoorManager(this,this._loaded),this._loaded))for(const r of Object.keys(this._mergedIndoor)){const o=this._mergedSourceCaches[r]||this._mergedOtherSourceCaches[r];o&&o.reload()}}mergeLayers(){const r={},o=[],u=Object.create(null);this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(g=>{for(const x of g._order){const w=g._layers[x];if(w.type==="slot"){const E=d.bV(x);if(r[E])continue;r[E]=[]}w.slot&&r[w.slot]?r[w.slot].push(w):o.push(w)}}),this._mergedOrder=[];let f=-1;const m=(g=[])=>{for(const x of g)if(x.type==="slot"){const w=d.bV(x.id);r[w]&&m(r[w]),this._mergedSlots.push(w)}else{const w=d.m(x.id,x.scope);this._mergedOrder.push(w),u[w]=x,x.is3D(!!this.terrain)&&(this._has3DLayers=!0,f=this._mergedOrder.length-1),x.type==="circle"&&(this._hasCircleLayers=!0),x.type==="symbol"&&(this._hasSymbolLayers=!0),x.type==="clip"&&(this._clipLayerPresent=!0)}};if(m(o),this._has3DLayers){const g={};for(let x=0;x<this._mergedOrder.length;++x){const w=this._mergedOrder[x];g[w]=x===f?1:x<f?u[w].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((x,w)=>g[x]-g[w])}this._mergedLayers=u,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(r){return this.stylesheet.camera={...this.stylesheet.camera,...r},this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?function(o,u,f){const m={...u};for(const x of Object.keys(zs))m[x]===void 0&&(m[x]=zs[x].default);const g=new d.ae(Kf,o,new Map(f));return g.setTransitionOrValue(m,f),g.untransitioned().possiblyEvaluate(new d.ai(0,{worldview:void 0}))}(this.scope,r,this.options).get("data"):null}_loadColorTheme(r){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const o=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((u,f)=>{const m="data:image/png;base64,";if(!r||r.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void u();let g=r;g.startsWith(m)||(g=m+g);const x=d.I.from("mapbox-reserved-lut"),w=new Image;w.src=g,w.onerror=()=>
3405{this._styleColorTheme.lutLoading=!1,f(new Error("Failed to load image data"))},w.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==o)return void u();this._styleColorTheme.lutLoading=!1;const{width:E,height:I,data:P}=d.e.getImageData(w);if(I>32)return void f(new Error("The height of the image must be less than or equal to 32 pixels."));if(E!==I*I)return void f(new Error("The width of the image must be equal to the height squared."));this.getImage(x)&&this.removeImage(x),this.addImage(x,{data:new d.b({width:E,height:I},P),pixelRatio:1,sdf:!1,usvg:!1,version:0});const R=this.imageManager.getImage(x,this.scope);R?(this._styleColorTheme.lut={image:R.data,data:r},u()):f(new Error("Missing LUT image."))}})}getLut(r){const o=this._styleColorThemeForScope[r];return o?o.lut:null}setProjection(r){r?this.stylesheet.projection=r: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.hasTerrain()||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(r){const o=new AbortController;this._spriteRequest=o,function(u,f,m,g){let x,w,E;const I=d.e.devicePixelRatio>1?"@2x":"";function P(R){E||R&&m.aborted||(R&&(E=R),function(){if(E)g(E);else if(x&&w){const B=d.e.getImageData(w),V={};for(const U in x){const{width:Z,height:q,x:X,y:ne,sdf:oe,pixelRatio:_e,stretchX:ae,stretchY:ue,content:he}=x[U],fe=new d.b({width:Z,height:q});d.b.copy(B,fe,{x:X,y:ne},{x:0,y:0},{width:Z,height:q},null),V[U]={data:fe,pixelRatio:_e!==void 0?_e:1,sdf:oe!==void 0&&oe,stretchX:ae,stretchY:ue,content:he,usvg:!1,version:0}}g(null,V)}}())}(async function(){const R=await f.transformRequest(f.normalizeSpriteURL(u,I,".json"),d.R.SpriteJSON,m),{data:B}=await d.g(R,m);E||(x=B)})().then(()=>P(void 0),R=>P(R)),async function(){const R=await f.transformRequest(f.normalizeSpriteURL(u,I,".png"),d.R.SpriteImage,m),{data:B}=await d.a(R,m);E||(w=B)}().then(()=>P(void 0),R=>P(R))}(r,this.map._requestManager,o.signal,(u,f)=>{if(this._spriteRequest=null,u)this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this.fire(new d.f(u));else if(f){const m=new Map;for(const g in f)m.set(d.I.from(g),f[g]);this.addImages(m,!0)}this.imageManager.setLoaded(!0,this.scope),this.fire(new d.h("data",{dataType:"style"}))})}addIconset(r,o){if(o.type==="sprite")return void this._loadSprite(o.url);const u=this.getOwnSourceCache(o.source);if(!u)return void this.fire(new d.f(new Error(`Source "${o.source}" as specified by iconset "${r}" does not exist and cannot be used as an iconset source`)));const f=u.getSource();if(f.type!=="raster-array")return void this.fire(new d.f(new Error(`Source "${o.source}" as specified by iconset "${r}" is not a "raster-array" source and cannot be used as an iconset source`)));f.partial=!1;const m=new uc(r,this.scope,u);this.imageManager.addImageProvider(m,this.scope)}removeIconset(r){this.imageManager.removeImageProvider(r,this.scope)}_loadIconset(r){if(!d.cg(r)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(r);const o=this.map._spriteFormat==="auto",u=new AbortController;this._spriteRequest=u,async function(f,m,g,x){try{const w=await m.transformRequest(m.normalizeIconsetURL(f),d.R.Iconset,g),{data:E}=await d.cC(w,g),I={},P=function(R){const B={icons:[]};let V;for(;V=R.nextField(void 0);)V===1&&B.icons.push(Uu(R,R.readVarint()+R.pos));return B}(new d.cB(E));for(const R of P.icons){const B={version:1,pixelRatio:d.e.devicePixelRatio,content:dd(R),stretchX:R.metadata?fd(R.metadata.stretch_x_areas):void 0,stretchY:R.metadata?fd(R.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:R};I[R.name]=B}x(null,I)}catch(w){g.aborted||x(w)}}(r,this.map._requestManager,u.signal,(f,m)=>{if(this._spriteRequest=null,f)o?this._loadSprite(r):(this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this.fire(new d.f(f)));else if(m){const g=new Map;for(const x in m)g.set(d.I.from(x),m[x]);this.addImages(g,!0)}this.imageManager.setLoaded(!0,this.scope),this.fire(new d.h("data",{dataType:"style"}))})}_validateLayer(r){const o=this.getOwnSource(r.source);if(!o)return;const u=r.sourceLayer;u&&(o.type==="geojson"||o.vectorLayerIds&&!o.vectorLayerIds.includes(u))&&this.fire(new d.f(ne
vendor: 4,376 bytes, line 3405
3405w Error(`Source layer "${u}" does not exist on source "${o.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const r in this._sourceCaches)if(!this._sourceCaches[r].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:r}of this.fragments)if(!r.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((r,o)=>{const u=this.fragments[o];return u&&u.style&&(r.data=u.style.serialize()),r})}_serializeSources(){const r={};for(const o in this._sourceCaches){const u=this._sourceCaches[o].getSource();r[u.id]||(r[u.id]=u.serialize())}return r}_serializeLayers(r){const o=[];for(const u of r){const f=this._layers[u];f&&f.type!=="custom"&&o.push(f.serialize())}return o}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(const r in this._sourceCaches)if(this._sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const r in this._mergedLayers){const o=this._mergedLayers[r];if(o._transitionablePaint&&o._transitionablePaint._values){const u=o._transitionablePaint._values["line-emissive-strength"];if(u&&u.value&&u.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(r){return r?this.order:this._mergedOrder}isLayerDraped(r){return!!this.terrain&&r.isDraped(this.getLayerSourceCache(r))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(r){const o=this.getOwnLayer(r);if(o)return o;this.fire(new d.f(new Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){const o=this.getOwnSource(r);if(o)return o;this.fire(new d.f(new Error(`The source '${r}' does not exist in the map's style.`)))}handleIdle(){const r=this.map.painter;r&&(r.context.sweepPendingPrograms(),this._programPrecompiler&&this._programPrecompiler.processQueue(r,this))}handleContextLost(){this._programPrecompiler&&this._programPrecompiler.reset()}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);const o=this.calculateLightsBrightness();r.brightness=o||0;let u=!1;o!==this._brightness&&(this._brightness=o,u=!0),r.worldview!==this._worldview&&(this._worldview=r.worldview,u=!0),u&&this.dispatcher.broadcast("upsertRenderParams",{brightness:this._brightness,worldview:this._worldview});const f=this._changes.isDirty();let m=!1;if(this._changes.isDirty()){const E=this._changes.getLayerUpdatesByScope();for(const I in E){const{updatedIds:P,removedIds:R}=E[I];(P||R)&&(this._updateWorkerLayers(I,P,R),m=!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()}const g={};for(const E in this._mergedSourceCaches){const I=this._mergedSourceCaches[E];g[E]=I.used,I.used=!1,I.tileCoverLift=0}const x={};for(const E of this._mergedOrder){const I=this._mergedLayers[E];if((I.visibility!=="none"||I.hasTransition())&&I.recalculate(r,this._availableImages),!I.isHidden(r.zoom)){I.mayUse("HD")&&(I.prepare(),Zn()),I.mayUse("Standard")&&(I.prepare(),$t());const P=this.getLayerSourceCache(I);P&&(P.used=!0,P.tileCoverLift=Math.max(P.tileCoverLift,I.tileCoverLift()))}
vendor: 4,188 bytes, line 3405
3405if(I.source){const P=d.m(I.source,I.scope),R=this._mergedHdRoadCoverageSourceCaches[P];R&&!R.used&&(R.used=!0)}if(I.type==="fill-extrusion"){const P=d.m(I.source,I.scope);if(P in this._mergedFillExtrusionSourceCaches){const R=I.layout&&I.layout.get("source-max-zoom");if(R!=null){const B=x[P];x[P]=B==null?R:Math.min(B,R)}}}}if(this._programPrecompiler&&this._programPrecompiler.needsBuild()){const E=this._mergedOrder.map(I=>this._mergedLayers[I]);this._programPrecompiler.buildQueue(E,r,this)}for(const E in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[E].setMaxzoomOverride(x[E]??null);this.terrain&&m&&this.mergeLayers();const w=this.imageManager.getPendingImageProviders();for(const E of w)E.sourceCache.used=!0;for(const E in g){const I=this._mergedSourceCaches[E];g[E]!==I.used&&I.getSource().fire(new d.h("data",{sourceDataType:"visibility",dataType:"source",sourceId:I.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),f&&this.fire(new d.h("data",{dataType:"style"}))}updateImageProviders(){const r=this.imageManager.getPendingImageProviders();for(const o of r){const u=o.resolvePendingRequests(),f=this.getFragmentStyle(o.scope);f&&f.addImages(u)}}_updateTilesForChangedImages(){const r={};for(const o in this._mergedSourceCaches){const u=this._mergedSourceCaches[o].getSource().scope;r[u]=r[u]||this._changes.getUpdatedImages(u),r[u].length!==0&&this._mergedSourceCaches[o].reloadTilesForDependencies(["icons","patterns"],r[u])}for(const o in r)this._changes.resetUpdatedImages(o)}_updateWorkerLayers(r,o,u){const f=this.getFragmentStyle(r);f&&this.dispatcher.broadcast("updateLayers",{layers:o?f._serializeLayers(o):[],scope:r,removedIds:u||[],options:f.options})}setState(r,o){if(this._checkLoaded(),Fs(this,no(r)))return!1;if((r=d.dd(r)).layers=iu(r.layers),!Gn.diffStyles)throw new Error("Debug module not loaded; cannot diff style.");const u=Gn.diffStyles(this.serialize(),r).filter(g=>!Jf.has(g.command));if(u.length===0)return!1;const f=u.filter(g=>!g_.has(g.command));if(f.length>0)throw new Error(`Unimplemented: ${f.map(g=>g.command).join(", ")}.`);const m=[];return u.forEach(g=>{m.push(this[g.command](...g.args))}),o&&Promise.all(m).then(o).catch(o),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(r=!1){this._availableImages=this.imageManager.listImages(this.scope);const o={scope:this.scope,images:this._availableImages};r&&(o.isSpriteLoaded=!0),this.dispatcher.broadcast("setImages",o)}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(r,o){if(r.size===0)return o&&this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this;for(const[u,f]of r.entries()){if(this.getImage(u))return this.fire(new d.f(new Error(`An image with the name "${u.name}" already exists.`)));this.imageManager.addImage(u,this.scope,f),this._changes.updateImage(u,this.scope)}return this._updateWorkerImages(o),this.fire(new d.h("data",{dataType:"style"})),this}addImage(r,o){return this.getImage(r)?this.fire(new d.f(new Error(`An image with the name "${r.name}" already exists.`))):(this.imageManager.addImage(r,this.scope,o),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new d.h("data",{dataType:"style"})),this)}updateImage(r,o,u=!1){this.imageManager.updateImage(r,this.scope,o),u&&(this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new d.h("data",{dataType:"style"})))}getImage(r){return this.imageManager.getImage(r,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 d.h("data",{dataType:"style"}
vendor: 6,912 bytes, line 3405
3405)),this):this.fire(new d.f(new 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 d.h("data",{dataType:"style"})),this}addModel(r,o,u={}){return this._checkLoaded(),this._validate($,`models.${r}`,o,null,u)||(this.modelManager.addModel(r,o,this.getActualScope()),this.fire(new d.h("data",{dataType:"style"}))),this}hasModel(r){return this.modelManager.hasModel(r,this.getActualScope())}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.getActualScope(),!1,!0),this.fire(new d.h("data",{dataType:"style"})),this):this.fire(new d.f(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(r,o,u={}){if(this._checkLoaded(),this.getOwnSource(r)!==void 0)throw new Error(`There is already a source with ID "${r}".`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(o.type)&&this._validate(Xu,`sources.${r}`,o,null,u))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const f=Object.hasOwn(ia,o.type)&&!Aa(o.type),m=f?new h_(r,o,this.dispatcher,this):ih(r,o,this.dispatcher,this);m.scope=this.scope;const g=w=>{w.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(w.id),source:w.serialize(),sourceId:w.id}))};g(m);const x=w=>{const E=(w===d.bR.Symbol?"symbol:":w===d.bR.FillExtrusion?"fill-extrusion:":"other:")+m.id,I=d.m(E,this.scope),P=this._sourceCaches[E]=new En(I,m,w);w===d.bR.Symbol?this._symbolSourceCaches[m.id]=P:w===d.bR.FillExtrusion?this._fillExtrusionSourceCaches[m.id]=P:this._otherSourceCaches[m.id]=P,P.onAdd(this.map)};x(d.bR.Other),o.type!=="vector"&&o.type!=="geojson"||(x(d.bR.Symbol),o.type==="vector"&&x(d.bR.FillExtrusion)),m.onAdd&&m.onAdd(this.map),f&&async function(w){if(Aa(w))return;const E=ia[w];if(!E)throw new Error(`Unknown source type "${w}"`);const I=await E();I&&!Aa(w)&&function(P,R){Sn[P]=R}(w,I)}(o.type).then(()=>{const w=Aa(o.type),E=this._otherSourceCaches[r];if(!E||E.getSource()!==m)return;if(!w)return void this.fire(new d.f(new Error(`Could not load module for source type "${o.type}".`)));const I=ih(r,o,this.dispatcher,this);I.scope=this.scope,g(I),E.setSource(I),I.onAdd&&I.onAdd(this.map),this._changes.setDirty()}),u.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();const o=this.getOwnSource(r);if(!o)throw new Error("There is no source with this ID");for(const f in this._layers)if(this._layers[f].source===r)return this.fire(new d.f(new Error(`Source "${r}" cannot be removed while layer "${f}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new d.f(new Error(`Source "${r}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const f=Object.entries(this.stylesheet.iconsets).find(([m,g])=>g.type==="source"&&g.source===r);if(f)return this.fire(new d.f(new Error(`Source "${r}" cannot be removed while iconset "${f[0]}" is using it.`)))}const u=this.getOwnSourceCaches(r);for(const f of u){const m=d.bV(f.id);delete this._sourceCaches[m],this._changes.discardSourceCacheUpdate(f.id),f.fire(new d.h("data",{sourceDataType:"metadata",dataType:"source",sourceId:f.getSource().id})),f.setEventedParent(null),f.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],delete this._fillExtrusionSourceCaches[r],this._hdCoverage&&delete this._hdCoverage.coverageSourceCaches[r],this._hdElevation&&delete this._hdElevation.elevationSourceCaches[d.m(r,this.scope)],this.mergeSources(),o.setEventedParent(null),o.onRemove&&o.onRemove(this.map),this.dispatcher.broadcast("removeSource",{type:o.type,source:r,scope:o.scope}),this._changes.setDirty(),this}setGeoJSONSourceData(r,o){this._checkLoaded(),this.getOwnSource(r).setData(o),this._changes.setDirty()}getOwnSource(r){const o=this.getOwnSourceCache(r);return o&&o.getSource()}getOwnSources(){const r=[];for(const o in this._otherSourceCaches){const u=this.getOwnSourceCache(o);u&&r.push(u.getSource())}return r}areTilesLoaded(){const r=this._mergedSourceCaches;for(const o in r){const u=r[o]._tiles;for(const f in u){const m=u[f];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}setLights(r){if(this._checkLoaded(),this._programPrecompiler&&this._programPrecompiler.reset(),!r)return delete this.ambientLight,void delete this.directionalLight;const o=this._getTransitionParameters();for(const m of r){if(this._validate(Ql,"lights",m))return;switch(m.type){case"ambient":if(this.ambientLight){const g=this.ambientLight;g.set(m),g.updateTransitions(o)}else this.ambientLight=new Nt(m,Ht(),this.scope,this.options);break;case"directional":if(this.directionalLight){const g=this.directionalLight;g.set(m),g.updateTransitions(o)}else this.directionalLight=new Nt(m,xi(),this.scope,this.options)}}const u=Object.assign(o,{worldview:this.map.getWorldview()}),f=new d.ai(this.z||0,u);this.ambientLight&&this.ambientLight.recalculate(f),this.directionalLight&&this.directionalLight.recalculate(f),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("upsertRenderParams",{brightness:this._brightness})}calculateLightsBrightness(){const r=this.directionalLight,o=this.ambientLight;if(!r||!o)return;const u=R=>.2126*(R[0]<=.03928?R[0]/12.92:Math.pow((R[0]+.055)/1.055,2.4))+.7152*(R[1]<=.03928?R[1]/12.92:Math.pow((R[1]+.055)/1.055,2.4))+.0722*(R[2]<=.03928?R[2]/12.92:Math.pow((R[2]+.055)/1.055,2.4)),f=r.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),m=r.properties.get("intensity"),g=r.properties.get("direction"),x=1-d.de(g.x,g.y,g.z)[2]/90,w=u(f)*m*x,E=o.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),I=o.properties.get("intensity"),P=u(E)*I;return Number(((w+P)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const r=[];return this.directionalLight&&r.push(this.directionalLight.get()),this.ambientLight&&r.push(this.ambientLight.get()),r}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(r==null||r===""&&this.isRootStyle())return this;if(d.df(r)){const o=d.dg(r),u=this.fragments.find(({id:m})=>m===o);if(!u)return;const f=d.bV(r);return u.style.getFragmentStyle(f)}{const o=this.fragments.find(({id:u})=>u===r);return o?o.style:void 0}}setFeaturesetSelectors(r){if(!r)return;const o=(u,f="")=>`${u}::${f}`;this._featuresetSelectors={};for(const u in r){const f={},m=this._featuresetSelectors[u]=[];
vendor: 4,545 bytes, line 3405
3405for(const g of r[u].selectors){if(g.featureNamespace){const w=this.getOwnLayer(g.layer);if(!w){d.w(`Layer is undefined for selector: ${g.layer}`);continue}const E=o(w.source,w.sourceLayer);if(E in f&&f[E]!==g.featureNamespace){d.w(`"featureNamespace ${g.featureNamespace} of featureset ${u}'s selector is not associated to the same source, skip this selector`);continue}f[E]=g.featureNamespace}let x;if(g.properties)for(const w in g.properties){const E=d.c(g.properties[w]);E.result==="success"&&(x=x||{},x[w]=E.value)}m.push({layerId:g.layer,namespace:g.featureNamespace,properties:x,uniqueFeatureID:g._uniqueFeatureID})}}}getFeaturesetDescriptors(r){const o=this.getFragmentStyle(r);if(!o||!o.stylesheet.featuresets)return[];const u=[];for(const f in o.stylesheet.featuresets)u.push({featuresetId:f,importId:o.scope?o.scope:void 0});return u}getFeaturesetLayers(r,o){const u=this.getFragmentStyle(o),f=u.stylesheet.featuresets;if(!f||!f[r])return this.fire(new d.f(new Error(`The featureset '${r}' does not exist in the map's style and cannot be queried.`))),[];const m=[];for(const g of f[r].selectors){const x=u.getOwnLayer(g.layer);x&&m.push(x)}return m}getConfigProperty(r,o){const u=this.getFragmentStyle(r);if(!u)return null;const f=d.m(o,u.scope),m=u.options.get(f),g=m?m.value||m.default:null;return g?g.serialize():null}isIndoorEnabled(){return this._indoorEnabled}getIndoorSourceLayers(r,o){const u=d.m(r,o);return this._mergedIndoor[u]}setIndoorData(r,o){this.indoorManager&&this.indoorManager.setIndoorData(o)}updateIndoorDependentLayers(){this._updateLayers(this._dependentLayerIds(r=>r.isIndoorDependent)),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(r,o,u){const f=this.getFragmentStyle(r);if(!f)return;const m=f.stylesheet.schema;if(!m||!m[o])return;const g=_l(m[o],u);if(g.result!=="success")return void Fs(this,g.value);const x=g.value.expression,w=d.m(o,f.scope),E=f.options.get(w);if(!E)return;let I;const{minValue:P,maxValue:R,stepValue:B,type:V,values:U}=m[o],Z=_l(m[o],m[o].default);Z.result==="success"&&(I=Z.value.expression),I?(this.options.set(w,{...E,value:x,default:I,minValue:P,maxValue:R,stepValue:B,type:V,values:U}),this.updateConfigDependencies(o)):this.fire(new d.f(new Error(`No schema defined for the config option "${o}" in the "${r}" fragment.`)))}getConfig(r){const o=this.getFragmentStyle(r);if(!o)return null;const u=o.stylesheet.schema;if(!u)return null;const f={};for(const m in u){const g=d.m(m,o.scope),x=o.options.get(g),w=x?x.value||x.default:null;f[m]=w?w.serialize():null}return f}setConfig(r,o){const u=this.getFragmentStyle(r);u&&(u.updateConfig(o,u.stylesheet.schema),this.updateConfigDependencies())}getSchema(r){const o=this.getFragmentStyle(r);return o?o.stylesheet.schema:null}setSchema(r,o){const u=this.getFragmentStyle(r);u&&(u.stylesheet.schema=o,u.updateConfig(u._config,o),this.updateConfigDependencies())}updateConfig(r,o){if(this._config=r,r||o)if(o)for(const u in o){let f,m;const g=_l(o[u],o[u].default);if(g.result==="success"&&(f=g.value.expression),r&&r[u]!==void 0){const R=_l(o[u],r[u]);R.result==="success"&&(m=R.value.expression)}const{minValue:x,maxValue:w,stepValue:E,type:I,values:P}=o[u];if(f){const R=d.m(u,this.scope);this.options.set(R,{default:f,value:m,minValue:x,maxValue:w,stepValue:E,type:I,values:P})}else this.fire(new d.f(new Error(`No schema defined for config option "${u}".`)))}else this.fire(new d.f(new Error("Attempting to set config for a style without schema.")))}_updateLayers(r){for(const o of r){const u=this.getLayer(o);u&&(u.possiblyEvaluateVisibility(),this._updateLayer(u),this._changes.setDirty())}}_dependentLayerIds(r){const o=[];for(const[u,f]of this._layerExpressionDependencies)r(f)&&o.push(u);return o}updateConfigDependencies(r){this._updateLayers(this._dependentLayerIds(o=>r?o.hasConfigDependency(r):o.isConfigDependent)),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(o=>{const u=o._styleColorTheme.colorThemeOverride?o._styleColorTheme.colorThemeOverride:o._styleColorTheme.colorTheme;if(u){const f=o._evaluateColorThemeData(u);(!o._styleColorTheme.lut&&f!==""||o._styleColorTheme.lut&&f!==o._styleColorTheme.lut.data)&&o.setColorTheme(u)}}),this._updateIndoorEnabled(),this._changes.setDirty()}addLayer(r,o,u={}){this._checkLoaded();const f=r.id;
3405if(this._layers[f])return void this.fire(new d.f(new Error(`Layer with id "${f}" already exists on this map`)));let m;if(r.type==="custom"){if(Fs(this,d.dh(r)))return;m=d.di(r,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof r.source=="object"&&(this.addSource(f,r.source),r=d.dd(r),r=Object.assign(r,{source:f})),this._validate(ol,`layers.${f}`,r,{arrayIndex:-1},u))return;m=d.di(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(m),m.setEventedParent(this,{layer:{id:f}})}this._layerExpressionDependencies.set(m.fqid,new Gs(m));let g=this._order.length;if(o){const I=this._order.indexOf(o);if(I===-1)return void this.fire(new d.f(new Error(`Layer with id "${o}" does not exist on this map.`)));m.slot&&m.slot!==this._layers[o].slot?d.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):g=I}this._order.splice(g,0,f),this._handleLayerOrderChange(),this._layers[f]=m;const x=this.getOwnLayerSourceCache(m),w=!!this.directionalLight&&this.directionalLight.shadowsEnabled();x&&m.canCastShadows()&&w&&(x.castsShadows=!0);const E=this._changes.getRemovedLayer(m);if(E&&m.source&&x&&m.type!=="custom"){this._changes.discardLayerRemoval(m);const I=d.m(m.source,m.scope);E.type!==m.type?this._changes.updateSourceCache(I,"clear"):(this._changes.updateSourceCache(I,"reload"),x.pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map),m.scope=this.scope,this.mergeLayers()}moveLayer(r,o){this._checkLoaded();const u=this._checkLayer(r);if(!u||r===o)return;const f=this._order.indexOf(r);this._order.splice(f,1);let m=this._order.length;if(o){const g=this._order.indexOf(o);
3405if(g===-1)return void this.fire(new d.f(new Error(`Layer with id "${o}" does not exist on this map.`)));u.slot&&u.slot!==this._layers[o].slot?d.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):m=g}this._order.splice(m,0,r),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(r){this._checkLoaded();const o=this._checkLayer(r);if(!o)return;o.setEventedParent(null);const u=this._order.indexOf(r);this._order.splice(u,1),delete this._layers[r],this._changes.setDirty(),this._handleLayerOrderChange(),this._layerExpressionDependencies.delete(o.fqid),this._changes.removeLayer(o);const f=this.getOwnLayerSourceCache(o);if(f&&f.castsShadows){let m=!1;for(const g in this._layers)if(this._layers[g].source===o.source&&this._layers[g].canCastShadows()){m=!0;break}f.castsShadows=m}o.onRemove&&o.onRemove(this.map),this.mergeLayers()}getOwnLayer(r){return this._layers[r]}hasLayer(r){return r in this._mergedLayers}hasLayerType(r){for(const o in this._layers)if(this._layers[o].type===r)return!0;return!1}setLayerZoomRange(r,o,u){this._checkLoaded();const f=this._checkLayer(r);f&&(f.minzoom===o&&f.maxzoom===u||(o!=null&&(f.minzoom=o),u!=null&&(f.maxzoom=u),this._updateLayer(f)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(r,o){this._checkLoaded();const u=this._checkLayer(r);u&&u.slot!==o&&(u.slot=o,this._updateLayer(u))}setFilter(r,o,u={}){this._checkLoaded();const f=this._checkLayer(r);if(!f||d.O(f.filter,o))return;const m=this._layerExpressionDependencies.get(f.fqid);if(o==null)return f.filter=void 0,m&&m.invalidateFilter(),void this._updateLayer(f);this._validate(H,`layers.${f.id}.filter`,o,{layerType:f.type},u)||(f.filter=d.dd(o),m&&m.invalidateFilter(),this._updateLayer(f))}getFilter(r){const o=this._checkLayer(r);if(o)return d.dd(o.filter)}
vendor: 1,190 bytes, line 3405
3405setLayoutProperty(r,o,u,f={}){this._checkLoaded();const m=this._checkLayer(r);if(m&&!d.O(m.getLayoutProperty(o),u)){if(u!=null&&(!f||f.validate!==!1)&&Fs(m,k.call(no,{key:`layers.${r}.layout.${o}`,layerType:m.type,objectKey:o,value:u,styleSpec:d.s,style:{glyphs:!0,sprite:!0}})))return;m.setLayoutProperty(o,u),this._updateLayer(m)}}getLayerProperty(r,o){const u=this._checkLayer(r);if(u){switch(o){case"minzoom":return u.minzoom;case"maxzoom":return u.maxzoom;case"filter":return this.getFilter(r);case"slot":return u.slot;case"appearances":return u.getAppearances().map(f=>f.serialize())}return u.isPaintProperty(o)?this.getPaintProperty(r,o):this.getLayoutProperty(r,o)}}setLayerProperty(r,o,u,f={}){this._checkLoaded();const m=this._checkLayer(r);if(m){switch(o){case"appearances":return m.setAppearances(u),void this._updateLayer(m);case"minzoom":return this.setLayerZoomRange(r,u);case"maxzoom":return this.setLayerZoomRange(r,null,u);case"filter":return this.setFilter(r,u,f);case"slot":return this.setSlot(r,u)}m.isPaintProperty(o)?this.setPaintProperty(r,o,u,f):this.setLayoutProperty(r,o,u,f)}}getLayoutProperty(r,o){const u=this._checkLayer(r);if(u)return u.getLayoutProperty(o)}
3405setPaintProperty(r,o,u,f={}){this._checkLoaded();const m=this._checkLayer(r);m&&(d.O(m.getPaintProperty(o),u)||(u==null||f&&f.validate===!1||!Fs(m,M.call(no,{key:`layers.${r}.paint.${o}`,layerType:m.type,objectKey:o,value:u,styleSpec:d.s})))&&(m.setPaintProperty(o,u)&&this._updateLayer(m),this._changes.updatePaintProperties(m)))}getPaintProperty(r,o){const u=this._checkLayer(r);if(u)return u.getPaintProperty(o)}setFeatureState(r,o){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){const{featuresetId:w,importId:E}=r.target,I=this.getFragmentStyle(E),P=I.getFeaturesetLayers(w);for(const{source:R,sourceLayer:B}of P)I.setFeatureState({id:r.id,source:R,sourceLayer:B},o)}else if("layerId"in r.target){const{layerId:w}=r.target,E=this.getLayer(w);if(!E)return;const I=this.getFragmentStyle(E.scope);if(!I)return;I.setFeatureState({id:r.id,source:E.source,sourceLayer:E.sourceLayer},o)}return}const u=r.source,f=r.sourceLayer,m=this._checkSource(u);if(!m)return;const g=m.type;if(g==="geojson"&&f)return void this.fire(new d.f(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(g==="vector"&&!f)return void this.fire(new d.f(new Error("The sourceLayer parameter must be provided for vector source types.")));r.id===void 0&&this.fire(new d.f(new Error("The feature id parameter must be provided.")));const x=this.getOwnSourceCaches(u);for(const w of x)w.setFeatureState(f,r.id,o)}removeFeatureState(r,o){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){const{featuresetId:w,importId:E}=r.target,I=this.getFragmentStyle(E),P=I.getFeaturesetLayers(w);for(const{source:R,sourceLayer:B}of P)I.removeFeatureState({id:r.id,source:R,sourceLayer:B},o)}else if("layerId"in r.target){const{layerId:w}=r.target,E=this.getLayer(w);if(!E)return;const I=this.getFragmentStyle(E.scope);if(!I)return;I.removeFeatureState({id:r.id,source:E.source,sourceLayer:E.sourceLayer},o)}return}const u=r.source,f=this._checkSource(u);if(!f)return;const m=f.type,g=m==="vector"?r.sourceLayer:void 0;if(m==="vector"&&!g)return void this.fire(new d.f(new Error("The sourceLayer parameter must be provided for vector source types.")));if(o&&typeof r.id!="string"&&typeof r.id!="number")return void this.fire(new d.f(new Error("A feature id is required to remove its specific state property.")));const x=this.getOwnSourceCaches(u);for(const w of x)w.removeFeatureState(g,r.id,o)}getFeatureState(r){if(this._checkLoaded(),"target"in r){let m;if("featuresetId"in r.target){const{featuresetId:g,importId:x}=r.target,w=this.getFragmentStyle(x),E=w.getFeaturesetLayers(g);for(const{source:I,sourceLayer:P}of E){const R=w.getFeatureState({id:r.id,source:I,sourceLayer:P});if(R&&!m)m=R;else if(!d.O(m,R))return void this.fire(new d.f(new 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){const{layerId:g}=r.target,x=this.getLayer(g);if(!x)return;const w=this.getFragmentStyle(x.scope);if(!w)return;m=w.getFeatureState({id:r.id,source:x.source,sourceLayer:x.sourceLayer})}return m}const o=r.source,u=r.sourceLayer,f=this._checkSource(o);if(f){if(f.type!=="vector"||u)return r.id===void 0&&this.fire(new d.f(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(o)[0].getFeatureState(u,r.id);this.fire(new d.f(new Error("The sourceLayer parameter must be provided for vector source types.")))}}resetFeatureStates(r){if(this._checkLoaded(),"featuresetId"in r){const{featuresetId:o,importId:u}=r,f=this.getFragmentStyle(u);if(!f)return;const m=f.getFeaturesetLayers(o);for(const{source:g,sourceLayer:x}of m)f.removeFeatureState({source:g,sourceLayer:x})}else{const{layerId:o}=r,u=this.getLayer(o);if(!u)return void this.fire(new d.f(new Error(`The layer '${o}' does not exist in the map's style and cannot be used to reset feature states.`)));this.removeFeatureState({source:u.source,sourceLayer:u.sourceLayer})}}setTransition(r){return this.stylesheet.transition={...this.stylesheet.transition,...r},this.transition=this.stylesheet.transition,this}getTransition(){return{...this.stylesheet.transition}}setWorldview(r){r!==this._worldview&&(this._worldview=r,this.dispatcher.broadcast("upsertRenderParams",{worldview:this._worldview}),this.reloadSources())}serialize(){this._checkLoaded();const r=this.getTerrain(),o=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return d.dj({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:o,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)},u=>u!==void 0)}_updateFilteredLayers(r){for(const o of Object.values(this._mergedLayers))r(o)&&this._updateLayer(o)}_updateLayer(r){this._changes.updateLayer(r);const o=this.getLayerSourceCache(r),u=d.m(r.source,r.scope),f=this._changes.getUpd
vendor: 4,223 bytes, line 3405
3405atedSourceCaches();r.source&&!f[u]&&o&&o.getSource().type!=="raster"&&(this._changes.updateSourceCache(u,"reload"),o.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(r){const o=x=>this._mergedLayers[x].is3D(!!this.terrain),u=this.order,f={},m=[];for(let x=u.length-1;x>=0;x--){const w=u[x];if(o(w)){f[w]=x;for(const E of r){const I=E[w];if(I)for(const P of I)m.push(P)}}}m.sort((x,w)=>w.intersectionZ-x.intersectionZ);const g=[];for(let x=u.length-1;x>=0;x--){const w=u[x];if(o(w))for(let E=m.length-1;E>=0;E--){const I=m[E].feature;if(I.layer&&f[I.layer.id]<x)break;g.push(I),m.pop()}else for(const E of r){const I=E[w];if(I)for(const P of I)g.push(P.feature)}}return g}queryRasterValue(r,o,u){const f=this.getOwnSource(r);return f?f.type!=="raster-array"?(this.fire(new d.f(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):f.queryRasterArrayValue(o,u):(this.fire(new d.f(new Error(`Source with id "${r}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(r,o,u){let f;o&&!Array.isArray(o)&&o.filter&&(this._validate(H,"queryRenderedFeatures.filter",o.filter,null,o),f=d.bv(o.filter));const m={},g=I=>{if(su.has(I.type))return;const P=this.getOwnLayerSourceCache(I),R=m[P.id]=m[P.id]||{sourceCache:P,layers:{},has3DLayers:!1};I.is3D(!!this.terrain)&&(R.has3DLayers=!0),R.layers[I.fqid]=R.layers[I.fqid]||{styleLayer:I,targets:[]},R.layers[I.fqid].targets.push({filter:f})};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new d.f(new Error("parameters.layers must be an Array."))),[];for(const I of o.layers){const P=this._layers[I];if(!P)return this.fire(new d.f(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];g(P)}}else for(const I in this._layers)g(this._layers[I]);const x=this._queryRenderedFeatures(r,m,u),w=this._flattenAndSortRenderedFeatures(x),E=[];for(const I of w)d.bW(I.layer.id)===this.scope&&E.push(I);return E}queryRenderedFeatureset(r,o,u){let f;o&&!Array.isArray(o)&&o.filter&&(this._validate(H,"queryRenderedFeatures.filter",o.filter,null,o),f=d.bv(o.filter));const m="mock",g=[];if(o&&o.target)g.push({...o,targetId:m,filter:f});else{const I=this.getFeaturesetDescriptors();for(const P of I)g.push({targetId:m,filter:f,target:P});for(const{style:P}of this.fragments){const R=P.getFeaturesetDescriptors();for(const B of R)g.push({targetId:m,filter:f,target:B})}}const x=this.queryRenderedTargets(r,g,u),w=[],E=new Set;for(const I of x)for(const P of I.variants[m])jf(P,I,E)||w.push(new d.dk(I,P));return w}queryRenderedTargets(r,o,u){const f={},m=(x,w,E,I)=>{const P=f[w.id]=f[w.id]||{sourceCache:w,layers:{},has3DLayers:!1};if(P.layers[x.fqid]=P.layers[x.fqid]||{styleLayer:x,targets:[]},x.is3D(!!this.terrain)&&(P.has3DLayers=!0),!I)return E.uniqueFeatureID=!1,void P.layers[x.fqid].targets.push(E);P.layers[x.fqid].targets.push({...E,namespace:I.namespace,properties:I.properties,uniqueFeatureID:I.uniqueFeatureID})};for(const x of o)if("featuresetId"in x.target){const{featuresetId:w,importId:E}=x.target,I=this.getFragmentStyle(E);if(!I||!I._featuresetSelectors)continue;const P=I._featuresetSelectors[w];if(!P){this.fire(new d.f(new Error(`The featureset '${w}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const R of P){const B=I.getOwnLayer(R.layerId);B&&!su.has(B.type)&&m(B,I.getOwnLayerSourceCache(B),x,R)}}else if("layerId"in x.target){const{layerId:w}=x.target,E=this.getLayer(w);if(!E||su.has(E.type))continue;m(E,this.getLayerSourceCache(E),x)}const g=this._queryRenderedFeatures(r,f,u);return this._flattenAndSortRenderedFeatures(g)}_queryRenderedFeatures(r,o,u){const f=[],m=!!this.map._showQueryGeometry,g=Ea.createFromScreenPoints(r,u);for(const x in o){const w=Gf(g,o[x],this._availableImages,u,m,this.getActualScope());Object.keys(w).length&&f.push(w)}if(this.placement)for(const x in o){if(o[x].sourceCache._renderSourceType!==d.bR.Symbol)continue;const w=d_(g.screenGeometry,o[x],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(w).length&&f.push(w)}return f}querySourceFeatures(r,o){const u=o&&o.filter;
3405u&&this._validate(H,"querySourceFeatures.filter",u,null,o);let f=[];const m=this.getOwnSourceCaches(r);for(const g of m)f=f.concat(rd(g,o));return f}getFlatLight(){return this.light.getLight()}setFlatLight(r,o,u={}){this._checkLoaded();const f=this.light.getLight();let m=!1;for(const x in r)if(!d.O(r[x],f[x])){m=!0;break}if(!m)return;const g=this._getTransitionParameters();this.light.setLight(r,o,u),this.light.updateTransitions(g)}hasTerrain(){return!!this.terrain&&this.terrain.drapeRenderMode===1}getTerrain(){return this.hasTerrain()?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=d.e.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&d.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(r,o=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),o===0&&delete this.terrain,r===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let u=r;const f=!("source"in r)||r.source==null;if(o===1){if(this.disableElevatedTerrain)return;if("source"in u&&typeof u.source=="object"){const x="terrain-dem-src";this.addSource(x,u.source),u=d.dd(u),u=Object.assign(u,{source:x})}const m={...u},g={};if(this.terrain&&f){m.source=this.terrain.get().source;const x=this.terrain?this.getFragmentStyle(this.terrain.scope):null;x&&(g.style=x.serialize())}if(this._validate(Ku,"terrain",m,g))return}if(!this.terrain||this.terrain.scope!==this.scope&&!f||this.terrain&&o!==this.terrain.drapeRenderMode){if(!u)return;this._createTerrain(u,o),this.fire(new d.h("data",{dataType:"style"}))}else{const m=this.terrain,g=m.get();for(const x of Object.keys(d.s.terrain))!Object.hasOwn(u,x)&&d.s.terrain[x].default&&(u[x]=d.s.terrain[x].default);for(const x in r)if(!d.O(r[x],g[x])){m.set(r,this.options),this.stylesheet.terrain=r;const w=this._getTransitionParameters({duration:0});m.updateTransitions(w),this.fire(new d.h("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const o=this.fog=new Te(r,this.map.transform,this.scope,this.options);this.stylesheet.fog=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_createSnow(r){const o=this.snow=new Ue(r,this.map.transform,this.scope,this.options);this.stylesheet.snow=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_createRain(r){const o=this.rain=new ut(r,this.map.transform,this.scope,this.options);this.stylesheet.rain=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const r of this.map._markers)r._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),r)if(this.fog){const o=this.fog;if(!d.O(o.get(),r)){o.set(r,this.options),this.stylesheet.fog=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createFog(r);else delete this.fog,delete this.stylesheet.fog;this._markersNeedUpdate=!0,this._programPrecompiler&&this._programPrecompiler.reset()}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){const o=this.snow;if(!d.O(o.get(),r)){o.set(r,this.options),this.stylesheet.snow=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createSnow(r);this._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){const o=this.rain;if(!d.O(o.get(),r)){o.set(r,this.options),this.stylesheet.rain=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createRain(r);
vendor: 3,830 bytes, line 3405
3405this._markersNeedUpdate=!0}_reloadColorTheme(){const r=()=>{for(const f in this._layers)this._layers[f].lut=this._styleColorTheme.lut;for(const f in this._sourceCaches)this._sourceCaches[f].clearTiles()},o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!o)return this._styleColorTheme.lut=null,void r();const u=this._evaluateColorThemeData(o);this._loadColorTheme(u).then(()=>{this.fire(new d.h("colorthemeset")),r()}).catch(f=>{d.w(`Couldn't set color theme: ${f}`)})}setColorTheme(r){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&d.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(r,o){const u=this.getFragmentStyle(r);u&&(u._styleColorTheme.colorThemeOverride=o,u._reloadColorTheme())}_getTransitionParameters(r){return{now:d.e.now(),transition:Object.assign(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;const r=[],o=[];for(const u of this._mergedOrder)this.isLayerDraped(this._mergedLayers[u])?r.push(u):o.push(u);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...r),this._drapedFirstOrder.push(...o)}_createTerrain(r,o){const u=this.terrain=new re(r,o,this.scope,this.options,this.map.getWorldview());o===1&&(this.stylesheet.terrain=r),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const f=this._getTransitionParameters({duration:0});u.updateTransitions(f)}_force3DLayerUpdate(){for(const r in this._layers){const o=this._layers[r];o.type==="fill-extrusion"&&this._updateLayer(o)}}_forceSymbolLayerUpdate(){for(const r in this._layers){const o=this._layers[r];o.type==="symbol"&&this._updateLayer(o)}}_validate(r,o,u,f,m={}){if(m&&m.validate===!1)return!1;const g={...this.serialize()};return Fs(this,r.call(no,{key:o,style:g,value:u,styleSpec:d.s,...f}))}_remove(){this._programPrecompiler&&(this._programPrecompiler.reset(),this._programPrecompiler=null),this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),d.dl.off("pluginStateChange",this._rtlTextPluginCallback);for(const r in this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(const r in this._mergedSourceCaches){const o=this._mergedSourceCaches[r];o.clearTiles(),o.setEventedParent(null);const u=o.getSource();u&&u.onRemove&&u.onRemove(this.map)}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&&this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(r){const o=this.getSourceCaches(r);for(const u of o)u.clearTiles()}clearSources(){for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles()}clearLayers(){for(const r in this._mergedLayers){const o=this._mergedLayers[r];o._clear&&o._clear()}}reloadSource(r){const o=this.getSourceCaches(r);for(const u of o)u.resume(),u.reload()}reloadSources(){for(const r of this.getSources())r.reload&&r.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(r=>{r.modelManager.reloadModels(r.scope)})}updateSources(r){let o;this.directionalLight&&(o=d.dm(this.directionalLight));const u=new Set,f=new Set,m=new Set;for(const g in this._mergedLayers){const x=this._mergedLayers[g];x.type==="building"?u.add(x.source):x.type==="raster"&&x.paint&&x.paint.get("raster-elevation-reference")==="ground"&&m.add(x.source),x.hasElevation()&&
3405!f.has(x.source)&&f.add(x.source)}this.updateFrcCoverageFadeRange();for(const g in this._mergedSourceCaches){const x=this._mergedSourceCaches[g],w=f.has(x._source.id);x._isRasterElevatedOverTerrain=m.has(x._source.id),u.has(x._source.id)&&(x._source.reparseOverscaled=!1),x.update(r,void 0,void 0,o,w)}this.updateFrcCoverage(),this.updateElevationCoverage(),Et.markElevationIngestSourceCachesUsed&&Et.markElevationIngestSourceCachesUsed(this)}_reloadSources(){for(const r in this._sourceCaches){const o=this._sourceCaches[r];o.resume(),o.reload()}}updateFrcCoverageFadeRange(){this.map.painter&&Et.updateFrcCoverageFadeRange&&Et.updateFrcCoverageFadeRange(this,this.map.painter)}updateFrcCoverage(){this._hdCoverage&&Et.updateFrcCoverage&&Et.updateFrcCoverage(this,this._hdCoverage)}updateElevationCoverage(){this.isRootStyle()&&Et.setupAndUpdateElevationCoverage&&Et.setupAndUpdateElevationCoverage(this)}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new d.h("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new Xf),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(r,o,u,f,m,g){this.pauseablePlacement||(this.pauseablePlacement=new Xf);let x=!1,w=!1;const E={},I={};for(const Z of this._mergedOrder){const q=this._mergedLayers[Z];if(q.type!=="symbol")continue;const X=d.m(q.source,q.scope);let ne=E[X];if(!ne){const _e=this.getLayerSourceCache(q);if(!_e)continue;const ae=_e.getRenderableIds(!0).map(ue=>_e.getTileByID(ue));I[X]=ae.slice(),ne=E[X]=ae.sort((ue,he)=>he.tileID.overscaledZ-ue.tileID.overscaledZ||(ue.tileID.isLessThan(he.tileID)?-1:1))}const oe=this.crossTileSymbolIndex.addLayer(q,ne,r.center.lng,r.projection);x=x||oe}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const P=!!(this.placement&&!r.equals(this.placement.transform)),R=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!m||this.placement.lastReplacementSourceUpdateTime!==m.updateTime)),B=P||R||x,V=(B||this.pauseablePlacement.isStale())&&u===0,U=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(d.e.now(),r.zoom)&&u!==0;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||V||U)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(r,this._mergedOrder,o,u,f,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex,g),this.map.painter)){const Z=this.map.painter.maxFrontCutoffRawStart;if(Z>0){const q=180*r.pitch/Math.PI;if(q>
3405=15){const X=Math.min(1,Math.max(0,(q-15)/5)),ne=X*X*(3-2*X);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-ne)+Z*ne}}}if(this.pauseablePlacement.isDone()?B&&u!==0&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,E,I,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(d.e.now()),w=!0),x&&this.pauseablePlacement.setStale()),w||x){this._buildingIndex.onNewFrame(r.zoom);for(let Z=0;Z<this._mergedOrder.length;Z++){const q=this._mergedLayers[this._mergedOrder[Z]];if(q.type!=="symbol"||q.visibility==="none")continue;const X=this.isLayerClipped(q);this.placement.updateLayerOpacities(q,E[d.m(q.source,q.scope)],Z,X?m:null,o,this.map.painter.scaleFactor)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(d.e.now())}_releaseSymbolFadeTiles(){for(const r in this._sourceCaches)this._sourceCaches[r].releaseSymbolFadeTiles()}addImport(r,o){if(this._checkLoaded(),new Set(["__proto__","constructor","prototype"]).has(r.id))return void this.fire(new d.f(new Error(`Import id can't be "${r.id}".`)));const u=this.stylesheet.imports=this.stylesheet.imports||[];if(u.findIndex(({id:m})=>m===r.id)!==-1)return void this.fire(new d.f(new Error(`Import with id '${r.id}' already exists in the map's style.`)));if(!o)return u.push(r),this._loadImports([r],!0);const f=u.findIndex(({id:m})=>m===o);return f===-1&&this.fire(new d.f(new Error(`Import with id "${o}" does not exist on this map.`))),this.stylesheet.imports=u.slice(0,f).concat(r).concat(u.slice(f)),this._loadImports([r],!0,o)}updateImport(r,o){this._checkLoaded();const u=this.stylesheet.imports||[],f=this.getImportIndex(r);return f===-1?this:typeof o=="string"?(this.setImportUrl(r,o),this):(o.url&&o.url!==u[f].url&&this.setImportUrl(r,o.url),d.O(o.config,u[f].config)||this.setImportConfig(r,o.config,o.data.schema),d.O(o.data,u[f].data)||this.setImportData(r,o.data),this)}moveImport(r,o){this._checkLoaded();let u=this.stylesheet.imports||[];const f=this.getImportIndex(r);if(f===-1)return this;const m=this.getImportIndex(o);if(m===-1)return this;const g=u[f],x=this.fragments[f];return u=u.filter(({id:w})=>w!==r),this.fragments=this.fragments.filter(({id:w})=>w!==r),this.stylesheet.imports=u.slice(0,m).concat(g).concat(u.slice(m)),this.fragments=this.fragments.slice(0,m).concat(x).concat(this.fragments.slice(m)),this.mergeLayers(),this}setImportUrl(r,o){this._checkLoaded();const u=this.stylesheet.imports||[],f=this.getImportIndex(r);if(f===-1)return this;u[f].url=o;const m=this.fragments[f];return m.style=this._createFragmentStyle(u[f]),m.style.on("style.import.load",()=>this.mergeAll()),m.style.loadURL(o),this}setImportData(r,o){this._checkLoaded();const u=this.getImportIndex(r),f=this.stylesheet.imports||[];return u===-1?this:o?(this.fragments[u].style.setState(o),this._reloadImports(),this):(delete f[u].data,this.setImportUrl(r,f[u].url))}setImportConfig(r,o,u){this._checkLoaded();const f=this.getImportIndex(r),m=this.stylesheet.imports||[];if(f===-1)return this;o?m[f].config=o:delete m[f].config;const g=this.fragments[f];u&&g.style.stylesheet&&(g.style.stylesheet.schema=u);const x=g.style.stylesheet&&g.style.stylesheet.schema;return g.config=o,g.style.updateConfig(o,x),this.updateConfigDependencies(),this}removeImport(r){this._checkLoaded();const o=this.stylesheet.imports||[],u=this.getImportIndex(r);u!==-1&&(o.splice(u,1),this.fragments[u].style._remove(),this.fragments.splice(u,1),this._reloadImports())}getImportIndex(r){const o=(this.stylesheet.imports||[]).findIndex(u=>u.id===r);return o===-1&&this.fire(new d.f(new Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),o}getLayer(r){return this._mergedLayers[r]}getSources(){const r=[];for(const o in this._mergedOtherSourceCaches){const u=this._mergedOtherSourceCaches[o];u&&r.push(u.getSource())}return r}getSource(r,o){const u=this.getSourceCache(r,o);return u&&u.getSource()}getLayerSource(r){const o=this.getLayerSourceCache(r);return o&&o.getSource()}getSourceCache(r,o){const u=d.m(r,o);return this._mergedOtherSourceCaches[u]}getLayerSourceCache(r){const o=d.m(r.source,r.scope);return r.type==="symbol"?this._mergedSymbolSourceCaches[o]:r.type==="fill-extrusion"?this._mergedFillExtrusionSourceCaches[o]||this._mergedOtherSourceCaches[o]:r.type==="fill"&&r.sourceLayer===d.bU&&this._mergedHdRoa
3405dCoverageSourceCaches[o]?this._mergedHdRoadCoverageSourceCaches[o]:this._mergedOtherSourceCaches[o]}getSourceCaches(r){return r==null?Object.values(this._mergedSourceCaches):[this._mergedOtherSourceCaches[r],this._mergedSymbolSourceCaches[r],this._mergedFillExtrusionSourceCaches[r],this._mergedHdRoadCoverageSourceCaches[r],this._mergedHdRoadElevationSourceCaches[r]].filter(Boolean)}updateSourceCaches(){const r=this._changes.getUpdatedSourceCaches();for(const o in r){const u=r[o];u==="reload"?this.reloadSource(o):u==="clear"&&this.clearSource(o)}}updateLayers(r){const o=this._changes.getUpdatedPaintProperties();for(const u of o){const f=this.getLayer(u);f&&f.updateTransitions(r)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(r){this.stylesheet.glyphs=r,this.glyphManager.setURL(r)}getOwnSourceCache(r){return this._otherSourceCaches[r]}getOwnLayerSourceCache(r){return r.type==="symbol"?this._symbolSourceCaches[r.source]:r.type==="fill-extrusion"&&this._fillExtrusionSourceCaches[r.source]||this._otherSourceCaches[r.source]}getOwnSourceCaches(r){return[this._otherSourceCaches[r],this._symbolSourceCaches[r],this._fillExtrusionSourceCaches[r],this._hdCoverage&&this._hdCoverage.coverageSourceCaches[r],this._hdElevation&&this._hdElevation.elevationSourceCaches[d.m(r,this.scope)]].filter(Boolean)}_updateHdCoverageSourceCache(r){return Et.HdCoverageState&&Et.updateHdCoverageSourceCache?(this._hdCoverage||(this._hdCoverage=new Et.HdCoverageState),Et.updateHdCoverageSourceCache(this,this._hdCoverage,r),!1):r.type==="fill"&&r.sourceLayer===d.bU}_isSourceCacheLoaded(r){const o=this.getOwnSourceCaches(r);return o.length===0?(this.fire(new d.f(new Error(`There is no source with ID '${r}'`))),!1):o.every(u=>u.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(r,o){if(!this._clipLayerPresent&&r.type!=="fill-extrusion"&&r.type!=="building")return!1;const u=r.type==="fill-extrusion"&&(r.sourceLayer==="building"||r.sourceLayer==="procedural_buildings"),f=r.type==="building";if(r.is3D(!!this.terrain)){if(u||f||o&&o.type==="batched-model"||r.type==="model")return!0}else if(r.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}getBOMObject(){}destroy(){this._clearWorkerCaches(),this.imageManager.imageAtlasCache.clear(),this.fragments.forEach(r=>{r.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}async getImages(r,o){const u=new Promise((w,E)=>{this.imageManager.getImages(o.icons.concat(o.patterns),o.scope,(I,P)=>{I?E(I):w(P)})});this._updateTilesForChangedImages();const f=o.icons.map(w=>d.I.toString(w)),m=o.patterns.map(w=>d.I.toString(w)),g=w=>{w&&(w.setDependencies(o.tileID.key,"icons",f),w.setDependencies(o.tileID.key,"patterns",m))},x=d.m(o.source,o.scope);return g(this._mergedOtherSourceCaches[x]),g(this._mergedSymbolSourceCaches[x]),(o.icons.some(w=>w.iconsetId)||o.patterns.some(w=>w.iconsetId))&&this.fire(new d.h("data",{dataType:"style"})),u}async rasterizeImages(r,o){return new Promise((u,f)=>{this.imageManager.rasterizeImages(o,(m,g)=>{m?f(m):u(g)})})}async checkAtlasCache(r,o){const u=this.imageManager.imageAtlasCache.findCachedAtlas(o.descriptor);return u&&u.contentDescriptor?{iconPositions:u.iconPositions,patternPositions:u.patternPositions,sourceHash:u.contentDescriptor.hash}:null}async getGlyphs(r,o){return new Promise((u,f)=>{this.glyphManager.getGlyphs(o.stacks,(m,g)=>{m?f(m):u(g)})})}}Ra.registerForPluginStateChange=d.d6;class Qf{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(r,o,u,f,m,g,x,w){this.context=r;let E=this.boundPaintVertexBuffers.length!==f.length;for(let P=0;!E&&P<f.length;P++)this.boundPaintVertexBuffers[P]!==f[P]&&(E=!0);let I=this.boundDynamicVertexBuffers.length!==x.length;for(let P=0;!I&&P<x.length;P++)this.boundDynamicVertexBuffers[P]!==x[P]&&(I=!0);if(!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==u||E||I||this.boundIndexBuffer!==m||this.boundVertexOffset!==g)this.freshBind(o,u,f,m,g,x,w);else{r.bindVertexArrayOES.set(this.vao);for(const P of x)P&&(P.bind(),w&&P.instanceCount&&P.setVertexAttribDivisor(r.gl,o,w));m&&m.dynamicDraw&&m.bind()}}freshBind(r,o,u,f,m,g,x){const w=this.context,E=w.gl;this.vao&&this.destroy(),this.vao=w.gl.createVertexArray(),w.bindVertexArrayOES.set(this.vao),this.boundProgram=r,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=u,this.boundIndexBuffer=f,this.boundVertexOffset=m,this.boundDynamicVertexBuffers=g,o.enableAttributes(E,r),o.bind(),o.setVertexAttribPointers(E,r,m);for(const I of u)I.enableAttributes(E,r),I.bind(),I.setVertexAttribPointers(E,r,m);for(const I of g)I&&(I.enableAttributes(E,r),I.bind(),I.setVertexAttribPointers(E,r,m),x&&I.instanceCount&&I.setVertexAttribDivisor(E,r,x));f&&f.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function ep(a,r){const o=Math.pow(2,r.canonical.z),u=r.canonical.y;return[new d.bS(0,u/o).toLngLat().lat,new d.bS(0,(u+1)/o).toLngLat().lat]}function hc(a,r,o,u,f,m,g){const x=a.context,w=x.gl,E=o.hillshadeFBO;if(!E)return;a.prepareDrawTile();const I=a.isTileAffectedByFog(r),P=[];a.terrain&&a.terrain.renderingToTexture&&a.emissiveMode==="mrt-fallback"&&P.push("USE_MRT1");const R=a.getOrCreateProgram("hillshade",{overrideFog:I,defines:P});x.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,E.colorAttachment0.get());const B=((q,X,ne,oe)=>{const _e=ne.paint.get("hillshade-shadow-color"),ae=ne.paint.get("hillshade-shadow-color-use-theme").
vendor: 10,488 bytes, line 3405
3405constantOr("default")==="none",ue=ne.paint.get("hillshade-highlight-color"),he=ne.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",fe=ne.paint.get("hillshade-accent-color"),be=ne.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Re=ne.paint.get("hillshade-emissive-strength");let Ae=d.au(ne.paint.get("hillshade-illumination-direction"));if(ne.paint.get("hillshade-illumination-anchor")==="viewport")Ae-=q.transform.angle;else if(q.style&&q.style.enable3dLights()&&q.style.directionalLight){const Ee=q.style.directionalLight.properties.get("direction"),Ye=d.de(Ee.x,Ee.y,Ee.z);Ae=d.au(Ye[1])}const Ce=!q.options.moving;return{u_matrix:oe||q.transform.calculateProjMatrix(X.tileID.toUnwrapped(),Ce),u_image:0,u_latrange:ep(0,X.tileID),u_light:[ne.paint.get("hillshade-exaggeration"),Ae],u_shadow:_e.toPremultipliedRenderColor(ae?null:ne.lut),u_highlight:ue.toPremultipliedRenderColor(he?null:ne.lut),u_emissive_strength:Re,u_accent:fe.toPremultipliedRenderColor(be?null:ne.lut)}})(a,o,u,a.terrain?r.projMatrix:null);a.uploadCommonUniforms(x,R,r.toUnwrapped());const{tileBoundsBuffer:V,tileBoundsIndexBuffer:U,tileBoundsSegments:Z}=a.getTileBoundsBuffers(o);R.draw(a,w.TRIANGLES,f,m,g,d.$.disabled,B,u.id,V,U,Z)}function pd(a,r,o){if(!r.needsDEMTextureUpload)return;const u=a.context,f=u.gl;u.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||a.getTileTexture(o.stride);const m=o.getPixels();r.demTexture?r.demTexture.update(m,{premultiply:!1}):r.demTexture=new d.T(u,m,f.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}function y_(a,r,o){const u=a.context,f=u.gl;if(!r.dem)return;const m=r.dem;if(u.activeTexture.set(f.TEXTURE1),pd(a,r,m),!r.demTexture)return;r.demTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE);const g=m.dim;u.activeTexture.set(f.TEXTURE0);let x=r.hillshadeFBO;if(!x){const R=new d.T(u,{width:g,height:g,data:null},f.RGBA8);R.bind(f.LINEAR,f.CLAMP_TO_EDGE),x=r.hillshadeFBO=u.createFramebuffer(g,g,1,"renderbuffer"),x.colorAttachment0.set(R.texture)}u.bindFramebuffer.set(x.framebuffer),u.viewport.set([0,0,g,g]);const{tileBoundsBuffer:w,tileBoundsIndexBuffer:E,tileBoundsSegments:I}=a.getMercatorTileBoundsBuffers(),P=[];a.linearFloatFilteringSupported()&&P.push("TERRAIN_DEM_FLOAT_FORMAT"),a.terrain&&a.terrain.renderingToTexture&&a.emissiveMode==="mrt-fallback"&&P.push("USE_MRT1"),a.getOrCreateProgram("hillshadePrepare",{defines:P}).draw(a,f.TRIANGLES,d.Z.disabled,d._.disabled,d.a1.unblended,d.$.disabled,((R,B)=>{const V=B.stride,U=d.Y();return d.dq(U,0,d.a2,-d.a2,0,0,1),d.bM(U,U,[0,-d.a2,0]),{u_matrix:U,u_image:1,u_dimension:[V,V],u_zoom:R.overscaledZ}})(r.tileID,m),o.id,w,E,I),r.needsHillshadePrepare=!1}class $i{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class x_ extends $i{getDefault(){return d.C.transparent.toNonPremultipliedRenderColor(null)}set(r){const o=this.current;(r.r!==o.r||r.g!==o.g||r.b!==o.b||r.a!==o.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class md extends $i{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class _d extends $i{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class gd extends $i{getDefault(){return[!0,!0,!0,!0]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||r[2]!==o[2]||r[3]!==o[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class yd extends $i{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class tp extends $i{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class ip extends $i{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){const o=this.current;(r.func!==o.func||r.ref!==o.ref||r.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class v_ extends $i{getDefault(){const r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||r[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class lu extends $i{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;r?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=r,this.dirty=!1}}class cu extends $i{getDefault(){return[0,1]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class rp extends $i{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;r?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=r,this.dirty=!1}}class Lo extends $i{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class xd extends $i{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;r?o.enable(o.BLEND):o.disable(o.BLEND),this.current=r,this.dirty=!1}}class ah extends $i{getDefault(){const r=this.gl;return[r.ONE,r.ZERO,r.ONE,r.ZERO]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||r[2]!==o[2]||r[3]!==o[3]||this.dirty)&&(this.gl.blendFuncSeparate(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class b_ extends $i{getDefault(){return d.C.transparent.toNonPremultipliedRenderColor(null)}set(r){const o=this.current;(r.r!==o.r||r.g!==o.g||r.b!==o.b||r.a!==o.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class lh extends $i{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(r,r),this.current=r,this.dirty=!1)}}class vd extends $i{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;r?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=r,this.dirty=!1}}class bd extends $i{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class wd extends $i{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}let Td=class extends $i{getDefault(){return null}set(a){(a!==this.current||this.dirty)&&(this.gl.useProgram(a),this.current=a,this.dirty=!1)}};class ch extends $i{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class np extends $i{getDefault(){const r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){const o=this.current;(r[0]!==o[0]||r[1]!==o[1]||r[2]!==o[2]||r[3]!==o[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class op extends $i{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class dc extends $i{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class w_ extends $i{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class T_ extends $i{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class E_ extends $i{getDefault(){return null}set(r){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class S_ extends $i{getDefault(){return null}set(r){this.gl&&(r!==this.current||this.dirty)&&(this.gl.bindVertexArray(r),this.current=r,this.dirty=!1)}}class I_ extends $i{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class A_ extends $i{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class Ed extends $i{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class uu extends $i{constructor(r,o){super(r),this.context=r,this.parent=o}getDefault(){return null}}class fc extends uu{constructor(r,o,u=0){super(r,o),this.attachmentPoint=r.gl.COLOR_ATTACHMENT0+u}setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachmentPoint,o.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class yl extends uu{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,this.attachment(),o.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class sp extends uu{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachment(),o.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class ap extends yl{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const lp=(a,r,o,u)=>({u_matrix:a,u_image0:0,u_image1:1,u_skirt_height:r,u_ground_shadow_factor:o,u_emissive_texture_available:u}),uh=(a,r,o,u,f,m,g,x,w,E,I,P,R,B,V,U,Z)=>({u_proj_matrix:Float32Array.from(a),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(u),u_merc_matrix:o,u_zoom_transition:f,u_merc_center:m,u_image0:0,u_image1:1,u_frustum_tl:g,u_frustum_tr:x,u_frustum_br:w,u_frustum_bl:E,u_globe_pos:I,u_globe_radius:P,u_viewport:R,u_grid_matrix:Z?Float32Array.from(Z):new Float32Array(9),u_skirt_height:B,u_far_z_cutoff:V,u_emissive_texture_available:U});function ra(a,r){return a!=null&&r!=null&&!(!a.hasData()||!r.hasData())&&a.demTexture!=null&&r.demTexture!=null&&a.tileID.key!==r.tileID.key}const Pa=new class{constructor(){this.operations={}}newMorphing(a,r,o,u,f){if(a in this.operations){const m=this.operations[a];m.to.tileID.key!==o.tileID.key&&(m.queued=o)}else this.operations[a]={startTime:u,phase:0,duration:f,from:r,to:o,queued:null}}
vendor: 5,518 bytes, lines 3405-3406
3405getMorphValuesForProxy(a){if(!(a in this.operations))return null;const r=this.operations[a];return{from:r.from,to:r.to,phase:r.phase}}update(a){for(const r in this.operations){const o=this.operations[r];for(o.phase=(a-o.startTime)/o.duration;o.phase>=1||!this._validOp(o);)if(!this._nextOp(o,a)){delete this.operations[r];break}}}_nextOp(a,r){return!!a.queued&&(a.from=a.to,a.to=a.queued,a.queued=null,a.phase=0,a.startTime=r,!0)}_validOp(a){return a.from.hasData()&&a.to.hasData()}};function hu(a,r,o){if(r===0)return 0;const u=r<1&&o===514?.25/r:1;return 6*Math.pow(1.5,22-a)*Math.max(r,1)*u}function hh(a,r){const o=1<<a.z;return!r&&(a.x===0||a.x===o-1)||a.y===0||a.y===o-1}function dh(a,r){if(!a.style||!a.style.enable3dLights())return;const o=a.context,u=o.gl;o.activeTexture.set(u.TEXTURE1),r?r.bind(u.LINEAR,u.CLAMP_TO_EDGE):a.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}class Da extends En{constructor(r){const o={type:"raster-dem",maxzoom:Math.ceil(r.transform.maxZoom)},u=ih("mock-dem",o,r.style.dispatcher,r.style);super("mock-dem",u,null),u.setEventedParent(this),this._sourceLoaded=!0}_loadTile(r,o){r.state="loaded",o(null)}}class Sd extends En{constructor(r){const o=ih("proxy",{type:"geojson",maxzoom:Math.ceil(r.transform.maxZoom)},r.style.dispatcher,r.style);super("proxy",o,null),o.setEventedParent(this),this.map=this.getSource().map=r,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,o,u){if(r.freezeTileCoverage)return;this.transform=r;const f=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((m,g)=>{if(m[g.key]="",!this._tiles[g.key]){const x=new Ps(g,this._source.tileSize*g.overscaleFactor(),r.tileZoom,void 0,void 0,this._source.worldview);x.state="loaded",this._tiles[g.key]=x}return m},{});for(const m in this._tiles)m in f||(this.freeFBO(m),this._tiles[m].unloadVectorData(),delete this._tiles[m])}freeFBO(r){const o=this.proxyCachedFBO[r];if(o!==void 0){const u=Object.values(o);this.renderCachePool.push(...u),delete this.proxyCachedFBO[r]}}deallocRenderCache(){this.renderCache.forEach(r=>r.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class du extends d.bP{constructor(r,o,u){super(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y),this.proxyTileKey=o,this.projMatrix=u}}class Id extends d.cW{constructor(r,o){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[u,f,m]=function(){const w=new d.bC,E=new d.ad,I=131;w.reserve(17161),E.reserve(33800);const P=d.a2/128,R=d.a2+P/2,B=R+P;for(let U=-P;U<B;U+=P)for(let Z=-P;Z<B;Z+=P){const q=Z<0||Z>R||U<0||U>R?24575:0,X=d.b0(Math.round(Z),0,d.a2),ne=d.b0(Math.round(U),0,d.a2);w.emplaceBack(X+q,ne)}const V=(U,Z)=>{const q=Z*I+U;E.emplaceBack(q+1,q,q+I),E.emplaceBack(q+I,q+I+1,q+1)};for(let U=1;U<129;U++)for(let Z=1;Z<129;Z++)V(Z,U);return[0,129].forEach(U=>{for(let Z=0;Z<130;Z++)V(Z,U),V(U,Z)}),[w,E,32768]}(),g=r.context;this.gridBuffer=g.createVertexBuffer(u,d.bE.members),this.gridIndexBuffer=g.createIndexBuffer(f),this.gridSegments=d.ac.simpleSegment(0,0,u.length,f.length),this.gridNoSkirtSegments=d.ac.simpleSegment(0,0,u.length,m),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Sd(o.map),this.orthoMatrix=d.Y(),d.dq(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,d.a2,0,d.a2,0,1);const x=g.gl;this._overlapStencilMode=new d._({func:x.GEQUAL,mask:255},0,255,x.KEEP,x.KEEP,x.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=o,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Da(o.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1,this._devtoolsFolder=null}set style(r){r.on("data",this._onStyleDataEvent.bind(this)),this._style=r,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,o,u){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);const f=r.terrain.properties,m=r.terrain.drapeRenderMode===0,g=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=d.e.now();const x=r.terrain&&r.terrain.scope,w=f.get("source"),E=m?this._mockSourceCache:r.getSourceCache(w,x);if(!E)return void d.w(`Couldn't find terrain source "${w}".`);if(this.sourceCache=E,this._attenuationRange=r.terrain.getAttenuationRange(),this._exaggeration=g?this.calculateExaggeration(o):f.get("exaggeration"),!o.projection.requiresDraping&&g&&this._exaggeration===0)return void this._disable();this.enabled=!0;const I=()=>{this.sourceCache.used&&d.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 3406This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const P=this.getScaledDemTileSize();this.sourceCache.update(o,P,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,I(),this._initializing=!0),I(),o.updateElevation(!0,u),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(o),this._emptyDEMTextureDirty=!0,this._previousZoom=
vendor: 4,784 bytes, line 3406
3406o.zoom}else this._disable()}calculateExaggeration(r){if(this._attenuationRange&&r.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(r.zoom);const o=this._previousCameraAltitude,u=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=u;const f=o!=null?u-o:Number.MAX_VALUE;if(Math.abs(f)<2)return this._exaggeration;const m=r.zoom,g=this._style.terrain;if(!this._previousUpdateTimestamp)return g.getExaggeration(m);let x=m-this._previousZoom;const w=this._previousUpdateTimestamp;let E=m;this._evaluationZoom!=null&&(E=this._evaluationZoom,Math.abs(m-E)>.5&&(x=.5*(m-E+x)),x*f<0&&(E+=x)),this._evaluationZoom=E;const I=g.getExaggeration(E),P=I===g.getExaggeration(Math.max(0,E-.1));if(P&&Math.abs(I-this._exaggeration)<.01)return I;let R=Math.min(.1,.00375*(this._updateTimestamp-w));return(P||I<.1||Math.abs(x)<1e-4)&&(R=Math.min(.2,4*R)),d.al(this._exaggeration,I,R)}resetTileLookupCache(r){this._findCoveringTileCache[r]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(r){r.dataType==="source"&&r.coord?this._clearRenderCacheForTile(r.sourceCacheId,r.coord):r.dataType==="style"&&(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(const r in this._style._mergedSourceCaches)this._style._mergedSourceCaches[r].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(r=>r.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(){const r=2*this.proxySourceCache.getSource().tileSize;return[r,r]}set useVertexMorphing(r){this._useVertexMorphing=r}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const o=this.proxySourceCache,u=this.painter.transform;this._initializing&&(this._initializing=u._centerAltitude===0&&this.getAtPointOrZero(d.bS.fromLngLat(u.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const f=this.proxyCoords=o.getIds().map(w=>{const E=o.getTileByID(w).tileID;return E.projMatrix=u.calculateProjMatrix(E.toUnwrapped()),E});(function(w,E){const I=E.transform.pointCoordinate(E.transform.getCameraPoint()),P=new d.P(I.x,I.y);w.sort((R,B)=>{if(B.overscaledZ-R.overscaledZ)return B.overscaledZ-R.overscaledZ;const V=new d.P(R.canonical.x+(1<<R.canonical.z)*R.wrap,R.canonical.y),U=new d.P(B.canonical.x+(1<<B.canonical.z)*B.wrap,B.canonical.y),Z=P.mult(1<<R.canonical.z);return Z.x-=.5,Z.y-=.5,Z.distSqr(V)-Z.distSqr(U)})})(f,this.painter);const m=this.proxyToSource||{};this.proxyToSource={},f.forEach(w=>{this.proxyToSource[w.key]={}}),this.terrainTileForTile={};const g=this._style._mergedSourceCaches;for(const w in g){const E=g[w];if(!E.used||!E.transform||(E!==this.sourceCache&&this.resetTileLookupCache(E.id),this._setupProxiedCoordsForOrtho(E,r[w],m),E.usedForTerrain))continue;const I=r[w];(E.getSource().reparseOverscaled||E._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(I)}this.proxiedCoords[o.id]=f.map(w=>new du(w,w.key,this.orthoMatrix)),this._assignTerrainTiles(f),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(m),this.renderingToTexture=!1;const x={};this._visibleDemTiles=[];for(const w of this.proxyCoords){const E=this.terrainTileForTile[w.key];if(!E)continue;const I=E.tileID.key;I in x||(this._visibleDemTiles.push(E),x[I]=I)}}_assignTerrainTiles(r){this._initializing||r.forEach(o=>{if(this.terrainTileForTile[o.key])return;const u=this._findTileCoveringTileID(o,this.sourceCache);u&&(this.terrainTileForTile[o.key]=u)})}_prepareDEMTextures(){const r=this.painter.context,o=r.gl;for(const u in this.terrainTileForTile){const f=this.terrainTileForTile[u],m=f.dem;!m||f.demTexture&&!f.needsDEMTextureUpload||(r.activeTexture.set(o.TEXTURE1),pd(this.painter,f,m))}}_prepareDemTileUniforms(r,o,u,f){if(!o||o.demTexture==null)return!1;const m=r.tileID.canonical,g=Math.pow(2,o.tileID.canonical.z-m.z),x=f||"";return u[`u_dem_tl${x}`]=[m.x*g%1,m.y*g%1],u[`u_dem_scale${x}`]=g,!0}
vendor: 6,172 bytes, line 3406
3406get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let r=0;const o=this._visibleDemTiles.reduce((u,f)=>{if(!f.dem)return u;const m=f.dem.tree.minimums[0];return m>0&&r++,u+m},0);return r?o/r:0}_updateEmptyDEMTexture(){const r=this.painter.context,o=r.gl;r.activeTexture.set(o.TEXTURE2);const u=this._getLoadedAreaMinimum(),f=new d.du({width:1,height:1},new Float32Array([u]));this._emptyDEMTextureDirty=!1;let m=this._emptyDEMTexture;return m?m.update(f,{premultiply:!1}):m=this._emptyDEMTexture=new d.T(r,f,o.R32F,{premultiply:!1}),m}setupElevationDraw(r,o,u){const f=this.painter.context,m=f.gl,g={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};g.u_exaggeration=this.exaggeration();let x=null,w=null,E=1;if(u&&u.morphing&&this._useVertexMorphing){const B=u.morphing.srcDemTile,V=u.morphing.dstDemTile;E=u.morphing.phase,B&&V&&(this._prepareDemTileUniforms(r,B,g,"_prev")&&(w=B),this._prepareDemTileUniforms(r,V,g)&&(x=V))}const I=B=>B&&B.demTexture&&this.painter.linearFloatFilteringSupported()?m.LINEAR:m.NEAREST;let P=null;var R;if(this.enabled?w&&x?(P=x.demTexture,f.activeTexture.set(m.TEXTURE4),w.demTexture.bind(I(w),m.CLAMP_TO_EDGE),g.u_dem_lerp=E):(x=this.terrainTileForTile[r.tileID.key],P=this._prepareDemTileUniforms(r,x,g)?x.demTexture:this.emptyDEMTexture):P=this.emptyDEMTexture,f.activeTexture.set(m.TEXTURE2),P&&(g.u_dem_size=(R=P).size[0]===1?1:R.size[0]-2,P.bind(I(x),m.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(u&&u.useDepthForOcclusion,o,g),u&&u.useMeterToDem&&x){const B=(1<<x.tileID.canonical.z)*d.dv(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;g.u_meter_to_dem=B}if(u&&u.labelPlaneMatrixInv&&(g.u_label_plane_matrix_inv=u.labelPlaneMatrixInv),o.setTerrainUniformValues(f,g),this.painter.transform.projection.name==="globe"){const B=this.globeUniformValues(this.painter.transform,r.tileID.canonical,u&&u.useDenormalizedUpVectorScale);o.setGlobeUniformValues(f,B)}}globeUniformValues(r,o,u){const f=r.projection;return{u_tile_tl_up:f.upVector(o,0,0),u_tile_tr_up:f.upVector(o,d.a2,0),u_tile_br_up:f.upVector(o,d.a2,d.a2),u_tile_bl_up:f.upVector(o,0,d.a2),u_tile_up_scale:u?d.dw(1):f.upVectorScale(o,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){const o=this.painter,u=this.painter.context;r.length!==0&&(u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),o.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(f,m,g,x,w){if(f.transform.projection.name==="globe")(function(E,I,P,R,B){const V=E.context,U=V.gl;let Z,q;const X=E.transform,ne=d.ds(E,V,X),oe=(Ce,Ee)=>{if(q===Ee)return;const Ye=[];Ee===1&&Ye.push("TERRAIN_VERTEX_MORPHING"),Ye.push("PROJECTION_GLOBE_VIEW"),ne&&Ye.push("CUSTOM_ANTIALIASING");const De=E.isTileAffectedByFog(Ce);Z=E.getOrCreateProgram("globeRaster",{defines:Ye,overrideFog:De}),q=Ee},_e=E.colorModeForRenderPass(),ae=new d.Z(U.LEQUAL,d.Z.ReadWrite,E.depthRangeFor3D);Pa.update(B);const ue=d.b6(X),he=[d.a7(X.center.lng),d.a8(X.center.lat)],fe=E.globeSharedBuffers,be=[X.width*d.e.devicePixelRatio,X.height*d.e.devicePixelRatio],Re=Float32Array.from(X.globeMatrix),Ae={useDenormalizedUpVectorScale:!0};{const Ce=E.transform,Ee=hu(Ce.zoom,I.exaggeration(),I.sourceCache._source.tileSize);q=-1;const Ye=U.TRIANGLES;for(const De of R){const Ve=P.getTile(De),$e=d._.disabled,ot=I.prevTerrainTileForTile[De.key],et=I.terrainTileForTile[De.key];ra(ot,et)&&Pa.newMorphing(De.key,ot,et,B,250),dh(E,Ve.emissiveTexture),V.activeTexture.set(U.TEXTURE0),Ve.texture&&Ve.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE);const Xe=Pa.getMorphValuesForProxy(De.key),mt=Xe?1:0;Xe&&Object.assign(Ae,{morphing:{srcDemTile:Xe.from,dstDemTile:Xe.to,phase:d.dr(Xe.phase)}});const qe=d.b2(De.canonical),Ge=d.b3(qe.getCenter().lat),Qe=d.b7(De.canonical,qe,Ge,Ce.worldSize/Ce._pixelsPerMercatorPixel),dt=d.b4(d.b5(De.canonical)),rt=E.emissiveMode==="mrt-fallback"?1:0,ct=uh(Ce.expandedFarZProjMatrix,Re,ue,dt,d.S(Ce.zoom),he,Ce.frustumCorners.TL,Ce.frustumCorners.TR,Ce.frustumCorners.BR,Ce.frustumCorners.BL,Ce.globeCenterInViewSpace,Ce.globeRadius,be,Ee,Ce._farZ,rt,Qe);if(oe(De,mt),Z&&(I.setupElevationDraw(Ve,Z,Ae),E.uploadCommonUniforms(V,Z,De.toUnwrapped()),fe)){const[_t,Dt,bt]=fe.getGridBuffers(Ge,Ee!==0);Z.draw(E,Ye,ae,$e,_e,d.$.backCCW,ct,"globe_raster",_t,Dt,bt)}}}if(fe&&(E.renderDefaultNorthPole||E.renderDefaultSouthPole)){const Ce=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];ne&&Ce.push("CUSTOM_ANTIALIASING"),Z=E.getOrCreateProgram("globeRaster",{defines:Ce});for(const Ee of R){const{x:Ye,y:De,z:Ve}=Ee.canonical,$e=De===0,ot=De===(1<<Ve)-1,[et,Xe,mt,qe]=fe.getPoleBuffers(Ve,!1);if(qe&&($e||ot)){const Ge=P.getTile(Ee);dh(E,Ge.emissiveTexture),V.activeTexture.set(U.TEXTURE0),Ge.texture&&Ge.texture.bind(U.LINEAR,U.CLAMP_TO_EDGE);let Qe=d.dt(Ve,Ye,X);const dt=d.b4(d.b5(Ee.canonical)),rt=E.emissiveMode==="mrt-fallback"?1:0,ct=(_t,Dt)=>_t.draw(E,U.TRIANGLES,ae,d._.disabled,_e,d.$.disabled,uh(X.expandedFarZProjMatrix,Qe,Qe,dt,0,he,X.frustumCorners.TL,X.frustumCorners.TR,X.frustumCorners.BR,X.frustumCorners.BL,X.globeCenterInViewSpace,X.globeRadius,be,0,X._farZ,rt),"globe_pole_raster",Dt,mt,qe);I.setupElevationDraw(Ge,Z,Ae),E.uploadCommonUniforms(V,Z,Ee.toUnwrapped()),$e&&E.renderDefaultNorthPole&&ct(Z,et),ot&&E.renderDefaultSouthPole&&(Qe=d.aN(d.Y(),Qe,[1,-1,1]),ct(Z,Xe))}}}})(f,m,g,x,w);else{const E=f.context,I=E.gl;let P,R;const B=f.shadowRenderer,V=d.aE(f,f.longestCutoffRange),U=_e=>{if(R===_e)return;const ae=[];_e===1&&ae.push("TERRAIN_VERTEX_MORPHING"),V.shouldRenderCutoff&&ae.push("RENDER_CUTOFF"),B&&(ae.push("RENDER_SHADOWS"),B.useNormalOffset&&ae.push("NORMAL_OFFSET")),P=f.getOrCreateProgram("terrainRaster",{defines:ae}),R=_e},Z=f.colorModeForRenderPass(),q=new d.Z(I.LEQUAL,d.Z.ReadWrite,f.depthRangeFor3D);Pa.update(w);const X=f.transform,ne=hu(X.zoom,m.exaggeration(),m.sourceCache._source.tileSize);
3406let oe=[0,0,0];if(B){const _e=f.style.directionalLight,ae=f.style.ambientLight;_e&&ae&&(oe=d.aF(f.style,_e,ae))}{R=-1;const _e=I.TRIANGLES,[ae,ue]=[m.gridIndexBuffer,m.gridSegments];for(const he of x){const fe=g.getTile(he),be=d._.disabled,Re=m.prevTerrainTileForTile[he.key],Ae=m.terrainTileForTile[he.key];ra(Re,Ae)&&Pa.newMorphing(he.key,Re,Ae,w,250),dh(f,fe.emissiveTexture),E.activeTexture.set(I.TEXTURE0),fe.texture&&fe.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const Ce=Pa.getMorphValuesForProxy(he.key),Ee=Ce?1:0;let Ye;Ce&&(Ye={morphing:{srcDemTile:Ce.from,dstDemTile:Ce.to,phase:d.dr(Ce.phase)}});const De=f.emissiveMode==="mrt-fallback"?1:0,Ve=lp(he.projMatrix,hh(he.canonical,X.renderWorldCopies)?ne/10:ne,oe,De);if(U(Ee),!P)continue;m.setupElevationDraw(fe,P,Ye);const $e=he.toUnwrapped();B&&B.setupShadows($e,P),f.uploadCommonUniforms(E,P,$e,null,V),P.draw(f,_e,q,be,Z,d.$.backCCW,Ve,"terrain_raster",m.gridBuffer,ae,ue)}}}}(o,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,o.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(this._drapedRenderBatches.length===0)return r+1;this.renderingToTexture=!0;const o=this.painter,u=this.painter.context,f=this.proxySourceCache,m=this.proxiedCoords[f.id],g=this._drapedRenderBatches.shift(),x=o.style.order,w=[];this._updateFBOs(o.emissiveMode==="mrt-fallback");let E=0;for(const I of m){const P=f.getTileByID(I.proxyTileKey),R=f.proxyCachedFBO[I.key]?f.proxyCachedFBO[I.key][r]:void 0,B=R!==void 0?f.renderCache[R]:this.pool[E++],V=R!==void 0;if(P.texture=B.tex,P.emissiveTexture=B.emissiveTex,V&&!B.dirty){w.push(P.tileID);continue}u.bindFramebuffer.set(B.fb.framebuffer);const U=u.gl;let Z;U.drawBuffers(o.emissiveMode==="mrt-fallback"?[U.COLOR_ATTACHMENT0,U.COLOR_ATTACHMENT1]:[U.COLOR_ATTACHMENT0]),this.renderedToTile=!1,B.dirty&&(u.clear({color:d.C.transparent,stencil:0}),B.dirty=!1);for(let q=g.start;q<=g.end;++q){const X=o.style._mergedLayers[x[q]];if(X.isHidden(o.transform.zoom))continue;const ne=o.style.getLayerSourceCache(X),oe=ne?this.proxyToSource[I.key][ne.id]:[I];if(!oe)continue;const _e=oe;u.viewport.set([0,0,B.fb.width,B.fb.height]),Z!==(ne?ne.id:null)&&(this._setupStencil(B,oe,X,ne),Z=ne?ne.id:null),o.renderLayer(o,ne,X,_e)}if(U.drawBuffers([U.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const q of this._pendingGroundEffectLayers){const X=o.style._mergedLayers[x[q]];if(X.isHidden(o.transform.zoom))continue;const ne=o.style.getLayerSourceCache(X),oe=ne?this.proxyToSource[I.key][ne.id]:[I];if(!oe)continue;const _e=oe;u.viewport.set([0,0,B.fb.width,B.fb.height]),Z!==(ne?ne.id:null)&&(this._setupStencil(B,oe,X,ne),Z=ne?ne.id:null),o.renderLayer(o,ne,X,_e)}this.renderedToTile?(B.dirty=!0,w.push(P.tileID)):V||--E,E===5&&(E=0,this.renderToBackBuffer(w))}return this.renderToBackBuffer(w),this.renderingToTexture=!1,u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),g.end+1}postRender(){}isLayerOrderingCorrect(r){const o=r.order.length;let u=-1,f=o;for(let m=0;m<o;++m)this._style.isLayerDraped(r._mergedLayers[r.order[m]])?u=Math.max(u,m):f=Math.min(f,m);return f>u}getMinElevationBelowMSL(){let r=0;return this._visibleDemTiles.filter(o=>o.dem).forEach(o=>{r=Math.min(r,o.dem.tree.minimums[0])}),r===0?r:(r-30)*this._exaggeration}raycast(r,o,u){if(!this._visibleDemTiles)return null;const f=this._visibleDemTiles.filter(m=>m.dem).map(m=>{const g=m.tileID,x=1<<g.overscaledZ,{x:w,y:E}=g.canonical,I=w/x,P=(w+1)/x,R=E/x,B=(E+1)/x;return{minx:I,miny:R,maxx:P,maxy:B,t:m.dem.tree.raycastRoot(I,R,P,B,r,o,u),tile:m}});f.sort((m,g)=>(m.t!==null?m.t:Number.MAX_VALUE)-(g.t!==null?g.t:Number.MAX_VALUE));for(const m of f){if(m.t==null)return null;const g=m.tile.dem.tree.raycast(m.minx,m.miny,m.maxx,m.maxy,r,o,u);if(g!=null)return g}return null}_createFBO(){const r=this.painter.context,o=r.gl,u=this.drapeBufferSize;r.activeTexture.set(o.TEXTURE0);const f=new d.T(r,{width:u[0],height:u[1],data:null},o.RGBA8);f.bind(o.LINEAR,o.CLAMP_TO_EDGE);const m=r.createFramebuffer(u[0],u[1],1,null);let g;return m.colorAttachment0.set(f.texture),this._emissiveTexture&&(g=new d.T(r,{width:u[0],height:u[1],data:null},o.R8),g.bind(o.LINEAR,o.CLAMP_TO_EDGE),m.createColorAttachment(r,1),m.colorAttachment1.set(g.texture)),m.depthAttachment=ne
3406w ap(r,m.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,u[0],u[1]),this._stencilRef=0,m.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):m.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:m,tex:f,emissiveTex:g,dirty:!1}}_updateFBOs(r){if(this._emissiveTexture!==r){for(const o of this.pool)this._updateFBO(o,r);for(const o of this.proxySourceCache.renderCache)this._updateFBO(o,r);this._emissiveTexture=r}}_updateFBO(r,o){const u=r.fb,f=this.painter.context,m=f.gl,g=this.drapeBufferSize;if(o){const x=new d.T(f,{width:g[0],height:g[1],data:null},m.R8);x.bind(m.LINEAR,m.CLAMP_TO_EDGE),r.emissiveTex=x,u.createColorAttachment(f,1),u.colorAttachment1.set(x.texture)}else r.emissiveTex=void 0,u.removeColorAttachment(f,1);r.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.hasLightTransitions())return!0;for(const r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r].hasTransition())return!0;return this._style.order.some(r=>{const o=this._style._mergedLayers[r],u=o.isHidden(this.painter.transform.zoom);return o.type==="hillshade"||o.type==="custom"?!u&&o.shouldRedrape():!u&&o.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(const u of this._style.getSources())if(u instanceof Ia){r=!0;break}if(!r)return;const o={};for(let u=0;u<this._style.order.length;++u){const f=this._style._mergedLayers[this._style.order[u]],m=this._style.getLayerSourceCache(f);if(!m||o[m.id]||f.isHidden(this.painter.transform.zoom)||f.type!=="line")continue;const g=f.widthExpression(),x=f.emissiveStrengthExpression();if(g instanceof d.aj||x instanceof d.aj){o[m.id]=!0;for(const w of this.proxyCoords){const E=this.proxyToSource[w.key][m.id];if(E)for(const I of E)this._clearRenderCacheForTile(m.id,I)}}}}_clearRasterLayersFromRenderCache(){let r=!1;for(const u in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[u]._source instanceof tu){r=!0;break}if(!r)return;const o={};for(let u=0;u<this._style.order.length;++u){const f=this._style._mergedLayers[this._style.order[u]],m=this._style.getLayerSourceCache(f);if(!m||o[m.id]||f.isHidden(this.painter.transform.zoom)||f.type!=="raster")continue;const g=f.paint.get("raster-fade-duration");for(const x of this.proxyCoords){const w=this.proxyToSource[x.key][m.id];if(w)for(const E of w){const I=Or(m.getTile(E),m.findLoadedParent(E,0),m,this.painter.transform,g);(I.opacity!==1||I.mix!==0)&&this._clearRenderCacheForTile(m.id,E)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const r=this._style.order,o=r.length;if(o===0)return;const u=[];this._pendingGroundEffectLayers=[];let f,m=0,g=this._style._mergedLayers[r[m]];for(;!this._style.isLayerDraped(g)&&g.isHidden(this.painter.transform.zoom)&&++m<o;)g=this._style._mergedLayers[r[m]];for(;m<o;++m){const x=this._style._mergedLayers[r[m]];x.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(x)?f===void 0&&(f=m):(x.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(m),f!==void 0&&(u.push({start:f,end:m-1}),f=void 0)))}if(f!==void 0&&u.push({start:f,end:m-1}),u.length!==0){const x=u.at(-1);this._pendingGroundEffectLayers.every(w=>w>x.end)||d.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=u}_setupRenderCache(r){const o=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,o.renderCache.length>o.renderCachePool.length){const g=Object.values(o.proxyCachedFBO);o.proxyCachedFBO={};for(let x=0;x<g.length;++x){const w=Object.values(g[x]);o.renderCachePool.push(...w)}}return}this._clearRasterLayersFromRenderCache();const u=this.proxyCoords,f=this._tilesDirty;for(let g=u.length-1;g>=0;g--){const x=u[g];if(o.getTileByID(x.key),o.proxyCachedFBO[x.key]!==void 0){const w=r[x.key],E=this.proxyToSource[x.key];let I=0;for(const P in E){const R=E[P],B=w[P];if(!B||B.length!==R.length||R.some((V,U)=>V!==B[U]||f[P]&&Object.hasOwn(f[P],V.key))){I=-1;break}++I}for(const P in o.proxyCachedFBO[x.key])o.renderCache[o.proxyCachedFBO[x.key][P]].dirty=I<0||I!==Object.values(w).length}}const m=[...this._drapedRenderBatches];m.sort((g,x)=>x.end-x.start-(g.end-g.start));for(const g of m)for(const x of u){if(o.proxyCachedFBO[x.key])continue;let w=o.renderCachePool.pop();w===void 0&&o.renderCache.length<50&&(w=o.renderCache.length,o.renderCache.push(this._createFBO())),w!==void 0&&(o.proxyCachedFBO[x.key]={},o.proxyCachedFBO[x.key][g.start]=w,o.renderCache[w].dirty=!0)}this._tilesDirty={}}_setupStencil(r,o,u,f){if(!f||!this._sourceTilesOverlap[f.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const m=this.painter.context,g=m.gl;if(o.length<=1)return void(this._overlapStencilType=!1);let x;if(u.isTileClipped())x=o.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(o[0].overscaledZ>
vendor: 10,288 bytes, lines 3406-3410
3406o.at(-1).overscaledZ))return void(this._overlapStencilType=!1);x=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+x>255&&(m.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=x,this._overlapStencilMode.ref=this._stencilRef,u.isTileClipped()&&this._renderTileClippingMasks(o,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):d._.disabled}_renderTileClippingMasks(r,o){const u=this.painter,f=this.painter.context,m=f.gl;u._tileClippingMaskIDs={},f.setColorMode(d.a1.disabled),f.setDepthMode(d.Z.disabled);const g=u.getOrCreateProgram("clippingMask");for(const x of r){const w=u._tileClippingMaskIDs[x.key]=--o;g.draw(u,m.TRIANGLES,d.Z.disabled,new d._({func:m.ALWAYS,mask:0},w,255,m.KEEP,m.KEEP,m.REPLACE),d.a1.disabled,d.$.disabled,Ar(x.projMatrix),"$clipping",u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}}pointCoordinate(r){const o=this.painter.transform;if(r.x<0||r.x>o.width||r.y<0||r.y>o.height)return null;const u=[r.x,r.y,1,1];d.c7(u,u,o.pixelMatrixInverse),d.dx(u,u,1/u[3]),u[0]/=o.worldSize,u[1]/=o.worldSize;const f=o._camera.position,m=d.dv(1,o.center.lat),g=[f[0],f[1],f[2]/m,0],x=d.dy([],u.slice(0,3),g);d.c3(x,x);const w=this.raycast(g,x,this._exaggeration);return w!==null&&w?(d.dz(g,g,x,w),g[3]=g[2],g[2]*=m,g):null}_setupProxiedCoordsForOrtho(r,o,u){if(r.getSource()instanceof fo)return this._setupProxiedCoordsForImageSource(r,o,u);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};const f=this.proxiedCoords[r.id]=[],m=this.proxyCoords;for(let w=0;w<m.length;w++){const E=m[w],I=this._findTileCoveringTileID(E,r);if(I){const P=this._createProxiedId(E,I,u[E.key]&&u[E.key][r.id]);f.push(P),this.proxyToSource[E.key][r.id]=[P]}}let g=!1;const x=new Set;for(let w=0;w<o.length;w++){const E=r.getTile(o[w]);if(!E||!E.hasData())continue;const I=this._findTileCoveringTileID(E.tileID,this.proxySourceCache);if(I&&I.tileID.canonical.z!==E.tileID.canonical.z){const P=this.proxyToSource[I.tileID.key][r.id],R=this._createProxiedId(I.tileID,E,u[I.tileID.key]&&u[I.tileID.key][r.id]);P?P.splice(P.length-1,0,R):this.proxyToSource[I.tileID.key][r.id]=[R];const B=this.proxyToSource[I.tileID.key][r.id];x.has(B)||x.add(B),f.push(R),g=!0}}if(this._sourceTilesOverlap[r.id]=g,g)for(const w of x)w.sort((E,I)=>I.overscaledZ-E.overscaledZ)}_setupProxiedCoordsForImageSource(r,o,u){if(!r.getSource().loaded())return;const f=this.proxiedCoords[r.id]=[],m=this.proxyCoords,g=r.getSource(),x=g.tileID;if(!x)return;const w=new d.P(x.x,x.y)._div(1<<x.z),E=g.coordinates.map(d.bS.fromLngLat).reduce((P,R)=>(P.min.x=Math.min(P.min.x,R.x-w.x),P.min.y=Math.min(P.min.y,R.y-w.y),P.max.x=Math.max(P.max.x,R.x-w.x),P.max.y=Math.max(P.max.y,R.y-w.y),P),{min:new d.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new d.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),I=(P,R)=>{const B=P.wrap+P.canonical.x/(1<<P.canonical.z),V=P.canonical.y/(1<<P.canonical.z),U=d.a2/(1<<P.canonical.z),Z=R.wrap+R.canonical.x/(1<<R.canonical.z),q=R.canonical.y/(1<<R.canonical.z);return B+U<Z+E.min.x||B>Z+E.max.x||V+U<q+E.min.y||V>q+E.max.y};for(let P=0;P<m.length;P++){const R=m[P];for(let B=0;B<o.length;B++){const V=r.getTile(o[B]);if(!V||!V.hasData()||I(R,V.tileID))continue;const U=this._createProxiedId(R,V,u[R.key]&&u[R.key][r.id]),Z=this.proxyToSource[R.key][r.id];Z?Z.push(U):this.proxyToSource[R.key][r.id]=[U],f.push(U)}}}_createProxiedId(r,o,u){let f=this.orthoMatrix;if(u){const m=u.find(g=>g.key===o.tileID.key);if(m)return m}if(o.tileID.key!==r.key){const m=r.canonical.z-o.tileID.canonical.z;let g,x,w;f=d.Y();const E=o.tileID.wrap-r.wrap<<r.overscaledZ;m>0?(g=d.a2>>m,x=g*((o.tileID.canonical.x<<m)-r.canonical.x+E),w=g*((o.tileID.canonical.y<<m)-r.canonical.y)):(g=d.a2<<-m,x=d.a2*(o.tileID.canonical.x-(r.canonical.x+E<<-m)),w=d.a2*(o.tileID.canonical.y-(r.canonical.y<<-m))),d.dq(f,0,g,0,g,0,1),d.bM(f,f,[x,w,0])}return new du(o.tileID,r.key,f)}_findTileCoveringTileID(r,o){let u=o.getTile(r);if(u&&u.hasData())return u;const f=this._findCoveringTileCache[o.id],m=f[r.key];if(u=m?o.getTileByID(m):null,u&&u.hasData()||m===null)return u;let g=u?u.tileID:r,x=g.overscaledZ;const w=o.getSource().minzoom,E=[];if(!m){const P=o.getSource().maxzoom;if(r.canonical.z>=P){const R=r.canonical.z-P;o.getSource().reparseOverscaled?(x=Math.max(r.canonical.z+2,o.transform.tileZoom),g=new d.bP(x,r.wrap,P,r.canonical.x>>R,r.canonical.y>>R)):R!==0&&(x=P,g=new d.bP(x,r.wrap,P,r.canonical.x>>R,r.canonical.y>>R))}g.key!==r.key&&(E.push(g.key),u=o.getTile(g))}const I=P=>{E.forEach(R=>{f[R]=P}),E.length=0};for(x-=1;x>=w&&(!u||!u.hasData());x--){u&&I(u.tileID.key);const P=g.calculateScaledKey(x);if(u=o.getTileByID(P),u&&u.hasData())break;const R=f[P];if(R===null)break;R===void 0?E.push(P):u=o.getTileByID(R)}return I(u?u.tileID.key:null),u&&u.hasData()?u:null}findDEMTileFor(r){return this.enabled?this._findTileCoveringTileID(r,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(r,o){let u=this._tilesDirty[r];u||(u=this._tilesDirty[r]={}),u[o.key]=!0}}function cp(a,r,o){const u=function(x,w,E){const I=d.dE(w,x),P=d.dE(E,[.2126,.7152,.0722]),R=1-.3*Math.min(P,1),B=d.al(R,1,Math.min(I+1,1));return d.al(.92,1,Math.asin(d.b0(w[2],-1,1))/Math.PI+.5)*B}(a,[0,0,1],r),f=[0,0,0];d.dB(f,o.slice(0,3),u);const m=[0,0,0];d.dB(m,r.slice(0,3),a[2]);const g=[0,0,0];return d.dC(g,f,m),d.dD(g)}const Ad=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Cd=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class up{static cacheKey(r,o,u,f){const m=[o];f&&m.push(f.cacheKey);for(const g of u)(typeof g=="string"&&g.includes(" ")||r.usedDefines.has(g))&&m.push(g);return m.join("/")}constructor(r,o,u,f,m,g,x=!1){const w=r.gl;this.program=w.createProgram(),this._context=r,this._fixedUniformsFn=m,this._pending=!0,this._precompiled=x,this.attributes={},this.configuration=f,this.name=o,this.fixedDefines=[...g],x?r._compileStats.precompiled++:r._compileStats.onDemand++;const E=`#version 300 es 3407${(f?f.defines():[]).concat(g.map(Z=>`#define ${Z}`)).join(` 3408`)}`,I=[E,d.dF];for(const Z of u.fragmentIncludes)I.push(d.ba[Z]);I.push(u.fragmentSource);const P=I.join(` 3409`),R=[E,d.dG];for(const Z of u.vertexIncludes)R.push(d.ba[Z]);this.forceManualRenderingForInstanceIDShaders=r.forceManualRenderingForInstanceIDShaders&&u.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&R.push("uniform int u_instanceID;"),R.push(u.vertexSource);let B=R.join(` 3410`);this.forceManualRenderingForInstanceIDShaders&&(B=B.replaceAll("gl_InstanceID","u_instanceID"));const V=w.createShader(w.FRAGMENT_SHADER);if(w.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);w.shaderSource(V,P),w.compileShader(V),w.attachShader(this.program,V);const U=w.createShader(w.VERTEX_SHADER);if(w.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);w.shaderSource(U,B),w.compileShader(U),w.attachShader(this.program,U),w.linkProgram(this.program),this._fragmentShader=V,this._vertexShader=U,r.extParallelShaderCompile?r._pendingPrograms.add(this):this._finalize()}_finalize(){if(!this._pending)return;this._pending=!1;const r=this._context,o=r.gl;r._pendingPrograms.delete(this);const u=d.e.now(),f=o.getProgramParameter(this.program,o.LINK_STATUS),m=d.e.now()-u,g=r._compileStats;if(g.totalStallMs+=m,m>g.maxStallMs&&(g.maxStallMs=m),m>1){g.framesMissed+=Math.floor(60*m/1e3);const E=this.fixedDefines.join(",");g.stalls.push({name:`${this.name}${E?"/":""}${E}`,ms:m,timestamp:u})}if(this._fragmentShader&&(f||d.w(`Fragment shader '${this.name}': ${o.getShaderInfoLog(this._fragmentShader)}`),o.deleteShader(this._fragmentShader),this._fragmentShader=null),this._vertexShader&&(f||d.w(`Vertex shader '${this.name}': ${o.getShaderInfoLog(this._vertexShader)}`),o.deleteShader(this._vertexShader),this._vertexShader=null),!f)return d.w(`Failed to link program '${this.name}': ${o.getProgramInfoLog(this.program)}`),void(this.failedToCreate=!0);this.fixedUniforms=this._fixedUniformsFn(r),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=this.configuration?this.configuration.getUniforms(r):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(E=>({u_instanceID:new d.aX(E)}))(r));const x=this.fixedDefines,w=this.name;(x.includes("TERRAIN")||x.includes("ELEVATED")||w.includes("symbol")||w.includes("circle"))&&(this.terrainUniforms=(E=>({u_dem:new d.aX(E),u_dem_prev:new d.aX(E),u_dem_tl:new d.a3(E),u_dem_scale:new d.a4(E),u_dem_tl_prev:new d.a3(E),u_dem_scale_prev:new d.a4(E),u_dem_size:new d.a4(E),u_dem_lerp:new d.a4(E),u_exaggeration:new d.a4(E),u_depth:new d.aX(E),u_depth_size_inv:new d.a3(E),u_depth_range_unpack:new d.a3(E),u_occluder_half_size:new d.a4(E),u_occlusion_depth_offset:new d.a4(E),u_meter_to_dem:new d.a4(E),u_label_plane_matrix_inv:new d.a5(E)}))(r)),x.includes("GLOBE")&&(this.globeUniforms=(E=>({u_tile_tl_up:new d.a6(E),u_tile_tr_up:new d.a6(E),u_tile_br_up:new d.a6(E),u_tile_bl_up:new d.a6(E),u_tile_up_scale:new d.a4(E)}))(r)),x.includes("FOG")&&(this.fogUniforms=(E=>({u_fog_matrix:new d.a5(E),u_fog_range:new d.a3(E),u_fog_color:new d.aY(E),u_fog_horizon_blend:new d.a4(E),u_fog_vertical_limit:new d.a3(E),u_fog_temporal_offset:new d.a4(E),u_frustum_tl:new d.a6(E),u_frustum_tr:new d.a6(E),u_frustum_br:new d.a6(E),u_frustum_bl:new d.a6(E),u_globe_pos:new d.a6(E),u_globe_radius:new d.a4(E),u_globe_transition:new d.a4(E),u_is_globe:new d.aX(E),u_viewport:new d.a3(E)}))(r)),x.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=d.dH(r)),x.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(E=>({u_lighting_ambient_color:new d.a6(E),u_lighting_directional_dir:new d.a6(E),u_lighting_directional_color:new d.a6(E),u_ground_radiance:new d.a6(E)}))(r)),x.includes("RENDER_SHADOWS")&&(this.shadowUniforms=d.dI(r))}
vendor: 4,591 bytes, line 3410
3410maybeFinalize(){if(!this._pending)return;const r=this._context.extParallelShaderCompile;r&&!this._context.gl.getProgramParameter(this.program,r.COMPLETION_STATUS_KHR)||this._finalize()}_ensureReady(){this._pending&&(this._finalize(),this._context.sweepPendingPrograms())}getAttributeLocation(r,o){this._ensureReady();let u=this.attributes[o];return u===void 0&&(u=this.attributes[o]=r.getAttribLocation(this.program,o)),u}_setUniformGroup(r,o,u){this._ensureReady();const f=this[o];if(!this.failedToCreate&&f){r.program.set(this.program);for(const m in u){const g=f[m];g&&g.set(this.program,m,u[m])}}}setTerrainUniformValues(r,o){this._setUniformGroup(r,"terrainUniforms",o)}setGlobeUniformValues(r,o){this._setUniformGroup(r,"globeUniforms",o)}setFogUniformValues(r,o){this._setUniformGroup(r,"fogUniforms",o)}setCutoffUniformValues(r,o){this._setUniformGroup(r,"cutoffUniforms",o)}setLightsUniformValues(r,o){this._setUniformGroup(r,"lightsUniforms",o)}setShadowUniformValues(r,o){this._setUniformGroup(r,"shadowUniforms",o)}_drawDebugWireframe(r,o,u,f,m,g,x,w,E,I){const P=r.options.wireframe;if(P.terrain===!1&&P.layers2D===!1&&P.layers3D===!1)return;const R=r.context;if(!(!(!P.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!P.layers2D||r._terrain&&r._terrain.renderingToTexture||!Ad.includes(this.name))||!(!P.layers3D||!Cd.includes(this.name))))return;const B=R.gl,V=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,m,R);if(!V)return;const U=[...this.fixedDefines,"DEBUG_WIREFRAME"],Z=r.getOrCreateProgram(this.name,{config:this.configuration,defines:U});Z._ensureReady(),R.program.set(Z.program);const q=(oe,_e,ae)=>{if(_e[oe]&&ae[oe])for(const ue in _e[oe])ae[oe][ue]&&ae[oe][ue].set(ae.program,ue,_e[oe][ue].current)};E&&E.setUniforms(Z.program,R,Z.binderUniforms,x,{zoom:w}),q("fixedUniforms",this,Z),q("terrainUniforms",this,Z),q("globeUniforms",this,Z),q("fogUniforms",this,Z),q("lightsUniforms",this,Z),q("shadowUniforms",this,Z),V.bind(),R.setColorMode(new d.a1([B.ONE,B.ONE_MINUS_SRC_ALPHA,B.ZERO,B.ONE],d.C.transparent,[!0,!0,!0,!1])),R.setDepthMode(new d.Z(o.func===B.LESS?B.LEQUAL:o.func,d.Z.ReadOnly,o.range)),R.setStencilMode(d._.disabled);const X=3*g.primitiveLength*2,ne=3*g.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const oe=I||1;for(let _e=0;_e<oe;++_e)Z.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",_e),B.drawElements(B.LINES,X,B.UNSIGNED_SHORT,ne)}else I&&I>1?B.drawElementsInstanced(B.LINES,X,B.UNSIGNED_SHORT,ne,I):B.drawElements(B.LINES,X,B.UNSIGNED_SHORT,ne);m.bind(),R.program.set(this.program),R.setDepthMode(o),R.setStencilMode(u),R.setColorMode(f)}checkUniforms(r,o,u){if(this.fixedDefines.includes(o)){for(const f of Object.keys(u))if(!u[f].initialized)throw new Error(`Program '${this.name}', from draw '${r}': uniform ${f} not set but required by ${o} being defined`)}}draw(r,o,u,f,m,g,x,w,E,I,P,R,B,V,U,Z){const q=r.context,X=q.gl;if(this._ensureReady(),this.failedToCreate)return;q.program.set(this.program),q.setDepthMode(u),q.setStencilMode(f),q.setColorMode(m),q.setCullFace(g);for(const[he,fe]of this.fixedUniformsEntries)fe.set(this.program,he,x[he]);V&&V.setUniforms(this.program,q,this.binderUniforms,R,{zoom:B});const ne={[X.POINTS]:1,[X.LINES]:2,[X.TRIANGLES]:3,[X.LINE_STRIP]:1}[o];this.checkUniforms(w,"RENDER_SHADOWS",this.shadowUniforms);const oe=U||[],_e=V?V.getPaintVertexBuffers():[],ae=o===X.TRIANGLES&&I,ue=Z&&Z>0?1:void 0;for(const he of P.get()){const fe=he.vaos||(he.vaos={});if((fe[w]||(fe[w]=new Qf)).bind(q,this,E,_e,I,he.vertexOffset,oe,ue),this.forceManualRenderingForInstanceIDShaders){const be=Z||1;for(let Re=0;Re<be;++Re)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Re),I?X.drawElements(o,he.primitiveLength*ne,X.UNSIGNED_SHORT,he.primitiveOffset*ne*2):X.drawArrays(o,he.vertexOffset,he.vertexLength)}else Z&&Z>1?X.drawElementsInstanced(o,he.primitiveLength*ne,X.UNSIGNED_SHORT,he.primitiveOffset*ne*2,Z):I?X.drawElements(o,he.primitiveLength*ne,X.UNSIGNED_SHORT,he.primitiveOffset*ne*2):X.drawArrays(o,he.vertexOffset,he.vertexLength);ae&&this._drawDebugWireframe(r,u,f,m,I,he,R,B,V,Z)}}}const Md=(a,r,o)=>({u_matrix:a,u_emissive_strength:r,u_ground_shadow_factor:o,u_opacity_multiplier:1}),pc=(a,r,o,u,f,m=0)=>Object.assign(Md(a,r,f),d.dJ(o,u,m)),C_=(a,r,o,u)=>({u_matrix:a,u_world:o,u_emissive_strength:r,u_ground_shadow_factor:u,u_opacity_multiplier:1}),M_=(a,r,o,u,f,m,g=0)=>Object.assign(pc(a,r,o,u,m,g),{u_world:f}),hp=(a,r,o)=>({u_image:a,u_texel_size:r,u_first_pass:o?1:0}),R_=d.Y(),Rd=(a,r,o,u,f,m,g)=>
vendor: 11,419 bytes, line 3410
3410{const x=a.transform,w=x.projection.name==="globe",E=w?d.dK(x.zoom,r.canonical)*x._pixelsPerMercatorPixel:d.c5(o,1,m),I={u_matrix:r.projMatrix,u_extrude_scale:E,u_intensity:g,u_inv_rot_matrix:R_,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(w){I.u_inv_rot_matrix=u,I.u_merc_center=f,I.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],I.u_zoom_transition=d.S(x.zoom);const P=f[0]*d.a2,R=f[1]*d.a2;I.u_up_dir=x.projection.upVector(new d.bX(0,0,0),P,R)}return I};function fh(a){const r=a.terrain?a.terrain.exaggeration():1;return(a.transform.pitch<15?d.al(.07,.7,d.b0((14-a.transform.zoom)/5,0,1)):.07)*r}const xl=(a,r,o,u,f,m,g,x,w,E,I,P,R,B,V,U,Z,q,X,ne,oe,_e)=>({u_matrix:r,u_normalize_matrix:o,u_globe_matrix:u,u_merc_matrix:f,u_grid_matrix:m,u_tl_parent:g,u_scale_parent:I,u_fade_t:P.mix,u_opacity:P.opacity*R.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:R.paint.get("raster-brightness-min"),u_brightness_high:R.paint.get("raster-brightness-max"),u_saturation_factor:d.dN(R.paint.get("raster-saturation")),u_contrast_factor:d.dM(R.paint.get("raster-contrast")),u_spin_weights:ph(R.paint.get("raster-hue-rotate")),u_perspective_transform:B,u_raster_elevation:V,u_zoom_transition:x,u_merc_center:w,u_cutoff_params:E,u_colorization_mix:Yr(d.dL,Z,X),u_colorization_offset:Er(d.dL,q,X),u_color_ramp:U,u_texture_offset:[oe/(ne+2*oe),ne/(ne+2*oe)],u_texture_res:[ne+2*oe,ne+2*oe],u_emissive_strength:_e,u_zbias_factor:fh(a)});function ph(a){a*=Math.PI/180;const r=Math.sin(a),o=Math.cos(a);return[(2*o+1)/3,(-Math.sqrt(3)*r-o+1)/3,(Math.sqrt(3)*r-o+1)/3]}const vl=d.Y(),Pd=(a,r,o,u,f,m,g,x,w,E,I,P,R,B,V,U,Z,q,X,ne,oe,_e,ae,ue,he)=>{const fe=f.transform,be={u_is_size_zoom_constant:+(a==="constant"||a==="source"),u_is_size_feature_constant:+(a==="constant"||a==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:fe.getCameraToCenterDistance(ne),u_rotate_symbol:+o,u_aspect_ratio:fe.width/fe.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_matrix:m,u_label_plane_matrix:g,u_coord_matrix:x,u_is_text:+E,u_is_sdf:+I,u_elevation_from_sea:w?1:0,u_pitch_with_map:+u,u_texsize:P,u_texsize_icon:R,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:vl,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:vl,u_up_vector:[0,-1,0],u_color_adj_mat:ae,u_icon_transition:ue||0,u_gamma_scale:I?u?f.transform.getCameraToCenterDistance(ne)*Math.cos(f.terrain?0:f.transform._pitch):1:0,u_device_pixel_ratio:d.e.devicePixelRatio,u_is_halo:1,u_scale_factor:he||1,u_ground_shadow_factor:oe,u_inv_matrix:d.aO(d.Y(),g),u_normal_scale:_e,u_lutTexture:d.dP.LUT,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],u_spp_zoom_fraction:0,u_opacity_multiplier:1};return ne.name==="globe"&&(be.u_tile_id=[V.canonical.x,V.canonical.y,1<<V.canonical.z],be.u_zoom_transition=U,be.u_inv_rot_matrix=q,be.u_merc_center=Z,be.u_camera_forward=fe._camera.forward(),be.u_ecef_origin=d.dO(fe.globeMatrix,V.toUnwrapped()),be.u_tile_matrix=fe.globeMatrix,be.u_up_vector=X),be},fu=(a,r,o,u)=>({u_matrix:a,u_emissive_strength:r,u_opacity:o,u_color:u}),pu=(a,r,o,u,f,m,g,x,w)=>Object.assign(d.dQ(f,m,g,u,x,w),{u_matrix:a,u_emissive_strength:r,u_opacity:o}),mu={fillExtrusion:d.dW,fillExtrusionPattern:d.dV,fill:a=>({u_matrix:new d.a5(a),u_emissive_strength:new d.a4(a),u_ground_shadow_factor:new d.a6(a),u_opacity_multiplier:new d.a4(a)}),fillPattern:a=>({u_matrix:new d.a5(a),u_emissive_strength:new d.a4(a),u_image:new d.aX(a),u_texsize:new d.a3(a),u_pixel_coord_upper:new d.a3(a),u_pixel_coord_lower:new d.a3(a),u_tile_units_to_pixels:new d.a4(a),u_ground_shadow_factor:new d.a6(a),u_pattern_transition:new d.a4(a),u_opacity_multiplier:new d.a4(a)}),fillOutline:a=>({u_matrix:new d.a5(a),u_emissive_strength:new d.a4(a),u_world:new d.a3(a),u_ground_shadow_factor:new d.a6(a),u_opacity_multiplier:new d.a4(a)}),fillOutlinePattern:a=>({u_matrix:new d.a5(a),u_emissive_strength:new d.a4(a),u_world:new d.a3(a),u_image:new d.aX(a),u_texsize:new d.a3(a),u_pixel_coord_upper:new d.a3(a),u_pixel_coord_lower:new d.a3(a),u_tile_units_to_pixels:new d.a4(a),u_ground_shadow_factor:new d.a6(a),u_pattern_transition:new d.a4(a),u_opacity_multiplier:new d.a4(a)}),lineBlendComposite:a=>({u_image:new d.aX(a),u_opacity:new d.a4(a),u_blend_mode:new d.aX(a),u_max_density:new d.a4(a)}),lineBlendReduce:a=>({u_image:new d.aX(a),u_texel_size:new d.a3(a),u_first_pass:new d.aX(a)}),circle:d.dU,collisionBox:a=>({u_matrix:new d.a5(a),u_inv_rot_matrix:new d.a5(a),u_camera_to_center_distance:new d.a4(a),u_extrude_scale:new d.a3(a),u_zoom_transition:new d.a4(a),u_merc_center:new d.a3(a),u_tile_id:new d.a6(a)}),collisionCircle:a=>({u_matrix:new d.a5(a),u_inv_matrix:new d.a5(a),u_camera_to_center_distance:new d.a4(a),u_viewport_size:new d.a3(a)}),debug:d.dT,clippingMask:a=>({u_matrix:new d.a5(a)}),heatmap:a=>({u_extrude_scale:new d.a4(a),u_intensity:new d.a4(a),u_matrix:new d.a5(a),u_inv_rot_matrix:new d.a5(a),u_merc_center:new d.a3(a),u_tile_id:new d.a6(a),u_zoom_transition:new d.a4(a),u_up_dir:new d.a6(a)}),heatmapTexture:a=>({u_image:new d.aX(a),u_color_ramp:new d.aX(a),u_opacity:new d.a4(a)}),hillshade:a=>({u_matrix:new d.a5(a),u_image:new d.aX(a),u_latrange:new d.a3(a),u_light:new d.a3(a),u_shadow:new d.dp(a),u_highlight:new d.dp(a),u_emissive_strength:new d.a4(a),u_accent:new d.dp(a)}),hillshadePrepare:a=>({u_matrix:new d.a5(a),u_image:new d.aX(a),u_dimension:new d.a3(a),u_zoom:new d.a4(a)}),line:d.dS,linePattern:d.dR,raster:a=>({u_matrix:new d.a5(a),u_normalize_matrix:new d.a5(a),u_globe_matrix:new d.a5(a),u_merc_matrix:new d.a5(a),u_grid_matrix:new d.aZ(a),u_tl_parent:new d.a3(a),u_scale_parent:new d.a4(a),u_fade_t:new d.a4(a),u_opacity:new d.a4(a),u_image0:new d.aX(a),u_image1:new d.aX(a),u_brightness_low:new d.a4(a),u_brightness_high:new d.a4(a),u_saturation_factor:new d.a4(a),u_contrast_factor:new d.a4(a),u_spin_weights:new d.a6(a),u_perspective_transform:new d.a3(a),u_raster_elevation:new d.a4(a),u_zoom_transition:new d.a4(a),u_merc_center:new d.a3(a),u_cutoff_params:new d.aY(a),u_colorization_mix:new d.aY(a),u_colorization_offset:new d.a4(a),u_color_ramp:new d.aX(a),u_texture_offset:new d.a3(a),u_texture_res:new d.a3(a),u_emissive_strength:new d.a4(a),u_zbias_factor:new d.a4(a)}),symbol:a=>({u_is_size_zoom_constant:new d.aX(a),u_is_size_feature_constant:new d.aX(a),u_size_t:new d.a4(a),u_size:new d.a4(a),u_camera_to_center_distance:new d.a4(a),u_rotate_symbol:new d.aX(a),u_aspect_ratio:new d.a4(a),u_fade_change:new d.a4(a),u_matrix:new d.a5(a),u_label_plane_matrix:new d.a5(a),u_coord_matrix:new d.a5(a),u_is_text:new d.aX(a),u_is_sdf:new d.aX(a),u_elevation_from_sea:new d.aX(a),u_pitch_with_map:new d.aX(a),u_texsize:new d.a3(a),u_texsize_icon:new d.a3(a),u_texture:new d.aX(a),u_texture_icon:new d.aX(a),u_gamma_scale:new d.a4(a),u_device_pixel_ratio:new d.a4(a),u_tile_id:new d.a6(a),u_zoom_transition:new d.a4(a),u_inv_rot_matrix:new d.a5(a),u_merc_center:new d.a3(a),u_camera_forward:new d.a6(a),u_tile_matrix:new d.a5(a),u_up_vector:new d.a6(a),u_ecef_origin:new d.a6(a),u_is_halo:new d.aX(a),u_icon_transition:new d.a4(a),u_color_adj_mat:new d.a5(a),u_scale_factor:new d.a4(a),u_ground_shadow_factor:new d.a6(a),u_inv_matrix:new d.a5(a),u_normal_scale:new d.a4(a),u_lutTexture:new d.aX(a),u_spp_fill_np_color:new d.aY(a),u_spp_halo_np_color:new d.aY(a),u_spp_opacity:new d.a4(a),u_spp_halo_width:new d.a4(a),u_spp_halo_blur:new d.a4(a),u_spp_emissive_strength:new d.a4(a),u_spp_occlusion_opacity:new d.a4(a),u_spp_z_offset:new d.a4(a),u_spp_translate_rotation:new d.a3(a),u_spp_zoom_fraction:new d.a4(a),u_opacity_multiplier:new d.a4(a)}),background:a=>({u_matrix:new d.a5(a),u_emissive_strength:new d.a4(a),u_opacity:new d.a4(a),u_color:new d.dp(a)}),backgroundPattern:a=>({u_matrix:new d.a5(a),u_emissive_strength:new d.a4(a),u_opacity:new d.a4(a),u_image:new d.aX(a),u_pattern_tl:new d.a3(a),u_pattern_br:new d.a3(a),u_texsize:new d.a3(a),u_pattern_size:new d.a3(a),u_pixel_coord_upper:new d.a3(a),u_pixel_coord_lower:new d.a3(a),u_pattern_units_to_pixels:new d.a3(a)}),terrainRaster:a=>({u_matrix:new d.a5(a),u_image0:new d.aX(a),u_image1:new d.aX(a),u_skirt_height:new d.a4(a),u_ground_shadow_factor:new d.a6(a),u_emissive_texture_available:new d.a4(a)}),skybox:a=>({u_matrix:new d.a5(a),u_sun_direction:new d.a6(a),u_cubemap:new d.aX(a),u_opacity:new d.a4(a),u_temporal_offset:new d.a4(a)}),skyboxGradient:a=>({u_matrix:new d.a5(a),u_color_ramp:new d.aX(a),u_center_direction:new d.a6(a),u_radius:new d.a4(a),u_opacity:new d.a4(a),u_temporal_offset:new d.a4(a)}),skyboxCapture:a=>({u_matrix_3f:new d.aZ(a),u_sun_direction:new d.a6(a),u_sun_intensity:new d.a4(a),u_color_tint_r:new d.aY(a),u_color_tint_m:new d.aY(a),u_luminance:new d.a4(a)}),globeRaster:a=>({u_proj_matrix:new d.a5(a),u_globe_matrix:new d.a5(a),u_normalize_matrix:new d.a5(a),u_merc_matrix:new d.a5(a),u_zoom_transition:new d.a4(a),u_merc_center:new d.a3(a),u_image0:new d.aX(a),u_image1:new d.aX(a),u_grid_matrix:new d.aZ(a),u_skirt_height:new d.a4(a),u_far_z_cutoff:new d.a4(a),u_frustum_tl:new d.a6(a),u_frustum_tr:new d.a6(a),u_frustum_br:new d.a6(a),u_frustum_bl:new d.a6(a),u_globe_pos:new d.a6(a),u_globe_radius:new d.a4(a),u_viewport:new d.a3(a),u_emissive_texture_available:new d.a4(a)}),globeAtmosphere:a=>({u_frustum_tl:new d.a6(a),u_frustum_tr:new d.a6(a),u_frustum_br:new d.a6(a),u_frustum_bl:new d.a6(a),u_horizon:new d.a4(a),u_transition:new d.a4(a),u_fadeout_range:new d.a4(a),u_atmosphere_fog_color:new d.aY(a),u_high_color:new d.aY(a),u_space_color:new d.aY(a),u_temporal_offset:new d.a4(a),u_horizon_angle:new d.a4(a)}),stars:a=>({u_matrix:new d.a5(a),u_up:new d.a6(a),u_right:new d.a6(a),u_intensity_multiplier:new d.a4(a)}),occlusion:a=>({u_matrix:new d.a5(a),u_anchorPos:new d.a6(a),u_screenSizePx:new d.a3(a),u_occluderSizePx:new d.a3(a),u_color:new d.aY(a)})};class ps{constructor(r,o,u,f){this.id=ps.uniqueIdxCounter,ps.uniqueIdxCounter++,this.context=r;const m=r.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||f||o.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){this.id=ps.uniqueIdxCounter,ps.uniqueIdxCounter++;const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}ps.uniqueIdxCounter=0;const tt={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class dp{constructor(r,o,u,f,m,g){this.length=o.length,this.attributes=u,this.itemSize=o.bytesPerElement,this.dynamicDraw=f,this.instanceCount=g,this.context=r;const x=r.gl;this.buffer=x.createBuffer(),r.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||m||o.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,r.arrayBuffer)}
3410enableAttributes(r,o){for(const u of this.attributes){const f=o.getAttributeLocation(r,u.name);f!==-1&&r.enableVertexAttribArray(f)}}setVertexAttribPointers(r,o,u){for(const f of this.attributes){const m=o.getAttributeLocation(r,f.name);if(m!==-1){const g=f.offset+this.itemSize*(u||0);f.type==="Float32"?r.vertexAttribPointer(m,f.components,r.FLOAT,!1,this.itemSize,g):r.vertexAttribIPointer(m,f.components,r[tt[f.type]],this.itemSize,g)}}}setVertexAttribDivisor(r,o,u){for(let f=0;f<this.attributes.length;f++){const m=o.getAttributeLocation(r,this.attributes[f].name);m!==-1&&this.instanceCount&&this.instanceCount>0&&r.vertexAttribDivisor(m,u)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class bl{constructor(r,o,u,f,m){this.context=r,this.width=o,this.height=u;const g=this.framebuffer=r.gl.createFramebuffer();f>0&&(this.colorAttachment0=new fc(r,g,0)),f>1&&(this.colorAttachment1=new fc(r,g,1)),m&&(this.depthAttachmentType=m,this.depthAttachment=m==="renderbuffer"?new yl(r,g):new sp(r,g))}static createWithTexture(r,o,u,f,m){const g=r.gl;if(r.activeTexture.set(g.TEXTURE1),r.viewport.set([0,0,u,f]),o&&o.width===u&&o.height===f)return g.bindTexture(g.TEXTURE_2D,o.colorAttachment0.get()),r.bindFramebuffer.set(o.framebuffer),o;o&&o.destroy();const x=r.extRenderToTextureHalfFloat||r.extColorBufferFloat?r.gl.RGBA16F:r.gl.RGBA8,w=new d.T(r,{width:u,height:f,data:null},x);w.bind(g.LINEAR,g.CLAMP_TO_EDGE);const E=r.createFramebuffer(u,f,1,null);if(E.format=x,E.colorAttachment0.set(w.texture),m){const I=r.createRenderbuffer(g.DEPTH24_STENCIL8,u,f);r.bindFramebuffer.set(E.framebuffer),g.framebufferRenderbuffer(g.FRAMEBUFFER,g.DEPTH_STENCIL_ATTACHMENT,g.RENDERBUFFER,I),E._stencilRbo=I}return E}createColorAttachment(r,o){o===0?this.colorAttachment0=new fc(r,this.framebuffer,0):o===1&&(this.colorAttachment1=new fc(r,this.framebuffer,1))}removeColorAttachment(r,o){const u=this.context.gl;let f;o===0?(f=this.colorAttachment0.get(),this.colorAttachment0=void 0):o===1&&(f=this.colorAttachment1.get(),this.colorAttachment1=void 0),f&&u.deleteTexture(f)}destroy(){const r=this.context.gl;if(this.colorAttachment0){const o=this.colorAttachment0.get();o&&r.deleteTexture(o)}if(this.colorAttachment1){const o=this.colorAttachment1.get();o&&r.deleteTexture(o)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const o=this.depthAttachment.get();o&&r.deleteRenderbuffer(o)}else{const o=this.depthAttachment.get();o&&r.deleteTexture(o)}this._stencilRbo&&(r.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),r.deleteFramebuffer(this.framebuffer)}}class fp{constructor(r,o){this.gl=r,this._pendingPrograms=new Set,this._compileStats={precompiled:0,onDemand:0,totalStallMs:0,maxStallMs:0,framesMissed:0,stalls:[]},this.clearColor=new x_(this),this.clearDepth=new md(this),this.clearStencil=new _d(this),this.colorMask=new gd(this),this.depthMask=new yd(this),this.stencilMask=new tp(this),this.stencilFunc=new ip(this),this.stencilOp=new v_(this),this.stencilTest=new lu(this),this.depthRange=new cu(this),this.depthTest=new rp(this),this.depthFunc=new Lo(this),this.blend=new xd(this),this.blendFunc=new ah(this),this.blendColor=new b_(this),this.blendEquation=new lh(this),this.cullFace=new vd(this),this.cullFaceSide=new bd(this),this.frontFace=new wd(this),this.program=new Td(this),this.activeTexture=new ch(this),this.viewport=new np(this),this.bindFramebuffer=new op(this),this.bindRenderbuffer=new dc(this),this.bindTexture=new w_(this),this.bindVertexBuffer=new T_(this),this.bindElementBuffer=new E_(this),this.bindVertexArrayOES=new S_(this),this.pixelStoreUnpack=new I_(this),this.pixelStoreUnpackPremultiplyAlpha=new A_(this),this.pixelStoreUnpackFlipY=new Ed(this),this.options=o?{...o}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=r.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=r.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=r.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=o&&
vendor: 4,198 bytes, line 3410
3410!!o.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.includes("PowerVR"),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=r.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=r.getExtension("EXT_color_buffer_half_float"),this.extColorBufferFloat=r.getExtension("EXT_color_buffer_float"),this.extTimerQuery=r.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),this.maxUniformBlockSize=Math.min(r.getParameter(r.MAX_UNIFORM_BLOCK_SIZE),32768),this.maxUniformBufferBindings=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS),this.extBlendFuncExtended=r.getExtension("WEBGL_blend_func_extended"),this.extParallelShaderCompile=r.getExtension("KHR_parallel_shader_compile")}sweepPendingPrograms(){if(this._pendingPrograms.size!==0)for(const r of this._pendingPrograms)r.maybeFinalize()}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(r,o,u){return new ps(this,r,o,u)}createVertexBuffer(r,o,u,f,m){return new dp(this,r,o,u,f,m)}createRenderbuffer(r,o,u){const f=this.gl,m=f.createRenderbuffer();return this.bindRenderbuffer.set(m),f.renderbufferStorage(f.RENDERBUFFER,r,o,u),this.bindRenderbuffer.set(null),m}createFramebuffer(r,o,u,f){return new bl(this,r,o,u,f)}clear({color:r,depth:o,stencil:u,colorMask:f}){const m=this.gl;let g=0;r&&(g|=m.COLOR_BUFFER_BIT,this.clearColor.set(r.toNonPremultipliedRenderColor(null)),this.colorMask.set(f||[!0,!0,!0,!0])),o!==void 0&&(g|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),u!==void 0&&(g|=m.STENCIL_BUFFER_BIT,this.clearStencil.set(u),this.stencilMask.set(255)),m.clear(g)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){d.O(r.blendFunction,d.a1.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)}}const Wn=d.Y();
vendor: 6,788 bytes, line 3410
3410function qo(a){const r=a._camera.getWorldToCamera(a.worldSize,1),o=d.X([],r,a.globeMatrix);d.aO(o,o);const u=[0,0,0],f=[0,1,0,0];return d.c7(f,f,o),u[0]=f[0],u[1]=f[1],u[2]=f[2],d.c3(u,u),u}function pp({width:a,height:r,anchor:o,textOffset:u,textScale:f},m){const{horizontalAlign:g,verticalAlign:x}=d.cM(o),w=-(g-.5)*a,E=-(x-.5)*r,I=d.cN(o,u);return new d.P((w/f+I[0])*m,(E/f+I[1])*m)}function mp(a,r,o,u,f,m,g,x,w,E){const I=a.text.placedSymbolArray,P=a.text.dynamicLayoutVertexArray,R=a.icon.dynamicLayoutVertexArray,B={},V=a.getProjection(),U=nl(g,V,f),Z=f.elevation,q=V.upVectorScale(g.canonical,f.center.lat,f.worldSize).metersToTile;P.clear();for(let X=0;X<I.length;X++){const ne=I.get(X),{tileAnchorX:oe,tileAnchorY:_e,numGlyphs:ae}=ne,ue=ne.hidden||!ne.crossTileID||a.allowVerticalPlacement&&!ne.placedOrientation?null:u[ne.crossTileID];if(ue){let he=0,fe=0,be=0;const Re=a.elevationType==="road";if(Z||Re){const et=new d.P(oe,_e);let Xe=0;if(Re&&a.hdExt){const Qe=a.symbolInstances.get(a.text.symbolInstanceIndices[X]);if(a.hdExt.isCrossTileRoadElevation(Qe.elevationFeatureIndex,g.canonical)){const dt=a.hdExt.getRoadFeatureHeightForPlacedSymbol(a,a.text,X,et,g.canonical);Xe=dt!==null?dt:0}else{const dt=a.hdExt.getElevationFeatureForPlacedSymbol(a,a.text,X);Xe=d.cW.getAtTileOffset(g,et,Z,dt!==void 0?dt:null)}}else Xe=d.cW.getAtTileOffset(g,et,Z,null);const[mt,qe,Ge]=V.upVector(g.canonical,oe,_e);he=Xe*mt*q,fe=Xe*qe*q,be=Xe*Ge*q}let[Ae,Ce,Ee,Ye]=d.cX(ne.projectedAnchorX+he,ne.projectedAnchorY+fe,ne.projectedAnchorZ+be,o?U:m);const De=d.dZ(f.getCameraToCenterDistance(V),Ye);let Ve=d.d4(a.textSizeData,w,ne)*De/d.d1;o&&(Ve*=a.tilePixelRatio/x);const $e=pp(ue,Ve);o?({x:Ae,y:Ce,z:Ee}=V.projectTilePoint(oe+$e.x,_e+$e.y,g.canonical),[Ae,Ce,Ee]=d.cX(Ae+he,Ce+fe,Ee+be,m)):(r&&$e._rotate(-f.angle),Ae+=$e.x,Ce+=$e.y,Ee=0);const ot=a.allowVerticalPlacement&&ne.placedOrientation===d.cL.vertical?Math.PI/2:0;for(let et=0;et<ae;et++)d.d_(P,Ae,Ce,Ee,ot);E&&ne.associatedIconIndex>=0&&(B[ne.associatedIconIndex]={x:Ae,y:Ce,z:Ee,angle:ot})}else d.dY(ae,P)}if(E){R.clear();const X=a.icon.placedSymbolArray;for(let ne=0;ne<X.length;ne++){const oe=X.get(ne),{numGlyphs:_e}=oe,ae=B[ne];if(oe.hidden||!ae)d.dY(_e,R);else{const{x:ue,y:he,z:fe,angle:be}=ae;for(let Re=0;Re<_e;Re++)d.d_(R,ue,he,fe,be)}}a.icon.dynamicLayoutVertexBuffer.updateData(R)}a.text.dynamicLayoutVertexBuffer.updateData(P)}function mh(a,r,o,u,f,m,g={}){const x=o.paint.get("icon-translate"),w=o.paint.get("text-translate"),E=o.paint.get("icon-translate-anchor"),I=o.paint.get("text-translate-anchor"),P=o.layout.get("icon-rotation-alignment"),R=o.layout.get("text-rotation-alignment"),B=o.layout.get("icon-pitch-alignment"),V=o.layout.get("text-pitch-alignment"),U=o.layout.get("icon-keep-upright"),Z=o.layout.get("text-keep-upright"),q=o.paint.get("icon-color-saturation"),X=o.paint.get("icon-color-contrast"),ne=o.paint.get("icon-color-brightness-min"),oe=o.paint.get("icon-color-brightness-max"),_e=o.layout.get("symbol-elevation-reference")==="sea",ae=o.layout.get("icon-image-use-theme")==="none",ue=a.context,he=ue.gl,fe=a.transform,be=P==="map",Re=R==="map",Ae=B==="map",Ce=V==="map",Ee=o.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Ye=!1;const De=a.depthModeForSublayer(0,d.Z.ReadOnly),Ve=new d.Z(a.context.gl.LEQUAL,d.Z.ReadOnly,a.depthRangeFor3D),$e=[d.a7(fe.center.lng),d.a8(fe.center.lat)],ot=o.layout.get("text-variable-anchor"),et=fe.projection.name==="globe",Xe=[],mt=[0,-1,0];for(const qe of u){const Ge=r.getTile(qe),Qe=Ge.getBucket(o);if(!Qe||Qe.projection.name==="mercator"&&et||Qe.fullyClipped)continue;const dt=Qe.projection.name==="globe",rt=dt?d.S(fe.zoom):0,ct=nl(qe,Qe.getProjection(),fe),_t=fe.calculatePixelsToTileUnitsMatrix(Ge),Dt=ot&&Qe.hasTextData(),bt=Qe.hasIconTextFit()&&Dt&&Qe.hasIconData(),Kt=Qe.getProjection().createInversionMatrix(fe,qe.canonical),Ti=(1<<Ge.tileID.canonical.z)*d.a2/a.transform.worldSize,ai=Ri=>{let li=[0,0,0];if(Ri){const rr=a.style.directionalLight,Zr=a.style.ambientLight;rr&&Zr&&(li=d.aF(a.style,rr,Zr))}return li},Ot=Ri=>{const li=Math.floor(a.context.maxUniformBlockSize/4),rr=Math.floor(li/4);Ri.push(`MAX_UBO_SIZE_VEC4 ${rr}u`)},Tt=Ri=>{fe.depthOcclusionForSymbolsAndCircles&&(o.hasOcclusionOpacityProperties||a.terrain)&&(Ri.push("DEPTH_D24"),Ri.push("DEPTH_OCCLUSION"))},Ei=Ri=>{o.lut&&!ae&&(o.lut.texture||(o.lut.texture=new d.e0(a.context,o.lut.image,[o.lut.image.height,o.lut.image.height,o.lut.image.height],ue.gl.RGBA8)),ue.activeTexture.set(ue.gl.TEXTURE0+d.dP.LUT),o.lut.texture&&o.lut.texture.bind(ue.gl.LINEAR,ue.gl.CLAMP_TO_EDGE),Ri.push("APPLY_LUT_ON_GPU"))},Ji=()=>{const Ri=be&&o.layout.get("symbol-placement")!=="point",li=[];Tt(li),Ei(li);const rr=Ri||bt,Zr=Qe.elevationType==="road",Jo=a.shadowRenderer,In=Zr&&Ae&&!!Jo&&Jo.enabled,ms=ai(In),bi=Zr&&Ae&&!a.terrain?Ve:De,Pi=o.paint.get("icon-image-cross-fade");a.terrainRenderModeElevated()&&Ae&&li.push("PITCH_WITH_MAP_TERRAIN"),dt&&(li.push("PROJECTION_GLOBE_VIEW"),rr&&li.push("PROJECTED_POS_ON_VIEWPORT")),Pi>0&&Qe.hasAnySecondaryIcon&&li.push("ICON_TRANSITION"),!Qe.icon.zOffsetVertexBuffer||Zr&&a.terrain||li.push("Z_OFFSET"),q===0&&X===0&&ne===0&&oe===1||li.push("COLOR_ADJUSTMENT"),In&&li.push("RENDER_SHADOWS","NORMAL_OFFSET"),Zr&&Ae&&!a.terrain&&Qe.icon.orientationVertexBuffer&&li.push("ELEVATED_ROADS"),Ot(li);const Jt=a.getOrCreateProgram("symbol",{defines:li}),sr=Ge.imageAtlasTexture?Ge.imageAtlasTexture.size:[0,0],$r=Qe.iconSizeData,Pt=d.cG($r,fe.zoom),nr=Ae||!fe.isOrthographic,pn=d.dX(ct,Ge.tileID.canonical,Ae,be,fe,Qe.getProjection(),_t),Xn=d.cF(ct,Ge.tileID.canonical,Ae,be,fe,Qe.getProjection(),_t),_s=Qe.icon.uboBinder&&Qe.icon.uboBinder.hasPerFeatureTranslate()?[0,0]:x,fi=a.translatePosMatrix(Xn,Ge,_s,E,!0),On=a.translatePosMatrix(ct,Ge,_s,E),zo=rr?Wn:pn,Al=be&&!Ae&&!Ri;let gs=mt;!et&&!fe.mercatorFromTransition||be||(gs=qo(fe));const ys=dt?gs:mt,Lh=o.getColorAdjustmentMatrix(q,X,ne,oe),Ec=Pd($r.kind,Pt,Al,Ae,a,On,zo,fi,_e,!1,Qe.sdfIcons,sr,[0,0],0,qe,rt,$e,Kt,ys,Qe.getProjection(),ms,Ti,Lh,Pi,null),Sc=Ge.imageAtlasTexture?Ge.imageAtlasTexture:null,Qo=o.layout.get("icon-size").constantOr(0)!==1||Qe.iconsNeedLinear,hr=Qe.sdfIcons||a.options.rotating||a.options.zooming||Qo||nr?he.LINEAR:he.NEAREST,St=Qe.sdfIcons&&o.paint.get("icon-halo-width").constantOr(1)!==0,Mr=a.terrain&&Ae&&Ri?d.aO(d.Y(),pn):Wn;if(Ri&&Qe.icon){const dr=d.cW.getAtTileOffsetFunc(qe,fe.center.lat,fe.worldSize,Qe.getProjection()),ef=d.cE(ct,Ge.tileID.canonical,Ae,be,fe,Qe.getProjection(),_t),ks=o.layout.get("icon-size-scale-range"),tf=d.b0(a.scaleFactor,ks[0],ks[1]);d.d$(Qe,ct,a,!1,ef,Xn,Ae,U,dr,qe,tf)}return{program:Jt,buffers:Qe.icon,uniformValues:Ec,atlasTexture:Sc,atlasTextureIcon:null,atlasInterpolation:hr,atlasInterpolationIcon:null,isSDF:Qe.sdfIcons,hasH
vendor: 6,587 bytes, line 3410
3410alo:St,depthMode:bi,tile:Ge,renderWithShadows:In,labelPlaneMatrixInv:Mr}},Ui=()=>{const Ri=Re&&o.layout.get("symbol-placement")!=="point",li=[],rr=Ri||ot||bt,Zr=Qe.elevationType==="road",Jo=a.shadowRenderer,In=Zr&&Ce&&!!Jo&&Jo.enabled,ms=ai(In),bi=Zr&&Ce&&!a.terrain?Ve:De;a.terrainRenderModeElevated()&&Ce&&li.push("PITCH_WITH_MAP_TERRAIN"),dt&&(li.push("PROJECTION_GLOBE_VIEW"),rr&&li.push("PROJECTED_POS_ON_VIEWPORT")),!Qe.text.zOffsetVertexBuffer||Zr&&a.terrain||li.push("Z_OFFSET"),Qe.iconsInText&&li.push("RENDER_TEXT_AND_SYMBOL"),In&&li.push("RENDER_SHADOWS","NORMAL_OFFSET"),Zr&&Ce&&!a.terrain&&Qe.text.orientationVertexBuffer&&li.push("ELEVATED_ROADS"),Tt(li),Ot(li);const Pi=a.getOrCreateProgram("symbol",{defines:li});let Jt,sr=[0,0],$r=null;const Pt=Qe.textSizeData;Qe.iconsInText&&(sr=Ge.imageAtlasTexture?Ge.imageAtlasTexture.size:[0,0],$r=Ge.imageAtlasTexture?Ge.imageAtlasTexture:null,Jt=Ce||!fe.isOrthographic||a.options.rotating||a.options.zooming||Pt.kind==="composite"||Pt.kind==="camera"?he.LINEAR:he.NEAREST);const nr=Ge.glyphAtlasTexture?Ge.glyphAtlasTexture.size:[0,0],pn=o.layout.get("text-size-scale-range"),Xn=d.b0(a.scaleFactor,pn[0],pn[1]),_s=d.cG(Pt,fe.zoom,Xn),fi=d.dX(ct,Ge.tileID.canonical,Ce,Re,fe,Qe.getProjection(),_t),On=d.cF(ct,Ge.tileID.canonical,Ce,Re,fe,Qe.getProjection(),_t),zo=Qe.text.uboBinder&&Qe.text.uboBinder.hasPerFeatureTranslate()?[0,0]:w,Al=a.translatePosMatrix(On,Ge,zo,I,!0),gs=a.translatePosMatrix(ct,Ge,zo,I),ys=rr?Wn:fi,Lh=Re&&!Ce&&!Ri;let Ec=mt;!et&&!fe.mercatorFromTransition||Re||(Ec=qo(fe));const Sc=Pd(Pt.kind,_s,Lh,Ce,a,gs,ys,Al,_e,!0,!0,nr,sr,0,qe,rt,$e,Kt,dt?Ec:mt,Qe.getProjection(),ms,Ti,null,null,Xn),Qo=Ge.glyphAtlasTexture?Ge.glyphAtlasTexture:null,hr=he.LINEAR,St=o.paint.get("text-halo-width").constantOr(1)!==0,Mr=a.terrain&&Ce&&Ri?d.aO(d.Y(),fi):Wn;if(Ri&&Qe.text){const dr=d.cW.getAtTileOffsetFunc(qe,fe.center.lat,fe.worldSize,Qe.getProjection()),ef=d.cE(ct,Ge.tileID.canonical,Ce,Re,fe,Qe.getProjection(),_t);d.d$(Qe,ct,a,!0,ef,On,Ce,Z,dr,qe,Xn)}return{program:Pi,buffers:Qe.text,uniformValues:Sc,atlasTexture:Qo,atlasTextureIcon:$r,atlasInterpolation:hr,atlasInterpolationIcon:Jt,isSDF:!0,hasHalo:St,depthMode:bi,tile:Ge,renderWithShadows:In,labelPlaneMatrixInv:Mr}},Ut=Qe.icon.segments.get().length,Mi=Qe.text.segments.get().length,_i=Ut&&!g.onlyText?Ji():null,ni=Mi&&!g.onlyIcons?Ui():null,lr=o.paint.get("icon-opacity").constantOr(1),cr=o.paint.get("text-opacity").constantOr(1);if(Ee&&Qe.canOverlap){Ye=!0;const Ri=lr&&!g.onlyText?Qe.icon.segments.get():[],li=cr&&!g.onlyIcons?Qe.text.segments.get():[];for(const rr of Ri)Xe.push({segments:new d.ac([rr]),sortKey:rr.sortKey,state:_i});for(const rr of li)Xe.push({segments:new d.ac([rr]),sortKey:rr.sortKey,state:ni})}else g.onlyText||Xe.push({segments:lr?Qe.icon.segments:new d.ac([]),sortKey:0,state:_i}),g.onlyIcons||Xe.push({segments:cr?Qe.text.segments:new d.ac([]),sortKey:0,state:ni})}Ye&&Xe.sort((qe,Ge)=>qe.sortKey-Ge.sortKey);for(const qe of Xe){const Ge=qe.state;if(Ge)if(a.terrain?a.terrain.setupElevationDraw(Ge.tile,Ge.program,{useDepthForOcclusion:fe.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Ge.labelPlaneMatrixInv}):a.setupDepthForOcclusion(fe.depthOcclusionForSymbolsAndCircles,Ge.program),ue.activeTexture.set(he.TEXTURE0),Ge.atlasTexture&&Ge.atlasTexture.bind(Ge.atlasInterpolation,he.CLAMP_TO_EDGE,!0),Ge.atlasTextureIcon&&(ue.activeTexture.set(he.TEXTURE1),Ge.atlasTextureIcon&&Ge.atlasTextureIcon.bind(Ge.atlasInterpolationIcon,he.CLAMP_TO_EDGE,!0)),Ge.renderWithShadows&&a.shadowRenderer.setupShadows(Ge.tile.tileID.toUnwrapped(),Ge.program,"vector-tile"),a.uploadCommonLightUniforms(a.context,Ge.program),Ge.hasHalo){const Qe=Ge.uniformValues;Qe.u_is_halo=1,_h(Ge.buffers,qe.segments,o,a,Ge.program,Ge.depthMode,f,m,Qe,2),Qe.u_is_halo=0}else{if(Ge.isSDF){const Qe=Ge.uniformValues;Ge.hasHalo&&(Qe.u_is_halo=1,_h(Ge.buffers,qe.segments,o,a,Ge.program,Ge.depthMode,f,m,Qe,1)),Qe.u_is_halo=0}_h(Ge.buffers,qe.segments,o,a,Ge.program,Ge.depthMode,f,m,Ge.uniformValues,1)}}}function _h(a,r,o,u,f,m,g,x,w,E){const I=u.context,P=I.gl,R=[a.dynamicLayoutVertexBuffer,a.opacityVertexBuffer,a.iconTransitioningVertexBuffer,a.globeExtVertexBuffer,a.zOffsetVertexBuffer,a.orientationVertexBuffer];a.featureIdBuffer&&R.push(a.featureIdBuffer);const B=a.uboBinder?null:a.programConfigurations.get(o.id);if(a.uboBinder){a.uboBinder.layer=o;const Z=u.transform.zoom,q=u.style.getBrightness?u.style.getBrightness():null,X=a.uboBinder.getConstantUniformValues(Z,q);w.u_spp_fill_np_color=X.fill_np_color,w.u_spp_halo_np_color=X.halo_np_color,w.u_spp_opacity=X.opacity,w.u_spp_halo_width=X.halo_width,w.u_spp_halo_blur=X.halo_blur,w.u_spp_emissive_strength=X.emissive_strength,w.u_spp_occlusion_opacity=X.occlusion_opacity,w.u_spp_z_offset=X.z_offset,w.u_spp_zoom_fraction=Z-a.uboBinder._floorZoom;const ne=o.paint.get(a.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),oe=a.uboBinder.hasPerFeatureTranslate()&&ne==="map"?u.transform.angle:0;w.u_spp_translate_rotation=[Math.cos(oe),Math.sin(oe)]}const{batchIndices:V,batchSegments:U}=a.getBatchGrouping(r);for(const Z of V){const q=U.get(Z);a.uboBinder&&a.uboBinder.bind(I,f.program,Z),f.draw(u,P.TRIANGLES,m,g,x,d.$.disabled,w,o.id,a.layoutVertexBuffer,a.indexBuffer,q,o.paint,u.transform.zoom,B,R,E)}}function gh(a,r,o,u,f,m){const g=o.paint.get("line-width"),x=o.paint.get("line-emissive-strength").isConstant(),w=o.paint.get("line-emissive-strength").constantOr(0),E=o.paint.get("line-occlusion-opacity"),I=o.layout.get("line-elevation-reference"),P=o.layout.get("line-width-unit")==="meters",R=I==="sea",B=!(!a.terrain||!a.terrain.enabled),V=a.context,U=V.gl;if(o.hasElevatedBuckets&&a.transform.projection.name==="globe")return;const Z=o.layout.get("line-cross-slope"),q=Z!==void 0,X=Z<1,ne=f||a.colorModeForDrapableLayerRenderPass(x?w:null),oe=a.terrain&&a.terrain.renderingToTexture||m,_e=oe?1:d.e.devicePixelRatio,ae=o.paint.get("line-dasharray"),ue=ae.constantOr(1),he=o.layout.get("line-cap"),fe=ae.constantOr(null),be=he.constantOr(null),Re=o.paint.get("line-pattern"),Ae=Re.constantOr(1),Ce=o.paint.get("line-pattern-cross-fade"),Ee=Re.constantOr(null),Ye=o.paint.get("line-opacity").constantOr(1);let De=!Ae&&Ye!==1||a.depthOcclusion&&E>0&&E<1;const Ve=o.paint.get("line-gradient"),$e=o.paint.get("line-border-width").constantOr(1)!==0?o.paint.get("line-border-gradient"):null,ot=Ae?"linePattern":"line",et=d.e3(o);let Xe;if(oe&&a.terrain&&a.terrain.clipOrMaskOverlapStencilType()&&(De=!1),E!==0&&a.depthOcclusion){const ct=o.paint._values["line-opacity"];
3410ct&&ct.value&&ct.value.kind==="constant"?Xe=ct.value:d.w(`Occlusion opacity for layer ${o.id} is supported only when line-opacity isn't data-driven.`)}g.value.kind!=="constant"&&g.value.isLineProgressConstant===!1&&et.push("VARIABLE_LINE_WIDTH");const mt=o.paint.get("line-emissive-strength");Ae||mt.value.kind==="constant"||mt.value.isLineProgressConstant!==!1||et.push("VARIABLE_LINE_EMISSIVE_STRENGTH"),a._debugParams.showElevationIdDebug&&et.push("DEBUG_ELEVATION_ID"),oe&&(a.emissiveMode!=="dual-source-blending"||x?a.emissiveMode==="mrt-fallback"&&et.push("USE_MRT1"):et.push("DUAL_SOURCE_BLENDING"));const qe={},Ge=[],Qe=(ct,_t,Dt,bt,Kt,Ti)=>{for(const ai of ct){const Ot=r.getTile(ai);if(Ae&&!Ot.patternsLoaded())continue;const Tt=Ot.getBucket(o);if(!Tt||Tt.elevationType!=="none"&&!Kt||Tt.elevationType==="none"&&Kt)continue;a.prepareDrawTile();const Ei=[..._t],Ji=Tt.elevationType==="road",Ui=a.shadowRenderer,Ut=Ji&&!!Ui&&Ui.enabled;let Mi=[0,0,0];if(Ut){const Pt=a.style.directionalLight,nr=a.style.ambientLight;Pt&&nr&&(Mi=d.aF(a.style,Pt,nr)),Ei.push("RENDER_SHADOWS","NORMAL_OFFSET")}const _i=Tt.programConfigurations.get(o.id);let ni=!1;if(Ee&&Ot.imageAtlas){const Pt=d.aG.from(Ee),nr=Pt.getPrimary().scaleSelf(_e).toString(),pn=Ot.imageAtlas.patternPositions.get(nr),Xn=Pt.getSecondary(),_s=Xn?Ot.imageAtlas.patternPositions.get(Xn.scaleSelf(_e).toString()):null;ni=!!pn&&!!_s,pn&&_i.setConstantPatternPositions(pn,_s)}Ce>0&&(ni||_i.getPatternTransitionVertexBuffer("line-pattern"))&&Ei.push("LINE_PATTERN_TRANSITION"),Tt.elevationGroundScaleVertexBuffer&&Ei.push("ELEVATION_GROUND_SCALE");const lr=a.isTileAffectedByFog(ai),cr=a.getOrCreateProgram(ot,{config:_i,defines:Ei,overrideFog:lr});if(!Ae&&fe&&be&&Ot.lineAtlas){const Pt=Ot.lineAtlas.getDash(fe,be);Pt&&_i.setConstantPatternPositions(Pt)}Ut&&Ui.setupShadows(Ot.tileID.toUnwrapped(),cr,"vector-tile");let[Ri,li]=o.paint.get("line-trim-offset");(be==="round"||be==="square")&&Ri!==li&&(Ri===0&&(Ri-=1),li===1&&(li+=1));const rr=oe?ai.projMatrix:null,Zr=P?1/Tt.tileToMeter/d.c5(Ot,1,a.transform.zoom):1,Jo=P?1/Tt.tileToMeter/d.c5(Ot,1,Math.floor(a.transform.zoom)):1,In=ue?o.paint._values["line-floorwidth"]:null;let ms;if(In&&In.value.kind==="constant"){const Pt=Tt.zoom;Pt in qe||(qe[Pt]=Math.max(.01,o.widthExpression().evaluate({zoom:Pt}))),ms=In.value.value;const nr=Math.floor(a.transform.zoom);In.value.value=qe[Pt]*Math.pow(2,nr-Ot.tileID.overscaledZ)}const bi=Ae?d.e4(a,Ot,o,rr,_e,Zr,Jo,[Ri,li],Mi,Ce):d.e5(a,Ot,o,rr,Tt.lineClipsArray.length,_e,Zr,Jo,[Ri,li],Mi),Pi=(Pt,nr,pn,Xn,_s,fi)=>{let On=Pt.texture;if(nr!==Pt.version){let zo=256;if(pn){const Al=r.getSource().maxzoom,gs=ai.canonical.z===Al?Math.ceil(1<<a.transform.maxZoom-ai.canonical.z):1;zo=d.b0(d.e6(Tt.maxLineLength/d.a2*1024*gs),256,V.maxTextureSize)}Pt.gradient=d.e7({expression:Xn,evaluationKey:"lineProgress",resolution:zo,image:Pt.gradient||void 0,clips:Tt.lineClipsArray,lut:_s?null:o.lut}),Pt.texture?Pt.texture.update(Pt.gradient):Pt.texture=new d.T(V,Pt.gradient,U.RGBA8),Pt.version=nr,On=Pt.texture}V.activeTexture.set(fi),On.bind(pn?U.NEAREST:U.LINEAR,U.CLAMP_TO_EDGE)};Ve&&Pi(Tt.gradients[o.id],o.gradientVersion,o.stepInterpolant,o.gradientExpression(),o.paint.get("line-gradient-use-theme").constantOr("default")==="none",U.TEXTURE1),$e&&Pi(Tt.borderGradients[o.id],o.borderGradientVersion,o.borderStepInterpolant,o.borderGradientExpression(),o.paint.get("line-border-gradient-use-theme").constantOr("default")==="none",U.TEXTURE2),ue&&(V.activeTexture.set(U.TEXTURE0),Ot.lineAtlasTexture&&Ot.lineAtlasTexture.bind(U.LINEAR,U.REPEAT),_i.updatePaintBuffers()),Ae&&(V.activeTexture.set(U.TEXTURE0),Ot.imageAtlasTexture&&Ot.imageAtlasTexture.bind(U.LINEAR,U.CLAMP_TO_EDGE),_i.updatePaintBuffers()),Kt&&!Ji&&a.terrain.setupElevationDraw(Ot,cr),a.uploadCommonUniforms(V,cr,ai.toUnwrapped());const Jt=Et.drawLineFrcCoverageDetect?Et.drawLineFrcCoverageDetect(a,Tt,ai,Kt,bi,_i,cr,Dt,ne,Ge):null,sr=(Pt,nr,pn)=>{nr&&nr.get().length!==0&&(Xe!=null&&(Xe.value=Ye*E),pn!==void 0&&(bi.u_opacity_multiplier=pn),cr.draw(a,U.TRIANGLES,Dt,Pt,ne,d.$.disabled,bi,o.id,Tt.layoutVertexBuffer,Tt.indexBuffer,nr,o.paint,a.transform.zoom,_i,[Tt.layoutVertexBuffer2,Tt.patternVertexBuffer,Tt.zOffsetVertexBuffer,Tt.elevationIdColVertexBuffer,Tt.elevationGroundScaleVertexBuffer]),pn!==void 0&&(bi.u_opacity_multiplier=1),Xe!=null&&(Xe.value=Ye))},$r=Pt=>{Jt&&Jt.active&&Et.drawLineFrcRenderLine?Et.drawLineFrcRenderLine(Tt,Jt,Pt,sr):sr(Pt,Tt.segments)};if(De&&!Kt){const Pt=a.stencilModeForClipping(ai).ref;Pt===0&&oe&&V.clear({stencil:0});const nr={func:U.EQUAL,mask:255};
vendor: 16,345 bytes, line 3410
3410bi.u_alpha_discard_threshold=.8,$r(new d._(nr,Pt,255,U.KEEP,U.KEEP,U.INVERT)),bi.u_alpha_discard_threshold=0,$r(new d._(nr,Pt,255,U.KEEP,U.KEEP,U.KEEP))}else bi.u_alpha_discard_threshold=De&&Kt&&Ti?.8:0,$r(Kt?bt:a.stencilModeForClipping(ai));Jt&&Et.drawLineFrcFadePass&&Et.drawLineFrcFadePass(a,Tt,ai,Jt,Kt,bt,sr),ms!==void 0&&(In.value.value=ms)}};let dt=a.depthModeForSublayer(0,d.Z.ReadOnly);const rt=new d.Z(a.depthOcclusion?U.GREATER:U.LEQUAL,d.Z.ReadOnly,a.depthRangeFor3D);if(o.hasNonElevatedBuckets){const ct=!oe&&a.terrain;E!==0&&ct?d.w(`Occlusion opacity for layer ${o.id} is supported on terrain only if the layer has line-z-offset enabled.`):ct?d.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${o.id}.`):Qe(u,et,dt,d._.disabled,!1,!0)}if(o.hasElevatedBuckets){I==="hd-road-markup"?B||(dt=rt,et.push("ELEVATED_ROADS")):(et.push("ELEVATED"),dt=rt,q&&et.push(X?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),R&&et.push("ELEVATION_REFERENCE_SEA"));const ct=De?a.stencilModeFor3D():d._.disabled;I!=="hd-road-markup"&&(a.forceTerrainMode=!0),Qe(u,et,dt,ct,!0,!0),De&&Qe(u,et,dt,ct,!0,!1),I!=="hd-road-markup"&&(a.forceTerrainMode=!1)}Et.drawLineFrcCoverageSecondPass&&Et.drawLineFrcCoverageSecondPass(a,o,Ge),De&&(a.resetStencilClippingMasks(),oe&&V.clear({stencil:0})),E===0||a.depthOcclusion||oe||a.layersWithOcclusionOpacity.push(a.currentLayer)}class Dd{destroy(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.drapeFbo&&(this.drapeFbo.destroy(),this.drapeFbo=null)}}class yh{constructor(r){this.pbo=r.createBuffer(),this.sync=null,this.fboA=null,this.fboB=null,this.maxDensity=0}destroy(r){this.sync&&(r.deleteSync(this.sync),this.sync=null),r.deleteBuffer(this.pbo),this.fboA&&(this.fboA.destroy(),this.fboA=null),this.fboB&&(this.fboB.destroy(),this.fboB=null)}}const mc={additive:{clearColor:new d.C(0,0,0,0),colorMode:d.a1.additiveAlphaWeighted,compositeUniformValue:1},multiply:{clearColor:new d.C(1,1,1,1),colorMode:d.a1.multiply,compositeUniformValue:0}};function wl(a){return!(!a.extRenderToTextureHalfFloat&&!a.extColorBufferFloat)}function xh(a,r){return a==="additive"&&wl(r)?d.a1.additiveAlphaWeightedUnboundedAlpha:mc[a].colorMode}function Ld(a,r,o){const u=a.context,f=u.gl;let m=o.width,g=o.height,x=o.colorAttachment0.get();r.lineBlendDensityReadback||(r.lineBlendDensityReadback=new yh(f));const w=r.lineBlendDensityReadback;let E=0,I=!0;for(;m>1||g>1;){const B=Math.max(1,Math.floor(m/2)),V=Math.max(1,Math.floor(g/2)),U=E===0?"fboA":"fboB";w[U]=bl.createWithTexture(u,w[U],B,V,!1);const Z=w[U];u.bindFramebuffer.set(Z.framebuffer),u.viewport.set([0,0,B,V]),u.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,x),a.getOrCreateProgram("lineBlendReduce").draw(a,f.TRIANGLES,d.Z.disabled,d._.disabled,d.a1.unblended,d.$.disabled,hp(0,[1/m,1/g],I),r.id,a.viewportBuffer,a.quadTriangleIndexBuffer,a.viewportSegments,r.paint,a.transform.zoom),m=B,g=V,x=Z.colorAttachment0.get(),E=1-E,I=!1}const P=wl(u),R=P?16:4;w.sync&&(f.deleteSync(w.sync),w.sync=null),f.bindBuffer(f.PIXEL_PACK_BUFFER,w.pbo),f.bufferData(f.PIXEL_PACK_BUFFER,R,f.STREAM_READ),f.readPixels(0,0,1,1,f.RGBA,P?f.FLOAT:f.UNSIGNED_BYTE,0),f.bindBuffer(f.PIXEL_PACK_BUFFER,null),w.sync=f.fenceSync(f.SYNC_GPU_COMMANDS_COMPLETE,0),u.viewport.set([0,0,a.width,a.height])}function zd(a,r,o){if(!wl(a.context))return;const u=r.lineBlendDensityReadback;u&&u.sync?(function(f,m,g){if(f.sync&&m.getSyncParameter(f.sync,m.SYNC_STATUS)===m.SIGNALED){if(m.deleteSync(f.sync),f.sync=null,m.bindBuffer(m.PIXEL_PACK_BUFFER,f.pbo),wl(g)){const x=new Float32Array(4);m.getBufferSubData(m.PIXEL_PACK_BUFFER,0,x);const w=x[1];f.maxDensity=Math.max(2*(w>0?x[0]/w:0),1)}else f.maxDensity=1;m.bindBuffer(m.PIXEL_PACK_BUFFER,null)}}(u,a.context.gl,a.context),u.sync||(Ld(a,r,o),a.style.map.triggerRepaint())):(Ld(a,r,o),a.style.map.triggerRepaint())}function Fd(a,r,o,u,f,m){const g=a.context,x=g.gl,w=o==="additive"?1:r.paint.get("line-opacity").constantOr(1),E=o==="additive"?function(P,R){const B=R.paint.get("line-blend-additive-clamp");if(B>0)return B;const V=R.lineBlendDensityReadback;return V&&V.maxDensity!==0?V.maxDensity:null}(0,r):1;if(E===null)return;g.bindFramebuffer.set(f),m&&g.viewport.set([0,0,m[0],m[1]]),g.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,u.colorAttachment0.get());const I=xh(o,a.context);a.getOrCreateProgram("lineBlendComposite").draw(a,x.TRIANGLES,d.Z.disabled,d._.disabled,I,d.$.disabled,((P,R,B,V)=>({u_image:0,u_opacity:R,u_blend_mode:B,u_max_density:V}))(0,w,mc[o].compositeUniformValue,E),r.id,a.viewportBuffer,a.quadTriangleIndexBuffer,a.viewportSegments,r.paint,a.transform.zoom)}function vh(a,r,o,u){const{painter:f,sourceCache:m,layer:g,coords:x,colorMode:w,elevationType:E,terrainEnabled:I,pass:P}=a,R=f.context.gl,B=g.paint.get("fill-pattern"),V=g.paint.get("fill-pattern-cross-fade"),U=B.constantOr(null);let Z=E;E!=="road"||r&&!I||(Z="none");const q=Z==="road",X=a.painter.shadowRenderer,ne=q&&!!X&&X.enabled,oe=new d.Z(f.context.gl.LEQUAL,d.Z.ReadOnly,f.depthRangeFor3D);let _e=[0,0,0];if(ne){const fe=f.style.directionalLight,be=f.style.ambientLight;fe&&be&&(_e=d.aF(f.style,fe,be))}const ae=B&&B.constantOr(1),ue=f.terrain&&f.terrain.renderingToTexture,he=(fe,be)=>{let Re,Ae,Ce,Ee,Ye;be?(Re=ae&&!g.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Ce=R.LINES):(Re=ae?"fillPattern":"fill",Ce=R.TRIANGLES);const De=[];for(const Ve of x){const $e=m.getTile(Ve);if(ae&&!$e.patternsLoaded())continue;const ot=$e.getBucket(g);if(!ot)continue;const et=r?ot.hdExt&&ot.hdExt.elevationBufferData:ot.bufferData;if(!et||et.isEmpty())continue;f.prepareDrawTile();const Xe=et.programConfigurations.get(g.id),mt=f.isTileAffectedByFog(Ve),qe=[],Ge=[];q&&(qe.push("ELEVATED_ROADS"),Ge.push(et.elevatedLayoutVertexBuffer)),ne&&qe.push("RENDER_SHADOWS","NORMAL_OFFSET"),ue&&o&&qe.push("USE_MRT1"),ae&&(f.context.activeTexture.set(R.TEXTURE0),$e.imageAtlasTexture&&$e.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),Xe.updatePaintBuffers());let Qe=!1;if(U&&$e.imageAtlas){const Kt=$e.imageAtlas,Ti=d.aG.from(U),ai=Ti.getPrimary().scaleSelf(d.e.devicePixelRatio).toString(),Ot=Ti.getSecondary(),Tt=Kt.patternPositions.get(ai),Ei=Ot?Kt.patternPositions.get(Ot.scaleSelf(d.e.devicePixelRatio).toString()):null;Qe=!!Tt&&!!Ei,Tt&&Xe.setConstantPatternPositions(Tt,Ei)}V>0&&(Qe||Xe.getPatternTransitionVertexBuffer("fill-pattern"))&&qe.push("FILL_PATTERN_TRANSITION");const dt=f.getOrCreateProgram(Re,{config:Xe,overrideFog:mt,defines:qe}),rt=f.translatePosMatrix(Ve.projMatrix,$e,g.paint.get("fill-translate"),g.paint.get("fill-translate-anchor"));ne&&X.setupShadows($e.tileID.toUnwrapped(),dt,"vector-tile");const ct=g.paint.get("fill-emissive-strength");if(be){Ee=et.lineIndexBuffer,Ye=et.lineSegments;const Kt=f.terrain&&f.terrain.renderingToTexture?f.terrain.drapeBufferSize:[R.drawingBufferWidth,R.drawingBufferHeight];Ae=Re==="fillOutlinePattern"&&ae?M_(rt,ct,f,$e,Kt,_e,V):C_(rt,ct,Kt,_e)}else Ee=et.indexBuffer,Ye=et.triangleSegments,Ae=ae?pc(rt,ct,f,$e,_e,V):Md(rt,ct,_e);f.uploadCommonUniforms(f.context,dt,Ve.toUnwrapped());let _t=fe;if((E==="road"&&!I||E==="offset")&&(_t=oe),!Ye||Ye.get&&Ye.get().length===0)continue;const Dt=u||f.stencilModeForClipping(Ve);let bt="fallthrough";!be&&Et.drawFillFrcCoverageFirstPass&&(bt=Et.drawFillFrcCoverageFirstPass({painter:f,layer:g,bucket:ot,coord:Ve,elevatedGeometry:r,program:dt,programConfiguration:Xe,uniformValues:Ae,drawMode:Ce,depthMode:_t,stencilMode:Dt,colorMode:w,bufferData:et,indexBuffer:Ee,segments:Ye,dynamicBuffers:Ge,polygonCoverageTiles:De})),bt==="fallthrough"&&dt.draw(f,Ce,_t,Dt,w,d.$.disabled,Ae,g.id,et.layoutVertexBuffer,Ee,Ye,g.paint,f.transform.zoom,Xe,Ge)}!be&&Et.drawFillFrcCoverageSecondPass&&Et.drawFillFrcCoverageSecondPass(f,g,De,Ce,w)};f.renderPass===P&&he(f.depthModeForSublayer(1,f.renderPass==="opaque"?d.Z.ReadWrite:d.Z.ReadOnly),!1),Z==="none"&&f.renderPass==="translucent"&&g.paint.get("fill-antialias")&&he(f.depthModeForSublayer(g.getPaintProperty("fill-outline-color")?2:0,d.Z.ReadOnly),!0)}function Od(a){return[a[0]*d.e9,a[1]*d.e9,a[2]*d.e9,0]}function _u(a,r,o,u,f,m,g,x,w){const E=u.getSource(),I=o.globeSharedBuffers;if(!I)return;let P,R,B;if(r&&(P=u.getTile(r)),E instanceof fo?(R=E.texture,B=d.dt(0,0,o.transform)):P&&r&&(R=P.texture,B=d.dt(r.canonical.z,r.canonical.x,o.transform)),!R||!B)return;a||(B=d.aN(d.Y(),B,[1,-1,1]));const V=o.context,U=V.gl,Z=f.paint.get("raster-resampling")==="nearest"?U.NEAREST:U.LINEAR,q=o.colorModeForDrapableLayerRenderPass(m),X=g.defines;X.push("GLOBE_POLES");const ne=new d.Z(U.LEQUAL,d.Z.ReadWrite,o.depthRangeFor3D),oe=o.transform.expandedFarZProjMatrix,_e=Float32Array.from(d.b4(d.b5(new d.bX(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),V.activeTexture.set(U.TEXTURE0),R.bind(Z,U.CLAMP_TO_EDGE),V.activeTexture.set(U.TEXTURE1),R.bind(Z,U.CLAMP_TO_EDGE),"useMipmap"in R&&V.extTextureFilterAnisotropic&&o.transform.pitch>20&&U.texParameterf(U.TEXTURE_2D,V.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,V.extTextureFilterAnisotropicMax);const[ae,ue,he,fe]=r?I.getPoleBuffers(r.canonical.z,!1):I.getPoleBuffers(0,!0),be=f.paint.get("raster-elevation");let Re;a?(Re=ae,o.renderDefaultNorthPole=be!==0):(Re=ue,o.renderDefaultSouthPole=be!==0);const Ae=Od(g.mix),Ce=((Ye,De,Ve,$e,ot,et,Xe,mt,qe,Ge,Qe,dt,rt,ct)=>xl(Ye,De,Ve,$e,new Float32Array(16),new Float32Array(9),[0,0],ot,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Xe,[0,0],qe,2,Qe,dt,rt,1,0,ct))(o,oe,_e,B,d.S(o.transform.zoom),0,f,0,be,0,Ae,g.offset,g.range,m),Ee=o.getOrCreateProgram("raster",{defines:X});o.uploadCommonUniforms(V,Ee,null),Ee.draw(o,U.TRIANGLES,ne,w,q,x,Ce,f.id,Re,he,fe)}function Bd(a){if(a.isOrthographic)return[0,0,0,0];const r=a._nearZ,o=a.projection.farthestPixelDistance(a),u=o-r,f=.2*a.height,m=r+f;return[r,o,(m-f-r)/u,(m-r)/u]}function _p(a,r,o,u){if(a)return r.type==="raster-array"?r.getTextureDescriptor(a,o,!0):{texture:a.texture,mix:Od(u.mix),offset:u.offset,buffer:0,tileSize:1}}const gp=d.d0(new Float32Array(16)),yp=d.a_([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:xp}=yp;function Os(a,r,o,u){a.emplaceBack(r,o,u)}class kd{constructor(r){this.vertexArray=new d.ea,this.indices=new d.ad,Os(this.vertexArray,-1,-1,1),Os(this.vertexArray,1,-1,1),Os(this.vertexArray,-1,1,1),Os(this.vertexArray,1,1,1),Os(this.vertexArray,-1,-1,-1),Os(this.vertexArray,1,-1,-1),Os(this.vertexArray,-1,1,-1),Os(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,xp),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=d.ac.simpleSegment(0,0,36,12)}}function La(a,r,o,u,f,m){const g=a.context.gl,x=r.paint.get("sky-atmosphere-color"),w=r.paint.get("sky-atmosphere-halo-color"),E=r.paint.get("sky-atmosphere-sun-intensity"),I=((P,R,B,V,U)=>({u_matrix_3f:P,u_sun_direction:R,u_sun_intensity:B,u_color_tint_r:[V.r,V.g,V.b,V.a],u_color_tint_m:[U.r,U.g,U.b,U.a],u_luminance:5e-5}))(d.ed(d.ee(),u),f,E,x.toPremultipliedRenderColor(null),w.toPremultipliedRenderColor(null));g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+m,r.skyboxTexture,0),o.draw(a,g.TRIANGLES,d.Z.disabled,d._.disabled,d.a1.unblended,d.$.frontCW,I,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}const vp=d.a_([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Nd{constructor(r){const o=new d.ef;o.emplaceBack(-1,1,1,0,0),o.emplaceBack(1,1,1,1,0),o.emplaceBack(1,-1,1,1,1),o.emplaceBack(-1,-1,1,0,1);const u=new d.ad;u.emplaceBack(0,1,2),u.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(o,vp.members),this.indexBuffer=r.createIndexBuffer(u),this.segments=d.ac.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Vd=d.a_([{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 bp{constructor(){this.colorModeAlphaBlendedWriteRGB=new d.a1([d.eg,d.eh,d.eg,d.eh],d.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new d.a1([d.eg,d.ei,d.eg,d.ei],d.C.transparent,[!1,!1,!1,!0]),this.params={starsCount:16e3,sizeMultiplier:.15,sizeRange:100,intensityRange:200},this.updateNeeded=!0,this._painter=null,this._devtoolsFolder=null}update(r){this._painter=r;const o=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Nd(o);let u=this.params;const f=u.sizeRange,m=u.intensityRange,g=function(P){const R=d.bi(30),B=[];for(let V=0;V<P;++V){const U=2*Math.PI*R(),Z=Math.acos(1-2*R())-.5*Math.PI;B.push(d.bh(Math.cos(Z)*Math.cos(U),Math.cos(Z)*Math.sin(U),Math.sin(Z)))}return B}(u.starsCount),x=d.bi(300),w=new d.ej,E=new d.ad;let I=0;for(let P=0;P<g.length;++P){const R=d.dB([],g[P],200),B=Math.max(0,1+.01*f*(1*x()-.5)),V=Math.max(0,1+.01*m*(1*x()-.5));w.emplaceBack(R[0],R[1],R[2],-1,-1,B,V),w.emplaceBack(R[0],R[1],R[2],1,-1,B,V),w.emplaceBack(R[0],R[1],R[2],1,1,B,V),w.emplaceBack(R[0],R[1],R[2],-1,1,B,V),E.emplaceBack(I+0,I+1,I+2),E.emplaceBack(I+0,I+2,I+3),I+=4}this.starsVx=o.createVertexBuffer(w,Vd.members),this.starsIdx=o.createIndexBuffer(E),this.starsSegments=d.ac.simpleSegment(0,0,w.length,E.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy(),this._painter=null}drawAtmosphereGlow(r,o){const u=r.context,f=u.gl,m=r.transform,g=new d.Z(f.LEQUAL,d.Z.ReadOnly,[0,1]),x=d.S(m.zoom),w=r.style.getLut(o.scope),E=o.properties.get("color-use-theme")==="none",I=o.properties.get("color").toNonPremultipliedRenderColor(E?null:w),P=o.properties.get("high-color-use-theme")==="none",R=o.properties.get("high-color").toNonPremultipliedRenderColor(P?null:w),B=o.properties.get("space-color-use-theme")==="none",V=o.properties.get("space-color").toNonPremultipliedRenderColor(B?null:w),U=5e-4,Z=d.ek(o.properties.get("horizon-blend"),0,1,U,.25),q=d.ds(r,u,m)&&Z===U?m.worldSize/(2*Math.PI*1.025)-1:m.globeRadius,X=r.frameCounter/1e3%1,ne=d.el(m.globeCenterInViewSpace),oe=Math.sqrt(Math.pow(ne,2)-Math.pow(q,2)),_e=Math.acos(oe/ne),ae=ue=>{const he=m.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ue&&he.push("ALPHA_PASS");const fe=r.getOrCreateProgram("globeAtmosphere",{defines:he}),be=((Ae,Ce,Ee,Ye,De,Ve,$e,ot,et,Xe,mt,qe)=>({u_frustum_tl:Ae,u_frustum_tr:Ce,u_frustum_br:Ee,u_frustum_bl:Ye,u_horizon:De,u_transition:Ve,u_fadeout_range:$e,u_atmosphere_fog_color:ot.toArray01(),u_high_color:et.toArray01(),u_space_color:Xe.toArray01(),u_temporal_offset:mt,u_horizon_angle:qe}))(m.frustumCorners.TL,m.frustumCorners.TR,m.frustumCorners.BR,m.frustumCorners.BL,m.frustumCorners.horizon,x,Z,I,R,V,X,_e);r.uploadCommonUniforms(u,fe);const Re=this.atmosphereBuffer;Re&&fe.draw(r,f.TRIANGLES,g,d._.disabled,ue?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,d.$.backCW,be,ue?"atmosphere_glow_alpha":"atmosphere_glow",Re.vertexBuffer,Re.indexBuffer,Re.segments)};ae(!1),ae(!0)}drawStars(r,o){const u=d.b0(o.properties.get("star-intensity"),0,1);if(u===0)return;const f=r.context,m=f.gl,g=r.transform,x=r.getOrCreateProgram("stars"),w=d.bd([]);d.be(w,w,-g._pitch),d.bf(w,w,-g.angle),d.be(w,w,d.au(g._center.lat)),d.em(w,w,-d.au(g._center.lng));const E=d.bg(new Float32Array(16),w),I=d.X([],g.starsProjMatrix,E),P=d.ed([],E),R=d.en([],P);let B=this.params.sizeMultiplier;const V=[0,1,0];d.ct(V,V,R),d.dB(V,V,B);const U=[1,0,0];d.ct(U,U,R),d.dB(U,U,B);const Z=(q=V,X=U,ne=u,{u_matrix:Float32Array.from(I),u_up:q,u_right:X,u_intensity_multiplier:ne});var q,X,ne;r.uploadCommonUniforms(f,x),this.starsVx&&this.starsIdx&&x.draw(r,m.TRIANGLES,d.Z.disabled,d._.disabled,this.colorModeAlphaBlendedWriteRGB,d.$.disabled,Z,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class P_{}class Ud{constructor(){this._storage=new Map}
vendor: 4,129 bytes, line 3410
3410getLinesFromTrianglesBuffer(r,o,u){{const P=this._storage.get(o.id);if(P)return P.lastUsedFrameIdx=r,P.buf}const f=u.gl,m=f.getBufferParameter(f.ELEMENT_ARRAY_BUFFER,f.BUFFER_SIZE),g=new ArrayBuffer(m),x=new Int16Array(g);f.getBufferSubData(f.ELEMENT_ARRAY_BUFFER,0,new Int16Array(g));const w=new d.eo;for(let P=0;P<m/2;P+=3){const R=x[P],B=x[P+1],V=x[P+2];w.emplaceBack(R,B),w.emplaceBack(B,V),w.emplaceBack(V,R)}const E=u.bindVertexArrayOES.current,I=new P_;return I.buf=new ps(u,w),I.lastUsedFrameIdx=r,this._storage.set(o.id,I),u.bindVertexArrayOES.set(E),I.buf}update(r){for(const[o,u]of this._storage)r-u.lastUsedFrameIdx>30&&(u.buf.destroy(),this._storage.delete(o))}destroy(){for(const[r,o]of this._storage)o.buf.destroy(),this._storage.delete(r)}}class wp{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const _c={symbol:function(a,r,o,u,f){if(a.renderPass!=="translucent")return;const m=d._.disabled,g=a.colorModeForRenderPass(),x=o.layout.get("text-variable-anchor"),w=o.layout.get("text-size-scale-range"),E=d.b0(a.scaleFactor,w[0],w[1]);x&&function(R,B,V,U,Z,q,X,ne){const oe=B.transform,_e=Z==="map",ae=q==="map";for(const ue of R){const he=U.getTile(ue),fe=he.getBucket(V);if(!fe||!fe.text||!fe.text.segments.get().length)continue;const be=d.cG(fe.textSizeData,oe.zoom,ne),Re=nl(ue,fe.getProjection(),oe),Ae=oe.calculatePixelsToTileUnitsMatrix(he),Ce=d.dX(Re,he.tileID.canonical,ae,_e,oe,fe.getProjection(),Ae),Ee=fe.hasIconTextFit()&&fe.hasIconData();be&&mp(fe,_e,ae,X,oe,Ce,ue,Math.pow(2,oe.zoom-he.tileID.overscaledZ),be,Ee)}}(u,a,o,r,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),f,E);const I=o.paint.get("icon-opacity").constantOr(1)!==0,P=o.paint.get("text-opacity").constantOr(1)!==0;o.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(I||P)?mh(a,r,o,u,m,g):(I&&mh(a,r,o,u,m,g,{onlyIcons:!0}),P&&mh(a,r,o,u,m,g,{onlyText:!0})),r.map.showCollisionBoxes&&Gn.drawCollisionDebug&&(Gn.drawCollisionDebug(a,r,o,u,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),Gn.drawCollisionDebug(a,r,o,u,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(a,r,o,u){if(a.renderPass!=="translucent")return;const f=o.paint.get("circle-opacity"),m=o.paint.get("circle-stroke-width"),g=o.paint.get("circle-stroke-opacity"),x=o.layout.get("circle-sort-key").constantOr(1)!==void 0,w=o.paint.get("circle-emissive-strength");if(f.constantOr(1)===0&&(m.constantOr(1)===0||g.constantOr(1)===0))return;const E=a.context,I=E.gl,P=a.transform,R=!(!a.terrain||!a.terrain.enabled),B=o.layout.get("circle-elevation-reference"),V=a.depthModeForSublayer(0,d.Z.ReadOnly),U=new d.Z(a.context.gl.LEQUAL,d.Z.ReadOnly,a.depthRangeFor3D),Z=B==="none"||R?V:U,q=d._.disabled,X=a.colorModeForDrapableLayerRenderPass(w),ne=P.projection.name==="globe",oe=[d.a7(P.center.lng),d.a8(P.center.lat)],_e=[];for(let ue=0;ue<u.length;ue++){const he=u[ue],fe=r.getTile(he),be=fe.getBucket(o);if(!be||be.projection.name!==P.projection.name)continue;const Re=be.programConfigurations.get(o.id),Ae=be.layoutVertexBuffer,Ce=be.globeExtVertexBuffer,Ee=be.indexBuffer,Ye=d.e1(o),De=[Ce],Ve=a.isTileAffectedByFog(he);ne&&Ye.push("PROJECTION_GLOBE_VIEW"),Ye.push("DEPTH_D24"),a.terrain&&P.depthOcclusionForSymbolsAndCircles&&Ye.push("DEPTH_OCCLUSION"),be.hdExt&&be.hdExt.hasElevation&&!a.terrain&&(Ye.push("ELEVATED_ROADS"),De.push(be.hdExt.elevatedLayoutVertexBuffer));const $e=a.getOrCreateProgram("circle",{config:Re,defines:Ye,overrideFog:Ve}),ot=P.projection.createInversionMatrix(P,he.canonical),et={programConfiguration:Re,program:$e,layoutVertexBuffer:Ae,dynamicBuffers:De,indexBuffer:Ee,uniformValues:d.e2(a,he,fe,ot,oe,o),tile:fe};if(x){const Xe=be.segments.get();for(const mt of Xe)_e.push({segments:new d.ac([mt]),sortKey:mt.sortKey,state:et})}else _e.push({segments:be.segments,sortKey:0,state:et})}x&&_e.sort((ue,he)=>ue.sortKey-he.sortKey);const ae={useDepthForOcclusion:P.depthOcclusionForSymbolsAndCircles};for(const ue of _e){const{programConfiguration:he,program:fe,layoutVertexBuffer:be,dynamicBuffers:Re,indexBuffer:Ae,uniformValues:Ce,tile:Ee}
3410=ue.state,Ye=ue.segments;a.terrain&&a.terrain.setupElevationDraw(Ee,fe,ae),a.uploadCommonUniforms(E,fe,Ee.tileID.toUnwrapped()),fe.draw(a,I.TRIANGLES,Z,q,X,d.$.disabled,Ce,o.id,be,Ae,Ye,o.paint,P.zoom,he,Re)}},heatmap:function(a,r,o,u){if(o.paint.get("heatmap-opacity")!==0)if(a.renderPass==="offscreen"){const f=a.context,m=f.gl,g=d._.disabled,x=new d.a1([m.ONE,m.ONE,m.ONE,m.ONE],d.C.transparent,[!0,!0,!0,!0]),w=a.transform.projection.name==="globe"?.5:.25;o.heatmapFbo=bl.createWithTexture(f,o.heatmapFbo,a.width*w,a.height*w),f.clear({color:d.C.transparent});const E=a.transform,I=E.projection.name==="globe",P=I?["PROJECTION_GLOBE_VIEW"]:[],R=I?d.$.frontCCW:d.$.disabled,B=[d.a7(E.center.lng),d.a8(E.center.lat)];for(let V=0;V<u.length;V++){const U=u[V];if(r.hasRenderableParent(U))continue;const Z=r.getTile(U),q=Z.getBucket(o);if(!q||q.projection.name!==E.projection.name)continue;const X=a.isTileAffectedByFog(U),ne=q.programConfigurations.get(o.id),oe=a.getOrCreateProgram("heatmap",{config:ne,defines:P,overrideFog:X}),{zoom:_e}=a.transform;a.terrain&&a.terrain.setupElevationDraw(Z,oe),a.uploadCommonUniforms(f,oe,U.toUnwrapped());const ae=E.projection.createInversionMatrix(E,U.canonical);oe.draw(a,m.TRIANGLES,d.Z.disabled,g,x,R,Rd(a,U,Z,ae,B,_e,o.paint.get("heatmap-intensity")),o.id,q.layoutVertexBuffer,q.indexBuffer,q.segments,o.paint,a.transform.zoom,ne,I?[q.globeExtVertexBuffer]:null)}f.viewport.set([0,0,a.width,a.height])}else a.renderPass==="translucent"&&(a.context.setColorMode(a.colorModeForRenderPass()),function(f,m){const g=f.context,x=g.gl,w=m.heatmapFbo;if(!w)return;g.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,w.colorAttachment0.get()),g.activeTexture.set(x.TEXTURE1);let E=m.colorRampTexture;E||(E=m.colorRampTexture=new d.T(g,m.colorRamp,x.RGBA8)),E.bind(x.LINEAR,x.CLAMP_TO_EDGE),f.getOrCreateProgram("heatmapTexture").draw(f,x.TRIANGLES,d.Z.disabled,d._.disabled,f.colorModeForRenderPass(),d.$.disabled,((I,P)=>({u_image:0,u_color_ramp:1,u_opacity:P.paint.get("heatmap-opacity")}))(0,m),m.id,f.viewportBuffer,f.quadTriangleIndexBuffer,f.viewportSegments,m.paint,f.transform.zoom)}(a,o))},line:function(a,r,o,u){const f=o.paint.get("line-opacity"),m=o.paint.get("line-width");if(f.constantOr(1)===0||m.constantOr(1)===0)return;const g=o.paint.get("line-blend-mode"),x=a.terrain&&a.terrain.renderingToTexture;if(g==="default"||a.transform.projection.name==="globe")a.renderPass==="translucent"&&gh(a,r,o,u);else{if(x)return void function(w,E,I,P,R){if(w.renderPass!=="translucent")return;const B=w.context,V=B.gl,U=w.terrain;if(!U)return;const Z=B.bindFramebuffer.current,q=w.emissiveMode==="mrt-fallback",X=U.drapeBufferSize[0],ne=U.drapeBufferSize[1];I.lineBlendFbos||(I.lineBlendFbos=new Dd),I.lineBlendFbos.drapeFbo=bl.createWithTexture(B,I.lineBlendFbos.drapeFbo,X,ne,!0),q&&V.drawBuffers([V.COLOR_ATTACHMENT0]),B.clear({color:mc[R].clearColor,depth:1,stencil:0});const oe=w.currentStencilSource,_e=w._tileClippingMaskIDs,ae=w.nextStencilID;w.currentStencilSource=void 0,w._tileClippingMaskIDs={},w.nextStencilID=1;const ue=w._terrain;w._terrain=null,w._renderTileClippingMasks(I,E,P),gh(w,E,I,P,xh(R,w.context),!0),w._terrain=ue,w.currentStencilSource=oe,w._tileClippingMaskIDs=_e,w.nextStencilID=ae,q&&V.drawBuffers([V.COLOR_ATTACHMENT0,V.COLOR_ATTACHMENT1]);const he=U.drapeBufferSize,fe=I.lineBlendFbos&&I.lineBlendFbos.drapeFbo;fe&&(R==="additive"&&zd(w,I,fe),Fd(w,I,R,fe,Z,he))}(a,r,o,u,g);if(a.renderPass==="offscreen")return void function(w,E,I,P,R){const B=w.context,V=Math.ceil(w.width),U=Math.ceil(w.height);I.lineBlendFbos||(I.lineBlendFbos=new Dd),I.lineBlendFbos.fbo=bl.createWithTexture(B,I.lineBlendFbos.fbo,V,U,!0),B.clear({color:mc[R].clearColor,depth:1,stencil:0});const Z=w.currentStencilSource,q=w._tileClippingMaskIDs,X=w.nextStencilID;w.currentStencilSource=void 0,w._tileClippingMaskIDs={},w.nextStencilID=1,w._renderTileClippingMasks(I,E,P);const ne=w.renderPass;w.renderPass="translucent",gh(w,E,I,P,xh(R,w.context)),w.renderPass=ne,w.currentStencilSource=Z,w._tileClippingMaskIDs=q,w.nextStencilID=X,B.viewport.set([0,0,w.width,w.height]),R==="additive"&&zd(w,I,I.lineBlendFbos.fbo)}(a,r,o,u,g);if(a.renderPass==="translucent"){const w=o.lineBlendFbos&&o.lineBlendFbos.fbo;return void(w&&Fd(a,o,g,w,null))}}},fill:function(a,r,o,u){const f=o.paint.get("fill-color"),m=o.paint.get("fill-opacity");if(m.constantOr(1)===0)return;const g=o.paint.get("fill-emissive-strength"),x=a.colorModeForDrapableLayerRenderPass(g),w=o.paint.get("fill-pattern"),E=a.opaquePassEnabledForLayer()&&!w.constantOr(1)&&f.constantOr(d.C.transparent).a===1&&m.constantOr(0)===1?"opaque":"translucent";let I="none";o.layout.get("fill-elevation-reference")!=="none"?I="road":o.paint.get("fill-z-offset").constantOr(1)!==0&&(I="offset");const P=!(!a.terrain||!a.terrain.enabled),R={painter:a,sourceCache:r,layer:o,coords:u,colorMode:x,elevationType:I,terrainEnabled:P,pass:E};if(a.renderPass==="shadow")return void(a.shadowRenderer&&I==="road"&&!P&&Et.drawElevatedFillShadows&&Et.drawElevatedFillShadows(R));const B=a.emissiveMode==="mrt-fallback";if(I!=="offset"){if(vh(R,!1,B),I==="road"){const V=!P&&a.renderPass==="translucent";V&&Et.drawDepthPrepass&&Et.drawDepthPrepass(a,r,o,u,"geometry"),vh(R,!0,B,d._.disabled),V&&Et.drawElevatedStructures&&Et.drawElevatedStructures(R)}}else vh(R,!1,B,a.stencilModeFor3D())},"fill-extrusion":function(a,r,o,u){const f=o.paint.get("fill-extrusion-opacity"),m=a.context,g=m.gl,x=a.terrain,w=x&&x.renderingToTexture;if(f===0)return;const E=a.emissiveMode==="mrt-fallback",I=a.conflationActive&&a.style.isLayerClipped(o,r.getSource()),P=a.style.order.indexOf(o.fqid);if(I&&function(R,B,V,U,Z){for(const q of U){const X=B.getTile(q).getBucket(V);X&&(X.updateReplacement(q,R.replacementSource,Z),X.uploadCentroid(R.context))}}(a,r,o,u,P),x||I)for(const R of u){const B=r.getTile(R).getBucket(o);B&&vr(a.context,r,R,B,o,x,I)}if(a.renderPass==="shadow"&&a.shadowRenderer){if(x&&f<.65&&o._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof d.aj)return;const R=a.shadowRenderer.getShadowPassDepthMode();mi(a,r,o,u,R,d._.disabled,d.a1.disabled,I)}else if(a.renderPass==="translucent"){const R=!o.paint.get("fill-extrusion-pattern").constantOr(1),B=o.paint.get("fill-extrusion-color").constantOr(d.C.white);if(!w&&B.a!==0){const U=new d.Z(a.context.gl.LEQUAL,d.Z.ReadWrite,a.depthRangeFor3D);f===1&&R?mi(a,r,o,u,U,d._.disabled,d.a1.unblended,I):(mi(a,r,o,u,U,d._.disabled,d.a1.disabled,I),mi(a,r,o,u,U,a.stencilModeFor3D(),a.colorModeForRenderPass(),I),a.resetStencilClippingMasks())}const V=a.style.enable3dLights()&&R&&(!x&&a.transform.projection.name!=="globe"||w);if(V&&!Mt.drawGroundEffect&&$t(),V&&Mt.drawGroundEffect){const U=o.paint.get("fill-extrusion-opacity"),Z=o.paint.get("fill-extrusion-ambient-occlusion-intensity"),q=o.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),X=o.paint.get("fill-extrusion-flood-light-intensity"),ne=o.paint.get("fill-extrusion-flood-light-color-use-theme").
3410constantOr("default")==="none",oe=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ne?null:o.lut).toArray01().slice(0,3),_e=Z>0&&q>0,ae=X>0,ue=new Ft;ue.translate=o.paint.get("fill-extrusion-translate"),ue.translateAnchor=o.paint.get("fill-extrusion-translate-anchor"),ue.edgeRadius=o.layout.get("fill-extrusion-edge-radius"),ue.cutoffFadeRange=o.paint.get("fill-extrusion-cutoff-fade-range");const he=fe=>{const be=a.depthModeForSublayer(1,d.Z.ReadOnly,g.LEQUAL,!0),Re=o.paint.get(fe?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ae=d.al(.1,3,Re),Ce=a._showOverdrawInspector;if(!Ce){const Ee=new d._({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),Ye=new d.a1([g.ONE,g.ONE,g.ONE,g.ONE],d.C.transparent,[!1,!1,!1,!0],g.MIN);Mt.drawGroundEffect(ue,a,r,o,u,be,Ee,Ye,d.$.disabled,fe,"sdf",U,Z,q,X,oe,Ae,I,!1)}{const Ee=Ce?d._.disabled:new d._({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),Ye=Ce?a.colorModeForRenderPass():new d.a1([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],d.C.transparent,[!0,!0,!0,!0]);Mt.drawGroundEffect(ue,a,r,o,u,be,Ee,Ye,d.$.disabled,fe,"color",U,Z,q,X,oe,Ae,I,!1)}};if(w){const fe=()=>{const Re=x.drapeBufferSize[0],Ae=x.drapeBufferSize[1];let Ce=x.framebufferCopyTexture;return Ce&&(!Ce||Ce.size[0]===Re&&Ce.size[1]===Ae)||(Ce&&Ce.destroy(),Ce=x.framebufferCopyTexture=new d.T(m,new d.b({width:Re,height:Ae}),g.RGBA8)),Ce.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.copyTexSubImage2D(g.TEXTURE_2D,0,0,0,0,0,Re,Ae),Ce},be=(Re,Ae,Ce)=>{const Ee=a.depthModeForSublayer(1,d.Z.ReadOnly,g.LEQUAL,!1),Ye=o.paint.get(Re?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),De=d.al(.1,3,Ye);{const Ve=new d.a1([g.ONE,g.ONE,g.ONE,g.ONE],d.C.transparent,[!1,!1,!1,!0]);Mt.drawGroundEffect(ue,a,r,o,u,Ee,d._.disabled,Ve,d.$.disabled,Re,"clear",U,Z,q,X,oe,De,I,Ae)}{const Ve=new d._({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),$e=new d.a1([g.ONE,g.ONE,g.ONE,g.ONE],d.C.transparent,[!1,!1,!1,!0],g.MIN);Mt.drawGroundEffect(ue,a,r,o,u,Ee,Ve,$e,d.$.disabled,Re,"sdf",U,Z,q,X,oe,De,I,Ae)}E&&!Re&&(Ce=fe());{const Ve=Re?g.ZERO:g.ONE_MINUS_DST_ALPHA,$e=new d._({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),ot=new d.a1([Ve,g.DST_ALPHA,g.ONE_MINUS_DST_ALPHA,g.ZERO],d.C.transparent,[!0,!0,!0,!0]);Mt.drawGroundEffect(ue,a,r,o,u,Ee,$e,ot,d.$.disabled,Re,"color",U,Z,q,X,oe,De,I,Ae)}if(!E||Re){const Ve=new d.a1([g.ONE,g.ONE,g.ONE,Re?g.ZERO:g.ONE],d.C.transparent,[!1,!1,!1,!0],Re?g.FUNC_ADD:g.MAX);Mt.drawGroundEffect(ue,a,r,o,u,Ee,d._.disabled,Ve,d.$.disabled,Re,"clear",U,Z,q,X,oe,De,I,Ae,Ce)}else{g.drawBuffers([g.NONE,g.COLOR_ATTACHMENT1]);const Ve=new d._({func:g.EQUAL,mask:255},254,255,g.KEEP,g.DECR,g.DECR),$e=new d.a1([g.ONE,g.ONE,g.ONE,g.ONE],d.C.transparent,[!0,!1,!1,!1],g.MAX);Mt.drawGroundEffect(ue,a,r,o,u,Ee,Ve,$e,d.$.disabled,Re,"emissive",U,Z,q,X,oe,De,I,Ae,Ce),g.drawBuffers([g.COLOR_ATTACHMENT0])}};if(_e||ae){let Re;a.prepareDrawTile(),E&&!_e||(Re=fe()),_e&&be(!0,!1,Re),ae&&be(!1,!0,Re)}}else _e&&he(!0),ae&&he(!1),(_e||ae)&&a.resetStencilClippingMasks()}}},hillshade:function(a,r,o,u){if(a.renderPass!=="offscreen"&&a.renderPass!=="translucent"||a.style.disableElevatedTerrain)return;const f=a.context,m=a.terrain&&a.terrain.renderingToTexture,[g,x]=a.renderPass!=="translucent"||m?[{},u]:a.stencilConfigForOverlap(u);for(const w of x){const E=r.getTile(w);if(E.needsHillshadePrepare&&a.renderPass==="offscreen")y_(a,E,o);else if(a.renderPass==="translucent"){const I=a.depthModeForSublayer(0,d.Z.ReadOnly),P=o.paint.get("hillshade-emissive-strength"),R=a.colorModeForDrapableLayerRenderPass(P),B=m&&a.terrain?a.terrain.stencilModeForRTTOverlap(w):g[w.overscaledZ];hc(a,w,E,o,I,B,R)}}f.viewport.set([0,0,a.width,a.height]),a.resetStencilClippingMasks()},raster:function(a,r,o,u,f,m){if(a.renderPass!=="translucent")return;const g=o.paint.get("raster-opacity");if(g===0)return;const x=a.transform.projection.name==="globe",w=o.paint.get("raster-elevation")!==0,E=w&&x,I=a.terrain&&a.terrain.exaggeration()>0&&w&&o.paint.get("raster-elevation-reference")==="ground",P=!x&&I;if(a.renderElevatedRasterBackface&&!E)return;const R=a.context,B=R.gl,V=r.getSource(),U=function(fe,be,Re,Ae,Ce){const Ee=be.paint.get("raster-color"),Ye=fe.type==="raster-array",De=[],Ve=be.paint.get("raster-resampling"),$e=be.paint.get("raster-color-mix");let ot=be.paint.get("raster-color-range");const et=[$e[0],$e[1],$e[2],0],Xe=$e[3];let mt=Ve==="nearest"?Ae.NEAREST:Ae.LINEAR;if(Ye&&(De.push("RASTER_ARRAY"),Ee||De.push("RASTER_COLOR"),Ve==="linear"&&De.push("RASTER_ARRAY_LINEAR"),mt=Ae.NEAREST,!ot&&fe.rasterLayers)){const qe=fe.rasterLayers.find(({id:Ge})=>Ge===be.sourceLayer);qe&&qe.fields&&qe.fields.range&&(ot=qe.fields.range)}if(ot=ot||[0,1],Ee){De.push("RASTER_COLOR"),Re.activeTexture.set(Ae.TEXTURE2),be.updateColorRamp(ot);let qe=be.colorRampTexture;qe||(qe=be.colorRampTexture=new d.T(Re,be.colorRamp,Ae.RGBA8)),qe.bind(mt,Ae.CLAMP_TO_EDGE)}return Ce&&De.push("USE_MRT1"),{mix:et,range:ot,offset:Xe,defines:De,resampling:mt}}(V,o,R,B,a.terrain&&a.terrain.renderingToTexture&&a.emissiveMode==="mrt-fallback");if(V instanceof fo&&!u.length&&!x)return;const Z=o.paint.get("raster-emissive-strength"),q=a.colorModeForDrapableLayerRenderPass(Z),X=a.terrain&&a.terrain.renderingToTexture,ne=!a.options.moving,oe=o.paint.get("raster-resampling")==="nearest"?B.NEAREST:B.LINEAR;if(V instanceof fo&&!u.length&&(V.onNorthPole||V.onSouthPole)){const fe=w?a.stencilModeFor3D():d._.disabled;return void _u(!!V.onNorthPole,null,a,r,o,Z,U,d.$.disabled,fe)}if(!u.length)return;const[_e,ae]=V instanceof fo||X?[{},u]:a.stencilConfigForOverlap(u),ue=ae.at(-1).overscaledZ;E&&U.defines.push("PROJECTION_GLOBE_VIEW"),w&&U.defines.push("RENDER_CUTOFF","ELEVATED"),I&&U.defines.push("ELEVATION_REFERENCE_GROUND");const he=(fe,be,Re)=>{for(const Ae of fe){const Ce=Ae.toUnwrapped(),Ee=r.getTile(Ae);if(X&&(!Ee||!Ee.hasData()))continue;R.activeTexture.set(B.TEXTURE0);const Ye=_p(Ee,V,o,U);if(!Ye||!Ye.texture)continue;const{texture:De,mix:Ve,offset:$e,tileSize:ot,buffer:et}=Ye;let Xe,mt;X?(Xe=d.Z.disabled,mt=Ae.projMatrix):w?(Xe=new d.Z(B.LEQUAL,d.Z.ReadWrite,a.depthRangeFor3D),mt=x?a.transform.expandedFarZProjMatrix:a.transform.calculateProjMatrix(Ce,ne)):(Xe=a.depthModeForSublayer(Ae.overscaledZ-ue,g===1?d.Z.ReadWrite:d.Z.ReadOnly,B.LESS),mt=a.transform.calculateProjMatrix(Ce,ne));const qe=a.terrain&&X?a.terrain.stencilModeForRTTOverlap(Ae):_e[Ae.overscaledZ],Ge=m?0:o.paint.get("raster-fade-duration");Ee.registerFadeDuration(Ge);const Qe=r.findLoadedParent(Ae,0),dt=Or(Ee,Qe,r,a.transform,Ge);let rt,ct;!dt.isFading&&Ee.refreshedUponExpiration&&(Ee.refreshedUponExpiration=!1),a.terrain&&a.terrain.prepareDrawTile(),R.activeTexture.set(B.TEXTURE0),De.bind(oe,B.CLAMP_TO_EDGE),R.activeTexture.set(B.TEXTURE1),Qe?(Qe.texture&&Qe.texture.bind(oe,B.CLAMP_TO_EDGE),rt=Math.pow(2,Qe.tileID.overscaledZ-Ee.tileID.overscaledZ
3410),ct=[Ee.tileID.canonical.x*rt%1,Ee.tileID.canonical.y*rt%1]):De.bind(oe,B.CLAMP_TO_EDGE),"useMipmap"in De&&R.extTextureFilterAnisotropic&&a.transform.pitch>20&&B.texParameterf(B.TEXTURE_2D,R.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,R.extTextureFilterAnisotropicMax);const _t=a.transform;let Dt;const bt=w?Bd(_t):[0,0,0,0];let Kt,Ti,ai,Ot,Tt,Ei=0;if(E&&V instanceof fo&&V.coordinates.length>3)Kt=Float32Array.from(d.b4(d.b5(new d.bX(0,0,0)))),Ti=Float32Array.from(_t.globeMatrix),ai=Float32Array.from(d.b6(_t)),Ot=[d.a7(_t.center.lng),d.a8(_t.center.lat)],Dt=V.elevatedGlobePerspectiveTransform,Tt=V.elevatedGlobeGridMatrix||new Float32Array(9);else if(E){const Mi=d.b2(Ae.canonical);Ei=d.b3(Mi.getCenter().lat),Kt=Float32Array.from(d.b4(d.b5(Ae.canonical))),Ti=Float32Array.from(_t.globeMatrix),ai=Float32Array.from(d.b6(_t)),Ot=[d.a7(_t.center.lng),d.a8(_t.center.lat)],Dt=[0,0],Tt=Float32Array.from(d.b7(Ae.canonical,Mi,Ei,_t.worldSize/_t._pixelsPerMercatorPixel))}else Dt=V instanceof fo?V.perspectiveTransform:[0,0],Kt=new Float32Array(16),Ti=new Float32Array(9),ai=new Float32Array(16),Ot=[0,0],Tt=new Float32Array(9);const Ji=xl(a,mt,Kt,Ti,ai,Tt,ct||[0,0],d.S(a.transform.zoom),Ot,bt,rt||1,dt,o,Dt,w?o.paint.get("raster-elevation"):0,2,Ve,$e,U.range,ot,et,Z),Ui=a.isTileAffectedByFog(Ae),Ut=a.getOrCreateProgram("raster",{defines:U.defines,overrideFog:Ui});if(a.uploadCommonUniforms(R,Ut,Ce),V instanceof fo){const Mi=V.elevatedGlobeVertexBuffer,_i=V.elevatedGlobeIndexBuffer;if(X||!x)V.boundsBuffer&&V.boundsSegments&&Ut.draw(a,B.TRIANGLES,Xe,d._.disabled,q,d.$.disabled,Ji,o.id,V.boundsBuffer,a.quadTriangleIndexBuffer,V.boundsSegments);else if(Mi&&_i){const ni=_t.zoom<=d.e8?V.elevatedGlobeSegments:V.getSegmentsForLongitude(_t.center.lng);ni&&Ut.draw(a,B.TRIANGLES,Xe,d._.disabled,q,be,Ji,o.id,Mi,_i,ni)}}else if(E){Xe=new d.Z(B.LEQUAL,d.Z.ReadOnly,a.depthRangeFor3D);const Mi=a.globeSharedBuffers;if(Mi){I&&(a.terrain.setupElevationDraw(Ee,Ut),a.uploadCommonUniforms(R,Ut,Ee.tileID.toUnwrapped()));const[_i,ni,lr]=Mi.getGridBuffers(Ei,!1),cr=Ut.getAttributeLocation(B,"a_texture_pos");cr!==-1&&B.vertexAttribI4ui(cr,0,0,0,0),Ut.draw(a,B.TRIANGLES,Xe,Re||qe,a.colorModeForRenderPass(),be,Ji,o.id,_i,ni,lr)}}else if(P)Xe=new d.Z(B.LEQUAL,d.Z.ReadWrite,a.depthRangeFor3D),a.terrain.setupElevationDraw(Ee,Ut),a.uploadCommonUniforms(R,Ut,Ee.tileID.toUnwrapped()),_t.pitch>20&&Ut.draw(a,B.TRIANGLES,Xe,d._.disabled,d.a1.disabled,d.$.frontCCW,Ji,o.id,a.terrain.gridBuffer,a.terrain.gridIndexBuffer,a.terrain.gridSegments),Ut.draw(a,B.TRIANGLES,Xe,qe,q,d.$.backCCW,Ji,o.id,a.terrain.gridBuffer,a.terrain.gridIndexBuffer,a.terrain.gridSegments);else{const{tileBoundsBuffer:Mi,tileBoundsIndexBuffer:_i,tileBoundsSegments:ni}=a.getTileBoundsBuffers(Ee);Ut.draw(a,B.TRIANGLES,Xe,qe,q,d.$.disabled,Ji,o.id,Mi,_i,ni)}}if(!(V instanceof fo)&&E)for(const Ae of fe){const Ce=Ae.canonical.y===(1<<Ae.canonical.z)-1;Ae.canonical.y===0&&_u(!0,Ae,a,r,o,Z,U,be,Re||d._.disabled),Ce&&_u(!1,Ae,a,r,o,Z,U,be===d.$.frontCW?d.$.backCW:d.$.frontCW,Re||d._.disabled)}};E?he(ae,a.renderElevatedRasterBackface?d.$.backCW:d.$.frontCW,a.stencilModeFor3D()):he(ae,d.$.disabled,void 0),a.resetStencilClippingMasks()},background:function(a,r,o,u){const f=o.paint.get("background-color"),m=o.paint.get("background-color-use-theme").constantOr("default")==="none",g=o.paint.get("background-opacity"),x=o.paint.get("background-emissive-strength"),w=o.paint.get("background-pitch-alignment")==="viewport";if(g===0)return;const E=a.context,I=E.gl,P=a.transform,R=P.tileSize,B=o.paint.get("background-pattern");let V;if(B!==void 0&&(B===null||(V=a.imageManager.getPattern(d.I.from(B.toString()),o.scope,a.style.getLut(o.scope)),!V)))return;const U=!B&&f.a===1&&g===1&&a.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.renderPass!==U)return;const Z=d._.disabled,q=a.depthModeForSublayer(0,U==="opaque"?d.Z.ReadWrite:d.Z.ReadOnly),X=a.colorModeForDrapableLayerRenderPass(x),ne=B?"backgroundPattern":"background";let oe,_e=u;_e||(oe=a.getBackgroundTiles(),_e=Object.values(oe).map(ue=>ue.tileID)),B&&(E.activeTexture.set(I.TEXTURE0),a.imageManager.bind(a.context,o.scope));const ae=[];if(a.terrain&&a.terrain.renderingToTexture&&a.emissiveMode==="mrt-fallback"&&ae.push("USE_MRT1"),w){const ue=a.getOrCreateProgram(ne,{overrideFog:!1,overrideRtt:!0,defines:ae}
3410),he=gp,fe=new d.bP(0,0,0,0,0),be=B?pu(he,x,g,a,B,o.scope,V,w,{tileID:fe,tileSize:R}):fu(he,x,g,f.toPremultipliedRenderColor(m?null:o.lut));return void ue.draw(a,I.TRIANGLES,q,Z,X,d.$.disabled,be,o.id,a.viewportBuffer,a.quadTriangleIndexBuffer,a.viewportSegments)}for(const ue of _e){const he=a.isTileAffectedByFog(ue),fe=a.getOrCreateProgram(ne,{overrideFog:he,defines:ae}),be=ue.toUnwrapped(),Re=u?ue.projMatrix:a.transform.calculateProjMatrix(be);a.prepareDrawTile();const Ae=r?r.getTile(ue):oe?oe[ue.key]:new Ps(ue,R,P.zoom,a),Ce=B?pu(Re,x,g,a,B,o.scope,V,w,{tileID:ue,tileSize:R}):fu(Re,x,g,f.toPremultipliedRenderColor(m?null:o.lut));a.uploadCommonUniforms(E,fe,be);const{tileBoundsBuffer:Ee,tileBoundsIndexBuffer:Ye,tileBoundsSegments:De}=a.getTileBoundsBuffers(Ae);fe.draw(a,I.TRIANGLES,q,Z,X,d.$.disabled,Ce,o.id,Ee,Ye,De)}},sky:function(a,r,o){const u=a._atmosphere?d.S(a.transform.zoom):1,f=o.paint.get("sky-opacity")*u;if(f===0)return;const m=a.context,g=o.paint.get("sky-type"),x=new d.Z(m.gl.LEQUAL,d.Z.ReadOnly,[0,1]),w=a.frameCounter/1e3%1;g==="atmosphere"?a.renderPass==="offscreen"?o.needsSkyboxCapture(a)&&(function(E,I){const P=E.context,R=P.gl;let B=I.skyboxFbo;if(!B){B=I.skyboxFbo=P.createFramebuffer(32,32,1,null),I.skyboxGeometry=new kd(P),I.skyboxTexture=P.gl.createTexture(),R.bindTexture(R.TEXTURE_CUBE_MAP,I.skyboxTexture),R.texParameteri(R.TEXTURE_CUBE_MAP,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_CUBE_MAP,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_CUBE_MAP,R.TEXTURE_MIN_FILTER,R.LINEAR),R.texParameteri(R.TEXTURE_CUBE_MAP,R.TEXTURE_MAG_FILTER,R.LINEAR);for(let q=0;q<6;++q)R.texImage2D(R.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,R.RGBA,32,32,0,R.RGBA,R.UNSIGNED_BYTE,null)}P.bindFramebuffer.set(B.framebuffer),P.viewport.set([0,0,32,32]);const V=I.getCenter(E,!0),U=E.getOrCreateProgram("skyboxCapture"),Z=new Float64Array(16);d.eb(Z,.5*-Math.PI),La(E,I,U,Z,V,0),d.eb(Z,.5*Math.PI),La(E,I,U,Z,V,1),d.ec(Z,.5*-Math.PI),La(E,I,U,Z,V,2),d.ec(Z,.5*Math.PI),La(E,I,U,Z,V,3),d.d0(Z),La(E,I,U,Z,V,4),d.eb(Z,Math.PI),La(E,I,U,Z,V,5),P.viewport.set([0,0,E.width,E.height])}(a,o),o.markSkyboxValid(a)):a.renderPass==="sky"&&function(E,I,P,R,B){const V=E.context,U=V.gl,Z=E.transform,q=E.getOrCreateProgram("skybox");V.activeTexture.set(U.TEXTURE0),U.bindTexture(U.TEXTURE_CUBE_MAP,I.skyboxTexture);const X=((ne,oe,_e,ae,ue)=>({u_matrix:ne,u_sun_direction:oe,u_cubemap:0,u_opacity:ae,u_temporal_offset:ue}))(Z.skyboxMatrix,I.getCenter(E,!1),0,R,B);E.uploadCommonUniforms(V,q),q.draw(E,U.TRIANGLES,P,d._.disabled,E.colorModeForRenderPass(),d.$.backCW,X,"skybox",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)}(a,o,x,f,w):g==="gradient"&&a.renderPass==="sky"&&function(E,I,P,R,B){const V=E.context,U=V.gl,Z=E.transform,q=E.getOrCreateProgram("skyboxGradient");I.skyboxGeometry||(I.skyboxGeometry=new kd(V)),V.activeTexture.set(U.TEXTURE0);let X=I.colorRampTexture;X||(X=I.colorRampTexture=new d.T(V,I.colorRamp,U.RGBA8)),X.bind(U.LINEAR,U.CLAMP_TO_EDGE);const ne=((oe,_e,ae,ue,he)=>({u_matrix:oe,u_color_ramp:0,u_center_direction:_e,u_radius:d.au(ae),u_opacity:ue,u_temporal_offset:he}))(Z.skyboxMatrix,I.getCenter(E,!1),I.paint.get("sky-gradient-radius"),R,B);E.uploadCommonUniforms(V,q),q.draw(E,U.TRIANGLES,P,d._.disabled,E.colorModeForRenderPass(),d.$.backCW,ne,"skyboxGradient",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)}(a,o,x,f,w)},custom:function(a,r,o,u){const f=a.context,m=o.implementation;if(!a.transform.projection.unsupportedLayers||!a.transform.projection.unsupportedLayers.includes("custom")||a.terrain&&(a.terrain.renderingToTexture||a.renderPass==="offscreen")&&o.isDraped(r)){if(a.renderPass==="offscreen"){const g=m.prerender;if(g){if(a.setCustomLayerDefaults(),f.setColorMode(a.colorModeForRenderPass()),a.transform.projection.name==="globe"){const x=a.transform.pointMerc;g.call(m,f.gl,a.transform.customLayerMatrix(),a.transform.getProjection(),a.transform.globeToMercatorMatrix(),d.S(a.transform.zoom),[x.x,x.y],a.transform.pixelsPerMeterRatio)}else g.call(m,f.gl,a.transform.customLayerMatrix());f.setDirty(),a.setBaseState()}}else if(a.renderPass==="translucent"){if(a.terrain&&a.terrain.renderingToTexture){const x=m.renderToTile;if(x){const w=u[0].canonical,E={x:w.x+u[0].wrap*(m.wrapTileId?0:1<<w.z),y:w.y,z:w.z};f.setDepthMode(d.Z.disabled),f.setStencilMode(d._.disabled),f.setColorMode(a.colorModeForRenderPass()),a.setCustomLayerDefaults();const I=f.gl;a.emissiveMode==="mrt-fallback"&&I.drawBuffers([I.COLOR_ATTACHMENT0]),x.call(m,f.gl,E),a.emissiveMode==="mrt-fallback"&&I.drawBuffers([I.COLOR_ATTACHMENT0,I.COLOR_ATTACHMENT1]),f.setDirty(),a.setBaseState()}return}a.setCustomLayerDefaults(),f.setColorMode(a.colorModeForRenderPass()),f.setStencilMode(d._.disabled);const g=m.renderingMode==="3d"?new d.Z(a.context.gl.LEQUAL,d.Z.ReadWrite,a.depthRangeFor3D):a.depthModeForSublayer(0,d.Z.ReadOnly);if(f.setDepthMode(g),a.transform.projection.name==="globe"){const x=a.transform.pointMerc;m.render(f.gl,a.transform.customLayerMatrix(),a.transform.getProjection(),a.transform.globeToMercatorMatrix(),d.S(a.transform.zoom),[x.x,x.y],a.transform.pixelsPerMeterRatio)}else m.render(f.gl,a.transform.customLayerMatrix());f.setDirty(),a.setBaseState(),f.bindFramebuffer.set(null)}}else d.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")}},bh={line:function(a,r,o){if(a.hasElevatedBuckets=!1,a.hasNonElevatedBuckets=!1,a._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||a._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(r){const u=r.getVisibleCoordinates();for(const f of u){const m=r.getTile(f).getBucket(a);if(m&&(m.elevationType!=="none"?a.hasElevatedBuckets=!0:a.hasNonElevatedBuckets=!0,a.hasElevatedBuckets&&a.hasNonElevatedBuckets))break}}}else a.hasNonElevatedBuckets=!0},raster:function(a,r,o){const u=r.getSource();if(u.type!=="raster-array"||!u.loaded())return;const f=a.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!f)return;const m=a.paint.get("raster-array-band")||u.getInitialBand(f);if(m==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(a.id,m)&&u.prepareTile(x,f,a.id,m)}};async function Tp(a){if(await $t(),Object.assign(_c,{model:Mt.drawModels}),Object.assign(bh,{model:Mt.prepare}),a&&!a._destroyed&&!a._shadowRenderer){const r=Mt.ShadowRenderer;r&&(a._shadowRenderer=new r(a))}}class mo{constructor(r,o,u,f,m){this.context=new fp(r,o),this.transform=u,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.frcCoverageSnapshot=null,this.elevationCoverageSnapshot=null,this.elevationProvidersReady=void 0,this.frcCoverageFadeRange=null,this.frcCoverageSourceLayers=[],this.frcCoverageRenderer=Et.FrcCoverageRenderer?new Et.FrcCoverageRenderer:null,this._debugParams={averageFPS:0,fpsHistory:[],fpsWindow:30,continousRedraw:!1,enabledLayers:{},buildingsShowNormals:!1,buildingsDrawGroundAO:!0,buildingsDrawShadowPass:!0,buildingsDrawTranslucentPass:!0,showTerrainProxyTiles:!1,terrainSortTilesHiZFirst:!0,terrainDisableRenderCache:!1,forceEnablePrecipitation:!1,overrideSnowParams:!1,snowParamsOverride:null,snowRevealParamsOverride:null,snowVignetteParam
vendor: 10,469 bytes, line 3410
3410sOverride:null,overrideRainParams:!1,rainParamsOverride:null,rainRevealParamsOverride:null,rainVignetteParamsOverride:null,overrideStarsParams:!1,starsParamsOverride:null,show3DModelFootprints:!1,showElevationIdDebug:!1,lodSwitchDistance:-1,lodSwitchFadeDuration:.5},this.occlusionParams=new wp,this.setup(),this.numSublayers=En.maxUnderzooming+En.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this.frameTimeDelta=0,this.lastPaintStartTimeStamp=0,this._shadowCullCache=null,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new d.ep,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._wireframeDebugCache=new Ud,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const g=new d.b({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new d.T(this.context,g,r.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=f,this.maxFrontCutoffRawStart=0,this.worldview=m,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(r,o){const u=!!r&&!!r.terrain&&this.transform.projection.supportsTerrain;if(!(u||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Id(this,r));const f=this._terrain;this.transform.elevation=u?f:null,f.update(r,this.transform,o),this.transform.elevation&&!f.enabled&&(this.transform.elevation=null)}_updateFog(r){const o=r.fog;if(!o||this.transform.projection.name==="globe"||o.getOpacity(this.transform.pitch)<1||o.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[u,f]=o.getRangeForProjection();if(u>f)return void(this.transform.fogCullDistSq=null);const m=u+.78*(f-u);this.transform.fogCullDistSq=m*m}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(r){r&&!this._terrain&&(this._terrain=new Id(this,this.style)),this._forceTerrainMode=r}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,o){if(this.width=r*d.e.devicePixelRatio,this.height=o*d.e.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style.order)this.style._mergedLayers[u].resize()}setup(){const r=this.context,o=new d.bC;o.emplaceBack(0,0),o.emplaceBack(d.a2,0),o.emplaceBack(0,d.a2),o.emplaceBack(d.a2,d.a2),this.tileExtentBuffer=r.createVertexBuffer(o,d.bE.members),this.tileExtentSegments=d.ac.simpleSegment(0,0,4,2);const u=new d.bC;u.emplaceBack(0,0),u.emplaceBack(d.a2,0),u.emplaceBack(0,d.a2),u.emplaceBack(d.a2,d.a2),this.debugBuffer=r.createVertexBuffer(u,d.bE.members),this.debugSegments=d.ac.simpleSegment(0,0,4,5);const f=new d.bC;f.emplaceBack(-1,-1),f.emplaceBack(1,-1),f.emplaceBack(-1,1),f.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(f,d.bE.members),this.viewportSegments=d.ac.simpleSegment(0,0,4,2);const m=new d.bs;m.emplaceBack(0,0,0,0),m.emplaceBack(d.a2,0,d.a2,0),m.emplaceBack(0,d.a2,0,d.a2),m.emplaceBack(d.a2,d.a2,d.a2,d.a2),this.mercatorBoundsBuffer=r.createVertexBuffer(m,Rs.members),this.mercatorBoundsSegments=d.ac.simpleSegment(0,0,4,2);const g=new d.ad;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(g);const x=new d.bD;for(const E of[0,1,3,2,0])x.emplaceBack(E);this.debugIndexBuffer=r.createIndexBuffer(x),this.emptyTexture=new d.T(r,new d.b({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA8),this.identityMat=d.Y();const w=this.context.gl;this.stencilClearMode=new d._({func:w.ALWAYS,mask:0},0,255,w.ZERO,w.ZERO,w.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(r){return r._makeTileBoundsBuffers(this.context,this.transform.projection),r._tileBoundsBuffer?{tileBoundsBuffer:r._tileBoundsBuffer,tileBoundsIndexBuffer:r._tileBoundsIndexBuffer,tileBoundsSegments:r._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,r.TRIANGLES,d.Z.disabled,this.stencilClearMode,d.a1.disabled,d.$.disabled,Ar(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,o,u){if(!o||this.currentStencilSource===o.id||!r.isTileClipped()||!u||u.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let x=!1;for(const w of u)if(this._tileClippingMaskIDs[w.key]===void 0){x=!0;break}if(!x)return}this.currentStencilSource=o.id;const f=this.context,m=f.gl;this.nextStencilID+u.length>256&&this.clearStencil(),f.setColorMode(d.a1.disabled),f.setDepthMode(d.Z.disabled);const g=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const x of u){const w=o.getTile(x),E=this._tileClippingMaskIDs[x.key]=this.nextStencilID++,{tileBoundsBuffer:I,tileBoundsIndexBuffer:P,tileBoundsSegments:R}=this.getTileBoundsBuffers(w);g.draw(this,m.TRIANGLES,d.Z.disabled,new d._({func:m.ALWAYS,mask:0},E,255,m.KEEP,m.KEEP,m.REPLACE),d.a1.disabled,d.$.disabled,Ar(x.projMatrix),"$clipping",I,P,R)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,o=this.context.gl;return new d._({func:o.NOTEQUAL,mask:255},r,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const o=this.context.gl;return new d._({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(r){const o=this.context.gl,u=r.sort((g,x)=>x.overscaledZ-g.overscaledZ),f=u.at(-1).overscaledZ,m=u[0].overscaledZ-f+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const g={};for(let x=0;x<m;x++)g[x+f]=new d._({func:o.GEQUAL,mask:255},x+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=m,[g,u]}return[{[f]:d._.disabled},u]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new d.a1([r.CONSTANT_COLOR,r.ONE,r.CONSTANT_COLOR,r.ONE],new d.C(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?d.a1.unblended:d.a1.alphaBlended}colorModeForDrapableLayerRenderPass(r){const o=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?r!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new d.a1([o.ONE,o.ONE_MINUS_SRC_ALPHA,o.CONSTANT_ALPHA,o.ONE_MINUS_SRC_ALPHA],new d.C(0,0,0,r??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new d.a1([o.ONE,o.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,o.ONE_MINUS_SRC_ALPHA],d.C.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(r,o,u,f=!1){if(this.depthOcclusion)return new d.Z(this.context.gl.GREATER,d.Z.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!f)return d.Z.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new d.Z(u||this.context.gl.LEQUAL,o,[m,m])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const r=this.context.gl,o=Math.ceil(this.width),u=Math.ceil(this.height),f=this.context.bindFramebuffer.get(),m=r.getParameter(r.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===o&&this.depthFBO.height===u||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),o!==0&&u!==0&&(this.depthFBO=new bl(this.context,o,u,0,"texture"),this.depthTexture=new d.T(this.context,{width:o,height:u,data:null},r.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(f),r.bindTexture(r.TEXTURE_2D,m),this.depthFBO&&(r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),r.blitFramebuffer(0,0,o,u,0,0,o,u,r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,this.context.bindFramebuffer.current))}render(r,o){this.context.sweepPendingPrograms(),this.frameTimeDelta=this.lastPaintStartTimeStamp===0?0:o.paintStartTimeStamp-this.lastPaintStartTimeStamp,this.lastPaintStartTimeStamp=o.paintStartTimeStamp,this._wireframeDebugCache.update(this.frameCounter),this.style=r,this.options=o,this.frcCoverageSnapshot&&!this.frcCoverageSnapshot.empty()&&(!this.frcCoverageRenderer&&Et.FrcCoverageRenderer&&(this.frcCoverageRenderer=new Et.FrcCoverageRenderer),this.frcCoverageRenderer&&this.frcCoverageRenderer.update(this.context,this.frcCoverageSnapshot.tiles));const u=this.style._mergedLayers,f=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(f);let g=m(),x=!1,w=!1,E=null,I=0,P=!1;for(const De of g){const Ve=u[De];Ve.visibility!=="none"&&(Ve.type==="circle"?x=!0:Ve.type==="building"?(E=Ve,++I):Ve.type==="symbol"&&(Ve.hasOcclusionOpacityProperties?w=!0:x=!0))}this.updateEmissiveMode();let R=g.map(De=>u[De]);const B=this.style._mergedSourceCaches;this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(d.e.now()),this.imageManager.beginFrame();for(const De in B){const Ve=B[De];Ve.used&&(Ve.prepare(this.context),Ve.getSource().usedInConflation&&++I)}let V=!1;for(const De of R)De.isHidden(this.transform.zoom)||(De.type==="clip"&&(V=!0),this.prepareLayer(De));const U={},Z={},q={},X={},ne={};for(const De in B){const Ve=B[De];U[De]=Ve.getVisibleCoordinates(),Z[De]=U[De].slice().reverse(),q[De]=Ve.getVisibleCoordinates(!0).reverse(),X[De]=Ve.getShadowCasterCoordinates(),ne[De]=Ve.sortCoordinatesByDistance(U[De])}const oe=De=>{const Ve=this.style.getLayerSourceCache(De);return Ve&&Ve.used?Ve.getSource():null};if(I||V||this._clippingActiveLastFrame){const De=[],Ve=[];let $e=0;for(const ot of R)this.isSourceForClippingOrConflation(ot,oe(ot))&&(De.push(ot),Ve.push($e)),$e++;
3410if(De&&(V||De.length>1)||this._clippingActiveLastFrame){V=!1;const ot=[];for(let et=0;et<De.length;et++){const Xe=De[et],mt=Ve[et],qe=this.style.getLayerSourceCache(Xe);if(!qe||!qe.used||!qe.getSource().usedInConflation&&Xe.type!=="clip"&&Xe.type!=="building")continue;let Ge=d.eq,Qe=d.cI.None;const dt=[];let rt=!0;if(Xe.type==="building")Ge=d.eu;else if(Xe.type==="clip")if(Ge=mt,Xe.isHidden(this.transform.zoom))rt=!1;else{if(!Xe.layout){rt=!1;continue}for(const ct of Xe.layout.get("clip-layer-types"))Qe|=ct==="model"?d.cI.Model:ct==="symbol"?d.cI.Symbol:d.cI.FillExtrusion;for(const ct of Xe.layout.get("clip-layer-scope"))dt.push(d.m(ct,Xe.scope));V=!0}rt&&ot.push({layer:Xe.fqid,cache:qe,order:Ge,clipMask:Qe,clipScope:dt})}this.replacementSource.setSources(ot),P=!0}}this._clippingActiveLastFrame=V,P||this.replacementSource.clear(),this.conflationActive=P,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let De=0;De<R.length;De++){const Ve=R[De];if(Ve.visibility==="none")continue;const $e=Ve.cutoffRange();if(this.longestCutoffRange=Math.max($e,this.longestCutoffRange),$e>0){const ot=oe(Ve);ot&&(this.minCutoffZoom=Math.max(ot.minzoom,this.minCutoffZoom)),Ve.minzoom&&(this.minCutoffZoom=Math.max(Ve.minzoom,this.minCutoffZoom))}Ve.is3D(f)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=De),this._lastOcclusionLayer=De)}const _e=this.style&&this.style.fog;_e?(this._fogVisible=_e.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=_e.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(q),this.opaquePassCutoff=0,g=m(),R=g.map(De=>u[De])),this.style.enable3dLights()&&!this._shadowRenderer&&Tp(this);const ae=this._shadowRenderer;if(ae){ae.updateShadowParameters(this.transform,this.style.directionalLight);for(const De in B)for(const Ve of U[De]){let $e={min:0,max:0};this.terrain&&($e=this.terrain.getMinMaxForTile(Ve)||$e),ae.addShadowReceiver(Ve.toUnwrapped(),$e.min,$e.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new d.er(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new bp),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let ue=!(!this.style||!this.style.snow),he=!(!this.style||!this.style.rain);if(ue&&!this._snow&&Et.Snow&&(this._snow=new Et.Snow),!ue&&this._snow&&(this._snow.destroy(),delete this._snow),he&&!this._rain&&Et.Rain&&(this._rain=new Et.Rain),!he&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),E&&(!this.buildingTileBorderManager&&Et.BuildingTileBorderManager&&(this.buildingTileBorderManager=new Et.BuildingTileBorderManager),this.buildingTileBorderManager)){const De=this.style.getLayerSourceCache(E);this.buildingTileBorderManager.updateBorders(De,E)}if(!d.es(this.context.gl))return;this.renderPass="offscreen";for(const De of R){const Ve=r.getLayerSourceCache(De);if(!De.hasOffscreenPass()||De.isHidden(this.transform.zoom))continue;const $e=Ve?Z[Ve.id]:void 0;(De.type==="custom"||De.type==="raster"||De.type==="raster-particle"||De.isSky()||$e&&$e.length)&&this.renderLayer(this,Ve,De,$e)}this.depthRangeFor3D=[0,1-(R.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,X)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const fe=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),be=(()=>{if(o.showOverdrawInspector)return d.C.black;const De=this.style.fog;if(De&&this.transform.projection.supportsFog){const Ve=this.style.getLut(De.scope);if(!fe){const $e=De.properties.get("color-use-theme")==="none",ot=De.properties.get("color").toNonPremultipliedRenderColor($e?null:Ve).toArray01();return new d.C(...ot)}if(fe){const $e=De.properties.get("space-color-use-theme")==="none",ot=De.properties.get("space-color").toNonPremultipliedRenderColor($e?null:Ve).toArray01();return new d.C(...ot)}}return d.C.transparent})();if(this.context.clear({color:be,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&fe&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=g.length-1;this.currentLayer>=0;this.currentLayer--){const De=R[this.currentLayer],Ve=r.getLayerSourceCache(De);
vendor: 4,528 bytes, line 3410
3410if(De.isSky())continue;const $e=Ve?(De.is3D(f)?ne:Z)[Ve.id]:void 0;this._renderTileClippingMasks(De,Ve,$e),this.renderLayer(this,Ve,De,$e)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&fe&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||d.S(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<g.length;this.currentLayer++){const De=R[this.currentLayer],Ve=r.getLayerSourceCache(De);De.isSky()&&this.renderLayer(this,Ve,De,Ve?Z[Ve.id]:void 0)}function Re(De,Ve){let $e;return Ve&&($e=(De.type==="symbol"?q:De.is3D(f)?ne:Z)[Ve.id]),$e}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<g.length;){const De=R[this.currentLayer];if(De.type==="raster"||De.type==="raster-particle"){const Ve=r.getLayerSourceCache(De);this.renderLayer(this,Ve,De,Re(De,Ve))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const Ae=ae?ae.getGroundShadowLayerIndex():-1;let Ce=!1,Ee=-1;for(let De=0;De<g.length;++De){const Ve=R[De];Ve.isHidden(this.transform.zoom)||Ve.is3D(f)&&(Ee=De)}w&&Ee===-1&&(x=!0);let Ye=!1;for(;this.currentLayer<g.length;){const De=R[this.currentLayer],Ve=r.getLayerSourceCache(De);if(De.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(De)){if(De.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Ye&&De.is3D(f)&&!f){const $e=this.currentLayer,ot=et=>{for(this.currentLayer=0;this.currentLayer<R.length;this.currentLayer++){const Xe=R[this.currentLayer];if(Xe.type==="fill"&&Et.drawDepthPrepass){const mt=this.style.getLayerSourceCache(Xe);Et.drawDepthPrepass(this,mt,Xe,Re(Xe,mt),et)}}};ot("initialize"),ot("reset"),this.currentLayer=$e,Ye=!0}if(x&&!Ce&&this.terrain&&!this.transform.isOrthographic&&(Ce=!0,this.blitDepth()),w&&Ee!==-1&&this.currentLayer===Ee+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(De,Ve,Ve?U[Ve.id]:void 0),this.renderLayer(this,Ve,De,Re(De,Ve)),!this.terrain&&ae&&this.currentLayer===Ae){{this.clearStencil(),this.resetStencilClippingMasks();const $e=this.currentLayer;for(this.currentLayer=0;this.currentLayer<R.length;this.currentLayer++){const ot=R[this.currentLayer];if(ot.type==="fill"&&Et.drawGroundShadowMask){const et=this.style.getLayerSourceCache(ot);Et.drawGroundShadowMask(this,et,ot,Re(ot,et))}}this.currentLayer=$e}if(ae.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const $e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=$e;this.currentLayer++){const ot=R[this.currentLayer];if(!ot.hasLightBeamPass())continue;const et=r.getLayerSourceCache(ot);this.renderLayer(this,et,ot,et?Z[et.id]:void 0)}this.currentLayer=$e,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const $e=this.currentLayer;this.depthOcclusion=!0;for(const ot of this.layersWithOcclusionOpacity){this.currentLayer=ot;const et=R[this.currentLayer],Xe=r.getLayerSourceCache(et),mt=Xe?Z[Xe.id]:void 0;this.terrain||this._renderTileClippingMasks(et,Xe,Xe?U[Xe.id]:void 0),this.renderLayer(this,Xe,et,mt)}this.depthOcclusion=!1,this.currentLayer=$e,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 De=null;R.forEach(Ve=>{const $e=r.getLayerSourceCache(Ve);$e&&!Ve.isHidden(this.transform.zoom)&&$e.getVisibleCoordinates().length&&(!De||De.getSource().maxzoom<$e.getSource().maxzoom)&&(De=$e)}),De&&this.options.showTileBoundaries&&Gn.drawDebug&&Gn.drawDebug(this,De,De.getVisibleCoordinates(),d.C.red,!1,this.options.showParseStatus)}this.options.showPadding&&Gn.drawDebugPadding&&Gn.drawDebugPadding(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
vendor: 5,174 bytes, line 3410
3410anvasCopy()),P||(this.conflationActive=!1)}prepareLayer(r){this.gpuTimingStart(r);const{unsupportedLayers:o}=this.transform.projection,u=!o||!o.includes(r.type);if(bh[r.type]&&(u||this.terrain&&r.type==="custom")){const f=this.style.getLayerSourceCache(r);bh[r.type](r,f,this)}this.gpuTimingEnd()}renderLayer(r,o,u,f){u.isHidden(this.transform.zoom)||(u.type==="background"||u.type==="sky"||u.type==="custom"||u.type==="model"||u.type==="raster"||u.type==="raster-particle"||f&&f.length)&&(this.id=u.id,this.gpuTimingStart(u),(!r.transform.projection.unsupportedLayers||!r.transform.projection.unsupportedLayers.includes(u.type)||r.terrain&&u.type==="custom")&&u.type!=="clip"&&u.type!=="slot"&&_c[u.type]&&_c[u.type](r,o,u,f,this.style.placement.variableOffsets,this.options.isInitialLoad),_c[u.type]||(u.mayUse("HD")&&async function(){await Zn(),Object.assign(_c,{building:Et.drawBuilding,"raster-particle":Et.drawRasterParticle}),Object.assign(bh,{"raster-particle":Et.prepareRasterParticle})}(),u.mayUse("Standard")&&Tp(r)),this.gpuTimingEnd())}gpuTimingStart(r){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery,u=this.context.gl;let f=this.gpuTimers[r.id];f||(f=this.gpuTimers[r.id]={calls:0,cpuTime:0,query:u.createQuery()}),f.calls++,u.beginQuery(o.TIME_ELAPSED_EXT,f.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const r=this.context.extTimerQuery,o=this.context.gl,u=o.createQuery();this.deferredRenderGpuTimeQueries.push(u),o.beginQuery(r.TIME_ELAPSED_EXT,u)}}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(){const r=this.gpuTimers;return this.gpuTimers={},r}collectDeferredRenderGpuQueries(){const r=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],r}queryGpuTimers(r){const o={};for(const u in r){const f=r[u],m=this.context.extTimerQuery,g=m.getQueryParameter(f.query,this.context.gl.QUERY_RESULT)/1e6;m.deleteQueryEXT(f.query),o[u]=g}return o}queryGpuTimeDeferredRender(r){if(!this.options.gpuTimingDeferredRender)return 0;const o=this.context.gl;let u=0;for(const f of r)u+=o.getQueryParameter(f,o.QUERY_RESULT)/1e6,o.deleteQuery(f);return u}translatePosMatrix(r,o,u,f,m){if(!u[0]&&!u[1])return r;const g=m?f==="map"?this.transform.angle:0:f==="viewport"?-this.transform.angle:0;if(g){const E=Math.sin(g),I=Math.cos(g);u=[u[0]*I-u[1]*E,u[0]*E+u[1]*I]}const x=[m?u[0]:d.c5(o,u[0],this.transform.zoom),m?u[1]:d.c5(o,u[1],this.transform.zoom),0],w=new Float32Array(16);return d.bM(w,r,x),w}saveTileTexture(r){if(r.context!==this.context)return;const o=r.size[0],u=this._tileTextures[o];u?u.push(r):this._tileTextures[o]=[r]}getTileTexture(r){const o=this._tileTextures[r];return o&&o.length>0?o.pop():null}terrainRenderModeElevated(){return this.style&&this.style.hasTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(r,o,u,f,m){const g=u===void 0?this.terrain&&this.terrain.renderingToTexture:u,x=f===void 0?this.terrainRenderModeElevated():f,w=m===void 0?this.transform.projection.name==="globe":m,E=[];return this.style&&this.style.enable3dLights()&&(r==="globeRaster"||r==="terrainRaster"?(E.push("LIGHTING_3D_MODE"),E.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):g||E.push("LIGHTING_3D_MODE")),x&&(E.push("TERRAIN"),this.linearFloatFilteringSupported()&&E.push("TERRAIN_DEM_FLOAT_FORMAT")),w&&E.push("GLOBE"),!this._fogVisible||g||o!==void 0&&!o||E.push("FOG"),g&&E.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&E.push("OVERDRAW_INSPECTOR"),E}getOrCreateProgram(r,o){this.cache=this.cache||{};const{defines:u,config:f,overrideFog:m,overrideRtt:g,overrideTerrain:x,overrideGlobe:w,precompiled:E}=o||{},I=this.currentGlobalDefines(r,m,g,x,w).concat(u||[]),P=this.getShaderSource(r),R=Et.programUniforms,B=Mt.programUniforms,V=mu[r]||R&&R[r]||B&&B[r],U=up.cacheKey(P,r,I,f);return this.cache[U]||(this.cache[U]=new up(this.context,r,P,f,V,I,E)),this.cache[U]}getShaderSource(r){const o=Et.shaders,u=Mt.shaders;return d.et[r]||o&&o[r]||u&&u[r]}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(){const r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new d.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
3410stroy(),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(),this._destroyed=!0}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,o,u){if(this.style.enable3dLights()){const f=this.style.directionalLight,m=this.style.ambientLight;if(f&&m){const g=((x,w,E,I)=>{const P=x.properties.get("direction"),R=x.properties.get("color-use-theme")==="none",B=x.properties.get("color").toNonPremultipliedRenderColor(R?null:E.getLut(x.scope)).toArray01();let V=x.properties.get("intensity");const U=w.properties.get("color-use-theme")==="none",Z=w.properties.get("color").toNonPremultipliedRenderColor(U?null:E.getLut(w.scope)).toArray01();let q=w.properties.get("intensity");const X=[P.x,P.y,P.z];I&&(I.ambientIntensity!==void 0&&(q=I.ambientIntensity),I.directionalIntensity!==void 0&&(V=I.directionalIntensity),I.ambientColor!==void 0&&(Z[0]=I.ambientColor[0],Z[1]=I.ambientColor[1],Z[2]=I.ambientColor[2]),I.directionalColor!==void 0&&(B[0]=I.directionalColor[0],B[1]=I.directionalColor[1],B[2]=I.directionalColor[2]));const ne=d.dA(Z,q),oe=d.dA(B,V);return{u_lighting_ambient_color:ne,u_lighting_directional_dir:X,u_lighting_directional_color:oe,u_ground_radiance:cp(X,oe,ne)}})(f,m,this.style,u);o.setLightsUniformValues(r,g)}}}uploadCommonUniforms(r,o,u,f,m,g){if(this.uploadCommonLightUniforms(r,o,g),this.terrain&&this.terrain.renderingToTexture)return;const x=this.style.fog;if(x){const w=x.getOpacity(this.transform.pitch),E=((I,P,R,B,V,U,Z,q,X,ne,oe,_e)=>{const ae=I.transform,ue=P.properties.get("color-use-theme")==="none",he=P.properties.get("color").toNonPremultipliedRenderColor(ue?null:I.style.getLut(P.scope)).toArray01();he[3]=B;const fe=I.frameCounter/1e3%1,[be,Re]=P.properties.get("vertical-range");return{u_fog_matrix:R?ae.calculateFogTileMatrix(R):_e||I.identityMat,u_fog_range:P.getRangeForProjection(),u_fog_color:he,u_fog_horizon_blend:P.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(be,Re),Re],u_fog_temporal_offset:fe,u_frustum_tl:V,u_frustum_tr:U,u_frustum_br:Z,u_frustum_bl:q,u_globe_pos:X,u_globe_radius:ne,u_viewport:oe,u_globe_transition:d.S(ae.zoom),u_is_globe:+(ae.projection.name==="globe")}})(this,x,u,w,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*d.e.devicePixelRatio,this.transform.height*d.e.devicePixelRatio],f);o.setFogUniformValues(r,E)}m&&o.setCutoffUniformValues(r,m.uniformValues)}setTileLoadedFlag(r){this.tileLoaded=r}saveCanvasCopy(){const r=this.canvasCopy();r&&(this.frameCopies.push(r),this.tileLoaded=!1)}canvasCopy(){const r=this.context.gl,o=r.createTexture();return r.bindTexture(r.TEXTURE_2D,o),r.copyTexImage2D(r.TEXTURE_2D,0,r.RGBA,0,0,r.drawingBufferWidth,r.drawingBufferHeight,0),o}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const r=this.style&&this.style.fog;return!!r&&r.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const r=this._backgroundTiles,o=this._backgroundTiles={},u=this.transform.coveringTiles({tileSize:512});for(const f of u)o[f.key]=r[f.key]||new Ps(f,512,this.transform.tileZoom,this,void 0,this.worldview);return o}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(r,o){return!(!r.is3D(!(!this.terrain||!this.terrain.enabled))||r.type!=="clip"&&r.type!=="building"&&(r.minzoom&&r.minzoom>this.transform.zoom||(this.style._clipLayerPresent||r.sourceLayer!=="building"&&r.sourceLayer!=="procedural_buildings")&&(!o||o.type!=="batched-model")))}isTileAffectedByFog(r){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let o=this._cachedTileFogOpacities[r.key];return o||(this._cachedTileFogOpacities[r.key]=o=this.style.fog.getOpacityForTile(r)),o[0]>=d.at||o[1]>=d.at}setupDepthForOcclusion(r,o,u){const f=this.context,m=f.gl,g=!!u;var x;u||(u={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}),f.activeTexture.set(m.TEXTURE3),r&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),u.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],u.u_depth_range_unpack=[2/((x=this.depthRangeFor3D)[1]-x[0]),-1-2*x[0]/(x[1]-x[0])],u.u_occluder_half_size=.5*this.occlusionParams.occluderSize,u.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
vendor: 7,960 bytes, line 3410
3410DepthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),f.activeTexture.set(m.TEXTURE0),g||o.setTerrainUniformValues(f,u)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const r=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=r?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function wh(a,r){let o=!1,u=null;const f=()=>{u=null,o&&(a(),u=setTimeout(f,r),o=!1)};return()=>(o=!0,u||f(),u)}const Ln=/(#.+)?$/;class za{constructor(r){this._hashName=r&&encodeURIComponent(r),d.aV(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=wh(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,window.addEventListener("hashchange",this._onHashChange,!1),r.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):this}getHashString(){const r=this._map;if(!r)return"";const o=jd(r);if(this._hashName){const u=this._hashName;let f=!1;const m=location.hash.slice(1).split("&").map(g=>{const x=g.split("=")[0];return x===u?(f=!0,`${x}=${o}`):g}).filter(g=>g);return f||m.push(`${u}=${o}`),`#${m.join("&")}`}return`#${o}`}_getCurrentHash(){const r=location.hash.replace("#","");if(this._hashName){let o;return r.split("&").map(u=>u.split("=")).forEach(u=>{u[0]===this._hashName&&(o=u)}),(o&&o[1]||"").split("/")}return r.split("/")}_onHashChange(){const r=this._map;if(!r)return!1;const o=this._getCurrentHash();if(o.length>=3&&!o.some(u=>isNaN(Number(u)))){const u=r.dragRotate.isEnabled()&&r.touchZoomRotate.isEnabled()?+(o[3]||0):r.getBearing();return r.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:u,pitch:+(o[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(Ln,this.getHashString()))}}function jd(a,r){const o=a.getCenter(),u=Math.round(100*a.getZoom())/100,f=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,f),g=Math.round(o.lng*m)/m,x=Math.round(o.lat*m)/m,w=a.getBearing(),E=a.getPitch();let I=r?`/${g}/${x}/${u}`:`${u}/${x}/${g}`;return(w||E)&&(I+="/"+Math.round(10*w)/10),E&&(I+=`/${Math.round(E)}`),I}const gc={linearity:.3,easing:d.ev(0,0,.3,1)},Gd={deceleration:2500,maxSpeed:1400,...gc},Hd={deceleration:20,maxSpeed:1400,...gc},Ep={deceleration:1e3,maxSpeed:360,...gc},Fa={deceleration:1e3,maxSpeed:90,...gc};class Oi{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:d.e.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,o=d.e.now();for(;r.length>0&&o-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const o={zoom:0,bearing:0,pitch:0,pan:new d.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)o.zoom+=m.zoomDelta||0,o.bearing+=m.bearingDelta||0,o.pitch+=m.pitchDelta||0,m.panDelta&&o.pan._add(m.panDelta),m.around&&(o.around=m.around),m.pinchAround&&(o.pinchAround=m.pinchAround);const u=this._inertiaBuffer.at(-1).time-this._inertiaBuffer[0].time,f={};if(o.pan.mag()){const m=yc(o.pan.mag(),u,{...Gd,...r||{}});f.offset=o.pan.mult(m.amount/o.pan.mag()),f.center=this._map.transform.center,Tl(f,m)}if(o.zoom){const m=yc(o.zoom,u,Hd);f.zoom=this._map.transform.zoom+m.amount,Tl(f,m)}if(o.bearing){const m=yc(o.bearing,u,Ep);f.bearing=this._map.transform.bearing+d.b0(m.amount,-179,179),Tl(f,m)}if(o.pitch){const m=yc(o.pitch,u,Fa);f.pitch=this._map.transform.pitch+m.amount,Tl(f,m)}if(f.zoom||f.bearing){const m=o.pinchAround===void 0?o.around:o.pinchAround;f.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),f.noMoveStart=!0,f}}function Tl(a,r){(!a.duration||a.duration<r.duration)&&(a.duration=r.duration,a.easing=r.easing)}function yc(a,r,o){const{maxSpeed:u,linearity:f,deceleration:m}=o,g=d.b0(a*f/(r/1e3),-u,u),x=Math.abs(g)/(m*f);return{easing:o.easing,duration:1e3*x,amount:g*(x/2)}}class _o extends d.h{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,o,u,f={}){const m=Wi(o.getCanvasContainer(),u);super(r,{point:m,lngLat:o.unproject(m),originalEvent:u,...f}),this._defaultPrevented=!1,this.target=o}}class gu extends d.h{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,o,u){const f=r==="touchend"?u.changedTouches:u.touches,m=mr(o.getCanvasContainer(),f),g=m.map(w=>o.unproject(w)),x=m.reduce((w,E,I,P)=>w.add(E.div(P.length)),new d.P(0,0));super(r,{points:m,point:x,lngLats:g,lngLat:o.unproject(x),originalEvent:u}),this._defaultPrevented=!1}}class Sp extends d.h{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,o){super("wheel",{originalEvent:o}),this._defaultPrevented=!1}}class Zd{constructor(r,o){this._map=r,this._clickTolerance=o.clickTolerance}reset(){this._mousedownPos=void 0}wheel(r){return this._firePreventable(new Sp(this._map,r))}mousedown(r,o){return this._mousedownPos=o,this._firePreventable(new _o(r.type,this._map,r))}mouseup(r){this._map.fire(new _o(r.type,this._map,r))}preclick(r){const o=new MouseEvent("preclick",r);this._map.fire(new _o(o.type,this._map,o))}click(r,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||(this.preclick(r),this._map.fire(new _o(r.type,this._map,r)))}dblclick(r){return this._firePreventable(new _o(r.type,this._map,r))}mouseover(r){this._map.fire(new _o(r.type,this._map,r))}mouseout(r){this._map.fire(new _o(r.type,this._map,r))}touchstart(r){return this._firePreventable(new gu(r.type,this._map,r))}touchmove(r){this._map.fire(new gu(r.type,this._map,r))}touchend(r){this._map.fire(new gu(r.type,this._map,r))}touchcancel(r){this._map.fire(new gu(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class na{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(r){this._map.fire(new _o(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new _o("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._map.fire(new _o(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Oa{constructor(r,o){this._map=r,this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,o){this.isEnabled()&&r.shiftKey&&r.button===0&&(er(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(r,o){if(!this._active)return;const u=o,f=this._startPos,m=this._lastPos;if(!f||!m||m.equals(u)||!this._box&&u.dist(f)<this._clickTolerance)return;this._lastPos=u,this._box||(this._box=si("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",r));const g=Math.min(f.x,u.x),x=Math.max(f.x,u.x),w=Math.min(f.y,u.y),E=Math.max(f.y,u.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${g}px,${w}px)`,this._box.style.width=x-g+"px",this._box.style.height=E-w+"px")})}mouseupWindow(r,o){if(!this._active)return;const u=this._startPos,f=o;if(u&&r.button===0){if(this.reset(),zt(),u.x!==f.x||u.y!==f.y)return this._map.fire(new d.h("boxzoomend",{originalEvent:r})),{cameraAnimation:m=>m.fitScreenCoordinates(u,f,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}
vendor: 12,249 bytes, line 3410
3410keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),Ul(),delete this._startPos,delete this._lastPos}_fireEvent(r,o){return this._map.fire(new d.h(r,{originalEvent:o}))}}function je(a,r){const o={};for(let u=0;u<a.length;u++)o[a[u].identifier]=r[u];return o}class Ze{constructor(r){this.reset(),this.numTouches=r.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,o,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=r.timeStamp),u.length===this.numTouches&&(this.centroid=function(f){const m=new d.P(0,0);for(const g of f)m._add(g);return m.div(f.length)}(o),this.touches=je(u,o)))}touchmove(r,o,u){if(this.aborted||!this.centroid)return;const f=je(u,o);for(const m in this.touches){const g=f[m];(!g||g.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(r,o,u){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const f=!this.aborted&&this.centroid;if(this.reset(),f)return f}}}class oa{constructor(r){this.singleTap=new Ze(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(r,o,u){this.singleTap.touchstart(r,o,u)}touchmove(r,o,u){this.singleTap.touchmove(r,o,u)}touchend(r,o,u){const f=this.singleTap.touchend(r,o,u);if(f){const m=r.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(f)<30;if(m&&g||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=f,this.count===this.numTaps)return this.reset(),f}}}class qi{constructor(){this._zoomIn=new oa({numTouches:1,numTaps:2}),this._zoomOut=new oa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,o,u){this._zoomIn.touchstart(r,o,u),this._zoomOut.touchstart(r,o,u)}touchmove(r,o,u){this._zoomIn.touchmove(r,o,u),this._zoomOut.touchmove(r,o,u)}touchend(r,o,u){const f=this._zoomIn.touchend(r,o,u),m=this._zoomOut.touchend(r,o,u);return f?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()+1,around:g.unproject(f)},{originalEvent:r})}):m?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()-1,around:g.unproject(m)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const me=0,Ip=2,Th={[me]:1,[Ip]:2},Eh={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class yu{constructor(r){this.reset(),this._clickTolerance=r.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(r,o){return!1}_move(r,o){return{}}mousedown(r,o){if(this._lastPoint)return;const u=Is(r);this._correctButton(r,u)&&(this._lastPoint=o,this._eventButton=u)}mousemoveWindow(r,o){const u=this._lastPoint;if(u){if(r.preventDefault(),this._eventButton!=null&&function(f,m){const g=Th[m];return f.buttons===void 0||(f.buttons&g)!==g}(r,this._eventButton))this.reset();else if(this._moved||!(o.dist(u)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(u,o)}}mouseupWindow(r){this._lastPoint&&Is(r)===this._eventButton&&(this._moved&&zt(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ap extends yu{mousedown(r,o){super.mousedown(r,o),this._lastPoint&&(this._active=!0)}_correctButton(r,o){return o===0&&!r.ctrlKey}_move(r,o){return{around:o,panDelta:o.sub(r)}}}class $d extends yu{constructor(r){super(r),this._pitchRotateKey=r.pitchRotateKey?Eh[r.pitchRotateKey]:void 0}_correctButton(r,o){return this._pitchRotateKey?o===0&&r[this._pitchRotateKey]:o===0&&r.ctrlKey||o===2}_move(r,o){const u=.8*(o.x-r.x);if(u)return this._active=!0,{bearingDelta:u}}contextmenu(r){this._pitchRotateKey||r.preventDefault()}}class El extends yu{constructor(r){super(r),this._pitchRotateKey=r.pitchRotateKey?Eh[r.pitchRotateKey]:void 0}_correctButton(r,o){return this._pitchRotateKey?o===0&&r[this._pitchRotateKey]:o===0&&r.ctrlKey||o===2}_move(r,o){const u=-.5*(o.y-r.y);if(u)return this._active=!0,{pitchDelta:u}}contextmenu(r){this._pitchRotateKey||r.preventDefault()}}class D_{constructor(r,o){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=o.clickTolerance||1,this.reset(),d.aV(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new d.P(0,0)}touchstart(r,o,u){return this._calculateTransform(r,o,u)}touchmove(r,o,u){if(this._active&&!(u.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(u.length===1&&!d.ew())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,o,u)}}touchend(r,o,u){this._calculateTransform(r,o,u),this._active&&u.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,o,u){u.length>0&&(this._active=!0);const f=je(u,o),m=new d.P(0,0),g=new d.P(0,0);let x=0;for(const E in f){const I=f[E],P=this._touches[E];P&&(m._add(I),g._add(I.sub(P)),x++,f[E]=I)}if(this._touches=f,x<this._minTouches||!g.mag())return;const w=g.div(x);return this._sum._add(w),this._sum.mag()<this._clickTolerance?void 0:{around:m.div(x),panDelta:w}}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=si("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 qd{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(r){}_move(r,o,u){return{}}touchstart(r,o,u){this._firstTwoTouches||u.length<2||(this._firstTwoTouches=[u[0].identifier,u[1].identifier],this._start([o[0],o[1]]))}touchmove(r,o,u){const f=this._firstTwoTouches;if(!f)return;r.preventDefault();const[m,g]=f,x=xu(u,o,m),w=xu(u,o,g);if(!x||!w)return;const E=this._aroundCenter?null:x.add(w).div(2);return this._move([x,w],E,r)}touchend(r,o,u){if(!this._firstTwoTouches)return;const[f,m]=this._firstTwoTouches,g=xu(u,o,f),x=xu(u,o,m);g&&x||(this._active&&zt(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function xu(a,r,o){for(let u=0;u<a.length;u++)if(a[u].identifier===o)return r[u]}function vu(a,r){return Math.log2(a/r)}class Wd extends qd{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(r){this._startDistance=this._distance=r[0].dist(r[1])}_move(r,o){const u=this._distance;if(this._distance=r[0].dist(r[1]),this._active||!(Math.abs(vu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:vu(this._distance,u),pinchAround:o}}}function Xd(a,r){return 180*a.angleWith(r)/Math.PI}class Cp extends qd{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(r){this._startVector=this._vector=r[0].sub(r[1]),this._minDiameter=r[0].dist(r[1])}_move(r,o){const u=this._vector;if(this._vector=r[0].sub(r[1]),u&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Xd(this._vector,u),pinchAround:o}}_isBelowThreshold(r){this._minDiameter=Math.min(this._minDiameter,r.mag());const o=25/(Math.PI*this._minDiameter)*360,u=this._startVector;if(!u)return!1;const f=Xd(r,u);return Math.abs(f)<o}}function xc(a){return Math.abs(a.y)>Math.abs(a.x)}class bu extends qd{constructor(r){super(),this._map=r}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(r){this._lastPoints=r,xc(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,o,u){const f=this._lastPoints;if(!f)return;const m=r[0].sub(f[0]),g=r[1].sub(f[1]);return this._map._cooperativeGestures&&!d.ew()&&u.touches.length<3||(this._valid=this.gestureBeginsVertically(m,g,u.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:(m.y+g.y)/2*-.5})}gestureBeginsVertically(r,o,u){if(this._valid!==void 0)return this._valid;const f=r.mag()>=2,m=o.mag()>=2;if(!f&&!m)return;if(!f||!m)return this._firstMove??(this._firstMove=u),u-this._firstMove<100&&void 0;const g=r.y>0==o.y>0;return xc(r)&&xc(o)&&g}}const Sh={panStep:100,bearingStep:15,pitchStep:10};class Mp{constructor(){const r=Sh;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1,this._panDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let o=0,u=0,f=0,m=0,g=0;switch(r.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:r.shiftKey?u=-1:(r.preventDefault(),m=-1);break;case 39:r.shiftKey?u=1:(r.preventDefault(),m=1);break;case 38:r.shiftKey?f=1:(r.preventDefault(),g=-1);break;case 40:r.shiftKey?f=-1:(r.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(u=0,f=0),this._panDisabled&&(m=0,g=0),{cameraAnimation:x=>{const w=x.getZoom();x.easeTo({duration:300,easeId:"keyboardHandler",easing:Rp,zoom:o?Math.round(w)+o*(r.shiftKey?2:1):w,bearing:x.getBearing()+u*this._bearingStep,pitch:x.getPitch()+f*this._pitchStep,offset:[-m*this._panStep,-g*this._panStep],center:x.getCenter()},{originalEvent:r})}}}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}disablePan(){this._panDisabled=!0}enablePan(){this._panDisabled=!1}}function Rp(a){return a*(2-a)}const Yd=4.000244140625,Pp=1/450,Dp=/(Mac|iPad)/i;class L_{constructor(r,o){this._map=r,this._el=r.getCanvasContainer(),this._handler=o,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Pp,d.aV(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center",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()||d.ew()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let o=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;
vendor: 5,181 bytes, line 3410
3410const u=d.e.now(),f=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,o!==0&&o%Yd===0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":f>400?(this._type=null,this._lastValue=o,this._timeout=window.setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(f*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),r.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=r,this._delta-=o,this._active||this._start(r)),r.preventDefault()}_onTimeout(r){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)}_start(r){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);const o=Wi(this._el,r);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:o,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;const r=this._map.transform;this._type==="wheel"&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const o=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(this._delta!==0){const E=this._type==="wheel"&&Math.abs(this._delta)>Yd?this._wheelZoomRate:this._defaultZoomRate;let I=2/(1+Math.exp(-Math.abs(this._delta*E)));this._delta<0&&I!==0&&(I=1/I);const P=o(),R=Math.pow(2,P),B=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):R;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(B*I))),this._type==="wheel"&&(this._startZoom=P,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:o(),f=this._startZoom,m=this._easing;let g,x=!1;if(this._type==="wheel"&&f&&m){const E=Math.min((d.e.now()-this._lastWheelEventTime)/200,1),I=m(E);g=d.al(f,u,I),E<1?this._frameId||(this._frameId=!0):x=!0}else g=u,x=!0;this._active=!0,x&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let w=g-o();return w*this._lastDelta<0&&(w=0),{noInertia:!0,needsRenderFrame:!x,zoomDelta:w,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let o=d.ex;if(this._prevEase){const u=this._prevEase,f=(d.e.now()-u.start)/u.duration,m=u.easing(f+.01)-u.easing(f),g=.27/Math.sqrt(m*m+1e-4)*.01,x=Math.sqrt(.0729-g*g);o=d.ev(g,x,.25,1)}return this._prevEase={start:d.e.now(),duration:r,easing:o},o}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=si("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=Dp.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 Lp{constructor(r,o){this._clickZoom=r,this._tapZoom=o}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 z_{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(r,o){return r.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:u.getZoom()+(r.shiftKey?-1:1),around:u.unproject(o)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zn{constructor(){this._tap=new oa({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(r,o,u){this._swipePoint||(this._tapTime&&r.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?u.length>0&&(this._swipePoint=o[0],this._swipeTouch=u[0].identifier):this._tap.touchstart(r,o,u))}touchmove(r,o,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const f=o[0],m=f.y-this._swipePoint.y;return this._swipePoint=f,r.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(r,o,u)}touchend(r,o,u){this._tapTime?this._swipePoint&&u.length===0&&this.reset():this._tap.touchend(r,o,u)&&(this._tapTime=r.t
vendor: 11,412 bytes, line 3410
3410imeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ih{constructor(r,o,u){this._el=r,this._mousePan=o,this._touchPan=u}enable(r){this._inertiaOptions=r||{},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 vc{constructor(r,o,u){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=o,this._mousePitch=u,this._pitchDisabled=!1}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&!this._pitchDisabled&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._pitchDisabled||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}disablePitch(){this._pitchDisabled=!0,this._mousePitch.disable()}enablePitch(){this._pitchDisabled=!1,this._pitchWithRotate&&this._mouseRotate.isEnabled()&&this._mousePitch.enable()}}class zp{constructor(r,o,u,f){this._el=r,this._touchZoom=o,this._touchRotate=u,this._tapDragZoom=f,this._rotationDisabled=!1,this._tapDragZoomDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoomDisabled||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._tapDragZoomDisabled||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()}disableTapDragZoom(){this._tapDragZoomDisabled=!0,this._tapDragZoom.disable()}enableTapDragZoom(){this._tapDragZoomDisabled=!1,this._touchZoom.isEnabled()&&this._tapDragZoom.enable()}}const Bs=a=>a.zoom||a.drag||a.pitch||a.rotate;class wu extends d.h{}class F_{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,o){const u=d.c2([],o,r);this.radius=d.el(u[2]<0?d.ez([],u,this.constants):[u[0],u[1],0])}projectRay(r){d.ez(r,r,this.constants),d.c3(r,r),d.eA(r,r,this.constants);const o=d.dB([],r,this.radius);if(o[2]>0){const u=d.dB([],[0,0,1],d.dE(o,[0,0,1])),f=d.dB([],d.c3([],[o[0],o[1],0]),this.radius),m=d.dC([],o,d.dB([],d.c2([],d.dC([],f,u),o),2));o[0]=m[0],o[1]=m[1]}return o}}function Ah(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}class O_{constructor(r,o){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Oi(r),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new F_,this._dragOrigin=null,this._mouseBeingPressed=!1,this._activeTouchCount=0,this._eventsInProgress={},this._addDefaultHandlers(o),d.aV(["handleEvent","handleWindowEvent"],this);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[f,m,g]of this._listeners){const x=f===document?this.handleWindowEvent:this.handleEvent;f.addEventListener(m,x,g)}}destroy(){for(const[r,o,u]of this._listeners){const f=r===document?this.handleWindowEvent:this.handleEvent;r.removeEventListener(o,f,u)}}_addDefaultHandlers(r){const o=this._map,u=o.getCanvasContainer();this._add("mapEvent",new Zd(o,r));const f=o.boxZoom=new Oa(o,r);this._add("boxZoom",f);const m=new qi,g=new z_;o.doubleClickZoom=new Lp(g,m),this._add("tapZoom",m),this._add("clickZoom",g);const x=new zn;this._add("tapDragZoom",x);const w=o.touchPitch=new bu(o);this._add("touchPitch",w);const E=new $d(r),I=new El(r);o.dragRotate=new vc(r,E,I),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]);const P=new Ap(r),R=new D_(o,r);o.dragPan=new Ih(u,P,R),this._add("mousePan",P),this._add("touchPan",R,["touchZoom","touchRotate"]);const B=new Cp,V=new Wd;o.touchZoomRotate=new zp(u,V,B,x),this._add("touchRotate",B,["touchPan","touchZoom"]),this._add("touchZoom",V,["touchPan","touchRotate"]),this._add("blockableMapEvent",new na(o));const U=o.scrollZoom=new L_(o,this);this._add("scrollZoom",U,["mousePan"]);const Z=o.keyboard=new Mp;this._add("keyboard",Z);for(const q of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])r.interactive&&r[q]&&o[q].enable(r[q])}_add(r,o,u){this._handlers.push({handlerName:r,handler:o,allowed:u}),this._handlersById[r]=o}stop(r="never"){if(!this._updatingCamera&&!(r==="always"||r==="ifPointerDown"&&this._isPointerDown())){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},!1),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Bs(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(r,o,u){for(const f in r)if(!(f===u||o&&o.includes(f)))return!0;return!1}handleWindowEvent(r){this.handleEvent(r,`${r.type}Window`)}_getMapTouches(r){const o=[];for(const u of r)this._el.contains(u.target)&&o.push(u);return o}_updatePointerLiveness(r){switch(r.type){case"mousedown":this._mouseBeingPressed=!0;break;case"mousemove":r.buttons===0&&(this._mouseBeingPressed=!1);break;case"mouseup":this._mouseBeingPressed=!1;break;case"touchstart":case"touchmove":case"touchend":case"touchcancel":this._activeTouchCount=r.touches?r.touches.length:0;break;case"blur":this._mouseBeingPressed=!1,this._activeTouchCount=0}}_isPointerDown(){return this._mouseBeingPressed||this._activeTouchCount>0}handleEvent(r,o){this._updatePointerLiveness(r),this._updatingCamera=!0;const u=r.type==="renderFrame",f=u?void 0:r,m={needsRenderFrame:!1},g={},x={},w=r.touches?this._getMapTouches(r.touches):void 0,E=w?mr(this._el,w):u?void 0:Wi(this._el,r);for(const{handlerName:R,handler:B,allowed:V}of this._handlers){if(!B.isEnabled())continue;let U;this._blockedByActive(x,V,R)?B.reset():B[o||r.type]&&(U=B[o||r.type](r,E,w),this.mergeHandlerResult(m,g,U,R,f),U&&U.needsRenderFrame&&this._triggerRenderFrame()),(U||B.isActive())&&(x[R]=B)}const I={};for(const R in this._previousActiveHandlers)x[R]||(I[R]=f);this._previousActiveHandlers=x,(Object.keys(I).length||Ah(m))&&(this._changes.push([m,g,I]),this._triggerRenderFrame()),(Object.keys(x).length||Ah(m))&&this._map._stop({keepGesture:"always"}),this._updatingCamera=!1;const{cameraAnimation:P}=m;P&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],P(this._map))}mergeHandlerResult(r,o,u,f,m){if(!u)return;Object.assign(r,u);const g={handlerName:f,originalEvent:u.originalEvent||m};u.zoomDelta!==void 0&&(o.zoom=g),u.panDelta!==void 0&&(o.drag=g),u.pitchDelta!==void 0&&(o.pitch=g),u.bearingDelta!==void 0&&(o.rotate=g)}_applyChanges(){const r={},o={},u={};for(const[f,m,g]of this._changes)f.panDelta&&(r.panDelta=(r.panDelta||new d.P(0,0))._add(f.panDelta)),f.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+f.pitchDelta),f.around!==void 0&&(r.around=f.around),f.aroundCoord!==void 0&&(r.aroundCoord=f.aroundCoord),f.pinchAround!==void 0&&(r.pinchAround=f.pinchAround),f.noInertia&&(r.noInertia=f.noInertia),Object.assign(o,m),Object.assign(u,g);this._updateMapTransform(r,o,u),this._changes=[]}_updateMapTransform(r,o,u){const f=this._map,m=f.transform,g=X=>[X.x,X.y,X.z];if((()=>{const X=this._eventsInProgress.drag;return X&&!this._handlersById[X.handlerName].isActive()})()&&!Ah(r)){const X=m.zoom;m.cameraElevationReference="sea",this._originalZoom!=null&&m._orthographicProjectionAtLowPitch&&m.projection.name!=="globe"&&m.pitch===0?(m.cameraElevationReference="ground",m.zoom=this._originalZoom):(m.recenterOnTerrain(),m.cameraElevationReference="ground"),X!==m.zoom&&this._map._update(!0)}if(m._isCameraConstrained&&f._stop({keepGesture:"always"}),!Ah(r))return void this._fireEvents(o,u,!0);let{panDelta:x,zoomDelta:w,bearingDelta:E,pitchDelta:I,around:P,aroundCoord:R,pinchAround:B}=r;m._isCameraConstrained&&(w>0&&(w=0),m._isCameraConstrained=!1),B!==void 0&&(P=B),(w||(X=>o[X]&&!this._eventsInProgress[X])("drag"))&&P&&(this._dragOrigin=g(m.pointCoordinate3D(P)),this._originalZoom=m.zoom,this._trackingEllipsoid.setup(m._camera.position,this._dragOrigin)),m.cameraElevationReference="sea",f._stop({keepGesture:"always"}),P=P||f.transform.centerPoint,E&&(m.bearing+=E),I&&(m.pitch+=I),m._updateCameraState();const V=[0,0,0];if(x)if(m.projection.name==="mercator"){const X=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(P).dir),ne=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(P.sub(x)).dir);V[0]=ne[0]-X[0],V[1]=ne[1]-X[1]}else{const X=m.pointCoordinate(P);if(m.projection.name==="globe"){x=x.rotate(-m.angle);const ne=m._pixelsPerMercatorPixel/m.worldSize;V[0]=-x.x*d.ey(d.br(X.y))*ne,V[1]=-x.y*d.ey(m.center.lat)*ne}else{const ne=m.pointCoordinate(P.sub(x));X&&ne&&(V[0]=ne.x-X.x,V[1]=ne.y-X.y)}}const U=m.zoom,Z=[0,0,0];if(w){const X=g(R||m.pointCoordinate3D(P)),ne={dir:d.c3([],d.c2([],X,m._camera.position))};if(ne.dir[2]<0){const oe=m.zoomDeltaToMovement(X,w);d.dB(Z,ne.dir,oe)}}const q=d.dC(V,V,Z);m._translateCameraConstrained(q),w&&Math.abs(m.zoom-U)>1e-4&&m.recenterOnTerrain(),m.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(o,u,!0)}_fireEvents(r,o,u){const f=Bs(this._eventsInProgress),m=Bs(r),g={};for(const I in r){const{originalEvent:P}=r[I];this._eventsInProgress[I]||(g[`${I}start`]=P),this._eventsInProgress[I]=r[I]}!f&&m&&this._fireEvent("movestart",m.originalEvent);for(const I in g)this._fireEvent(I,g[I]);m&&this._fireEvent("move",m.originalEvent);for(const I in r){const{originalEvent:P}=r[I];this._fireEvent(I,P)}const x={};let w;for(const I in this._eventsInProgress){const{handlerName:P,originalEvent:R}=this._eventsInProgress[I];this._handlersById[P].isActive()||(delete this._eventsInProgress[I],w=o[P]||R,x[`${I}end`]=w)}for(const I in x)this._fireEvent(I,x[I]);const E=Bs(this._eventsInProgress);if(u&&(f||m)&&!E){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=R=>R!==0&&-this._bearingSnap<R&&R<this._bearingSnap;
vendor: 13,171 bytes, line 3410
3410I?(P(I.bearing||this._map.getBearing())&&(I.bearing=0),this._map.easeTo(I,{originalEvent:w})):(this._map.fire(new d.h("moveend",{originalEvent:w})),P(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,o){this._map.fire(new d.h(r,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(r=>{this._frameId=void 0,this.handleEvent(new wu("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Fp="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class B_ extends d.E{constructor(r,o){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=o.bearingSnap,this._respectPrefersReducedMotion=o.respectPrefersReducedMotion!==!1,d.aV(["_renderFrameCallback"],this)}getCenter(){return new d.cz(this.transform.center.lng,this.transform.center.lat)}setCenter(r,o){return this.jumpTo({center:r},o)}panBy(r,o,u){return r=d.P.convert(r).mult(-1),this.panTo(this.transform.center,{offset:r,...o},u)}panTo(r,o,u){return this.easeTo({center:r,...o},u)}getZoom(){return this.transform.zoom}setZoom(r,o){return this.jumpTo({zoom:r},o),this}zoomTo(r,o,u){return this.easeTo({zoom:r,...o},u)}zoomIn(r,o){return this.zoomTo(this.getZoom()+1,r,o),this}zoomOut(r,o){return this.zoomTo(this.getZoom()-1,r,o),this}getBearing(){return this.transform.bearing}setBearing(r,o){return this.jumpTo({bearing:r},o),this}getPadding(){return this.transform.padding}setPadding(r,o){return this.jumpTo({padding:r},o),this}rotateTo(r,o,u){return this.easeTo({bearing:r,...o},u)}resetNorth(r,o){return this.rotateTo(0,{duration:1e3,...r},o),this}resetNorthPitch(r,o){return this.easeTo({bearing:0,pitch:0,duration:1e3,...r},o),this}snapToNorth(r,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(r,o):this}getPitch(){return this.transform.pitch}setPitch(r,o){return this.jumpTo({pitch:r},o),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(r,o){return this.jumpTo({fov:r},o)}getHorizontalFieldOfView(){return this.transform.horizontalFov}cameraForBounds(r,o){r=d.eB.convert(r);const u=o&&o.bearing||0,f=o&&o.pitch||0,m=r.getNorthWest(),g=r.getSouthEast();return this._cameraForBounds(this.transform,m,g,u,f,o)}_extendPadding(r){const o={top:0,right:0,bottom:0,left:0};return r==null?{...o,...this.transform.padding}:typeof r=="number"?{top:r,bottom:r,right:r,left:r}:{...o,...r}}_extendCameraOptions(r){return(r={offset:[0,0],maxZoom:this.transform.maxZoom,...r}).padding=this._extendPadding(r.padding),r}_minimumAABBFrustumDistance(r,o){const u=o.max[0]-o.min[0],f=o.max[1]-o.min[1];return u/f>r.aspect?u/(2*Math.tan(.5*r.fovX)*r.aspect):f/(2*Math.tan(.5*r.fovY)*r.aspect)}_cameraForBoundsOnGlobe(r,o,u,f,m,g){const x=r.clone(),w=this._extendCameraOptions(g);x.bearing=f,x.pitch=m;const E=d.cz.convert(o),I=d.cz.convert(u),P=.5*(E.lat+I.lat),R=.5*(E.lng+I.lng),B=d.eC(P,R),V=d.c3([],B),U=d.c3([],d.eD([],V,[0,1,0])),Z=d.eD([],U,V),q=[U[0],U[1],U[2],0,Z[0],Z[1],Z[2],0,V[0],V[1],V[2],0,0,0,0,1],X=[B,d.eC(E.lat,E.lng),d.eC(I.lat,E.lng),d.eC(I.lat,I.lng),d.eC(E.lat,I.lng),d.eC(P,E.lng),d.eC(P,I.lng),d.eC(E.lat,R),d.eC(I.lat,R)];let ne=d.eE.fromPoints(X.map(et=>[d.dE(U,et),d.dE(Z,et),d.dE(V,et)]));const oe=d.bH([],ne.center,q);d.eF(oe)===0&&d.eG(oe,0,0,1),d.c3(oe,oe),d.dB(oe,oe,d.c8),x.center=d.eH(oe);const _e=x.getWorldToCameraMatrix(),ae=d.aO(new Float64Array(16),_e);ne=d.eE.applyTransform(ne,d.X([],_e,q));const ue=this._extendAABB(ne,x,w,f);if(!ue)return void d.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");ne=ue,d.bH(oe,oe,_e);const he=.5*(ne.max[2]-ne.min[2]),fe=this._minimumAABBFrustumDistance(x,ne),be=d.dB([],[0,0,1],he),Re=d.dC(be,oe,be),Ae=fe+(x.pitch===0?0:d.eI(oe,Re)),Ce=x.globeCenterInViewSpace,Ee=d.c2([],oe,[Ce[0],Ce[1],Ce[2]]);d.c3(Ee,Ee),d.dB(Ee,Ee,Ae);const Ye=d.dC([],oe,Ee);d.bH(Ye,Ye,ae);const De=d.bj/d.c8,Ve=d.el(Ye),$e=d.dv(Math.max(Ve*De-d.bj,Number.EPSILON),0),ot=Math.min(x.zoomFromMercatorZAdjusted($e),w.maxZoom);return ot>.5*(d.e8+d.b1)?(x.setProjection({name:"mercator"}),x.zoom=ot,this._cameraForBounds(x,o,u,f,m,g)):{center:x.center,zoom:ot,bearing:f,pitch:m}}_extendAABB(r,o,u,f){const m=.5*((u.padding.left||0)+(u.padding.right||0)),g=.5*((u.padding.top||0)+(u.padding.bottom||0)),x=g,w=m,E=m,I=g,P=o.width-(w+E),R=o.height-(x+I),B=d.c2([],r.max,r.min),V=Math.min(P/B[0],R/B[1]),U=Math.min(o.scaleZoom(o.scale*V),u.maxZoom);if(isNaN(U))return null;const Z=o.scale/o.zoomScale(U),q=new d.eE([r.min[0]-w*Z,r.min[1]-I*Z,r.min[2]],[r.max[0]+E*Z,r.max[1]+x*Z,r.max[2]]),X=(typeof u.offset.x=="number"&&typeof u.offset.y=="number"?new d.P(u.offset.x,u.offset.y):d.P.convert(u.offset)).rotate(-d.au(f));return q.center[0]-=X.x*Z,q.center[1]+=X.y*Z,q}queryTerrainElevation(r,o){const u=this.transform.elevation;return u?(o={exaggerated:!0,...o},u.getAtPoint(d.bS.fromLngLat(r),null,o.exaggerated)):null}_cameraForBounds(r,o,u,f,m,g){if(r.projection.name==="globe")return this._cameraForBoundsOnGlobe(r,o,u,f,m,g);const x=r.clone(),w=this._extendCameraOptions(g);x.bearing=f,x.pitch=m;const E=d.cz.convert(o),I=d.cz.convert(u),P=new d.cz(E.lng,I.lat),R=new d.cz(I.lng,E.lat),B=x.project(E),V=x.project(I),U=this.queryTerrainElevation(E),Z=this.queryTerrainElevation(I),q=this.queryTerrainElevation(P),X=this.queryTerrainElevation(R),ne=[[B.x,B.y,Math.min(U||0,Z||0,q||0,X||0)],[V.x,V.y,Math.max(U||0,Z||0,q||0,X||0)]];let oe=d.eE.fromPoints(ne);const _e=x.getWorldToCameraMatrix(),ae=d.aO(new Float64Array(16),_e);oe=d.eE.applyTransform(oe,_e);const ue=this._extendAABB(oe,x,w,f);if(!ue)return void d.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");oe=ue;const he=.5*d.c2([],oe.max,oe.min)[2],fe=this._minimumAABBFrustumDistance(x,oe),be=[0,0,1,0];d.c7(be,be,_e),d.eJ(be,be);const Re=d.dB([],be,fe+he),Ae=d.dC([],oe.center,Re);d.bH(oe.center,oe.center,ae),d.bH(Ae,Ae,ae);const Ce=x.unproject(new d.P(oe.center[0],oe.center[1])),Ee=d.eK(x.projection,Ce),Ye=Math.pow(2,Ee),De=Math.min(x._zoomFromMercatorZ(Ae[2]*x.pixelsPerMeter*Ye/x.worldSize),w.maxZoom);return x.mercatorFromTransition&&De<.5*(d.e8+d.b1)?(x.setProjection({name:"globe"}),x.zoom=De,this._cameraForBounds(x,o,u,f,m,g)):{center:Ce,zoom:De,bearing:f,pitch:m}}fitBounds(r,o,u){const f=this.cameraForBounds(r,o);return this._fitInternal(f,o,u)}fitScreenCoordinates(r,o,u,f,m){const g=d.P.convert(r),x=d.P.convert(o),w=new d.P(Math.min(g.x,x.x),Math.min(g.y,x.y)),E=new d.P(Math.max(g.x,x.x),Math.max(g.y,x.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(g,x))return this;const I=this.transform.pointLocation3D(w),P=this.transform.pointLocation3D(E),R=this.transform.pointLocation3D(new d.P(w.x,E.y)),B=this.transform.pointLocation3D(new d.P(E.x,w.y)),V=[Math.min(I.lng,P.lng,R.lng,B.lng),Math.min(I.lat,P.lat,R.lat,B.lat)],U=[Math.max(I.lng,P.lng,R.lng,B.lng),Math.max(I.lat,P.lat,R.lat,B.lat)],Z=f&&f.pitch?f.pitch:this.getPitch(),q=this._cameraForBounds(this.transform,V,U,u,Z,f);return this._fitInternal(q,f,m)}_fitInternal(r,o,u){return r?(o=Object.assign(r,o)).linear?this.easeTo(o,u):this.flyTo(o,u):this}jumpTo(r,o){this._stop({keepGesture:"ifPointerDown"});const u=r.preloadOnly?this.transform.clone():this.transform;let f=!1,m=!1,g=!1;"zoom"in r&&u.zoom!==+r.zoom&&(f=!0,u.zoom=+r.zoom),r.center!==void 0&&(u.center=d.cz.convert(r.center)),"bearing"in r&&u.bearing!==+r.bearing&&(m=!0,u.bearing=+r.bearing),"pitch"in r&&u.pitch!==+r.pitch&&(g=!0,u.pitch=+r.pitch),"fov"in r&&(u.fov=+r.fov);const x=typeof r.padding=="number"?this._extendPadding(r.padding):r.padding;if(r.padding!=null&&!u.isPaddingEqual(x))if(r.retainPadding===!1){const w=u.clone();w.padding=x,u.setLocationAtPoint(u.center,w.centerPoint)}else u.padding=x;return r.preloadOnly?(this._preloadTiles(u),this):(this.fire(new d.h("movestart",o)).fire(new d.h("move",o)),f&&this.fire(new d.h("zoomstart",o)).fire(new d.h("zoom",o)).fire(new d.h("zoomend",o)),m&&this.fire(new d.h("rotatestart",o)).fire(new d.h("rotate",o)).fire(new d.h("rotateend",o)),g&&this.fire(new d.h("pitchstart",o)).fire(new d.h("pitch",o)).fire(new d.h("pitchend",o)),this.fire(new d.h("moveend",o)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||d.w(Fp),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,o){const u=this.transform;if(!u.projection.supportsFreeCamera)return d.w(Fp),this;this.stop();const f=u.zoom,m=u.pitch,g=u.bearing;u.setFreeCameraOptions(r);const x=f!==u.zoom,w=m!==u.pitch,E=g!==u.bearing;return this.fire(new d.h("movestart",o)).fire(new d.h("move",o)),x&&this.fire(new d.h("zoomstart",o)).fire(new d.h("zoom",o)).fire(new d.h("zoomend",o)),E&&this.fire(new d.h("rotatestart",o)).fire(new d.h("rotate",o)).fire(new d.h("rotateend",o)),w&&this.fire(new d.h("pitchstart",o)).fire(new d.h("pitch",o)).fire(new d.h("pitchend",o)),this.fire(new d.h("moveend",o)),this}easeTo(r,o){this._stop({easeId:r.easeId}),((r={offset:[0,0],duration:500,easing:d.ex,...r}).animate===!1||this._prefersReducedMotion(r))&&(r.duration=0);const u=this.transform,f=this.getZoom(),m=this.getBearing(),g=this.getPitch(),x=this.getPadding(),w=this.getVerticalFieldOfView(),E="zoom"in r?+r.zoom:f,I="bearing"in r?this._normalizeBearing(r.bearing,m):m,P="pitch"in r?+r.pitch:g,R="fov"in r?+r.fov:w,B=this._extendPadding(r.padding),V=d.P.convert(r.offset);let U,Z,q;if(u.projection.name==="globe"){const Ce=d.bS.fromLngLat(u.center),Ee=V.rotate(-u.angle);Ce.x+=Ee.x/u.worldSize,Ce.y+=Ee.y/u.worldSize;const Ye=Ce.toLngLat(),De=d.cz.convert(r.center||Ye);this._normalizeCenter(De),U=u.centerPoint.add(Ee),Z=new d.P(Ce.x,Ce.y).mult(u.worldSize),q=new d.P(d.a7(De.lng),d.a8(De.lat)).mult(u.worldSize).sub(Z)}else{U=u.centerPoint.add(V);const Ce=u.pointLocation(U),Ee=d.cz.convert(r.center||Ce);this._normalizeCenter(Ee),Z=u.project(Ce),q=u.project(Ee).sub(Z)}const X=u.zoomScale(E-f);let ne,oe;r.around&&(ne=d.cz.convert(r.around),oe=u.locationPoint(ne));const _e=this._zooming||E!==f,ae=this._rotating||m!==I,ue=this._pitching||P!==g,he=R!==w,fe=!u.isPaddingEqual(B),be=r.retainPadding===!1?u.clone():u,Re=Ce=>Ee=>{if(_e&&(Ce.zoom=d.al(f,E,Ee)),ae&&(Ce.bearing=d.al(m,I,Ee)),ue&&(Ce.pitch=d.al(g,P,Ee)),he&&(Ce.fov=d.al(w,R,Ee)),fe&&(be.interpolatePadding(x,B,Ee),U=be.centerPoint.add(V)),ne)Ce.setLocationAtPoint(ne,oe);else{const Ye=Ce.zoomScale(Ce.zoom-f),De=E>f?Math.min(2,X):Math.max(.5,X),Ve=Math.pow(De,1-Ee),$e=Ce.unproject(Z.add(q.mult(Ee*Ve)).mult(Ye));Ce.setLocationAtPoint(Ce.renderWorldCopies?$e.wrap():$e,U)}return r.preloadOnly||this._fireMoveEvents(o),Ce};if(r.preloadOnly){const Ce=this._emulate(Re,r.duration,u);return this._preloadTiles(Ce),this}const Ae={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=_e,this._rotating=ae,this._pitching=ue,this._padding=fe,this._easeId=r.easeId,this._prepareEase(o,r.noMoveStart,Ae),this._ease(Re(u),Ce=>{u.cameraElevationReference==="sea"&&u.recenterOnTerrain(),this._afterEase(o,Ce)},r),this}_prepareEase(r,o,u={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),o||u.moving||this.fire(new d.h("movestart",r)),this._zooming&&!u.zooming&&this.fire(new d.h("zoomstart",r)),this._rotating&&!u.rotating&&this.fire(new d.h("rotatestart",r)),this._pitching&&!u.pitching&&this.fire(new d.h("pitchstart",r))}_fireMoveEvents(r){this.fire(new d.h("move",r)),this._zooming&&this.fire(new d.h("zoom",r)),this._rotating&&this.fire(new d.h("rotate",r)),this._pitching&&this.fire(new d.h("pitch",r))}_afterEase(r,o){if(this._easeId&&o&&this._easeId===o)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const u=this._zooming,f=this._rotating,m=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new d.h("zoomend",r)),f&&this.fire(new d.h("rotateend",r)),m&&this.fire(new d.h("pitchend",r)),this.fire(new d.h("moveend",r))}flyTo(r,o){if(this._prefersReducedMotion(r)){const qe=d.cb(r,["center","zoom","bearing","pitch","fov","around","padding","retainPadding"]);return this.jumpTo(qe,o)}this.stop(),r={offset:[0,0],speed:1.2,curve:1.42,easing:d.ex,...r};const u=this.transform,f=this.getZoom(),m=this.getBearing(),g=this.getPitch(),x=this.getPadding(),w=this.getVerticalFieldOfView(),E="zoom"in r?d.b0(+r.zoom,u.minZoom,u.maxZoom):f,I="bearing"in r?this._normalizeBearing(r.bearing,m):m,P="pitch"in r?+r.pitch:g,R="fov"in r?+r.fov:w,B=R!==w,V=this._extendPadding(r.padding),U=u.zoomScale(E-f),Z=d.P.convert(r.offset);let q=u.centerPoint.add(Z);const X=u.pointLocation(q),ne=d.cz.convert(r.center||X);this._normalizeCenter(ne);const oe=u.project(X),_e=u.project(ne).sub(oe);let ae=r.curve;const ue=Math.max(u.width,u.height),he=ue/U,fe=_e.mag();if("minZoom"in r){const qe=d.b0(Math.min(r.minZoom,f,E),u.minZoom,u.maxZoom),Ge=ue/u.zoomScale(qe-f);
vendor: 2,540 bytes, line 3410
3410ae=Math.sqrt(Ge/fe*2)}const be=ae*ae;function Re(qe){const Ge=(he*he-ue*ue+(qe?-1:1)*be*be*fe*fe)/(2*(qe?he:ue)*be*fe);return Math.log(Math.sqrt(Ge*Ge+1)-Ge)}function Ae(qe){return(Math.exp(qe)-Math.exp(-qe))/2}function Ce(qe){return(Math.exp(qe)+Math.exp(-qe))/2}const Ee=Re(0);let Ye=function(qe){return Ce(Ee)/Ce(Ee+ae*qe)},De=function(qe){return ue*((Ce(Ee)*(Ae(Ge=Ee+ae*qe)/Ce(Ge))-Ae(Ee))/be)/fe;var Ge},Ve=(Re(1)-Ee)/ae;if(Math.abs(fe)<1e-6||!isFinite(Ve)){if(Math.abs(ue-he)<1e-6)return this.easeTo(r,o);const qe=he<ue?-1:1;Ve=Math.abs(Math.log(he/ue))/ae,De=function(){return 0},Ye=function(Ge){return Math.exp(qe*ae*Ge)}}r.duration="duration"in r?+r.duration:1e3*Ve/("screenSpeed"in r?+r.screenSpeed/ae:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);const $e=m!==I,ot=P!==g,et=!u.isPaddingEqual(V),Xe=r.retainPadding===!1?u.clone():u,mt=qe=>Ge=>{const Qe=Ge*Ve,dt=1/Ye(Qe);qe.zoom=Ge===1?E:f+qe.scaleZoom(dt),$e&&(qe.bearing=d.al(m,I,Ge)),ot&&(qe.pitch=d.al(g,P,Ge)),B&&(qe.fov=d.al(w,R,Ge)),et&&(Xe.interpolatePadding(x,V,Ge),q=Xe.centerPoint.add(Z));const rt=Ge===1?ne:qe.unproject(oe.add(_e.mult(De(Qe))).mult(dt));return qe.setLocationAtPoint(qe.renderWorldCopies?rt.wrap():rt,q),qe._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(o),qe};if(r.preloadOnly){const qe=this._emulate(mt,r.duration,u);return this._preloadTiles(qe),this}return this._zooming=!0,this._rotating=$e,this._pitching=ot,this._padding=et,this._prepareEase(o,!1),this._ease(mt(u),()=>this._afterEase(o),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(r){}_cancelRenderFrame(r){}_stop({easeId:r,keepGesture:o}={}){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const f=this._onEaseEnd;this._onEaseEnd=void 0,f.call(this,r)}const u=this.handlers;return u&&u.stop(o),this}_ease(r,o,u){u.animate===!1||u.duration===0?(r(1),o()):(this._easeStart=d.e.now(),this._easeOptions=u,this._onEaseFrame=r,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((d.e.now()-this._easeStart)/this._easeOptions.duration,1),o=this._onEaseFrame;o&&o(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,o){r=d.cU(r,-180,180);const u=Math.abs(r-o);return Math.abs(r-360-o)<u&&(r-=360),Math.abs(r+360-o)<u&&(r+=360),r}_normalizeCenter(r){const o=this.transform;
vendor: 22,734 bytes, lines 3410-3415
3410if(o.maxBounds||o.projection.name!=="globe"&&!o.renderWorldCopies)return;const u=r.lng-o.center.lng;r.lng+=u>180?-360:u<-180?360:0}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&d.e.prefersReducedMotion&&!(r&&r.essential)}_emulate(r,o,u){const f=Math.ceil(15*o/1e3),m=[],g=r(u.clone());for(let x=0;x<=f;x++){const w=g(x/f);m.push(w.clone())}return m}_preloadTiles(r,o){}}const k_=/^(https?:|mailto:)/i;class Op{constructor(r={}){this.options=r,d.aV(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(r){const o=this.options&&this.options.compact,u=r._getUIString("AttributionControl.ToggleAttribution");this._map=r,this._container=si("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=si("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",u);const f=si("span","mapboxgl-ctrl-icon",this._compactButton);return f.setAttribute("aria-hidden","true"),f.setAttribute("title",u),this._innerContainer=si("div","mapboxgl-ctrl-attrib-inner",this._container),o&&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),o===void 0&&(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","false")):(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"));const o=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||d.eL.ACCESS_TOKEN}];if(r){const u=o.reduce((f,m,g)=>(m.value&&(f+=`${m.key}=${m.value}${g<o.length-1?"&":""}`),f),"?");r.href=`${d.eL.FEEDBACK_URL}/${u}#${jd(this._map,!0)}`,r.rel="noopener nofollow"}}_updateData(r){!r||(r.dataType!=="source"||r.sourceDataType!=="metadata"&&r.sourceDataType!=="visibility")&&r.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let r=[];if(this._map.style.stylesheet){const f=this._map.style.stylesheet;this.styleOwner=f.owner,this.styleId=f.id}const o=this._map.style._mergedSourceCaches;for(const f in o){const m=o[f];if(m.used){const g=m.getSource();g.attribution&&!r.includes(g.attribution)&&r.push(g.attribution)}}r.sort((f,m)=>f.length-m.length),r=r.filter((f,m)=>{for(let g=m+1;g<r.length;g++)if(r[g].includes(f))return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=[...this.options.customAttribution,...r]:r.unshift(this.options.customAttribution));const u=r.map(f=>function(m){const g=new DOMParser().parseFromString(m,"text/html");return Array.from(g.body.querySelectorAll("*")).reverse().forEach(x=>{const w=x.textContent||"";if(x.tagName!=="A")return void x.replaceWith(...x.childNodes);const E=x.getAttribute("href");if(!E||!k_.test(E))return void x.replaceWith(g.createTextNode(w));const I=g.createElement("a");I.href=E,I.textContent=w,I.rel="noopener nofollow";const P=x.getAttribute("class");P&&(I.className=P),x.replaceWith(I)}),g.body.innerHTML}(f)).join(" | ");u!==this._attribHTML&&(this._attribHTML=u,r.length?(this._innerContainer.innerHTML=u,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 Ch{constructor(){d.aV(["_updateLogo","_updateCompact"],this)}onAdd(r){this._map=r,this._container=si("div","mapboxgl-ctrl");const o=si("a","mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://www.mapbox.com/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),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(r){r&&r.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const r=this._map.style._sourceCaches;if(Object.entries(r).length===0)return!0;for(const o in r){const u=r[o].getSource();if(Object.hasOwn(u,"mapbox_logo")&&!u.mapbox_logo)return!1}return!0}_updateCompact(){const r=this._container.children;if(r.length){const o=r[0];this._map.getCanvasContainer().offsetWidth<250?o.classList.add("mapboxgl-compact"):o.classList.remove("mapboxgl-compact")}}}class Bp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const o=++this._id;return this._queue.push({callback:r,id:o,cancelled:!1}),o}remove(r){const o=this._currentlyRunning,u=o?this._queue.concat(o):this._queue;for(const f of u)if(f.id===r)return void(f.cancelled=!0)}run(r=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const u of o)if(!u.cancelled&&(u.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class kp{constructor(r){this.jumpTo(r)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const o=d.dr((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-o)+this._end*o}isEasing(r){return r>=this._startTime&&r<=this._endTime}jumpTo(r){this._startTime=-1/0,this._endTime=-1/0,this._start=r,this._end=r}easeTo(r,o,u){this._start=this.getValue(o),this._end=r,this._startTime=o,this._endTime=o+u}}const Tu={"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 Np extends d.h{constructor(r,o,u,f){const{point:m,lngLat:g,originalEvent:x,target:w}=r;super(r.type,{point:m,lngLat:g,originalEvent:x,target:w}),this.preventDefault=()=>{r.preventDefault()},this.id=o,this.interaction=u,this.feature=f}}class Cr{constructor(r){this.map=r,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}add(r,o){if(this.typeById.has(r))throw new Error(`Interaction id "${r}" already exists.`);const u=o.filter;let f=o.type;u&&this.filters.set(r,d.bv(u)),f==="mouseover"&&(f="mouseenter"),f==="mouseout"&&(f="mouseleave");const m=this.interactionsByType.get(f)||new Map;f==="mouseenter"||f==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(r,o)):m.size===0&&this.map.on(f,this.handleType),m.size===0&&this.interactionsByType.set(f,m),m.set(r,o),this.typeById.set(r,f)}get(r){const o=this.typeById.get(r);if(!o)return;const u=this.interactionsByType.get(o);return u?u.get(r):void 0}remove(r){const o=this.typeById.get(r);if(!o)return;this.typeById.delete(r),this.filters.delete(r);const u=this.interactionsByType.get(o);u&&(u.delete(r),o==="mouseenter"||o==="mouseleave"?(this.delegatedInteractions.delete(r),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):u.size===0&&this.map.off(o,this.handleType))}queryTargets(r,o){const u=[];for(const[f,m]of o)m.target&&u.push({targetId:f,target:m.target,filter:this.filters.get(f)});return this.map.style.queryRenderedTargets(r,u,this.map.transform)}handleMove(r){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const o=this.queryTargets(r.point,Array.from(this.delegatedInteractions).reverse());o.length&&(r.type="mouseenter",this.handleType(r,o));const u=new Map;for(const[f,{feature:m}]of this.prevHoveredFeatures)this.hoveredFeatures.has(f)||u.set(m.id,m);u.size&&(r.type="mouseleave",this.handleType(r,Array.from(u.values())))}handleOut(r){const o=Array.from(this.hoveredFeatures.values()).map(({feature:u})=>u);o.length&&(r.type="mouseleave",this.handleType(r,o)),this.hoveredFeatures.clear()}handleType(r,o){const u=r.type==="mouseenter";if(u&&!this.interactionsByType.has(r.type))return void d.w("mouseenter interaction required for mouseleave to work.");const f=Array.from(this.interactionsByType.get(r.type)).reverse(),m=!!o;o=o||this.queryTargets(r.point,f);let g=!1;const x=new Set;for(const w of o){for(const[E,I]of f){if(!I.target)continue;const P=w.variants?w.variants[E]:null;if(P){for(const R of P){if(jf(R,w,x,E))continue;const B=new d.dk(w,R),V=Uf(R,w,E);m&&B.id!==void 0&&(B.state=this.map.getFeatureState(B));const U=u?this.prevHoveredFeatures.get(V):null,Z=new Np(r,E,I,B),q=U?U.stop:I.handler(Z);if(u&&this.hoveredFeatures.set(V,{feature:w,stop:q}),q!==!1){g=!0;break}}if(g)break}}if(g)break}if(!g)for(const[w,E]of f){const{handler:I,target:P}=E;if(!P&&I(new Np(r,w,E,null))!==!1)break}}}function bc(a,r){if(Array.isArray(a)&&Array.isArray(r)){const o=new Set(a),u=new Set(r);return o.size===u.size&&a.every(f=>u.has(f))}return d.O(a,r)}const Vp=/matrix.*\((.+)\)/,Mh={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,fontstackCompositing:"client",transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1},Rh={showCompass:!0,showZoom:!0,visualizePitch:!1};class Eu{constructor(r,o,u=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new $d({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,u&&(this.mousePitch=new El({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),d.aV(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchmove",this.touchmove),o.addEventListener("touchend",this.touchend),o.addEventListener("touchcancel",this.reset)}down(r,o){this.mouseRotate.mousedown(r,o),this.mousePitch&&this.mousePitch.mousedown(r,o),er()}move(r,o){const u=this.map,f=this.mouseRotate.mousemoveWindow(r,o),m=f&&f.bearingDelta;if(m&&u.setBearing(u.getBearing()+m),this.mousePitch){const g=this.mousePitch.mousemoveWindow(r,o),x=g&&g.pitchDelta;x&&u.setPitch(u.getPitch()+x)}}off(){const r=this.element;r.removeEventListener("mousedown",this.mousedown),r.removeEventListener("touchstart",this.touchstart),r.removeEventListener("touchmove",this.touchmove),r.removeEventListener("touchend",this.touchend),r.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){Ul(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down({...r,button:r.button,type:r.type,ctrlKey:!0,preventDefault:()=>r.preventDefault()},Wi(this.element,r)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(r){this.move(r,Wi(this.element,r))}mouseup(r){this.mouseRotate.mouseupWindow(r),this.mousePitch&&this.mousePitch.mouseupWindow(r),this.offTemp()}touchstart(r){r.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=mr(this.element,r.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>r.preventDefault()},this._startPos))}touchmove(r){r.targetTouches.length!==1?this.reset():(this._lastPos=mr(this.element,r.targetTouches)[0],this.move({buttons:1,preventDefault:()=>r.preventDefault()},this._lastPos))}touchend(r){r.targetTouches.length===0&&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 Kd(a,r,o){if(a=new d.cz(a.lng,a.lat),r){const u=new d.cz(a.lng-360,a.lat),f=new d.cz(a.lng+360,a.lat),m=360*Math.ceil(Math.abs(a.lng-o.center.lng)/360),g=o.locationPoint3D(a).distSqr(r),x=r.x<0||r.y<0||r.x>o.width||r.y>o.height;o.locationPoint3D(u).distSqr(r)<g&&(x||Math.abs(u.lng-o.center.lng)<m)?a=u:o.locationPoint3D(f).distSqr(r)<g&&(x||Math.abs(f.lng-o.center.lng)<m)&&(a=f)}for(;Math.abs(a.lng-o.center.lng)>180;){const u=o.locationPoint3D(a);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;a.lng>o.center.lng?a.lng-=360:a.lng+=360}return a}const Ph={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%)"},Su=/\s+/,Wo={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class Dh extends d.E{constructor(r,o){super(),(r instanceof HTMLElement||o)&&(r={element:r,...o}),d.aV(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:u="center",color:f="#3FB1CE",scale:m=1,draggable:g=!1,clickTolerance:x=0,rotation:w=Wo.rotation,rotationAlignment:E=Wo.rotationAlignment,pitchAlignment:I=Wo.pitchAlignment,occludedOpacity:P=Wo.occludedOpacity,altitude:R=Wo.altitude}=r||{};this._anchor=u,this._color=f,this._scale=m,this._draggable=g,this._clickTolerance=x,this._rotation=w,this._rotationAlignment=E,this._pitchAlignment=I,this._occludedOpacity=P,this._altitude=R,this._state="inactive",this._isDragging=!1,this._pointerEvents=null,this._updateMoving=()=>this._update(!0),r&&r.element?(this._element=r.element,this._offset=d.P.convert(r&&r.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=d.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",V=>{V.preventDefault()}),this._element.addEventListener("mousedown",V=>{V.preventDefault()});const B=this._element.classList;for(const V in Ph)B.remove(`mapboxgl-marker-anchor-${V}`);B.add(`mapboxgl-marker-anchor-${this._anchor}`),r&&r.className&&B.add(...r.className.trim().split(Su)),this._popup=null}_createDefaultMarker(){const r=si("div"),o=Eo("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},r);this._svgElement=o;const u=Eo("radialGradient",{id:"shadowGradient"},Eo("defs",{},o));Eo("stop",{offset:"10%","stop-opacity":.4},u),Eo("stop",{offset:"100%","stop-opacity":.05},u);const f=Eo("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"});return this._shadowElement=f,this._altitude===0&&o.insertBefore(f,o.firstChild),Eo("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"},o),Eo("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"},o),Eo("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),r}addTo(r){return r===this._map||(this.remove(),this._map=r,r.getCanvasContainer().appendChild(this._element),r.on("move",this._updateMoving),r.on("moveend",this._update),r.on("remove",this._clearFadeTimer),r._addMarker(this),this.setDraggable(this._draggable),this._update(),r.on("click",this._onMapClick)),this}remove(){const r=this._map;return r&&(r.off("click",this._onMapClick),r.off("move",this._updateMoving),r.off("moveend",this._update),r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler),r.off("mouseup",this._onUp),r.off("touchend",this._onUp),r.off("mousemove",this._onMove),r.off("touchmove",this._onMove),r.off("remove",this._clearFadeTimer),r._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=d.cz.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(r){if(r===this._altitude)return this;const o=this._altitude;return this._altitude=r||Wo.altitude,this._defaultMarker&&o===0!=(this._altitude===0)&&(this._altitude===0?this._svgElement.insertBefore(this._shadowElement,this._svgElement.firstChild):this._shadowElement.remove()),this._update(),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(r){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")),r){if(!("offset"in r.options)){const f=Math.sqrt(Math.pow(13.5,2)/2);r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[f,-1*(38.1-13.5+f)],"bottom-right":[-f,-1*(38.1-13.5+f)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,r._marker=this,r._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(r){const o=r.code,u=r.charCode||r.keyCode;o!=="Space"&&o!=="Enter"&&u!==32&&u!==13||this.togglePopup()}_onMapClick(r){const o=r.originalEvent.target,u=this._element;this._popup&&(o===u||u.contains(o))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const r=this._popup;return r?(r.isOpen()?(r.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(r.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const r=this._map,o=this._pos;if(!r||!o)return!1;const u=r.unproject(o,this._altitude),f=r.getFreeCameraOptions();if(!f.position)return!1;const m=f.position.toLngLat();return m.distanceTo(u)<.9*m.distanceTo(this._lngLat)}_evaluateOpacity(){const r=this._map;if(!r)return;const o=this._pos;if(!o||o.x<0||o.x>r.transform.width||o.y<0||o.y>r.transform.height)return void this._clearFadeTimer();const u=r.unproject(o,this._altitude);let f;r._showingGlobe()&&d.f2(r.transform,this._lngLat)?f=0:(f=1-r._queryFogOpacity(u),r.transform._terrainEnabled()&&r.style&&r.style.hasTerrain()&&this._behindTerrain()&&(f*=this._occludedOpacity)),this._element.style.opacity=`${f}`;const m=this._element.style.pointerEvents;(this._pointerEvents===null?m==="":m===this._pointerEvents)&&(this._pointerEvents=f>0?"auto":"none",this._element.style.pointerEvents=this._pointerEvents),this._popup&&this._popup._setOpacity(f),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const r=this._pos;if(!r||!this._map)return;const o=this._offset.mult(this._scale);this._element.style.transform=` 3411 translate(${r.x}px,${r.y}px) 3412 ${Ph[this._anchor]} 3413 ${this._calculateXYTransform()} ${this._calculateZTransform()} 3414 translate(${o.x}px,${o.y}px) 3415 `}_calculateXYTransform(){const r=this._pos,o=this._map,u=this.getPitchAlignment();if(!o||!r||u!=="map")return"";if(!o._showingGlobe()){const w=o.getPitch();return w?`rotateX(${w}deg)`:""}const f=d.f3(d.f4(o.transform,this._lngLat)),m=r.sub(d.f5(o.transform)),g=Math.abs(m.x)+Math.abs(m.y);if(g===0)return"";const x=f/g;return`rotateX(${-m.y*x}deg) rotateY(${m.x*x}deg)`}_calculateZTransform(){const r=this._pos,o=this._map;if(!o||!r)return"";let u=0;const f=this.getRotationAlignment();if(f==="map")if(o._showingGlobe()){const m=o.project(new d.cz(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),g=o.project(new d.cz(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(m);u=d.f3(Math.atan2(g.y,g.x))-90}else u=-o.getBearing();else if(f==="horizon"){const m=d.am(4,6,o.getZoom()),g=d.f5(o.transform);g.y+=m*o.transform.height;const x=r.sub(g),w=d.f3(Math.atan2(x.y,x.x));u=(w>90?w-270:w+90)*(1-m)}return u+=this._rotation,u?`rotateZ(${u}deg)`:""}_update(r){cancelAnimationFrame(this._updateFrameId);const o=this._map;
3415o&&(o.transform.renderWorldCopies&&(this._lngLat=Kd(this._lngLat,this._pos,o.transform)),this._pos=o.project(this._lngLat,this._altitude),r===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),o._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(o._showingGlobe()||o.style&&o.style.hasTerrain()||o.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=d.P.convert(r),this._update(),this}addClassName(r){return this._element.classList.add(r),this}removeClassName(r){return this._element.classList.remove(r),this}toggleClassName(r){return this._element.classList.toggle(r)}_onMove(r){const o=this._map;if(!o)return;const u=this._pointerdownPos,f=this._positionDelta;if(u&&f){if(!this._isDragging){const m=this._clickTolerance||o._clickTolerance;if(r.point.dist(u)<m)return;this._isDragging=!0}this._pos=r.point.sub(f),this._lngLat=o.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new d.h("dragstart"))),this.fire(new d.h("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new d.h("dragend")),this._state="inactive"}_addDragHandler(r){const o=this._map,u=this._pos;o&&u&&this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(u),this._pointerdownPos=r.point,this._state="pending",o.on("mousemove",this._onMove),o.on("touchmove",this._onMove),o.once("mouseup",this._onUp),o.once("touchend",this._onUp))}setDraggable(r){this._draggable=!!r;const o=this._map;return o&&(r?(o.on("mousedown",this._addDragHandler),o.on("touchstart",this._addDragHandler)):(o.off("mousedown",this._addDragHandler),o.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(r){return this._rotation=r||Wo.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||Wo.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r||Wo.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(r){return this._occludedOpacity=r||Wo.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Jd={OFF:[],WAITING_ACTIVE:["waiting","active"],ACTIVE_LOCK:["active"],ACTIVE_ERROR:["waiting","active-error"],BACKGROUND:["background"],BACKGROUND_ERROR:["waiting","background-error"]},wc=a=>`mapboxgl-ctrl-geolocate-${a}`,Fn=["waiting","active","active-error","background","background-error"].map(wc),Xo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},Qd={maxWidth:100,unit:"metric"},Yo={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},Ko=/\s+/,Tc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},Sl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Il(a=new d.P(0,0),r="bottom"){if(typeof a=="number"){const o=Math.round(Math.sqrt(.5*Math.pow(a,2)));switch(r){case"top":return new d.P(0,a);case"top-left":return new d.P(o,o);case"top-right":return new d.P(-o,o);case"bottom":return new d.P(0,-a);case"bottom-left":return new d.P(o,-o);case"bottom-right":return new d.P(-o,-o);case"left":return new d.P(a,0);case"right":return new d.P(-a,0)}return new d.P(0,0)}return a instanceof d.P||Array.isArray(a)?d.P.convert(a):d.P.convert(a[r]||[0,0])}const Iu=typeof document<"u"?document.currentScript:null;return d.f6(Iu&&Iu.src&&d.f7(Iu.src)?"cdn":"other"),{version:d.f1,supported:function(a){return!function(r){return typeof window<"u"&&typeof document<"u"?Object.hasOwn?function(){const o=document.createElement("canvas");o.width=o.height=1;const u=o.getContext("2d");return!!u&&u.getImageData(0,0,1,1).width===o.width}()?function(o){return o?(Kn===void 0&&(Kn=Lr(!0)),Kn):(To===void 0&&(To=Lr(!1)),To)}(r)?"":"insufficient WebGL2 support":"insufficient Canvas/getImageData support":"Object.hasOwn not supported":"not a browser"}(a)},setRTLTextPlugin:d.fc,getRTLTextPluginStatus:d.fb,setSdkInfo:d.fa,addTileProvider:d.f9,Map:class extends B_{constructor(a){d.eM.mark(d.eN.create);const r=a;if((a={...Mh,...a}
3415).minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");super(new d.eO(a.minZoom,a.maxZoom,a.minPitch,a.maxPitch,a.renderWorldCopies,null,null),a),this._repaint=!!a.repaint,this._interactive=a.interactive,this._minTileCacheSize=a.minTileCacheSize,this._maxTileCacheSize=a.maxTileCacheSize,this._failIfMajorPerformanceCaveat=a.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=a.preserveDrawingBuffer,this._antialias=a.antialias,this._trackResize=a.trackResize,this._bearingSnap=a.bearingSnap,this._refreshExpiredTiles=a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._placementAlgorithm=a.placementAlgorithm||"default",this._isInitialLoad=!0,this._crossSourceCollisions=a.crossSourceCollisions,this._collectResourceTiming=a.collectResourceTiming,this._language=this._parseLanguage(a.language),this._worldview=a.worldview,this._renderTaskQueue=new Bp,this._domRenderTaskQueue=new Bp,this._controls=[],this._markers=[],this._popups=[],this._mapId=d.av(),this._locale={...Tu,...a.locale},this._clickTolerance=a.clickTolerance,this._cooperativeGestures=a.cooperativeGestures,this._performanceMetricsCollection=a.performanceMetricsCollection,this._tessellationStep=a.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=a.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new kp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=a.scaleFactor,this._requestManager=new d.eP(a.transformRequest,a.accessToken,a.testMode);const o=d.eQ(a.accessToken||d.eL.ACCESS_TOKEN);if(o&&"atlas"in o&&typeof o.atlas=="number"&&(this._tokenExpiration=o.atlas),this._silenceAuthErrors=!!a.testMode,this._contextCreateOptions=a.contextCreateOptions?{...a.contextCreateOptions}:{},typeof a.container=="string"){const u=document.getElementById(a.container);if(!u)throw new Error(`Container '${a.container.toString()}' not found.`);this._container=u}else{if(!(a.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(this._container.childNodes.length>0&&d.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."),a.maxBounds&&this.setMaxBounds(a.maxBounds),this._spriteFormat="auto",d.aV(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new 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 O_(this,a),this._localFontFamily=a.localFontFamily,this._localIdeographFontFamily=a.localIdeographFontFamily,this._fontstackCompositing=a.fontstackCompositing,(a.style||!a.testMode)&&this.setStyle(a.style||d.eL.DEFAULT_STYLE,{config:a.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily,fontstackCompositing:this._fontstackCompositing}),a.projection&&this.setProjection(a.projection),a.hash&&(this._hash=new za(typeof a.hash=="string"&&a.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){r.center==null&&r.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch});const u=a.bounds;u&&(this.resize(),this.fitBounds(u,{...a.fitBoundsOptions,duration:0}))}this.resize(),a.attributionControl&&this.addControl(new Op({customAttribution:a.customAttribution}
vendor: 4,803 bytes, line 3415
3415)),this._logoControl=new Ch,this.addControl(this._logoControl,a.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",u=>{this._update(u.dataType==="style"),this.fire(new d.h(`${u.dataType}data`,u))}),this.on("dataloading",u=>{this.fire(new d.h(`${u.dataType}dataloading`,u))}),this._interactions=new Cr(this)}_getMapId(){return this._mapId}addControl(a,r){if(r===void 0&&(r=a.getDefaultPosition?a.getDefaultPosition():"top-right"),!a||!a.onAdd)return this.fire(new d.f(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=a.onAdd(this);this._controls.push(a);const u=this._controlPositions[r];return r.includes("bottom")?u.insertBefore(o,u.firstChild):u.appendChild(o),this}removeControl(a){if(!a||!a.onRemove)return this.fire(new d.f(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(a);return r>-1&&this._controls.splice(r,1),a.onRemove(this),this}hasControl(a){return this._controls.includes(a)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(a){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));const r=!this._moving;return r&&this.fire(new d.h("movestart",a)).fire(new d.h("move",a)),this.fire(new d.h("resize",a)),r&&this.fire(new d.h("moveend",a)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(a){return this.transform.setMaxBounds(d.eB.convert(a)),this._update()}setMinZoom(a){if((a=a??-2)>=-2&&a<=this.transform.maxZoom)return this.transform.minZoom=a,this._update(),this.getZoom()<a?this.setZoom(a):this.fire(new d.h("zoomstart")).fire(new d.h("zoom")).fire(new d.h("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(a){if((a=a??22)>=this.transform.minZoom)return this.transform.maxZoom=a,this._update(),this.getZoom()>a?this.setZoom(a):this.fire(new d.h("zoomstart")).fire(new d.h("zoom")).fire(new d.h("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(a){if((a=a??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(a>=0&&a<=this.transform.maxPitch)return this.transform.minPitch=a,this._update(),this.getPitch()<a?this.setPitch(a):this.fire(new d.h("pitchstart")).fire(new d.h("pitch")).fire(new d.h("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(a){if((a=a??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(a>=this.transform.minPitch)return this.transform.maxPitch=a,this._update(),this.getPitch()>a?this.setPitch(a):this.fire(new d.h("pitchstart")).fire(new d.h("pitch")).fire(new d.h("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(a){return this._scaleFactor=a,this.painter.scaleFactor=a,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(r=>r.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(a){return a==="auto"?navigator.language:Array.isArray(a)?a.length===0?void 0:a.map(r=>r==="auto"?navigator.language:r):a}setLanguage(a){const r=this._parseLanguage(a);if(!this.style||r===this._language)return this;this._language=r,this.style.reloadSources();for(const o of this._controls)o._setLanguage&&o._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(a){return this.style&&a!==this._worldview?(this._worldview=a,this._styleDirty=!0,this.style.setWorldview(a),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(a){return this._lazyInitEmptyStyle(),a?typeof a=="str
3415ing"&&(a={name:a}):a=null,this._useExplicitProjection=!!a,this._prioritizeAndUpdateProjection(a,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const a=this.transform,r=a.projection.name;let o;r==="globe"&&a.zoom>=d.b1?(a.setMercatorFromTransition(),o=!0):r==="mercator"&&a.zoom<d.b1&&(a.setProjection({name:"globe"}),o=!0),o&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(a,r){return this._updateProjection(a||r||{name:"mercator"})}_updateProjection(a){let r;const o=this.transform.mercatorFromTransition;r=a.name==="globe"&&this.transform.zoom>=d.b1?this.transform.setMercatorFromTransition():this.transform.setProjection(a),this.style.applyProjectionUpdate();const u=this.transform.getProjection().name==="mercator"&&o!==this.transform.mercatorFromTransition;return(r||u)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(a,r){return this.transform.locationPoint3D(d.cz.convert(a),r)}unproject(a,r){return this.transform.pointLocation3D(d.P.convert(a),r)}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(a,r,o){const u=f=>{let m=[];if(Array.isArray(r)){const g=r.filter(x=>this.getLayer(x));m=g.length?this.queryRenderedFeatures(f,{layers:g}):[]}else m=this.queryRenderedFeatures(f,{target:r});return m};if(a==="mouseenter"||a==="mouseover"){let f=!1;return{listener:o,targets:r,delegates:{mousemove:g=>{const x=u(g.point);x.length?f||(f=!0,o.call(this,new _o(a,this,g.originalEvent,{features:x}))):f=!1},mouseout:()=>{f=!1}}}}if(a==="mouseleave"||a==="mouseout"){let f=!1;return{listener:o,targets:r,delegates:{mousemove:x=>{u(x.point).length?f=!0:f&&(f=!1,o.call(this,new _o(a,this,x.originalEvent)))},mouseout:x=>{f&&(f=!1,o.call(this,new _o(a,this,x.originalEvent)))}}}}{const f=m=>{const g=u(m.point);g.length&&(m.features=g,o.call(this,m),delete m.features)};return{listener:o,targets:r,delegates:{[a]:f}}}}on(a,r,o){if(typeof r=="function"||o===void 0)return super.on(a,r);if(typeof r=="string"&&(r=[r]),!this._areTargetsValid(r))return this;const u=this._createDelegatedListener(a,r,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(u);for(const f in u.delegates)this.on(f,u.delegates[f]);return this}once(a,r,o){if(typeof r=="function"||o===void 0)return super.once(a,r);if(typeof r=="string"&&(r=[r]),!this._areTargetsValid(r))return this;const u=this._createDelegatedListener(a,r,o);for(const f in u.delegates)this.once(f,u.delegates[f]);return this}off(a,r,o){if(typeof r=="function"||o===void 0)return super.off(a,r);if(typeof r=="string"&&(r=[r]),!this._areTargetsValid(r))return this;const u=this._delegatedListeners?this._delegatedListeners[a]:void 0;return u&&(f=>{for(let m=0;m<f.length;m++){const g=f[m];if(g.listener===o&&bc(g.targets,r)){for(const x in g.delegates)this.off(x,g.delegates[x]);return f.splice(m,1),this}}})(u),this}queryRenderedFeatures(a,r){if(!this.style)return[];if(a===void 0||a instanceof d.P||Array.isArray(a)||r!==void 0||(r=a,a=void 0),a=a||[[0,0],[this.transform.width,this.transform.height]],!r){const m=this.style.queryRenderedFeatures(a,void 0,this.transform),g=this.style.queryRenderedFeatureset(a,void 0,this.transform);return m.concat(g)}let o=!0;if(r.target&&(o=this._isTargetValid(r.target),o&&!r.layers))return this.style.queryRenderedFeatureset(a,r,this.transform);let u=!0;if(r.layers&&Array.isArray(r.layers)){for(const m of r.layers)if(!this._isValidId(m)){u=!1;break}if(u&&!r.target)return this.style.queryRenderedFeatures(a,r,this.transform)}let f=[];return u&&(f=f.concat(this.style.queryRenderedFeatures(a,r,this.transform))),o&&(f=f.concat(this.style.queryRenderedFeatureset(a,r,this.transform))),f}
vendor: 4,199 bytes, line 3415
3415querySourceFeatures(a,r){return!a||typeof a=="string"&&!this._isValidId(a)?[]:this.style.querySourceFeatures(a,r)}queryRasterValue(a,r,o){return this._isValidId(a)?this.style.queryRasterValue(a,r,o):Promise.resolve(null)}isPointOnSurface(a){const{name:r}=this.transform.projection;return r!=="globe"&&r!=="mercator"&&d.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(d.P.convert(a))}addInteraction(a,r){return this._interactions.add(a,r),this}removeInteraction(a){return this._interactions.remove(a),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(a){return this._cooperativeGestures=a,this}setStyle(a,r){return r={localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily,fontstackCompositing:this._fontstackCompositing,...r},this.style&&a&&r.diff!==!1&&r.localFontFamily===this._localFontFamily&&r.localIdeographFontFamily===this._localIdeographFontFamily&&r.fontstackCompositing===this._fontstackCompositing&&!r.config?(this.style._diffStyle(a,(o,u)=>{if(o){const f=typeof o=="string"?o:o instanceof Error?o.message:o.error;d.w(`Unable to perform style diff: ${f}. Rebuilding the style from scratch.`),this._updateStyle(a,r)}else u&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._fontstackCompositing=r.fontstackCompositing,this._updateStyle(a,r))}_getUIString(a){const r=this._locale[a];if(r==null)throw new Error(`Missing UI string '${a}'`);return r}_updateStyle(a,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),a){const o={...r};r&&r.config&&(o.initialConfig=r.config,delete o.config),this.style=new Ra(this,o).load(a),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Ra(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():(d.w("There is no style added to the map."),!1)}_isValidId(a){return a==null?(this.fire(new d.f(new Error("IDs can't be empty."))),!1):d.df(a)?(this.fire(new d.f(new Error(`IDs can't contain special symbols: "${a}".`))),!1):a!=="__proto__"&&a!=="constructor"&&a!=="prototype"||(this.fire(new d.f(new Error(`IDs can't be "${a}".`))),!1)}_isTargetValid(a){return"featuresetId"in a?this._isValidId("importId"in a?a.importId:a.featuresetId):"layerId"in a&&this._isValidId(a.layerId)}_areTargetsValid(a){if(Array.isArray(a)){for(const r of a)if(!this._isValidId(r))return!1;return!0}return this._isTargetValid(a)}addSource(a,r){return this._isValidId(a)?(this._lazyInitEmptyStyle(),this.style.addSource(a,r),this._update(!0)):this}isSourceLoaded(a){return!!this._isValidId(a)&&!!this.style&&this.style._isSourceCacheLoaded(a)}areTilesLoaded(){return this.style.areTilesLoaded()}removeSource(a){return this._isValidId(a)?(this.style.removeSource(a),this._updateTerrain(),this._update(!0)):this}getSource(a){return this._isValidId(a)?this.style.getOwnSource(a):null}addImage(a,r,{pixelRatio:o=1,sdf:u=!1,stretchX:f,stretchY:m,content:g}={}){this._lazyInitEmptyStyle();const x=d.I.from(a);if(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){const{width:w,height:E,data:I}=d.e.getImageData(r);this.style.addImage(x,{data:new d.b({width:w,height:E},I),pixelRatio:o,stretchX:f,stretchY:m,content:g,sdf:u,version:0,usvg:!1})}else if(r.width===void 0||r.height===void 0)this.fire(new d.f(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:w,height:E}=r,I=r;this.style.addImage(x,{data:new d.b({width:w,height:E},new Uint8Array(I.data)),pixelRatio:o,stretchX:f,stretchY:m,content:g,sdf:u,usvg:!1,version:0,userImage:I}),I.onAdd&&I.onAdd(this,a)}}updateImage(a,r){this._lazyInitEmptyStyle();const o=d.I.from(a),u=this.style.getImage(o);
vendor: 4,798 bytes, lines 3415-3417
3415if(!u)return void this.fire(new d.f(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const f=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?d.e.getImageData(r):r,{width:m,height:g,data:x}=f;if(m===void 0||g===void 0)return void this.fire(new d.f(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==(u.usvg?u.icon.usvg_tree.width:u.data.width)||g!==(u.usvg?u.icon.usvg_tree.height:u.data.height))return void this.fire(new d.f(new Error(`The width and height of the updated image (${m}, ${g}) 3416 must be that same as the previous version of the image 3417 (${u.data.width}, ${u.data.height})`)));const w=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);let E=!1;u.usvg?(u.data=new d.b({width:m,height:g},new Uint8Array(x)),u.usvg=!1,u.icon=void 0,E=!0):u.data.replace(x,w),this.style.updateImage(o,u,E)}hasImage(a){return a?!!this.style&&!!this.style.getImage(d.I.from(a)):(this.fire(new d.f(new Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(d.I.from(a))}loadImage(a,r){(async()=>{const o=await this._requestManager.transformRequest(a,d.R.Image),{data:u}=await d.a(o);return u})().then(o=>r(null,o)).catch(r)}listImages(){return this.style.listImages().map(a=>a.name)}addModel(a,r){this._lazyInitEmptyStyle(),this.style.addModel(a,r)}hasModel(a){return a?this.style.hasModel(a):(this.fire(new d.f(new Error("Missing required model id"))),!1)}removeModel(a){this.style.removeModel(a)}listModels(){return this.style.listModels()}addLayer(a,r){return this._isValidId(a.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(a,r),this._update(!0)):this}getSlot(a){const r=this.getLayer(a);return r&&r.slot||null}setSlot(a,r){return this.style.setSlot(a,r),this.style.mergeLayers(),this._update(!0)}addImport(a,r){return this._isValidId(a.id)?(this.style.addImport(a,r).catch(o=>this.fire(new d.f(new Error("Failed to add import",o)))),this):this}updateImport(a,r){return typeof r!="string"&&r.id!==a?(this.removeImport(a),this.addImport(r)):(this.style.updateImport(a,r),this._update(!0))}removeImport(a){return this.style.removeImport(a),this}moveImport(a,r){return this.style.moveImport(a,r),this._update(!0)}moveLayer(a,r){return this._isValidId(a)?(this.style.moveLayer(a,r),this._update(!0)):this}removeLayer(a){return this._isValidId(a)?(this.style.removeLayer(a),this._update(!0)):this}getLayer(a){if(!this._isValidId(a))return null;const r=this.style.getOwnLayer(a);return r?r.type==="custom"?r.implementation:r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(a,r,o){return this._isValidId(a)?(this.style.setLayerZoomRange(a,r,o),this._update(!0)):this}setFilter(a,r,o={}){return this._isValidId(a)?(this.style.setFilter(a,r,o),this._update(!0)):this}getFilter(a){return this._isValidId(a)?this.style.getFilter(a):null}setPaintProperty(a,r,o,u={}){return this._isValidId(a)?(this.style.setPaintProperty(a,r,o,u),this._update(!0)):this}getPaintProperty(a,r){return this._isValidId(a)?this.style.getPaintProperty(a,r):null}setLayoutProperty(a,r,o,u={}){return this._isValidId(a)?(this.style.setLayoutProperty(a,r,o,u),this._update(!0)):this}getLayoutProperty(a,r){return this._isValidId(a)?this.style.getLayoutProperty(a,r):null}getLayerProperty(a,r){return this._isValidId(a)?this.style.getLayerProperty(a,r):null}setLayerProperty(a,r,o,u={}){return this._isValidId(a)?(r==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(a,r,o,u),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(a){return this.style.setGlyphsUrl(a),this._update(!0)}getSchema(a){return this.style.getSchema(a)}setSchema(a,r){return this.style.setSchema(a,r),this._update(!0)}getConfig(a){return this.style.getConfig(a)}setConfig(a,r){return this.style.setConfig(a,r),this._update(!0)}getConfigProperty(a,r){return this.style.getConfigProperty(a,r)}setConfigProperty(a,r,o){return this.style.setConfigProperty(a,r,o),this._update(!0)}getFeaturesetDescriptors(a){return this.style.getFeaturesetDescriptors(a)}setLights(a){if(this._lazyInitEmptyStyle(),a&&a.length===1&&a[0].type==="flat"){const r=a[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(a),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const a=this.style.getLights()||[];return a.length===0&&a.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),a}setLight(a,r={}
vendor: 5,032 bytes, line 3417
3417){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:a}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(a){return this._lazyInitEmptyStyle(),!a&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(a),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(a){return this._lazyInitEmptyStyle(),this.style.setFog(a),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(a){return this._lazyInitEmptyStyle(),this.style.setSnow(a),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(a){return this._lazyInitEmptyStyle(),this.style.setRain(a),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(a){return this._lazyInitEmptyStyle(),this.style.setColorTheme(a),this._update(!0)}setImportColorTheme(a,r){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(a,r),this._update(!0)}setCamera(a){return this.style.setCamera(a),this._triggerCameraUpdate(a)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(a){const r=this.transform.nearClipOffset!==a;return this.transform.nearClipOffset=a,this._update(r)}_triggerCameraUpdate(a){return this._update(this.transform.setOrthographicProjectionAtLowPitch(a["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(a){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(d.cz.convert(a),this.transform):0}setFeatureState(a,r){return a.source&&!this._isValidId(a.source)?this:(this.style.setFeatureState(a,r),this._update())}removeFeatureState(a,r){return a.source&&!this._isValidId(a.source)?this:(this.style.removeFeatureState(a,r),this._update())}getFeatureState(a){return a.source&&!this._isValidId(a.source)?null:this.style.getFeatureState(a)}resetFeatureStates(a){return this.style.resetFeatureStates(a),this._update()}_selectIndoorFloor(a){this.style.indoorManager&&this.style.indoorManager.selectFloor(a)}_setIndoorActiveFloorsVisibility(a){this.style.indoorManager&&this.style.indoorManager.setActiveFloorsVisibility(a)}getIndoorTileOptions(a,r){return this.style&&this.style.isIndoorEnabled()&&this.style.indoorManager?this.style.indoorManager.getIndoorTileOptions(a,r):null}_updateContainerDimensions(){if(!this._container)return;const a=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300;let o,u,f,m=this._container;for(;m&&(!u||!f);){const g=window.getComputedStyle(m).transform;g&&g!=="none"&&(o=g.match(Vp)[1].split(", "),o[0]&&o[0]!=="0"&&o[0]!=="1"&&(u=o[0]),o[3]&&o[3]!=="0"&&o[3]!=="1"&&(f=o[3])),m=m.parentElement}this._containerWidth=u?Math.abs(a/u):a,this._containerHeight=f?Math.abs(r/f):r}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&d.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(){const a=this._container;a.classList.add("mapboxgl-map"),(this._missingCSSCanary=si("div","mapboxgl-canary",a)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=si("div","mapboxgl-canvas-container",a);this._canvas=si("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);const o=this._controlContainer=si("div","mapboxgl-control-container",a),u=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(f=>{u[f]=si("div",`mapboxgl-ctrl-${f}`,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(a,r){const o=d.e.devicePixelRatio||1;this._canvas.width=o*Math.ceil(a),this._canvas.height=o*Math.ceil(r),this._canvas.style.width=`${a}px`,this._canvas.style.height=`${r}px`}_addMarker(a){this._markers.push(a)}_removeMarker(a){const r=this._markers.indexOf(a);r!==-1&&this._markers.splice(r,1)}_addPopup(a){this._popups.push(a)}_removePopup(a){const r=this._popups.indexOf(a);r!==-1&&this._popups.splice(r,1)}_setupPainter(){const a={...L,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}
vendor: 6,180 bytes, line 3417
3417,r=this._canvas.getContext("webgl2",a);r?(d.eR(r,!0),this.painter=new mo(r,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",o=>{if(o.dataType==="source"){const u=this.transform.elevation?this.transform.elevation._source():null;u&&o.sourceCacheId===u.id&&this.style&&this.style._setLabelPlacementStale(),this.style&&o.sourceCacheId&&this.style._buildingIndex.hasLayerForSourceCache(o.sourceCacheId)&&this.style._requestFullLabelPlacement(),this.painter.setTileLoadedFlag(!0)}})):this.fire(new d.f(new Error("Failed to initialize WebGL")))}_contextLost(a){a.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.style&&this.style.handleContextLost(),this.fire(new d.h("webglcontextlost",{originalEvent:a}))}_contextRestored(a){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 d.h("webglcontextrestored",{originalEvent:a}))}_onMapScroll(a){if(a.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(a){return this.style?(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_requestDomTask(a){!this.loaded()||this.loaded()&&!this.isMoving()?a():this._domRenderTaskQueue.add(a)}_render(a){let r;this.fire(new d.h("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,u=d.e.now(),f=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=f.createQuery(),f.beginQuery(o.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(a),this._domRenderTaskQueue.run(a),this._removed)return;this._updateProjectionTransition();const m=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const w=this.transform.zoom,E=this.transform.pitch,I=d.e.now(),P=new d.ai(w,{now:I,fadeDuration:m,pitch:E,transition:this._loaded?this.style.transition:{duration:0,delay:0},worldview:this._worldview});this.style.update(P)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let g=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),g=this._updateAverageElevation(u),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):g=this._updateAverageElevation(u),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,this.painter.replacementSource,this._placementAlgorithm)),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:m,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming,paintStartTimeStamp:a}),this.fire(new d.h("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,d.eM.mark(d.eN.load),this.fire(new d.h("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._placementDirty&&this.style._releaseSymbolFadeTiles(),r){const w=d.e.now()-u;f.endQuery(o.TIME_ELAPSED_EXT),setTimeout(()=>{const E=f.getQueryParameter(r,f.QUERY_RESULT)/1e6;f.deleteQuery(r),this.fire(new d.h("gpu-timing-frame",{cpuTime:w,gpuTime:E}))},50)}if(this.listens("gpu-timing-layer")){const w=this.painter.collectGpuTimers();setTimeout(()=>{const E=this.painter.queryGpuTimers(w);this.fire(new d.h("gpu-timing-layer",{layerTimes:E}))},50)}if(this.listens("gpu-timing-deferred-render")){const w=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const E=this.painter.queryGpuTimeDeferredRender(w);this.fire(new d.h("gpu-timing-deferred-render",{gpuTime:E}))},50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty||g;if(x||this._repaint)this.triggerRepaint();else{const w=this.idle();if(w&&(g=this._updateAverageElevation(u,!0)),g)this.triggerRepaint();else{if(this._triggerFrame(!1),w&&(this.fire(new d.h("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const E=this._calculateSpeedIndex();this.fire(new d.h("speedindexcompleted",{speedIndex:E})),this.speedIndexTiming=!1}w&&this.style&&this.style.handleIdle()}}!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,d.eM.mark(d.eN.fullLoad),this._performanceMetricsCollection&&d.eS(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:this.painter.style.hasTerrain(),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())}
vendor: 8,920 bytes, line 3417
3417_forceMarkerAndPopupUpdate(a){for(const r of this._markers)a&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(const r of this._popups)!a||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(a,r=!1){const o=f=>(this.transform.averageElevation=f,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&o(0);const u=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(u||(r||a-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(a)){const f=this.transform.averageElevation;let m=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(m)?m=0:this._averageElevationLastSampledAt=a;const g=Math.abs(f-m);if(g>1){if(this._isInitialLoad||u)return this._averageElevation.jumpTo(m),o(m);this._averageElevation.easeTo(m,a,300)}else if(g>1e-4)return this._averageElevation.jumpTo(m),o(m)}return!!this._averageElevation.isEasing(a)&&o(this._averageElevation.getValue(a))}_isTokenExpired(){return this._tokenExpiration!=null&&Date.now()>this._tokenExpiration}_revokeAuth(){const a=this.painter.context.gl;d.eR(a,!1),this._logoControl instanceof Ch&&this._logoControl._updateLogo(),a&&a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new d.f(new 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/")))}_authenticate(){d.eT(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,a=>{a&&(a.message!==d.eU&&a.status!==401||this._revokeAuth())}),this._isTokenExpired()&&this._revokeAuth(),d.eV(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&d.eW(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&d.eX(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){d.eY(this._requestManager._customAccessToken)}_updateTerrain(){const a=this._isDragging();this.painter.updateTerrain(this.style,a)}_calculateSpeedIndex(){const a=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const o=this.painter.context.gl,u=o.createFramebuffer();function f(m){o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,m,0);const g=new Uint8Array(o.drawingBufferWidth*o.drawingBufferHeight*4);return o.readPixels(0,0,o.drawingBufferWidth,o.drawingBufferHeight,o.RGBA,o.UNSIGNED_BYTE,g),g}return o.bindFramebuffer(o.FRAMEBUFFER,u),this._canvasPixelComparison(f(a),r.canvasCopies.map(f),r.timeStamps)}_canvasPixelComparison(a,r,o){let u=o[1]-o[0];const f=a.length/4;for(let m=0;m<r.length;m++){const g=r[m];let x=0;for(let w=0;w<g.length;w+=4)g[w]===a[w]&&g[w+1]===a[w+1]&&g[w+2]===a[w+2]&&g[w+3]===a[w+3]&&(x+=1);u+=(o[m+2]-o[m+1])*(1-x/f)}return u}remove(){if(this._removed)return;this._hash&&this._hash.remove();for(const r of this._controls)r.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);const a=this.painter.context.gl.getExtension("WEBGL_lose_context");a&&a.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),d.eZ(this.painter.context.gl),d.e_.remove(),d.e$.remove(),this._removed=!0,this.fire(new d.h("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(a){this._renderNextFrame=this._renderNextFrame||a,this.style&&!this._frame&&(this._frame=d.e.frame(r=>{const o=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,o&&this._render(r)}))}_preloadTiles(a){const r=this.style?this.style.getSourceCaches():[];return d.bT(r,(o,u)=>o._preloadTiles(a,u),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,a&&jo(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(a){this._showParseStatus!==a&&(this._showParseStatus=a,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(a){this._showTerrainWireframe!==a&&(this._showTerrainWireframe=a,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(a){this._showLayers2DWireframe!==a&&(this._showLayers2DWireframe=a,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(a){this._showLayers3DWireframe!==a&&(this._showLayers3DWireframe=a,this._update())}get showElevationIdDebug(){return!!this.painter&&this.painter._debugParams.showElevationIdDebug}set showElevationIdDebug(a){this.painter&&this.painter._debugParams.showElevationIdDebug!==a&&(this.painter._debugParams.showElevationIdDebug=a,this.style&&a?this.style._reloadSources():this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(a){this._speedIndexTiming!==a&&(this._speedIndexTiming=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,a&&jo(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,a&&jo(),this.style&&a?this.style._reloadSources():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(a){this._showTileAABBs!==a&&(this._showTileAABBs=a,a&&this._update())}_setCacheLimits(a,r){d.f0(a,r)}get version(){return d.f1}},NavigationControl:class{constructor(a={}){this.options={...Rh,...a},this._container=si("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(d.aV(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",r=>{this._map&&this._map.zoomIn({},{originalEvent:r})}),si("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",r=>{this._map&&this._map.zoomOut({},{originalEvent:r})}),si("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(d.aV(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",r=>{const o=this._map;o&&(this.options.visualizePitch?o.resetNorthPitch({},{originalEvent:r}):o.resetNorth({},{originalEvent:r}))}),this._compassIcon=si("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const a=this._map;if(!a)return;const r=a.getZoom(),o=r===a.getMaxZoom(),u=r===a.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())}_rotateCompassArrow(){const a=this._map;if(!a)return;const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(a.transform.pitch*(Math.PI/180)
3417),.5)}) rotateX(${a.transform.pitch}deg) rotateZ(${a.transform.angle*(180/Math.PI)}deg)`:`rotate(${a.transform.angle*(180/Math.PI)}deg)`;a._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),a.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&a.on("pitch",this._rotateCompassArrow),a.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Eu(a,this._compass,this.options.visualizePitch)),this._container}onRemove(){const a=this._map;a&&(this._container.remove(),this.options.showZoom&&a.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&a.off("pitch",this._rotateCompassArrow),a.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(a,r){const o=si("button",a,this._container);return o.type="button",o.addEventListener("click",r),o}_setButtonTitle(a,r){if(!this._map)return;const o=this._map._getUIString(`NavigationControl.${r}`);a.setAttribute("aria-label",o),a.firstElementChild&&a.firstElementChild.setAttribute("title",o)}},GeolocateControl:class extends d.E{constructor(a={}){super();const r=navigator.geolocation;this.options={geolocation:r,...Xo,...a},d.aV(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=wh(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(a){return this._map=a,this._container=si("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),this._geolocationWatchID!==void 0&&(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(a){const r=(o=!!this.options.geolocation)=>{this._supportsGeolocation=o,a(o)};this._supportsGeolocation!==void 0?a(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(o=>r(o.state!=="denied")).catch(()=>r()):r()}_isOutOfMapMaxBounds(a){const r=this._map.getMaxBounds(),o=a.coords;return!!r&&(o.longitude<r.getWest()||o.longitude>r.getEast()||o.latitude<r.getSouth()||o.latitude>r.getNorth())}_setWatchState(a){this._watchState=a;const r=this._geolocateButton.classList;r.remove(...Fn);for(const o of Jd[a])r.add(wc(o))}_setButtonTitle(a){const r=this._map._getUIString(a);this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":this._setWatchState("ACTIVE_ERROR");break;case"BACKGROUND":this._setWatchState("BACKGROUND_ERROR")}}_onSuccess(a){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(a))return this._setErrorState(),this.fire(new d.h("outofmaxbounds",a)),this._updateMarker(),void this._finish();if(this._lastKnownPosition=a,this.options.trackUserLocation)switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._setWatchState(this.options.followUserLocation?"ACTIVE_LOCK":"BACKGROUND");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._setWatchState("BACKGROUND")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(a),this.options.followUserLocation&&(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(a),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new d.h("geolocate",{coords:a.coords,timestamp:a.timestamp,...a.toJSON?{toJSON:a.toJSON.bind(a)}:{}})),this._finish()}}_updateCamera(a){const r=new d.cz(a.coords.longitude,a.coords.latitude),o=a.coords.accuracy,u={bearing:this._map.getBearing(),...this.options.fitBoundsOptions};this._map.fitBounds(r.toBounds(o),u,{geolocateSource:!0})}_updateMarker(a){if(a){const r=new d.cz(a.coords.longitude,a.coords.latitude);this.options.showAccuracyCircle?this._accuracyCircleMarker.setLngLat(r).addTo(this._map):this._accuracyCircleMarker.remove(),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=a.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map.transform,r=d.dv(1,a._center.lat)*a.worldSize,o=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(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(a){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(
3417a.code===1)this._setWatchState("OFF"),this._geolocateButton.disabled=!0,this._setButtonTitle("GeolocateControl.LocationNotAvailable"),this._geolocationWatchID!==void 0&&this._clearWatch();else{if(a.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new d.h("error",{code:a.code,message:a.message,PERMISSION_DENIED:a.PERMISSION_DENIED,POSITION_UNAVAILABLE:a.POSITION_UNAVAILABLE,TIMEOUT:a.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const a=this.options.positionOptions.timeout;a&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},a))}_clearRequestTimeout(){this._requestTimeoutId!==void 0&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(a){this._map!==void 0&&(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=si("button","mapboxgl-ctrl-geolocate",this._container),si("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",a===!1?(d.w("Geolocation support is not available so the GeolocateControl will be disabled."),this._geolocateButton.disabled=!0,this._setButtonTitle("GeolocateControl.LocationNotAvailable")):this._setButtonTitle("GeolocateControl.FindMyLocation"),this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._createUserLocationMarkers(),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||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.originalEvent.type==="resize"||(this._setWatchState("BACKGROUND"),this.fire(new d.h("trackuserlocationend")))}),this.fire(new d.h("ready")))}_onDeviceOrientation(a){this._userLocationDotMarker&&(a.webkitCompassHeading?this._heading=a.webkitCompassHeading:a.absolute===!0&&(this._heading=-1*a.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return d.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._setWatchState("WAITING_ACTIVE"),this.fire(new d.h("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._setWatchState("OFF"),this.fire(new d.h("trackuserlocationend"));break;case"BACKGROUND":this._setWatchState("ACTIVE_LOCK"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new d.h("trackuserlocationstart"))}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let a;this._geolocateButton.classList.add(wc("waiting")),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(a={maximumAge:6e5,timeout:0},this._noTimeout=!0):(a=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,a),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(a){return this.options.followUserLocation=a??Xo.followUserLocation,this.options.trackUserLocation&&this._watchState!=="OFF"&&(this.options.followUserLocation?this._watchState!=="BACKGROUND"&&this._watchState!=="BACKGROUND_ERROR"||(this._setWatchState("ACTIVE_LOCK"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new d.h("trackuserlocationstart"))):this._watchState!=="ACTIVE_LOCK"&&this._watchState!=="ACTIVE_E
3417RROR"||(this._setWatchState("BACKGROUND"),this.fire(new d.h("trackuserlocationend")))),this}setShowAccuracyCircle(a){if(this.options.showAccuracyCircle=a??Xo.showAccuracyCircle,!this._accuracyCircleMarker)return this;if(this.options.showAccuracyCircle){if(this.options.showUserLocation&&this._lastKnownPosition){const{longitude:r,latitude:o,accuracy:u}=this._lastKnownPosition.coords;this._accuracy=u,this._accuracyCircleMarker.setLngLat(new d.cz(r,o)).addTo(this._map),this._updateCircleRadius()}}else this._accuracyCircleMarker.remove();return this}setShowUserHeading(a){return this.options.showUserHeading=a??Xo.showUserHeading,this._setup?(this.options.showUserHeading?this._geolocationWatchID!==void 0&&this._addDeviceOrientationListener():(this._removeDeviceOrientationListener(),this._heading=void 0,this._userLocationDotMarker&&this._updateMarkerRotation()),this):this}setFitBoundsOptions(a){return this.options.fitBoundsOptions=a??Xo.fitBoundsOptions,this}setShowUserLocation(a){return this.options.showUserLocation=a??Xo.showUserLocation,this._setup?(this.options.showUserLocation?(this._userLocationDotMarker||(this._createUserLocationMarkers(),this._map.on("zoom",this._onZoom)),!this._lastKnownPosition||this._watchState!==void 0&&this._watchState==="OFF"||this._updateMarker(this._lastKnownPosition)):(this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this._accuracyCircleMarker&&this._accuracyCircleMarker.remove()),this):this}_addDeviceOrientationListener(){const a=()=>{const r="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(r,this._onDeviceOrientation)};typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(r=>{r==="granted"&&a()}).catch(console.error):a()}_removeDeviceOrientationListener(){window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation)}_createUserLocationMarkers(){this._dotElement=si("div","mapboxgl-user-location"),this._dotElement.appendChild(si("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(si("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Dh({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=si("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Dh({element:this._circleElement,pitchAlignment:"map"})}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),this._removeDeviceOrientationListener(),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove(wc("waiting")),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Op,ScaleControl:class{constructor(a={}){this.options={...Qd,...a},d.aV(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const a=this.options.maxWidth||100,r=this._map,o=r._containerHeight/2,u=r._containerWidth/2-a/2,f=r.unproject([u,o]),m=r.unproject([u+a,o]),g=f.distanceTo(m);if(this.options.unit==="imperial"){const x=3.2808*g;x>5280?this._setScale(a,x/5280,"mile"):this._setScale(a,x,"foot")}else this.options.unit==="nautical"?this._setScale(a,g/1852,"nautical-mile"):g>=1e3?this._setScale(a,g/1e3,"kilometer"):this._setScale(a,g,"meter")}_setScale(a,r,o){this._map._requestDomTask(()=>{const u=function(m){const g=Math.pow(10,`${Math.floor(m)}`.length-1);let x=m/g;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:x>=1?1:function(w){const E=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*E)/E}(x),g*x}(r),f=u/r;this._container.innerHTML=o!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:o}).format(u):`${u} ${Yo[o]}`,this._container.style.width=a*f+"px"})}onAdd(a){return this._map=a,this._language=a.getLanguage(),this._container=si("div","mapboxgl-ctrl mapboxgl-ctrl-scale",a.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(a){this._language=a,this._update()}setUnit(a){this.options.unit=a,this._update()}},FullscreenControl:class{constructor(a={}){this._fullscreen=!1,a&&a.container&&(a.container instanceof HTMLElement?this._container=a.container:d.w("Full screen control 'container' must be a DOM element.")),d.aV(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(a){return this._map=a,this._container||(this._container=this._map.getContainer()),this._controlContainer=si("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",d.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(){const a=this._fullscreenButton=si("button","mapboxgl-ctrl-fullscreen",this._controlContainer);si("span","mapboxgl-ctrl-icon",a).setAttribute("aria-hidden","true"),a.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",a)}_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(){d.aV(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(a){return this._map=a,this._container=si("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._map.on("idle",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){const a=this._map.style.indoorManager;a.off("selector-update",this._onIndoorUpdate),a.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(a.getControlState()),this._map.off("idle",this._onStyleData)}}_createButton(a,r){const o=si("button",a,this._container);return o.type="button",o.addEventListener("click",r),o}_setButtonTitle(a,r){a.setAttribute("aria-label",r),a.textContent=r}onRemove(){this._container&&this._container.remove(),this._map&&(this._map.off("styledata",this._onStyleData),this._map.off("idle",this._onStyleData),this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(a){if(!a||!a.floors||a.floors.length===0)return this._model=a,void(this._container.style.display="none");const r=this._model;this._model=a,this._container.style.display="inline-block";const o=!r||r.floors.length!==a.floors.length||r.floors.some((u,f)=>u.id!==a.floors[f].id);if(o&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),a.selectedFloorId){if(a.selectedFloorId!==this._lastSelectedFloorId||o){const u=a.floors.findIndex(f=>f.id===a.selectedFloorId);if(u!==-1){const f=a.floors.length;let m,g;f<=5?(m=0,g=f-1):this._visibleFloorStart===0?(m=0,g=3):this._visibleFloorStart>=f-3?(m=f-3-1,g=f-1):(m=this._visibleFloorStart,g=this._visibleFloorStart+3-1),u<m?this._visibleFloorStart=u:u>g&&(this._visibleFloorStart=u-2)}}this._lastSelectedFloorId=a.selectedFloorId}this._render()}
vendor: 5,144 bytes, line 3417
3417_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";const a=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);si("span","mapboxgl-ctrl-icon",a).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||a.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(a);const r=this._model.floors,o=r.length;if(o<=5)return void r.forEach(g=>this._createFloorButton(g));const u=this._visibleFloorStart===0,f=this._visibleFloorStart>=o-3;if(u)this._createFloorButton(r[0]);else{const g=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);si("span","mapboxgl-ctrl-icon",g).setAttribute("aria-hidden","true"),this._container.appendChild(g)}let m=[];if(m=u?r.slice(1,4):f?r.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):r.slice(this._visibleFloorStart,this._visibleFloorStart+3),m.forEach(g=>this._createFloorButton(g)),f)this._createFloorButton(r[o-1]);else{const g=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);si("span","mapboxgl-ctrl-icon",g).setAttribute("aria-hidden","true"),this._container.appendChild(g)}}_createFloorButton(a){const r=this._createButton("mapboxgl-ctrl-level-button",()=>{const m=a.id;this._model&&this._model.selectedFloorId===m&&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(m))}),o=(a.name||"").trim(),u=a.zIndex.toString(),f=o?Array.from(o).slice(0,3).join(""):u;this._setButtonTitle(r,f),this._model&&this._model.activeFloorsVisible&&a.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--,this._visibleFloorStart===1&&(this._visibleFloorStart=0);const a=this._model&&this._model.floors||[];if(a.length>3){const r=a.length-3;this._visibleFloorStart===r-1&&(this._visibleFloorStart=r-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){const a=this._model.floors.length-3;this._visibleFloorStart<a&&(this._visibleFloorStart++,this._visibleFloorStart===1&&(this._visibleFloorStart=2),this._visibleFloorStart===a-1&&(this._visibleFloorStart=a),this._visibleFloorStart>a&&(this._visibleFloorStart=a),this._render())}}},Popup:class extends d.E{constructor(a){super(),this.options=Object.assign(Object.create(Tc),a),this._altitude=this.options.altitude,d.aV(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(a&&a.className?a.className.trim().split(Ko):[])}addTo(a){return this._map&&this.remove(),this._map=a,this.options.closeOnClick&&a.on("preclick",this._onClose),this.options.closeOnMove&&a.on("move",this._onClose),a.on("remove",this.remove),this._update(),a._addPopup(this),this._focusFirstElement(),this._trackPointer?(a.on("mousemove",this._onMouseEvent),a.on("mouseup",this._onMouseEvent),a._canvasContainer.classList.add("mapboxgl-track-pointer")):a.on("move",this._update),this.fire(new d.h("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const a=this._map;return a&&(a.off("move",this._update),a.off("move",this._onClose),a.off("preclick",this._onClose),a.off("click",this._onClose),a.off("remove",this.remove),a.off("mousemove",this._onMouseEvent),a.off("mouseup",this._onMouseEvent),a.off("drag",this._onMouseEvent),a._canvasContainer&&a._canvasContainer.classList.remove("mapboxgl-track-pointer"),a._removePopup(this),this._map=void 0),this.fire(new d.h("close")),this}getLngLat(){return this._lngLat}setLngLat(a){this._lngLat=d.cz.convert(a),this._pos=null,this._trackPointer=!1,this._update();const r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(a){return this._altitude=a,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const a=this._map;return a&&(a.off("move",this._update),a.on("mousemove",this._onMouseEvent),a.on("drag",this._onMouseEvent),a._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(a){return this.setDOMContent(document.createTextNode(a))}setHTML(a){const r=document.createDocumentFragment(),o=document.createElement("body");let u;for(o.innerHTML=a;u=o.firstChild,u;)r.appendChild(u);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=si("div","mapboxgl-popup-content",this._container||void 0);
3417if(r.appendChild(a),this.options.closeButton){const o=this._closeButton=si("button","mapboxgl-popup-close-button",r);o.type="button",o.setAttribute("aria-label","Close popup"),o.innerHTML='<span aria-hidden="true">×</span>',o.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(a){return this._classList.add(a),this._updateClassList(),this}removeClassName(a){return this._classList.delete(a),this._updateClassList(),this}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(a){let r;return this._classList.delete(a)?r=!1:(this._classList.add(a),r=!0),this._updateClassList(),r}_onMouseEvent(a){this._update(a.point)}_getAnchor(a){if(this.options.anchor)return this.options.anchor;const r=this._map,o=this._container,u=this._pos;if(!r||!o||!u)return"bottom";const f=o.offsetWidth,m=o.offsetHeight,g=u.x<f/2,x=u.x>r.transform.width-f/2;if(u.y+a<m)return g?"top-left":x?"top-right":"top";if(u.y>r.transform.height-m){if(g)return"bottom-left";if(x)return"bottom-right"}return g?"left":x?"right":"bottom"}_updateClassList(){const a=this._container;if(!a)return;const r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),a.className=r.join(" ")}_update(a){const r=this._map,o=this._content;if(!r||!this._lngLat&&!this._trackPointer||!o)return;let u=this._container;if(u||(u=this._container=si("div","mapboxgl-popup",r.getContainer()),this._tip=si("div","mapboxgl-popup-tip",u),u.appendChild(o)),this.options.maxWidth&&u.style.maxWidth!==this.options.maxWidth&&(u.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Kd(this._lngLat,this._pos,r.transform)),!this._trackPointer||a){const f=this._pos=this._trackPointer&&a instanceof d.P?a:r.project(this._lngLat,this._altitude),m=Il(this.options.offset),g=this._anchor=this._getAnchor(m.y),x=Il(this.options.offset,g),w=f.add(x).round();r._requestDomTask(()=>{this._container&&g&&(this._container.style.transform=`${Ph[g]} translate(${w.x}px,${w.y}px)`)})}if(!this._marker&&r._showingGlobe()){const f=d.f2(r.transform,this._lngLat)?0:1;this._setOpacity(f)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector(Sl);a&&a.focus()}_onClose(){this.remove()}_setOpacity(a){this._container&&(this._container.style.opacity=`${a}`),this._content&&(this._content.style.pointerEvents=a?"auto":"none")}},Marker:Dh,Style:Ra,LngLat:d.cz,LngLatBounds:d.eB,Point:d.P,MercatorCoordinate:d.bS,FreeCameraOptions:d.f8,Evented:d.E,config:d.eL,prewarm:function(){od().acquire(gt)},clearPrewarmedResources:function(){const a=oc;a&&(a.isPreloaded()&&a.numActive()===1?(a.release(gt),oc=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 d.eL.ACCESS_TOKEN},set accessToken(a){d.fm(a)},get baseApiUrl(){return d.eL.API_URL},set baseApiUrl(a){d.fl(a)},get workerCount(){return at.workerCount},set workerCount(a){(function(r){at.workerCount=r})(a)},get maxParallelImageRequests(){return d.eL.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(a){d.fk(a)},clearStorage(a){d.fj(a)},get workerUrl(){return nt.workerUrl},set workerUrl(a){nt.workerUrl=a},get workerClass(){return nt.workerClass},set workerClass(a){nt.workerClass=a},get dracoUrl(){return d.fi()},set dracoUrl(a){d.fh(a)},get meshoptUrl(){return d.fg()},set meshoptUrl(a){d.ff(a)},get buildingGenUrl(){return d.fe()},set buildingGenUrl(a){d.fd(a)},setNow:d.e.setNow,restoreNow:d.e.restoreNow}});var Pb=$a;return Pb})})(Cb);var Rb=Cb.exports;const kS=FS(Rb),VS=BS({__proto__:null,default:kS},[Rb]);export{kS as a,VS as m}; 3418//# sourceMappingURL=mapbox-gl-hTgpQtrM.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.